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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


int solve(int N, int K) {
    if (N % K) return 1;
    else return 0;
}

int main() {
    int N,K; cin >> N >> K;
    cout << solve(N,K) << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(_) for _ in input().split()]
table = {}
for a in A:
    if a in table.keys():
        table[a] += 1
    else:
        table[a] = 1
rectangle1 = 0
rectangle2 = 0
square = 0
for k, v in table.items():
    if v > 3:
        square = max(square, k)
    if v > 1:
        rectangle1, rectangle2 = sorted(
            [rectangle1, rectangle2, k], reverse=True)[:-1]
print(max(square**2, rectangle1*rectangle2))


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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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


int main() {
    cout<<fixed<<setprecision(10);

    ll N; cin>>N;
    vint X(N),Y(N); vector<char> U(N);
    rep(i,N) cin>>X[i]>>Y[i]>>U[i];

    const ll C = 200000;

    vector<vector<set<ll>>> tate(2*C+1, vector<set<ll>>(2)); // U, D
    vector<vector<set<ll>>> yoko(2*C+1, vector<set<ll>>(2)); // R, L
    vector<vector<set<ll>>> nanap(2*C+1, vector<set<ll>>(4)); // 右肩上がり　U, D, R, L
    vector<vector<set<ll>>> nanam(2*C+1, vector<set<ll>>(4)); // 右肩下がり　U, D, R, L

    // rep(i,N){
    //     cout<<U[i]<<": "<<Y[i]-X[i]<<" "<<Y[i]+X[i]<<endl;
    // }

    rep(i,N){
        if(U[i] == 'U'){
            tate[X[i]][0].insert(Y[i]);
            nanap[C+Y[i]-X[i]][0].insert(X[i]);
            nanam[Y[i]+X[i]][0].insert(X[i]);
        }else if(U[i] == 'D'){
            tate[X[i]][1].insert(Y[i]);
            nanap[C+Y[i]-X[i]][1].insert(X[i]);
            nanam[Y[i]+X[i]][1].insert(X[i]);
        }else if(U[i] == 'R'){
            yoko[Y[i]][0].insert(X[i]);
            nanap[C+Y[i]-X[i]][2].insert(X[i]);
            nanam[Y[i]+X[i]][2].insert(X[i]);
        }else{ // L
            yoko[Y[i]][1].insert(X[i]);
            nanap[C+Y[i]-X[i]][3].insert(X[i]);
            nanam[Y[i]+X[i]][3].insert(X[i]);
        }
    }

    ll ans = LLONG_MAX;
    // tate
    for(auto &v:tate){
        for(auto yu:v[0]){
            auto it = v[1].lower_bound(yu+1);
            if(it == v[1].end()) continue;
            chmin(ans, *it - yu);
        }
    }

    // yoko
    for(auto &v:yoko){
        for(auto xr:v[0]){
            auto it = v[1].lower_bound(xr+1);
            if(it == v[1].end()) continue;
            chmin(ans, *it - xr);
        }
    }

    // nanap
    for(auto &v:nanap){
        // U, L
        for(auto xu:v[0]){
            auto it = v[3].lower_bound(xu+1);
            if(it == v[3].end()) continue;
            chmin(ans, 2*(*it - xu));
        }
        // R, D
        for(auto xr:v[2]){
            auto it = v[1].lower_bound(xr+1);
            if(it == v[1].end()) continue;
            chmin(ans, 2*(*it - xr));
        }
    }

    // nanam
    for(auto &v:nanam){
        // D, L
        for(auto xd:v[1]){
            auto it = v[3].lower_bound(xd+1);
            if(it == v[3].end()) continue;
            chmin(ans, 2*(*it - xd));
        }
        // R, U
        for(auto xr:v[2]){
            auto it = v[0].lower_bound(xr+1);
            if(it == v[0].end()) continue;
            chmin(ans, 2*(*it - xr));
        }
    }


    if(ans == LLONG_MAX) puts("SAFE");
    else cout<<ans*5<<endl;

    return 0;

}

Measured memory_bytes: 322128
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <complex>
#include <cmath>
using namespace std;


int main(int argc, char const *argv[]) {
    long long n,h,w;cin>>n>>h>>w;
    cout<<(n-h+1)*(n-w+1)<<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << max(A * B, C * D) << endl;
}

Measured memory_bytes: 3540
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,k = li()
x = []
y = []
points = [tuple(li()) for _ in range(n)]
for i in range(n):
    x.append(points[i][0])
    y.append(points[i][1])
    
