akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int n , m;
int deg[100005];
vector<int> E[100005];
bool vis[100005];
bool ok = 0;
int c1 = -1 , c2 = -1;
void dfs(int u,int lst)
{
    vis[u] = 1;
    for(int i = 0;i < E[u].size() && !ok;i++) {
        if(E[u][i] == c2) return ;
        else if(!vis[E[u][i]]) {
            dfs(E[u][i],u) ;
        }
        else if(E[u][i] == c1 && c1 != lst) {
            ok = 1;
        }
    }
    return;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i = 1;i <= m;i++) {
        int u , v;scanf("%d%d",&u,&v);
        deg[u]++ ; deg[v]++;
        E[u].push_back(v) ; E[v].push_back(u);
    }
    int ans = 0 , num = 0;
    for(int i = 1;i <= n;i++) {
        if(deg[i] & 1) {
            puts("No");return 0;
        }
        if(deg[i] >= 6) {
            ans = 3;
        }
        else if(deg[i] == 4) {
            num++;
            if(c1 == -1) c1 = i;
            else c2 = i;
        }
        else ans = max(ans , 1);
    }
    if(ans == 3) {
        puts("Yes");return 0;
    }
    if(num >= 3) {
        puts("Yes");return 0;
    }
    if(num <= 1) {puts("No");return 0;}
    dfs(c1,0);
    if(ok) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 7424
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define repr(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define all(x) (x).begin(),(x).end()
//#define DEBUG
#ifdef DEBUG
#include "debug.cpp"
#endif
using namespace std;

template<typename T>
T gcd(T a, T b)
{
    if (a == 0) return b;
    if (b == 0) return a;
    return __gcd(a, b);
}

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

    int n; cin >> n;
    int* a = new int[n];
    rep(i, n)
    {
        cin >> a[i];
    }
    int m = 0;
    int* l = new int[n];
    int* r = new int[n];
    l[0] = 0;
    r[n-1] = 0;
    repr(i, 1, n)
    {
        l[i] = gcd(a[i-1], l[i-1]);
        r[n-i-1] = gcd(a[n-i], r[n-i]);
    }
    rep(i, n)
    {
        m = max(m, gcd(l[i], r[i]));
    }

    cout << m << endl;

    return 0;
}

Measured memory_bytes: 1408
A, B = [int(x) for x in input().split(' ')]

def find(per, value):
    n_list = [i for i in range(1,1001)]
    return list(filter(lambda x:int(x*per) == value, n_list))

a_list = list(set(find(0.08, A)) & set(find(0.1, B)))
if a_list:
    print(min(a_list))
else:
    print(-1)

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

using namespace std;

#define INF 1000000000
#define INFLL 0x3f3f3f3f3f3f3f3fLL 
#define EPS 10e-9
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define st first
#define nd second
#define sz(v) int(v.size())
#define all(X) (X).begin(), (X).end()
#define FOR(I, A, B) for(int I = A; I < B; I++)
#define RFOR(I, A, B) for(int I = A; I >= B; I--)

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<iii> viii;
typedef vector<ll> vll;

int n;
ll PD[405][405];
ll a[405];

ll pd(int i, int j){
	if(i == j){
		return 0;
	}
	ll &ans = PD[i][j];
	if(ans != -1){
		return ans;
	}

	ans = INFLL;

	ll s = 0;
	for(int k = i; k <= j; k++){
		s+=a[k];
	}

	for(int k = i; k < j; k++){
		ans = min(ans, pd(i, k) + pd(k+1, j) + s);
	}
	return ans;
}

