buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <bits/stdc++.h> using namespace std; int main() { int K = 0; string S; cin >> K >> S; if (S.size() <= K) cout << S; else { for (int i = 0; i < 7; i++) { cout << S.at(i); } cout << "..."; } }
#include <bits/stdc++.h> using namespace std; int main() { int K = 0; string S; cin >> K >> S; if (S.size() <= K) cout << S; else { for (int i = 0; i < K; i++) { cout << S.at(i); } cout << "..."; } }
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22]]
1
74
k = int(input()) s = input() s_2 = int(len(s)) if s_2 > k: tmp = s[k:] s = s[:k] a = ["." for i in range(s_2-k)] s += "".join(a) ans = s else: ans = s print(s)
k = int(input()) s = input() s_2 = int(len(s)) if s_2 > k: tmp = s[k:] s = s[:k] a = ["." for i in range(3)] s += "".join(a) ans = s else: ans = s print(s)
[["-", 0, 659, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 659, 12, 652, 3, 4, 0, 657, 12, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
78
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main() { int k; cin >> k; string s; cin >> s; int n = s.length(); if (k > n) { cout << s; } else if (k < n) { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..."; ...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main() { int k; cin >> k; string s; cin >> s; int n = s.length(); if (k >= n) { cout << s; } else if (k < n) { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..."; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
94
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> int main(void) { char s[120]; int k, sl, i; scanf("%d", &k); scanf("%s", s); sl = strlen(s); if (sl < k) { printf("%s", s); } else { for (i = 0; i < k; i++) { printf("%c", s[i]); } printf("..."); } return 0...
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> int main(void) { char s[120]; int k, sl, i; scanf("%d", &k); scanf("%s", s); sl = strlen(s); if (sl <= k) { printf("%s", s); } else { for (i = 0; i < k; i++) { printf("%c", s[i]); } printf("..."); } return ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
109
k = gets.to_i s = gets.chomp if s.size() < k puts s else puts s[0...k] + "..." end
k = gets.to_i s = gets.chomp if s.size() <= k puts s else puts s[0...k] + "..." end
[["-", 36, 36, 0, 493, 0, 121, 15, 738, 17, 18], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 19]]
4
33
#include <iostream> #include <string> using namespace std; int main() { string s; string ans; int x; cin >> x; cin >> s; int y; y = s.size(); int i; if (x > y) { x = y; } for (i = 0; i < x; i++) { ans.push_back(s.at(i)); } if (y >= x) { cout << ans << endl; } else { cout <...
#include <iostream> #include <string> using namespace std; int main() { string s; string ans; int x; cin >> x; cin >> s; int y; y = s.size(); int i; if (x > y) { x = y; } for (i = 0; i < x; i++) { ans.push_back(s.at(i)); } if (y <= x) { cout << ans << endl; } else { cout <...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
114
#include <bits/stdc++.h> #include <math.h> #define ll long long #define PI 3.14159265 using namespace std; const int MAX_CHAR = 26; const int MAX_FACT = 20; ll fact[MAX_FACT]; // utility for calculating factorials void precomputeFactorials() { fact[0] = 1; for (ll i = 1; i < MAX_FACT; i++) { fact[i] = fact[i ...
#include <bits/stdc++.h> #include <math.h> #define ll long long #define PI 3.14159265 using namespace std; const int MAX_CHAR = 26; const int MAX_FACT = 20; ll fact[MAX_FACT]; // utility for calculating factorials void precomputeFactorials() { fact[0] = 1; for (ll i = 1; i < MAX_FACT; i++) { fact[i] = fact[i ...
[["+", 8, 1, 0, 16, 12, 69, 341, 342, 0, 70], ["+", 8, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 8, 1, 0, 16, 12, 69, 341, 342, 0, 73]]
1
273
#include <stdio.h> #include <string.h> char s[100005]; int main() { int t; scanf("%d", t); scanf(" "); scanf("%s", s); if (t >= strlen(s)) puts(s); else { s[t] = '\0'; printf("%s", s); puts("..."); } return 0; }
#include <stdio.h> #include <string.h> char s[1005]; int main() { int t; scanf("%d", &t); scanf(" "); scanf("%s", s); if (t >= strlen(s)) puts(s); else { s[t] = '\0'; printf("%s", s); puts("..."); } return 0; }
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
0
89
#include <bits/stdc++.h> using namespace std; #define Maxn 110 int k; char str[Maxn]; int main() { scanf("%d", &k); scanf("%s", str + 1); int len = strlen(str + 1); if (len >= k) { for (int i = 1; i <= k; i++) printf("%c", str[i]); puts("..."); } else { printf("%s\n", str + 1); } }
#include <bits/stdc++.h> using namespace std; #define Maxn 110 int k; char str[Maxn]; int main() { scanf("%d", &k); scanf("%s", str + 1); int len = strlen(str + 1); if (len > k) { for (int i = 1; i <= k; i++) printf("%c", str[i]); puts("..."); } else { printf("%s\n", str + 1); } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
111
#include <bits/stdc++.h> using namespace std; size_t length(const string &str) { return str.length(); } int main() { int K; cin >> K; string S; cin >> S; int s = length(S); if (s <= K) { cout << S << endl; } else { S.erase(0, K); S.append("..."); cout << S << endl; } }
#include <bits/stdc++.h> using namespace std; size_t length(const string &str) { return str.length(); } int main() { int K; cin >> K; string S; cin >> S; int s = length(S); if (s <= K) { cout << S << endl; } else { string A = S.substr(0, K); A.append("..."); cout << A << endl; } }
[["+", 0, 57, 75, 76, 0, 9, 0, 43, 39, 78], ["+", 75, 76, 0, 9, 0, 43, 49, 50, 49, 22], ["+", 75, 76, 0, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 0, 43, 49, 50, 51, 2, 63, 118, 119, 120], ["-", 0, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 0, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["-", 0, 9, 0...
1
92
#include <stdio.h> int main(void) { char S[100]; int K, count = 0; scanf("%d", &K); scanf("%s", S); for (int i = 0; S[i] != '\0'; i++) { count++; } if (count < K) { printf("%s", S); } else { for (int i = 0; i < K; i++) { printf("%c", S[i]); } printf("..."); } return 0;...
#include <stdio.h> int main(void) { char S[200]; int K, count = 0; scanf("%d", &K); scanf("%s", S); for (int i = 0; S[i] != '\0'; i++) { count++; } if (count <= K) { printf("%s", S); } else { for (int i = 0; i < K; i++) { printf("%c", S[i]); } printf("..."); } return 0...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
123
K = int(input()) S = input() if len(S) <= K: print(S) else: s = [S[:7]] print(s[0]+'...')
K = int(input()) S = input() if len(S) <= K: print(S) else: s = [S[:K]] print(s[0]+'...')
[["-", 0, 662, 12, 634, 0, 206, 206, 663, 0, 612], ["+", 0, 662, 12, 634, 0, 206, 206, 663, 0, 22]]
5
47
import java.util.Scanner; import java.util.ServiceConfigurationError; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); String s = sc.next(); if (s.length() < k) { } else { StringBuilder sb = new StringBuilder(); ...
import java.util.Scanner; import java.util.ServiceConfigurationError; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); String s = sc.next(); if (s.length() <= k) { } else { StringBuilder sb = new StringBuilder(); ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19]]
3
123
#include <bits/stdc++.h> using namespace std; int main() { string S, x; int K; cin >> K; cin >> S; if (S.size() <= K) { cout << S << endl; } else { x == S.erase(K) + "..."; cout << x << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { string S, x; int K; cin >> K; cin >> S; if (S.size() <= K) { cout << S << endl; } else { x = S.erase(K) + "..."; cout << x << endl; } }
[["-", 75, 76, 0, 9, 0, 1, 0, 16, 17, 60], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32]]
1
68
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <new> #include <vector> using namespace std; int main() { int K; cin >> K; string S; cin >> S; int N = S.length(); if (K <= N) { for (int i = 0; i < K; ++i) ...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <new> #include <vector> using namespace std; int main() { int K; cin >> K; string S; cin >> S; int N = S.length(); if (K < N) { for (int i = 0; i < K; ++i) {...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
101
#include <bits/stdc++.h> using namespace std; #define ll long long const int MOD = 1e9 + 7; #define INF 2e9 #define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i) #define REP(i, n) REPS(i, 0, n) #define RREP(i, n) REPS(i, 1, n + 1) #define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i) #define DEP(i, n) DEPS(i,...
#include <bits/stdc++.h> using namespace std; #define ll long long const int MOD = 1e9 + 7; #define INF 2e9 #define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i) #define REP(i, n) REPS(i, 0, n) #define RREP(i, n) REPS(i, 1, n + 1) #define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i) #define DEP(i, n) DEPS(i,...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
243
#include <bits/stdc++.h> using namespace std; int main() { unsigned int K; string S; cin >> K >> S; if (K >= S.size()) { cout << S << endl; } if (K < S.size()) { cout << S.substr(1, K) + "..." << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { unsigned int K; string S; cin >> K >> S; if (K >= S.size()) { cout << S << endl; } if (K < S.size()) { cout << S.substr(0, K) + "..." << endl; } }
[["-", 31, 16, 12, 16, 31, 2, 3, 4, 0, 13], ["+", 31, 16, 12, 16, 31, 2, 3, 4, 0, 13]]
1
72
#include <bits/stdc++.h> using namespace std; int main() { unsigned int K, i; string S; cin >> K >> S; if (S.size() < K) { cout << S << endl; } else { for (i = 0; i < K; i++) { cout << S.at(i); } cout << "..." << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { unsigned int K, i; string S; cin >> K >> S; if (S.size() <= K) { cout << S << endl; } else { for (i = 0; i < K; i++) { cout << S.at(i); } cout << "..." << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
80
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k; cin >> s; if (k <= s.size()) { cout << s << "\n"; } else { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..." << "\n"; }; }
#include <bits/stdc++.h> using namespace std; int main() { int k; string s; cin >> k; cin >> s; if (k >= s.size()) { cout << s << "\n"; } else { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..." << "\n"; }; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
83
K=int(input()) S=str(input()) if len(S) <= K: print(S) elif len(S) > K: print(S[0:int(K)])
K=int(input()) S=str(input()) if len(S) <= K: print(S) elif len(S) > K: print(S[0:int(K)]+"...")
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 657, 12, 557, 0, 654], ["+", 0, 652, 3, 4, 0, 657, 12, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 12, 557, 0, 655]]
5
48
import sys import math def solution(): k=int(input()) s=input() if(k>len(s)): print(s) else: print(s[:k]+"...") if __name__ == "__main__": solution()
import sys import math def solution(): k=int(input()) s=input() if(len(s)<=k): print(s) else: print(s[:k]+"...") if __name__ == "__main__": solution()
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 0, 22], ["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 47], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 19], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 0, 22]]
5
60
#include <algorithm> #include <bits/stdc++.h> #include <functional> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int k; string s, subs; cin >> k; cin >> s; if ((int)(s.size()) <= k) { cout << s << endl; } else { subs = s.substr(0, k - 1); cout << sub...
#include <algorithm> #include <bits/stdc++.h> #include <functional> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int k; string s, subs; cin >> k; cin >> s; if ((int)(s.size()) <= k) { cout << s << endl; } else { subs = s.substr(0, k); cout << subs + ...
[["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
87
n = int(input()) #print('n=',n) m = input() #print('m=',m) o = len(m) #print('o=',o) if o <= n: print(m) elif o > n: print(m[0:n],'...')
n = int(input()) #print('n=',n) m = input() #print('m=',m) o = len(m) #print('o=',o) if o <= n: print(m) elif o > n: print(m[0:n],'...',sep='')
[["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 654], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 655]]
5
49
K = int(input()) S = input() s = int(len(S)) tmp = [] if s < K: print(S) else: for i in range(K): tmp.append(S[i]) tmp.append("...") #print(tmp) print("".join(map(str, tmp)))
K = int(input()) S = input() s = int(len(S)) tmp = [] if s <= K: print(S) else: for i in range(K): tmp.append(S[i]) tmp.append("...") #print(tmp) print("".join(map(str, tmp)))
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
78
import sys val = input() input_str = input() if 0 > int(val) or int(val) > 100: sys.exit() if 0 > len(input_str) or len(input_str) > 100: sys.exit() if int(val) >= len(input_str): print(input_str) else: new_str = input_str[0:7] print(new_str + '...')
import sys val = input() input_str = input() if 0 > int(val) or int(val) > 100: sys.exit() if 0 > len(input_str) or len(input_str) > 100: sys.exit() if int(val) >= len(input_str): print(input_str) else: new_str = input_str[0:int(val)] print(new_str + '...')
[["-", 0, 1, 0, 662, 12, 206, 206, 663, 0, 612], ["+", 0, 662, 12, 206, 206, 663, 0, 652, 63, 22], ["+", 12, 206, 206, 663, 0, 652, 3, 4, 0, 24], ["+", 12, 206, 206, 663, 0, 652, 3, 4, 0, 22], ["+", 12, 206, 206, 663, 0, 652, 3, 4, 0, 25]]
5
85
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int K = sc.nextInt(); String S = sc.next(); if (S.length() <= K) System.out.println(S); else System.out.println(S.substring(0, 1) + "..."); } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int K = sc.nextInt(); String S = sc.next(); // System.out.println(S.length()); if (S.length() <= K) System.out.println(S); else System.out.println(S.substring(0, K...
[["-", 3, 4, 0, 16, 31, 492, 3, 4, 0, 499], ["+", 3, 4, 0, 16, 31, 492, 3, 4, 0, 22]]
3
92
K = int(input()) S = input() if len(S) > K: for i in range(0,K): print(S[i], end="") print("") else: print(S)
K = int(input()) S = input() if len(S) > K: for i in range(0,K): print(S[i], end="") print("...") else: print(S)
[["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
54
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef long long ll; typedef vector<ll> ve; int main() { ll i, n, j, t; cin >> n; cin.ignore(); string s; getline(cin, s); if (s.length() <= n) cout << s << endl; else { s.resize(7); s += "..."; cout << s << endl; } }
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef long long ll; typedef vector<ll> ve; int main() { ll i, n, j, t; cin >> n; cin.ignore(); string s; getline(cin, s); if (s.length() <= n) cout << s << endl; else { s.resize(n); s += "..."; cout << s << endl; } }
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
93
#include <bits/stdc++.h> using namespace std; int main() { int k; cin >> k; string s; cin >> s; long long a = s.size(); if (a < k + 1) { cout << s << endl; } else { for (int i = 0; i < 7; i++) { cout << s.at(i); } cout << "..." << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int k; cin >> k; string s; cin >> s; long long a = s.size(); if (a < k + 1) { cout << s << endl; } else { for (int i = 0; i < k; i++) { cout << s.at(i); } cout << "..." << endl; } return 0; }
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 12, 22]]
1
91
K=int(input()) S=input() if len(S)<K: print(S) else: text=S[0:K] text=text+"..." print(text)
K=int(input()) S=input() if len(S)<=K: print(S) else: text=S[0:K] text=text+"..." print(text)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
46
k = int(input()) s = input() con1 = k >= 1 and k <= 100 con2 = len(s) >= 1 and len(s) <= 100 con3 = s.islower() == True and con2 == True if con1 == True and con3 == True: if k <= len(s): newstring = s[0:k] + "..." print(newstring) else: print(s) else: print()
k = int(input()) s = input() con1 = k >= 1 and k <= 100 con2 = len(s) >= 1 and len(s) <= 100 con3 = s.islower() == True and con2 == True if con1 == True and con3 == True: if k < len(s): newstring = s[0:k] + "..." print(newstring) else: print(s) else: print()
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 18]]
5
94
#include <bits/stdc++.h> using namespace std; int main() { string s; int k, ans; cin >> k >> s; ans = s.size(); if (ans < k) { cout << s << endl; } else { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..." << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { string s; int k, ans; cin >> k >> s; ans = s.size(); if (ans <= k) { cout << s << endl; } else { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..." << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
82
try: k=int(input()) s=input() if len(s)>k: print(s[0:7]+"...") else: print(s) except: pass
try: k=int(input()) s=input() if len(s)>k: print(s[0:k]+"...") else: print(s) except: pass
[["-", 3, 4, 0, 657, 31, 206, 206, 663, 0, 612], ["+", 3, 4, 0, 657, 31, 206, 206, 663, 0, 22]]
5
45
#include <bits/stdc++.h> using namespace std; int main() { string str; int length; cin >> length >> str; if (str.size() < length) { cout << str << endl; } else { cout << str.substr(0, length) << "..." << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { string str; int length; cin >> length >> str; if (str.size() <= length) { cout << str << endl; } else { cout << str.substr(0, length) << "..." << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
62
///بِسْمِ الّٰلهِ الرَّحْمٰنِ الرَحِيْمِ #include <bits/stdc++.h> using namespace std; #define ll long long #define pi acos(-1.0) int main() { int t, m, l, i, n, k; string s, sub, sd; cin >> k >> s; if (k > s.size()) { cout << s << endl; } else { sub = s.substr(0, k); cout << sub << "..." << endl...
///بِسْمِ الّٰلهِ الرَّحْمٰنِ الرَحِيْمِ #include <bits/stdc++.h> using namespace std; #define ll long long #define pi acos(-1.0) int main() { int t, m, l, i, n, k; string s, sub, sd; cin >> k >> s; if (k >= s.size()) { cout << s << endl; } else { sub = s.substr(0, k); cout << sub << "..." << end...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
90
K=int(input()) S=input() n=len(S) if n<=K: print(S) else: for i in range(7): print(S[i],end="") print("...")
K=int(input()) S=input() n=len(S) if n<=K: print(S) else: for i in range(K): print(S[i],end="") print("...")
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
56
k = int(input()) s = input() listS = list(s) if len(s) < k: print(s) else: print(''.join(listS[0:k])+'...')
k = int(input()) s = input() listS = list(s) if len(s) <= k: print(s) else: print(''.join(listS[0:k])+'...')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
52
in_str = input() in_str2 = input() if (not in_str.isnumeric()) : print("error: 1st arg must be integer") exit() num = int(in_str) str = in_str2 str_len = len(in_str2) if num > 100 : print("error: 1st arg must be under 100") exit() if str_len> 100 : print("error: size of 2nd arg must be under 100"...
in_str = input() in_str2 = input() if (not in_str.isnumeric()) : print("error: 1st arg must be integer") exit() num = int(in_str) str = in_str2 str_len = len(in_str2) if num > 100 : print("error: 1st arg must be under 100") exit() if str_len> 100 : print("error: size of 2nd arg must be under 100"...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
96
k = int(input()) s = list(input()) if k == len(s): print(''.join(s)) else: l = [] for i in range(k): l.append(s[i]) l.append('...') m = ''.join(l) print(m)
k = int(input()) s = list(input()) if k >= len(s): print(''.join(s)) else: l = [] for i in range(k): l.append(s[i]) l.append('...') m = ''.join(l) print(m)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
78
#include <stdio.h> #include <string.h> int main(void) { int K; char S[100 + 2]; scanf("%d%*c", &K); fgets(S, sizeof(S), stdin); S[strlen(S) - 1] = '\0'; if (K > strlen(S)) { printf("%s\n", S); } else { for (int i = 0; i < K; i++) { printf("%c", S[i]); } printf("...\n"); } ret...
#include <stdio.h> #include <string.h> int main(void) { int K; char S[100 + 2]; scanf("%d%*c", &K); fgets(S, sizeof(S), stdin); S[strlen(S) - 1] = '\0'; if (K >= strlen(S)) { printf("%s\n", S); } else { for (int i = 0; i < K; i++) { printf("%c", S[i]); } printf("...\n"); } re...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20]]
0
121
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main(int argc, char const *argv[]) { cin.tie(0); ios::sync_with_stdio(false); ll K; cin >> K; string S; cin >> S; if (S.size() <= K) cout << S << endl; else { cout << S.subst...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) typedef long long ll; int main(int argc, char const *argv[]) { cin.tie(0); ios::sync_with_stdio(false); ll K; cin >> K; string S; cin >> S; if (S.size() <= K) cout << S << endl; else { cout << S.subst...
[["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 22]]
1
101
k = int(input()) s = [] s = str(input()) if len(s)<= k: print(s) else: print(s[0:k],'...')
k = int(input()) s = [] s = str(input()) if len(s)<= k: print(s) else: print(s[0:k]+'...')
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]]
5
47
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int mod = 1000000000 + 7; int main() { int k; string s; cin >> k >> s; int count; if (k <= s.length()) count = k; else count = s.length(); for (int i = 0; i < count; i++) ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int mod = 1000000000 + 7; int main() { int k; string s; cin >> k >> s; int count; if (k < s.size()) count = k; else count = s.size(); for (int i = 0; i < count; i++) cou...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 15, 339, 51, 16, 12, 2, 63, 118, 119, 120], ["+", 15, 339, 51, 16, 12, 2, 63, 118, 119, 120], ["-", 0, 1, 0, 11, 12, 2, 63, 118, 119, 120], ["+", 0, 1, 0, 11, 12, 2, 63, 118, 119, 120]]
1
115
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K; cin >> S; int size; size = S.length(); if (K >= size) { cout << S << endl; } if (K <= size) { string subS = S.substr(0, K); cout << subS << "..." << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int K; string S; cin >> K; cin >> S; int size; size = S.length(); if (K >= size) { cout << S << endl; } if (K < size) { string subS = S.substr(0, K); cout << subS << "..." << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
81
#include <bits/stdc++.h> using namespace std; int main() { int a; string s; cin >> a >> s; if (s.size() < a) cout << s; else { for (int i = 0; i < a; i++) cout << s[i]; cout << "..." << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int a; string s; cin >> a >> s; if (s.size() <= a) cout << s; else { for (int i = 0; i < a; i++) cout << s[i]; cout << "..." << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
70
#include <bits/stdc++.h> using namespace std; typedef long long unsigned int ll; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) #define rep(i, start, end) for (int i = start; i < (int)(end); ++i) int main() { int k; cin >> k; string s; cin >> s; if (s.size() < k) { cout << s << endl; } else ...
#include <bits/stdc++.h> using namespace std; typedef long long unsigned int ll; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) #define rep(i, start, end) for (int i = start; i < (int)(end); ++i) int main() { int k; cin >> k; string s; cin >> s; if (s.size() <= k) { cout << s << endl; } else...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
117
K = int(input()) S = list(input()) if len(S) > K: print("".join(S[:7])+"...") else: print("".join(S))
K = int(input()) S = list(input()) if len(S) > K: print("".join(S[:K])+"...") else: print("".join(S))
[["-", 31, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 31, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
54
string_list = [input() for i in range(2)] if int(string_list[0]) > len(str(string_list[1])): print(string_list[1]) else: print(str(string_list[1])[: int(string_list[0])] + "...")
string_list = [input() for i in range(2)] if int(string_list[0]) >= len(str(string_list[1])): print(string_list[1]) else: print(str(string_list[1])[: int(string_list[0])] + "...")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20]]
5
67
s=[] k=int(input()) s=list(input()) if len(s)>k: for i in range(k): print(s[i], end="") print("...") else: print(s)
s=[] k=int(input()) s=list(input()) if len(s)>k: for i in range(k): print(s[i], end="") print("...") else: print(''.join(s))
[["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 654], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 655], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
60
#include <bits/stdc++.h> using namespace std; int main() { string s; int k; cin >> k; cin >> s; int nagasa; nagasa = s.size(); if (nagasa < k) { cout << s << endl; } else { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..." << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { string s; int k; cin >> k; cin >> s; int nagasa; nagasa = s.size(); if (nagasa <= k) { cout << s << endl; } else { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..." << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
85
<?php fscanf(STDIN,"%d",$k); $string = trim(fgets(STDIN)); if(strlen($string) <= $k ){ echo $string; }else{ $new_str = substr($string,0,7); echo $new_str.'...'; }
<?php fscanf(STDIN,"%d",$k); $string = trim(fgets(STDIN)); if(strlen($string) <= $k ){ echo $string; }else{ $new_str = substr($string,0,$k); echo $new_str.'...'; }
[["-", 0, 11, 12, 613, 3, 3, 0, 28, 0, 612], ["+", 12, 613, 3, 3, 0, 28, 0, 606, 0, 607], ["+", 12, 613, 3, 3, 0, 28, 0, 606, 0, 141]]
6
65
k=int(input()) s=input() if(len(s)<k): print(s) else: print(s[:7]+"...")
k=int(input()) s=input() if(len(s)<=k): print(s) else: print(s[:k]+"...")
[["-", 0, 656, 0, 57, 15, 23, 0, 666, 667, 18], ["+", 0, 656, 0, 57, 15, 23, 0, 666, 667, 19], ["-", 3, 4, 0, 657, 31, 206, 206, 663, 0, 612], ["+", 3, 4, 0, 657, 31, 206, 206, 663, 0, 22]]
5
41
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #includ...
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #includ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 75, 76, 0, 9, 0, 14, 8, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
515
#include <iostream> #include <string> using namespace std; int main() { int k; cin >> k; string s; cin >> s; if (k <= s.size()) { for (int i = 0; i < k; i++) cout << s[i]; cout << "..." << endl; } else { cout << s << endl; } return 0; }
#include <iostream> #include <string> using namespace std; int main() { int k; cin >> k; string s; cin >> s; if (k < s.size()) { for (int i = 0; i < k; i++) cout << s[i]; cout << "..." << endl; } else { cout << s << endl; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
81
import java.util.*; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int k = scan.nextInt(); String s = scan.next(); if (s.length() <= k) { System.out.println(s); } else { String n = s.substring(0, k + 1).concat("..."); Syst...
import java.util.*; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int k = scan.nextInt(); String s = scan.next(); if (s.length() <= k) { System.out.println(s); } else { String n = s.substring(0, k).concat("..."); System.o...
[["-", 51, 492, 500, 492, 3, 4, 0, 16, 17, 72], ["-", 51, 492, 500, 492, 3, 4, 0, 16, 12, 499]]
3
107
k = int(input()) s = str(input()) if k >= len(s): ans = s else: rest = len(s) - k ans = s[0:k] + '.'*rest print(ans)
k = int(input()) s = str(input()) if k >= len(s): ans = s else: rest = len(s) - k ans = s[0:k] + '...' print(ans)
[["-", 0, 662, 12, 657, 12, 657, 31, 557, 0, 6], ["+", 0, 1, 0, 662, 12, 657, 12, 557, 0, 6], ["-", 0, 1, 0, 662, 12, 657, 12, 657, 17, 48], ["-", 0, 1, 0, 662, 12, 657, 12, 657, 12, 22]]
5
55
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) int main(void) { int k; string s; cin >> k >> s; if (s.size() <= k) { cout << s << endl; } else { rep(i, k) { cout << s.at(i); } cout << e...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) int main(void) { int k; string s; cin >> k >> s; if (s.size() <= k) { cout << s << endl; } else { rep(i, k) { cout << s.at(i); } cout << "...
[["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151]]
1
88
k = input() k = int(k) s = input() if len(s) < k: print(s) else: s = s[:k] print(str(s)+"...")
k = input() k = int(k) s = input() if len(s) <= k: print(str(s)) else: s = s[:k] print(str(s)+"...")
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
48
#include <iostream> #include <string> using namespace std; int main() { int K; string S; cin >> K >> S; int size = S.length(); string ANS = S; if (size > K) { ANS = S.substr(1, K) + "..."; } cout << ANS << endl; }
#include <iostream> #include <string> using namespace std; int main() { int K; string S; cin >> K >> S; int size = S.length(); string ANS = S; if (size > K) { ANS = S.substr(0, K) + "..."; } cout << ANS << endl; }
[["-", 0, 11, 12, 16, 31, 2, 3, 4, 0, 13], ["+", 0, 11, 12, 16, 31, 2, 3, 4, 0, 13]]
1
69
#include <bits/stdc++.h> using namespace std; int main() { string S, X; int K; cin >> K >> S; if (S.size() <= K) { cout << S << endl; } if (S.size() > K) { for (int i = 0; i < K; i++) { X += S.at(i); } } cout << X + "..." << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string S, X; int K; cin >> K >> S; if (S.size() <= K) { cout << S << endl; } if (S.size() > K) { for (int i = 0; i < K; i++) { X += S.at(i); } cout << X + "..." << endl; } }
[["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
91
k = int(input()) s = str(input()) n = len(s) - k print(s[:-k-1]+'...' if n>0 else s)
k = int(input()) s = str(input()) n = len(s) - k print(s[:k]+'...' if n>0 else s)
[["-", 31, 206, 206, 663, 0, 657, 31, 664, 17, 33], ["-", 0, 657, 31, 206, 206, 663, 0, 657, 17, 33], ["-", 0, 657, 31, 206, 206, 663, 0, 657, 12, 612]]
5
45
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; string S; cin >> S; if (S.size() <= K) cout << S << endl; else { for (int i = 0; i <= K; i++) cout << S[i]; cout << "..." << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; string S; cin >> S; if (S.size() <= K) cout << S << endl; else { for (int i = 0; i < K; i++) cout << S[i]; cout << "..." << endl; } return 0; }
[["-", 75, 76, 0, 9, 0, 7, 15, 16, 17, 19], ["+", 75, 76, 0, 9, 0, 7, 15, 16, 17, 18]]
1
77
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define test ...
#include <bits/stdc++.h> using namespace std; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define test ...
[["-", 0, 30, 0, 14, 8, 9, 0, 14, 49, 22], ["+", 0, 1, 0, 191, 51, 83, 0, 22, 0, 46], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
94
#include <bits/stdc++.h> #define ll long long #define rep(i, a, n) for (int i = a; i <= n; i++) #define per(i, n, a) for (int i = n; i >= a; i--) #define endl '\n' #define mem(a, b) memset(a, b, sizeof(a)) #define IO \ ios::sync_with_stdio(false); ...
#include <bits/stdc++.h> #define ll long long #define rep(i, a, n) for (int i = a; i <= n; i++) #define per(i, n, a) for (int i = n; i >= a; i--) #define endl '\n' #define mem(a, b) memset(a, b, sizeof(a)) #define IO \ ios::sync_with_stdio(false); ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18]]
1
174
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); String s = sc.next(); int n = s.length(); if (n <= k) System.out.println(s); else System.out.println(s.substring(0, k + 1) ...
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); String s = sc.next(); int n = s.length(); if (n <= k) System.out.println(s); else System.out.println(s.substring(0, k) + "....
[["-", 0, 16, 31, 492, 3, 4, 0, 16, 17, 72], ["-", 0, 16, 31, 492, 3, 4, 0, 16, 12, 499]]
3
107
#include <bits/stdc++.h> using namespace std; int main() { int input; cin >> input; string str; cin >> str; string result; if (input > str.size()) { result = str; } else { result = str.substr(0, input) + "..."; } cout << result << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int input; cin >> input; string str; cin >> str; string result; if (input >= str.size()) { result = str; } else { result = str.substr(0, input) + "..."; } cout << result << endl; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
72
#include <bits/stdc++.h> #include <string> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int k; cin >> k; string a, p; cin >> a; int b; b = a.size(); if (k >= b) { cout << a << endl; } else { p = a.substr(1, k); cout << p << "..." << endl; } retur...
#include <bits/stdc++.h> #include <string> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int k; cin >> k; string a, p; cin >> a; int b; b = a.size(); if (k >= b) { cout << a << endl; } else { p = a.substr(0, k); cout << p << "..." << endl; } retur...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13]]
1
92
k = gets.to_i s = gets.chomp string = s.split("") result = [] if string.length >= k (0...k).each do |i| result << string[i] end puts result.join("") + "..." else puts s end
k = gets.to_i s = gets.chomp string = s.split("") result = [] if string.length > k (0...k).each do |i| result << string[i] end puts result.join("") + "..." else puts s end
[["-", 36, 36, 0, 493, 0, 121, 15, 738, 17, 20], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 47]]
4
63
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; string S; cin >> S; if (S.size() <= K) { cout << K; } else { string split = S.erase(K); cout << split << "..."; } }
#include <bits/stdc++.h> using namespace std; int main() { int K; cin >> K; string S; cin >> S; if (S.size() <= K) { cout << S; } else { string split = S.erase(K); cout << split << "..."; } }
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]]
1
63
K=int(input()) S=input() B = list(S) L = len(S) if L < K : print(S) else: B=B[0:K] B= ''.join(B) print(B+'...')
K=int(input()) S=input() B = list(S) L = len(S) if L <= K : print(S) else: B=B[0:K] B= ''.join(B) print(B+'...')
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
61
#include <bits/stdc++.h> using namespace std; int main() { int K, N; string S; cin >> K; cin >> S; N = S.size(); if (K > N) { cout << S << endl; return 0; } if (K <= N) { for (int i = 0; i < K; i++) { cout << S.at(i); if (i == K - 1) { cout << "..." << endl; } ...
#include <bits/stdc++.h> using namespace std; int main() { int K, N; string S; cin >> K; cin >> S; N = S.size(); if (K >= N) { cout << S << endl; return 0; } if (K < N) { for (int i = 0; i < K; i++) { cout << S.at(i); if (i == K - 1) { cout << "..." << endl; } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
104
K = gets.chomp.to_i S = gets.chomp if K >= S.length puts S else p S[0..(K-1)]. + '...' end
K = gets.chomp.to_i S = gets.chomp if K >= S.length puts S else puts S[0..(K-1)]. + '...' end
[["-", 0, 493, 0, 121, 75, 95, 0, 652, 735, 22], ["+", 0, 493, 0, 121, 75, 95, 0, 652, 735, 22]]
4
38
k = int(input()) s = input() if len(s) <= k: print(s) else: print("...{}".format(s[:k]))
k = int(input()) s = input() if len(s) <= k: print(s) else: print("{}...".format(s[:k]))
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
42
#include <bits/stdc++.h> using namespace std; int main() { unsigned int k; string s; cin >> k >> s; if (s.size() <= k) cout << s << endl; if (s.size() > k) { for (int i = 0; i < k; i++) { cout << s.at(i); if (i == k - 1) { cout << "…" << endl; } } } }
#include <bits/stdc++.h> using namespace std; int main() { unsigned int k; string s; cin >> k >> s; if (s.size() <= k) cout << s << endl; if (s.size() > k) { for (int i = 0; i < k; i++) { cout << s.at(i); if (i == k - 1) { cout << "..." << endl; } } } }
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
96
k = int(input()) s = input() l = len(list(s)) if l <=k: print(s) else: t = s+"..." print(t)
k = int(input()) s = input() n = len(list(s)) if n <= k: print(s) else: t = s[:k]+"..." print(t)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 0, 1, 0, 662, 12, 657, 31, 206, 0, 70], ["+", 0, 662, 12, 657, 31, 206, 206, 663, 0, 102], ["+", 0, 662, 12, 657, 31, 206, 206, 663...
5
44
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cmath> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iostream> // cout, endl, cin #include <map> // map #in...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cmath> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iostream> // cout, endl, cin #include <map> // map #in...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
140
#include <bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int K; cin >> K; string x; cin >> x; if (sz(x) < K) { cout << x << "\n"; } else { cout << x.substr(0, K) << "..." << "\n"; } }
#include <bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int K; cin >> K; string x; cin >> x; if (sz(x) <= K) { cout << x << "\n"; } else { cout << x.substr(0, K) << "..." << "\n"; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
94
#include "bits/stdc++.h" using namespace std; #define rep(i, a, b) for (int i = (a); i < (b); i++) int main() { int k; string a; cin >> k >> a; if (k > a.size()) { cout << a << endl; } if (k < a.size()) { rep(i, 0, k) { cout << a.at(i); } cout << "..." << endl; } }
#include "bits/stdc++.h" using namespace std; #define rep(i, a, b) for (int i = (a); i < (b); i++) int main() { int k; string a; cin >> k >> a; if (k >= a.size()) { cout << a << endl; } if (k < a.size()) { rep(i, 0, k) { cout << a.at(i); } cout << "..." << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
94
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<long long> vecll; typedef vector<string> vecstr; #define rep0(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++) #define rep(i, a, b) for (ll i = (ll)a; i <= (ll)(b); i++) #define rep0r(i, n) fo...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<long long> vecll; typedef vector<string> vecstr; #define rep0(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++) #define rep(i, a, b) for (ll i = (ll)a; i <= (ll)(b); i++) #define rep0r(i, n) fo...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
456
K=gets.chomp.to_i S=gets.chomp.strip.to_s s_len = S.length s_array = [] if K > s_len puts S else s_array = S.chars s_tmp = s_array[0..K-1].inject(:+) s_tmp << '...' puts s_tmp end
K=gets.chomp.to_i S=gets.chomp.strip.to_s s_len = S.length s_array = [] if K >= s_len puts S else s_array = S.chars s_tmp = s_array[0..K-1].inject(:+) s_tmp << '...' puts s_tmp end
[["-", 36, 36, 0, 493, 0, 121, 15, 738, 17, 47], ["+", 36, 36, 0, 493, 0, 121, 15, 738, 17, 20]]
4
60
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int K; string S; cin >> K >> S; if (K > S.size()) { cout << S; return 0; } else { for (int i = 0; i < K; i++) { cout << S[i]; } cout << "..."; return 0; } }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int K; string S; cin >> K >> S; if (K >= S.size()) { cout << S; return 0; } else { for (int i = 0; i < K; i++) { cout << S[i]; } cout << "..."; return 0; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
84
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long #define ull unsigned long long #define si set<ll> #define vi vector<ll> #define mii map<ll, ll> #define vpi vector<pair<ll, ll>> #define sz(c) (int)c.size() #define fr first #define ll long long #define fastio ...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long #define ull unsigned long long #define si set<ll> #define vi vector<ll> #define mii map<ll, ll> #define vpi vector<pair<ll, ll>> #define sz(c) (int)c.size() #define fr first #define ll long long #define fastio ...
[["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 22]]
1
135
#include <bits/stdc++.h> using namespace std; #ifndef LOCAL #define fprintf \ if (false) \ fprintf #endif #define debug_int(x) fprintf(stderr, "%s = %d\n", #x, x) #define debug_double(x)...
#include <bits/stdc++.h> using namespace std; #ifndef LOCAL #define fprintf \ if (false) \ fprintf #endif #define debug_int(x) fprintf(stderr, "%s = %d\n", #x, x) #define debug_double(x)...
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
1
139
if __name__=="__main__": # Problem B K = input() S = input() K_len = int(K) S_len = len(S) if S_len < K_len: print(S) else: print(S[:K_len]+str("..."))
if __name__=="__main__": # Problem B K = input() S = input() K_len = int(K) S_len = len(S) if S_len <= K_len: print(S) else: print(S[:K_len]+str("..."))
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 19]]
5
56
k = int(input()) s = str(input()) s_len = len(s) if s_len > k: k_short = str(s[0:7]+"...") print(k_short) else: print(s)
k = int(input()) s = str(input()) s_len = len(s) if s_len > k: k_short = str(s[0:k]+"...") print(k_short) else: print(s)
[["-", 3, 4, 0, 657, 31, 206, 206, 663, 0, 612], ["+", 3, 4, 0, 657, 31, 206, 206, 663, 0, 22]]
5
52
/* Dsingh_24 */ #include <bits/stdc++.h> #define ll long long #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (ll int)x.size() #define hell 1000000007 #define rep(i, a, b) for (ll int ...
/* Dsingh_24 */ #include <bits/stdc++.h> #define ll long long #define pb push_back #define endl '\n' #define pii pair<ll int, ll int> #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define sz(x) (ll int)x.size() #define hell 1000000007 #define rep(i, a, b) for (ll int ...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
154
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) typedef long long ll; typedef pair<int, int> P; typedef pair<long long, long long> Pll; typedef vector<int> vi; typedef vector<ll> vll; const long long mod = 1000000007LL; int ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) typedef long long ll; typedef pair<int, int> P; typedef pair<long long, long long> Pll; typedef vector<int> vi; typedef vector<ll> vll; const long long mod = 1000000007LL; int ...
[["-", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22]]
1
144
K = int(input()) S = list(input()) print(''.join(S) if len(S) <= K else ''.join(S[:7]) + '...')
K = int(input()) S = list(input()) print(''.join(S) if len(S) <= K else ''.join(S[:K]) + '...')
[["-", 31, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 31, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
49
n = int(input()) s = input() ans = "" if len(s) >= n: ans = s[0:(n)] + "..." else: ans = s print(ans)
n = int(input()) s = input() ans = "" if len(s) > n: ans = s[0:(n)] + "..." else: ans = s print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 20], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
48
#include <bits/stdc++.h> using namespace std; int main() { int64_t K; string S; cin >> K >> S; int64_t s_size = S.size(); if (s_size <= K) { cout << S << endl; } else { cout << S.erase(7) << "..." << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int64_t K; string S; cin >> K >> S; int64_t s_size = S.size(); if (s_size <= K) { cout << S << endl; } else { cout << S.erase(K) << "..." << endl; } }
[["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 22]]
1
65
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define rep(i, a, b) for (int i = a; i < b; ++i) #define rrep(i, a, b) for (int i = a; i >= b; --i) #define fore(i, a) for (auto &i :...
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define rep(i, a, b) for (int i = a; i < b; ++i) #define rrep(i, a, b) for (int i = a; i >= b; --i) #define fore(i, a) for (auto &i :...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
627
#include <bits/stdc++.h> using namespace std; int main(void) { int k; string s; cin >> k >> s; int size = s.size(); if (size <= k) { cout << s << endl; } else { string output = s.substr(1, k); cout << output; cout << "..." << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main(void) { int k; string s; cin >> k >> s; int size = s.size(); if (size <= k) { cout << s << endl; } else { string output = s.substr(0, k); cout << output; cout << "..." << endl; } return 0; }
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13]]
1
78
#!/usr/bin/env python3 import sys def solve(K: int, S: str): if (len(S) <= K): print(S) else: print(K[0:K+1], "...", sep='') return # Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custo...
#!/usr/bin/env python3 import sys def solve(K: int, S: str): if (len(S) <= K): print(S) else: print(S[0:K], "...", sep='') return # Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom ...
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["-", 3, 4, 0, 206, 206, 663, 0, 657, 17, 72], ["-", 3, 4, 0, 206, 206, 663, 0, 657, 12, 612]]
5
119
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <string.h> using namespace std; int main() { string s; int k; scanf("%d\n", &k); getline(cin, s); // printf("%d",s.size()); if (k <= s.size()) { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "..."...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <string.h> using namespace std; int main() { string s; int k; scanf("%d\n", &k); getline(cin, s); // printf("%d",s.size()); if (k < s.size()) { for (int i = 0; i < k; i++) { cout << s[i]; } cout << "...";...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
93
k=int(input()) s=input() print(s if len(s)<=k else s[0:k+1]+"...")
k=int(input()) s=input() print(s if len(s)<=k else s[0:k]+"...")
[["-", 0, 657, 31, 206, 206, 663, 0, 657, 17, 72], ["-", 0, 657, 31, 206, 206, 663, 0, 657, 12, 612]]
5
37
K=int(input()) S=input() a=len(S) if a<=K: print(S) else: print(S[:K]+"."*(a-K))
K=int(input()) S=input() a=len(S) if a<=K: print(S) else: print(S[:K]+"."*3)
[["-", 3, 4, 0, 657, 12, 657, 12, 23, 0, 24], ["-", 0, 657, 12, 657, 12, 23, 0, 657, 31, 22], ["-", 0, 657, 12, 657, 12, 23, 0, 657, 17, 33], ["-", 0, 657, 12, 657, 12, 23, 0, 657, 12, 22], ["-", 3, 4, 0, 657, 12, 657, 12, 23, 0, 25], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 12, 612]]
5
48
K = int(input()) S = input() if len(S) > K: S = S[:K] + '...' print(a)
K = int(input()) S = input() if len(S) > K: S = S[:K] + '...' print(S)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
36
k = input() s = input() if len(s) <= int(k): print(s) else: print(s[0:k] + "...")
k = input() s = input() if len(s) <= int(k): print(s) else: print(s[0:int(k)] + "...")
[["+", 0, 657, 31, 206, 206, 663, 0, 652, 63, 22], ["+", 31, 206, 206, 663, 0, 652, 3, 4, 0, 24], ["+", 31, 206, 206, 663, 0, 652, 3, 4, 0, 25]]
5
40
# -*- coding: utf-8 -*- K = int(input()) S = input() print("{}{}".format(S[:6+1], '...' if len(S) > K else ''))
# -*- coding: utf-8 -*- K = int(input()) S = input() print("{}{}".format(S[:K], '...' if len(S) > K else ''))
[["-", 3, 4, 0, 206, 206, 663, 0, 657, 31, 612], ["-", 3, 4, 0, 206, 206, 663, 0, 657, 17, 72], ["-", 3, 4, 0, 206, 206, 663, 0, 657, 12, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 22]]
5
45
k=int(input()) s=str(input()) ss = list(s) if len(s) <= k : print(s) else: ss = ss[0:len(s)-k] print(''.join(ss)+"...")
k=int(input()) s=str(input()) ss = list(s) if len(s) <= k : print(s) else: ss = ss[0:k] print(''.join(ss)+"...")
[["-", 12, 206, 206, 663, 0, 657, 31, 652, 63, 22], ["-", 206, 663, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 206, 663, 0, 657, 31, 652, 3, 4, 0, 22], ["-", 206, 663, 0, 657, 31, 652, 3, 4, 0, 25], ["-", 0, 662, 12, 206, 206, 663, 0, 657, 17, 33]]
5
63