akhauriyash/Code-Regression huggingface dataset:
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);
    let W = read![[i64]];

    let S = W.iter().sum::<i64>();
    let mut min_diff = std::i64::MAX;

    for T in 1..N {
        let S1 = W.iter().take(T).sum::<i64>();
        let S2 = S - S1;
        min_diff = min(min_diff, (S1 - S2).abs());
    }
    println!("{}", min_diff)
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define itn int

long long int GCD(long long int a,long long int b){long long int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
using namespace std;

int main() {
  int a,b;
  cin >> a >> b;
  if(a==b){
    cout << a+b << endl;
  }
  else if(a>b){
    cout << a+a-1 << endl;
  }
  else{
    cout << b+b-1 << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

int main() {
string s;
cin >> s;
int ans =0;
int che =0;
for(int i=0;i<s.size();i++){
    if(i%2==0){
        if(s.at(i)=='1')ans++;
    }
    else{
        if(s.at(i)=='0')ans++;
    }
}
for(int i=0;i<s.size();i++){
    if(i%2==0){
        if(s.at(i)=='0')che++;
    }
    else{
        if(s.at(i)=='1')che++;
    }
}
    ans=min(ans,che);
    cout << ans <<endl;
}




Measured memory_bytes: 512
#include<stdio.h>
int main(void){
    int  a, b;
    scanf("%d %d",&a,&b);
    if(a < b){
        printf("a < b\n");
    }
    else if(a > b){
        printf("a > b\n");
    }
    else{
        printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 2084
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<math.h>
#include<complex>

using namespace std;


//ユークリッドの互除法　a,bは最大公約数を求めたい２つの数
long long int gcd(long long int a, long long int b) {
             long long int tmp;
             long long int r = 1;
             if (b > a) {
                           tmp = a;
                           a = b;
                           b = tmp;
             }
             r = a % b;
             while (r != 0) {
 
 
                           a = b;
                           b = r;
                           r = a % b;
 
             }
             return b;
}

const long long int mod=1000000007;
int main(){
	cout << fixed << setprecision(18);
	long long int n,m,k,t,a[201000],res=0,l,r;
	string str;
	cin>>str>>n;
	for(int i=0;i<str.length();i+=n){
		cout<<str[i];
	}
	
}


Measured memory_bytes: 256
# coding: utf-8


def solve(*args: str) -> str:
    _ = int(args[0])
    D = list(map(int, args[1].split()))

    max_d = max(D)

    nodes = [0]*(max_d+1)
    for d in D:
        nodes[d] += 1

    ret = 0
    if D[0] == 0 and nodes.count(0) == 0 and nodes[0] == 1:
        ret = 1
        for i in range(2, max_d+1):
            ret *= pow(nodes[i-1], nodes[i], 998244353)

    return str(ret % 998244353)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 14596
using System;
 
namespace _4_C
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string[] x = Console.ReadLine().Split();
                int a = Int32.Parse(x[0]);
                int b = Int32.Parse(x[2]);
                if (x[1] == "+")
                {
                    Console.WriteLine(a + b);
                }
                else if (x[1] == "-")
                {
                    Console.WriteLine(a - b);
                }
                else if (x[1] == "*")
                {
                    Console.WriteLine(a * b);
                }
                else if (x[1] == "/")
                {
                    Console.WriteLine(a / b);
                }
                else
                {
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 9168
#include <bits/stdc++.h>

using namespace std;
#define rep(i, l, r) for (int i = l; i<r;i++)
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define pb(c) push_back(c)
#define vii vector<pair<int,int>>
#define ii pair<int,int>
#define max(a, b) (((a)<(b))?b:a)
#define min(a, b) ((a>b)?b:a)
#define mp(i, j) make_pair(i,j)
#define ull unsigned long long int
#define ll  long long int
#define pi 3.141592653589793238
#define inf ((ll)1e18)
#define eps 1e-14
#define mod ((int)1e9+7)
#define maxlg 18
#define left(i) ((i)<<1)
#define right(i) (((i)<<1)+1)
#define maxn 200006
set<int> close[26];
string s;
int tree[maxn];
vii t;
bool comp (ii a,ii b) {
    return a.first < b.first;
}
int read(int idx){
    int sum = 0;
    while (idx > 0){
        sum += tree[idx];
        idx -= (idx & -idx);
    }
    return sum;
}
void update(int idx ,int val){
    while (idx < maxn){
        tree[idx] += val;
        idx += (idx & -idx);
    }
}
int arr[maxn];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
 #endif
    cin >> s;
    rep (i, 0, s.length()) {
        close[s[i] - 'a'].insert(i);
    }
    ll cost = 0;
    int oddPos =-1;
    rep (j,0,26) {
        while (close[j].size()>1) {
            int f = *close[j].begin();
            int l = *(--close[j].end());
            t.push_back(mp(f,l));
            close[j].erase(f);
            close[j].erase(l);
        }
        if (close[j].size()==1 && oddPos==-1)
            oddPos = *close[j].begin();
        else if (close[j].size()==1) {
            cout<<-1;
            return 0;
        }
    }
    sort(all(t));
    rep (i,0,t.size()) {
        int p1 = t[i].first;
        int p2 = t[i].second;
        int actPos = i;
        int act2 = s.length()-1-actPos;
        arr[p1] = actPos;
        arr[p2] = act2;
    }
    if (s.length()&1) {
         arr[oddPos]=s.length()/2;
    }
    ll ans=0;
    for (int i=s.length()-1;i>=0;i--) {
        int a = arr[i];
        cost += read(a+1);
        update(a+1,1);
    }
    cout << cost ;


    return 0;
}

Measured memory_bytes: 12428
N = int(input())
s = []
for i in range(N):
  tmp = list(input())
  tmp.sort()				# ソート
  s.append(''.join(tmp))	# 文字列の結合
s.sort()

i, j = 0, 1
count = 0
total = 0
while j < N:
  while s[i] == s[j]:
    count += 1
    j += 1
    if j == N:
      break
  
  if count >= 1:
    tmp1, tmp2 = 1, 2
    for k in range(count+1, count+1-2, -1):
      tmp1 *= k
    total += int(tmp1/tmp2)
  i = j
  j += 1
  count = 0
print(total)


Measured memory_bytes: 16532
#include"bits/stdc++.h"
using namespace std;

string s;
long long int result = 0;

void dfs(int i, long long int tmp, long long int sum) {
  if (i == s.length() - 1) {
    result += sum + tmp * 10 + s[i] - '0';
    return;
  }

  dfs(i + 1, tmp * 10 + s[i] - '0', sum);
  dfs(i + 1, 0, tmp * 10 + sum + s[i] - '0');
}

void Main() {
  cin >> s;

  dfs(0, 0, 0);
  cout << result << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
fun main() {
    val l = readLine()!!.split(' ').map { it.toLong() }
    val a = readLine()!!.split(' ').map { it.toInt() }
    val visited: MutableSet<Int> = mutableSetOf(0)
    val list: MutableList<Int> = mutableListOf(0)

    var x = 0
    var loopStartAt = 0
    for (i in 0 until l[1]) {
        x = a[x]-1
        if (visited.add(x)) {
            list.add(x)
        } else {
            loopStartAt = list.indexOf(x)
            break
        }
    }

    val res = if (l[1] < list.size) {
        list.last()
    } else {
        list.subList(loopStartAt, list.size)[((l[1]-loopStartAt)%(list.size-loopStartAt)).toInt()]
    }
    println(res+1)
}


Measured memory_bytes: 77624
#include <bits/stdc++.h>
#include <map>
using namespace std;
int main(void){
   int N;
   cin >> N;
   vector<int> p(N);
   for(int i = 0; i < N; i++) cin >> p[i];
   int C = 0;
   int S = 0;
   for(int i = 0; i < N; i++){
       if(p[i] == i+1){
           C++;
       if(i != N-1 && p[i+1] == i+2){
            C++;
            S++;
            i++;
           }
       }
       //cout << C << " " << S << endl;
   }
   cout << C-S << endl;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;

int main() {
	//input
	int A, B;
	cin >> A >> B;

	//calculation
	for (int i = 1; i <= 1000; ++i) {
		int tempA = i * 0.08;
		int tempB = i * 0.1;
		if (tempA == A && tempB == B) {
			cout << i << endl;
			return 0;
		}
	}

	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e3 + 5, M = 1e4 + 5, mod = 1e9 + 7;

int dp[N][M], mark[N][M], n, h, dam[N], cost[N];

ll solve(int idx, int kam){
    if(kam <= 0) return 0;
    if(idx == n) return 1e9;
    if(mark[idx][kam]) return dp[idx][kam];
    mark[idx][kam] = 1;
    int op1 = cost[idx] + solve(idx, kam - dam[idx]);
    int op2 = solve(idx + 1, kam);
    return dp[idx][kam] = min(op1, op2);
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> h >> n;
    for(int i = 0; i < n; i++){
        cin >> dam[i] >> cost[i];
    }
    cout << solve(0, h);

    return 0;
}


Measured memory_bytes: 81808
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> VI;
typedef vector<long long int> VLLI;
typedef vector<pair<int, int> > VPI;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll, ll> PLL;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

int main() {
    int n;
    cin >> n;
    while (n > 0) {
        if (n%10 == 7) {
            cout << "Yes" << "\n";
            return 0;
        }
        n /= 10;
    }
    cout << "No" << "\n";
}



Measured memory_bytes: 3636
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
       int K = sc.nextInt();
//       String S = sc.next();
//       char[] c = S.toCharArray();
       
       long[] a = new long[(int)N];
       for (int i=0 ; i<N; i++) {
           a[i] = sc.nextLong();
       }
       
       long ans=0;
       for(int i=0;i<K+1;i++) {
    	   for(int j=0;j<K-i+1;j++) {
    	       long[] m = new long[N];
    		   if(i+j>N)continue;
    		   int d=K-i-j;
    		   long now=0;
    		   int cnt=0;
    		   for(int l=0;l<i;l++) {
    			   m[cnt]=a[l];
    			   now=now+a[l];
    			   cnt++;
    		   }
    		   for(int r=0;r<j;r++) {
    			   m[cnt]=a[a.length-r-1];
    			   now=now+a[a.length-r-1];
    			   cnt++;
    		   }
    		   Arrays.sort(m);
    		   for(int n=0;n<d;n++) {
    			   if(m[n]>=0)break;
    			   now=now-m[n];
    		   }
    		   ans=Math.max(ans, now);
    		   
    	   }
       }
 
       System.out.println(ans);
   }
      

}

Measured memory_bytes: 25140
#include <stdio.h>

int main()
{
    int a[4];
    int i;
    int s,d;
    for (i = 0; i < 4; i++) a[i] = 0;
    for (i = 0; i < 3; i++) {
	scanf("%d %d", &s, &d);
	a[s-1]++;
	a[d-1]++;
    }
    for (i = 0; i < 4; i++) {
	if (a[i] > 2) {
	    printf("NO\n");
	    return 0;
	}
    }
    printf("YES\n");
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int x1,x2,x3,x4,x5;
    scanf("%d%d%d%d%d",&x1,&x2,&x3,&x4,&x5);
    if(x1==0)
    {
        printf("1");
    }
    
     else if(x2==0)
    {
        printf("2");
    }
    
    
    else  if(x3==0)
    {
        printf("3");
    }
    
     else if(x4==0)
    {
        printf("4");
    }
    
    
     else if(x5==0)
    {
        printf("5");
    }
    return 0;
    
    
    
}

Measured memory_bytes: 1664
import math
from functools import reduce


def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n=int(input())
l1=range(1,n+1)
l2=range(1,n+1)
l3=range(1,n+1)

count=0

for i in l1:
    for j in l2:
        te=math.gcd(i,j)
        for k in l3:
            count+=math.gcd(te,k)

print(count)

Measured memory_bytes: 9580
using System;

namespace cf16e
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            long n = long.Parse(input[0]);
            long a = long.Parse(input[1]);

            long answer = n;
            for (int i = 2; i <= 39; ++i)
            {
                long x = FindPowerNth(n, i);
                if (x <= 1) break;
                long c = PowerN(x, i);
                int j;
                for (j = 0; c < n; ++j) c = c / x * (x + 1);
                long ans = (x * i + j) + a * (i - 1);
                if (answer > ans) answer = ans;
            }

            Console.WriteLine(answer);
        }

        static long FindPowerNth(long n, int i)
        {
            if (n < (1L << i)) return 1;
            long x = (long)Math.Pow(n, 1 / (double)i);
            while (PowerN(x, i) <= n) ++x;
            return x - 1;
        }

        static long PowerN(long n, int i)
        {
            long x = n;
            for (int ii = 1; ii < i; ++ii) x *= n;
            return x;
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a;i<b;i++)
#define vi vector<int>
#define vii vector<ll>
#define all(x) x.begin(),x.end()
#define mod 1000000007
#define pb push_back
#define ii pair<int,int>
#define iii pair<ll,ll>
#define MAX 10000000000000
#define pi 3.1415926535
typedef long long ll;
vi dp;
int solve(int u, vector<vi> &adj) {
    if(dp[u]!=-1)
        return dp[u];

    int ans = -1;
    if((int)adj[u].size()==0) {
        dp[u] = 0;
        return 0;
    }
    
    for(auto it: adj[u]) {
        ans = max(ans, solve(it, adj));
    } 
    dp[u] = ans+1;
    return ans+1;
}
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    vector<vi> adj(n+1);
    vi indeg(n+1,0);
    dp.resize(n+1,-1);
    f(i,0,m) {
        int u,v;
        cin>>u>>v;
        adj[u].pb(v);
        indeg[v]++;
    }

    int ans = -1;

    f(i,1,n+1) {
        if(indeg[i]==0) {
            ans = max(ans, solve(i, adj));
        }
    }
    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 11264
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
using namespace std;

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  vector<int> v;
  v = {a,
       b,
       c};
  sort(v.begin(), v.end());
  if ((v[0] == v[1] && v[1] != v[2]) || (v[0] != v[1] && v[1] == v[2]))
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    itn n; cin>>n;
    vector <double> a(n); 
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    double tmp = 0;
    rep(i,n){
        if(i==0) continue;
        if(i==1) tmp = (a[i] + a[i-1]) /2.0;
        else tmp = (tmp + a[i]) /2.0;
    }
    cout<<tmp<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) true
#define dump(x) true
#endif

struct segtree{
	using D = long long;
	D inf = 1e18;

	int N;
	vector<D> val;

	segtree(){}
	segtree(int n){
		N=1;
		while(N<n) N*=2;
		val.assign(N*2,inf);
	}
	segtree(const vector<D>& ds){
		int n = ds.size();
		N=1;
		while(N<n) N*=2;
		val.assign(N*2,inf);
		rep(i,n) val[i+N] = ds[i];
		for(int i=N-1;i>0;i--) val[i] = min(val[i*2],val[i*2+1]);
	}
	void assign(int k,D d){
		k+=N;
		chmin(val[k],d);
		k/=2;
		while(k){
			val[k] = min(val[k*2],val[k*2+1]);
			k/=2;
		}
	}
	D getmin(int a,int b){
		D res = inf;
		a+=N,b+=N;
		while(a<b){
			if(a&1) chmin(res,val[a++]);
			if(b&1) chmin(res,val[--b]);
			a/=2,b/=2;
		}
		return res;
	}
};
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int N,M; cin >> N >> M;
	using P = pair<ll,ll>;
	VV<P> r2lc(N);
	rep(i,M){
		int l,r,c; cin >> l >> r >> c;
		l--,r--;
		r2lc[r].emplace_back(l,c);
	}
	const ll inf = 1e18;
	segtree seg(N);
	seg.assign(0,0);
	rep1(r,N-1){
		for(P p: r2lc[r]){
			int l = p.fs;
			ll c = p.sc;
			seg.assign(r,seg.getmin(l,r)+c);
		}
	}
	ll ans = seg.getmin(N-1,N);
	if(ans == inf) ans = -1;
	cout << ans << endl;
}


Measured memory_bytes: 7680
#pragma region Header
#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#define IFD(...)
#ifndef NDEBUG
#define NDEBUG
#endif
#endif
#include <utility>
#include <cstdint>
#include <cmath>
#include <cassert>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#include <functional>
#include <algorithm>
#include <numeric>
#include <stdexcept>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <boost/hana/functional/fix.hpp>
using boost::hana::fix;
using namespace std;
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, b, a) for (int i = (b); i >= (a); --i)
template <typename T>
int SZ(T const &x)
{
    return static_cast<int>(x.size());
}
template <class T>
bool chmax(T &a, T const &b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, T const &b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    int k;
    cin >> k;
    rep(i, k)
    {
        cout << "ACL";
    }
    cout << '\n';

    return 0;
}


Measured memory_bytes: 3608
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b int
	fmt.Scanf("%d %d", &a, &b)

	var cal []int
	cal = append(cal, a+b)
	cal = append(cal, a-b)
	cal = append(cal, a*b)

	sort.Sort(sort.IntSlice(cal))

	fmt.Print(cal[2])

}


Measured memory_bytes: 512
#include <cmath>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int r, n, sl, sr, h; int height[40]; double sunrise[40];

	while (true)
	{
		cin >> r >> n;

		if (r == 0 && n == 0) { break; }

		for (int i = 0; i < 40; i++) { height[i] = 0; sunrise[i] = -5000.0; }

		for (int i = 0; i < n; i++)
		{
			cin >> sl >> sr >> h;

			for (int j = sl; j < sr; j++)
			{
				height[j + 20] = max(h, height[j + 20]);
			}
		}

		for (int i = 20 - r; i < 20 + r; i++)
		{
			if (i < 20)
			{
				sunrise[i] = sqrt(r * r - (19 - i) * (19 - i)) - r;
			}
			else
			{
				sunrise[i] = sqrt(r * r - (i - 20) * (i - 20)) - r;
			}
		}

		double Answer = 10000.0;

		for (int i = 0; i < 40; i++)
		{
			Answer = min(height[i] - sunrise[i], Answer);
		}
		
		printf("%.4f\n", Answer);
	}

	return 0;
}