x.sort()
y.sort()

ans = (x[-1]-x[0]) * (y[-1]-y[0])
for u,xs in enumerate(x[:-1]):
    for xt in x[u+1:]:
        for v,ys in enumerate(y[:-1]):
            for yt in y[v+1:]:
                area = (xt-xs) * (yt-ys)
                inner = 0
                for xi,yi in points:
                    if xs<=xi<=xt and ys<=yi<=yt:
                        inner += 1
                        
                if inner >= k:
                    ans = min(ans,area)
                    
                    
print(ans)

Measured memory_bytes: 48092
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }


signed main()
{
    int W,H; cin>>W>>H;
    vector<pair<int,int> > a;
    for(int i=0;i<W;i++){
        int p; cin>>p;
        a.push_back(make_pair(p,0));
    }
    for(int i=0;i<H;i++){
        int q; cin>>q;
        a.push_back(make_pair(q,1));
    }
    sort(a.begin(),a.end());
    
    int ans=0;
    for(auto p:a){
        if(W==0 and H==0) break;
        if(p.second==0){
            ans+=p.first*(H+1);
            W--;
        }else{
            ans+=p.first*(W+1);
            H--;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6384
#include <iostream>
#include <vector>

using namespace std;

void trade(int k, int h, vector<int> &ans){
    int tmp = ans[k];
    ans[k]=ans[h];
    ans[h]=tmp;
}

int main(){
    int N, x;
    cin >> N >> x;

    if (x==1 || x==2*N-1){
        cout << "No\n";
        return 0;
    }else{
        cout << "Yes\n";
    }
    if (N==2){
        for(int i=0; i<2*N-1; i++){
            cout << i+1 << '\n';
        }
        return 0;
    }

    vector<int> ans(2*N,0);
    for(int i=1; i<2*N; i++)ans[i]=i;
    trade(N-1,1,ans);
    trade(N,x,ans);
    trade(N+1,2*N-1,ans);
    if(x!=2*N-2){
        trade(N-2,2*N-2,ans);
    }else{
        trade(N+2,2,ans);
    }
    for(int i=1; i<2*N;i++){
        cout << ans[i] << '\n';
    }
}

Measured memory_bytes: 2304
import sys

S = list(map(int, sys.stdin.readline().strip()))
len_S = len(S)
ans = 0
for i in range(2 ** (len_S - 1)):
  sum_ = S[len_S - 1]
  cursor = len_S - 1
  power = 0
  while cursor > 0:
    cursor -= 1 
    if i % 2 == 1:
      power += 1
    else:
      power = 0
    sum_ += S[cursor] * (10 ** power)
    i >>= 1
  ans += sum_
print(ans)


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int K; cin >> K;
    string S; cin >> S;
    if (S.size() > K) {
        cout << S.substr(0, K) << "...\n";
    } else {
        cout << S << "\n";
    }\
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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 all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

int main(){
    string s;cin>>s;
    int n=s.size();
    vvll dp(n,vll(13));//桁dp的な:i+1桁目の時点での13で割った余りがjとなる場合の数
    if(s[n-1]=='?')rep(i,10)dp[0][i]=1;
    else dp[0][s[n-1]-'0']=1;
    ll res=1;ll tmp;const ll c=13;
    rep2(i,1,n){
        res*=10;res%=c;
        if(s[n-1-i]!='?'){
            rep(j,13){
                tmp=j-((s[n-1-i]-'0')*res)%c;
                if(tmp<0)tmp+=c;
                dp[i][j]+=dp[i-1][tmp];
                dp[i][j]%=inf;
            }
        }
        else{
            rep(j,13)rep(k,10){
                tmp=j-(k*res)%c;
                if(tmp<0)tmp+=c;
                dp[i][j]+=dp[i-1][tmp];
                dp[i][j]%=inf;
            }
        }
    }
    cout<<dp[n-1][5]<<endl;
}

Measured memory_bytes: 13696
N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	auto x1=in(),y1=in(),x2=in(),y2=in();
	double dx = x2-x1,dy = y2-y1;
	double norm = hypot(dx,dy);
	dx/=norm,dy/=norm;
	auto Q=in();
	REP(i,Q){
		int x3=in(),y3=in();
		double cross = dx*(y3-y2)-(x3-x2)*dy;
		if(abs(cross)<=1e-7){
			double proj = dx*(x3-x1)+dy*(y3-y1);
			if(proj<0){
				out("ONLINE_BACK");
			}
			else{
				double norm2=hypot(x3-x1,y3-y1);
				if(norm2>norm) out("ONLINE_FRONT");
				else out("ON_SEGMENT");
			}
		}
		else{
			if(cross>0) out("COUNTER_CLOCKWISE");
			else out("CLOCKWISE");
		}
	}

	return 0;
}



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

int a[100005];

int main()
{
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	sort(a + 1, a + 1 + n);
	double ans = a[n] * 1.0 / 2;
	double mi = 10000000000;
	int num;
	for(int i = 1; i <= n - 1; i++)
	{
		if(abs(a[i] - ans) < mi)
		{
			num = a[i];
			mi = abs(a[i] - ans);
		}
	}
	printf("%d %d\n", a[n], num);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ll n;
    cin >> n;

    int r = 0;

    ll m = n - 1;
    for (ll i = 1; i * i <= m; i++) {
        if (m % i == 0) r += (i >= 2) + (i * i < m);
    }

    auto f = [&](ll k) {
        ll t = n;
        while (t % k == 0) t /= k;
        if (t % k == 1) r++;
    };

    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            if (i >= 2) f(i);
            if (i * i < n) f(n / i);
        }
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    string A, B, C;
    cin >> A >> B >> C;
    char next_ = 'a';
    int rem_a = A.size();
    int rem_b = B.size();
    int rem_c = C.size();

    while (true) {
        if (next_ == 'a') {
            if (rem_a == 0) {
                cout << "A" << endl;
                return 0;
            }
            next_ = A[A.size() - rem_a];
            --rem_a;
        } else if (next_ == 'b') {
            if (rem_b == 0) {
                cout << "B" << endl;
                return 0;
            }
            next_ = B[B.size() - rem_b];
            --rem_b;
        } else {
            if (rem_c == 0) {
                cout << "C" << endl;
                return 0;
            }
            next_ = C[C.size() - rem_c];
            --rem_c;
        }
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        s[i] = (s[i]-'A' + n)%26 + 'A';
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using ll = long long int;

int main(){
    int N; cin >> N;
    string S; cin >> S;
    vi R(0); vi G(0); vi B(0);
    for(int i=0; i<N; i++){
        if(S[i] == 'R'){
            R.emplace_back(i);
        }
        else if(S[i] == 'G'){
            G.emplace_back(i);
        }
        else{
            B.emplace_back(i);
        }
    }
    ll p, q, r; p = R.size(); q = G.size(); r = B.size();
    ll sum = p*q*r;

    ll minus = 0;
    for(int i=1; i<N; i++){
        int p = 0;
        while(p+2*i<N){
            if(S[p]!=S[p+i]&&S[p]!=S[p+2*i]&&S[p+i]!=S[p+2*i]){
                minus++;
            }
            p++;
        }
    }
    sum -= minus;
    cout << sum;
}

Measured memory_bytes: 3644
S = input()
cnt = 0
ans = []
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        cnt += 1
    
    else:
        ans.append(cnt)
        cnt = 0
ans.append(cnt)
print(max(ans))


Measured memory_bytes: 2940
#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 N, M, Q;
vector<int> a, b, c, d;
ll ans = 0;

void dfs(vector<int> A) {
  if (A.size() == N + 1) {
    // calc score;
    ll now = 0;
    rep(i, Q) {
      if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
    }
    ans = max(ans, now);
    return;
  }

  A.push_back(A.back());
  while (A.back() <= M) {
    dfs(A);
    A.back()++;
  }
}

int main() {
  cin >> N >> M >> Q;
  a = b = c = d = vector<int>(Q);
  rep(i, Q) cin >> a[i] >> b[i] >> c[i] >> d[i];
  dfs(vector<int>(1, 1));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

const long long int MOD = 1000000007;

long long int fact(long long int k) {
	long long int sum = 1;
	for (long long int i = 2; i <= k; i++)
		sum *= i;

	return sum;
}

int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}

long long int power(int a, int b) {
	long long int  ans = 1;
	for (int i = 0; i < b; i++)
		ans = (ans * a) % MOD;

	return ans;
}


int main()
{
	long long int n;
	float x;

	cin >> n;

	x = n / 1.08f;

	if ((int)((int)x * 1.08) == n)
		cout << (int)x << endl;
	else if ((int)((int)(x + 1) * 1.08) == n)
		cout << (int)(x + 1) << endl;
	else
		cout << ":(" << endl;



	return 0;
}

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

int n;
double ans;

int main() {
	cin >> n;
	double p[n + 1], dp[n + 1][n + 1];
	dp[0][0] = 1;
	for (int i=1; i<=n; i++) {
		cin >> p[i];
		dp[i][0] = dp[i-1][0] * (1 - p[i]);
		for (int j=1; j<i; j++) {
			dp[i][j] = dp[i-1][j-1] * p[i] + dp[i-1][j] * (1 - p[i]);
		}
		dp[i][i] = dp[i-1][i-1] * p[i];
	}
	for (int i=n; i>n/2; i--) ans += dp[n][i];
	cout << fixed << setprecision(9) << ans << endl;
}

Measured memory_bytes: 70528
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int n = in.nextInt();
        HashMap<String, Integer> map = new HashMap<>();
        int x=0,mx=0;
        for(int i=0;i<n;i++){
            String s = in.next();
            x = map.getOrDefault(s,0)+1;
            mx = Math.max(mx,x);
            map.put(s,x);
        }
        ArrayList<String> ar = new ArrayList<>();
        for (Map.Entry mapElement : map.entrySet()) { 
            String key = (String)mapElement.getKey();
            int value = (int)mapElement.getValue();
            if(value==mx){
                ar.add(key);
            }
        }
        Collections.sort(ar);
        for(String s:ar){
            out.println(s);
        }
    }
    
    /************* SOLUTION ENDS HERE **********/
}

Measured memory_bytes: 62024
from collections import Counter

H, W, N, *AB = map(int, open(0).read().split())

C = Counter()
for a, b in zip(*[iter(AB)] * 2):
    C.update(
        [(a - i, b - j)
        for i in range(-1, 2)
        for j in range(-1, 2)
        if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1]
    )

D = Counter(v for _, v in C.items())

print((H - 2) * (W - 2) - sum(D.values()))
for i in range(1, 10):
    print(D[i])


Measured memory_bytes: 178260
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int sol = 0;
    for (int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        sol += min(x, abs(k - x));
    }
    cout << sol * 2;
}


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

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

    int N = scanner.nextInt();
    int[] a = new int[N];
    for (int i = 0; i < N; i++) {
      a[i] = scanner.nextInt();
    }

    Arrays.sort(a);

    long sum = 0;
    if (N % 2 == 0) {
      for (int i = 0; i < N; i++) {
        if (i < N / 2 - 1) sum -= 2 * a[i];
        else if (i == N / 2 - 1) sum -= a[i];
        else if (i == N / 2) sum += a[i];
        else sum += 2 * a[i];
      }
    } else {
      for (int i = 0; i < N; i++) {
        if (i < N / 2 - 1) sum -= 2 * a[i];
        else if (i > N / 2 + 1) sum += 2 * a[i];
      }
      long s1 = - 2 * a[N / 2 - 1] + a[N / 2] +     a[N / 2 + 1];
      long s2 = -     a[N / 2 - 1] - a[N / 2] + 2 * a[N / 2 + 1];
      sum += Math.max(s1, s2);
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 52996
// AOJ 2522
#include<iostream>
#include<string>
#define rep(i,a) for( int i = 0; i != (a); ++i )

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

	if( s.size() < 6 )
	{
		std::cout << "INVALID" << std::endl;
		return 0;
	}

	int fl = 0;
	rep( i, s.size() )
	{
		if( s[i] >= '0' && s[i] <= '9' )
			fl |= 1;
		if( s[i] >= 'A' && s[i] <= 'Z' )
			fl |= 2;
		if( s[i] >= 'a' && s[i] <= 'z' )
			fl |= 4;
	}

	std::cout << (fl&1 && fl>>1&1 && fl>>2&1?"VALID":"INVALID") << std::endl;

	return 0;
}

