akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

int main(){
  string s;
  cin >> s;
  int size = int(s.size());
  vector<string> v;
  for (int i = 0; i < size-2; i++)
  {
    string tmp = s.substr(i, 3);
    v.push_back(tmp);
  }

  int minv = INT_MAX;
  string res = "1";
  for(auto a : v){
    if(minv > abs(stoi(a) - 753))
    {
      minv = abs(stoi(a) - 753);
      res = a;
    }
  }
  cout << minv << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const int INF = 100100100;
using namespace std;

int N;
double dist[9][9];

int main()
{
  pair <int,int>  c[10];
  int array[] = {1, 2, 3, 4, 5, 6, 7, 8};

  cin >> N;

  int x,y;
  rep(i,N) {
    cin >> x >> y;
    c[i] = make_pair(x,y);
  }

  rep(i,N) {
    rep(j,N){
      dist[i][j] = sqrt(pow(c[i].first - c[j].first, 2.0) + pow(c[i].second - c[j].second, 2.0));
    }
  }

  double tnum = 1.0;
  rep(i, N) tnum *= i+1;
  
  double tdist = 0.0;
  do {
    rep(i,N-1) {
      int s=array[i];
      int d=array[i+1];
      tdist += dist[s-1][d-1];
    }
  } while(next_permutation(array, array+N));

  tdist /= tnum;
  printf("%.8f\n", tdist);
}

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

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for (int i=a; i<b; i++)
#define M00(i, a) for (int i=0; i<a; i++)
#define MOOd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define M00d(i,a) for (int i = (a)-1; i >= 0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _<< " _ " <<

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;
typedef complex<ld> cd;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() { FAST
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	int n, m;
	cin >> n >> m;
	vi uf(n, -1);
	M00(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		while(uf[a] >= 0) a = uf[a];
		while(uf[b] >= 0) b = uf[b];
		if(a == b) continue;
		if(uf[b] > uf[a]) {
			uf[a] = uf[a] + uf[b];
			uf[b] = a;
		} else {
			uf[b] = uf[a] + uf[b];
			uf[a] = b;
		}
	}
	int ans = 0;
	M00(i, n) ans = max(ans, -uf[i]);
	cout << ans << endl;
}


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

int main() {
    string s;
    cin>>s;
    int a=0,b=0,c=0;
    for(int i=0; i<3; i++) {
        if(s[i]=='a') a++;
        if(s[i]=='b') b++;
        if(s[i]=='c') c++;
    }
    if(a==1&&b==1&&c==1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (true) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << '\n';
            return 0;
        }
        a -= d;
        if (a <= 0) {
            cout << "No" << '\n';
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int vis[N];
vector<int>e[N],p1,p2;
deque<int>dq;
int main()
{
	int n,m,a,b,res,k;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&a,&b);
		e[a].push_back(b);
		e[b].push_back(a);
	}
	int r=1;
	vis[r]=1;
	dq.push_back(r);
	do
	{
		res=0;
		k=dq.front();
		vis[k]=1;
		p1.push_back(k);
		for(int i=0;i<e[k].size();i++)
		{
			if(!vis[e[k][i]])
			{
				dq.push_front(e[k][i]);
				res=1;
				break;
			}
		}
	}while(res);
	do
	{
		res=0;
		k=dq.back();
		vis[k]=1;
		p2.push_back(k);
		for(int i=0;i<e[k].size();i++)
		{
			if(!vis[e[k][i]])
			{
				dq.push_back(e[k][i]);
				res=1;
				break;
			}
		}
	}while(res);
	printf("%d\n",p1.size()+p2.size()-1);
	for(int i=p1.size()-1;i>=0;i--)
		printf("%d ",p1[i]);
	for(int i=1;i<p2.size();i++)
		printf("%d ",p2[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 7544
# ABC114 C - 755
N = int(input())

def rep(s):
    if int(s) > N:
         return 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0 
    for c in '753':
        ret += rep(s + c)
    return ret

print(rep('0'))

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

int main()
{
    int n, a[10000];
    int min = 1000000, max = -1000000;
    long sum = 0;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a[i];

        if (a[i] < min) {
            min = a[i];
        }
        if (a[i] > max) {
            max = a[i];
        }
        sum += a[i];
    }

    cout << min << " "
         << max << " "
         << sum << endl;

    return 0;
}

Measured memory_bytes: 1204
#include <stdio.h>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long ll;
const ll mod=1e9+7;

int n;
ll m;

ll powmod(ll x,ll e){
  ll c=x,p=1;
  while(e>0){
    if(e%2)p=p*c%mod;
    c=c*c%mod;
    e/=2;
  }
  return p;
}

ll f(int e){
  ll ans=1;
  REP(i,0,e){
    ans=ans*(n+i)%mod;
    ans=ans*powmod(i+1,mod-2)%mod;
  }
  return ans;
}

int main(void){
  scanf("%d%lld",&n,&m);
  ll p=2;
  ll ans=1;
  for(;m>1;p++){
    int e=0;
    while(m%p==0)e++,m/=p;
    ans=ans*f(e)%mod;
  }
  if(m>1)ans=ans*f(1)%mod;
  printf("%lld\n",ans);
}


Measured memory_bytes: 128
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N=Integer.parseInt(sc.next());
int bit=0;
for(int i=0;i<N;i++){
int a=Integer.parseInt(sc.next());
bit|=a;
}
System.out.println(Integer.numberOfTrailingZeros(bit));

}
}


Measured memory_bytes: 21844
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

constexpr int64_t kMod = 1e9+7;
int64_t Modinv(int64_t a, int64_t m) {
  int64_t b = m, u = 1, v = 0;
  while (b) {
    int64_t t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

int main() {
  int64_t N;
  cin >> N;
  
  int64_t sum = 0;
  int64_t square_sum = 0;
  for (int64_t n = 0; n < N; ++n) {
    int64_t A;
    cin >> A;
    (sum += A) %= kMod;
    (square_sum += A * A) %= kMod;
  }
  int64_t sum_square = (sum * sum) % kMod;
  int64_t res = ((sum_square - square_sum) %kMod * Modinv(2, kMod)) % kMod;
  if (res < 0) res += kMod;
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 3624
from collections import deque
import sys


def bfs():
    color[0] = "GRAY"
    d[0] = 0
    Q.append(0)
    while len(Q) != 0:
        u = Q.popleft()
        for v in range(n):
            if M[u][v] and color[v] == "WHITE":
                color[v] = "GRAY"
                d[v] = d[u] + 1
                Q.append(v)
        color[u] = "BLACK"


if __name__ == "__main__":
    n = int(sys.stdin.readline())
    M = [[0] * n for i in range(n)]
    color = ["WHITE"] * n
    d = [-1] * n
    Q = deque()
    for inp in sys.stdin.readlines():
        inp = list(map(int, inp.split()))
        for i in inp[2:]:
            M[inp[0]-1][i-1] = 1
    bfs()
    for i in range(n):
        print(i+1, d[i])

Measured memory_bytes: 8152
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 04/12/20 07:29:17
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  int ans = 1;
  bool front = true;
  bool up;
  int p; cin>>p;
  for (int i = 1; i < n; i++) {
    int a; cin>>a;
    if (front) {
      if (p != a) {
        up = p < a;
        front = false;
      }
    } else {
      if (up and p > a) {
        ++ans;
        front = true;
      } else if (!up and p < a) {
        ++ans;
        front = true;
      }
    }
    p = a;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
using namespace std;

#define N 100010
#define INF 1e9+7

int n, h[N], f[N];

int main() {
  scanf("%d", &n);
  for (int i=1; i<=n; i++) scanf("%d", &h[i]);
  for (int i=1; i<=n; i++) f[i] = INF;
  f[1] = 0;
  for (int i=2; i<=n; i++) {
    f[i] = f[i-1] + fabs(h[i]-h[i-1]);
    if (i > 2)
      f[i] = fmin(f[i], f[i-2]+fabs(h[i]-h[i-2]));
  }
  printf("%d\n", f[n]);
  return 0;
}


Measured memory_bytes: 896
N = int(input())
nums = [int(e) for e in input().split()]
nums.sort()
checker = nums[0]
count = 1
for i in range(1,N):
    if(checker != nums[i]):
        count+=1
        checker = nums[i]
if(N - count)%2==0:
    print(count)
else:
    print(count-1)

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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  ll x,y;
  cin >> x >> y;
  cout << ( 3 * x + y ) / 2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
const int N = 1e5+ 5;
ll n, k;
ll dp[N][5] = {};
ll cost[5];
ll mo[N];
bool win(int a, int b)
{
    if((a == 0 && b == 2) || (a == 1 && b == 0) || (a == 2 && b == 1)) return true;
    return false;
}
ll compute(int i, int prev)
{
    if(i >= n) return 0;
    if(dp[i][prev] != -1) return dp[i][prev];
    ll j;
    ll ans = 0;
    FOR0(j, 3)
    {
        if(j == prev) continue;
        ll dif = 0;
        if(win(j, mo[i])) dif = cost[j];
        ans = MAX2(ans, dif + compute(i+k, j));
    }
    return dp[i][prev] = ans;
}
int main()
{
    she_told_me_dont_worry
    cin>>n>>k;
    int i;
    FOR0(i, 3) cin>>cost[i];
    swap(cost[1], cost[2]);
    string s;
    cin>>s;
    FOR0(i, n)
    {
        if(s[i] == 'r') mo[i] = 0;
        else if(s[i] == 'p') mo[i] = 1;
        else mo[i] = 2;
        int j;
        FOR0(j, 4) dp[i][j] = -1;
        //cout<<mo[i];
    }
    //cout<<endl;
    ll ans = 0;
    FOR0(i, k)
    {
        ans += compute(i, 3);
    }
    cout<<ans<<endl;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 12880
#include<stdio.h>

int max(int a,int b){
    return ((a > b) ? a : b);
}

int main(void){

    int N,i,B[99],A[100],ans = 0;

    scanf("%d",&N);
    for(i = 0;i < N-1;i++){
        scanf("%d",&B[i]);
    }

    A[0] = B[0];

    for(i = 0;i < N - 1;i++){
        A[i + 1] = B[i];
        if(max(A[i],A[i + 1]) > B[i]){
            A[i] = B[i];
        }
    }

    for(i = 0;i < N;i++){
        ans += A[i];
    }

    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int digit_sum(int n) {
  int sum=n%10;
  while(n!=0) {
    n/=10;
    sum+=n%10;
  }
  return sum;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}

int main() {
  string s;
  cin >> s;
  int n=s.length();
  cout << s[0] << n-2 << s[n-1] << endl;
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
#define INF (1e9)

int main() {
    ll H, W;
    cin >> H >> W;
    vvi T(H + 2, vi(W + 2));
    for (int i = 1; i < H + 1; i++) {
        for (int j = 1; j < W + 1; j++) {
            char c;
            cin >> c;
            if (c == '#') {
                T[i][j] = -INF;
                for (int x = -1; x < 2; x++) {
                    for (int y = -1; y < 2; y++) {
                        T[i + x][j + y]++;
                    }
                }
            }
        }
    }

    for (int i = 1; i < H + 1; i++) {
        for (int j = 1; j < W + 1; j++) {
            if (T[i][j] < 0) cout << '#';
            else cout << T[i][j];
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
S = input()
if S == 'SUN':
    print(7)
elif S == 'MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
elif S == 'SAT':
    print(1)

Measured memory_bytes: 8864
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S, T;
  cin >> S >> T;
  cout << T + S << '\n';
  return 0;
}


Measured memory_bytes: 3524
#include <iostream>
using namespace std;
int satisfaction () {

}
int main() {
    int d;
    cin >> d;
    int c[26], s[d][26], t[d], last[26], satisfaction = 0;
    for (int i=0; i<26; i++) {
        cin >> c[i];
        last[i] = -1;
    }
    for (int i=0; i<d; i++) {
        for (int j=0; j<26; j++) {
            cin >> s[i][j];
        }
    }
    for (int i=0; i<d; i++) {
        cin >> t[i];
    }
    for (int i=0; i<d; i++) {
        satisfaction += s[i][t[i]-1] + c[t[i]-1] * (i-last[t[i]-1]);
        for (int j=0; j<26; j++) {
            satisfaction -= c[j] * (i-last[j]);
        }
        last[t[i]-1] = i;
        cout << satisfaction << endl;
    }
}

Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
typedef pair<int, int> p;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9


int main() {
	
	int i, j;
	int a[100];
	string S;
	cin >> S;
	int len = S.size();
	if (S == "zyxwvutsrqponmlkjihgfedcba") {
		cout << "-1" << endl;
		return 0;
	}
	else if (len != 26) {
		char ans;
		bool flag = false;
		string c("abcdefghijklmnopqrstuvwxyz");
		for (j = 0; j < 26; j++) {
			flag = false;
			for (i = 0; i < len; i++) {
				if (c[j] == S[i]) flag = true;
			}
			if (!flag) {
				ans = c[j];
				break;
			}
		}
		for (i = 0; i < len; i++) cout << S[i];
		cout << ans << endl;
		return 0;
	}
	else {
		int num;
		for (i = 25; i >= 1; i--) {
			if (S[i - 1] < S[i]) {
				num = i;
				break;
			}
		}
		string t = S.substr(num);
		sort(t.begin(), t.end());
		char ans;
		int tlen = t.size();
		for (i = 0; i < tlen; i++) {
			if (t[i] > S[num - 1]) {
				ans = t[i];
				break;
			}
		}
		for (i = 0; i < num - 1; i++) cout << S[i];
		cout << ans << endl;
		return 0;
	}

	return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
c=[n for i in range(n)]
for j in range(k):
    d=[0 for i in range(n+1)]
    for i in range(n):
        d[max(i-a[i],0)]+=1
        d[min(i+a[i]+1,n)]-=1
    e=[d[0]]
    for i in range(n-1):#ちょっと特殊な累積和 普通のものの[1:-1]
        e.append(e[i]+d[i+1])
    #print(d,e,sep='\n')
    #print(e)
    a=e
    if e==c:
        break
print(*a)


Measured memory_bytes: 184176
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    public static void Main(string[] args)
    {
        var S = Console.ReadLine();
        var n_0 = S.Count(n => n == '0');
        var n_1 = S.Count(n => n == '1');
        Console.WriteLine(S.Count() - Math.Abs(n_0 - n_1));
    }
}

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

int main()
{
    int K, A, B;
    bool a = false;
    cin >> K >> A >> B;
    for (int i = A; i <= B;i++)
    {

        if(i%K == 0)
        {
            a = true;
            break;
        }
    }
    if(a == true)
    {
        cout << "OK" << endl;
    }
    else
    {
        cout << "NG" << endl;
    }
}


Measured memory_bytes: 3636
// In the name of God 
#include <bits/stdc++.h>

using namespace std ;

const int N = (int)100 + 10 ;

int n , a[N] ; 

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n ;
	for(int i = 0 ; i < n ; ++i)
		cin >> a[i] ;
	int res = 0 ; 
	for(int i = 1 ; i < n ; ++i) {
		if(a[i - 1] == a[i])
			res ++ , a[i] = -1 ; 
	}
	cout << res << '\n' ; 
}


Measured memory_bytes: 256
#include <iostream>

auto main () -> int
{
    const char * res [] = {"NO" , "YES"};
    int n;
    std::cin >> n;

    for (auto i = 0; i < n; ++ i)
    {
        int a , b , c;
        std::cin >> a >> b >> c;
        if (a > c)
        {
            std::swap (a , c);
        }
        if (b > c)
        {
            std::swap (b , c);
        }
        std::cout << res [a * a + b * b == c * c] << std::endl;
    }
}

Measured memory_bytes: 2984
#include<iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <math.h>
#include <cctype>
using namespace std;
string p;
//ITP1-8
	int main(){
		getline(cin,p);
		int f=p.size();
			for(int i=0;i<f;i++){
				if(islower(*p.begin())==0){
					*p.begin()=tolower(*p.begin());}else{
					*p.begin()=toupper(*p.begin());}
			cout<<*p.begin();
			p.erase(p.begin());}
		cout<<endl;
		return 0;}


Measured memory_bytes: 1196
#include <bits/stdc++.h>
#include <iomanip>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;

#define mem(a, b) memset(a, b, sizeof(a))
#define REP(i, a) for (int i = 0; i < a; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(a) a.begin(), a.end()

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
}

inline void print_vector(vector<int> &A){
    for (auto&& x : A){
        cout << x << " ";
    }
    cout << endl;
}

inline void print_array(const int A[], int n) {
    REP(i, n) {
        cout << A[i] << " ";
    }
    cout << endl;
}

bool is_prime(int n) {
    if (n == 2) return true;
    for (int i = 2; i < sqrt(n) + 1; ++i) {
        if (n % i == 0) {
            return false;
        }
    }

    return true;
}

inline void solve() {
    int a, b, c;
    cin >> a >> b >> c;

    int k;
    cin >> k;

    while (k > 0) {
        if (b <= a) {
            b *= 2;
            k--;
        } else {
            break;
        }
    }

    while (k > 0) {
        if (c <= b) {
            c *= 2;
            k--;
        } else {
            break;
        }
    }

    if (a < b && b < c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}


int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    int t;
    t = 1;
    // cin >> t;

    for (int _ = 0; _ < t; _++) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3672
#include <iostream>
using namespace std;
int main() {
     int R[200000],n;
     cin >> n;
    for (int i = 0; i < n ; ++i) {
        cin >> R[i];
    }

    int maxvalue = -2000000000;
    int minvalue = R[0];

    for (int i = 1; i < n ; ++i) {
        maxvalue = max(maxvalue, R[i] - minvalue);
        minvalue = min(minvalue, R[i]);
    }

    cout << maxvalue << endl;
    return 0;
}

Measured memory_bytes: 1940
x1, y1, x2, y2 = gets.chomp.split(" ").map(&:to_i)

x_diff = x2-x1
y_diff = y2-y1

x3 = x2 - y_diff
y3 = y2 + x_diff

x4 = x1 - y_diff
y4 = y1 + x_diff

puts [x3, y3, x4, y4].join(" ")


Measured memory_bytes: 1788
#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 int64_t Int;

int main(){ 
    int N, K;

    cin >> N >> K;

    vector<bool> have(N,false);

    rep(i,K) {
        int d;
        cin >> d;

        vector<int> A(d);
        rep(j,d) cin >> A[j];
        rep(j,d) have[A[j]-1] = true;
    }

    int ans = 0;

    rep(i,N) {
        if (!have[i]) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3632
/* dijkstra.cpp
    ダイクストラ法で、ある頂点から各頂点への最短距離を求めるアルゴリズム
    負の辺が含まれる場合はうまく計算出来ないので、ベルマンフォード法を用いる

    verified: AOJ GRL_1_A
        http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A&lang=jp
*/

#include <bits/stdc++.h>
using namespace std;

template <typename T>
struct Edge {
    int to;
    T cost;
};
using Graph = vector<vector<Edge<long long>>>;  // 距離/コストの型 T を指定する
const long long INF = (1LL << 60);              // 型 T のINF (完全な最大値は取らないように)

/* dijkstra(G,s,dis,prev)
    入力：グラフ G, 開始点 s, 距離を格納する dis, 最短経路の前の点を記録するprev
    計算量：O(|E|log|V|)
    副作用：dis, prevが書き換えられる
*/
template <typename T>
void dijkstra(const Graph &G, int s, vector<T> &dis, vector<int> &prev) {
    using P = pair<T, int>;

    int N = G.size();
    dis.resize(N, INF);
    prev.resize(N, -1);
    priority_queue<P, vector<P>, greater<P>> pq;  // the least element is top. first:cost, second: node
    dis[s] = 0;
    pq.emplace(dis[s], s);
    while (!pq.empty()) {
        P p = pq.top();  // the least element
        pq.pop();
        int v = p.second;
        if (dis[v] < p.first) {
            continue;
        }
        for (auto &e : G[v]) {
            if (dis[e.to] > dis[v] + e.cost) {
                dis[e.to] = dis[v] + e.cost;
                prev[e.to] = v;
                pq.emplace(dis[e.to], e.to);
            }
        }
    }
}

/* get_path(prev, t)
    入力：dijkstra で得た prev, ゴール t
    出力： t への最短路のパス
*/
vector<int> get_path(const vector<int> &prev, int t) {
    vector<int> path;
    for (int cur = t; cur != -1; cur = prev[cur]) {
        path.push_back(cur);
    }
    reverse(path.begin(), path.end());
    return path;
}

int main() {
    int V, E;
    cin >> V >> E;
    Graph G(V * 3);
    for (int i = 0; i < E; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a * 3].push_back({b * 3 + 1, 1});
        G[a * 3 + 1].push_back({b * 3 + 2, 1});
        G[a * 3 + 2].push_back({b * 3, 1});
    }
    int s, t;
    cin >> s >> t;
    s--, t--;
    vector<long long> dis;
    vector<int> prev;
    dijkstra(G, s * 3, dis, prev);
    if (dis[t * 3] != INF) {
        cout << dis[t * 3] / 3 << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 20224
N, *A = map(int, open(0).read().split())

mod = 10 ** 9 + 7
ans = 0
for bit in range(60):
    ctr = [0, 0]
    for i in range(N):
        ctr[A[i] >> bit & 1] += 1
    ans += (1 << bit) * (ctr[0] * ctr[1])
    ans %=mod
print(ans)


Measured memory_bytes: 136428
#include <atcoder/all>
#include <bits/stdc++.h>

using namespace std;
using namespace atcoder;

int main()
{
  int n, m;
  cin >> n >> m;
  vector<string> s(n);
  for (int i = 0; i < n; i++)
  {
    cin >> s[i];
  }
  mcf_graph<int, int> F(2 * n * m + 2);
  int fr = 0, to = 2 * n * m + 1;
  int N = 50 * 50 * 20;
  int cnt = 0;
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < m; j++)
    {
      if (s[i][j] == 'o')
      {
        cnt++;
        F.add_edge(fr, i * m + j + 1, 1, 0);
        vector<pair<int, int> > q = {{i, j}};
        vector<vector<int> > dist(n, vector<int>(m, -1));
        dist[i][j] = 0;
        for (int k = 0; k < q.size(); k++)
        {
          int x = q[k].first, y = q[k].second;
          F.add_edge(i * m + j + 1, n * m + x * m + y + 1, 1, N - dist[x][y]);
          if (x + 1 < n && y < m && s[x + 1][y] != '#' && dist[x + 1][y] == -1)
          {
            dist[x + 1][y] = dist[x][y] + 1;
            q.push_back({x + 1, y});
          }
          if (x < n && y + 1 < m && s[x][y + 1] != '#' && dist[x][y + 1] == -1)
          {
            dist[x][y + 1] = dist[x][y] + 1;
            q.push_back({x, y + 1});
          }
        }
      }
      if (s[i][j] != '#')
      {
        F.add_edge(n * m + i * m + j + 1, to, 1, 0);
      }
    }
  }
  pair<int, int> om = F.flow(fr, to);
  assert(om.first == cnt);
  cout << cnt * N - om.second << "\n";
}

Measured memory_bytes: 7228
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << 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 > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int n;
  cin>>n;
  bool flag = false;
  rep(i, n / 7 + 1) {
    int rem = n - i * 7;
    if(rem % 4 == 0) {
      flag = true;
    }
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int a, b, c, i, d = 0;
	for (scanf("%d %d %d", &a, &b, &c), i = a; i <= b; i++){
		if (c % i == 0) d++;
	}
	printf("%d\n", d);
	return 0;
}

Measured memory_bytes: 596
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define read(a) scanf("%d", &a)
#define readl(a) scanf("%lld", &a)
#define reads(a) scanf("%s", a)
#define readf(a) scanf("%lf", &a)
#define readc(a) scanf("%c", &a)
#define debug(a, b) printf("%s = %d\n", a, b)
#define debug1(a, i, b) printf("%s[%d] = %d", a, i, b)
#define show(a) putchar(a)
#define pb emplace_back
#define mk make_pair
#define _rand mt19937 RAND(time(0))
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define mem(a) memset(a, 0, sizeof(a))
#define Buff ios::sync_with_stdio(false)
typedef long long ll;
typedef long long LL;
typedef int Int;
typedef double db;
using namespace std;
const int INF = 1e9 + 7;
const int N = 2e5 + 7;
const int M = 5e6 + 7;
char s[N];
deque<char> q;
signed main()
{
//    Buff;
    cin >> (s + 1);
    int n = strlen(s + 1);
    for(int i = 1; i <= n; i++)
        q.push_back(s[i]);
    int Q, Flag = 0;
    int Ti, Fi;
    char Ci;
//    cout << "YES\n";
    cin >> Q;
    while(Q--)
    {
        cin >> Ti;
//        cout << "Ti = " << Ti << "\n";
        if(Ti == 1) Flag ^= 1;
        else
        {
            cin >> Fi >> Ci;
            if(Fi == 1)
            {
                if(Flag) q.push_back(Ci);
                else     q.push_front(Ci);
            }
            else
            {
                if(Flag) q.push_front(Ci);
                else    q.push_back(Ci);
            }
        }
    }
    if(Flag)
    {
        while(q.size())
        {
            cout << q.back() << "";
            q.pop_back();
        }
    }
    else
    {
        while(q.size())
        {
            cout << q.front() << "";
            q.pop_front();
        }
    }
    cout << "\n";
    return 0;
}
/**

**/



Measured memory_bytes: 896
import java.util.*;
import java.lang.*;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);

		String str = s.nextLine();

		if(str.charAt(2)==str.charAt(3) && str.charAt(4)==str.charAt(5)){
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		
	}

 }


Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

int main(){
    string s,t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<char>());
    /*
    for(int i = 0; i < min(s.size(), t.size()); i++){
        if(s[i] < t[i]){
            cout << "Yes" << endl;
            return 0;
        }else if(s[i] > t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    if(s.size() < t.size()){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    */
   if(s < t) cout << "Yes" << endl;
   else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll a, b = 0;
    string s;
    cin >> a >> s;
    b = (s[0] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
    a *= b;
    a /= 100;
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 3648
def main():

    N = int(input())

    d = [2 for _ in range(N+1)]
    d[1] = 1

    # v = int(math.sqrt(N))
    for i in range(2, N//2+1):
        for j in range(i+i, N+1, i):
            d[j] += 1
            # if j//i > v: d[j] += 1

    ans = 0
    for i in range(1, N+1):
        ans += i * d[i]
    return ans

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 224844
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x); i<=(y); i++)
#define per(i,x,y) for (int i=(x); i>=(y); i--)
#define ll long long
#define ull unsigned long long
#define ld long double
#define inf 1000000000
#define INF 1000000000000000000ll
#define pii pair<int,int>
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define sqr(x) ((x)*(x))
#define y1 y1_
#define cmin(x,y) (x)=(y)<(x)?(y):(x)
#define cmax(x,y) (x)=(y)>(x)?(y):(x)
#define mset(x,y) memset((x),(y),sizeof(x))
#define mcpy(x,y) memcpy((x),(y),sizeof(y))
using namespace std;
const ld pi=acos(-1);
const ld eps=1e-8;
//////////////////////// header files ////////////////////////
ll read(){
	char ch=getchar(); ll x=0; int op=1;
	for (; !isdigit(ch); ch=getchar()) if (ch=='-') op=-1;
	for (; isdigit(ch); ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
	return x*op;
}
void write(ll a){
	if (a<0) putchar('-'),a=-a;
	if (a>=10) write(a/10); putchar(a%10+'0');
}
////////////////////////// fast i/o //////////////////////////
#ifdef mod
ll ksm(ll x,ll p){
	ll ret=1;
	for (; p; p>>=1,x=x*x%mod) if (p&1) ret=ret*x%mod;
	return ret;
}
ll get_inv(ll x){
	return ksm(x,mod-2);
}
#else
ll ksm(ll x,ll p){
	ll ret=1;
	for (; p; p>>=1,x=x*x) if (p&1) ret=ret*x;
	return ret;
}
#endif
//////////////////////////// qpow ////////////////////////////
#define N 105
int n,m,p[N],q[N]; char a[N][N];
bool chk(int x,int y){
	rep (i,1,n) if (a[i][x]!=a[p[i]][y] || a[i][y]!=a[p[i]][x]) return 0;
	return 1;
}
bool dfs2(int k){
	if (k>m) return 1;
	if (q[k]) return dfs2(k+1);
	int cnt=0; rep (i,k,m) if (!q[i]) cnt++;
	rep (i,k,m) if (!q[i]){
		q[i]=k; q[k]=i;
		if (chk(i,k) && (i!=k || (cnt&1)) && dfs2(k+1)) return 1;
		q[i]=q[k]=0;
	}
	return 0;
}
bool dfs1(int k){
	if (k>n) return dfs2(1);
	if (p[k]) return dfs1(k+1);
	int cnt=0; rep (i,k,n) if (!p[i]) cnt++;
	rep (i,k,n) if (!p[i]){
		p[i]=k; p[k]=i;
		if ((i!=k || (cnt&1)) && dfs1(k+1)) return 1;
		p[i]=p[k]=0;
	}
	return 0;
}
//#define local
int main(){
#ifdef local
	freopen("test.in","r",stdin); freopen("test.out","w",stdout);
#endif
	n=read(),m=read();
	rep (i,1,n) scanf("%s",a[i]+1);
	puts(dfs1(1)?"YES":"NO");
	return 0;
}
// sample data:
/*
3 3
arc
rac
eed

YES
*/

// rest:
/*

*/

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

using namespace std;


int main()
{
    long N, tmp;
    long vec_size;
    long small, big;
    vector<long> vec;

    small = big = 0;

    cin >> N;

    for (int i = 0; i < N; i++) {
        cin >> tmp;
        vec.push_back(tmp);
    }

    sort(vec.begin(), vec.end());


    vec_size = vec.size();
    for (int i = 0; i < vec_size/2; i++) {
        small+= vec[i]*2;
    }
    for(int i = vec_size/2; i < vec_size; i++) {
            big+= vec[i]*2;
        }
    
    if (vec_size % 2 == 0) {
        small-=vec[vec_size/2-1];
        big-=vec[vec_size/2];
    } else {
           
        big-=vec[vec_size/2]+vec[vec_size/2+1];
        
        if (vec[vec_size/2]*2 - vec[vec_size/2+1]-vec[vec_size/2-1] < 0) {
            small+=vec[vec_size/2]*2 - vec[vec_size/2+1]-vec[vec_size/2-1];
        }
    }
    
    cout << big-small << endl;

    return 0;   
}

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

int n;
int w[105];
int f[105];
int ans;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>w[i];
        f[i]=f[i-1]+w[i];
    }
    ans=1e9;
    for(int i=1;i<n;i++){
        ans=min(ans,abs(f[n]-f[i]-f[i]));
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using vl = vector<long long>;
using P = pair<long long,long long>;

int main(){
	ll x; cin >> x;
	cout << x / 500 * 1000 + x % 500 / 5 * 5 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 28)

template<typename T>
void remove(vector<T>& vector, unsigned int index){
vector.erase(vector.begin() + index);
}

typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int w, h;
int state[21][21];
bool memo[21][21] = {0};
int ans;
void dfs(int x, int y){
	if(!memo[x][y]){
		memo[x][y] = true;
		ans++;
	}else return;
	int res = 0;
	rep(k,4){
		int nx = x + dx[k];
		int ny = y + dy[k];
		if(nx < 0 || ny < 0 || nx >= w || ny >= h)continue;
		if(state[nx][ny])continue;
		dfs(nx, ny);
	}
}
int main(void){
	while(cin >> w >> h, w|h){
		ans = 0;
		fill_n(*memo, 21*21, false);
		int sx, sy;
		rep(i,h){
			rep(j,w){
				char c;
				cin >> c;
				if(c == '@'){
					sx = j;
					sy = i;
					state[j][i] = 2;
				}else if(c == '.'){
					state[j][i] = 0;
				}else{
					state[j][i] = 1;
				}
			}
		}
		dfs(sx, sy);
		cout << ans << endl;
	}
	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

Measured memory_bytes: 1176
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;

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

	cin >> N >> M;
	while (N) {
		vector<pair<long long int, long long int>>v(N);
		long long int ans = 0;
		for (int i = 0; i < N; i++) {
			cin >> v[i].second >> v[i].first;
		}
		sort(v.begin(), v.end());
		reverse(v.begin(), v.end());
		for (int i = 0; i < N; i++) {
			if (M >= v[i].second) {
				M -= v[i].second;
			}
			else {
				ans += v[i].first*v[i].second;
				ans -= M*v[i].first;
				M = 0;
			}
		}
		cout << ans << endl;
		cin >> N >> M;
	}
	return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;


int main() {
  int n;
  cin >> n;
  if(n % 2 == 0) {
    cout << n/2;
  } else {
    cout << (n/2) + 1;
  }
}

Measured memory_bytes: 256
N = int(input())
ans = 0
happy = [[0]*3 for _ in range(N)]
dp = [[0]*3 for _ in range(N+1)]
for i in range(N):
    happy[i][0], happy[i][1], happy[i][2] = map(int, input().split())

for i in range(1, N+1):
    for place in range(3):
        for yes in range(3):
            if place == yes:
                continue
            dp[i][place] = max(dp[i][place], dp[i-1][yes] + happy[i-1][place])

ans = max(dp[N])
print(ans)


Measured memory_bytes: 42556
import sys
input = sys.stdin.readline

N = int(input())
L = [input().strip() for _ in range(N)]

m = [0 for _ in range(N)]
for i in range(N):
    p = list(L[i])
    p.sort()
    
    
    m[i] = "".join(p)

mm = {}
for i in range(N):
    if mm.get(m[i]) == None:
        mm[m[i]] = 0
    mm[m[i]] += 1


ans = 0
for v in mm.values():
    if v != 1:
        ans += v * (v - 1) // 2

print(ans)

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

int main(){
    int k; string s;
    cin>>k>>s;
    int n=s.size();
    if(k>=n)cout<<s<<endl;
    else cout<<s.substr(0,k)<<"..."<<endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;

int		main(void)
{
	int N;

	cin >> N;
	double sum = 0;

	for (int i = 0; i < N; i++)
	{
		double A;

		cin >> A;
		sum += 1 / A;
	}
	printf("%9lf\n", (1 / sum));
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    rep(i,n) cin >> a.at(i) >> b.at(i);
    ll mx=0;
    ll num=0;
    rep(i,n){
        if(mx<a.at(i)){
            mx=a.at(i);
            num=b.at(i);
        }
    }
    cout << mx+num << endl;
}


Measured memory_bytes: 4840
s = input()
n = len(s)

ans = 'NO'
for i in range(n):
    for j in range(i, n):
        string = s[:i] + s[j+1:]
        if string == 'keyence':
            ans = 'YES'
if s == 'keyence':
    ans = 'YES'

print(ans)

Measured memory_bytes: 38512
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////



int main() {

	string s;
	ll x, y;
	cin >> s >> x >> y;

	ll N = s.size();

	vector<ll> v[2];
	v[0].push_back(0);
	
	ll t = 0;

	rep(i, N) {
		if (s[i] == 'F') {
			v[t % 2][t / 2]++;
		}
		else { t++; v[t % 2].push_back(0); }
	}

	ll dp[2][20000] = {};


	rep(i, 2) {
		dp[i][10000] = 1;

		rep(j, v[i].size()) {
			ll a[20000] = {};
			
			rep(k, 20000) {
				if (dp[i][k] == 1) {
					a[k + v[i][j]]=1;
					if (i != 0 || j != 0) { a[k - v[i][j]]=1; }
				}
			}

			rep(k, 20000) {
				dp[i][k] = a[k];
			}
		}

	}

	if (dp[0][10000 + x] == 1 && dp[1][10000 + y] == 1) { cout << "Yes"; }
	else { cout << "No"; }

	system("PAUSE");
}






Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = 0;
		int W = 0;
		String sh = "#";
		String dot = ".";
		while(true) {
			H = sc.nextInt();
			W = sc.nextInt();
			if(H == 0 && W ==0)break;
			//上辺
			for(int j = 0; j < W; j++) {
				System.out.print(sh);
			}
			 System.out.println("");
			//間
			for(int i = 1; i < H-1; i++) {
				System.out.print(sh);
				for(int j = 1; j < W-1; j++) {
					System.out.print(dot);
				}
				System.out.println(sh);
			}
			//下辺
			for(int j = 0; j < W; j++) {
				System.out.print(sh);
			}
			System.out.println("\n");
		}
		sc.close();
	}
}


Measured memory_bytes: 32976
import java.util.*;
import java.lang.*;

public class Main {
	static int n;
	static int m;
	static int[] k;
	static ArrayList<ArrayList<Integer>> s;
	static int[] p;
	static int ans;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		k = new int[m];
		s = new ArrayList<>();
		for (int i = 0; i < m; i++) {
			k[i] = sc.nextInt();
			ArrayList<Integer> tmp = new ArrayList<>();
			for (int j = 0; j < k[i]; j++) {
				tmp.add(sc.nextInt());
			}
			s.add(tmp);
		}
		p = new int[m];
		for (int i = 0; i < m; i++) {
			p[i] = sc.nextInt();
		}
		ans = 0;
		dfs(0, new boolean[n]);
		System.out.println(ans);
	}
	static void dfs(int index, boolean[] on) {
		if (index == n) {
			count(on);
		} else {
			dfs(index + 1, on);
			on[index] = true;
			dfs(index + 1, on);
			on[index] = false;
		}
	}

	static void count(boolean[] on) {
		int count = 0;
		for (int i = 0; i < m; i++) {
			int tmp = 0;
			for (int j = 0; j < k[i]; j++) {
				if (on[s.get(i).get(j) - 1]) {
					tmp++;
				}
			}
			if (tmp % 2 == p[i]) {
				count++;
			}
		}
		if (count == m) {
			ans++;
		}
	}
}



Measured memory_bytes: 22740
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] data = new int[n];
    int[] data2 = new int[n];
    int min=100;

    for (int i = 0;i<n ;i++ ) {
      data[i] = sc.nextInt();
    }
    data2[0]=data[0];
    for (int t = 1;t<n ;t++ ) {
      data2[t] = data2[t-1]+data[t];
      }

      for (int i = 0;i<n ;i++ ) {
        int t1 = data2[n-1]-data2[i];
        int t0 = data2[i];
        int pre = Math.abs(t1-t0);
        min = Math.min(min,pre);
      }
      System.out.println(min);
    }

  }


Measured memory_bytes: 22740
#include <stdio.h>

#define N 100000
#define NIL -1

typedef struct node{
  int id;      //???????????????
  int k;       //??????????????°
  int left;    //???????????????????????????????????????
  int sibling; //left???????????????????????£????????????(??????)
  int parent;  //???
  int depth;   //??????????????±???
}Node;

int main()
{

  Node tree[N];
  int n, id, k, i, j, c, m, s, t, a;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    tree[i].id = NIL;
    tree[i].left = NIL;
    tree[i].sibling = NIL;
    tree[i].parent = NIL;
    tree[i].depth = 0;
  }

  for(i=0; i<n; i++){
    scanf("%d%d", &id, &k);

    for(j=0; j<k; j++){
      scanf("%d", &c);

      if(j == 0){ 
	tree[id].left = c;
	tree[c].parent = id;
      }

      else{
	tree[m].sibling = c;
	tree[c].parent = id;
      }

      m = c;

    }
  }

  for(i=0; i<n; i++){

    s = i;

    while(1){
      t = tree[s].parent;
      if(t == NIL) break; //i??????????????????????????????????????????
      s = t;
      tree[i].depth++;
    }
 
    printf("node %d: ", i);
    printf("parent = %d, ", tree[i].parent);
    
    printf("depth = %d, ", tree[i].depth);

    if(tree[i].parent == NIL){
      printf("root, [");
      if(tree[i].left != NIL){printf("%d", tree[i].left);      
	a = tree[i].left;
	while(1){
	  if(tree[a].sibling == NIL) break;
	  a = tree[a].sibling;
	  printf(", %d", a);
	}
      }

      printf("]\n");
    }

    else if(tree[i].left == NIL){
      printf("leaf, []\n");
    }

    else if(tree[i].left != NIL){
      printf("internal node, [");
      printf("%d", tree[i].left);
	a = tree[i].left;
	while(1){
	if(tree[a].sibling == NIL) break;
	a = tree[a].sibling;
	printf(", %d", a);
      }
      printf("]\n");
    }

  }

  return 0;
}

Measured memory_bytes: 2956
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
    if(b==0)return a;
    gcd(b,a%b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin>>n;
  vector<int>values;
  for(int i=0;i<n;i++){
    int o;
    cin>>o;
    values.push_back(o);
  }
  int x=values[0];
  for(int i=1;i<n;i++){
    x=gcd(x,values[i]);
  }
  cout<<x<<endl;
  return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1000000007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }



int main(){
    int N;
    cin >> N;
    vector<int> X(N);
    REP(i, N) cin >> X[i];
    long long ans = 1LL<<60;
    for(int i=1; i<=100; i++){
        long long tot = 0;
        for(int x : X){
            tot += (x-i)*(x-i);
        }
        ans = min(ans, tot);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
def test():
    o = input()
    e = input()
    s = ""
    k = 0; j = 0
    for i in range(len(o)+len(e)):
        if i % 2 == 0:
            s += o[j]
            j += 1
        else:
            s += e[k]
            k += 1
    print(s)


if __name__ == "__main__":
    test()


Measured memory_bytes: 3060