akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	ll start,end;
};

int main(){

	ll T;
	scanf("%lld",&T);

	int N;
	scanf("%d",&N);

	ll* okunai_ruisekiwa = new ll[N];

	Info* info = (Info*)malloc(sizeof(Info)*N);

	scanf("%lld %lld",&info[0].start,&info[0].end);

	okunai_ruisekiwa[0] = 0;

	ll pre_end = info[0].end;

	for(int i = 1; i < N; i++){
		scanf("%lld %lld",&info[i].start,&info[i].end);
		okunai_ruisekiwa[i] = info[i].start-pre_end;
		okunai_ruisekiwa[i] += okunai_ruisekiwa[i-1];
		pre_end = info[i].end;
	}

	ll maximum = 0;
	int left,right,m,last_live;
	ll start_time,okunai_time;

	for(int first_live = 0; first_live < N; first_live++){

		start_time = info[first_live].start;

		left = first_live,right = N-1,m = (left+right)/2;
		last_live = N-1;

		while(left <= right){
			if(info[m].start-start_time < T){
				last_live = m;
				left = m+1;
			}else{
				right = m-1;
			}
			m = (left+right)/2;
		}

		if(first_live == 0){
			okunai_time = okunai_ruisekiwa[last_live];
		}else{
			okunai_time = okunai_ruisekiwa[last_live]-okunai_ruisekiwa[first_live];
		}

		maximum = max(maximum,min(T,info[last_live].end-start_time)-okunai_time);
	}

	printf("%lld\n",maximum);

	return 0;
}

Measured memory_bytes: 5568
/*
      author  : nishi5451
      created : 14.08.2020 15:26:06
*/

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