Measured memory_bytes: 1180
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll n, m, h[100000] = {}, a, b, ans = 0;

int main() {
	cin >> n >> m;
	vector<vector<ll>> to(n);
	rep(i, n)cin >> h[i];
	rep(i, m) {
		cin >> a >> b;
		a--;
		b--;
		to[a].pub(b);
		to[b].pub(a);
	}
	rep(i, n) {
		bool ok = true;
		rep(j, sz(to[i])) {
			if (h[i] <= h[to[i][j]])ok = false;
		}
		if (ok)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9856
#include<stdio.h>
int main(void)
{
	int i,h1,h2,h3,m1,m2,m3,s1,s2,s3;
	for(i=1;i<=3;i++) {
		scanf("%d %d %d %d %d %d",&h1,&m1,&s1,&h2,&m2,&s2);
			s3=s2-s1;
			m3=m2-m1;
			h3=h2-h1;
			if(s3<0) {
				m3--;
				s3+=60;
			}
			if(m3<0) {
				h3--;
				m3+=60;
			}
		printf("%d %d %d\n",h3,m3,s3);
	}
	return 0;
}

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

int main() {
  int i;
  cin >> i;
  char ans;
  if (i <= 599)
    ans = '8';
  else if (i <= 799)
    ans = '7';
  else if (i <= 999)
    ans = '6';
  else if (i <= 1199)
    ans = '5';
  else if (i <= 1399)
    ans = '4';
  else if (i <= 1599)
    ans = '3';
  else if (i <= 1799)
    ans = '2';
  else if (i <= 1999)
    ans = '1';

  cout << ans << endl;
}


Measured memory_bytes: 3628
import math


def equal(x, y):
    return math.fabs(x - y) <= 10 ** (-10)


def spam(_x1, _y1, _x2, _y2):
    if _x1 > _x2:
        return _x1, _y1, _x2, _y2
    else:
        return _x2, _y2, _x1, _y1


for i in range(int(input())):
    x1, y1, x2, y2, x3, y3, x4, y4 = list(map(float, input().split()))
    b1 = (x1 - x2, y1 - y2)
    b2 = (x3 - x4, y3 - y4)
    p = 0 if b2[0] != 0 else 1
    q = 1 if b2[0] != 0 else 0

    t = b1[p]/b2[p]
    if equal(b1[q], b2[q] * t):
        print('YES')
    else:
        print('NO')

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

using namespace std;
#ifdef CLION
ifstream ifs("/home/kyuridenamida/CLionProjects/untitled4/input.txt");
#define cin ifs
#endif

int main() {
    long long N;
    cin >> N;


    set<long long> S;

    for (long long i = 1; i * i <= N; i++) {
        S.insert(i);
        S.insert(N / i);
    }

    long long ans = 0;
    S.insert(0);
    for (auto s : S) {
        long long small = s + 1;
        long long d = N / small;
        if (d == 0) {
            continue;
        }
        long long X = N % small;

        if ((X - d) >= 0 && (X - d) % d == 0) {
            ans += small + (X - d) / d;
        }
    }
    cout << ans << endl;

}



Measured memory_bytes: 93952
using System;

namespace ITP1_4_C_Simple_Calculator
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = null;
            do
            {
                if(input != null)
                {
                    var a = int.Parse( input[ 0 ] );
                    var b = int.Parse( input[ 2 ] );
                    var output = 0;
                    switch ( input[1] )
                    {
                        case "+":
                            output = a + b;
                            break;
                        case "-":
                            output = a - b;
                            break;
                        case "*":
                            output = a * b;
                            break;
                        case "/":
                            output = a / b;
                            break;
                    }
                    Console.WriteLine( output );
                }
                input = Console.ReadLine().Split( ' ' );
            } while ( input[1] != "?");
        }
    }
}

