akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    ll ary[n];
    rep(i,n) cin >> ary[i];

    ll sum = 0;
    rep(i,n) sum += ary[i];
    sum /= 2;
    ll sum02 = 0;
    for (int i=1; i<n; i+=2) {
        sum02 += ary[i];
    }

    ll first_mountain = sum - sum02;
    vector<ll> ans;
    ans.push_back(first_mountain*2);

    rep(i, n-1) {
        first_mountain = ary[i] - first_mountain;
        ans.push_back(first_mountain*2);
    }
    rep(i,n-1) {
        cout << ans[i] << " ";
    }
    cout << ans[n-1] << endl;
}


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

long long div(long long &x){
    int ret = 0;
    if(x < 0){
        if(x % 2 == 0 ) x = -x / 2;
        else {
            x = -x / 2 + 1;
            ret = 1;
        }
    }
    else{
        if(x % 2 == 0 ) x = -x / 2;
        else {
            x = -x / 2;
            ret = 1;
        }
    }
    return ret;
}

int main(){
    
    long long x;
    cin >> x;
    
    vector<int> ans;
    if(x == 0){
        cout << "0" << endl;
        return 0;
    }
    while(x != 1){
        ans.push_back(div(x));
    }
    ans.push_back(1);

    for(int i = ans.size()-1; i >= 0; i--){
        cout << ans[i];
    }
    cout << endl;
    

}



Measured memory_bytes: 256
N,M=map(int,input().split())
H=list(map(int,input().split()))
AB=[list(map(int,input().split())) for i in range(M)]
hasi=[0]*N
for i in range(M):
    if H[AB[i][0]-1]>H[AB[i][1]-1]:
        hasi[AB[i][1]-1]+=1
    elif H[AB[i][0]-1]<H[AB[i][1]-1]:
        hasi[AB[i][0]-1]+=1
    else:
        hasi[AB[i][0]-1]+=1
        hasi[AB[i][1]-1]+=1
print(hasi.count(0))

Measured memory_bytes: 32020
#import collections
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
#import copy
#import numpy as np