int main(){
	scanf("%d", &n);
	FOR(i, 0, n){
		scanf("%lld", a+i);
	}
	memset(PD, -1, sizeof PD);
	printf("%lld\n", pd(0, n-1));
	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()	
using namespace std;
typedef long long ll;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000000LL;
typedef pair<int,int> P;
int v[26],v2[26];
int main(){
	string s;cin>>s;
	string t;cin>>t;
	int n=s.length();
	fill(v,v+26,-1);
	fill(v2,v2+26,-1);
	bool f=false;
	for(int i=0;i<n;i++){
		if(v[s[i]-'a']!=-1){
			if(v[s[i]-'a']!=t[i]-'a'){
				f=true;
			}
		}else{
			v[s[i]-'a']=t[i]-'a';
		}
		if(v2[t[i]-'a']!=-1){
			if(v2[t[i]-'a']!=s[i]-'a'){
				f=true;
			}
		}else{
			v2[t[i]-'a']=s[i]-'a';
		}
	}
	if(f){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
}

Measured memory_bytes: 776
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
void solve(); int main() { solve(); return 0; }

void solve() {
  ll n;
  cin >> n;
  string ans = "";
  
  while (n) {
    n--;
    ans += (char)(n%26 + 'a');
    n /= 26;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}


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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
Int mod = 1e9+7;
//Int mod = 998244353;

typedef struct {
    double y, x;
} p_t;

string to_str(Int x) {
    string s = "";
    while (x > 0) {
        char a = '0' + (x % 10);
        s = a + s;
        x /= 10;
    }
    return s;
}

Int dp[10001];

int main() {
    Int h, n;
    cin >> h >> n;
    vector<Int> a(n), b(n);
    for (Int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    for (Int i = 0; i <= h; i++) {
        dp[i] = INF;
    }
    dp[0] = 0;
    for (Int i = 0; i < n; i++) {
        for (Int j = 1; j <= a[i]; j++) {
            dp[j] = min(dp[j], b[i]);
        }
        for (Int j = 0; j + a[i] <= h; j++) {
            dp[j + a[i]] = min(dp[j + a[i]], dp[j] + b[i]);
        }
    }
    dump(dp[h]);
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  while(1){
    cout << fixed << setprecision(12);
    int n;
    double s[1000];
    double avg=0,sum=0,ans=0;
    sum = 0;
  
    cin >> n;
    if(n == 0) break;
    for(int i=0; i<n; i++){
	cin >> s[i];
	sum += s[i];
    }
    avg = sum / n;
    for(int i=0; i<n; i++) ans += pow(s[i]-avg,2);

    ans = sqrt(ans/n);
    cout << ans << endl;
  }
  return 0; 
}


Measured memory_bytes: 3240
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
inline ll read()
{
	ll x=0,w=0;char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
int m,d;
int main()
{
    m=read();d=read();reg int i,j,gs=0;
    for(i=1;i<=m;++i)
        for(j=22;j<=d;++j)
            if(j%10>=2&&j/10>=2&&(j%10)*(j/10)==i)gs++;
    cout<<gs<<"\n";
	return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>inline bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int a, b, c;
    cin >> a >> b >> c;

    if (a > b) swap(a, b);
    if (b > c) swap(b, c);
    if (a > b) swap(a, b);

    int res = 0;
    res += c - b;
    a += res, b += res;
    if ((b-a) % 2 == 0) res += (b-a) / 2;
    else res += (b-a) / 2 + 2;
    cout << res << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

long long dp[111][100100];
const long long INF=1LL<<60;
int h[100100][2];
int N;
long long W,weight[111],value[111];



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


rep(i,N){
cin >>weight[i] >> value[i];
}
rep(i,111)rep(j,100100){
dp[i][j]=INF;
}


dp[0][0]=0;

for(int i=0;i<N;i++){
for(int sum_w=0;sum_w<=100100;sum_w++){
if(sum_w-value[i]>=0){
dp[i+1][sum_w]=min(dp[i+1][sum_w],dp[i][sum_w-value[i]]+weight[i]);
}
dp[i+1][sum_w]=min(dp[i+1][sum_w],dp[i][sum_w]);
}
}

long long res=0;
rep(i,100100){
if(dp[N][i]<=W)res=i;
}

cout << res;


return 0;
}

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

int main(){
  int i, j, H, W;
  string s;
  bool flag = false;
  cin >> H >> W;
  for(int k=1; k<=H; k++){
    for(int l=0; l<W; l++){
      cin >> s;
      if(s=="snuke"){
        i=k;
        j=l;
      }
    }
  }
  cout << (char)('A'+j) << i << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <stack>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <math.h>
#include <list>
using namespace std;

int main()
{
  int i,N; cin >> N;
  string s; cin >> s;
  
  int west = 0 , east = 0;
  int toward;
  for(i = 0; i < N; i++){
    if(s.at(i) == 'W') west++;
    if(s.at(i) == 'E') east++;
  }
  toward = west;
  
  int toward_max = 0;
  for(i = 0; i < N; i++){
    if(i == 0){ 
      if(s.at(0) == 'W') toward--; 
    }
    if( i != 0){
      if(s.at(i) == 'W') toward--;
      if(s.at(i-1) == 'E') toward++; 
    }
    toward_max = max(toward_max , toward);
  }
  
  int ans = N - toward_max - 1;
  if(ans < 0) ans = 0;
  cout << ans << endl;
}

Measured memory_bytes: 900
sub f{my($u,$t,$p)=@_;push@$t,$u;$_-$p&&f($_,$t^R,$u)for@$u}@a=$,=$";$#a=<>;map{push@$_,$u-$_+$;for($u,$;)=split}<>;f 1,b;$c=@b>@0?b:0;map{$s=--$x;$s+3>$.or$a[$_]||=$s+=3for@$_}@b>$./3&@0>$./3?(0,b):($c,$c);print map$_||3*++$z,@a

Measured memory_bytes: 269824
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    def search(a,n,key):
        a[n] = key
        i = 0
        while a[i] != key:
            i += 1
        return i != n


    n = int(input())
    a = input().split()
    a.append(None)
    q = int(input())
    t = input().split()

    sum_ = 0
    for key in t:
        if search(a, n, key):
            sum_ += 1
    print(sum_)



Measured memory_bytes: 6248
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

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

const ll LINF = 1001002003004005006LL;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int n, m; cin >> n >> m;
    vector<ll> h(n);
    rep(i,n) cin >> h[i];
    set<int> st;
    rep(i,n) st.insert(i);
    rep(i,m) {
        int a, b; cin >> a >> b;
        --a, --b;
        if (h[a] < h[b]) {
            st.erase(a);
        }
        else if (h[a] > h[b]) {
            st.erase(b);
        }
        else if (h[a]==h[b]) {
            st.erase(a);
            st.erase(b);
        }
    }
    cout << st.size() << endl;
    return 0;
}

















Measured memory_bytes: 8804
N, X, Y = map(int, input().split())

print(N)

X -= 1
Y -= 1

def disdance(i, j):
    if i <= X and j >= Y:
        return X - i + j - Y + 1
    elif i >= X and j <= Y:
        return min(j - i, i - X + Y - j + 1)
    elif i >= X and j >= Y:
        return min(j - i, i - X + j - Y + 1)
    elif i <= X and j <= Y:
        return min(j - i, X - i + Y - j + 1)

d = [0] * N

for i in range(N - 1):
    for j in range(i + 1, N):
        d[disdance(i, j)] += 1

for k in range(2, N):
    print(d[k])

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

int main() {
  int N, Q;
  cin >> N >> Q;
  
  fenwick_tree<long long> bit(N);
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    bit.add(i, a);
  }
  
  while (Q--) {
    int t;
    cin >> t;
    
    if (t) {
      int l, r;
      cin >> l >> r;
      cout << bit.sum(l, r) << endl;
    } else {
      int p, x;
      cin >> p >> x;
      bit.add(p, x);
    }
  }
  
  return 0;
}

Measured memory_bytes: 8220
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<long long>;

	class InputData {
	public:
		void getInput(void);
		void skipInput(void);
		Str getStr(void);
		Num getNum(void);
		BigNum getBigNum(void);
	private:
		Str str;
		Num num;
		BigNum bNum;
	};
	Str AtCoder::InputData::getStr(void) {
		return this->str;
	}
	Num AtCoder::InputData::getNum(void) {
		return this->num;
	}
	BigNum AtCoder::InputData::getBigNum(void) {
		return this->bNum;
	}
	void AtCoder::InputData::skipInput(void) {
		std::string buf = "";
		std::getline(std::cin, buf);
	}
	void AtCoder::InputData::getInput(void) {
		this->str.clear();
		this->num.clear();
		this->bNum.clear();

		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				this->str.push_back(row);
				this->num.push_back(std::atoi(row.c_str()));
				this->bNum.push_back(std::atoll(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		this->str.push_back(row);
		this->num.push_back(std::atoi(row.c_str()));
		this->bNum.push_back(std::atoll(row.c_str()));
	}

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(long long);
		void decrement(void);
		void decrement(long long);
		long long getResult(void);
	private:
		long long result;
	};
	void Ans::showResult(void) {
		printf("%lld\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(long long value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(long long value) {
		this->result -= value;
	}
	long long AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {

	AtCoder::InputData* data = new AtCoder::InputData();
	data->getInput();

	AtCoder::Num num = data->getNum();
	const int x = num[0];

	if (x < 30) {
		printf("No\n");
	} else {
		printf("Yes\n");
	}

	delete(data);

	return 0;
}


Measured memory_bytes: 3136
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N = getN()

num = [0] * (10 ** 4 + 10)

for x in range(1, 103):
    for y in range(1, 103):
        for z in range(1, 103):
            opt = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x)
            if opt < 10 ** 4 + 9:
                num[opt] += 1

for i in range(N):
    print(num[i + 1])

Measured memory_bytes: 78820
// 2012/07/09 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int t;
		cin >> t;

		if(t==0)
			break;

		int sum = 0;

		int n;
		cin >> n;

		for(int i=0; i<n; i++){
			int s, f;
			cin >> s >> f;

			sum += (f-s);
		}

		if(sum>=t){
			cout << "OK" << endl;
		}
		else{
			cout << t-sum << endl;
		}
	}

	return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin.sync();

    string w;
    getline(cin,w);
    int len = w.length();
    int arr[100]={0};
    
    for(int i=0; i<len; i++)
    {
        for(int j=0; j<len; j++)
        {
            if(w[i]==w[j])
            {
                arr[i]++;
            }
        }
    }
    int a=0;
    for(int i=0;i<len; i++)
    {
        if(arr[i]%2 != 0)
        {
            cout<<"No";
            a++;
            break;
        }
    }
    if(a==0)
    {
        cout<<"Yes";
    }


    return 0;
}

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

void insertionSort(int* A, int N) {
	for (int i = 1; i < N; i++) {
		int v = A[i];
		int j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		for (int i = 0; i < N-1; i++) {
			cout << A[i] << " ";
		}
		cout << A[N - 1] << endl;
	}
}


int main() {
	int length, elem[1000];
	cin >> length;
	for (int i = 0; i < length; i++) {
		cin >> elem[i];
	}
	for (int i = 0; i < length -1; i++) {
		cout << elem[i] << " ";
	}
	cout << elem[length - 1] << endl;

	insertionSort(elem, length);


}


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

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
	int sum = 0;
	while (n > 0) { // n が 0 になるまで
	sum += n % 10;
	n /= 10;
}
return sum;
}

int main() {
	int n;
	cin>>n;
	int sum = findSumOfDigits(n); // i の各桁の和
	if(n%sum==0){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}


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

int main()
{
    string s;
    cin >> s;
    string ans = "Yes";
    rep(i, s.length())
    {
        if (i % 2 == 0 && s[i] == 'L')
            ans = "No";
        else if (i % 2 == 1 && s[i] == 'R')
            ans = "No";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n"
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define f first
#define s second
typedef long long int ll;
const int INF = 1e9;

using namespace std;

int main()
{
    FASTIO
    int n;
  	cin>>n;
  	set<string> myset;
  	string ss;
  	for(int i=0; i<n; i++)
    {
      cin>>ss;
      myset.insert(ss);
    }
  	cout<<myset.size();
    return 0;
}

Measured memory_bytes: 19244
#include <iostream>
#include <algorithm>

using namespace std;

int money[20];

int pow(int x, int n) {
	int res = 1;
	for (int i = 0; i < n; i++) {
		res *= x;
	}
	return res;
}

int f(int n, int x) {
	int res = 0;
	int i = 0;
	while (pow(x, i) <= 100000) {
		i++;
	}
	while (i >= 0 || n > 0) {
		res += n / pow(x, i);
		n %= pow(x, i);
		i--;
	}
	return res;
}

int main() {
	int N;
	cin >> N;
	int sum = 1 << 30;
	for (int i = 0; i <= N; i++) {
		sum = min(sum, f(i, 6) + f(N - i, 9));
	}
	cout << sum << endl;
	
	//system("pause");
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}
	void run(){
		Scanner sc=new Scanner(System.in);
		while(true){
			char ch[]=sc.next().toCharArray();
			String type=sc.next();
			if(type.equals("X")) break;
			int now=typeCheck(ch);
			if(type.equals("U")){
				System.out.println(Uchange(ch, now));
			}
			else if(type.equals("L")){
				System.out.println(Lchange(ch, now));
			}
			else if(type.equals("D")){
				System.out.println(Dchange(ch, now));
			}
		}
	}
	int typeCheck(char ch[]){
		for(int i=0; i<ch.length; i++){
			if(ch[i]=='_'){
				return 2;
			}
		}
		if(Character.isUpperCase(ch[0])){
			return 0;
		}
		else return 1;
	}
	String Uchange(char ch[],int now){
		if(now==0){//テ・ツ?・テ・ツ環崚」ツ?袈
			//テ」ツ?敕」ツ?ョテ」ツ?セテ」ツ?セテ」ツ?ァOK
			return String.valueOf(ch);
		}
		else if(now==1){//テ・ツ?・テ・ツ環崚」ツ?鍬
			ch[0]=Character.toUpperCase(ch[0]);	
			return String.valueOf(ch);
		}
		else if(now==2){//テ・ツ?・テ・ツ環崚」ツ?轡
			String str="";
			ch[0]=Character.toUpperCase(ch[0]);
			str+=String.valueOf(ch[0]);
			for(int i=1; i<ch.length; i++){
				if(ch[i]=='_'){
					i++;
					ch[i]=Character.toUpperCase(ch[i]);
					str+=String.valueOf(ch[i]);
				}
				else{
					str+=String.valueOf(ch[i]);
				}
			}
			return str;
		}
		return "NG";
	}
	String Lchange(char ch[],int now){
		if(now==0){//テ・ツ?・テ・ツ環崚」ツ?袈
			ch[0]=Character.toLowerCase(ch[0]);	
			return String.valueOf(ch);
		}
		else if(now==1){//テ・ツ?・テ・ツ環崚」ツ?鍬
			//テ」ツ?敕」ツ?ョテ」ツ?セテ」ツ?セテ」ツ?ァOK
			return String.valueOf(ch);
		}
		else if(now==2){//テ・ツ?・テ・ツ環崚」ツ?轡
			String str="";
			for(int i=0; i<ch.length; i++){
				if(ch[i]=='_'){
					i++;
					ch[i]=Character.toUpperCase(ch[i]);
					str+=String.valueOf(ch[i]);
				}
				else{
					str+=String.valueOf(ch[i]);
				}
			}
			return str;
		}
		return "NG";
	}
	String Dchange(char ch[],int now){
		if(now==0){//テ・ツ?・テ・ツ環崚」ツ?袈
			ch[0]=Character.toLowerCase(ch[0]);	
			String str="";
			str+=ch[0];
			for(int i=1; i<ch.length; i++){
				if(Character.isUpperCase(ch[i])){
					str+="_";
					str+=String.valueOf(Character.toLowerCase(ch[i]));
				}
				else{
					str+=String.valueOf(ch[i]);
				}
			}
			return str;
		}
		else if(now==1){//テ・ツ?・テ・ツ環崚」ツ?鍬
			String str="";
			for(int i=0; i<ch.length; i++){
				if(Character.isUpperCase(ch[i])){
					str+="_";
					str+=String.valueOf(Character.toLowerCase(ch[i]));
				}
				else{
					str+=String.valueOf(ch[i]);
				}
			}
			return str;
		}
		else if(now==2){//テ・ツ?・テ・ツ環崚」ツ?轡
			//テ」ツ?敕」ツ?ョテ」ツ?セテ」ツ?セテ」ツ?ァOK
			return String.valueOf(ch);
		}
		return "NG";
	}
}

Measured memory_bytes: 17288
#include <stdio.h>
  
int main(void)
{
    int m, f, r, sum;
  
    while(1)
    {
        scanf("%d%d%d", &m, &f, &r);
         
        sum = m+f;
         
        if(m==-1 && f==-1 && r==-1)
        {
            break;
        }
         
        if(m==-1 || f==-1)
        {
            printf("F\n");
        }
         
        else if(sum  >= 80)
        {
            printf("A\n");
        }
         
        else if(sum >= 65)
        {
            printf("B\n");
        }
         
        else if(sum >= 50)
        {
            printf("C\n");
        }
         
        else if(sum >= 30)
        {
            if(r >= 50)
            {
                printf("C\n");
            }
             
            else
            {
                printf("D\n");
            }
        }
         
        else
        {   
            printf("F\n");
        }
    }
     
    return 0;
}

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

int main() {
	//input
	string T;
	cin >> T;

	//calculation
	for (int i = 0; i < T.size(); i++) {
		if (T[i] == '?')
		{
			T[i] = 'D';
		}
	}

	//output
	cout << T << endl;


	return 0;
}


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

using namespace std;

typedef long long ll;

int b[200005], n;
ll dosad[200005], dp[200005], sol;
bool bio[200005];
vector <int> a;
const ll mod = (ll)1e9 + 7;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 0 ; i < n ; ++i){
	cin >> b[i];
}
for(int i = 1 ; i < n ; ++i){
	if(b[i] != b[i - 1]){
		a.push_back(b[i - 1]);
	}
}
a.push_back(b[n - 1]);
n = (int)a.size();
dosad[a[0]] = 1;
for(int i = 0 ; i < n ; ++i){
	if(bio[a[i]]){
		sol = (sol + dosad[a[i]]) % mod;
	}
	else{
		bio[a[i]] = 1;
	}
	if(i){
		dosad[a[i]] = (dosad[a[i]] + dosad[a[i - 1]]) % mod;
	}
}
sol = (sol + 1) % mod;
cout << sol << endl;

return 0;
}



Measured memory_bytes: 3700
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(unreachable_code)]

use proconio::marker::{Bytes, Chars};
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        mut S: Chars,
    }

    let mut first = String::new();
    first.push(S[0]);
    first.push(S[1]);

    let mut second = String::new();
    second.push(S[2]);
    second.push(S[3]);

    let first: isize = first.parse().unwrap();
    let second: isize = second.parse().unwrap();

    let ans = match (first, second) {
        (1...12, 1...12) => "AMBIGUOUS",
        (1...12, _) => "MMYY",
        (_, 1...12) => "YYMM",
        _ => "NA",
    };

    println!("{}", ans);
}