Measured memory_bytes: 5704
s = gets.chomp
t = gets.chomp

if s.length < t.length
  puts "UNRESTORABLE"

elsif s.include?(t)
  s.gsub!(/\?/, 'a')
  puts s
else
  f = true
  ans = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
  
  (0..(s.length - t.length)).each {|i|
    f = true
    tmp = "" << s

    t.length.times {|j|
      if tmp[i + j] != t[j] and tmp[i + j] != '?'
        f = false
        break
      else
        tmp[i + j] = t[j]
      end
    }

    if f
      tmp.gsub!(/\?/, 'a')
      ans = [ans, tmp].min
    end
  }
  
  if ans != "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
    puts ans
  else
    puts "UNRESTORABLE"
  end
end


Measured memory_bytes: 1788
/* AtCoder My Practice             */
/* author: Leonardone @ NEETSDKASU */
#include <stdio.h>

int main(void) {
  	int a = 0, b = 0, c;
    while ((c = getchar()) != ' ') {
       a = (a * 10) + c - '0';
    }
    while ((c = getchar()) != '\n') {
       b = (b * 10) + c - '0';
    }
    if (a % 2 == 0 || b % 2 == 0) {
      	puts("Even");
    } else {
      	puts("Odd");
    }
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<long long int> 
#define pb push_back
#define f(i,x,n) for (i=x;i<n;i++)


bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 
void solve(){
    ll x,k,d;
    cin >> x >> k >> d;
        if(x==0)
    {
        if(k%2==0)
            cout<<"0"<<endl;
        else
            cout<<d<<endl;
    }
    else
    {
        if(x<0)
        x=-x;
        ll c;
        c=x/d;
        if(c>k)
        {
            cout<<x-k*d<<endl;
        }
        else if(c==k)
        {
            cout<<x%d<<endl;
        }
        else
        {
            k=k-c;
            if(k%2==0)
            {
                cout<<x%d<<endl;
            }
            else
            {
                ll ans=(d-x%d);
                cout<<ans<<endl;
            }
        }
    }
    
    
}
int main(){
	ios_base::sync_with_stdio(false); 
     	cin.tie(NULL);
	int t=1;
	
	while(t--)
	solve();	
	
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;

ll cost[1234567], imos[1234567];
signed main() {
	ll n, m, p, a, b, c, ans = 0; cin >> n >> m;
	ll mae = 0;
	rep(i, m) {
		cin >> p;
		if (i != 0) {
			ll x = mae, y = p;
			if (x > y) { swap(x, y); }
			imos[x]++; imos[y]--;
		}
		mae = p;
	}
	rep(i, n + m) {
		if (i != 0) {
			imos[i] += imos[i - 1];
			//cout << i << ' ' << imos[i] << endl;
		}
	}
	rep(i, n - 1) {
		cin >> a >> b >> c;
		if (a * imos[i + 1] <= (b * imos[i + 1]) + c) { ans += a * imos[i + 1]; }
		else { ans += (b * imos[i + 1]) + c; }
		//cout << i + 1 << ' ' << ans << endl;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4664
//============================================================================
// Name        : atcoder.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
using namespace std;


int main() {
	int n,m;
	long long ans=0;
	int a[8]={1,1,1,1,-1,-1,-1,-1};
	int b[8]={1,1,-1,-1,1,1,-1,-1};
	int c[8]={1,-1,1,-1	,1,-1,1	,-1};
	long long D[8][1005];
	long long x,y,z;
	cin>>n>>m;
	for(int i=0;i<n;++i){
		cin>>x>>y>>z;
		for(int j=0;j<8;++j){
			D[j][i]=x*a[j]+y*b[j]+z*c[j];
		}
	}
	for(int j=0;j<8;++j){
		sort(D[j],D[j]+n);
	}
	for(int j=0;j<8;++j){
		long long f=0;
		for(int i=n-1;i>n-1-m;--i){
			f+=D[j][i];
		}
		ans=max(ans,f);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
N, X, M = map(int, input().split())
C = X
F = {X}
S = 0
cnt = 0
loop = 0
loop_S = 0
while cnt < N:
    S += C
    cnt += 1
    C *= C
    C %= M
    if C in F:
        break
    F.add(C)
st = C
L = 0
if cnt < N:
    val = (st * st) % M
    loop += 1
    loop_S = st
    while val != st:
        loop_S += val
        loop += 1
        val *= val
        val %= M
    ccnt = N - ((N-cnt)//loop)*loop - cnt
    res = 0
    val = st
    while ccnt > 0:
        res += val
        val *= val
        val %= M
        ccnt -= 1
    print(S+loop_S*((N-cnt)//loop)+res)
else:
    print(S)

Measured memory_bytes: 74144
#include<cstdio>
#include<cstring>

char a[10010];
bool c, f;

int main() 
{
    scanf("%s", a);
    for(int i=0; i<strlen(a); i++) 
    {
        if(a[i]=='C') c=true;
        if(a[i]=='F'&&c==true) f=true;
    }
    if(f==true) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * メインクラス
 *
 */
public class Main {

	/**
	 * メインメソッド
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {

		// ============================================================
		// 標準入力を変数に設定
		// ============================================================

		// 標準入力を取得
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");

		List<Integer> in = new ArrayList<Integer>();

		for (int i = 0; i < line.length; i++) {
			in.add(Integer.parseInt(line[i]));
		}

		int max = 0;
		for (int i : in) {

			if (max < i) {
				max = i;
			}
		}

		int a = 0;
		int b = 0;

		for (int i : in) {

			if (max != i && a == 0) {
				a = i;
			} else if (max != i && a != 0 && b == 0) {
				b = i;
			}

		}

		System.out.println(a * b / 2);

	}
}

Measured memory_bytes: 21076
function Main(input) {
  'use strict';

  const temp = input.split(" ");
  const w = temp.shift();
  const h = temp.shift();
  const x = temp.shift();
  const y = temp.shift();
  
  const s = w * h / 2;
  const g = (w / 2 == x && h / 2 == y)? 1: 0;
  console.log([s,g].join(" "));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using ll = long long;
//typedef long long ll;

#define INF ((1LL << 62) - 1)
#define MOD int(1e9+7)
#define repi(i,j,n) for(int i = (j); i < (n); ++i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()

inline void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

ll k, n;
ll x_, y_, ans = INF;
vector<pair<ll, ll> > v;
vector<ll> x, y;

int main() {
    init();

    cin >> n >> k;
    v.resize(n);
    x.resize(n);
    y.resize(n);
    rep(i,n) {
        cin >> x_ >> y_;
        v[i] = {x_, y_};
        x[i] = x_;
        y[i] = y_;
    }

    sort(all(v));
    sort(all(x));
    sort(all(y));

    // dx
    rep(i,n) {
        // ux
        repi(j,i+1,n) {
            // dy
            rep(l,n) {
                // uy
                ll lb, rb, mid;
                lb = 0, rb = n;
                while (rb - lb > 1) {
                    mid = (lb + rb) / 2;

                    //if (l == mid) break;

                    ll dx, dy, ux, uy, tmp, cnt = 0;
                    dx = min(x[i], x[j]);
                    ux = max(x[i], x[j]);
                    dy = min(y[l], y[mid]);
                    uy = max(y[l], y[mid]);

                    //cout << "mid = " << endl;
                    //cout << ux << " " << dx << " " << uy << " " << dy << endl;

                    tmp = (ux - dx) * (uy - dy);

                    rep(z,n) {
                        if (dx <= v[z].fi and v[z].fi <= ux and dy <= v[z].se and v[z].se <= uy) {
                            cnt++;
                        }
                    }

                    //cout << tmp << endl;

                    if (cnt >= k) {
                        if (ans == INF) ans = tmp;
                        else ans = min(ans, tmp);
                        rb = mid;
                    }
                    else {
                        lb = mid;
                    }
                }
            }
        }

    }


    /*
    rep(i,n) {
        repi(j,i+1,n) {
            ll dx, ux, dy, uy, cnt = 0;
            ll tmp;
            dx = min(v[i].fi, v[j].fi);
            ux = max(v[i].fi, v[j].fi);
            dy = min(v[i].se, v[j].se);
            uy = max(v[i].se, v[j].se);

            cout << ux << " " << dx << " " << uy << " " << dy << endl;

            tmp = (ux - dx) * (uy - dy);

            rep(l,n) {
                if (dx <= v[l].fi and v[l].fi <= ux and dy <= v[l].se and v[l].se <= uy) {
                    cnt++;
                }
            }

            cout << "cnt = " << cnt << endl;
            cout << "tmp = " << tmp << endl;

            if (cnt >= k) {
                if (ans == INF) ans = tmp;
                else ans = min(ans, tmp);
            }
        }
    }
    */

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#import numpy as np
import math
from bisect import bisect

N, D, A = map(int, input().split())
xh = [list(map(int, input().split())) for _ in range(N)]
xh.sort(key=lambda x: x[0])
x = [i[0] for i in xh]
h = [i[1] for i in xh]
#h_int = np.ceil(h/A)

cnt=0
damage=[0]*(N+1)

for i in range(len(x)):
    damage[i] += damage[i-1]
    h[i] -= damage[i]
    if h[i]<=0: continue
    h_int =  math.ceil(h[i]/A)
    cnt+=h_int
    damage[i]+=h_int*A
    r=bisect(x,x[i]+2*D)
    #print(damage[i])
    damage[r]-= A*h_int
    

print(int(cnt))


Measured memory_bytes: 127740
#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

int main()
{
    double t1,t2;
    while( scanf( "%lf %lf\n", &t1, &t2 ) != EOF )
    {
        const double bound_1[100] = {35.5,37.5,40,43,50,55,70};
        const double bound_2[100] = {71,77,83,89,105,116,148};
        const string c[100] = {"AAA","AA","A","B","C","D","E"};
        int i = 0, num;
        while( 1 )
        {
            if( t1 < bound_1[i] && t2 < bound_2[i] ){
                cout << c[i] << endl;
                break;
            }
            if( i > 7 )
            {
                printf( "NA\n");
                break;
            }
            i++;
        }
        /* for( int i = 0; i < 7; i++ )
        {
            if( t1 > bound_1[i] )
            {
                num1 = i;
            }
            if( t2 > bound_2[i] )
            {
                num2 = i;
            }
        } */
       
    }
    return 0;
}


Measured memory_bytes: 3268
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input!{
        s: chars
    }
    if s.len() == 2 {
        println!("{}", s.into_iter().collect::<String>());
    } else {
        println!("{}", s.into_iter().rev().collect::<String>());
    }
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    try {
      int n = sc.nextInt();
      int ans = 0;
      for (int i = 1; i <= n; i++) {
        if (i % 2 == 0) continue;
        int cnt = 0;
        for (int j = 1; j <= i; j++) if (i % j == 0) cnt++;
        if (cnt == 8) ans++;
      }
      System.out.println(ans); 
    } finally {
      sc.close();
    }
  }
}


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

using namespace std;

#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define ll long long
#define dbg(x) cout << #x << "=" << x << endl
#define dbg2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>  vi;
typedef vector<ll>  vl;
typedef vector<pii>  vpii;
typedef vector<pl>  vpl;
typedef vector<vi>  vvi;
typedef vector<vl>  vvl;
const int mod = 1000000007;
const double pi = 3.14159265358979311599796346854;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n{};
    cin >> n;
    cout << fixed << setprecision(10) << n * pi * 2;
    return 0;
}


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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)
#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(V.begin(),V.end(),c))

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    string S;
    int N;
    cin >>N>>S;

    rep(i,S.size()){
        S[i]=S[i]+N;
        if('Z'<S[i])S[i]=S[i]-'Z'+'A'-1;
    }

    cout << S <<endl;
    return (0);
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

const int BIT = 4000;
const int MOD = 998244353;

bitset<BIT> gcd(bitset<BIT> a, bitset<BIT> b)
{
    int i = BIT - 1;
    int j = BIT - 1;

    for(;;){
        while(i >= 0 && !a[i])
            -- i;
        if(i == -1)
            return b;

        while(j >= 0 && !b[j])
            -- j;
        if(j == -1)
            return a;

        if(i < j)
            b ^= a << (j - i);
        else
            a ^= b << (i - j);
    }
}

long long div(const bitset<BIT>& x, const bitset<BIT>& a)
{
    int i = BIT - 1;
    while(!a[i])
        -- i;

    long long ans = 0;
    bitset<BIT> y;
    for(int j=BIT-1; j>=i; --j){
        ans *= 2;
        ans %= MOD;
        if(x[j]){
            ++ ans;
            ans %= MOD;
        }
        if(x[j] != y[j])
            y ^= a << (j - i);
    }

    while(--i >= 0){
        if(x[i] && !y[i])
            break;
        else if(!x[i] && y[i])
            return ans;
    }

    ++ ans;
    ans %= MOD;
    return ans;
}

int main()
{
    int n;
    bitset<BIT> x;
    cin >> n >> x;

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

    bitset<BIT> b = a[0];
    for(int i=1; i<n; ++i)
        b = gcd(a[i], b);

    cout << div(x, b) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a); i>n; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
int main() {
	int n; cin >> n;
	set<string> ss;
	string s1, s2;
	rep(i, 0, n) {
		cin >> s1 >> s2;
		if(s1 == "insert") {
			ss.emplace(s2);
		} else {
			P(ss.count(s2) ? "yes" : "no");
		}
	}
	return 0;
}

Measured memory_bytes: 29688
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

#define ll         long long
#define PI         acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

//逆向きで考えると良い

int main(void){
    vector<string> vs(4);
    vs[0] = "maerd";
    vs[1] = "remaerd";
    vs[2] = "esare";
    vs[3] = "resare";
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    string check = "";
    bool isFit = false;
    while(check.length()<s.length()){
        isFit = false;
        FOR(i, 0, 4){
            string ss = check + vs[i];
            if(ss.length()>s.length()) continue;
            if(ss==s.substr(0, ss.length())){
                check = ss;
                isFit = true;
                break;
            }
        }
        if(!isFit){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 788
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

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

#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--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000

int main() {
  int N,M;
  cin >> N >> M;
  int ans;
  ans += N*(N-1)/2;
  ans += M*(M-1)/2;
  cout << ans << endl;
}

Measured memory_bytes: 256