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

#define endl '\n'
#define rep(i,s,n)      for (int i = s ; i < n ; i++)
#define repp(i,s,n)    for (int i = s ; i <= n ;i++)
#define all(a)      a.begin(),a.end()
#define sz(v)    (int)v.size()
#define digg(n)    ((long long)log10(n)+1)
#define Unique(n)         (n).erase(unique(all(n)), (n).end())
#define tests    int s ; cin >> s; while (s--)
#define test    int tt = 1 ; while (tt--)
#define readArr    int n ; cin >> n ; int arr[n]; rep(i,0,n)cin>>arr[i]
#define isvowel(a)   (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u' )
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define s second
#define f first
#define deb(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>void __f(const char* name, Arg1&& arg1)
{
    cerr << name << " : " << arg1 <<'\n';
}
template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}

void readFromText (){
    #ifndef ONLINE_JUDGE
freopen("C:/Users/Anas-Hagras/Desktop/input.txt","r",stdin);
    #endif // ONLINE_JUDGE
}

typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int,int> pii;
typedef vector<long long> vll;
typedef vector<pii>vii;
typedef map<long long, long long> mll ;

const int mx = 2e5 ;
int freq[mx];
int pref[mx];

int main()
{
    fast;
    readFromText();
    int t = 1 ;
//    cin >> t ;
    while(t--)
    {
        ll n ; cin >> n ; ll arr[n]; rep(i,0,n)cin>>arr[i];
        ll c = 0 ;
        sort(arr,arr+n);
        for (ll i = 0 ; i < n ; i++){
            for (ll j = i+1 ; j < n ; j++){
                for (ll k = j+1; k < n ; k++){
                    ll sum = arr[i]+arr[j]+arr[k];
                    int mx = max({arr[i],arr[j],arr[k]});
                    if ((sum-mx)>mx&&arr[i]!=arr[j]&&arr[j]!=arr[k]){
                        c++;
                    }
                }
            }
        }
        cout << c << endl ;
    }
    return 0;
}


Measured memory_bytes: 3604
/// Thank you tanakh!!!
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::cmp;