Measured memory_bytes: 2144
n=4
li=[int(input()) for i in range(n)]
a=li[0]
b=li[1]
c=li[2]
x=li[3]

count=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k==x:
                count+=1
print(count)

Measured memory_bytes: 3064
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

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

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007    //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

// debug
#define DEBUG(x) cout << #x << ": " << x << endl
#define DEBUG2(x, y) cout << #x << ": " << x << " " << #y << ": " << y << endl
#define DEBUG_VEC(v)   \
  cout << #v << ":";   \
  REP(i, v.size())     \
  cout << " " << v[i]; \
  cout << endl
#define DEBUG_ARR(v, n) \
  cout << #v << ":";    \
  REP(i, n)             \
  cout << " " << v[i];  \
  cout << endl

signed main()
{
  string S, T;
  cin >> S;
  cin >> T;

  if (T.substr(0, T.size() - 1) == S)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
// Because I am lazy
// Template Start
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define all(x) (x).begin(),(x).end()
#define alli(a, n, k) (a+k),(a+n+k)
#define REP(i, a, b, k) for(__typeof(a) i = a;i < b;i += k)
#define REPI(i, a, b, k) for(__typeof(a) i = a;i > b;i -= k)
#define REPITER(it, a) for(__typeof(a.begin()) it = a.begin();it != a.end(); ++it)

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds

#define eps 1e-6
#define pi 3.141592653589793

using namespace std;

template<class T> inline T gcd(T a, T b) { while(b) b ^= a ^= b ^= a %= b; return a; }
template<class T> inline T mod(T x) { if(x < 0) return -x; else return x; }

typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII > PPII;
typedef vector< PII > VPII;
typedef vector< PPII > VPPI;

const int MOD = 1e9 + 7;
const int INF = 1e9;
// Template End
const int MAX = 55;
PII a[MAX], b[MAX];

int main(int argc, char* argv[])
{
    if(argc == 2 or argc == 3) freopen(argv[1], "r", stdin);
    if(argc == 3) freopen(argv[2], "w", stdout);
    int n, m, mi, x, ans;
    cin >> n >> m;
    REP(i, 0, n, 1)
        cin >> a[i].fi >> a[i].se;
    REP(i, 0, m, 1)
        cin >> b[i].fi >> b[i].se;
    REP(i, 0, n, 1)
    {
        mi = INF;
        REP(j, 0, m, 1)
        {
            x = mod(a[i].fi - b[j].fi) + mod(a[i].se - b[j].se);
            if(x < mi) mi = x, ans = j;
        }
        cout << ans+1 << endl;
    }

    return 0;

}


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

a=[2]
b=[2]
for i in range(3,10000000):
    t=0
    while t<len(a):
        if i%a[t]==0:
            break
        else:t+=1
    else:
        a.append(i)
        if i%5==2:
            b.append(i)

    if len(b)==55:
        break

b.sort()
print(" ".join(list(map(str, b[:n]))))

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <stdlib.h>
using namespace std;

int N,M;
int Map[55][55],a[55],b[55];
int visit[55];

int main(){

    cin>>N>>M;
    for(int i = 1;i<=M;i++){
        cin>>a[i]>>b[i];
        visit[a[i]]++;
        visit[b[i]]++;
        Map[a[i]][b[i]] = Map[b[i]][a[i]] = 1;
    }
    int sum = 0;
    int xi;
    bool falg = true;
    while(1){
        falg = true;
        for(int i = 1;i<=N;i++){
            if(visit[i]==1){
                    sum++;
                xi = i;
                falg = false;
                visit[i]--;
                break;
            }
        }
        if(falg) break;
        for(int i = 1;i<=N;i++){
            if(Map[xi][i]==1)
                visit[i]--;
        }
    }
   

    cout<<sum<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 2e6+100;
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h1,h2,m1,m2;
	cin>>h1>>m1;
	cin>>h2>>m2;
	int cnt,ans;
	cin>>cnt;
	ans=h2*60+m2-h1*60-m1-cnt;
	if(ans<0)
	ans=0;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		int A = sc.nextInt();
		int B = sc.nextInt();

		String U = sc.next();

		if(U.equals(S)){
			A -= 1;
		}
		else{
			B -= 1;
		}

		System.out.println(A + " " + B);
	}
}

