akhauriyash/Code-Regression huggingface dataset:
using System;

class solve{
  
public static void Main(string[] args){
  
int a, b, c;

string input = Console.ReadLine();
  
a = Int32.Parse(input[0].ToString());
b = Int32.Parse(input[2].ToString());
c = Int32.Parse(input[4].ToString());


string output;
  

if (a+b+c == 17){
  		output= "YES";
	} else {
    output="NO";
}
  
Console.WriteLine(output);
}
  
}


Measured memory_bytes: 13140
n,k=map(int,input().split())
s=input()
wa=[]
now=1
cnt=0
for i in range(n):
    if s[i]==str(0+now):
        cnt+=1
    else:
        wa.append(cnt)
        now=1-now
        cnt=1
if cnt!=0:
    wa.append(cnt)

if len(wa)%2==0:
    wa.append(0)

add=2*k+1
ans=0

left=0
right=0
tmp=0
for i in range(0,len(wa),2):
    nextleft=i
    nextright=min(i+add, len(wa))

    while nextleft > left:
        tmp-=wa[left]
        left+=1
    while nextright > right:
        tmp+=wa[right]
        right+=1

    ans=max(tmp,ans)
print(ans)


Measured memory_bytes: 4212
cin = open(0).read().strip().split('\n')

n,k = map(int, cin[0].split(' '))
a = list(map(int, cin[1].split(' ')))

history = [1]
for i in range(n):
    history.append(a[history[i]-1])

if n >= k:
    print(history[k])
else:
    times = [-1] * n
    for i in range(n):
        if times[history[i]-1] == -1:
            times[history[i]-1] = i
        else:
            cycle = i-times[history[i]-1]
            pre = times[history[i]-1]
            mod = (k-pre)%cycle
            print(history[pre+mod])
            break


Measured memory_bytes: 33740
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll A,B; cin >> A >> B;
    res = A*B;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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