Measured memory_bytes: 3196
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = {-1,0,1,0}; const int dy[] = {0,1,0,-1};

int main() {
    set<char> l = {'q', 'w', 'e', 'r', 't', 'a', 's', 'd', 'f', 'g', 'z', 'x', 'c', 'v', 'b'};
    set<char> r = {'y', 'u', 'i', 'o', 'p', 'h', 'j', 'k', 'l', 'n', 'm'};

    string s;
    while(cin >> s, s != "#") {
        int r_p__l_m = 0;
        int cnt = 0;
        int d = 0;
        for(auto c:s){
            int k = 0;
            if(EXIST(l, c)){
                k = -1;
            }else if(EXIST(r, c)){
                k = 1;
            }

            if(k != r_p__l_m) {
                cnt += d;
                r_p__l_m = k;
            }
            d = 1;
        }

        cout << cnt << endl;
    }
}

Measured memory_bytes: 1192
#include <iostream>

using namespace std;

int main(void){
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;
  if(a1 + a2 + a3 <= 21){
	cout << "win" << endl;
  	return 0;
  }
  cout << "bust" << endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h> // Include every standard library
using namespace std;
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};
#define sqr(x) ((LL)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define ALLA(arr, sz) arr, arr + sz
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define TC(t) while (t--)
#define ms(s, n) memset(s, n, sizeof(s))
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define size(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed << setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vii;
typedef vector<vi> vvi;
const int MOD = (int)1e9 + 7;
const int MOD2 = MOD + 2; //1007681537;
const int INF = (int)1e9;
const ll LINF = (ll)1e18;
const ld PI = acos((ld)-1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b)
{
    ll r;
    while (b)
    {
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
inline ll fpow(ll n, ll k, int p = MOD)
{
    ll r = 1;
    for (; k; k >>= 1)
    {
        if (k & 1)
            r = r * n % p;
        n = n * n % p;
    }
    return r;
}
inline ll isqrt(ll k)
{
    ll r = sqrt(k) + 1;
    while (r * r > k)
        r--;
    return r;
}
inline ll icbrt(ll k)
{
    ll r = cbrt(k) + 1;
    while (r * r * r > k)
        r--;
    return r;
}
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
int modulo(int a, int b) { return (a % b + b) % b; }
#define db(x) cerr << #x << " = " << (x) << " ";

vi graph[100005];
vi visited(100005);
vi deg(100005); //deg[v]= no of edges going into node v. 
vi dist(1000005);

void dfs(int v) {
    visited[v] = 1;
    for (int a : graph[v]) {
        dist[a] = max(dist[a], dist[v] + 1);
        deg[a]--;
        if(deg[a]==0)
            dfs(a);
    }
}

int main()
{
    IOS;
    int n, m;
    scanf("%d%d", &n, &m);
    while (m--){
        int x,y;
        scanf("%d%d", &x, &y);
        graph[x].pb(y);
        deg[y]++;
    }
    for (int a = 1; a <=n; a++) {
        if (visited[a] == 0 && deg[a] == 0)
            dfs(a);
    }
    int res = 0;
    for (int a = 1; a <= n; a++)
        res = max(res, dist[a]);
    printf("%d", res);
}


Measured memory_bytes: 17972
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

const LL inf = 1LL<<60;

int main(){
    int N;
    cin >> N;
    vector<vector<pair<int, LL> > > tree(N);
    REP(i, N-1){
        int a, b, c;
        cin >> a >> b >> c;
        a--;b--;
        tree[a].push_back(make_pair(b, c));
        tree[b].push_back(make_pair(a, c));
    }
    int Q, K;
    cin >> Q >> K;
    K--;

    vector<LL> dist(N, inf);
    stack<int> st;
    dist[K] = 0;
    st.push(K);
    while(!st.empty()){
        int u = st.top();st.pop();
        REP(i, tree[u].size()){
            int v = tree[u][i].first;
            LL d = tree[u][i].second;
            if(dist[v]<inf)continue;
            dist[v] = dist[u] + d;
            st.push(v);
        }
    }
    REP(q, Q){
        int x, y;
        cin >> x >> y;
        x--;y--;
        cout << dist[x] + dist[y] << endl;
    }

    return 0;
}


Measured memory_bytes: 9984
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX];

// テーブルを作る前処理
/*
void COMinit() {
    fac[0] = fac[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
    }
}
*/

ll pow_kai(ll a,ll n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a%MOD;
    }
    a = a*a%MOD;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll tmp=1;
    for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

    return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
}



int main()
{
    double X,now=100,i=1.01;
    int nen=0;
    cin >> X;

    while(now<X){
        now=floor(now*i);
        nen=nen+1;
    }

    cout << nen << endl;
    
 
    return 0;

}

Measured memory_bytes: 3724
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int d, w; 
    while(cin >> d >> w) {
        if(d == 0 && w == 0) break;
        vector<vector<int>> e(d, vector<int>(w));
        rep(i, d) {
            rep(j, w) {
                cin >> e[i][j];
            }
        }
        int ans = 0;
        rep(i, d) {
            for(int j = i + 2; j < d; ++ j) {
                rep(k, w) {
                    for(int l = k + 2; l < w; ++ l) {
                        int mi = inf;
                        for(int x = i; x <= j; ++ x) {
                            chmin(mi, e[x][k]);
                            chmin(mi, e[x][l]);
                        }
                        for(int y = k; y <= l; ++ y) {
                            chmin(mi, e[i][y]);
                            chmin(mi, e[j][y]);
                        }
                        int res = 0;
                        bool ok = 1;
                        for(int x = i + 1; x <= j - 1; ++ x) {
                            for(int y = k + 1; y <= l - 1; ++ y) {
                                if(e[x][y] < mi) res += (mi - e[x][y]);
                                else ok = 0;
                            }
                        }
                        if(ok) chmax(ans, res);
                    }
                }
            }
        }
        cout << ans << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for1(i, a, b) for (int i = (int)a; i < (int)(b); ++i)
#define rfor1(i, a, b) for (int i=(int)b-1;i>=(int)a;i--)
#define for2(i, a, b) for (int i = (int)a; i <= (int)(b); ++i)
#define for3(i, a, b) for (int i = (int)a; i < (int)(b); i=i+2)
#define for4(i, a, b) for (int i = (int)a; i <= (int)(b); i=i+2)
#define tc(t) int t; cin>>t; while(t--)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a;
    cin >> a;
    cout << 3 * (pow(a, 2)) << endl;
}






Measured memory_bytes: 3708
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from copy import deepcopy
#import heapq
#import math
#import string

setrecursionlimit(10**6)
input=stdin.readline

n=int(input().rstrip())
now=0
for i in range(1,n+1):
    if i%2==1:
        now+=1
print(now/n)

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	string s;
	cin >> s;
	if((s[0] == s[1]) || (s[1] == s[2]) || (s[2] == s[0])){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    
    int X,a500,a5,s;
    
    scanf("%d",&X);
    a500=X/500;
    a5=(X-(500*a500))/5;
    s=(a500*1000)+(a5*5);
    printf("%d\n",s);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
char a[1000][1000];
int b[1000][1000];
int main(void)
{
	int h,w,i,j,k,cnt=-1;
	int flg=-1;
	cin>>h>>w;
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			cin>>a[i][j];
		}
	}
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			cnt=-1;
			for(k=j;k>=0;k--){
				cnt++;
				if(a[i][k]=='c'){
					b[i][j]=cnt;
					break;
				}
			}
			if(k==-1){
				b[i][j]=-1;
			}
		}
	}
	for(i=0;i<h;i++){
		cout<<b[i][0];
		for(j=1;j<w;j++){
			cout<<" "<<b[i][j];
			
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3580
<?php

$s = 100000;
$n = intval(fgets(STDIN));
for($i = 0; $i < $n; $i++){
	$s = $s*1.05;
	$r = $s % 1000;
	if($r > 0){
		// 切り上げ
		$s = $s - $r + 1000;
	}
}

echo $s."\n";

Measured memory_bytes: 15296
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
#include <cstring>
using namespace std;
int main()
{
  string s;
  cin>>s;
  if (s=="Sunny")
    cout<<"Cloudy"<<endl;
  else if (s=="Cloudy")
    cout<<"Rainy"<<endl;
  else
    cout<<"Sunny"<<endl;
    
}

Measured memory_bytes: 256
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

// reference: http://ir5.hatenablog.com/entry/20171209/1512821837

struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

use std::mem;
use std::cmp;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n: i32 = sc.read();
    let a: i32 = sc.read();
    let b: i32 = sc.read();
    println!("{} {}", cmp::min(a, b), cmp::max(a + b - n, 0));
}

Measured memory_bytes: 2116
to_int :: String -> Int
to_int = read

main :: IO()
main = do
    input <- words <$> getContents
    let n = to_int $ input !! 0
    let a = to_int $ input !! 1
    let b = to_int $ input !! 2
    putStrLn . show $ solve n a b

solve :: Int -> Int -> Int -> Int
solve n a b = min (a * n) b


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;

int main(){
  int n;
  while (std::cin >> n, n) {
    string ans;
    while(n != 0){
      int digit = n%(-10);
      n /= -10;
      if(digit < 0){
        digit += 10;
        n++;
      }
      ans += '0' + digit;
    }
    reverse(ans.begin(), ans.end());
    std::cout << ans << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

bool comp(const vector<double> &a, const vector<double> &b){
    return (a[1] < b[1]);
}

int main() {
    int N, T, A, h;
    cin >> N >> T >> A;
    vector<vector<double>> temp;
    for (int i=0; i<N; i++){
        cin >> h;
        temp.push_back(vector<double>({(double)i, abs(A - (T - 0.006*h))}));
    }

    sort(temp.begin(), temp.end(), comp);

    cout << (int)(temp[0][0] + 1) << endl;

    return 0;

}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
 <url:https://arc065.contest.atcoder.jp/tasks/arc065_b>
 問題文============================================================
 N 個の都市があり、K 本の道路と L 本の鉄道が都市の間に伸びています。
 i 番目の道路は pi 番目と qi 番目の都市を双方向に結び、
 i 番目の鉄道は ri 番目と si 番目の都市を双方向に結びます。
 異なる道路が同じ 2 つの都市を結ぶことはありません。同様に、異なる鉄道が同じ 2 つの都市を結ぶことはありません。
 
 ある都市から別の都市に何本かの道路を通って到達できるとき、
 それらの都市は道路で連結しているとします。
 また、すべての都市はそれ自身と道路で連結しているとみなします。
 鉄道についても同様に定めます。
 
 全ての都市について、その都市と道路・鉄道のどちらでも連結している都市の数を求めてください。
 
 =================================================================
 
 解説=============================================================
 
 ================================================================
 */

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N,K,L; cin >> N >> K >> L;
    vector<ll> p(K),q(K),r(L),s(L);
    
    for(int i = 0; i < K;i++){
        cin >> p[i] >> q[i];
        p[i]--; q[i]--;
    }
    for(int i = 0; i < L;i++){
        cin >> r[i] >> s[i];
        r[i]--; s[i]--;
    }
    
    UnionFind pq(N),rs(N);
    for(int i = 0; i < K;i++) pq.unionSet(p[i], q[i]);
    for(int i = 0; i < L;i++) rs.unionSet(r[i], s[i]);
    map<pii,int> mp;
    for(int i = 0; i < N;i++) mp[pii(pq.root(i),rs.root(i))]++;
    for(int i = 0; i < N;i++){
        cout << mp[pii(pq.root(i),rs.root(i))] << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 16640
n=int(input())
a=list(map(int,input().split()))
sum=1
check=0
a.sort()

for i in range(n):
    x=a[i]
    if x==0:
        print(0)
        exit()
    if not check==-1:
        sum*=x
        if sum>10**18:
            check=-1
if check==-1:
        print(-1) 
        exit()  
print(sum)

Measured memory_bytes: 84804
import java.util.*;
 
public class Main{
	public static void main(String[] args){
	    Scanner sc = new Scanner(System.in);
    	int num = sc.nextInt();
        int sl = 0;
        for(int i = 1; i * i <= num; i++){
            if(i * i <= num){
                sl = i * i;
            }
        }
        System.out.println(sl);
	}
}

Measured memory_bytes: 35644
N = int(input())
L = list(map(int,input().split()))

L.sort()

L_ = []

#何が何回出てきたか
tmp = L[0]
k = 1
for i in range(1,N):
    if tmp != L[i]:
        L_.append([tmp,k])
        k=1
    else:
        k += 1
    tmp = L[i]
L_.append([tmp,k])
    
ans = 0

for k in range(len(L_)-1,1,-1):
    for j in range(k-1,0,-1):
        for i in range(j-1,-1,-1):
            if L_[j][0] - L_[i][0] < L_[k][0] and L_[j][0] + L_[i][0] > L_[k][0]:
                ans += L_[i][1]*L_[j][1]*L_[k][1]

print(ans)


Measured memory_bytes: 9236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  if (sz(s) > k) {
    s = s.substr(0, k);
    s += "...";
  }
  cout << s << endl;
}


Measured memory_bytes: 3656
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
#define ld long double
using namespace std; 
 
const int N = 1e6 + 100, T = 4, OO = 1e9 + 100, M = 1e9 + 7, P = 6151, SQ = 50, lg = 21;
typedef pair <int, int> pii;
int a[N];

int32_t main() {
	use_fast;
	int n, m;
	cin >> n >> m;
	int sum = 0;
	for(int i = 0; i < m; i++) {
		int x;
		cin >> x;
		sum += x;
	}
	if(sum >= n)
		return cout << "Yes", 0;
	cout << "No" << endl;
	return 0; 
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ... 
*/	

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main()
{
    while (true) {
        int M, T, P, R;
        cin >> M >> T >> P >> R;
        if (M == 0 && T == 0 && P == 0 && R == 0) {
            return 0;
        }

        struct Problem {
            int time = -1;
            int incorrect = 0;
        };

        vector<vector<Problem>> data(T, vector<Problem>(P));
        for (int i = 0; i < R; ++i) {
            int m, t, p, j;
            cin >> m >> t >> p >> j;

            if (j == 0) {
                data[t - 1][p - 1].time = m;
            }
            else {
                data[t - 1][p - 1].incorrect += 1;
            }
        }

        struct Team {
            int id = 0;
            int correct = 0;
            int time = 0;
        };

        vector<Team> teams(T);
        for (int i = 0; i < T; ++i) {
            teams[i].id = i;
            teams[i].correct = accumulate(begin(data[i]), end(data[i]), 0,
                                          [](int z, const Problem& pp) {
                                              return pp.time >= 0 ? z + 1 : z;
                                          });
            teams[i].time = accumulate(
                begin(data[i]), end(data[i]), 0, [](int z, const Problem& pp) {
                    return pp.time >= 0 ? z + pp.time + 20 * pp.incorrect : z;
                });
        }

        sort(begin(teams), end(teams), [](const Team& a, const Team& b) {
            if (a.correct == b.correct) {
                if (a.time == b.time) {
                    return a.id > b.id;
                }
                else {
                    return a.time < b.time;
                }
            }
            else {
                return a.correct > b.correct;
            }
        });

        for (size_t i = 0; i < teams.size(); ++i) {
            if (i > 0) {
                if (teams[i - 1].correct == teams[i].correct &&
                    teams[i - 1].time == teams[i].time) {
                    cout << '=';
                }
                else {
                    cout << ',';
                }
            }
            cout << (teams[i].id + 1);
        }
        cout << endl;
    }
}


Measured memory_bytes: 3108
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		char[] c=s.toCharArray();
		int cnt=0;
		for(int i=0;i<c.length;i++) {
			if(Character.getNumericValue(c[i])==1)cnt++;
		}
		System.out.println(cnt);

	}

}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#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() {
	int n,x;
	cin >> n >> x;
	vector <int> v(n);
	rep(i,n) cin >> v[i];
	sort(v.begin(), v.end());
	x-=accumulate(v.begin(), v.end(),0);
	cout << v.size() + x/v[0] << endl;
}


Measured memory_bytes: 256
//
#include<bits/stdc++.h>

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const int INF = 1000000007;
const ll MOD = 1000000007;

const int N = 300005;

pll hw[N];
ll x[N], y[N];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll h, w, m;
    cin >> h >> w >> m;
    for(int i=0; i<m; i++)
    {
        cin >> hw[i].f >> hw[i].s;
        x[hw[i].f]++;
        y[hw[i].s]++;
    }
    ll mx_x = *max_element(x+1, x+h+1);
    ll mx_y = *max_element(y+1, y+w+1);
    ll ct = 0;
    for(int i=0; i<m; i++)
    {
        if(x[hw[i].f] == mx_x && y[hw[i].s] == mx_y)
        {
            ct++;
        }
    }
    ll num_x = 0, num_y = 0;
    for(int i=1; i<=h; i++)
    {
        if(x[i] == mx_x)
        {
            num_x++;
        }
    }

    for(int i=1; i<=w; i++)
    {
        if(y[i] == mx_y)
        {
            num_y++;
        }
    }
//    what_is(ct);
//    what_is(mx_x);
//    what_is(mx_y);
//    what_is(num_x);
//    what_is(num_y);

    cout << mx_x+mx_y - (ct == num_x*num_y);
    return 0;
}


Measured memory_bytes: 12988