Measured memory_bytes: 21844
n = int(input())
a = input()
b = []
b.append(0)
sum1 = 0
for i in range(n):
    if a[i] == 'I':
        sum1+=1
        b.append(sum1)
    elif a[i] == 'D':
        sum1-=1
        b.append(sum1)
print(max(b))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define int long long
#define st first
#define nd second
#define rd third
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define RE(i, n) FOR(i, 1, n)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, n) for(int i = 0;i <(n); ++i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
template<typename TH> void _dbg(const char* sdbg, TH h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t) {
  while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
#define next ____next
#define prev ____prev
#define left ____left
#define hash ____hash
typedef long long ll;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<pair<int, int> > VPII;
typedef vector<pair<ll, ll> > VPLL;

template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
template<class T1, class T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class A, class B, class C> struct Triple { A first; B second; C third;
  bool operator<(const Triple& t) const { if (st != t.st) return st < t.st; if (nd != t.nd) return nd < t.nd; return rd < t.rd; } };
template<class T> void ResizeVec(T&, vector<int>) {}
template<class T> void ResizeVec(vector<T>& vec, vector<int> sz) {
  vec.resize(sz[0]); sz.erase(sz.begin()); if (sz.empty()) { return; }
  for (T& v : vec) { ResizeVec(v, sz); }
}
typedef Triple<int, int, int> TIII;
template<class A, class B, class C>
ostream& operator<< (ostream &out, Triple<A, B, C> t) { return out << "(" << t.st << ", " << t.nd << ", " << t.rd << ")"; }
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }

const int N = 1e6 + 5;
int a[N];
VI won_with[N];
int GetDepth(int v) {
  VI deps;
  if (won_with[v].empty()) {
    return 0;
  }
  for (auto guy : won_with[v]) {
    deps.PB(GetDepth(guy));
  }
  sort(ALL(deps), greater<int>());
  int res = 0;
  for (int i = 0; i < SZ(deps); i++) {
    maxi(res, deps[i] + i + 1);
  }
  return res;
}
    
int32_t main() {

  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cerr << fixed << setprecision(10);
  cin.tie(0);
  //double beg_clock = 1.0 * clock() / CLOCKS_PER_SEC;
  
  int n;
  cin>>n;
  FOR (i, 2, n) {
    cin>>a[i];
    won_with[a[i]].PB(i);
  }
  cout<<GetDepth(1)<<endl;
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  return 0;
}


Measured memory_bytes: 35456
#include<bits/stdc++.h>
#define int long long

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n, w, c, v, dp[100001], ans = 0, sum = 0;
    fill(dp, dp + 100001, 2147483647);
    dp[0] = 0;
    cin >> n >> w;
    for (int i = 0; i < n; i++)
    {
        cin >> c >> v;
        sum += v;
        for (int j = sum; j >= v; j--)
            dp[j] = min(dp[j], dp[j - v] + c);
    }
    while (dp[sum--] > w);
    cout << sum + 1 << '\n';
    
    return 0;
}