x=int(input())
cnt=0
while x-500>=0:
    cnt += 1000*(x//500)
    x%=500
    #print(cnt,x)
while x-5>=0:
    cnt+= 5*(x//5)
    x %= 5
print(cnt)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
int main()
{
 int i,n;
 string s;
 s="No";
 cin >> n;
 for(i=9;i>=1;i--)
 {
  if(n%i==0 && (n/i)<=9)
  s="Yes";
 }
 cout << s;
 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a;
  long long k,b,c=0;
  cin>>n>>k;
  vector<pair<int,long long>> p(n);
  for(int i=0;i<n;i++){
    cin>>a>>b;
    p[i]=make_pair(a,b);
  }
  sort(p.begin(),p.end());
  for(int i=0;i<n;i++){
    c+=p[i].second;
    if(c>=k){
      cout<<p[i].first;
      return 0;
    }
  }
}

Measured memory_bytes: 1792
in_list = input().split(' ')
A = in_list[0]
B = in_list[1]
C = in_list[2]
D = in_list[3]

L = int(A) + int(B)
R = int(C) + int(D)

if L < R:
    print('Right')
elif L > R:
    print('Left')
else:
    print('Balanced')

Measured memory_bytes: 9056
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimine("O3")
#define all(x) (x).begin(),(x).end()
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int arr[101010];
int main()
{
	usecppio
	int n;
	cin >> n;
	for (int i = 1; i<=n; i++)
		cin >> arr[i];
	int ct = 0;
	int on = 1;
	while(ct < 1000000)
	{
		ct++;
		on = arr[on];
		if (on == 2)
		{
			cout << ct;
			return 0;
		}
	}
	cout << -1;
	return 0;
}

Measured memory_bytes: 640
/*
*
*	AUTHOR :- @soham01
*		// "WORK HARD AND NEVER GIVE UP" //
*
*/
#include "bits/stdc++.h"

using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> //find_by_order(), order_of_key()
#define pb push_back
#define mp make_pair 
#define vi vector<long long int >
#define vb vector<bool>
#define vs vector<string>
#define vd vector<double>
#define vvi vector<vector<long long int> >
#define vp vector<pair<long long int , long long int > >
#define seti set<long long int >
#define setc set<char>
#define setd set<double>
#define mod 1000000009
#define endl '\n'
typedef long long int lli;

// ITS MY REQUEST TO PLEASE PLEASE DO LOOK AT THE CONSTRAINS GIVEN CAREFULLY
// DO CHECK FOR CORNER CASES

/*-------LET THE GAME BEGIN-----------*/

void solve()
{
	lli n,a,b,cal,i,c=0,s=0;
	cin>>n>>a>>b;
	s=a+b;
	if(a==0)
	{
		cout<<"0"<<endl;
	}else
	{
		if(n<=a+b)
		{
			if(a<=n)
			{
				cout<<a<<endl;
			}else if(a>n)
			{
				cout<<n<<endl;
			}
		}else{
			lli x=0,y=0;
			x=n/s;
			y=n%s;
		//	cout<<x<<" "<<y<<endl;
			if(y<=a)
			{
				cout<<(a*x) + y<<endl;
			}else{
				cout<<(a*x) + a<<endl;
			}
			
		}
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
		solve();
	return 0;
}





Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  string S;
  cin>>S;
  int ans = 0;
  int tmp;
  for(int l=0;l<S.size();++l) {
    tmp = 0;
    for(int i=0;i<S.size();++i) {
      if(S[i]==S[i+l]) tmp++;
      else {
        ans = max(ans, min(tmp, l));
        tmp = 0;
      }
    }
    if(tmp>0) {
      ans = max(ans, min(tmp, l));
    }
  }
  cout<<ans<<endl;
}



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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

ll n, dp[3][100010], ans, hp[3][100010];

int main(){
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> hp[0][i] >> hp[1][i] >> hp[2][i];
	}
	for(int i=1;i<=n;i++){
		dp[0][i] = max(dp[1][i-1]+hp[0][i], dp[2][i-1]+hp[0][i]);
		dp[1][i] = max(dp[0][i-1]+hp[1][i], dp[2][i-1]+hp[1][i]);
		dp[2][i] = max(dp[1][i-1]+hp[2][i], dp[0][i-1]+hp[2][i]);
	}
	ans = max(dp[1][n], dp[2][n]);
	ans = max(dp[0][n], ans);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4992
//AUTHOR:: MOHAMMAD FAISAL
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
// Bricks Break problem
#include<bits/stdc++.h>
#include<iostream>
#include<bitset>
#include<string>
#include<algorithm>
#include <cctype>
#include<unordered_map>
#include<map>
#include<set>
#include<vector>
#include<utility>
#include<iterator>
using namespace std;
//string password;
int gcd(int a,int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
bool isVowel(char c)
{
    return c=='a' || c=='e' || c=='i' || c=='o' || c=='u';
}
bool isPrime(long long n)
{
  if (n == 1)
  {
    return false;
  }
  long long int i = 2;
  while (i*i <= n)
  {
      if (n % i == 0)
      {
          return false;
      }
      i += 1;
  }
  return true;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.flush();
    int n;
    cin >> n;
    int count=0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin >> x;
        if(x==count+1){
            count++;}
    }
    (count==0) ? cout<<"-1": cout<<n-count;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}

//座圧(破壊的)
int cocomp(ll*a,int n){
	//0～cnt-1に圧縮
	ll*b=(ll*)malloc(sizeof(ll)*n);
	memcpy(b,a,sizeof(ll)*n);
	sortup(b,n);
	int cnt=1;
	rep(r,1,n)if(b[r]!=b[cnt-1])b[cnt++]=b[r];
	rep(i,0,n){
		int l=0,r=cnt;
		while(r-l>1){int m=(l+r)/2;if(b[m]>a[i])r=m;else l=m;}
		a[i]=l;
	}
	free(b);
	return cnt;
}

ll a[100010];
int x[100010],y[100010];
int cnt;
int ans[100010],anscnt;
int main(){
	int n;
	scanf("%d",&n);
	rep(i,0,n)scanf("%lld",a+i);
	cocomp(a,n);
	rep(i,0,n){
		if(a[i]!=a[n-1-i]){
			if(y[a[i]])y[a[i]]--;
			else x[a[i]]++,cnt++;
			if(x[a[n-1-i]])x[a[n-1-i]]--,cnt--;
			else y[a[n-1-i]]++;
		}
		if(!cnt)ans[anscnt++]=i+1;
	}
	rep(i,0,anscnt)printf("%d%c",ans[i],i==anscnt-1?10:32);
}


Measured memory_bytes: 3820
class SegmentTree:
    '''
    SegmentTree(arr, e)
        arr : 配列,
        e : 単位元\n
    segment_tree[i] = x で更新\n
    segment_tree[a,b] で区間[a,b)の計算結果を得る(a<bでなければ単位元が返ってくる)
    '''
    def __init__(self, arr, e):
        self.e = e
        self.len = len(arr)
        # 最下層の長さnの初期化(扱う配列の長さ以上の2冪のうち最も小さいもの)
        n = 2 ** (len(bin(self.len + 1)) - 2)
        self.n = n
        # nodeの初期化
        node = [e] * (2 * n)
        node[n: n + self.len] = arr
        for i in range(n - 1, 0, -1):
            node[i] = node[2 * i] + node[2 * i + 1]
        self.node = node


    def __setitem__(self, i, val):
        # 最下層からはじめる。それより上にはn-1個のノードがある
        i += self.n
        self.node[i] = val
        # 最上層に辿り着くまで
        while i > 1:
            # 親に移動
            i //= 2
            # 2つの子に対する計算結果
            self.node[i] = self.node[2 * i] + self.node[2 * i + 1]

    def __getitem__(self, i):
        return self.node[self.n + i]

    def query(self, a, b):
        a = self.trim(a, self.len)
        b = self.trim(b, self.len)

        # [a,b)が欲しい
        # k=0, [l=0,r=n)から始める
        # [l,r)が[a,b)の中に入るまで[l,mid), [mid,r)に分割して再帰
        def get(k, l, r):
            # そもそも[l,r)が[a,b)に入ってない時は計算に影響を与えない単位元を返す
            if r <= a or b <= l:
                return self.e
            if a <= l and r <= b:
                return self.node[k]
            m = (l + r) // 2
            return get(2 * k, l, m) + get(2 * k + 1, m, r)

        return get(1, 0, self.n)


    def getlist(self):
        return self.node[self.n:]

    def trim(self, i, n):
        i = max(i, -n)
        i = min(i, n)
        if i < 0:
            i += n
        return i



# https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_B
n, q = map(int, input().split())
A = [0] * n
st = SegmentTree(A, 0)
for i in range(q):
    com, x, y = map(int, input().split())
    x -= 1
    if com == 0:
        st[x] += y
    else:
        y -= 1
        # print(st[x: y + 1])
        print(st.query(x, y + 1))



Measured memory_bytes: 11548
int a[100000];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    scanf("%d", &a[i]);
  int xor_sum = 0;
  for (int i = 0; i < n; i++)
    xor_sum ^= a[i];
  int ans = 0;
  for (int bit = 29; bit >= 0; bit--) {
    if (((1 << bit) & xor_sum) == 0) {
      continue;
    }
    int x = (1 << (bit + 1)) - 1;

    for (int i = 0; i < n; i++) {
      int y = a[i] ^ (a[i] - 1);
      if (y == x) {
        xor_sum ^= y;
        ans += 1;
        break;
      }
    }
  }

  if (xor_sum != 0) {
    printf("-1\n");
  } else {
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 512
//O7Oo7oO7O

#include <bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

using ll = long long int;

int main()
{
	IOS

    int n;
    cin>>n;
    int flag=0;
    while(n>0)
    {
    	if(n%10==7)
    		flag=1;
    	n/=10;

    }
    if(flag)
    	cout<<"Yes\n";
    else
    	cout<<"No\n";

    return 0;
}



Measured memory_bytes: 3696
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int, string> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
string S;
int N;
map<P, ll> mp;
bool judge(string s){
    string str = s;
    rep(i,0,4){
        if(i < 3)swap(str[i], str[i+1]);
        rep(j,0,2)if(str.substr(j,3) == "AGC"){
            //cout << S << endl;
            return 0;
        }
        swap(str[i], str[i+1]);
    }
    return 1;
}
int dfs(int i, string str){
    if(mp[P(i, str) ] != 0){
        return mp[P(i, str)];
    }
    if(i == N)return 1;
    
    string s = "AGCT";
    ll ret = 0;
    for(auto c:s){
        string ss = str;
        ss += c;
        if(judge(ss)){
            ret = (ret + dfs(i + 1, str.substr(1) += c )) % MOD;
        }
    }
    mp[P(i, str)] = ret;
    
    return ret;
}
main(){
    cin >> N;
    cout << dfs(0, "TTT") << endl;
}

Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<cmath>
#include<array>
#include<algorithm>
#include<queue>
//#include<deque>
#include<vector>
//#include<utility>
//#include<set>
#include<map>
//#include<list>
#include<bitset>
#include<iomanip>

using namespace std;
using LLI = long long int;
LLI N;

//array<int, 8>dir_x = { 0,0,1,1,1,-1,-1,-1 };
//array<int, 8>dir_y = { 1,-1,1,0,-1,1,0,-1 };
//array<int, 4>dir_x2 = { 0,0,1,-1 };
//array<int, 4>dir_y2 = { 1,-1,0,0 };
//char alp[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };

//class UnionFind {
//public:
//	vector<int>data;
//	UnionFind(int size) :data(size, -1) {};
//	bool unionset(int x, int y) {
//		x = root(x), y = root(y);
//		if (x != y) {
//			if (data[y] < data[x]) {
//				swap(x, y);
//			}
//			data[x] += data[y];
//			data[y] = x;
//		}
//		return x != y;
//	}
//	bool findset(int x, int y) {
//		return root(x) == root(y);
//	}
//	int root(int x) {
//		return data[x] < 0 ? x : data[x] = root(data[x]);
//	}
//	int size(int x) {
//		return -data[root(x)];
//	}
//};

//LLI gcd(LLI x, LLI y) {
//	LLI  r;
//	if (x < y) {
//		swap(x, y);
//	}
//	r = x % y;
//	while (r != 0) {
//		x = y;
//		y = r;
//		r = x % y;
//	}
//	return y;
//}
//LLI lcm(LLI x, LLI y) {
//	return x / gcd(x, y) * y;
//}

//long nCr(int n, int r) {
//	long ans = 1;
//	for (int i = n; i > n - r; i--) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1; i++) {
//		ans = ans / i;
//	}
//	return ans;
//}
//long nHr(int n,int r) {
//	n = n + r - 1;
//	return nCr(n,r);
//}

//const int n_max = 8;
//array<array<bool, n_max>, n_max>graph;
//int dfs(int v,int N,array<bool,n_max>visited) {
//	int ret = 0;
//	bool all_visited = true;
//	for (int i = 0; i < N;i++) {
//		if (visited[i] == false) {
//			all_visited = false;
//		}
//	}	
//	if (all_visited) {
//		return 1;
//	}
//	for (int i = 0; i < N;i++) {
//		if (graph[v][i] == false) {
//			continue;
//		}
//		if (visited[i] == true) {
//			continue;
//		}
//		visited[i] = true;
//		ret += dfs(i,N,visited);
//		visited[i] = false;
//	}
//	return ret;
//}

//vector<vector<int>>sub;
//int dfs(int id) {
//	if (sub[id].size() == 0) {
//		return 1;
//	}
//	int minP = (int)1e9;
//	int maxP = 0;
//	for (int i : sub[id]) {
//		int P = dfs(i);
//		minP = min(minP, P);
//		maxP = max(maxP, P);
//	}
//	return minP + maxP + 1;
//}

//#define debug(x) cerr << #x << " : " << x << endl
//#define debugv(x) cerr << #x << " : "; for(auto i:x) cerr << i << ", "; cerr<<endl

int main(void) {
	LLI N;
	cin >> N;
	vector<pair<LLI, LLI>>vec(N);
	for (int i = 0; i < N;i++) {
		cin >> vec[i].first;
	}
	for (int i = 0; i < N; i++) {
		cin >> vec[i].second;
	}
	LLI sum = 0;
	for (int i = 0; i < N;i++) {
		if (vec[i].first > vec[i].second) {
			sum += vec[i].first - vec[i].second;
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 256
import sys
# N,M = [int(n) for n in input().split()]
# S = str(input())
# T = str(input())

S = str(input())
N = int(S)
sum = 0
for i in range(len(S)):
    sum+=int(S[i])
if(N%sum == 0):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




int main() {
    string s;
    int x[3] = {};
    cin >> s;
    REP(i, s.size()){
        x[s[i] - 'a']++;
    }
    if(abs(x[0] - x[1]) >= 2){
        cout << "NO" << endl;
        return 0;
    }
    if(abs(x[1] - x[2]) >= 2){
        cout << "NO" << endl;
        return 0;
    }
    if(abs(x[0] - x[2]) >= 2){
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  int k;
  cin >> k;
  rep(i,0,k){
    cout << "ACL";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;

int main() {
    ll n, d;
    cin >> n >> d;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        if(x * x + y * y <= d * d) {
            ans++;
        }
    }
    cout << ans << endl;
}


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

int main(){

  int h, w, i, j, ch;
  char cl[100][100];
  int po[100][100];

  cin >> h >> w;

  for (i=0; i<h; i++){
    cin >> cl[i];
  }

  for (i=0; i<h; i++){
    for (j=w; j>0; j--){
      ch = j;po[i][j-1]=0;
      while(ch > 0){
	if (cl[i][ch-1] == 'c'){
	  break;
	}
	ch--;
	if(ch==0){
	  po[i][j-1]=-1;
	  // cout << po[i][j-1];
	  break;
	}
	po[i][j-1]++;
      }
    }
  }

  for (i=0; i<h; i++){
    for (j=0; j<w; j++){
      cout << po[i][j];
      if (j<w-1){
	cout << " ";
      }
    }
    cout << endl;
  }

  return 0;

}

Measured memory_bytes: 3108
#include<iostream>
#include<cmath>
#include<map>
#include<deque>
#include<string>
#include<algorithm>
#include<bitset>
typedef long long ll;

#define all(x) (x).begin(),(x).end()
#define puts(x) cout<< x << endl;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define fore(i,a) for(auto i:a)
#define MOD= 1000000007;
using namespace std;
int n;
string s;
int main(){
    cin>>n>>s;
    rep(i,0,s.size()){
        s[i]+=n;
        if(s[i]>'Z')s[i]-=('Z'-'A'+1);
    }
    puts(s);
}


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

int main(){
  bool j=true;
  int count=0;
  vector<pair<int,int>> s;
  for(int i=0;i<6;i++){
    int h,w;
    cin>>h>>w;
    if(h>w){swap(h,w);}
    s.push_back({h,w});
  }
  sort(s.begin(),s.end());
  vector<pair<int,int>> e;
  for(int i=0;i<3;i++){
    if(s[i*2]!=s[i*2+1]){j=false; break;}
    bool samef=false;
    bool sames=false;
    for(int t=0;t<3;t++){
      if(t!=i && (s[i*2].first==s[t*2].second || s[i*2].first==s[t*2].first)){samef=true;}
      if(t!=i && (s[i*2].second==s[t*2].second || s[i*2].second==s[t*2].first)){sames=true;}
    }
    if(!samef || !sames){j=false; break;}
    bool donef=false;
    bool dones=false;
    for(int t=0;t<e.size();t++){
      if(e[t].first==s[i*2].first){e[t].second++; donef=true;}
    }
    if(!donef){e.push_back({s[i*2].first,1});}
    for(int t=0;t<e.size();t++){
      if(e[t].first==s[i*2].second){e[t].second++; dones=true;}
    }
    if(!dones){e.push_back({s[i*2].second,1});}
  }
  for(int i=0;i<e.size();i++){
    if(e[i].second%2!=0){j=false;}
  }
  cout<<(j?"yes":"no")<<endl;

  return 0;
}



Measured memory_bytes: 3092
#include<stdio.h>
#include<stdlib.h>

int m[20000];
int n[20000];
int r[20000];
int a,b,c;

void push_1(int x) {
  m[a]=x;
  a++;
}
void push_2(int x) {
  n[b]=x;
  b++;
}
void push_3(int x) {
  r[c]=x;
  c++;
}
int pop_1() {
  if(a==0) return -1;
  a--;
  return m[a];
}
int pop_2() {
  if(b==0) return 0;
  b--;
  return n[b];
}
int pop_3() {
  if(c==0) return -1;
  c--;
  return r[c];
}

int main() {
  char w[20000];
  scanf("%s",w);
  int i=0,j=0,d=0,sum=0,z=0,g[20000];
   a=b=c=0;
   
  while(w[i]=='\\' || w[i]=='/' || w[i]=='_') {
    if(w[i]=='\\') push_1(i);
    if(w[i]=='/') {
      int x=pop_1();
      if(x>=0) {
          d=0;
	    while(1) {
	    int y=pop_3();
	    if(y<x) {
	    if(y!=-1) push_3(y);
	    break;
	  }
	  
	 d+=pop_2();
	 
	}
	d+=i-x;
	push_2(d);
	push_3(x);
  }
  }
    i++;
}

  while(1){
    int x=pop_2();
    if(x==0) break;
    sum+=x;
    g[z]=x;
    z++;
  }
  
  
  printf("%d\n%d",sum,z);
  for(j=z-1; j>=0; j--) printf(" %d",g[j]);
  printf("\n");
  return 0;
}



Measured memory_bytes: 2092
import bisect,sys
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac =fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV
        
    return CONV()


def cumsum(As):
    s = 0
    for a in As:
        s+=a
        yield s


sys.setrecursionlimit(200005)


def main():
    N,K = isRaw()
    sRa = []
    for k in range(K):
        d = iRaw()
        As = isRaw()
        sRa+=As
    return N - len(set(sRa))
    
if __name__ == "__main__":
    print(main())


Measured memory_bytes: 67980
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  bool good=true;
  cin>>str;
  for(int i=0;i<str.size()-1;i++){
    if(str[i]==str[i+1]){
      good=false;
    }
  }
  if(good){
    cout<<"Good"<<endl;
  }else{
    cout<<"Bad"<<endl;
  }
  return(0);
}


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

int main() {
    char x, y;
    cin >> x >> y;

    if (x == y)
        cout << '=' << endl;
    else if (x < y)
        cout << '<' << endl;
    else
        cout << '>' << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int freq[100001]={0};
  int n;
  scanf("%d", &n);
  int arr[n];
  for(int a=0;a<n;a++)
  {
	  scanf("%d ", &arr[a]);
	  freq[arr[a]]++;
  }
  long long int sum=0;
  sum=accumulate(arr,arr+n,sum);
  int q;
  scanf("%d ", &q);
  while(q--)
  {
  	int b,c;
  	scanf("%d %d", &b,&c);
  	sum+=(c-b)*freq[b];
  	freq[c]+=freq[b];
  	freq[b]=0;
  	printf("%lld\n", sum);
  }
}

Measured memory_bytes: 4580
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int N,C;
ll D[35][35];
ll c[3][35];
ll K;

int main()
{
	cin >> N >> C;
	rep(i,0,C) rep(j,0,C) {
		cin >> D[i][j];
	}
	rep(i,0,N) rep(j,0,N) {
		int a;
		cin >> a;
		a--;
		c[(i+j)%3][a]++;
	}
	ll ans = INF;
	rep(i,0,C) rep(j,0,C) rep(k,0,C) { //i,j,k色に変える
		if(i==j or j==k or k==i)continue;
		ll s = 0;
		rep(t,0,C)s+=D[t][i]*c[0][t]+D[t][j]*c[1][t]+D[t][k]*c[2][t];
		ans = min(ans,s);
	}
	cout << ans << endl;
	return 0;
}


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

const double PI = acos(-1);

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_c() {
	ll a, b, h, m;
	//ll ans = 0;
	double ans = 0;
	cin >> a >> b >> h >> m;

	double ra, rb;
	ra = PI * h / 6 + PI / 6 * m / 60;
	rb = PI * m / 30;
	ans = sqrt(a * a + b * b - 2 * a * b * cos(fabs(ra - rb)));

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

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed;
	cout << setprecision(15);

	solve_abc_c();

	return 0;
}


Measured memory_bytes: 4244
(defun make-unionfind (n)
  (let ((x (make-array n)))
    (loop for i from 0 below n
       do (setf (aref x i) i))
    x))

(defun quel (uf a)
  (cond ((= a (aref uf a)) a)
	(t (let ((b (quel uf (aref uf a))))
	     (setf (aref uf a) b)
	     b))))

(defun unite (uf a b)
  (let ((c (quel uf a))
	(d (quel uf b)))
    (setf (aref uf c) d)))

(defun main ()
  (let* ((n (read))
	 (m (read))
	 (langs (make-array m :initial-element nil))
	 (uf (make-unionfind n)))
    (loop for i from 0 below n
       do (let ((k (read)))
	    (loop repeat k
	       for l = (1- (read))
	       do (push i (aref langs l)))))
    (loop for pohe across langs
       unless (null pohe)
       do (loop for x in pohe
	     for y in (cdr pohe)
	     do (unite uf x y)))
    (let ((ans (loop for i from 0 below n
		  always (= (quel uf 0) (quel uf i)))))
      (format t "~a~%" (if ans "YES" "NO")))))

(main)


Measured memory_bytes: 58884
n = int(input())
s = [int(input()) for i in range(n)]
notTenTimes = list(filter(lambda x: x % 10 != 0, s))
ans = sum(s)

if sum(s) % 10 == 0:
    if(len(notTenTimes)):
        ans -= min(notTenTimes)
    else:
        ans = 0

print(ans)



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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

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

using namespace std;

string tenki[3] = {"Sunny", "Cloudy", "Rainy"};

int main() {
    string s;
    cin >> s;

    string ans = "";

    if(s == tenki[0])
        cout << tenki[1] << endl;
    else if(s == tenki[1])
        cout << tenki[2] << endl;
    else
        cout << tenki[0] << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long countA= 0;
		long countB=0;
		long a[] = new long[N];
		long b[] = new long[N];
		for (int i=0;i<N;i++) {
			a[i] = sc.nextLong();
			countA+=a[i];
		}
		for (int i=0;i<N;i++) {
			b[i] = sc.nextLong();
			countB+=b[i];
		}
		if (countB>=countA) {
			long ca =0;
			long cb=0;
			for (int i=0;i<N;i++) {
				if (a[i]>=b[i]) {
					cb +=a[i]-b[i];
				} else {
					ca+=(b[i]-a[i])/2;
					ca +=(b[i]-a[i])%2;
					cb +=(b[i]-a[i])%2;
				}
			}
			long count= countB-countA;
			if (count<cb||count<ca) {
				System.out.println("No");
			} else {
				if ((count-ca)*2==count-cb) {
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			}
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 56780
s=input()
lis=["q","w","e","r","t","y","u","i","o","p","l","k","j","h","g","f","d","s","a","z","x","c","v","b","n","m"]
a=set()
for i in range(len(s)):
    a.add(s[i])
#print(a)
ans=[]
for i in range(len(lis)):
    if lis[i] in a:
        continue
    ans.append(lis[i])
ans.sort()
if ans:
    print(ans[0])
else:
    print("None")


Measured memory_bytes: 39280
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    string s;
    cin >> s;
    stack<int> st;
    vector<P> vec;
    int sum = 0;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == '\\') st.push(i);
        else if(s[i] == '/')
        {
            if(st.size() == 0) continue;
            sum += i - st.top();
            P tmp = make_pair(i - st.top(), st.top());
            while(vec.size() > 0 && vec.back().second >= tmp.second)
            {
                tmp.first += vec.back().first;
                vec.pop_back();
            }
            vec.push_back(tmp);
            st.pop();
        }
    }
    cout << sum << endl;
    cout << vec.size();
    for(int i = 0; i < vec.size(); i++)
    {
        cout << " " << vec[i].first;
    }
    cout << endl;
	return 0;
}


Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
int main() {
  ll n,d,x,a;
  cin>>n>>d>>x;
  ll ans=n+x;
  d--;
  for(int i=0;i<n;i++){
    cin>>a;
    ans+=d/a;
  }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  long n, times[5];
  cin >> n;
  for (int i = 0; i < 5; i++)
    cin >> times[i];
  
  long sum = 0;
  for (int i = 0; i < 5; i++) {
  	long time = (n + times[i] - 1) / times[i];
    sum = max(sum + 1, time + i);
  }
  
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
        nums: [u32; n],
    }
    let ans = nums
                .iter()
                .map(|&u| u.trailing_zeros())
                .min()
                .unwrap();
    println!("{}", ans)
}


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


int main() {
    int H,W;
    cin >> H >> W;
    int C[H*W][H*W] = {};
    rep(i,H*W){
        rep(j,H*W){
            if(i==j) C[i][j] = 0;
            else C[i][j] = 10000;
        }
    }
    bool S[H][W] = {};
    rep(i,H){
        string s;
        cin >> s;
        rep(j,W){
            if(s[j] == '.') S[i][j] = 1;
            //S[i][j] = (s[j] == '.' ? 1 : 1000);
        }
    }
    rep(i,H){
        rep(j,W-1){
            int x = i * W + j;
            int v = (S[i][j] == 1 && S[i][j+1] == 1 ? 1 : 10000);
            C[x][x+1] = v;
            C[x+1][x] = v;
        }
    }
    rep(i,H-1){
        rep(j,W){
            int x = i * W + j;
            int v = (S[i][j] == 1 && S[i+1][j] == 1 ? 1 : 10000);
            C[x][x+W] = v;
            C[x+W][x] = v;
        }
    }

    /*
    rep(i,H*W){
        rep(j,H*W){
            cout << setw(12) << C[i][j] << " ";
        }
        cout << endl;
    }
    */

    for(int k=0;k<H*W;k++){
        for(int i=0;i<H*W;i++){
            for(int j=0;j<H*W;j++){
                C[i][j] = min(C[i][j],C[i][k] + C[k][j]);
            }
        }
    }

    /*
    rep(i,H*W){
        rep(j,H*W){
            cout << setw(12) << C[i][j] << " ";
        }
        cout << endl;
    }
    */

    int res = 0;
    rep(i,H*W){
        rep(j,H*W){
            if(C[i][j] < 10000) res = max(res,C[i][j]);
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 896
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;



void solve(){
}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    vector<vector<pair<int,int>>> q(n);
    rep(i,n){
        cin >> a[i];
        rep(j,a[i]){
            int x,y;
            cin >> x >> y;
            q[i].push_back(make_pair(x,y));
        }
    }
    int ans = 0;
    for(int bit=0;bit<(1<<n);bit++){
        int cnt=0;
        bool rr = false;
        rep(i,n){
            if(bit & (1 << i)){
                rep(j,a[i]){
                    int l = q[i][j].first;
                    int r = q[i][j].second;
                    if(r==1){
                        if(bit & (1 << (l-1))) {
                            continue;
                        }else{
                            rr = true;
                            break;
                        }
                    }else{
                        if(!(bit & (1 << (l-1)))) continue;
                        else{
                            rr = true;
                            break;
                        }
                    }
                }
            }
        }
        if(rr){
            continue;
        }else{
            rep(i,n){
                if(bit & (1 << i)) ++cnt;
            }
            ans = max(ans,cnt);
        }
    }

    cout << ans;
    return 0;
}

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

using namespace std;

typedef long long ll;
const double eps=1e-6,pi=acos(-1);
const int N=1e5+5,M=1e9+7,SEGM=4*N,OO=0x3f3f3f3f;
int t,n,m,k;
int a[N];
int mem[N][2];

int solve(int rem,bool p){
    if(rem==0) return !p;
    int &ret=mem[rem][p];
    if(~ret) return ret;
    ret=!p;
    for(int i=0;i<n;++i){
        if(rem-a[i]>=0){
            if(solve(rem-a[i],!p)==p){
                ret=p;
                break;
            }
        }
    }
    return ret;
}

int main(){
    //freopen("myfile.txt","w",stdout);
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;++i)
        scanf("%d",a+i);
    memset(mem,-1,sizeof mem);
    if(!solve(k,0)) printf("First\n");
    else printf("Second\n");
    return 0;
}


Measured memory_bytes: 12356
/******************************************
* NICK : nikhilsinghh59 *
******************************************/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"

#define PB push_back
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
const int M = 1e9+7;

int main()
{   
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    ll k , n;
    cin >> k >> n;

    ll ar[n];
    for(ll i=0 ;i<n ; i++){
        cin >> ar[i];
    }

    sort(ar , ar+n);


    ll ans = INT_MAX;

    for(ll i=0 ; i<n ; i++) {
        if(i==0) {
            ans = min(ans , ar[n-1] - ar[0]);
        }
        else if(i==n-1) {
            ans = min(ans , k - (ar[n-1] - ar[n-2]));
        }
        else {
            ans =min(ans , k - (ar[i] - ar[i-1]));
        }

    }
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define int long long
#define maxn 1010
using namespace std;
int n,k;
int x[maxn][3];
main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
		for(int j=0;j<3;j++)
			cin>>x[i][j];
	int mx=0;
	for(int mask=0;mask<8;mask++)
	{
		vector<int> v;
		for(int i=0;i<n;i++)
		{
			int t=mask,val=0;
			for(int j=0;j<3;j++)
			{
				if(t&1)
					val+=x[i][j];
				else
					val-=x[i][j];
				t/=2; 
			}
			v.push_back(val);
		}
		sort(v.rbegin(),v.rend());
		int sum=0;
		for(int i=0;i<k;i++)
			sum+=v[i];
		mx=max(mx,sum);
	}
	cout<<mx<<endl;
	return 0;
}

Measured memory_bytes: 256
#    !/usr/bin/env python3
#    encoding: UTF-8
#    Modified: <07/Jul/2019 05:31:11 PM>


#    ✪ H4WK3yE乡
#    Mohd. Farhan Tahir
#    Indian Institute Of Information Technology (IIIT), Gwalior


import sys
import os
from io import IOBase, BytesIO


def main():
    n, a, b = get_ints()
    print(min(n * a, b))


BUFSIZE = 8192


class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill():
            pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill()
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        py2 = round(0.5)
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2 == 1:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode("ascii"))
            self.read = lambda: self.buffer.read().decode("ascii")
            self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def get_array(): return list(map(int, sys.stdin.readline().split()))


def get_ints(): return map(int, sys.stdin.readline().split())


def input(): return sys.stdin.readline().strip()


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  for(int i=k;i<n;i++)
  {
    if(a[i]>a[i-k])
      cout<<"Yes"<<endl;
    else 
      cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 4428
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, k, t; cin >> n >> k >> t;
  int u, v, l; cin >> u >> v >> l;
  t *= v;
  bitset<10000> bs;
  while (n--) {
    int d; cin >> d;
    bs[d] = true;
  }
  double res = 0;
  int c = 0, r = 0;
  for (int x = 0; x < l; ++x) {
    if (bs[x]) {
      if (c < k and r) ++c;
      else r = t;
    }
    res += 1.0 / (r ? v : u);
    if (r) {
      if (!--r and c) {
        --c;
        r = t;
      }
    }
  }
  cout << fixed << setprecision(15) << res << '\n';
}


Measured memory_bytes: 3304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
const ll mod = 1e9+7;
typedef pair<int,int> P;
#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,m,N) for(int i=m;i<N;i++)
#define mm(n,m) memset(n,m,sizeof(n))

int main(){
  int n;
  string s;
  string ans="";
  cin>>n>>s;
  rep(i,s.length()){
    int tmp = s[i]-'A';
    tmp+=n;
    s[i] += n;
    if(tmp>=26){
      s[i] -= 26;
    }
    cout<<s[i];
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

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

using namespace std;

typedef long long ll;

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

  int n; cin >> n;
  double ans = 0;

  for (int i = 1; i <= n; i++) {
    if (i & 1) {
      ans++;
    }
  }

  cout << ans / n << endl;

  return 0;
}


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

//素数かどうかを判定する関数を作る
int PrimeNum(int N){
  bool jud = true;
  for (int i=2; i<=N-1; i++){
    if (N%i == 0){
      jud = false;
      break;
    }
  }
  if (jud == true){
    return true;
  }
  else{
    return false;
  }
}

int main(){
  int X; cin >> X;
  int ans=0;
  for (int i=0; i<=X; i++){
    if (PrimeNum(X+i) == true){
      ans = X+i;
      break;
    }
  }  
  cout << ans << endl;
}

Measured memory_bytes: 764
n=gets.to_i
f=(1..n).map{gets.tr(' ', '').to_i(2)}
p=(1..n).map{gets.split.map &:to_i}
puts (1..1023).map{|i|f.zip(p).map{|x, y| y[("%b" % (i&x)).count(?1)]}.inject :+}.max


Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using psi=pair<string,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
template<class T>void geti(T&a){for(auto&_:a)cin>>_;}
template<class T>void getii(T&a){for(auto&_:a)geti(_);}
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__)
#define dclt(t,...) t __VA_ARGS__;get(__VA_ARGS__)
class Eratosthenes{
  public:
    int n, sqlim;
    vector<bool> prime;
    Eratosthenes(int N):n(N+1){
        sqlim=(int)ceil(sqrt(n));
        prime=vector<bool>(n,1); prime[0]=prime[1]=0;
        for(int i=2;i<=sqlim;i++) if(prime[i]) for(int j=i*i;j<=n;j+=i) prime[j]=0;}
    vector<int> primeArray(int s=0, int l=10000){vi ret; for(int i=s;ret.size()!=l&&i<n;i++) if(prime[i]) ret.push_back(i); return ret;}
};


int main(){
	int n,ans;
	vi a=Eratosthenes(10000).primeArray();
	
	cin>>n;
	ans=n;
	rep(lp,n){
		int p; cin>>p;
		for(int i=0;i<a.size()&&a[i]<p;i++){
			if(p%a[i]==0){
				ans--;
				break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3172
q,h,s,d = map(int, input().split())
n = int(input())
# print(min(q*8,h*4,s*2,d),min(q*8,h*4,s*2))
print((n//2 * min(q*8,h*4,s*2,d)) + (n%2 * min(q*4,h*2,s)))

Measured memory_bytes: 2940
#include<iostream>
#include<cstdio>

using namespace std;

const int maxn=1e4+5;
const int NIL=-1;

struct node{
    int parent,left,right;
};

node t[maxn];
int d[maxn],h[maxn],n;

void setdepth(int u,int p)
{
    if(u==NIL){
        return ;
    }
    d[u]=p;
    setdepth(t[u].left,p+1);
    setdepth(t[u].right,p+1);
}

int setheight(int u)
{
    int h1=0,h2=0;
    if(t[u].left!=NIL){
        h1=setheight(t[u].left)+1;
    }
    if(t[u].right!=NIL){
        h2=setheight(t[u].right)+1;
    }
    return h[u]=max(h1,h2);
}

int getsibling(int u)
{
    if(t[u].parent==NIL){
        return NIL;
    }
    if(t[t[u].parent].left!=u&&t[t[u].parent].left!=NIL){
        return t[t[u].parent].left;
    }
    if(t[t[u].parent].right!=u&&t[t[u].parent].right!=NIL){
        return t[t[u].parent].right;
    }
    return NIL;
}

void print(int u)
{
    printf("node %d: ",u);
    printf("parent = %d, ",t[u].parent);
    printf("sibling = %d, ",getsibling(u));
    int deg=0;
    if(t[u].left!=NIL){
        deg++;
    }
    if(t[u].right!=NIL){
        deg++;
    }
    printf("degree = %d, ",deg);
    printf("depth = %d, ",d[u]);
    printf("height = %d, ",h[u]);
    if(t[u].parent==NIL){
        printf("root\n");
    }else if(t[u].left==NIL&&t[u].right==NIL){
        printf("leaf\n");
    }else{
        printf("internal node\n");
    }
}

int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        t[i].parent=NIL;
    }
    int p,l,r;
    for(int i=0;i<n;i++){
        scanf("%d%d%d",&p,&l,&r);
        t[p].left=l;
        t[p].right=r;
        if(l!=NIL){
            t[l].parent=p;
        }
        if(r!=NIL){
            t[r].parent=p;
        }
    }
    int root;
    for(int i=0;i<n;i++){
        if(t[i].parent==NIL){
            root=i;
        }
    }
    setdepth(root,0);
    setheight(root);
    for(int i=0;i<n;i++){
        print(i);
    }
    return 0;
}
/*
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
*/



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

struct UnionFind{
	vector<int> par;
	int sz;
	
	UnionFind(int N) : par(N) , sz(N) {
		for(int i=0;i<N;i++) par[i]=i;
	}
	
	int root(int x){
		if(par[x]==x) return x;
		else{
			return par[x]=root(par[x]); //ここは同時に経路圧縮もやってるらしい
		}
	}
	
	void unite(int x,int y){
		int rx=root(x);
		int ry=root(y);
		if(rx==ry) return;
		else { par[rx]=ry; sz--; }
	}
	
	bool same(int x,int y){
		int rx=root(x);
		int ry=root(y);
		return rx==ry;
	}
	
	int size() { return sz; }
};

int main(){
	int N,M,x,y,z;
	cin >> N>>M;
	UnionFind uf(N);
	for(int i=0;i<M;i++){
		cin >>x>>y>>z; x--; y--;
		uf.unite(x,y);
	}
	cout<<uf.size()<<endl;
}



Measured memory_bytes: 640
use std::cmp::*;
use std::io::*;
use std::num::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn main() {
    let s: String = read();
    let mut v: Vec<char> = s.chars().collect();
    if v.len() == 3 {
        v.reverse();
    }
    let a: String = v.iter().fold("".into(), |x, c| x + c.to_string().as_ref());
    println!("{}", a);
}


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

using namespace std;
#define Size(x) ((int)(x).size())
#define pb push_back
#define LD_OUT setprecision(12) << fixed
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const int INF = 1e9 + 10;
const int MN = 1e5 + 10;

int n ;
bool dp1[MN] , dp0[MN];
vector<int>adj[MN];

void dfs(int s,int pr)
{
	int C = 0;
	for(auto v:adj[s]) if(v!=pr){
		dfs(v , s);
		if(dp0[v]) ++C;	
	}
	for(auto v:adj[s]) if(v != pr){
		C -= dp0[v];
		if(dp1[v] && C == Size(adj[s])-2+(pr == -1)) dp0[s] = true;
		C += dp0[v];
	}
	if(C == Size(adj[s])-1) dp1[s] = true;
}

int main()
{
	ios_base :: sync_with_stdio(false) ,cin.tie(0) , cout.tie(0);
	cin >> n;
	for(int i=0;i<n-1;++i){
		int a,b;cin>>a>>b;--a,--b;
		adj[a].pb(b) , adj[b].pb(a);
	}
	dfs(0 , -1);
	if(dp0[0]) cout << "Second\n";
	else cout << "First\n";
	return 0;
}


Measured memory_bytes: 6016
#include <stdio.h>
int main(void){
	int N;
	scanf("%d",&N);
	int x=0;
	x = (N +(4-1))/4;
	int i,flag=0;
	//printf("x = %d",x);
	for(i=0;i<=x;i++){
		
		if( (N-4*i)%7==0){
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
bool vis[maxn];int dp[maxn];
int d(int x)
{
	if(vis[x]) return dp[x];
	vis[x]=1;int &ans=dp[x];ans=0;
	if(x==0) return 1;
	if(x>=100&&d(x-100))
	{
		ans=1;return 1;
	}
	if(x>=101&&d(x-101))
	{
		ans=1;return 1;
	}
	if(x>=102&&d(x-102))
	{
		ans=1;return 1;
	}
	if(x>=103&&d(x-103))
	{
		ans=1;return 1;
	}
	if(x>=104&&d(x-104))
	{
		ans=1;return 1;
	}
	if(x>=105&&d(x-105))
	{
		ans=1;return 1;
	}
	return ans;
}
int main()
{
	int x;cin>>x;
	cout<<d(x)<<endl;
	return 0;
 } 
 /*

*/

Measured memory_bytes: 768