def main():
    mod = 1000000007
    N = int(input())
    A = list(map(int, input().split()))
    cnt = [0, 0, 0]
    ans = 1
    for a in A:
        ans = ans * cnt.count(a) % mod
        for j in range(3):
            if cnt[j] == a:
                cnt[j] = a+1
                break
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 13972
// Shift-JIS（シフトジス）

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

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

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int H,A,i;
    scanf("%d%d",&H,&A);
    int temp = H;
    for(i=1;;i++)
    {
        temp-=A;
        if(temp<=0)
        {
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 128
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

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

int main(){fastio
    
    string s;cin>>s;
    if(s[1]=='B')cout<<"ARC";
    else cout<<"ABC";
    
    return 0;
}


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

int main() {
    string s, t;
    cin >> s >> t;
    
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if (s < t) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    int cnt = 0;
    bool flag = false;
    for(int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        if(a == b) cnt++;
        else cnt = 0;
        if(cnt >= 3) flag = true;
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3592
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
char s[200009];
int main()
{
    scanf("%s", s);
    long long tem = 0;
    for (int i = 0; s[i];i++)
        tem += s[i] - '0';
    if (tem % 9 == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

void main_()
{
    ll N, x;
    cin >> N >> x;
    vector<ll> as;
    as.reserve(N);
    copy_n(istream_iterator<ll>(cin), N, back_inserter(as));

    ll ans = 0;
    for (ll i = 0; i < N - 1; i++) {
        auto surplus = (as[i] + as[i + 1] - x);
        if (surplus > 0) {
            as[i + 1] -= surplus;
            ans += surplus;
            if (as[i + 1] < 0) {
                // i+1を減らすだけでは足りない場合代わりにiを減らす
                as[i] += as[i + 1];
                as[i + 1] = 0;
            }
        }
    }
    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll x, a, b;
  cin >> x >> a >> b;
  cout << (x-a)%b;
  return 0;
}


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

int main()
{
	int n;
  	cin >> n;
  	vector<int> arr(n);
  	for(int i = 0; i < n; ++i)
      cin >> arr[i];
  	sort(arr.begin(), arr.end());
  	int res = n/2;
  	res = arr[res] - arr[res - 1];
  	cout << res;
}

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


int main(){
    int n;
    cin >> n;
    vector<P> p(n);
    vector<vector<ll>> dp(n+1,vector<ll>(n+1));
    rep(i,n){
        int a;cin >> a;
        p.emplace_back(a,i);
    }
    sort(p.rbegin(),p.rend());
    dp[0][0] = 0;
    rep(i,n){
        rep(l,i+1){
            int r = i-l;
            dp[i+1][l+1] = max(dp[i+1][l+1],dp[i][l]+ll(p[i].second+1-(l+1))*p[i].first);
            dp[i+1][l] = max(dp[i+1][l],dp[i][l]+ll(n-r - (p[i].second+1))*p[i].first);
        }
    }

    ll ans = 0;
    rep(i,n+1) ans = max(ans,dp[n][i]);
    cout << ans << endl;
}

Measured memory_bytes: 34580
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long ll;

ll po[20];char opt[10];
inline bool Query(ll x){
	printf("? %lld\n", x);
	fflush(stdout);
	scanf("%s", opt);
	return opt[0] == 'Y';
}

int main(){
	po[0] = 1;
	for(int i = 1;i <= 18;++i)po[i] = 10LL * po[i - 1];
	bool flag = 1;
	ll L = 0;
	for(int i = 1;i <= 9;++i){
		if(!Query(po[i])){
			flag = 0;
			if(!L)L = po[i - 1];
		}
	}
	if(flag){
		/*int l = 0, r = 9, mid, pos = 9;
		while(l <= r){
			mid = l + r >> 1;
			if(Query(2LL * po[mid]))pos = min(pos, mid), r = mid - 1;
			else l = mid + 1;
		}
		printf("! %lld\n", po[mid]);*/
		for(int i = 0;i <= 9;++i){
			if(Query(2LL * po[i])){
				printf("! %lld\n", po[i]);
				return 0;
			}
		}
	}
	else{
		ll r = L * 10 - 1, l = L + 1, mid, ans = r;
		while(l <= r){
			mid = l + r >> 1;
			if(Query(10LL * mid))ans = min(ans, mid), r = mid - 1;
			else l = mid + 1;
		}
		printf("! %lld\n", ans);
	}
	fflush(stdout);
	return 0;
}


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

#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, n, m) for(int (i) = (n); (i) < (m); ++(i))

// constexpr int INF = 1e9;
constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;

int N;
bool check(vector<string>& S, int A, int B){
  vector<string> T = S;
  REP(i, N){
    REP(j, N){
      T[i][j] = S[(i+A)%N][(j+B)%N];
    }
  }
  REP(i, N){
    REP(j, N){
      if(T[i][j] != T[j][i]) return false;
    }
  }
  return true;
}
int main(){
  cin >> N;
  vector<string> S(N);
  REP(i, N){
    cin >> S[i];
  }
  int ans = 0;
  REP(i, N){
    if(check(S, i, 0)){
      ans++;
    }
  }
  cout << ans * N << endl;
  return 0;
}


Measured memory_bytes: 512
n,*a=$<.map &:to_i
a.sort!
p [0,1].map{|x|
  b=(0...n).map{|i|a[x==i%2?i/2:n-i/2-1]}
  (0...n).map{|i|(b[i-1]-b[i]).abs}.max(n-1).reduce(:+)
}.max

Measured memory_bytes: 10864
def f(a, b5, rev=False):
    ok = -1
    ng = 300
    while ng - ok > 1:
        mid = (ng+ok)//2
        if N[mid] == b5:
            print(a, mid - 300)
            exit()
        elif N[mid] > b5:
            ng = mid
        else:
            ok = mid
    

N = [i**5 for i in range(-300,300)]
X = int(input())
for a in range(-300,300):
    b5 = N[a + 300] - X
    f(a, b5)

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

#define MAXN 100001
const int M = int(1e9) + 7;
int N, K, cnt[MAXN], ans;

int mpow(int a, int p) {
    int res = 1, sqr = a;
    while (p) {
        if (p & 1) res = ((int64_t)res * sqr) % M;
        p >>= 1;
        sqr = ((int64_t)sqr * sqr) % M;
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> N >> K;
    for (int i = K+1; i-->1;) {
        cnt[i] = mpow(K/i, N);
        for(int j = i + i; j <= K; j += i) {
            cnt[i] = (M + cnt[i] - cnt[j]) % M;
        }
        ans = (ans + (int64_t)cnt[i] * i) % M;
    }
    cout << ans;
}

Measured memory_bytes: 4036
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n,t,min=1000000009;
  cin>>n>>t;
  vector<int> a(n),b(n);
  for (int i = 0; i < n; ++i)
  {
    cin>>a[i];
    b[i] = (min>a[i] ? 0:a[i]-min); 
    min=std::min(min,a[i]);
  }
  sort(b.begin(),b.end());
  cout<<(b.end()-lower_bound(b.begin(),b.end(),b[n-1]));
}

Measured memory_bytes: 1024
import java.io.*;
import java.util.*;

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int N=1000000,i,j; boolean c[]=new boolean[N+1];
        for(i=2;i<=N;i++)
        if(!c[i])
        for(j=2*i;j<=N;j+=i)
        c[j]=true;

        ArrayList<Integer> pr=new ArrayList<>();
        for(i=2;i<=N;i++)
        if(!c[i]) pr.add(i);

        HashMap<Integer,Integer> hm=new HashMap<>();
        int sz=pr.size(),ar[]=new int[sz];
        for(i=0;i<sz;i++)
        hm.put(pr.get(i),i);

        int n=Integer.parseInt(bu.readLine());
        int a[]=new int[n];
        String s[]=bu.readLine().split(" ");
        for(i=0;i<n;i++)
        {
            a[i]=Integer.parseInt(s[i]);
            int x=a[i];
            for(j=2;j*j<=x;j++)
            if(x%j==0)
            {
                ar[hm.get(j)]++;
                while(x%j==0) x/=j;
            }
            if(x>=2) ar[hm.get(x)]++;
        }

        int max=0;
        for(i=0;i<sz;i++)
        max=Math.max(max,ar[i]);
        if(max<2) {System.out.print("pairwise coprime"); return;}

        int g=a[0];
        for(i=1;i<n;i++)
        g=gcd(g,a[i]);
        if(g==1) sb.append("setwise coprime");
        else sb.append("not coprime");
        System.out.print(sb);
    }

    static int gcd(int a,int b)
    {
        int t;
        while(b!=0)
        {
            t=b;
            b=a%b;
            a=t;
        }
        return a;
    }
}


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

int main() {
    ll a, b;
    cin >> a >> b;
    ll ans = a;
    while(1) {
        if(ans % b == 0) {
            break;
        }
        ans += a;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	int n,ans=0;
	string s;
	cin>>n>>s;
	rep(i,n-1)if(s.at(i)!=s.at(i+1))ans++;
	cout<<ans+1<<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(void){
  string s,t;
  cin>>s>>t;
  for(int i=0;i<s.size();i++){
    if(s==t){
      cout<<"Yes"<<endl;
      return 0;
    }
    char c=s[0];
    s=s.substr(1,s.size()-1)+c;
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int[] value = new int[n];
		int i=0;
		for (;i<value.length; i++){
			value[i] = sc.nextInt();
			if ((value[i]%2==0 && value[i]%3!=0) && (value[i]%2==0 && value[i]%5!=0)){
				break;
			}
		}
		if (i==n){
			System.out.println("APPROVED");
		} else {
			System.out.println("DENIED");
		}
		
    	}
  
}

Measured memory_bytes: 35836
import copy
H,W,K= map(int, input().split())
board=[]

def judge(H_ex,W_ex):
    cp_array=copy.deepcopy(board)
    for i in range(H):
        for j in range(W):
            if H_ex&(2**i)!=0:
                cp_array[i][j]=2
    for j in range(W):
        for i in range(H):
            if W_ex&(2**j)!=0:
                cp_array[i][j]=2
    count=0
    for i in range(H):
        for j in range(W):
            if cp_array[i][j]==1:
                count+=1
    if count==K:
        return True
    else:
        return False


for i in range(H):
    input_str=input()
    board.append([])
    for j in range(W):
        v=0
        if input_str[j]=="#":
            v=1
        board[i].append(v)

H_cmb=2**H
W_cmb=2**W
count=0

for i in range(H_cmb):
    for j in range(W_cmb):
        if judge(i,j)==True:
            count+=1



print("{}".format(count))


Measured memory_bytes: 9144
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll n;
  cin >> n;
  vector<string> s(n);
  set<string> st;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    st.insert(s[i]);
  }

  cout << st.size() << ln;

  return 0;
}

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

template <typename T> void chmin(T&x,const T &y)
{
	if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef long long s64;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define rep0(i,l,r) for(int i=l;i<r;++i)
#define gc (c=getchar())
int read()
{
	char c;
	while(gc<'-');
	if(c=='-')
	{
		int x=gc-'0';
		while(gc>='0')x=x*10+c-'0';
		return -x;
	}
	int x=c-'0';
	while(gc>='0')x=x*10+c-'0';
	return x;
}
#undef gc

int main()
{
#ifdef kcz
	freopen("1.in","r",stdin);//freopen("1.out","w",stdout);
#endif
	string s;
	cin>>s;
	s64 sum=0;int cnt=0;
	rep(i,0,int(s.size())-1)
	if(s[i]=='W')
	{
		sum+=i;
		++cnt; 
	}
	cout<<sum-s64(cnt)*(cnt-1)/2;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin >> n;
  vl a(n);
  rep(i,n) cin >> a[i];
  vl b = a;
  sort(rng(b),greater<ll>());
  ll m1 = b[0];
  ll m2 = b[1];
  rep(i,n){
    if(a[i] == m1)cout<<m2<<endl;
    else cout<<m1<<endl;
  }
  return 0;
}

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

long long int gcd(int a,int b)
{
  if(a==0)
    return b;
  return gcd(b%a, a);
}

int main(){
  long long int a,b;
  cin>>a>>b;
  long long int ans = (a*b)/gcd(a,b);
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        //Compute c1 = new Compute();//calc

        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //StringBuilder answer=new StringBuilder();

        //input
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        boolean flag=false;
        int ans=0;
        if (a%2!=b%2) System.out.println("IMPOSSIBLE");
        else 
        {
            for (int i=1;i<1000000000;++i)
            {
                if (Math.abs(a-i)==Math.abs(b-i))
                {
                    ans=i;
                    flag=true;
                    break;
                }
            }
            if (flag) System.out.println(ans);
            else System.out.println("IMPOSSIBLE");
        }
        //output
        //System.out.println(String.format("%.0f",answer));
    }
}

Measured memory_bytes: 21972
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
#define MOD 1000000007
using namespace std;

int main() {
	string sa, sb, sc;
	cin >> sa >> sb >> sc;
	char s = 'a';
	int counta = 0, countb = 0, countc = 0;
	while (1) {
		if (s == 'a') {
			s = sa[counta];
			counta++;
		}
		else if (s == 'b') {
			s = sb[countb];
			countb++;
		}
		else if (s == 'c') {
			s = sc[countc];
			countc++;
		}
		if (counta == sa.size()+1) {
			cout << 'A' << endl;
			return 0;
		}
		if (countb == sb.size()+1) {
			cout << 'B' << endl;
			return 0;
		}
		if (countc == sc.size()+1) {
			cout << 'C' << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n = false, w = false, s = false, e = false;
    string str;
    cin >> str;
    for (auto c : str)
    {
        if (c == 'N') n = true;
        if (c == 'W') w = true;
        if (c == 'S') s = true;
        if (c == 'E') e = true;
    }
    if ((n ^ s) || (w ^ e))
    {
        cout << "No\n";
    }
    else
    {
        cout << "Yes\n";
    }
}


Measured memory_bytes: 256
n = gets.to_i
a = Array.new(n){gets.split.map(&:to_i)}
dp = Array.new(n){Array.new(3, 0)}
dp[0] = a[0]
(1...n).each do |i|
  dp[i][0] = [dp[i-1][1], dp[i-1][2]].max + a[i][0]
  dp[i][1] = [dp[i-1][0], dp[i-1][2]].max + a[i][1]
  dp[i][2] = [dp[i-1][0], dp[i-1][1]].max + a[i][2]
end
puts dp.last.max


Measured memory_bytes: 16124
import java.util.Scanner;
public class Main{
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int count = 0;
		for(int i = 1; i <= n; i++) {
			count += i;
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 35564
//#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define fast_io()                \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    fast_io();
    ld a, b;
    cin >> a >> b;
    cout << (ll)(a * b);
    return 0;
}

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

int n;
int l[10000];

int main(){

    cin >> n;
    for(int i = 0; i < n; i++) cin >> l[i];
    sort(l, l+n);

    int ans = 0;

    for(int i = 0; i < n-2; i++){
        for(int j = i+1; j < n-1; j++){
            for(int k = j+1; k < n; k++){
                if(l[k] < l[i]+l[j]){
                    ans++;
                }else{
                    break;
                }
            }
        }
    }

    cout << ans << endl;
    

    return 0;
}

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

struct Node {
  int key;
  Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u, int k) {
  while (u != NIL && k != u->key) {
    if (k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

void insert(int k) {
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while (x != NIL) {
    y = x;
    if (z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }

  z->parent = y;
  if (y == NIL) {
    root = z;
  } else {
    if (z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node *u) {
  if (u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}
void preorder(Node *u) {
  if (u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

int main() {
  int n, i, x;
  string com;

  scanf("%d", &n);
  for (int i = 0; i < n; i ++) {
    cin >> com;
    if (com[0] == 'f') {
      scanf("%d", &x);
      Node *t = find(root, x);
      if (t != NIL) printf("yes\n");
      else printf("no\n");
    } else if (com == "insert") {
      scanf("%d", &x);
      insert(x);
    } else if (com == "print") {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
}



Measured memory_bytes: 21992
#include <cstdio>
#include <cstring>
int a,b;
int dp[16][16];
bool bad[16][16];
int main (int argc, char const* argv[])
{
	int a,b,n;
	while(scanf("%d %d",&a,&b),a) {
		memset(dp,0,sizeof(dp));
		memset(bad,0,sizeof(bad));
		scanf("%d",&n);
		for(int i=0;i<n;i++) {
			int x,y;
			scanf("%d %d",&x,&y);
			bad[x-1][y-1]=true;
		}
		if(bad[0][0]){printf("0\n");continue;}
		dp[0][0]=1;
		for(int i=0;i<a;i++) {
			for(int j=0;j<b;j++) {
				if(bad[i][j])continue;
				if(i>0&&!bad[i-1][j])dp[i][j]+=dp[i-1][j];
				if(j>0&&!bad[i][j-1])dp[i][j]+=dp[i][j-1];
			}
		}
		printf("%d\n",dp[a-1][b-1]);
	}
	return 0;
}

Measured memory_bytes: 1028
#include<stdio.h>

int main() {
	int a = 0;
	int b = 0;
	scanf("%d %d", &a, &b);
	
	if (a < b)
		printf("a < b\n");
	else if (a > b)
		printf("a > b\n");
	else
		printf("a == b\n");

	return 0;
}

Measured memory_bytes: 1008
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer v[] = new Integer[N];
		for (int i = 0; i < N; i++) {
			v[i] = sc.nextInt();
		}
		sc.close();
		Arrays.sort(v);

		double a = v[0];

		for (int i = 1; i < N; i++) {
			a = (a + v[i]) / 2;
		}
		System.out.println(a);
	}
}


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

using namespace std;
typedef unsigned long long ll;
int main() {
	int n ;
	cin>>n;
	vector<int>num(n);
	for(int i = 0 ; i< n ; i++){
		cin>>num[i];
	}
	
	sort(num.begin(),num.end());

	cout<<num[n/2]-num[n/2-1];
}



Measured memory_bytes: 640
from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
#from math import *
from collections import defaultdict as dd, deque
def data(): return sys.stdin.readline().strip()
def mdata(): return map(int, data().split())
out=sys.stdout.write
#sys.setrecursionlimit(100000)
INF=int(10e9)

n=int(data())
dp1=[0]*(n+1)
dp2=[0]*(n+1)
dp3=[0]*(n+1)
for i in range(1,n+1):
    a,b,c=mdata()
    dp1[i]=max(dp2[i-1],dp3[i-1])+a
    dp2[i] = max(dp1[i - 1], dp3[i - 1]) + b
    dp3[i] = max(dp2[i - 1], dp1[i - 1]) + c
print(max(dp1[-1],dp2[-1],dp3[-1]))

Measured memory_bytes: 46056
#include<stdio.h>
#include<math.h>
#include <stdlib.h>
#include<string.h>

int main(){
	char str[10000]={'\0'};
	int i,n,j;
	
	while(fgets(str,sizeof(str),stdin)!=NULL){
		
		for(i=0;i<strlen(str);i++){
			if(str[i]=='a' && str[i+1]=='p' && str[i+2]=='p' && str[i+3]=='l' && str[i+4]=='e'){
				str[i]='p'; 
				str[i+1]='e';
				str[i+2]='a';
				str[i+3]='c';
				str[i+4]='h';
			}
			else if(str[i]=='p' && str[i+1]=='e' && str[i+2]=='a' && str[i+3]=='c' && str[i+4]=='h'){
				str[i]='a'; 
				str[i+1]='p';
				str[i+2]='p';
				str[i+3]='l';
				str[i+4]='e';
			}
		
	
		}
		printf("%s",str);
		for(i=0;i<strlen(str);i++)str[i]='\0';
	}
return 0;
}

Measured memory_bytes: 528
using System;
using System.Linq;

namespace id_2881cs
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var tmp = Console.ReadLine();
                if(tmp == "#") { return; }
                var x = tmp.Split(' ').Skip(1).Select(int.Parse).ToArray();
                var year = x[0];
                var month = x[1];
                var day = x[2];
                if (year >= 31 && month >= 5 || year >= 32)
                {
                    Console.WriteLine("? {0} {1} {2}", year - 30, month, day);
                }
                else
                {
                    Console.WriteLine(tmp);
                }
            }
        }
    }
}



Measured memory_bytes: 18436
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

bool flag[4] = {0};
int N[4];

bool can(){
  for(int i = 0; i < 4; i++){
    if(N[i] == 1 && !flag[0]) flag[0] = true;
    else if(N[i] == 7 && !flag[1]) flag[1] = true;
    else if(N[i] == 9 && !flag[2]) flag[2] = true;
    else if(N[i] == 4 && !flag[3]) flag[3] = true;
    else return false;
  }
  return true;
}

int main(){

  cin >> N[0] >> N[1] >> N[2] >> N[3];

  if (can()) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <math.h>
using namespace std;

int main() {

	string S;
	string T;

	cin >> S;
	cin >> T;

	string ans = T + S;

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

Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
int main(){
	int a;scanf("%d",&a);
	printf("%.12f\n",(double)((a+1)/2)/a);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld double
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define pll pair <ll,ll>
#define nl "\n"

int main()
{
	ios_base::sync_with_stdio(false);
	ll n,i,j;
	cin>>n;
	ll a[100002][3],dp[100002][3];
	for(i=0;i<n;i++)
		for(j=0;j<3;j++)
			cin>>a[i][j];
	for(j=0;j<3;j++)
		dp[0][j]=a[0][j];
	for(i=1;i<n;i++)
	{
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+a[i][2];
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<nl;
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
#define int long long
signed main(void){
    int N;
    int F=0;
    int S=0;
    
    int A[114514];
    cin >> N;
    REP(i,N){cin >> A[i];}
    sort(A,A+N,greater<int>());
    
    REP(i,N-1){
        if(A[i]==A[i+1]){
            if(F!=0){S=A[i];break;}
            else{F=A[i];A[i]=0;A[i+1]=0;}
        }
    }
    cout << F*S <<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

const int MAX_N=110000;
int memo[MAX_N];

int rec(int n){
    if(n==0) return 0;
    if(memo[n]!=-1)return memo[n];
    int res=n;
    for(int pow6=1;pow6<=n;pow6*=6){
        res=min(res,rec(n-pow6)+1);
    }
    for(int pow9=1;pow9<=n;pow9*=9){
        res=min(res,rec(n-pow9)+1);
    }
    return memo[n]=res;
}

int main(){
    int n;cin>>n;
    for(int i=0;i<MAX_N;i++){
        memo[i]=-1;
    }
    cout<<rec(n)<<endl;
    return 0;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  bool flag = true;
  if(a[a.size()-1] != b[0]) flag = false;
  if(b[b.size()-1] != c[0]) flag = false;
  if(flag) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    string a, b;
    cin >> a >> b;
    string s = a + b;
    bool flag = true;
    int num = stoi(s);
    for(int i=1; i<=100100; i++){
        if((i*i)==num){
            flag = false;
            break;
        }
    }
    if(flag==false) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <unordered_map>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF 1e18
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

long cnt[26];

int main() {
    string s;
    cin >> s;
    for (auto c: s) {
        cnt[c-'a']++;
    }
    long n = s.size();
    long ans = n * (n + 1) / 2;
    REP(i,26) {
        if (cnt[i]) {
            ans -= cnt[i] * (cnt[i] + 1) / 2;
        }
    }
    cout << ans + 1 << endl;
}


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

void _140() {
    int n;
    cin >> n;

    int a[20];
    int b[20];
    int c[20];
    for (int i = 0; i < n; ++i) 
        cin >> a[i];
    for (int i = 0; i < n; ++i) 
        cin >> b[i];
    for (int i = 0; i < n - 1; ++i) 
        cin >> c[i];

    int score = 0;
    for (int i = 0; i < n - 1; ++i) {
        score += b[a[i] - 1];
        if (a[i + 1] == a[i] + 1) {
            score += c[a[i] - 1];
        }
        // cout << score << endl;
    }
    score += b[a[n - 1] - 1];

    cout << score << endl;
}

#include <string>
void _141() {
    string s;
    cin >> s;
    bool judge = true;
    for (int i = 0; i < s.size(); ++i) {
        if ((i + 1) % 2 == 0 && s[i] == 'R') {
            judge = false;
            break;
        } else if ((i + 1) % 2 == 1 && s[i] == 'L') {
            judge = false;
            break;
        }
    }

    if (judge) 
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void _142() {
    int n, k;
    cin >> n >> k;
    int count = 0;
    int h;
    for (int i = 0; i < n; ++i) {
        cin >> h;
        if (h >= k)
            count++;
    }
    cout << count << endl;
}

void _143() {
    int n;
    cin >> n;
    int d[50];
    for (int i = 0; i < n; ++i) {
        cin >> d[i];
    }

    int value = 0;
    for (int i = 0; i < n - 1; ++i) {
        for (int j = i + 1; j < n; ++j) {
            value += d[i] * d[j];
        }
    }
    cout << value << endl;
}

void _144() {
    int n;
    cin >> n;

    for (int i = 1; i <= 9; ++i) {
        for (int j = 1; j <= 9; ++j) {
            if (i * j == n) {
                cout << "Yes" << endl;
                return;
            }
        }
    }
    cout << "No" << endl;
}

void _145() {
    int n;
    string s;
    cin >> n;
    cin >> s;

    if (s.size() %2 ==1) {
        cout << "No" << endl;
        return;
    }

    string first = s.substr(0, s.size() / 2);
    string second = s.substr(s.size() / 2, s.size());
    if (first == second)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void _146() {
    int n;
    cin >> n;
    string s;
    cin >> s;

    for (int i = 0; i < s.size(); ++i) {
        s[i] = s[i] + n;
        if (s[i] > 90) {
            s[i] = '@' + (s[i] - 90);
        }
    }
    cout << s << endl;
}

int main()
{
    _146();
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
long long n,a,b;
long long lstp,tot=0;
int main() {
    cin >> n >> a >> b;
    lstp=n%(a+b);
    if (lstp<a) {
        tot+=lstp;
    }
    else{
        tot+=a;
    }
    tot+=(n/(a+b))*a;
    cout << tot;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;


namespace atcorder2
{
    class Program
    {
        public static long Read()
        {

            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

       
         public static long GCM(long x,long y)
        {
            if (x < y)  GCM(y, x);


            while (y > 0)
            {
                var z = y;
                y = x % y;
                x = z;
            }
            
            return x;
        }

        



        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var n = Read();
            var s = new long[n];
            long min =long.MaxValue;
            for (int i = 0; i < n; i++)
            {
                s[i] = Read();
                if (min > s[i] && s[i] % 10 != 0) min = s[i];
            }
            if (s.Sum() % 10 != 0)
                WriteLine(s.Sum());
            else {
                if (min == long.MaxValue)
                    WriteLine(0);
                else
                    WriteLine(s.Sum()-min);
                }

            
            
            
         


            
            
            
            

            






            Console.Out.Flush();
        }
    }
}




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

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

const int MX = 707;

bool g[MX][MX];
bool rg[MX][MX];

int c[MX];
int cid[MX];

int dfs(int n, int v, int cc, int ccid) {
    c[v] = cc;
    cid[v] = ccid;
    for (int to = 1; to <= n; to++) {
        if (rg[v][to] && c[to] == 0) {
            dfs(n, to, 3 - cc, ccid);
        }
    }
}

int cnt[MX][3];

bool dp[MX][MX];

int main() {
#ifdef BZ
    freopen("in", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (i != j) {
                rg[i][j] = true;
            }
        }
    }

    for (int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        g[u][v] = g[v][u] = true;
        rg[u][v] = rg[v][u] = false;
    }

    int nv = 0;
    for (int i = 1; i <= n; i++) {
        if (c[i] == 0) {
            nv++;
            dfs(n, i, 1, nv);
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (rg[i][j] && c[i] == c[j]) {
                cout << -1 << "\n";
                return 0;
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        cnt[cid[i]][c[i]]++;
    }

    dp[1][0] = true;
    for (int i = 1; i <= nv; i++) {
        for (int j = 0; j <= n; j++) {
            if (dp[i][j]) {
                dp[i + 1][j + cnt[i][1]] = true;
                dp[i + 1][j + cnt[i][2]] = true;
            }
        }
    }

    int ans = 1e9 + 7;
    for (int i = 0; i <= n; i++) {
        if (dp[nv + 1][i]) {
            int j = n - i;
            ans = min(ans, i * (i - 1) / 2 + j * (j - 1) / 2);
        }
    }

    cout << ans << "\n";

}


Measured memory_bytes: 1792
import java.io.BufferedReader

fun main() {
    val br = System.`in`.bufferedReader()
    val r = br.readInt()
    print(when (r) {
        in 400..599 -> 8
        in 600..799 -> 7
        in 800..999 -> 6
        in 1000..1199 -> 5
        in 1200..1399 -> 4
        in 1400..1599 -> 3
        in 1600..1799 -> 2
        in 1800..1999 -> 1
        else -> -1
    })

}


private const val SPACE_INT = ' '.toInt()
private const val ZERO_INT = '0'.toInt()
private const val NL_INT = '\n'.toInt()

private fun BufferedReader.readInt(): Int {
    var ret = read()
    while (ret <= SPACE_INT) {
        ret = read()
    }
    val neg = ret == '-'.toInt()
    if (neg) {
        ret = read()
    }
    ret -= ZERO_INT
    var read = read()
    while (read >= ZERO_INT) {
        ret *= 10
        ret += read - ZERO_INT
        read = read()
    }

    while (read <= SPACE_INT && read != -1 && read != NL_INT) {
        mark(1)
        read = read()
    }
    if (read > SPACE_INT) {
        reset()
    }
    return if (neg) -ret else ret
}

Measured memory_bytes: 34264
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int N;
	cin >> N;
	string S;
	cin >> S;
	int M = S.size();
	rep(i, M) {
		S[i] = (S[i] - 'A' + N) % 26 + 'A';
	}
	co(S);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <time.h>
#include <stdlib.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ull unsigned long long
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define clr(x) x.clear()
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vi>
#define mp make_pair
#define hell 1000000007
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define all(a) a.begin(),a.end()
#define ign cin.ignore();

#define o_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define o_setll tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

using namespace std;
using namespace __gnu_pbds;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

int main()
{
    IOS
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++)
    {
        cout<<"x";
    }
    return 0;
}


Measured memory_bytes: 256