Measured memory_bytes: 1024
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;
 
#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 
const ll mod = (ll)(998244353);
ll mulmod(ll a, ll b) {
   return (a%mod * b%mod)%mod;
}
 
ll fast_exp(ll base, ll exp) {
    ll res=1;
    while(exp>0) {
       if(exp%2==1) res = mulmod(res, base);
       base= mulmod(base, base);
       exp/=2;
    }
    return res%mod;
}
 
int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n;
  cin >> n;
  vll a(n);
  for(ll i = 0; i < n; i++) cin >> a[i];
  if(a[0] != 0) {
   cout<< 0 ;
   return 0;
}
  sort(all(a));
  ll ans = 1;
  ll mx = a[n-1];
  map<ll, ll> key;
  for(auto it: a) key[it]++;
  if(key[0] > 1) {
    cout << 0;
    return 0;
  }
  for(ll i = 1; i <= mx; i++) {
    ans = mulmod(ans, fast_exp(key[i-1], key[i]));
  }
  cout << ans%mod;
  return 0;
} //good night.


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
using namespace std;
using v = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}

int main(int argc, char *argv[]){
    int a, b, c; cin >> a >> b >> c;
    int res;
    if(a != b and b!= c and c != a) res = 3;
    else if(a == b and b == c and c == a) res = 1;
    else if(a == b or a == c or b == c) res = 2;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
//setprecision(12)
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
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; }
typedef long long ll;
#define pint pair<int,int>
#define pll pair<ll,ll>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    char a; cin >> a;
    if(a>='a' && a<='z') cout << 'a' << endl;
    else cout << 'A' << endl;

    return 0;
}

