akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    vector<string> s(n);
    cout << 0 << endl;
    cin >> s[0];
    if (s[0] == "Vacant")return 0;

    int l = 1, r = n;
    while (1) {
        int mid = (l + r) / 2;
        cout << mid << endl;
        cin >> s[mid];
        if (s[mid] == "Vacant")return 0;

        if ((mid % 2 == 0 && s[0] == s[mid]) || (mid % 2 == 1 && s[0] != s[mid]))l = mid + 1;
        else r = mid;
    }
}

Measured memory_bytes: 1620
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
#include<complex>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

int calc(int s, int p) {
    return (100+p)*s/100;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, y, s;
    while (cin >> x >> y >> s) {
        if (x==0 && y==0 && s==0) break;
        int ans = 0;
        for (int s1 = 1; s1 < s; s1++) for (int s2 = 1; s2 < s; s2++) {
            if (calc(s1, x)+calc(s2, x) == s) {
                ans = max(ans, calc(s1, y)+calc(s2, y));
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3124
fun main(args: Array<String>) {
    val S = readLine()!!.toLong()

    var y2 = 1e9.toLong()
    var x2 = 1L
    var x1 = (S + y2 - 1) / y2
    var y1 = (y2 - S % y2) % y2

    println("0 0 $x1 $y1 $x2 $y2")
}


Measured memory_bytes: 31640
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    s, w = list(map(int, readline().split()))

    if w >= s:
        print("unsafe")
    else:
        print("safe")


if __name__ == '__main__':
    main()


Measured memory_bytes: 61584
import java.util.*;
public class Main {
	public static int gcd(int m, int n) {
        int r;
        while (n > 0) {
            r = m % n;
            m = n;
            n = r;
        }
        return m;
    }
	public static int gcd(int m, int n,int p) {
		int r=gcd(m,n);
		return gcd(r,p);
       
    }

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int c = sc.nextInt();
		int t=0;
		for(int i=1;i<=c;i++) {
			for(int j=1;j<=c;j++) {
				for(int k=1;k<=c;k++) {
				t+=gcd(i,j,k);	
				}
			}
			
		}
		System.out.println(t);


	}

}


Measured memory_bytes: 35652
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 998244353;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int n;
string s;
int m[300300][15];

bool mas[100];
int ans;
signed main() {

	cin >> n;
	cin >> s;
	bool t[10] ={};
	for(int i = n-1; i >= 0; i--) {
		int a = s[i] - '0';
		for(int j = 0; j < 10; j++) {
			m[i][j] = m[i+1][j];
			if(a == j && !t[j]){
				m[i][j] ++;
				t[j] = true;
			}
			m[i][10] += m[i][j];
		}

	}

	for(int i = 0; i < n-1; i++) {
		for(int j = i+1; j < n; j++) {
			int sum = (s[i]-'0')*10 + (s[j]-'0') ;

			if(mas[sum]) continue;
			mas[sum]  =true;

			ans += m[j+1][10] ;			
		}
	}
	
	cout << ans << endl;
	

    return 0;
}



Measured memory_bytes: 2048
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << endl
#define prtd(n, var)     cout << fixed << setprecision(n) << var << endl
#define prt2(v1, v2)     cout << v1 << " " << v2 << endl
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << endl
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << endl

//----------------------------------------------------------------

int main(void) {
  ll a, b, c;
  cin >> a >> b >> c;

  ll tmp=c-a-b;
  if(tmp<0){
    prt("No"); return 0;
  }
  if(tmp*tmp>4*a*b){
    prt("Yes");
  } else {
    prt("No");
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		String[] weather = new String[]{"Sunny", "Cloudy", "Rainy"};
		String target = sc.next();
		for (int i = 0; i < weather.length; i++) {
			if (target.equals(weather[i])) {
				System.out.println(weather[(i + 1) % weather.length]);
				return;
			}
		}
	}
}


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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);

    int l, r;
    cin >> l >> r;

    int id_l = l % 2019;
    int id_r = r % 2019;
    int ans = INT_MAX;

    int id = 0;
    while (1) {
	ll judge = 2019 * id;
	if (judge > r)
	    break;
	if (judge >= l && judge <= r) {
	    cout << 0 << endl;
	    return 0;
	}
	id++;
    }


    if (id_l == id_r) {
	ans = id_l * id_r % 2019;
    } else {
	rep (i, min(id_l, id_r), max(id_l, id_r)) {
	    rep (j, i + 1, max(id_l, id_r) + 1) {
		int tmp = i * j % 2019;
		ans = min(ans, tmp);
	    }
	}
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int i, N, a[101],max,premax= 1000;
    cin >> N ;
    for(i = 0;i < N;i++)
    {
        cin >> a[i];
    } 
   
    sort(a, a+N, greater<int>());
    int Alice = 0;
    int Bob = 0;
    for (int i = 0;i < N; i++)
    {
        if(i%2 == 0)
        {
            Alice +=a[i];
        }else
        {
            Bob += a[i];
        }
    }
    cout << Alice - Bob << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n);++i)
const int INF =1001001001;
using ll=long long;
using P = pair<int,int>;
using Graph =vector<string>;
Graph field;
queue<P> q;

int main() {
  ll n;
  ll i=0;
  ll nu=26;
  cin>>n;
  ll n1=n;
  while(n>0){
  i++;
  n=n-nu;
  nu*=26;
  }

  deque<int> q;
  n1=n;
  rep(j,i){
    ll n2=n1%26;
    if(n2<0)n2+=26;
    q.push_back(n2);
    n1=n1/26;
  }
  rep(j,i){
    string ab;
    int a1=q.back();
    q.pop_back();
    if(a1==0)a1=26;
    ab='a'+a1-1;
    cout<<ab;
  }
  cout<<endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  if(n%1000==0)
  cout<<0<<"\n";
  else
  {
      int res = (n/1000) + 1;
      res = res*1000 - n;
      cout<<res<<"\n";
  }
}

Measured memory_bytes: 3548
#include <stdio.h>
int main(){
  int a1, a2, a3;
  
  scanf("%d %d %d",&a1, &a2, &a3);
  
  if(a1 + a2 + a3 >= 22){
    printf("bust");
  }
  
  else {
    printf("win");
  }
  
  return 0;
}

Measured memory_bytes: 128
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = S()
if N[0] == N[2]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 74652
import java.util.*;
public class Main { //クラス名はMain
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int o=Math.max(0,a-2*b);
        System.out.println(o);
    }
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)