int main(){
    int h,w;
    cin >> h >> w;
    vector<string> s;
    string dots;
    rep(i,w+2) dots.push_back('.');
    s.push_back(dots);
    rep(i,h){
        string tmp;
        cin >> tmp;
        string a;
        a.push_back('.');
        a += tmp;
        a.push_back('.');
        s.push_back(a);
    }
    s.push_back(dots);
    //rep(i,h+2) cout << s[i] << endl;

    for(int i=1; i<=h; i++){
        for(int j=1; j<=w; j++){
            if(s[i][j]=='#') cout << "#";
            else{
                int now = 0;
                for(int ii=-1; ii<=1; ii++){
                    for(int jj=-1; jj<=1; jj++){
                        if(ii==0 && jj==0) continue;
                        if(s[i+ii][j+jj]=='#') now++;
                    }
                }
                cout << now;
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3612
#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 repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N;
int main(){
    cin >> N;
    vector<int> s(N);
    vector<int> t;
    rep(i,N){
        cin >> s[i];
        if(s[i]%10 != 0) t.pb(s[i]);
    }
    sort(ALL(t));
    int sum = accumulate(ALL(s),0);
    
    if(t.empty() && sum % 10 == 0) cout << 0 << '\n';
    else if(t.empty() || sum % 10 != 0) cout << sum << '\n';
    else cout << sum - t.at(0) << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
long long int __lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
 //__gcd 最大公約数
 //__lcm 最小公倍数

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

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int l=sc.nextInt();
    String str[]=new String[n];
    for(int i=0;i<n;i++){
      str[i]=sc.next();//なぜsc.nextLineじゃダメなのかは不明
    }
    Arrays.sort(str);
    for(int i=0;i<n;i++){
      System.out.print(str[i]);
    }
  }
}

Measured memory_bytes: 23764
#include "bits/stdc++.h"

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)
typedef long long ll;

int sum_digits(int num);
template <class T>
vector<T> copy_vector(vector<T> vec);
int gcd(int a, int b);

#define RED '0'
#define BLUE '1'

void exe_stack(int *count, int *num_stack, int *other_num_stack) {
    if(*num_stack > 0) {
        (*num_stack)--;
        *count += 2;
    } else {
        (*other_num_stack)++;
    }
}

int main() {
    string s;
    cin >> s;
    
    int n = s.size();
    int count = 0;
    int stacked_red = 0;
    int stacked_blue = 0;
    for(int i=0; i<n; i++) {
        if(s[i] == RED) {
            exe_stack(&count, &stacked_blue, &stacked_red);
        } else { // BLUEのとき
            exe_stack(&count, &stacked_red, &stacked_blue);
        }
    }
    cout << count << endl;

    return 0;
}

/******************************/
/***** DECRARED FUNCTIONS *****/
/******************************/

int sum_digits(int num) {
    int rtn = 0;
    while(num != 0) {
        int tmp = num % 10; 
        rtn += tmp;
        num /= 10; 
    }   
    return rtn;
}
//int sum_digits(int num) {
//    int rtn = 0;
//    string num_str = to_string(num);
//    for(int i=0; i<num_str.size(); i++) {
//        rtn += num_str[i] - '0';
//    }   
//    return rtn;
//}

// vectorのコピー
template <class T>
vector<T> copy_vector(vector<T> vec) {
    vector<T> rtn;
    rtn.reserve(vec.size());
    copy(vec.begin(), vec.end(), back_inserter(rtn));
    return rtn;
}

// ユークリウッドの互除法
int gcd(int a, int b) {
    if(b==0) return a;
    else return gcd(b, a % b);
}



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

int main() {
    int N , T , A , X;
    scanf("%d%d%d" ,&N ,&T ,&A);
    int res =0;
    int cc=1<<30;
    for ( int i=1;i<=N;i++)
    {
            scanf("%d%" ,&X);
            int d=(T*1000-X*6) - A*1000;
            if(d<0) d=-d;
            if(cc>d)cc=d, res =i;
    }

    printf("%d\n" ,res);

    
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vvi v(n, vi(10));
	REP(i, n) {
		REP(j, 10)cin >> v[i][j];
	}
	vvi p(n, vi(11));
	REP(i, n) {
		REP(j, 11) {
			cin >> p[i][j];
		}
	}
	int ans = -INF;
	FOR(i, 1,1 << 10) {
		int tmp = 0;
		REP(j, n) {
			int cnt = 0;
			REP(k, 10) {
				if ((i&(1 << k)) && (v[j][k]))cnt++;
			}
			tmp += p[j][cnt];
		}
		ans = max(ans, tmp);
	}
	cout << ans << endl;

}


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

ll N;
vector<int> a(100001, 0);

int main(void){
    
    cin >> N;
    for(int i = 0; i < N; ++i){
        cin >> a[i];
        a[i] -= 1;
    }
    
    int ans = 0, i = 0;
    while(ans <= N){
        i = a[i];
        ++ans;
        if(i == 1){
            cout << ans << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    
    return 0;
}


Measured memory_bytes: 640
#include <iostream>

using lint = long long;

int main() {
    lint a, b, k;
    std::cin >> a >> b >> k;

    lint d = std::min(a, k);
    a -= d;
    k -= d;

    d = std::min(b, k);
    b -= d;
    k -= d;

    std::cout << a << ' ' << b << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int isprime(int n){
	for(int i = 2;i * i <= n;i++){
		if(n % i == 0) return 0;
	}
	return 1;
}

int main(){
	int n, max;
	while(scanf("%d", &n) != EOF){
		if(n == 0) break;
		for(int i = n;i >= 2;i--){
			if(isprime(i) == 1 && isprime(i-2) == 1){
				max = i;
				break;
			}
		}
		printf("%d %d\n", max - 2, max);
	}
	return 0;
}

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


int main() {

    int n;
    cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    vector<int> c(n);
    rep(i,n) cin >> c[i];
    int ans = 0;
    rep(i,n) {
        if (v[i] - c[i] > 0) {
            ans += v[i] - c[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
class segtree():
    def segfunc(x,y):
        return min(x,y)
    #####単位元######
    ide_ele = -1
    n=1
    init_val=[0]*n
    #num:n以上の最小の2のべき乗
    num =2**(n-1).bit_length()
    seg=[ide_ele]*2*num
    
    def __init__(self,INIT_VAL,SEGFUNC,IDE_ELE):
        self.ide_ele=IDE_ELE
        self.init_val=[i for i in INIT_VAL]
        self.segfunc=SEGFUNC
        self.n=len(self.init_val)
        self.num =2**(self.n-1).bit_length()
        self.seg=[self.ide_ele]*2*self.num

        #set_val
        for i in range(self.n):
            self.seg[i+self.num-1]=self.init_val[i]    
        #built
        for i in range(self.num-2,-1,-1) :
            self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) 
        
    def update(self,k,x):
        k += self.num-1
        self.seg[k] = x
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
        
    def query(self,p,q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res
class UnionFind():
    n=1
    par=[0]
    rnk=[0]
    def __init__(self,size):
        self.n=size
        self.par=[i for i in range(self.n)]
        self.rnk=[0 for i in range(self.n)]
    def find(self,vertex1):
        if self.par[vertex1]==vertex1:
            return vertex1
        else:
            self.par[vertex1]=self.find(self.par[vertex1])
            return self.par[vertex1]
    def unite(self,vertex1,vertex2):
        vertex1=self.find(vertex1)
        vertex2=self.find(vertex2)
        if vertex1==vertex2:
            return
        if (self.rnk[vertex1]<self.rnk[vertex2]):
            self.par[vertex1]=vertex2
        else:
            self.par[vertex2]=vertex1
            if(self.rnk[vertex1]==self.rnk[vertex2]):
                self.rnk[vertex1]+=1
    def same(self,vetrex1,vertex2):
        return self.find(vetrex1)==self.find(vertex2)

N,K=map(int,input().split())
P=[int(i) for i in input().split()]
mintree=segtree(P,min,N)
maxtree=segtree(P,max,-1)
G=UnionFind(N-K+1)
for i in range(N-K):
    m=mintree.query(i+1,i+K)
    M=maxtree.query(i+1,i+K)
    #print(m,M)
    if P[i]<m and M<P[i+K]:
        G.unite(i,i+1)
aaa=[G.find(i) for i in range(N-K+1)]
Q=[1 for i in range(N)]
for i in range(N-1):
    if P[i]<P[i+1]:
        Q[i+1]=Q[i]+1
    else:
        Q[i+1]=1
tmp=0
for i in range(N):
    if Q[i]==K:
        tmp+=1
if tmp>0:
    tmp-=1
print(len(set(aaa))-tmp)

Measured memory_bytes: 124232
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
#include <math.h>
using namespace std;
int main(){
    string s,a,b,c;
    s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    cin>>a>>b>>c;
    cout<<s[a[0]-'a']<<s[b[0]-'a']<<s[c[0]-'a']<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll Mod=1e9+7;
struct point
{
	int x,y;
}p[3010];
int h,w,n;
ll fac[200010],inv[200010],f[3010];
void upd(ll &x,ll v)
{
	x=(x+v)%Mod;
}
ll pw(ll x,ll y)
{
	ll res=1;
	while (y)
	{
		if (y&1)
		{
			res=res*x%Mod;
		}
		x=x*x%Mod;
		y>>=1;
	}
	return res;
}
ll c(int n,int m)
{
	if (m<0 || m>n)
	{
		return 0;
	}
	return fac[n]*inv[m]%Mod*inv[n-m]%Mod;
}
bool cmp(point x,point y)
{
	if (x.x==y.x)
	{
		return x.y<y.y;
	}
	else
	{
		return x.x<y.x;
	}
}
int main()
{
	n=200000;
	fac[0]=1;
	for (int i=1;i<=n;i++)
	{
		fac[i]=fac[i-1]*i%Mod;
	}
	inv[n]=pw(fac[n],Mod-2);
	for (int i=n-1;i>=0;i--)
	{
		inv[i]=inv[i+1]*(i+1)%Mod;
	}
	scanf("%d%d%d",&h,&w,&n);
	h--;
	w--;
	for (int i=0;i<n;i++)
	{
		scanf("%d%d",&p[i].x,&p[i].y);
		p[i].x--;
		p[i].y--;
	}
	sort(p,p+n,cmp);
	ll ans=c(h+w,h);
	for (int i=0;i<n;i++)
	{
		f[i]=c(p[i].x+p[i].y,p[i].x);
		for (int j=0;j<i;j++)
		{
			if (p[j].x>p[i].x || p[j].y>p[i].y)
			{
				continue;
			}
			int x=p[i].x-p[j].x;
			int y=p[i].y-p[j].y;
			upd(f[i],Mod-f[j]*c(x+y,x)%Mod);
		}
		upd(ans,Mod-f[i]*c(h-p[i].x+w-p[i].y,h-p[i].x)%Mod);
		//cerr<<f[i]<<" "<<ans<<endl;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3456
#include <stdio.h>

int main(void) {
    int w, h, x, y, t;
    scanf("%d %d %d %d", &w, &h, &x, &y);
    if(x*2 == w && y*2 == h){ t = 1; }
    else{ t = 0; }
    printf("%lf %d\n", (double)w*h/2, t);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long a,b;
  long long n;
  cin>>n>>a>>b;
  long long tnp= (n/(a+b))*a;
  long p = n%(a+b);
                  if(p>a)
                  tnp+=a;
                  else
                  tnp+=p;
                  cout<<tnp<<endl;
  
}

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

int main() {
  std::string s, t;
  std::cin >> s >> t;

  for (int i = s.size() - t.size(); 0 <= i; i--) {
    bool flag = true;
    for (int j = 0; j < t.size(); j++) {
      if (s[i + j] != '?' && s[i + j] != t[j]) {
        flag = false;
        break;
      }
    }
    if (!flag) {
      continue;
    }

    for (int j = 0; j < t.size(); j++) {
      s[i + j] = t[j];
    }
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == '?') {
        s[j] = 'a';
      }
    }
    std::cout << s << std::endl;
    return 0;
  }

  std::cout << "UNRESTORABLE" << std::endl;
  return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	sort(a.begin(), a.end(), greater<int>());
	int alice = 0;
	int bob = 0;
	for(int i=0; i<n; i+=2){
		alice += a[i];
		bob += a[i+1];
	}
	cout << alice - bob << endl;
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  int ans = 999;
  for(int i = 0 ; i <= s.size()-3; i++){
    int num = (s[i] - '0') * 100 + (s[i+1] - '0') * 10 + (s[i+2] - '0');
    ans = min(ans,abs(num-753));
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  mp(a,b)  make_pair(a,b)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" );
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
const ll INF = 1e9+9, LINF = 1e18;


int main()
{
    ll n;
    cin>>n;
    n+=n*(n%2);
    cout<<n<<endl;

    return 0;
}


Measured memory_bytes: 256
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N = inp()
A = inlist()

s = sum(A)
c = 0
f = True
while f:
    for i in range(N):
        if A[i] % 2 != 0:
            f = False
            break
        A[i] = A[i] // 2
    if not f:
        break
    c += 1
print(c)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define lol long long
#define in(n,s) insert(n,s) //文字列の挿入 
// s.erase(s.begin()+1) 文字列の削除
// 小文字を大文字は -32
#define SYOU(x) setprecision(x)
#define abs(x,y) (max(x,y)-min(x,y))
#define mp make_pair
#define fi first
#define se second
using namespace std;
struct Per{
  int number;
  string name;
};
lol i[111100];
bool ii[11111];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=0,f=0,g=1,h=2,j;
  string s,w,p;
  cin >>s>>a;
  for(int n=0;n<s.size();n++){
    if(n%a==0) w.push_back(s[n]);
  }
  cout <<w<<'\n';
  return (0);
}


Measured memory_bytes: 256
def valid?(a, b, c)
  a <= b + c && b <= c + a + 1 && c <= a + b + 1
end
 
def calc(rear, front, west, east, north, south, limit, best)
  path = [0] * limit
  limit.times do |i|
    a = rear + front
    b = west + east
    c = north + south
 
    if east > 0 && valid?(b - 1, c, a)
      rear, front, west, east = east - 1, west, rear, front
      y = 69
    elsif north > 0 && valid?(c - 1, a, b)
      rear, front, north, south = north - 1, south, front, rear
      y = 78
    elsif south > 0 && valid?(c - 1, a, b)
      rear, front, north, south = south - 1, north, rear, front
      y = 83
    #elsif west > 0 && valid?(b - 1, c, a)
    else
      rear, front, west, east = west - 1, east, front, rear
      y = 87
    end
     
    if best
      x = best[i]
      return best if x < y
      best = nil if x > y
    end
    path[i] = y  
  end
  path
end
 
def find(target, limit)
  best = nil
  target.permutation(6).to_a.uniq.each do |rear, front, west, east, north, south|
    a = rear + front
    b = west + east
    c = north + south
    if valid?(a, b, c)
      best = calc(rear, front, west, east, north, south, limit, best)
    end
  end
  best
end
 
loop do
  target = gets.split.map!(&:to_i)
  break if target.all?(&:zero?)
  p, q = gets.split.map!(&:to_i)
  result = find(target, q)
  puts result ? result[p-1..-1].pack('C*') : 'impossible'
end

Measured memory_bytes: 114700
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static void Main (string[] args) {
        var inp = Console.ReadLine().Split(' ');
        int k = int.Parse(inp[0]);

        var inp2 = Console.ReadLine().Split(' ');
        int a = int.Parse(inp2[0]);
        int b = int.Parse(inp2[1]);

        for(int i = a;i <= b;i++) {
            if(i % k == 0) {
                Console.WriteLine("OK");
                return;
            }
        }

        Console.WriteLine("NG");
    }
}

Measured memory_bytes: 27476
#include<bits/stdc++.h>
using namespace std;
long long cnt;
int main()
{
	int x,y,z,k,s;
	cin>>k>>s;
	for(x=0;x<=k;x++)
	{
		for(y=0;y<=k;y++)
		{
			z=s-x-y;
			if(z<=k&&z>=0) cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

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

int main() {
    int N, T, A;
    string s, a_string;

    cin >> s;

    for (int i = 0; i < s.length(); i += 2){
        a_string = a_string + s[i];
    }

    cout << a_string << endl;
}

Measured memory_bytes: 640
n = int(input())

A = []
B = []
for i in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

C = zip(B, A)
C = sorted(C)
B, A = zip(*C)

ans = 1
t = 0
for i, j in zip(A, B):
    t += i
    if t <= j:
        continue
    else:
        print("No")
        ans = 0
        break
if ans:
    print("Yes")


Measured memory_bytes: 49196
import sys 

n=int(input())
w=[list(input()) for i in range(n)]
flag=True

for i in range(0,n-1):
    if  w[i+1][0]!=w[i][-1]:
        flag=False
for i in range(0,n-1):
    for j in range(1,n):
        if i==j:
            continue
        if w[i]==w[j]: 
            flag=False
if flag :
    print("Yes")
else : print("No")



Measured memory_bytes: 65684
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 
 
 int main(){
 ll n,k ; cin>> n>>k ;
 vector<ll> A(n) ;
 rep(i,n) cin>>A[i] ;
 ll l=1 ;
 ll r= 1e9 ;
 rep(ww,100){
   ll m= (r+l)/2 ;
   ll ans=0 ;
   rep(i,n){
     ans+= ((A[i]+m-1)/m)-1 ;
   }
  if(ans>k) l=m ;
  else r=m ;
 }

 cout<<r<<endl ;

   return 0 ;
 }



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

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 h, w, a, b;
    cin >> h >> w >> a >> b;

    for (i64 i = 0; i < h; i++) {
        for (i64 j = 0; j < w; j++) {
            cout << ((i < b) ^ (j < a) ? 1 : 0);
        }
        cout << endl;
    }
}

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


Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007
#define MEM_SIZE = 1e5+5;

template<typename T> void DEBUG(T e){std::cout <<"DEBUG>>"<< e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }


 
 
void solve(void)
{
  int N,W;
  cin>>N>>W;
  
  vector<int> weight(N);
  vector<int> value(N);
  int V = 0;
  for (int i = 0; i < N; i++)
  {
    cin>>weight[i]>>value[i];
    V += value[i];
  }
  
  vector<vector<int> > DP (N+1,vector<int>(V+1,INF/4));
  DP[0][0] = 0;
  for (int i = 1; i <= N; i++)
  {
    for (int v = 0; v <= V; v++)
    {
      if(v >= value[i-1])
      {
        DP[i][v] = min(DP[i-1][v],DP[i-1][v - value[i-1]] + weight[i-1]);
      }
      else
      {
        DP[i][v] = DP[i-1][v];
      }
      
    }
  }
  //  DEBUG(DP);
  int ANS = 0;
  for (int i = 0; i <= V; i++)
  {
    if(DP[N][i] <= W)
    {
      ANS = max(ANS,i);
    }
  }
  // DEBUG(DP);
  cout<<ANS<<endl;
  
  
  return;
}



int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(8);
  solve();

 
  return 0;
}

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

int main() {

    while(1){

        int x,y,s;

        cin >> x >> y >> s;

        if(x==0 && y==0 && s==0) break;

        int ans = -1;

        map<int,int> tax_excluded;

        for(int i=1; i<s; i++){
            tax_excluded[i*(100+x)/100] = i;
        }



        for(int i=1; i<s; i++){

            int a,b;

            a = tax_excluded[i]; b = tax_excluded[s-i];
            
            a = a * (100 + y) / 100;
            b = b * (100 + y) / 100;

            ans = max(ans,a+b);
        }


        cout << ans << endl;

    }

    return 0;
}


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


//a^n (mod m)
const long long mod = 1000003;
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//mod mでの a の逆元を求める
long long modinv(long long a) {
    long long b = mod, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod; 
    if (u < 0) u += mod;
    return u;
}

ll f[2000200];

signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(20);

    int q;
    cin>>q;

    f[0]=1;
    for(int i=1;i<2000200;i++){
        f[i] = f[i-1]*i;
        f[i]%=mod; 
    }

    while(q--){
        ll x,d,n;
        cin>>x>>d>>n;

        if(d==0){
            ll t = modpow(x,n);
            cout<<t<<"\n";
            continue;
        }

        if(n>=mod){
            cout<<0<<"\n";
            continue;
        }

        ll ans = modpow(d,n);
        ll xd = x*modinv(d) + mod -1;
        xd%=mod;

        ans *= (f[xd+n]*modinv(f[xd]))%mod;

        ans%=mod;

        cout<<ans<<"\n";
    }


}


Measured memory_bytes: 16512
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstdio>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
struct po{
	ll v,c,r;
	bool operator >(const po&q)const{
		return c>q.c;
	}
};
int n,m,s,t,p,q;
ll sd[100005],td[100005],dp[100005][4],d;
vector<P>g[100005];
priority_queue<po,vector<po>,greater<po> >dik;
int main(void){
    scanf("%d%d%d%d%d%d",&n,&m,&s,&t,&p,&q);
    s--,t--,p--,q--;
    for(int i=0;i<n;i++){
		sd[i]=INF;
		td[i]=INF;
		dp[i][0]=INF;
		dp[i][1]=INF;
		dp[i][2]=INF;
		dp[i][3]=INF;
	}
    for(int i=0;i<m;i++){
		ll a,b,c;
		scanf("%lld%lld%lld",&a,&b,&c);
		g[--a].PB(P(--b,c));
		g[b].PB(P(a,c));
	}
	sd[s]=0;
	td[t]=0;
	dik.push(po{s,0,0});
	dik.push(po{t,0,1});
	while(!dik.empty()){
		ll v=dik.top().v,c=dik.top().c,r=dik.top().r;
		dik.pop();
		if(r==0){
			if(sd[v]<c)continue;
			for(int i=0;i<g[v].size();i++){
				ll u=g[v][i].F,e=g[v][i].S;
				if(sd[u]>c+e){
					sd[u]=c+e;
					dik.push(po{u,c+e,0});
				}
			}
		}else{
			if(td[v]<c)continue;
			for(int i=0;i<g[v].size();i++){
				ll u=g[v][i].F,e=g[v][i].S;
				if(td[u]>c+e){
					td[u]=c+e;
					dik.push(po{u,c+e,1});
				}
			}
		}
	}
	d=sd[t];
	dp[p][0]=0;
	dik.push(po{p,0,0});
	while(!dik.empty()){
		ll v=dik.top().v,c=dik.top().c,r=dik.top().r;
		dik.pop();
		if(dp[v][r]<c)continue;
		for(int i=0;i<g[v].size();i++){
			ll u=g[v][i].F,e=g[v][i].S;
			if((r==0||r==3)&&dp[u][r]>c+e){
				dp[u][r]=c+e;
				dik.push(po{u,c+e,r});
			}
			if((r==1||r==2)&&dp[u][3]>c+e){
				dp[u][3]=c+e;
				dik.push(po{u,c+e,3});
			}
			if((r==0||r==1)&&sd[v]+e+td[u]==d&&dp[u][1]>c){
				dp[u][1]=c;
				dik.push(po{u,c,1});
			}
			if((r==0||r==2)&&td[v]+e+sd[u]==d&&dp[u][2]>c){
				dp[u][2]=c;
				dik.push(po{u,c,2});
			}
		}
	}
	printf("%lld\n",min(min(dp[q][0],dp[q][1]),min(dp[q][2],dp[q][3])));
}



Measured memory_bytes: 27040
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>

using namespace std;

int main()
{
	int k,s;

	cin >> k >> s;

	int cnt;

	for(int x = 0; x <= k; x++)
	{
		for(int y = x; y <= k; y++)
		{
			for(int z = y; z <= k; z++)
			{
				if (x+y+z == s)
				{
					if (x == y && y == z)
					{
						cnt++;
					}else if (x == y || y == z || z == x)
					{
						cnt += 3;
					}else
					{
						cnt += 6;
					}
				}
			}
		}
	}

	cout << cnt << endl;

	return 0;
}
	

Measured memory_bytes: 384
N = int(input())

jmps = []
for _ in range(N):
    jmps.append(int(input()) - 1)

now = 0
ans = 0
for i in range(N):
    if now == 1:
        ans = i
        break
    now = jmps[now]

ans = ans or -1
print(ans)

Measured memory_bytes: 7084
#include<stdio.h>

int main(){
	long long int input, sum=0;
	scanf("%lld", &input);
	for (long long int i=1 ; i<=input ; i++){
		if (i%3==0 || i%5==0){
		} 
		//else if (i%3==0 || i%5==0){
		//} 
		else{
			sum+=i;
		}
	
	} 
	printf("%lld\n", sum);
	
	return 0;
}

Measured memory_bytes: 1736
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"
#include "string"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (n); i++)

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int& x : a) cin >> x;
	sort(a.rbegin(), a.rend());
	int t = n-1;
	ll ans = 0;
	rep(i, n) {
		int lim = 2;
		if (i == 0)lim = 1;
		rep(j, lim) {
			if (t > 0) {
				ans += a[i];
				t--;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    map<char, int> mp;
    int H, W; cin >> H >> W;
    for(int i=0; i<H; i++) for(int j=0; j<W; j++){
        char c; cin >> c;
        mp[c]++;
    }

    if(H%2 == 0 && W%2 == 0){
        for(char c='a'; c<='z'; c++){
            if(mp[c]%4 != 0){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }
    else if((H%2 == 0 && W%2 == 1) || (H%2 == 1 && W%2 == 0)){
        int E, O;
        if(H%2 == 0){ E = H, O = W; }
        else { E = W, O = H; }

        int cnt = 0;
        int goal = E*(O-1)/4;
        int res = goal;
        for(char c='a'; c<='z' && cnt<goal; c++){
            int ccnt = min(mp[c]/4, res);
            cnt += ccnt;
            res -= ccnt;
            mp[c] -= ccnt*4;
        }

        if(cnt < goal){
            cout << "No" << endl;
            return 0;
        }

        for(char c='a'; c<='z'; c++){
            if(mp[c]%2 != 0){
                cout << "No" << endl;
                return 0;
            }
        }

        cout << "Yes" << endl;
        return 0;
    }
    else{
        int cnt = 0;
        int goal = (H-1)*(W-1)/4;
        int res = goal;
        for(char c='a'; c<='z' && cnt<goal; c++){
            int ccnt = min(mp[c]/4, res);
            cnt += ccnt;
            res -= ccnt;
            mp[c] -= ccnt*4;
        }

        if(cnt < goal){
            cout << "No" << endl;
            return 0;
        }

        int odd = 0;
        for(char c='a'; c<='z'; c++) if(mp[c]%2 == 1) odd++;
        
        if(odd != 1){
            cout << "No" << endl;
            return 0;
        }

        cout << "Yes" << endl;
        return 0;
    }
}

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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int K = A + B;

            if (K % 2 == 0)
            {
                Console.WriteLine(K / 2);
            }
           
            else
            {
                Console.WriteLine("IMPOSSIBLE");
            }
               
            }
            
        }
        
    }


Measured memory_bytes: 11092
#include<iostream>
#include<cstdio>
#include<set>
#include<map>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<string>
#include<vector>
#include<queue>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 100000005
#define rep(i,n) for(int i = 0;i < n;i++)
using namespace std;
typedef long long int ll;
typedef pair<int,int> PI;

int cas = 0;

void show(int a[][10],int n){
    printf("Case %d:\n",cas);
    rep(i,n){
        rep(j,n){
            printf("%3d",a[i][j]);
        }
        printf("\n");
    }
}

bool check(int x,int y,int n){
    if(x>=0&&x<n&&y>=0&&y<n)
        return 1;
    else
        return 0;
}

int main(){
    int a[10][10];
    int n;
    int dir[2][2]={{-1,1},{1,-1}};
    while(1){
        cas++;
        cin>>n;
        if(!n)
            break;
        int now[2]={0,0};
        int d=0;
        int put = 1;
        a[0][0]=1;
        if(n==1){
            show(a,1);
            continue;
        }
        a[0][1]=2;
        while(check(now[0],now[1],n)){
            a[now[0]][now[1]]=put;
            if(!check(now[0]+dir[d][0],now[1]+dir[d][1],n)){
                if(!d){
                    if(now[1]+1<n){
                        now[1]++;
                    }else{
                        now[0]++;
                    }
                }else{
                    if(now[0]+1<n){
                        now[0]++;
                    }else{
                        now[1]++;
                    }

                }
                d=1-d;
            }else{
                now[0]+=dir[d][0];
                now[1]+=dir[d][1];
            }
            put++;
        }
        show(a,n);
    }
}

Measured memory_bytes: 1164
from collections import deque
d = deque()
time = dict()
complete = dict()
complete_time = 0
n, q = map(int, input().split())
for _ in range(n):
    process, msec = input().split()
    d.append(process)
    time[process] = int(msec)
while d:
    target_process = d.popleft()
    if time[target_process] <= q:
        complete_time += time[target_process]
        complete[target_process] = complete_time
    else:
        complete_time += q
        time[target_process] -= q
        d.append(target_process)

for key, value in complete.items():
    print(key, value)


Measured memory_bytes: 18296
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <set>
using namespace std;

int main()
{
	int32_t D, G;
	cin >> D >> G;
	G /= 100;

	vector<int32_t> p(D), c(D);
	vector<vector<int32_t>> dp(D + 1);
	for (int32_t i = 0; i < D; i++) {
		cin >> p[i] >> c[i];
		c[i] /= 100;
	}
	for (int32_t i = 0; i <= D; i++)
		dp[i].resize(G + 1, numeric_limits<int32_t>::max());
	dp[0][0] = 0;

	for (int32_t row = 1; row <= D; row++) {
		for (int32_t col = 0; col <= G; col++) {
			if (dp[row - 1][col] == numeric_limits<int32_t>::max())
				continue;
			int32_t pos;
			for (int32_t i = 0; i <= p[row - 1]; i++) {
				pos = col + i * row;
				if (i == p[row - 1])
					pos += c[row - 1];
				if (pos > G)
					pos = G;
				dp[row][pos] = min(dp[row][pos], dp[row - 1][col] + i);
			}
		}
	}

	cout << dp[D][G] << endl;

	return 0;
}


Measured memory_bytes: 4864
n,a,b,c = map(int,input().split())
l = [int(input()) for _ in range(n)]
def dfs(cur,x,y,z):
    if cur == n:
        return abs(a-x) + abs(b-y) + abs(c-z)-30 if min(x,y,z) > 0 else 10**9
    ret1 = dfs(cur+1,x,y,z)
    ret2 = dfs(cur+1,x+l[cur],y,z) + 10
    ret3 = dfs(cur+1,x,y+l[cur],z) + 10
    ret4 = dfs(cur+1,x,y,z+l[cur]) + 10
    return min(ret1,ret2,ret3,ret4)
print(dfs(0,0,0,0))

Measured memory_bytes: 3188
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main() {

    int n, m;
    
    cin >> n >> m;
    
    for (int i = m / n; i; i--) {
        if (m % i == 0) {
            cout << i << endl;
            break;
        }
    }

}

Measured memory_bytes: 256
n,k = map(int,input().split())
h=list(map(int,input().split()))

dp=[10**9]*(n+k+1)

dp[0]=0
for i in range(0,n):
    for j in range(1,k+1):
        if i+j < n:
            dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))

print(dp[n-1])

Measured memory_bytes: 52448
using System;
class Program
{
    static void Main(string[] args)
    {
        //int[] am = new int[200000];
        //int[] bm = new int[200000];
        // 整数の入力
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int M = int.Parse(input[1]);

        int[] cIsland = new int[N+1];
        int chk = 0;
        int k = 0;


        for (int i = 0; i < M; i++) {

            string[] ip = Console.ReadLine().Split(' ');
            int a = int.Parse(ip[0]);
            int b = int.Parse(ip[1]);
            if (a == 1 || b == 1) {
                //cIsland[k] = a + b - 1;
                
                // for (int j = 0; j < k; j++) {
                //     if (cIsland[j] == cIsland[k]){
                //         chk = 1;
                //         break;
                //     }
                // }

                if (cIsland[a + b - 1] ==1){
                    chk = 1;
                        break;
                    }else{
                        cIsland[a + b - 1] =1;
                    }
                k++;
            }

            if (chk == 1)break;

            if (a == N || b == N) {
                //cIsland[k] = a + b - N;
                
                // for (int j = 0; j < k; j++) {
                //     if (cIsland[j] == cIsland[k]){
                //         chk = 1;
                //         break;
                //     }
                // }
                if (cIsland[a + b - N] == 1){
                    chk=1;
                    break;
                    }else{
                        cIsland[a + b - N] = 1;
                    }
                k++;
            }

            if (chk == 1)break;

        }



        if (chk == 0) {
            Console.WriteLine("IMPOSSIBLE");
        } else {
            Console.WriteLine("POSSIBLE");
        }

    }
}

Measured memory_bytes: 15712
#include<iostream>

using namespace std;

int main(){
  int P,Q,R,x,y;
  cin >> P>>Q>>R;
  x = max(P,Q);
  y = max(x,R);
  if(y==P){
    cout << Q+R <<endl;
  }else{if(y==Q){
    cout << P+R <<endl;
  }else{if(y==R){
    cout << Q+P <<endl;
  }} }



  return 0;
}


Measured memory_bytes: 256
dic = {1:0, 2:0, 3:0, 4:0}

for _ in range(3):
    a, b = map(int, input().split(' '))
    dic[a] += 1
    dic[b] += 1
    
if sorted(list(dic.values())) == [1, 1, 2, 2]:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
n,a,b=map(int,input().split())

c=10**9+7

def com(n,k,c):
    l=1
    m=1
    for i in range(k):
        l*=n-i
        m*=i+1
        l%=c
        m%=c
    return l*pow(m,c-2,c)%c

ans=pow(2,n,c)-1-com(n,a,c)-com(n,b,c)

ans%=c

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> p(m), y(m);
    vector<vector<pair<int, int>>> v(n);

    rep(i, m) {
        cin >> p[i] >> y[i];
        v[p[i]-1].push_back(make_pair(y[i], i));
    }

    rep(i, n) {
        sort(v[i].begin(), v[i].end());
        
        rep(j, v[i].size()) {
            y[v[i][j].second] = j+1;
        }
    }

    rep(i, m) {
        printf("%06d%06d\n", p[i], y[i]);
    }
    
    return 0;
}

Measured memory_bytes: 7808
#include <iostream>
#include <string>
using namespace std;
int main(){
  int n;string s;cin>> n>>s;
  for(int i=0;i<s.size();i++){
    char a=s.at(i);
    int b=(int)a+n;
    if(b>90){b-=26;}
    cout << (char)b;
  }
  cout <<endl;
}

Measured memory_bytes: 256
s=input()
K=int(input())
n=len(s)
a=[s[i] for i in range(n)]+[s[i:j] for i in range(0, n-1) for j in range(i+2, min(n+1, i+K+1))]
a.sort()
i=1
counter=1
while counter<K:
  if a[i]!=a[i-1]:
    counter+=1    
  i+=1
print(a[i-1])

Measured memory_bytes: 4572
#include <iostream>

using namespace std;

int main() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];

    sort(a, a + 3);

    int ans = 1 << 26;

    for (int i = a[0]; i <= a[2]; i++) {
        int cnt = 0;

        for (int j = 0; j < 3; j++) {
            if (i > a[j]) {
                if ((i - a[j]) % 2 == 0) {
                    cnt += (i - a[j]) / 2;
                } else {
                    cnt = 1 << 26;
                    break;
                }
            } else {
                cnt += a[j] - i;
            }
        }

        ans = min(ans, cnt);
    }

    cout << ans << endl;
}

Measured memory_bytes: 632
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
//const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


int main() {
    int n;cin>>n;
    vector<ll> a(n);cin>>a;
    sort(all(a));
    
    ll mx=a[n-1];
    
    auto md = lower_bound(all(a),(double)mx/2.0);
    
    ll mdv = *md;
    ll mdr = *(--md);
    
    if(abs((double)mx/2.0-mdv) < abs((double)mx/2.0-mdr)){
        cout<<mx<<" "<<mdv<<endl;
    }else{
        cout<<mx<<" " <<mdr<<endl;
    }
    
    return 0;
}


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

typedef long long ll;

const int mod = 1000000007;
const int INF = 1001001001;

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}

#define rep(i, n)  for(int i=0;i<(n);++i)
#define all(x) (x).begin(),(x).end()

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));

    int s = a[0];
    for(int i = 1; i < a.size(); i++) s = gcd(s, a[i]);

    int maxa = a[n-1];


    if(maxa >= k && k % s == 0) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int N;
    string cName;
	cin >> N;
    if (N > 999) {
        cName = "ABD";
    } else {
        cName = "ABC";
    }
    cout << cName << endl;
	return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(ll, a, b, c, d);
  --a;
  ll bc = b / c;
  ll ac = a / c;
  ll bd = b / d;
  ll ad = a / d;
  ll l = c * d / gcd(c, d);
  ll bl = b / l;
  ll al = a / l;
  out(b - a - ((bc - ac) + (bd - ad) - (bl - al)));
}


Measured memory_bytes: 3600
#include<stdio.h>

int main(){
  int n; scanf("%d",&n);
  for (int i=1; i<10 ;i++){
    if (n%i==0 && n/i<10){
      printf("Yes\n"); break;
    }
    else if (i==9) printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(){
  char c;
  cin >> c;
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
      cout << "vowel" << endl;
  }
  
  else {
      cout << "consonant" << endl;
  }
  
  
  
  
  
  
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int, input().split()))

ans= [0]*N
tmp = A[1]

for i in range(2,N):
    tmp = tmp^A[i]

ans[0]=tmp
print(ans[0])

for i in range(1,N):
    ans[i]=ans[i-1]^A[i-1]^A[i]
    print(ans[i])  




Measured memory_bytes: 31564
#include<cstdio>
using namespace std;
bool a,b;
char s[105];
int main(){
	scanf("%s",&s);
	for(int i=0;s[i]!='\0';++i){
		if(s[i]=='C') a=1;
		if(a && s[i]=='F'){
			b=1;
			printf("Yes\n");
			break;
		}
	}
	if(!(a && b)) printf("No\n");
	return 0;
}

Measured memory_bytes: 128