Measured memory_bytes: 3648
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <unordered_map>
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
using namespace std;
using LL = long long;

int main() {
	LL h, w;
	cin >> h >> w;
	LL ans = h*w;
	for (int k = 0; k<2; k++) {
		for (int i = 1; i<h; i++) {
			LL s1 = i*w;
			LL s2 = (h - i)*(w / 2);
			LL s3 = h*w - s1 - s2;
			LL tmp = max(max(s1, s2), s3) - min(min(s1, s2), s3);
			ans = min(ans, tmp);
		}
		swap(h, w);
	}
	ans = min(ans, h);
	ans = min(ans, w);
	if (h % 3 == 0 || w % 3 == 0) ans = 0;
	cout << ans << endl;
}

Measured memory_bytes: 256
// This is my template for fast solving

#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <utility>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <memory>
#include <initializer_list>
#include <iomanip>
#include <stack>
#include <bitset>
#include <cstdio>
// #include <complex>
// #include <random>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ld = long double;
// const ll INF = 1e18;
// const ld INF = 1e20;
// const ll MOD = 1e9 + 7;
// const ld EPS = 1e-10;
// const ld PI = acos(-1);

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    for (size_t i = 0; i < v.size(); ++i) {
        os << v[i];
        if (i + 1 != v.size()) {
            os << " ";
        }
    }
    return os;
}