typedef long long Int;

int main() {

    Int N;
    cin >> N;
    vector<Int> A(N);
    rep(i,N) cin >> A[i];

    vector<Int> L(N), R(N);

    L[0] = A[0];
    rep1(i,N-1) L[i] = __gcd(L[i-1],A[i]);

    R[N-1] = A[N-1];
    rep1(i,N-1) R[N-1-i] = __gcd(R[N-i], A[N-1-i]);

    Int MAX = R[1];
    rep1(i,N-2) {
        MAX = max(MAX, __gcd(L[i-1], R[i+1]));
    }
    MAX = max(MAX, L[N-2]);

    cout << MAX << endl;

    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    vector<vector<ll>> x(100);
    for(int i = 0; i < n; ++i){
        ll h;
        cin >> h;
        for(int j = 0; j < h; ++j){
            if(x.at(j).size() == 0 || x.at(j).back() < i - 1){
                x.at(j).push_back(i);
            }else{
                x.at(j).back() = i;
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i < x.size(); ++i){
        ans += x.at(i).size();
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
///╔══╗
///╚╗╔╝
///╔╝╚(¯`v´¯)
///╚══╝`.¸.´farzin


#include <bits/stdc++.h>

#define int int64_t
#define pb push_back
#define ibsws ios_base::sync_with_stdio
#define gcd __gcd
#define s second
#define f first
typedef std::pair<int,int> pii ;

using namespace std;

const int N=1e5+1e2,inf=1e15;
int n,tw,mx;
int w[N],v[N],dp[110][N],ps[N];

int32_t main(){
	ibsws(true==false);
	cin>>n>>tw;
	for(int i=1;i<=n;i++){
        cin>>w[i]>>v[i];
	}
	for(int i=1;i<=n;i++){
        ps[i]=ps[i-1]+v[i];
	}
	for(int i=0;i<=n;i++){
        for(int j=0;j<=1e5;j++){
            dp[i][j]=inf;
        }
	}
	for(int i=1;i<=v[0];i++){
        dp[0][i]=w[0];
	}
	for(int i=1;i<=n;i++){
        for(int j=1;j<=ps[i];j++){
            if(v[i]>j){
                dp[i][j]=dp[i-1][j];
            }
            dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i]]+w[i]);
        }
	}
	for(int i=0;i<=n;i++){
        for(int j=0;j<=1e5;j++){
            //cout<<dp[i][j]<<' ';
            if(dp[i][j]<=tw){
                mx=max(mx,j);
            }
    //    cout<<'\n';
        }
	}
	cout<<mx+1;
}


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

using namespace std;

int main(){
  string s,t,u;
  int a,b;
  cin >>s>>t>>a>>b>>u;
  if(u==s){
    a--;
  }else{
    b--;
  }
  cout << a << " " << b << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){

  CIN(a,b);
  if((!a||!b)||(a>0!=b>0))EN(Zero);
  ll minus = 1LL*max(0,-1*a) - max(0,-1*(b+1));
  SANKOU(minus&1,Negative,Positive);

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(30);
#define ll long long
#define pi 3.14159265359
using namespace std;

int main()
{
    IOS;

    int h,w,k;
    cin>>h>>w>>k;
    string s[6];
    for(int i=0;i<h;i++)
        cin>>s[i];
    int res=0;
    for(int i=0;i<(1<<h);i++){
        for(int j=0;j<(1<<w);j++){
            int c=0;
            for(int x=0;x<h;x++){
                for(int y=0;y<w;y++){
                    if(!(i>>x&1) and !(j>>y&1))
                        c+= s[x][y]=='#';
                }
            }
            res+= c==k;
        }
    }
    cout<<res;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using lint = long long;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  lint a;
  cin >> a;
  string b;
  cin >> b;
  lint bb = 100 * (b[0] - '0') + 10 * (b[2] - '0') + (b[3] - '0');
  a *= bb;
  a /= 100;
  cout << a << "\n";
  return 0;
}


Measured memory_bytes: 3652
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(" ").map { it.toInt() }
    val list = readLine()!!.split(" ").map { it.toInt() }
    val sorted  = list.sortedBy { it }
    var sum = 0
    for (i in sorted.indices) {
        if (i >= k) {
            break
        }
        sum += sorted[i]
    }
    println(sum)
}

Measured memory_bytes: 40824
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	if((n-2*m)%2){
	    REP(i, 0, m) printf("%ld %ld\n", i+1, n-i);
	} else {
	    REP(i, 0, (m+1)/2){
		printf("%ld %ld\n", i+1, n-i);
	    }
	    REP(i, (m+1)/2, m){
		printf("%ld %ld\n", i+2, n-i);
	    }
	}
	return 0;
}