fn main() {
    input!(n: usize);
    if (n / 10) % 111 == 0 || (n % 1000) % 111 == 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

const int sz = 1e5+1 ;

vector<pair<int , long long int> > adj[sz] ;
long long int d[sz] , col[sz] ;
int n ;

void bfs(int start)
{
    queue<int> q ;
    q.push(start) ;
    for(int i = 1 ; i <= n ; i++) d[i] = LLONG_MAX ;
    d[start] = 0 ;
    while(!q.empty())
    {
        int u = q.front() ;
        q.pop() ;
        for(int i = 0 ; i < adj[u].size() ; i++)
        {
            long long int w = adj[u][i].second ;
            int z = adj[u][i].first ;
            if(d[u]+w<d[z]) d[z] = d[u] + w , q.push(z) ;
        }
    }
}


int main()
{
    int  st = 0 ;
    cin>>n ;
    for(int i = 0 ; i < n-1 ; i++)
    {
        int u , v , w ;
        cin>>u>>v>>w ;
        adj[u].push_back({v,w}) ;
        adj[v].push_back({u,w}) ;
    }
    bfs(1) ;
    for(int i = 1 ; i <= n ; i++)
    {
        if(d[i]%2==0) col[i] = 0 ;
        else col[i] = -1 ;
        if(st==0 and d[i]%2!=0) st = i ;
        d[i] = 0 ;
    }
    bfs(st) ;
    for(int i = 1 ; i <= n ; i++)
    {
        if(d[i]%2==0 and col[i]==-1) col[i] = 1 ;
    }
    for(int i = 1 ; i <= n ; i++) cout<<col[i]<<endl ;
}


Measured memory_bytes: 9472
#include<iostream>
using namespace std;
int main(){
  int x, y;int a = 0;
  cin >> x >> y;
  if(x == 3)
    a += 100000;
  if(x == 2)
    a += 200000;
  if(x == 1)
    a += 300000;
  if(y == 3)
    a += 100000;
  if(y == 2)
    a += 200000;
  if(y == 1)
    a += 300000;
  if(x == 1 && y == 1)
    a += 400000;
  cout << a << endl;
}

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

int main() {
 string a,b;
 cin >> a >> b;
  if(a[0]==b[2] && a[1]==b[1] && a[2]==b[0]){
   cout << "YES" << endl;
  }
  else{
   cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define _GLIBCXX_DEBUG
static const int MAX = 20;

int getDigit(int x){
    return to_string(x).length();
}

int main(){
  int N, count = 0;
  cin >> N;
  rep2(i, 1, N+1){
    if(getDigit(i)%2 == 1) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main(){
	string s;
	long long ans = 0;
	cin >> s;
	int n = 1 << (s.size() - 1);
	for(int i = 0; i < n; i++){
		string t = s.substr(0, 1);
		for(int j = s.size() - 2; j >= 0; j--){
			if(((i >> j) & 1) == 1){
				ans += atoll(t.c_str());
				t = s.substr(s.size() - j - 1, 1);
			} else{
				t += s.substr(s.size() - j - 1, 1);
			}
		}
		ans += atoll(t.c_str());
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;

	vector<int> arr(m);
	for (int i = 0; i < m; i++)
	{
		cin >> arr[i];
	}

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

	vector<int> diff;
	for (int i = 1; i < m ;i++)
	{
		diff.push_back(arr[i] - arr[i - 1]);
	}

	sort(diff.begin(), diff.end(), greater<int>());

	int ans = arr[m - 1] - arr[0];

	for (int i = 0; i < min((int)diff.size(), n - 1); i++)
	{
		ans -= diff[i];
	}

	cout << ans << endl;
	
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define inf 0x3f3f3f3f
#define mod 1000000007
#define maxm 
#define maxn 
int s[100010];
bool isprime(int x) {
	if (x < 2) return 0;
	if (x == 2) return 1;
	if (x % 2 == 0) return 0;
	int y = sqrt(x) + 0.5;
	for (int i = 3; i <= y; i += 2) {
		if (x % i == 0) return 0;
	}
	return 1;
}
int main()
{
	int q, x, y;
	
	for (int i = 1; i <= 100000; i++) {
		s[i] = s[i - 1];
		if ((i & 1) && (isprime(i) && isprime((i + 1) / 2))) {
			s[i]++;
		}
	}
	scanf("%d", &q);
	while (q--) {
		scanf("%d%d", &x, &y);
		printf("%d\n", s[y] - s[x - 1]);
	}
}



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

s = []
for i in range(n):
    s.append( input())

x = set(s)

dic = {}
for i in x:
    dic[i] = 0


for i in s:
    dic[i] +=1

max_dic = max(dic.values())

ans = []
for i in x:
    if dic[i] == max_dic:
        ans.append(i)


for i in sorted(ans):
    print(i)




Measured memory_bytes: 49424
def main():
    import sys
    input = sys.stdin.readline
    
    N = int(input())
    A = list(map(int,input().split()))
    #N = 1
    #A = [1,1]
    
    mod = 10**9 + 7
    ex = [1]
    for i in range(1,10**5+1):
        ex.append((ex[-1]*i)%mod)
        
    def comb(n,k):
        if 0 <= n and 0 <= k <= n:
            return (ex[n] * pow(ex[k],mod-2,mod) * pow(ex[n-k],mod-2,mod))%mod
        else:
            return 0
    
    D = {}
    for i in range(N+1):
        if not A[i] in D:
            D[A[i]] = i
        else:
            double = A[i]
            d1 = D[A[i]]
            d2 = i
    A = d1
    B = d2-d1-1
    C = N-d2
    #print(A,B,C)
    for i in range(1,N+2):
        ans = 0
        ans += comb(A+B+C,i)
        ans += 2*comb(A+B+C,i-1)
        ans -= comb(A+C,i-1)
        ans += comb(A+B+C,i-2)
        #print(comb(A+B+C,i), comb(A+B+C-1,i-1), comb(A+C,i-1), comb(A+B+C,i-2))
        print(ans%mod)
        
        
    
    
main()

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



#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)

using namespace std;

template <class T>
using vec = std::vector<T>;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL<<60;

int lcm(int a,int b){
    //最小公倍数
    return a/__gcd(a,b) * b;
}





int main()
{
    int n,W;cin>>n>>W;
    vec<int> weight(n+10);
    vec<int> val(n+10);
    rep(i,n){
        cin>>weight[i]>>val[i];
    }
    vec<vec<ll>> dp(n+100,vec<ll> (W+100,0)); //dp[(商品id)][(総重量w以下)]

    rep(i,n){
        rep(w,W+1){
            if(w<weight[i]) dp[i+1][w]=dp[i][w];
            else dp[i+1][w]=max(dp[i][w],dp[i][w-weight[i]]+val[i]);
            
        }
    }

    cout<<dp[n][W]<<endl;

    return 0;

}




Measured memory_bytes: 157824
#include <stdio.h>
int main(){
	int stu[30]={0},i,input;
	i=0;
	input=0;
	for(i=0;i<28;i++){
		scanf("%d",&input);
		stu[input-1]=1;
	}
	for(i=0;i<30;i++){
		if(!stu[i])printf("%d\n",i+1);
	}
return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include<iomanip>

using namespace std;
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define i64 int64_t
#define tos(x) to_string(x)

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	ff(i, 0, n) {
		cin >> a.at(i);
	}
	sort(a.begin(),a.end());
	int ans = 0;
	ff(i, 0, n) {
		ff(j, i+1, n) {
			ff(k, j+1, n) {
				if (a.at(k) < a.at(j) + a.at(i)) {
					ans++;
					//cout << a.at(k) << " " << a.at(j) << " " << a.at(i) << endl;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
function main(input){
  input = input.split('\n');
  N = input[0].split(' ')[0];
  K = input[0].split(' ')[1];
  Q = input[0].split(' ')[2];
 
  input = input.slice(1);
  points = [...Array(Number(N))].fill(Number(K) - Number(Q));

  input = input.map(function(element){
    points[element - 1] =  points[element - 1] + 1;
  });
  
  points.map(function(element){
    console.log(element > 0 ? 'Yes': 'No');
  });
    
}
main(require('fs').readFileSync('/dev/stdin','utf8'));

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)



int main(){
	LL A,B,C; cin >> A >> B >> C;
	if(C > A+B) cout << A+B+B+1 << endl;
	else cout << B+C << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{long long int n,sum1=0,sum2=0,sum3=0,sum4=0;
 cin>>n;
 while(n--)
 {string s;
  cin>>s;
  if(s=="AC")
    sum1++;
  if(s=="WA")
    sum2++;
  if(s=="TLE")
    sum3++;
  if(s=="RE")
    sum4++;}
 cout<<"AC x "<<sum1<<"\n"<<"WA x "<<sum2<<"\nTLE x "<<sum3<<"\nRE x "<<sum4;
 
}

Measured memory_bytes: 3656
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long K = sc.nextLong();
    
    long remainder = N % K;
    
    System.out.println(Math.min(remainder, K-remainder));
  }
}
    

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

int main(){
	int N;
	cin >> N;
	vector<int> W(N);
	int sum = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> W[i];
		sum += W[i];
	}
	int sum2 = 0;
	int ans = 10000;
	for (int i = 0; i < N-1; i++)
	{
		sum2 += W[i];
		ans = min(ans, abs(sum - sum2 * 2));
	}
	cout << ans << endl;
	cin >> ans;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define dfor(i,a,b) for(int i=(a);i>=(b);i--)
#define ll long long
#define ull unsigned long long

int main() {
	int n;
	cin>>n;
	float a[n];
	double sum =0;
	rep(i,n){
		cin>>a[i];
		sum += (1/a[i]);
	}
	sum = 1/sum;
	printf("%.7f",sum);
}

Measured memory_bytes: 256
//One Punch AC
#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define reset(x) memset(x, 0,sizeof(x))
#define resetgt(x, y) memset(x, y,sizeof(x))
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define nmax
#define MOD 1000000007
#define pii pair<int, int>
#define ll long long
#define Task ""

using namespace std;
string s;
ll sum = 0;
vector <pii> res;

ll calc(int x) {return (1ll * x * (x + 1)) / 2; }

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    freopen(Task".inp", "r", stdin);
//    freopen(Task".out", "w", stdout);
    cin >> s;
    int vt = 0;
    while (vt < sz(s)) {
        char tg = s[vt];
        int cnt = 0;
        while (vt < sz(s) && s[vt] == tg) vt++, cnt++;
        if (tg == '<') res.PB({1, cnt});
        else res.PB({2, cnt});
    }
//    for (pii x:res) cout << x.F << ' ' << x.S << '\n';
    ll x = (calc(res[0].S - 1));
    if (x == 0 && res[0].F == 2) sum++;
    else if (x != 0) {
        if (res[0].F == 2) sum += x + res[0].S;
        else sum += x;
    }
    for (int i = 1; i < sz(res); i++) {
        sum += calc(res[i].S - 1);
        if (res[i].F == 2) sum += max(res[i-1].S, res[i].S);
    }
    if (res[sz(res) - 1].F == 1) sum += res[sz(res) - 1].S;
    cout << sum;
    return 0;
}


Measured memory_bytes: 3352
#include <iostream>
using namespace std;
int main(){
  int N;  cin >> N;
  int T[100];
  int sum = 0;
  for(int i = 0;i < N;i++){
    cin >> T[i];
    sum += T[i];
  }

  int M;
  cin >> M;
  int P[100];
  int X[100];

  for(int i = 0;i < M;i++){
    cin >> P[i] >> X[i];
  }

  for(int i = 0;i < M;i++){
    int ans = sum - T[P[i] - 1] + X[i];
    cout << ans << endl;
  }

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <iomanip>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll R,G,B,N;
    cin >> R >> G >> B >> N;
    ll count = 0;
    for (int ri = 0; ri <= 3000; ++ri) {
        for (int gi = 0; gi <= 3000; ++gi) {
            ll res = N - ri*R - gi*G;
            if(res < 0){
                continue;
            }
            if(res % B == 0){
                count++;
            }
        }
    }
    cout << count << endl;
}


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

ll inf = LLONG_MAX;
ll minf = -inf;

int main(){
    int N, M, P;
    cin >> N >> M >> P;
    vector<vector<int>> edge(M, vector<int>(3));
    for (int i = 0; i < M; i++) {
        cin >> edge[i][0] >> edge[i][1] >> edge[i][2];
        edge[i][2] -= P;
    }
    
    vector<ll> score(N+1, minf);
    score[1] = 0;
    for (int i = 0; i < N; i++) {
        for (auto e : edge) {
            if (score[e[0]] == minf) continue;
            score[e[1]] = max(score[e[1]], score[e[0]] + e[2]);
        }
    }
    
    ll ans = score[N];
    
    for (int i = 0; i < N; i++) {
        for (auto e : edge) {
            if (score[e[0]] == minf) continue;
            if (score[e[1]] < score[e[0]] + e[2]) {
                score[e[1]] = inf / 2;
            }
        }
    }
    
    if (ans < score[N]) {
        cout << -1 << endl;
    } else {
        cout << max(ans, (ll)0) << endl;
    }
}

Measured memory_bytes: 512
function Main(input) {
  var s = input.split("\n")[0];
  for (var i = "a".charCodeAt(0); i <= "z".charCodeAt(0);i++) {
    if(!s.includes(String.fromCharCode(i))) {
      console.log(String.fromCharCode(i));
      return;
    }
  }
  console.log("None");
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
using ll = long long;
#define pi 3.1415926
 
int a[10000];
 
int main()
{
    int n, m;
    cin >> n >> m;
    int s = 0;
    for(int i = 0; i < m; i++){
        cin >> a[i];
        s = s + a[i];
    }
    if(n >= s)
        cout << n - s;
    else
        cout << "-1";
    


}


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



int main(){
    int a[5],k;
    cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k;

    bool b=true;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            if(abs(a[i]-a[j])>k)b=false;
        }
    }
    if(b)cout<<"Yay!"<<endl;
    else cout<<":("<<endl;
}

Measured memory_bytes: 256
N=int(input())
A=[0]+list(map(int,input().split()))
B=[0 for i in range(N+1)]
ans=[]
for i in range(1,N+1)[::-1]:
    #print(i)
    cnt=0
    for j in range(i,N+1,i):
        #print(i,j)
        if B[j]==1:
            cnt+=1
    if A[i]%2!=cnt%2:
        B[i]=1
        ans.append(i)
print(len(ans))
ans.sort()
print(*ans)
#print(A)

Measured memory_bytes: 14056
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
    int k;
    int x;
    cin>>k>>x;
    
    vector<int> vec(2*k-1);
    int c=-1*k+1;
    for(int i=0;i<vec.size();i++){
        if(x+c<-1000000 || x+c>1000000){
            c++;
            continue;
        }
        vec.at(i)=x+c;
        c++;
        cout<<vec.at(i);
        if(i!=vec.size()-1)cout<<" ";
    }
}

Measured memory_bytes: 256
buf = []
while True:
    in_line = raw_input().split()
    if in_line[1] == "?":
        break
    else:
        a = int(in_line[0])
        b = int(in_line[2])
        op = in_line[1]
        if op == "+":
            buf.append(a+b)
        elif op == "-":
            buf.append(a-b)
        elif op == "*":
            buf.append(a*b)
        elif op == "/":
            buf.append(a/b)
for i in buf:
    print i

Measured memory_bytes: 6324
#include <stdio.h>
#include <string.h>

int main(void)
{
    int W, H;
    char buf[16], row[301];
    memset(row, '#', 300);
    row[300] = 0;
    row[0] = '#';

    while (1)
    {
        fgets(buf, 16, stdin);
        sscanf(buf, "%d %d", &H, &W);
        if (!(W | H)) break;

        row[W] = 0;
        memset(row + 1, '#', W - 1);
        printf("%s\n", row);
        H -= 2;

        memset(row + 1, '.', W - 2);

        while (H)
        {
            printf("%s\n", row);
            --H;
        }

        memset(row + 1, '#', W - 1);
        printf("%s\n", row);

        row[W - 1] = '.';
        row[W] = '.';
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2104
import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,m = map(int,readline().split())

if n >= m//2:
    print(m//2)
    exit()

ans = n
m -= n*2

ans += m//4
print(ans)

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

int main(){
    int sec;
    cin >> sec;
    int h = sec/3600;
    int m = (sec - h*3600)/ 60;
    int s = sec - h*3600 - m*60;
    cout << h << ":" << m << ":" << s << endl;
    return 0;
}


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

#define o(output) cout << output << endl

using namespace std;

string s;
int a,b,c,d;
char A,B;
priority_queue<int,vector<int>,greater<int> >small;

int main(){
  cin >> a >> b >>c;
  small.push(a);
  small.push(b);
  small.push(c);
  c=small.top();
  small.pop();
  o(c+small.top());
}

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
#define LEN(x) ll(x.length()) //lengthをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll n;
    cin >> n;
    vector<ll> x(n), y(n);
    REP(i, n) cin >> x[i] >> y[i];
    ll d1 = 0, d2 = 0, fmax1 = -INF, fmin1 = INF, fmax2 = -INF, fmin2 = INF;
    REP(i, n){
        fmax1 = max(fmax1, x[i] - y[i]);
        fmin1 = min(fmin1, x[i] - y[i]);
        fmax2 = max(fmax2, x[i] + y[i]);
        fmin2 = min(fmin2, x[i] + y[i]);
    }
    d1 = fmax1 - fmin1;
    d2 = fmax2 - fmin2;
    cout << max(d1, d2);
    return 0;
}

Measured memory_bytes: 6412
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <chrono>
#include <utility>

using namespace std;

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

constexpr int cm = 1<<17;
char buff[cm], *ci = buff + cm, ct;

inline char readchar() {
  if (ci - buff == cm) {
    fread(buff, 1, cm, stdin);
    ci = buff;
  }
  return *ci++;
}

inline int readint() {
  int num = 0;
  if (ci - buff + 16 > cm) {
    while ((ct = readchar()) >= '0') {
      num = (num << 3) + (num << 1) + ct - '0';
    }
  } else {
    while ((ct = *ci++) >= '0') {
      num = (num << 3) + (num << 1) + ct - '0';
    }
  }
  return num;
}

int main(){
  auto start = chrono::system_clock::now();

  int n = readint();

  vector<queue<int>> v(1002, queue<int> ());
  rep(i, n) {
    rep(j, n - 1) {
      int a = readint();
      v[i + 1].push(a);
    }
  }

  for (int day = 1; day <= n * (n - 1) / 2; ++day) {
    bool done[1002] = {};
    for (int i = 1; i <= n; ++i) {
      if (done[i]) continue;
      if (v[i].empty()) continue;
      int next = v[i].front();
      if (done[next]) continue;
      if (v[next].front() == i) {
        v[i].pop(); v[next].pop();
        done[i] = done[next] = true;
      }
    }
    if (all_of(done, done + n, [](const bool& x){return x == false;})){
      printf("-1");
      return 0;
    }
    if (all_of(v.begin(), v.end(), [](const queue<int>& x){return x.empty();})) {
      printf("%d", day);
      return 0;
    }
    auto now = chrono::system_clock::now();
    auto dur = now - start;
    auto msec = chrono::duration_cast<chrono::milliseconds>(dur).count();
    if (msec >= 27) {
      printf("%d", n * (n - 1) / 2);
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }






int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	ll ans = 0;
	int n = s.size();
	rep(i,(1 << (n - 1))){
		int f = 0;
		rep(j,n - 1){
			if((1 << j) & i){
				ans += stoll(s.substr(f,j - f + 1));
				f = j + 1;
			}
		}
		ans += stoll(s.substr(f,n - f));
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
// include
#include <algorithm>
#include <iterator>
#include <vector>
#include <iomanip>
#include <iostream>
#include <stack>
#include <queue>
#include <list>
#include <utility>

#include <string>
#include <cstring>

#include <stdio.h>
#include <cassert>

// M_PI for pi
#define _USE_MATH_DEFINES
#include <math.h>

#define MAX 100000005

using namespace std;

int N;
long long x;

long long A[2005];
long long B[2005];

void slove() {
}


int main(int argc, char* argv[]) {
    cin >> N >> x;

    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }


    long long S = 1000000000000000000LL;
    long long s;


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

    for (int k = 0; k < N; ++k) {
        for (int i = 0; i < N; ++i) {
            B[i] = min(B[i], A[(N + i - k) % N]);
        }

        //for (int i = 0; i < N; ++i) {
        //    cout << B[i] << " ";
        //}
        //cout << endl;

        s = 0;

        for (int i = 0; i < N; ++i) {
            s += B[i];
        }

        s += k * x;
        //cout << s << endl;

        S = min(s, S);
    }

    cout << S << endl;


    return 0;
}


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

int main(void){
    
    for(int i = 0 ; i < 301 ; i++){
        int h = 0;
        int w = 0;
        
        cin >> h >> w;
        
        if( (h == 0) && (w == 0) ){
            break;
        }

        for(int j = 0 ; j < h ; j++){
            for(int k = 0; k < w ; k++){
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

int main() {

   int N;
   cin >> N;
   int Even[N/2];
   int Odd[N/2];

   map<int, int> MapE, MapO;

   for (int i = 0; i < N; i++) {
      if (i % 2 == 0) {
         cin >> Even[i/2];
         MapE[Even[i/2]]++;
      } else {
         cin >> Odd[i/2];
         MapO[Odd[i/2]]++;
      }
   }

   std::vector<ipair> VecE, VecO;
   for (map<int, int>::iterator it = MapE.begin(); it != MapE.end(); ++it) {
      VecE.push_back(ipair(it->first, it->second));
   }
   for (map<int, int>::iterator it = MapO.begin(); it != MapO.end(); ++it) {
      VecO.push_back(ipair(it->first, it->second));
   }
   sort(VecE.begin(), VecE.end(), morePair);
   sort(VecO.begin(), VecO.end(), morePair);
  
   int tmp1 = VecE[0].first;
   int tmp2 = VecO[0].first;

   int count = 0;
   if (tmp1 != tmp2) {
      // cout << "case1" << endl;
      count += N/2 - MapE[tmp1];
      count += N/2 - MapO[tmp2];
   } else if (MapE.size() == 1 && MapO.size() == 1) {
      // cout << "case2" << endl;
      count += N/2;
   } else if (MapE.size() == 1 || MapO.size() == 1) {
      // cout << "case3" << endl;
      if (MapE.size() != 1) {
         int tmp = VecE[1].first;
         count += N/2 - MapE[tmp];
      } else {
         int tmp = VecO[1].first;
         count += N/2 - MapO[tmp];
      }
   } else {
      // cout << "case4" << endl;
      if (VecE[1].second > VecO[1].second) {
         int tmp = VecE[1].first;
         count += N/2 - MapE[tmp];
         count += N/2 - MapO[tmp2];
      } else {
         int tmp = VecO[1].first;
         count += N/2 - MapO[tmp];
         count += N/2 - MapE[tmp1];
      }
   }
      
   cout << count << endl;
   
   return 0;
}


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

int data[100005],dp[100005];

int main()
{
  int n;

  scanf("%d",&n);
  for(int c=0;c<n;c++)
  {
    scanf("%d",&data[c]);
    if (c>1)
    dp[c]=std::min(dp[c-1]+abs(data[c]-data[c-1]),dp[c-2]+abs(data[c]-data[c-2]));
    else if (c>0)
    dp[c]=dp[c-1]+abs(data[c]-data[c-1]);
  }
  printf("%d\n",dp[n-1]);
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a, b) for(int i=a;i<b;++i)
#define fj(a, b) for(int j=a;j<b;++j)
#define fk(a, b) for(int k=a;k<b;++k)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;

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

ll n, m, ans;

void solve(){
	cin >> n >> m;
	ll mini = min(n, m / 2);
	ans += mini;
	n -= mini;
	m -= mini * 2;
	ans += m / 4;
	cout << ans << endl;
}


int main(){

	solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;



int main(){
  int H, W, k;
  cin >> H >> W >> k;
  vector<string> field(H);
  REP(h,H) cin >> field[h];
  int ans[H+1][W+1];
  REP(h,H) REP(w,W) ans[h][w] = 0;

  vector<bool> ok(H);
  REP(h,H) ok[h] = false;
  bool isfirst = true;
  int now = 1;
  REP(h,H){
    int bery = 0;

    REP(w,W){
      if(field[h][w] == '#'){
        isfirst = false;
        if(bery == 0) {
          bery++;
        }
        else if(bery >= 1){
          now++;
          bery++;
        }
      }
      ans[h][w] = now;
    }

    if(bery == 0){
      if(isfirst){
        ok[h] = true;
      }
      else REP(w,W){
        ans[h][w] = ans[h-1][w];
      }
    }
    else now++;
  }

  for(int h = H-1; h >= 0; --h){
    if(ok[h] == true){
      REP(w,W){
        ans[h][w] = ans[h+1][w];
      }
    }
  }

  REP(h,H){
    REP(w,W){
      cout << ans[h][w] << " ";
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 4012
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

	cout << a[0] << b[1] << c[2] << endl;
}


Measured memory_bytes: 256
//#include<iostream>
//#include<algorithm>
//#include<string>
//#include <cmath>
//#include <vector>
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define REP(x,n) for(int x=0;x<n;x++)

//vector//
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

typedef pair<int,int> P;  //q(p.first,p.second)

int main (){
    int n,m;
    cin >> n >> m;
    vei a(m);
    REP(i,m){
        cin >> a[i];
    }
    int sum = 0;
    REP(i,m){
        sum+=a[i];
    }
    if(sum > n){
        cout << -1;
    }else{
        cout << n - sum;
    }
}

Measured memory_bytes: 3668
n=int(input())
A=[]
B=[]
for i in range(n):
    x,y=map(int,input().split())
    A.append(x)
    B.append(y)
A.reverse()
B.reverse()
ans=0

for i in range(n):
    if (A[i]+ans)%B[i]!=0:
        ans+=B[i]-(A[i]+ans)%B[i]
print(ans)

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

using namespace std;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    const int mod=1000000007;
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    for(int o=0;o<h;o++) cin >> s[o];
    vector<vector<int>> dp(h,vector<int>(w,0));
    dp[0][0]=1;
    for(int o=0;o<h;o++)
    {
        for(int i=0;i<w;i++)
        {
            if(s[o][i]=='#') continue;
            if(o>0) dp[o][i]=dp[o-1][i];
            if(i>0) dp[o][i]+=dp[o][i-1];
            if(dp[o][i]>=mod) dp[o][i]-=mod;
        }
    }
    cout << dp[h-1][w-1] << "\n";
    return 0;
}


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

int main(){
  string s;
  int cnt = 0;
  int ret = 0;
  
  cin >> s;
  for(int i = 0; i < (int)s.size(); i++){
    if(s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T'){
      cnt++;
    }else if(ret < cnt){
        ret = cnt;
        cnt = 0;
    }
  }
  ret = (ret < cnt) ? cnt : ret;
  printf("%d", ret);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  ll ans = 0;
  ll cnt = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == 'W') {
      ans += i - cnt;
      cnt++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3760
import std.conv, std.functional, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.complex, std.container, std.math, std.numeric, std.range, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }


enum long MO = 998244353;

void addTo(ref long t, long f) {
  t += f;
  if (t >= MO) {
    t -= MO;
  }
}

int N;
int[] A;

void main() {
  try {
    for (; ; ) {
      N = readInt();
      A = new int[N];
      foreach (i; 0 .. N) {
        A[i] = readInt();
      }
      
      const ASum = A.sum;
      auto dp = new long[][](4, ASum + 1);
      dp[0][0] = 1;
      foreach (i; 0 .. N) {
        auto dpNext = new long[][](4, ASum + 1);
        foreach (x; 0 .. ASum + 1) {
          foreach (p; 0 .. 4) {
            if (x + A[i] <= ASum) {
              addTo(dpNext[p][x + A[i]], dp[p][x]);
            }
            addTo(dpNext[p | 1][x], dp[p][x]);
            addTo(dpNext[p | 2][x], dp[p][x]);
          }
        }
        dp = dpNext;
      }
      debug {
        writeln(dp[3]);
      }
      
      long two = 1, three = 1;
      foreach (i; 0 .. N) {
        two *= 2;
        two %= MO;
        three *= 3;
        three %= MO;
      }
      long ans = three - 3 * two + 3;
      foreach (x; 0 .. ASum + 1) {
        if (x >= ASum - x) {
          ans -= 3 * dp[3][x];
          ans %= MO;
        }
      }
      ans = (ans % MO + MO) % MO;
      writeln(ans);
    }
  } catch (EOFException e) {
  }
}


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

using namespace std;

int f(int a) {
  if (a % 2 == 0) {
    return a / 2;
  } else {
    return 3 * a + 1;
  }
}

int main() {
  int a;
  cin >> a;
  
  map<int, bool> present;
  int ct = 1;
  while (!present[a]) {
    present[a] = true;
    a = f(a);
    ct++;
  }
                  
  cout << ct << endl;
                  
  return 0;
}


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

int main(void){
   int X;
   cin>>X;
   int rest=X%100;
   int count=X/100;
   if(5*count>=rest){
      cout<<1<<endl;
   }else{
      cout<<0<<endl;
   }
   return 0;
}


Measured memory_bytes: 3636
n = int(input())
li = [0]
for i in range(n):
    li.append(int(input()))

count = 0
now = 1
while now != 2:
    if li[now] == 0:
        count = -1
        break
    else:
        a = li[now]
        li[now] = 0
        now = a
        count += 1

print(count)

Measured memory_bytes: 12848
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,N;cin>>K>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  vector<int> aida(N);
  for(int i=0;i<N-1;i++){
    aida[i]=A[i+1]-A[i];
  }
  aida[N-1]=K-A[N-1]+A[0];
  sort(aida.begin(),aida.end());
  long wa=0;
  for(int i=0;i<N-1;i++){
    wa+=aida[i];
  }
  cout<<wa<<endl;
}

Measured memory_bytes: 1792
from operator import mul
from functools import reduce
from collections import Counter
# from itertools import combinations as comb
# from itertools import permutations as perm
# from copy import copy
# 配列二分法アルゴリズム
# https://docs.python.jp/3/library/bisect.html
# import bisect
# 桁数指定
# print('{:.3f}'.format(X))
# from collections import defaultdict
# dic = defaultdict(lambda: ...)
# 値で辞書をソート
# sorted(dic.items(), key=lambda x:x[1])
# ヒープキュー
# https://docs.python.org/ja/3/library/heapq.html
# import heapq
# 正規表現(regular expression)のためのモジュール
# import re

import sys

sys.setrecursionlimit(2000)


def inpl():
    return list(map(int, input().split()))


# 重複組み合わせは nHr = (n + r - 1)Cn
def cmb(n, r):
    # combination
    if n < r:
        return 0
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


def gcd(a, b):
    # greatest common divisor
    while b > 0:
        a, b = b, a % b

    return a


def lcm(a, b):
    # least common multiple
    return a * b // gcd(a, b)


al = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

N = int(input())
S = list(input())

for i, s in enumerate(S):
    j = al.index(s)
    S[i] = al[(j + N) % 26]

print("".join(S))


Measured memory_bytes: 3688
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 100005

int N = 1;
ll M,C;
ll A[SIZE];
ll max_data[4*SIZE],add_data[4*SIZE];
ll L_max[SIZE],R_max[SIZE];

void init(int first_N){
	while(N < first_N)N *= 2;
}

void add(int left,int right,ll value,int node_id,int node_left,int node_right){

	if(right < node_left || left > node_right){
		//範囲外ならreturn
		return;
	}
	else if(left <= node_left && right >= node_right){ //このノードのカバーしている区間が、更新区間の部分区間である場合

		add_data[node_id] += value; //一様に加える値を加算

		while(node_id != 0){

			node_id = (node_id-1)/2; //下から上に向かって、最小値および最大値更新
			max_data[node_id] = max(max_data[2*node_id+1]+add_data[2*node_id+1],max_data[2*node_id+2]+add_data[2*node_id+2]);
		}
	}else{

		add(left,right,value,2*node_id+1,node_left,(node_left+node_right)/2);
		add(left,right,value,2*node_id+2,(node_left+node_right)/2+1,node_right);
	}
}

ll getMax(int left,int right,int node_id,int node_left,int node_right){
	if(right < node_left || left > node_right)return -BIG_NUM;
	else if(left <= node_left && right >= node_right){
		return max_data[node_id]+add_data[node_id];

	}else{

		ll  left_max  = getMax(left,right,2*node_id+1,node_left,(node_left+node_right)/2);
		ll  right_max = getMax(left,right,2*node_id+2,(node_left+node_right)/2+1,node_right);
		return max(left_max,right_max)+add_data[node_id];
	}
}

int main(){

	int first_N;
	scanf("%d %lld %lld",&first_N,&M,&C);

	ll first_sum = 0;

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

		scanf("%lld",&A[i]);
		first_sum += A[i];
	}

	if(first_sum >= M){

		printf("0\n");
		return 0;
	}

	init(first_N);

	int left = 1,right = first_N,mid = (left+right)/2;
	int ans = BIG_NUM;

	//探索範囲は増えるのは、損にならないので範囲の二分探索ができるはず

	while(left <= right){

		for(int i = 0; i <= 2*N-2; i++){
			max_data[i] = 0;
			add_data[i] = 0;
		}

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

			add(i,i,A[i],0,0,N-1);
		}

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

			L_max[i] = -HUGE_NUM;
		}

		//左から
		for(int i = 0; i < first_N; i++){
			if(i > 0){

				add(max(0,i-mid),i-1,-C,0,0,N-1);
			}
			L_max[i] = getMax(max(0,i-mid),i,0,0,N-1);
		}

		for(int i = 0; i <= 2*N-2; i++){
			max_data[i] = 0;
			add_data[i] = 0;
		}

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

			add(i,i,A[i],0,0,N-1);
		}

		ll sum = 0;
		for(int i = 0; i < first_N; i++){

			R_max[i] = -HUGE_NUM;
		}

		//右から
		for(int i = first_N-1; i >= 0; i--){
			if(i < first_N-1){

				add(i+1,min(first_N-1,i+mid),-C,0,0,N-1);
			}
			R_max[i] = getMax(i,min(first_N-1,i+mid),0,0,N-1);
		}

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

			sum += max(L_max[i],R_max[i]);
		}

		if(sum >= M){

			ans = mid;
			right = mid-1;

		}else{

			left = mid+1;
		}
		mid = (left+right)/2;
	}

	if(ans == BIG_NUM){

		printf("-1\n");
	}else{

		printf("%d\n",ans);
	}

	return 0;
}



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

#define coutv(v) for (int i = 0; i < (v).size(); ++i) cout << v[i] << ' '; cout << endl;
#define coutvv(v) for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cout << v[i][j] << ' '; cout << endl;}
#define debugv(v) {for (int i = 0; i < (v).size(); ++i) cerr << v[i] << ' '; cerr << endl;}
#define debugvv(v) {for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cerr << v[i][j] << ' '; cerr << endl;}}
#define TC int TESTCASE; cin >> TESTCASE; while (TESTCASE--)
typedef long long ll;




int main() {
    int n;
    cin >> n;
    if (n >= 30) {
        cout << "Yes";
    } else {
        cout << "No";
    }
}


Measured memory_bytes: 3624
/* --- author: dxm --- */
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

void qread(int &x){
	int neg=1;x=0;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')neg=-1;c=getchar();}
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	x*=neg;
}

const int maxn=205;
const int mod=1e9+7;
int n,m,k,t,tot,top;
int c[maxn][maxn];
vector<int>edge[maxn],bcc[maxn];
int dfn[maxn],low[maxn],st[maxn],pw[maxn];
bool vis[maxn],in[maxn][maxn];

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

void tarjan(int x,int p){
	vis[x]=true;
	dfn[x]=low[x]=++t;
	st[top++]=x;
	rep(i,edge[x].size()){
		int y=edge[x][i];
		if(y==p)continue;
		if(!vis[y]){
			tarjan(y,x);
			low[x]=min(low[x],low[y]);
			if(low[y]>=dfn[x]){
				int cur;
				tot++;
				bcc[tot].pb(x);
				in[x][tot]=true;
				do{
					cur=st[--top];
					in[cur][tot]=true;
					bcc[tot].pb(cur);
				}while(cur!=y);
			}
		}
		else low[x]=min(low[x],dfn[y]);
	}
}

int quickpow(int x,int pow){
	int res=1;
	for(;pow;pow>>=1){
		if(pow&1)res=1LL*res*x%mod;
		x=1LL*x*x%mod;
	}
	return res;
}

int main(){
#ifdef FILE
	freopen("FILE.in","r",stdin);
	freopen("FILE.out","w",stdout);
#endif
	rep(i,201)c[i][0]=1;
	REP(i,200)REP(j,200)c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
	scanf("%d%d%d",&n,&m,&k);
	pw[0]=1;
	REP(i,m)pw[i]=1LL*pw[i-1]*k%mod;
	REP(i,m){
		int u,v;
		scanf("%d%d",&u,&v);
		edge[u].pb(v);
		edge[v].pb(u);
	}
	REP(i,n)if(!vis[i])tarjan(i,0);
	int ans=1;
	REP(i,tot){
		if(bcc[i].size()==2){
			ans=1LL*ans*k%mod;
			continue;
		} 
		bool ok=true;
		int cnt=0;
		rep(j,bcc[i].size()){
			int x=bcc[i][j];
//			cout<<x<<" ";
			int c=0;
			rep(k,edge[x].size())if(in[edge[x][k]][i])c++;
			if(c>2)ok=false;
			cnt+=c;
		}
		cnt/=2;
//		cout<<endl;
//		cout<<ok<<" "<<cnt<<endl;
		if(ok){
			int res=0;
			rep(j,bcc[i].size())res=(res+pw[gcd(j,bcc[i].size())])%mod;
			res=1LL*res*quickpow(bcc[i].size(),mod-2)%mod;
			ans=1LL*ans*res%mod;
		}
		else ans=1LL*ans*c[cnt+k-1][k-1]%mod;
	}
	printf("%d\n",ans);
#ifdef TIME
	printf("Running Time = %d ms\n",int(clock()*1000.0/CLOCKS_PER_SEC));
#endif
	return 0;
}

/*
Input:
-----------------
Output:
*/


Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
	int n,m;
	int a[101];
	int high,low,key;
	int cnt=0;
	int i,j;

	scanf("%d",&n);
	while(n!=0){
		for(i=0;i<n;i++){
			scanf("%d",&a[i]);
		}
		scanf("%d",&m);
		cnt=0;
		low=0;
		high=n-1;
		while(high>=low){
			cnt++;
			key=(high+low)/2;
			if(a[key]==m){
				break;
			}
			else if(a[key]>m){
				high=key-1;
			}
			else {
				low=key+1;
			}
		}
		printf("%d\n",cnt);
		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double lxd;
typedef vector<ll> vll ;
 
#define INF (ll)1e11 + 7 
#define mem(dp,a) memset(dp,a,sizeof dp)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) ;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define f(i,n) for (ll i=0;i<n;i++)
#define fo(i,n,x) for (ll i=x;i<=n  ;i++)
#define mp(a,b) push_back(make_pair(a,b))
#define pb(x) push_back(x)
#define make_graph(a,b) adj[a].pb(b) ; adj[b].pb(a);
#define tr(c,it) for(((c).begin())it=(c).begin();it!=(c).end();it++)
#define test ll t; cin>>t; label: while(t--)
#define fls fflush(stdout)
#define F first
#define S second

vll x(3,-1);
vector<vll> dp(100001, x) ;
vector<vll> arr(100001, x) ;

ll fn(ll id, ll t){
    
    ll fuck = -1 ;
    
    if(id == 0){
        f(i,3){
            if(i == t)continue ;
            fuck = max(fuck, arr[0][i]) ;
        }
        return fuck ;
    }
    
    if(dp[id][t] != -1) return dp[id][t] ;
    
    f(i,3){
        if(i == t)continue ;
        fuck = max(arr[id][i] + fn(id - 1, i), fuck) ;
    }
    
    return dp[id][t] = fuck ;
}

main(){
    
        ll n ;
        cin>>n ;
        f(i,n)cin>>arr[i][0]>>arr[i][1]>>arr[i][2] ;
        cout<<max(fn(n-1, 2), min(fn(n-1, 1), fn(n-1, 0))) ;
    
}

Measured memory_bytes: 18944