// struct Node {

//     Node (int k, int v): l(nullptr), r(nullptr), key(k), value(v), size(1) {}

//     Node* l;
//     Node* r;
//     int key;
//     int value;
//     size_t size;
// };

// Node* insert(Node* p, Node* x) {
//     if (p == nullptr) {
//         return x;
//     }
//     if (p->key > x->key) {
//         p->l = insert(p->l, x);
//     } else {
//         p->r = insert(p->r, x);
//     }
//     p->size += 1;
//     return p;
// }

// size_t size(Node* p) {
//     if (p == nullptr) {
//         return 0;
//     }
//     return p->size;
// }

// Node* find(Node* p, int k) {
//     if (size(p->l) >= k) {
//         return find(p->l, k);
//     }
//     if (size(p->l) + 1 == k) {
//         return p;
//     }
//     return find(p->r, k - size(p->l) - 1);
// }


void solve() {
    string s;
    int n;
    cin >> n >> s;
    for (char& c : s) {
        int k = (c - 'A' + n) % 26 + 'A';
        c = char(k);
    }
    cout << s << "\n";
}

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

    // int q;
    // cin >> q;
    // while (q--) {
    //     solve();
    // }

    solve();

    // Node* root = nullptr;

    // root = insert(root, new Node(1, 1));
    // root = insert(root, new Node(2, 2));
    // root = insert(root, new Node(3, 3));
    // root = insert(root, new Node(4, 4));

    // auto res = find(root, 4);

    // cout << res->key << " " << res->value << "\n";

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(sys.stdin.readline() for _ in range(n)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
INF = float("inf")
import sys,collections

N,M,X = map(int,sys.stdin.readline().split())

C = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param

ALL = [0]*(M+1)
for a in C:
    for i in range(M+1):
        ALL[i] += a[i]
#print(ALL,X)
if any(e < X for e in ALL[1:]):
    print(-1)
    exit()

m = INF
def backtrack(n,c):
    #print(n,c)
    if n == N:
        if all(a >= X for a in c[1:]):
            #print("OK",n,c,X)
            global m
            m = min(m,c[0])
        return
    backtrack(n+1,c)#not select
    backtrack(n+1,[a+b for a,b in zip(c,C[n])])#select

backtrack(0,[0]*(M+1))
print(m)

Measured memory_bytes: 72888
#include<bits/stdc++.h>
using namespace std;
main(){
  int n;
  long re,ro,se,so;
  re=ro=se=so=0;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++){
    se+=a[i],so+=a[i];
    if(i%2){
      if(se<0 && so>0)continue;
      else{
        if(se>=0)re+=1+se,se-=1+se;
        if(so<=0)ro+=1-so,so+=1-so;
      }
    }else{
      if(se>0 && so<0)continue;
      else{
        if(se<=0)re+=1-se,se+=1-se;
        if(so>=0)ro+=1+so,so-=1+so;
      }
    }
  }
  cout<<min(re,ro)<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define R register

const int MN = 100;

int L;

int m;

int x[MN], y[MN], vl[MN];

int main() {
	std::ios::sync_with_stdio(false);

	std::cin >> L;
	for (R int i = 2; i < 20; ++i)
		x[++m] = i, y[m] = i + 1, vl[m] = 0,
		x[++m] = i, y[m] = i + 1, vl[m] = 1 << 19 - i;

	for (R int i = 0, s = 0; (1 << i) <= L; ++i)
		if ((L >> i) & 1) {
			s += 1 << i;
			if (i == 19) {
				x[++m] = 1, y[m] = 2, vl[m] = 0;
				x[++m] = 1, y[m] = 2, vl[m] = 1 << 18;
				continue;
			}
			x[++m] = 1, y[m] = 20 - i, vl[m] = L - s;
		}
	
	std::cout << 20 << " " << m << std::endl;
	for (R int i = 1; i <= m; ++i) 
		std::cout << x[i] << " " << y[i] << " " << vl[i] << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define FOR(i, s, n) for(int i=(int)(s); i<(int)(n); ++i)
#define ALL(n) (n).begin(), (n).end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;

const ll MAX_V = 100000;
const ll INF = 1e9;
const ll MOD = 998244353;

int main(){
    int n, k; cin >> n >> k;
    int d[k];
    REP(i, k) cin >> d[i];
    int i = 0;
    while(true){
        bool ng = false;
        int p = n + i;
        while(p > 0){
            REP(j, k){
                if (p % 10 == d[j]) ng = true;
            }
            if (ng) break;
            p /= 10;
        }
        if (!ng) break;
        i++;
    }
    cout << (n+i) << endl;
}

Measured memory_bytes: 256
require 'pp'

a, v = gets.split.map(&:to_i)
b, w = gets.split.map(&:to_i)
t = gets.to_i

diff = (a - b).abs
diff2 = (w - v).abs

if v < w
    puts "NO"
    exit 0
end

if diff2 * t >= diff
    puts "YES"
else
    puts "NO"
end


Measured memory_bytes: 14540
import sys
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit('(i4[::1],)', cache=True)
def solve(A):
    count = np.zeros(10**6 + 10, np.int32)
    for x in A:
        if count[x] > 1:
            continue
        count[::x] += 1
    ret = 0
    for x in A:
        ret += count[x] == 1
    return ret

A = np.array(read().split(), np.int32)[1:]

print(solve(A))

Measured memory_bytes: 120156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    ll n; cin >> n;
    ll sum = 0, i = 0;
    while (sum < n)sum += ++i;
    erFOR(j, 1, i)if (n - j >= 0) {
        n -= j;
        cout << j << "\n";
    }
}

Measured memory_bytes: 256
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let n: usize = sc.read();
    let mut pairs = vec![];
    if n % 2 == 0 {
        for i in 0..(n / 2) {
            pairs.push(vec![i + 1, n - i]);
        }
    } else {
        for i in 0..(n / 2 + 1) {
            pairs.push(vec![i, n - i]);
        }
    }

    let m = pairs.len();
    let mut edges = vec![];
    for i in 0..m {
        for j in 0..i {
            for &from in pairs[i].iter() {
                for &to in pairs[j].iter() {
                    if from == 0 || to == 0 {
                        continue;
                    }
                    edges.push((from, to));
                }
            }
        }
    }

    println!("{}", edges.len());
    for (a, b) in edges.into_iter() {
        println!("{} {}", a, b);
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352