Measured memory_bytes: 3824
#include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#define N 200100
#define LL long long
using namespace std;
int h, w, a, b;
LL f[N], inv[N];
const LL MOD = 1e9 + 7;
LL powd(LL x, LL y){
	LL ret = 1LL;
	while (y){
		if (y % 2) ret = ret * x % MOD;
		x = x * x % MOD;
		y >>= 1;
	}
	return ret;
}

void Init(){
	f[0] = f[1] = 1LL;
	inv[0] = inv[1] = 1LL;
	for (LL i = 2; i < N; ++ i){
		f[i] = f[i - 1] * i % MOD;
		inv[i] = powd(f[i], MOD - 2LL);
	}
	
}

LL cal(int n, int k){
	//printf("n == %d k == %d\n", n, k);
	//cout << f[n] <<  " " << inv[k] << " " << inv[n - k] << endl;
	return f[n] * inv[k] % MOD * inv[n - k] % MOD;
}
int main(){
	int i;
	cin >> h >> w >> a >> b;
	Init();
	LL ans = cal(h + w - 2, h - 1);
	//printf("ans == %I64d\n", ans);
	for (i = 0; i < a; ++ i){
		ans -= cal(h - i - 1 + b - 1, b - 1) * \
			cal(i + w - b - 1, i) % MOD;
		if (ans < 0)  ans += MOD;
	}
	//printf("%I64d\n", ans);
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main(){
	int n,cnt=0;
	int t;
	bool ans=true;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>t;
		if(t!=i){
			cnt++;
		}
		if(cnt>2){
			ans=false;
			break;
		}
	}
	if(ans){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define N 500000

void merge(int [], int, int, int);
void mergeSort(int [], int, int);

int m = 0;

int main(){
  int a[N];
  int left, right, mid;
  int n, i;

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }

  mergeSort(a, 0, n);

  printf("%d", a[0]);
  for(i = 1; i < n; i++){
    printf(" %d", a[i]);
  }
  printf("\n%d\n", m);
  return 0;
}

void merge(int a[], int left, int mid, int right){
  int i, j, k;
  int n1, n2;
  n1 = mid - left;
  n2 = right - mid;
  int l[n1], r[n2];
  for(i = 0; i <= n1-1; i++){
    l[i] = a[left + i];
  }
  for(i = 0; i <= n2-1; i++){
    r[i] = a[mid + i];
  }
  l[n1] = 2147483647;
  r[n2] = 2147483647;
  
  
  
  i = 0;
  j = 0;
  
  for(k = left; k <= right-1; k++){
    if(l[i] <= r[j]){
      a[k] = l[i];
      i = i + 1;
      m++;
    }else{
      a[k] = r[j];
      j = j + 1;
      m++;
    }
    
  }
}

void mergeSort(int a[], int left, int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right) / 2;
    mergeSort(a, left, mid);
    mergeSort(a, mid, right);
    merge(a, left, mid, right);
  }
}




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

using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll n;
    cin >> n;
    ll tmp = n/500 , ans=tmp*1000;

    n -= tmp*500;
    tmp = n/5;
    ans += tmp*5;
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
 
int main(void) {
     
    char c;
    int i;
    
    i = 'a'-'A';//????????????
     
    for(;;){
        scanf("%c",&c);
        if ('a' <= c && c<= 'z') 
            printf("%c",c-i);
        else if ('A' <= c && c<= 'Z')
            printf("%c",c+i);
        else if (c == '\n') 
            break;
        else
            printf("%c",c);
    }
     
    printf("\n");
    return 0;
}

Measured memory_bytes: 524
#include <iostream>
using namespace std;

long long int X;

int main(void) {
  cin >> X;

  long long int ans = 0;
  long long int now = 100;

  while (now < X) {
    now += now * 0.01;
    ans++;
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
 
int main(void){
    int i,ex1,ex2,ex3,ex4,a,b,q;
    int dice[7];
    int command;
 
    for(i = 1;i <= 6;i++){
        scanf("%d",&dice[i]);
    }
 
    scanf("%d",&q);
 
    for(i = 0;i < q;i++){
        scanf("%d%d",&a,&b);
        while(1){
            command = rand() % 4;
            if(command == 0){
                ex1 = dice[1];
                ex2 = dice[2];
                ex3 = dice[5];
                ex4 = dice[6];
                dice[1] = ex3;
                dice[2] = ex1;
                dice[5] = ex4;
                dice[6] = ex2;
            }else if(command == 1){
                ex1 = dice[1];
                ex2 = dice[2];
                ex3 = dice[5];
                ex4 = dice[6];
                dice[1] = ex2;
                dice[2] = ex4;
                dice[5] = ex1;
                dice[6] = ex3;
            }else if(command == 2){
                ex1 = dice[1];
                ex2 = dice[3];
                ex3 = dice[4];
                ex4 = dice[6];
                dice[1] = ex3;
                dice[3] = ex1;
                dice[4] = ex4;
                dice[6] = ex2;
            }else if(command == 3){
                ex1 = dice[1];
                ex2 = dice[3];
                ex3 = dice[4];
                ex4 = dice[6];
                dice[1] = ex2;
                dice[3] = ex4;
                dice[4] = ex1;
                dice[6] = ex3;
            }
            if(dice[1] == a && dice[2] == b)
                break;
        }
        printf("%d\n",dice[3]);
    }
    return 0;
}


Measured memory_bytes: 2044
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<vector>
using namespace std;
#define fr first
#define sc second
typedef pair<int,int> P;
int dx[] = {0,1,0,-1} , dy[] = {-1,0,1,0};
int main(){
  int N,n,d;
  while(cin >> N , N){
    P p[N];
    int bix=0,biy=0,mix=0,miy=0;
    p[0] = P(0,0);
    for(int i = 1; i < N ; i++){
      cin >> n >> d;
      p[i] = P(p[n].fr + dx[d],p[n].sc + dy[d]);
      bix = max(p[i].fr , bix);
      biy = max(p[i].sc , biy);
      mix = min(p[i].fr , mix);
      miy = min(p[i].sc , miy);
    }
    cout << biy - miy + 1 << " " << bix - mix + 1 << endl;
  }
}

Measured memory_bytes: 1160
#include <stdio.h>
#include<math.h>

int main()

{

     double  r ; double a , c ;

    scanf("%lf",&r) ;

    if(r > 0 && r < 10000)  {

        a = (M_PI)*r*r ;

        c = 2*(M_PI)*r ;

        printf("%lf %lf\n",a,c) ;

    }

    return 0 ;

}



Measured memory_bytes: 2056
#include<iostream>
using namespace std;

int main() {
    std::string moji = "";
    std::cin>>moji;

    std::string abc = "abcdefghijklmnopqrstuvwxyz";

    for ( int i = 0; i < 26; i++ ) {
        if ( moji[0] == abc[i] ) {
            std::cout<<abc[i+1]<<std::endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
/*input
1 1
snuke
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	int a,b;
	string s;
	cin>>a>>s>>b;
	if(s=="+"){
		cout<<a+b;
	}
	else cout<<a-b;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const long inf=1e9;
int main(){
	int N,T;cin>>N>>T;
	vector<pair<int,int>> vp(N);
	rep(i,0,N) cin>>vp[i].first>>vp[i].second;
	sort(vp.begin(),vp.end());reverse(vp.begin(),vp.end());
	int dp[N+1][T+1]={};
	rep(i,1,N+1) dp[i][0]=max(dp[i-1][0],vp[i-1].second);
	rep(i,1,N+1){
		rep(j,1,T+1){
			dp[i][j]=dp[i-1][j];
			if(j>=vp[i-1].first){
                dp[i][j]=max(dp[i][j],dp[i-1][j-vp[i-1].first]+vp[i-1].second);
            }
		}
	}int ans=0;
    rep(i,0,T) ans=max(ans,dp[N][i]);
    cout<<ans<<endl;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
const int MAXN=1e5+10;
struct qnode
{
    int v;
    int c;
    qnode(int _v=0,int _c=0):v(_v),c(_c) {}
    bool operator <(const qnode &r)const
    {
        return c>r.c;
    }
};
struct Edge
{
    int v,cost;
    Edge(int _v=0,int _cost=0):v(_v),cost(_cost) {}
};
vector<Edge>E[MAXN];
bool vis[MAXN];
int dist[MAXN];
void Dijkstra(int n,int start)
{
    memset(vis,false,sizeof(vis));
    for(int i=0; i<=n; i++)dist[i]=INF;
    priority_queue<qnode>que;
    while(!que.empty())que.pop();
    dist[start]=0;
    que.push(qnode(start,0));
    qnode tmp;
    while(!que.empty())
    {
        tmp=que.top();
        que.pop();
        int u=tmp.v;
        if(vis[u])continue;
        vis[u]=true;
        for(int i=0; i<E[u].size(); i++)
        {
            int v=E[tmp.v][i].v;
            int cost=E[u][i].cost;
            if(!vis[v]&&dist[v]>dist[u]+cost)
            {
                dist[v]=dist[u]+cost;
                que.push(qnode(v,dist[v]));
            }
        }
    }
}
void addedge(int u,int v,int w)
{
    E[u].push_back(Edge(v,w));
}

int main()
{
    int k;
    scanf("%d",&k);
    for(int i = 0; i < k; ++i)
    {
        addedge(i,(i+1)%k,1);
        addedge(i,(i*10)%k,0);
    }
    Dijkstra(k,1);
    printf("%d\n",dist[0]+1);
    return 0;
}



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

// #define int ll
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n) for (int i = 0; i < n; i++)
#define dotc()    int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)     (int)x.size()
#define eb        emplace_back
#define pb        push_back
#define mp        make_pair
#define all(x)    x.begin(), x.end()
#define rall(x)   x.rbegin(), x.rend()
#define fi        first
#define se        second

ll mod(1000000007);
double pi(acos(-1.0));

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#endif

  int s, w;
  cin >> s >> w;
  if (w >= s) cout << "un";
  cout << "safe";

  return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner

object Main {
  def readable(input: String): Boolean = {
    def readableOdd(str: String) = {
      str match {
        case "" => true
        case _ => List('R', 'U', 'D').contains(str.charAt(0)) && readableEven(str.substring(1))
      }
    }
    def readableEven(str: String): Boolean = {
      str match {
        case "" => true
        case _ => List('L', 'U', 'D').contains(str.charAt(0)) && readableOdd(str.substring(1))
      }
    }
    input match {
      case "" => true
      case _ => readableOdd(input)
    }
  }

  def main(args: Array[String]) = {
    val input = new Scanner(System.in).next()
    if(readable(input)) println("Yes")
    else println("No")
  }
}


Measured memory_bytes: 25524
import math

S=list(input())
count=0
n,m=math.floor(len(S)/2),math.ceil(len(S)/2)
S1,S2=S[0:n],S[:m-1:-1]

for i in range(n):
  if S1[i]!=S2[i]:
    count+=1

print(count)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line1 = sc.nextLine();
		String line2 = sc.nextLine();
		
		int[] diceA = Dice.Diceget(line1);
		int[] diceB = Dice.Diceget(line2);
		
		if (Dice.Dicejudge(diceA, diceB)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}

class Dice {
	public static int[] Diceget(String line) {
		int[] set = new int[7];
		String[] s = line.split(" ");
		for (int i = 1; i <= 6; i++) {
			set[i] = Integer.parseInt(s[i - 1]);
		}
		return set;
	}

	public static int[] DiceE(int[] d) {
		int[] dd = new int[7];
		dd[1] = d[4];
		dd[2] = d[2];
		dd[3] = d[1];
		dd[4] = d[6];
		dd[5] = d[5];
		dd[6] = d[3];
		return dd;
	}

	public static int[] DiceN(int[] d) {
		int[] dd = new int[7];
		dd[1] = d[2];
		dd[2] = d[6];
		dd[3] = d[3];
		dd[4] = d[4];
		dd[5] = d[1];
		dd[6] = d[5];
		return dd;
	}

	public static int[] DiceS(int[] d) {
		int[] dd = new int[7];
		dd[1] = d[5];
		dd[2] = d[1];
		dd[3] = d[3];
		dd[4] = d[4];
		dd[5] = d[6];
		dd[6] = d[2];
		return dd;
	}

	public static int[] DiceW(int[] d) {
		int[] dd = new int[7];
		dd[1] = d[3];
		dd[2] = d[2];
		dd[3] = d[6];
		dd[4] = d[1];
		dd[5] = d[5];
		dd[6] = d[4];
		return dd;
	}

	public static boolean Dicejudge(int[] d1, int[] d2) {
		
		boolean judge = false;

		int breakcount = 0;

		for (int j = 0; j < 4; j++) {

			for (int k = 0; k < 4; k++) {

				for (int l = 0; l < 4; l++) {

					for (int m = 0; m < 4; m++) {
						d2 = Dice.DiceW(d2);
						if (d1[1] == d2[1] && d1[2] == d2[2] && d1[3] == d2[3]
								&& d1[4] == d2[4] && d1[5] == d2[5]) {
							breakcount++;
							break;
						}

					}
					if (breakcount >= 1) {
						break;
					}
					d2 = Dice.DiceS(d2);
					if (d1[1] == d2[1] && d1[2] == d2[2] && d1[3] == d2[3]
							&& d1[4] == d2[4] && d1[5] == d2[5]) {
						breakcount++;
						break;

					}
				}

				if (breakcount >= 1) {
					break;
				}

				d2 = Dice.DiceE(d2);
				if (d1[1] == d2[1] && d1[2] == d2[2] && d1[3] == d2[3]
						&& d1[4] == d2[4] && d1[5] == d2[5]) {
					breakcount++;
					break;
				}

			}

			if (breakcount >= 1) {
				break;
			}

			d2 = Dice.DiceN(d2);
			if (d1[1] == d2[1] && d1[2] == d2[2] && d1[3] == d2[3]
					&& d1[4] == d2[4] && d1[5] == d2[5]) {
				breakcount++;
				break;
			}
		}
		
		if (breakcount == 1) {
			judge = true;
		}
		return judge;
	}
}

Measured memory_bytes: 26292
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
	int n,k;
    cin>>n>>k;
    if(k==1)cout<<0<<endl;
    else cout<<n-k<<endl;
}

Measured memory_bytes: 256
<?php
  fscanf(STDIN, "%d", $num);
$array = str_split($num);
$ctn = count($array);
$result=0;
for($i = 0; $i < $ctn; $i++){
    if($array[$i] == 7){
        $result += 1;
    }
}
if($result){
    echo 'Yes';
}else{
    echo 'No';
}
  ?>

Measured memory_bytes: 15728
#include <iostream>
#include <map>

using namespace std;

int main() {
  int n;
  cin >> n;
  map<int, int> m;
  for (int i = 1; i <= n; i++) {
      int to;
      cin >> to;
      m.insert(make_pair(i, to));
  }

  int current = 1;
  int push_count = 0;
  bool is_reached = false;
  while(!is_reached && !m.empty()){
     if (m.count(current) == 0) break;
     int next = m.at(current);
     push_count++;

     if (next == 2) {
         is_reached = true;
         break;
     }
     m.erase(current);
     current = next;
  }

  if (is_reached) {
    cout << push_count << endl;
  } else {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 4992
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	as := make([]int, n)
	for i := range as {
		sc.Scan()
		as[i], _ = strconv.Atoi(sc.Text())
	}
	for i := k; i < n; i++ {
		if as[i] > as[i-k] {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 5992
# include <iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
    int a,b,c,k,i=0;
    cin>>a>>b>>c;
    cin>>k;
    while(b<=a)
    {
        b=b*2;
        i++;
    }
    while(c<=b)
    {
        c=c*2;
        i++;
    }
    if(i<=k)
    cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
const int N = 1e5+1e2;
#define ll long long 
const int mod = 1e9+7;
int n;
ll a[N],ans;
ll inv[N],sum[N]; 
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%lld",&a[i]);
	inv[1]=1;
	ll f=1;
	for(int i=2;i<=n;++i)
		inv[i]=(1ll*(mod-mod/i)*inv[mod%i])%mod;
	for(int i=1;i<=n;++i)
		sum[i]=(sum[i-1]+inv[i])%mod,f=(1ll*f*i)%mod;
	for(int i=1;i<=n;++i)
		ans=(1ll*ans+a[i]*(sum[i]+sum[n-i+1]-1))%mod;
	printf("%lld\n",(ans*f)%mod);
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
typedef long long ll;
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=a; i>=b; i--)
typedef std::vector<long long > vi ;
#define F first
#define S second
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define PB push_back
#define MP make_pair
#define PI 3.14159265358979323846
#define all(a) a.begin(),a.end()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define endl '\n'
#define show(a) for(auto el:a)cout<<el<<" "
const ll INF=LLONG_MAX/2;
const ll N=2e5+1;
#define yesno(f) yes(f);no(f);
#define yes(f) if(f)cout<<"YES\n";
#define no(f) if(!f)cout<<"NO\n";
using  namespace std;
int main()
{
    fast;
   ll t=1;
   //std::cin >> t;
   while(t--)
   {
       ll n,i,j=0;
       std::cin >> n;
       char s[n];
       fr(i,0,n)
       {
           std::cin >> s[i];
           if(s[i]=='Y')
           j=1;
       }
       if(j)
       cout<<"Four\n";
       else
       cout<<"Three\n";
   }
}

Measured memory_bytes: 3648
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	Int n;
	while(n=in()){
		Int res=n*n*n;
		Int x,y;
		for(x=1;x<n;x++){
			for(y=x;y<n;y++){
				if(n*n*n<x*x*x+y*y*y)break;
				chmin(res,n*n*n-x*x*x-y*y*y);
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <iomanip>  //桁数を指定するためのヘッダー
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    double fa=a, fb=b;  //aとbの形を浮動小数点型に直す必要あり
    int d = a/b;
    int r = a%b;
    double f = fa/fb;
    cout << d << " " << r << " " << fixed << setprecision(8) << f << endl;
    return 0;
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define fi first
#define se second
const int N = 3e5+6;
const int M = 998244353;
const ll inf = 1e18;
const ld pi = acos(-1.0);
void solve(){
   int k;
   cin>>k;
   string s;
   cin>>s;
   if(s.size()>k){
    for(int i=0;i<k;i++)cout<<s[i];
    cout<<"..."<<endl;

   }else cout<<s<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
 //   cin>>t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 3644
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
bool test = true;
#else 
bool test = false;
#endif
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

signed main(void) {
	int i, j, k, l;
	int K;
	string m[2][100];
	cin >> K;
	rep(i, K) cin >> m[0][i];
	rep(i, K) cin >> m[1][i];
	int pow[2] = {};
	bool win[2] = {};
	string kougekida = "kougekida";
	string mamoru = "mamoru";
	string tameru = "tameru";
	rep(i, K) {
		if (m[0][i] == kougekida) {
			if (m[1][i] == kougekida) {
				if (pow[0] == 0 && pow[1] == 0) continue;
			}
		}
		if (m[0][i] == kougekida) {
			if (pow[0] == 0) {
				win[1] = true;
				break;
			}
		}
		if (m[1][i] == kougekida) {
			if (pow[1] == 0) {
				win[0] = true;
				break;
			}
		}
		if (m[0][i] == kougekida) {
			if (m[!0][i] == kougekida) {
				if (pow[0] > pow[!0]) {
					win[0] = true;
					break;
				}
				else if (pow[0] < pow[!0]) {
					win[!0] = true;
					break;
				}
				pow[0] = pow[!0] = 0;
			}
		}

		rep(j, 2) {
			if (m[j][i] == kougekida) {
				if (m[!j][i] == mamoru) {
					if (pow[j] == 5) {
						win[j] = true;
						goto end;
					}
					else {
						pow[j] = 0;
					}
				}
				if (m[!j][i] == tameru) {
					win[j] = true;
					goto end;
				}

			}
		}

		rep(j, 2) {
			if (m[j][i] == tameru) {
				if (pow[j] == 5) continue;
				else {
					pow[j]++;
				}
			}
		}
		if (test) {
			dump(pow[0]);
			dump(pow[1]);
		}
	}
	end:
	if (win[0]) puts("Isono-kun");
	else if (win[1]) puts("Nakajima-kun");
	else puts("Hikiwake-kun");
	return 0;
}

Measured memory_bytes: 3232
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template<class T, class F>
class sliding_window {
    vector<T> v;
    deque<T> Q;
    F f;
public:
    int l, r;
    explicit sliding_window(vector<T> &v, F f) : v(v), f(f), l(0), r(0) {};
    void set(vector<T> &u){
        v = u;
        Q.clear();
        l = 0; r = 0;
    }
    void reset(){
        Q.clear();
        l = 0, r = 0;
    }
    void slideL(){
        if(Q.front() == l++) Q.pop_front();
    }
    void slideR(){
        while(!Q.empty() && !f(v[Q.back()], v[r])) Q.pop_back();
        Q.push_back(r++);
    }
    T get_index()  {
        if(l == r) return 0;
        return Q.front();
    }
    T value()  {
        if(l == r) return 0;
        return v[Q.front()];
    }
};


template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[";
    for (int i = 0; i < v.size(); ++i) {
        if(i) os << ",";
        os << v[i];
    }
    return os << "]";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
    return os << "(" << p.first << "," << p.second << ")";
}
int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<ll> v(n);
    for (auto &&i : v) scanf("%lld", &i);
    auto f = [](ll a, ll b){ return a > b; };
    vector<ll> dp(v);
    sliding_window<ll, decltype(f)> g(dp, f);
    for (int i = 1; i < k; ++i) {
        for (int j = 0; j < i; ++j) {
            dp[j] = 0;
        }
        for (int j = i; j < n; ++j) {
            while(j > g.r) g.slideR();
            while(j-m > g.l) g.slideL();
            dp[j] = g.value() + v[j]*(i+1);
        }
        g.set(dp);
    }
    cout << *max_element(dp.begin(), dp.end()) << "\n";
    return 0;
}


Measured memory_bytes: 2560
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
#define erase(i) erase(i, 1)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
template<typename T> void remove(std::vector<T>& vector, unsigned int index){vector.erase(vector.begin() + index);}
//priority_queue<int, vi, greater<int> > que;//昇順
//priority_queue<int> que; // 降順

using namespace std;

const int mod=1e9+7;

signed main()
{
    SPEED;
    int n, m;
    cin >> n >> m;
    vector<int> ac(n,0);
    vector<int> p(n,0);
    int sum = 0, sum_i = 0;
    rep(i,m)
    {
        int num;string s;
        cin >> num >> s;
        if(ac[num-1] == 0 && s == "WA")p[num-1]++;
        else if(s=="AC")ac[num-1] = 1;
    }
    rep(i,n)
    {
        if(ac[i] == 1)
        {
            sum += p[i];
            sum_i++;
        }
    }
    cout << sum_i << " " << sum << endl;
}


Measured memory_bytes: 1792
import heapq

def main():
    N, M = map(int, input().split())
    AB = [tuple(map(int, input().split())) for _ in range(N)]
    AB.sort()
    AB.reverse()
    M += 1
    w = [False] * M
    q = []
    r = 0
    for i in range(1, M):
        while AB and AB[-1][0] <= i:
            heapq.heappush(q, -AB.pop()[1])
        if q:
            r += heapq.heappop(q)
    return -r

print(main())


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

const int MAXN = 1e5+10;
struct node
{
    int no,score;
};
node ns[MAXN];

bool cmp(const node& a, const node& b)
{
    return a.no < b.no;
}

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    long long res = n;
    for(int i = 0; i < n; ++i)
        cin >> ns[i].no >> ns[i].score;
    sort(ns,ns+n,cmp);
    for(int i = 0; i < n; ++i)
    {
        if(i == 0)
            res += ns[i].no-1;
        else
            res += ns[i].no-ns[i-1].no-1;
    }
    res += ns[n-1].score;
    cout << res << endl;
    return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 61)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



string s,t;
void solve(){
	cin >> s >> t;
	int n = s.size();
	
	int cnt = 0;
	for(int i = 0; i < n; i++){
		if(s[i]!=t[i]) cnt++;
	}
	cout << cnt << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3780
a, b, c, x, y = map(int, input().split())
ans = a * x + b * y
ans = min(c * max(x, y) * 2, ans)
if x < y:
    ans = min(c * x * 2 + (y - x) * b, ans)
else:
    ans = min(c * y * 2 + (x - y) * a, ans)

print(ans)

Measured memory_bytes: 3064
import java.util.*;
	
	public class Main{
		public static void main(String[] args){
			Scanner scan = new Scanner(System.in);
			for(int i = 1;i<=7;i++){
				int a = scan.nextInt();
				int b = scan.nextInt();
				a = a - b;
				System.out.println(a);
			}
		}
	}
	

Measured memory_bytes: 17364
from collections import deque
def main():
	N,M,*AB=map(int,open(0).read().split())
	to=[[] for _ in range(N+1)]
	for a,b in zip(*[iter(AB)]*2):
		to[a].append(b)
		to[b].append(a)
	q=deque([1])
	r=[None]*(N+1)
	while q:
		x=q.popleft()
		for i in to[x]:
			if r[i] is None:
				q.append(i)
				r[i]=x
	print("Yes",*r[2:],sep="\n")
if __name__=='__main__':
	main()


Measured memory_bytes: 56568
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    string s;
    cin >> s;
    map<ll, ll> mp;
    mp[0] = 1;
    ll cur = 0, p = 1, ans = 0;
    for (int i = s.size() - 1; i >= 0; i--) {
        cur = (cur + (s[i] - '0') * p) % 2019;
        ans += mp[cur];
        p = (p * 10) % 2019;
        mp[cur]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3716
n,*a = map(str,open(0).read().split())

n = int(n)
A = a.count("AC")
B = a.count("WA")
C = a.count("TLE")
D = a.count("RE")

print("AC " + "x " + str(A))
print("WA " + "x " + str(B))
print("TLE " + "x " + str(C))
print("RE " + "x " + str(D))

Measured memory_bytes: 17200