akhauriyash/Code-Regression huggingface dataset:
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let H: Vec<usize> = sc.vec(N);
    let mut prev = 0;
    let mut cand = 0;
    let mut ans = 0;
    for i in 0..N {
        if prev >= H[i] {
            cand += 1;
        } else {
            ans = max(ans, cand);
            cand = 0;
        }
        prev = H[i];
    }
    ans = max(ans, cand);
    println!("{}", ans);
}


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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;
const int mod=1000000007;
template<class T,class U>
void add(T& a,U b){
	a=((ll)a+b)%mod;
}

template<class T,class U>
void sub(T& a,U b){
	a=((ll)a-b%mod+mod)%mod;
}

template<class T,class U>
void mult(T& a,U b){
	a=((ll)a*b)%mod;
}

ll modPow(ll a,ll p){
	ll s=1;
	REP(i,30){
		if((p>>i)&1)
			mult(s,a);
		mult(a,a);
	}
	return s;
}

ll modInv(ll a){
	return modPow(a,mod-2);
}
const int Vmax=5140;
signed main(){
	vi dp(Vmax,0);
	int n=read(),k=read();
	dp[0]=1;
	vi a;
	REP(i,n)a.PB(read());
	for(auto v:a)for(int i=Vmax-1;i-v>=0;i--)add(dp[i],dp[i-v]);
	int ans=0;
	for(auto v:a){
		for(int i=0;i+v<Vmax;i++)sub(dp[i+v],dp[i]);
		bool ex=false;
		FOR(i,max(k-v,0LL),k)ex|=(dp[i]!=0);
		ans+=ex;
		for(int i=Vmax-1;i-v>=0;i--)add(dp[i],dp[i-v]);
	}
	cout<<n-ans<<endl;
}


Measured memory_bytes: 384
N, A, B = input().split()
A = int(A)
B = int(B)
s = input()

accepted = 0
B_checked = 0

for i in range(len(s)):
    if s[i] == "c":
        print("No")
    elif s[i] == "a":
        accepted += 1
        print("Yes")
    else:
        B_checked += 1
        if (B_checked <= B):
            accepted += 1
            print("Yes")
        else:
            print("No")

    if (accepted >= (A + B)):
        for i in range(len(s) - i - 1):
            print("No")

        break

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

//#define int long long
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true) {
        int n;
        cin >> n;
        if (n == 0) break;
        int ans = 0;
        for (int w = 2; 2 * n - w * (w - 1) > 0; w++) {
            //w((w - 1 + s) + s) / 2 = n (s >= 1)
            //w(w - 1) + 2ws = 2n
            //s = (2n - w(w - 1)) / 2w
            if ((2 * n - w * (w - 1)) % (2 * w) == 0) ans++;
        }
        cout << ans << endl;
    }

}

Measured memory_bytes: 3152
A, B, C, X, Y = map(int, input().split())
Sum = A * X + B * Y

if A+B > 2*C:
  if X < Y:
    if 2*C <= B:
      Sum = C * 2 * Y
    else:
      Sum = C * 2 * X + B * (Y - X)
  elif Y < X:
    if 2*C <= A:
      Sum = C * 2 * X
    else:
      Sum = C * 2 * Y + A * (X - Y)
  else:
    Sum = C * 2 * X

print(Sum)

Measured memory_bytes: 3064
#include<algorithm>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<time.h>
#include<tuple>
#include<utility>
#include<vector>

using namespace std;
const long mod = 1000000007;
long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }


int main() {

	long N; cin >> N;
	long res = 0;
	vector<pair<long, long>> red(N); for (int i = 0; i < N; i++) cin >> red[i].first >> red[i].second;
	vector<pair<long, long>> blue(N); for (int i = 0; i < N; i++) cin >> blue[i].second >> blue[i].first;

	//xの厳しいものからyの厳しいものへ組んでいく

	sort(red.begin(), red.end());
	reverse(red.begin(), red.end());
	sort(blue.begin(), blue.end());

	for (int i = 0; i < N; i++) { long s = blue[i].second; blue[i].second = blue[i].first; blue[i].first = s; }

	for (auto& r : red) {
		for (auto& b : blue) {
			if (r.first < b.first && r.second < b.second) {
				res++;
				//疑似的に取り除いたことになっている。
				r.first = INT_MAX;
				r.second = INT_MAX;
				b.first = INT_MIN;
				b.second = INT_MIN;
			}
		}
	}

	cout << res << endl;

}

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

#define mp make_pair
#define pb push_back
#define p push

#define FOR(a, c) for(int a = 0;a<c;a++)
#define ll long long int

#define getI(a) scanf("%d",&a)
#define getII(a, b) scanf("%d%d",&a,&b)
#define getIII(a, b, c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a, b) scanf("%lld%lld",&a,&b)
#define getLLL(a, b, c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a, b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a, b) printf("%lld%lld",a,b);
#define pfd(a) printf("%lf",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);

#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define SIZE  ( int)(1e9 + 7)
#define MAXN (ll) (1e5+5)

using namespace std;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector <vector<int>> vvi;
typedef vector<long long> vl;
typedef vector <pair<int, int>> vpi;
typedef vector <pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector <vi> graph;

int k = 5;

int main (){
    IOS
    ll n;
    cin >>n;
    string s,s2;
    cin>>s;
    cin>>s2;
    for (int i = 0; i <n ; ++i) {
        cout<<s[i]<<s2[i];
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{ int a,b,coin,i;
  scanf("%d %d",&a,&b);
 coin=0;
  for(i=0;i<2;i++)
  { if(a>=b)
   { coin+=a;
     a--;
   }else{coin+=b;b--;}   
  }
 printf("%d",coin);
}

Measured memory_bytes: 128
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val (n, a, b) = readLongList()
    val period = a + b
    val res = (n / period) * a + (n % period).coerceAtMost(a)
    println(res)
}

Measured memory_bytes: 36440
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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;}
#define DEBUG_VLL(vec) REP(i, vec.size()) cerr<<vec[i]<<(i==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, x; cin >> a >> b >> x;
    ll rem = a*a*b-x;
    if (rem <= a*a*b/2) {
        long double h = (long double)rem * 2 / (long double)(a*a);
        long double deg = atan2(h, a);
        cout << fixed << setprecision(12) << deg/M_PI * 180.0 << '\n';
    } else {
        long double h = (long double)x * 2 / (long double)(a*b);
        long double deg = atan2(b, h);
        cout << fixed << setprecision(12) << deg/M_PI * 180.0 << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c, d, e, f, g, h;
  cin >> a >> b >> c >> d >> e >> f >> g >>h;
  int A, B ,C ,D ,E ,F;
  C = a / 10;
  D = c / 10;
  E = b / 20;
  F = d / 20;
  
  A = a * e + b * f + C * g + E * h;
  B = c * e + d * f  + D * g + F * h;
  if(A > B) cout << "hiroshi" << endl;
  if(A == B) cout << "even" << endl;
  if(A < B) cout << "kenjiro" << endl;
  return 0;
}


Measured memory_bytes: 3088
#pragma GCC optimize("-Ofast","-funroll-all-loops")
#include<bits/stdc++.h>
//#define int long long
using namespace std;
const int N=1e5+10;
int n,col[N],dep[N],f[N],num[5];
vector<int> g[N],v;
inline void add(int a,int b){g[a].push_back(b),g[b].push_back(a);}
void dfs(int x,int fa){
	dep[x]=dep[fa]+1; f[x]=fa;
	for(int to:g[x])	if(to!=fa)	dfs(to,x); 
}
void upd(int x,int co){
	for(int to:g[x])	if(col[to]==-1)	col[to]=co,upd(to,co);
}
signed main(){
	cin>>n; memset(col,-1,sizeof col);
	for(int i=1,a,b;i<n;i++)	scanf("%d %d",&a,&b),add(a,b);
	dfs(1,0);
	int now=n,cnt=dep[now]/2;
	while(now){
		if(cnt>0)	col[now]=0,cnt--;
		else	col[now]=1; now=f[now];
	}
	for(int i=1;i<=n;i++)	if(col[i]!=-1)	upd(i,col[i]);
	for(int i=1;i<=n;i++)	num[col[i]]++;
	if(num[1]>num[0])	puts("Fennec");
	else	puts("Snuke");
	return 0;
}


Measured memory_bytes: 15056
#include <stdio.h>
#include <math.h>

double D(double a){
	a *= a;
	return a;
}

int main(void){
	int n, i;
	double score[1024], bun, ave, sum = 0, A,hensa;
	
	while(1){
		scanf("%d",&n);
		
		if(n == 0) break; //0???break
		
		for(i = 0,sum = 0; i < n; i++){
			scanf("%lf",&score[i]);
		sum += score[i];
		}
		ave = sum / n;
		
		for(i = 0,A = 0;i < n; i++){
		A += D(score[i] - ave); 
	}
	bun = A /n;
	hensa = sqrt(bun);
	printf("%f\n",hensa);
}
return 0;
}

Measured memory_bytes: 664
// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
 
#define mp make_pair
#define bp __builtin_popcountll
#define MOD  998244353
const int N = 10000;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));

void solve()
{
     ll n,m;
     cin >> n >> m;
     string s[n];
     for(ll i=0;i<n;i++)   cin >> s[i];
     ll a[n+1][m+1],dp[n+1][m+1];
     memset(dp,0,sizeof(dp));
     for(ll i=1;i<=n;i++)
     {
          for(ll j=1;j<=m;j++)   
          {
               if(s[i-1][j-1]=='.')    a[i][j] = 0;
               else                    a[i][j] = 1;
          }
     }
     dp[1][1] = a[1][1];
     for(ll i=2;i<=m;i++)  
     {
          dp[1][i] = dp[1][i-1];
          if(a[1][i] && !a[1][i-1])   dp[1][i]++;
     }
     for(ll i=2;i<=n;i++)   
     {
          dp[i][1] = dp[i-1][1];
          if(a[i][1] && !a[i-1][1])   dp[i][1]++;
     }
     for(ll i=2;i<=n;i++)
     {
          for(ll j=2;j<=m;j++)
          {
               ll temp1 = dp[i-1][j];
               if(a[i][j] && !a[i-1][j])   temp1++; 
               ll temp2 = dp[i][j-1];
               if(a[i][j] && !a[i][j-1])   temp2++;
               dp[i][j] = min(temp1,temp2);   
          }
     }
     cout<<dp[n][m];
}

int main()
{
     FAST;
     ll t = 1;
   //  cin >> t;
     while(t--)
     {
          solve();
     }
}              

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;int S = 0,c = 0,i;cin >> s;
  for(i=0;i<s.size();i++){
    if(s[i]=='S') S++;
    else if(s[i]=='T' && S>0){
      c++;S--;
    }
  }
  cout << s.size()-c*2 << "\n";
}

Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
int compare(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
int main() {
	int n, a, i, arr[101], s = 1, cnt = 0;
	scanf("%d", &n);

	for (i = 0; i < n; i++)scanf("%d", &arr[i]);
	qsort(arr, n, 4, compare);
	for (i = 0; i < n; i++) {
		cnt =cnt+ s*arr[i];
		s = -s;
	}
	printf("%d", cnt);
}



Measured memory_bytes: 128
N, K = map(int, input().split())
s = input()

X = [0]
if s[0] == "0":
    X.append(0)
for i in range(N):
    if i == N-1 or s[i] != s[i+1]:
        X.append(i+1)
if s[-1] == "0":
    X.append(X[-1])

if len(X) <= K*2+1:
    print(N)
else:
    ma = 0
    for i in range(0, len(X) - K*2 - 1, 2):
        ma = max(X[i+K*2+1]-X[i], ma)
    print(ma)

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

using namespace std;

int main(int argc, char const *argv[])
{
    int n, m; cin >> n >> m;
    vector<bool> z(m, true);

    int k, a;
    for(int i=0;i<n;++i) {
        cin >> k;
        vector<bool> y(m, false);
        for(int j=0;j<k;++j) {
            cin >> a; --a;
            y[a] = true;
        }
        for(int j=0;j<m;++j) {
            z[j] = z[j]&y[j];
        }
    }
    a=0;
    for(int i=0;i<m;++i) a+=(z[i]? 1: 0);
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#include <deque>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define BRK(x) { (x); break; }
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define FLOOR(x) ((int)floor(((double)x)))
#define CEIL(x) ((int)ceil(((double)x)))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mt make_tuple
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using namespace std;


int N;
int T[1010], A[1010];


int solve(){
	int t = T[0], a = A[0];
	rep(i, 1, N) t = max((t+T[i]-1)/T[i], ((a+A[i]-1)/A[i]))*T[i], a = max((t+T[i]-1)/T[i], ((a+A[i]-1)/A[i]))*A[i];
	return t+a;
}


signed main(){
	cin >> N;
	rep(i, 0, N) cin >> T[i] >> A[i];

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];

static const double pi = 3.141592653589793;
int main(){
    long long a;
    cin>>a;
    string s="";
    rep(i,20){
        a-=1;
        s+='a'+a%26;
        a/=26;
        if(a==0){
            break;
        }
    }
    reverse(s.begin(),s.end());
    cout<<s<<endl;
}



Measured memory_bytes: 3632
main = 
  let 
    func = do
      line <- getLine
      let 
        [h,w] = map read $ words line :: [Int]
        drawOddLine x 
          | x == (w+1)      = do
            putStrLn ""
          | (mod x 2) == 0  = do
            putStr "."
            drawOddLine (x+1)
          | (mod x 2) == 1  = do
            putStr "#"
            drawOddLine (x+1)
        drawEvenLine x 
          | x == (w+1)      = do
            putStrLn ""
          | (mod x 2) == 0  = do
            putStr "#"
            drawEvenLine (x+1)
          | (mod x 2) == 1  = do
            putStr "."
            drawEvenLine (x+1)
        drawBoard y
          | y == (h+1)      = do
            putStrLn ""
          | (mod y 2) == 0  = do
            drawEvenLine 1
            drawBoard (y+1)
          | (mod y 2) == 1  = do
            drawOddLine 1
            drawBoard (y+1)
        in 
          if h == 0 && w == 0
            then putStr ""
            else do
              drawBoard 1 
              func
    in func



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

int main(int argv, char *argc[]){
    int row, line, total=0, ttotal=0, x, y;
    int *table;
    
    scanf("%d %d\n", &row, &line);
    table = (int *)calloc(row*line, sizeof(int));
    
    for(x=0; row>x; x++){
        for(y=0; line>y; y++){
            scanf("%d", &table[(line*x)+y]);
        }
    }
    
    /*最終行以外のテーブル表示*/
    for(x=0; row>x; x++, total=0){
        for(y=0; line>y; y++){
            printf("%d ", table[(line*x)+y]);
            
            total += table[(line*x)+y];
            if(line-1 == y){
                printf("%d\n", total);
                ttotal += total;
            }
        }
    }
    
    
    /*最終行のテーブル表示*/
    for(x=0; line>x; x++, total=0){
        for(y=0; row>y; y++){
            total += table[(line*y)+x];
        }
        printf("%d ", total);
    }
    
    printf("%d\n", ttotal);
    
    free(table);
    return 0;
}

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

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

	set<string> visited;

	char last = '*';

	bool good = true;
	for (int i = 0; i < N; i++) {

		string s;
		cin >> s;

		if (visited.count(s) > 0)
		{
			good = false;
		}
		visited.insert(s);

		if (last == '*' || last == s[0])
		{
			last = s[s.length()-1];
		}
		else
		{
			good = false;
		}
	}

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

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

int main()
{
  	int x, y;
  	cin>>x>>y;
  	char a[x+2][y+2];
  	for(int i = 0; i < x+2; i++)
    {
    	for(int j = 0; j < y+2; j++)
        {
        	if(i == 0)
              	a[i][j] = '#';
          	else if(j == 0)
              	a[i][j] = '#';
          	else if(i == x+1)
              	a[i][j] = '#';
          	else if(j == y+1)
              	a[i][j] = '#';
          	else
              	cin>>a[i][j];
            cout<<a[i][j];
        }
        cout<<"\n";
    }
	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String sl[] = s.split(" ");
            int A = Integer.parseInt(sl[0]);
            int B = Integer.parseInt(sl[1]);

            System.out.println(10 <= A + B ? "error" : A + B);
        }
    }
}


Measured memory_bytes: 21076
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    int n; cin >> n;
    int a[100010];
    vector<int> v;
    rep(i,0,n){
        cin >> a[i];
        v.pb(a[i]);
    }
    sort(v.begin(), v.end());
    int ans = 0;
    rep(i,0,n){
        int k = lower_bound(v.begin(), v.end(), a[i]) - v.begin();
        if((k%2) != (i%2)) ans++;
    }
    cout << ans / 2 << endl;
    return 0;
}

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

long long gc(long long a, long long b) {
	if(b == 0) return a;
	else return gc(b,a%b);
}

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
	long long n,ans=0,r=0,g=0,b=0;
	string s;
	cin>>n;
	cin>>s;
	for(int i=0; i<n; i++) {
		if(i) {
			if(s[i] == 'R') r++;
			else if(s[i] == 'G') g++;
			else b++;						
		}
	}
	for(int i=1; i<n; i++) {
		if(s[i]=='R') r--;
		else if(s[i]=='G') g--;
		else b--;
		for(int j=0; j<i; j++) {
			if(s[i]!=s[j]) {
				if(s[i]!='R' && s[j]!='R') {
					ans += r;
					if(i+i-j<n) {
						if(s[2*i-j] == 'R') ans--;
					}
				}
				if(s[i]!='G' && s[j]!='G') {
					ans += g;
					if(i+i-j<n) {
						if(s[2*i-j] == 'G') ans--;
					}					
				}
				if(s[i]!='B' && s[j]!='B')	{
					ans += b;
					if(i+i-j<n) {
						if(s[2*i-j] == 'B') ans--;
					}					
				}			
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3656
#include <iostream>

int main()
{
	int H, W;
	char C[100][100];

	std::cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			std::cin >> C[i][j];
		}
	}


	for (int j = 0; j < W; j++) {
		std::cout << C[0][j];
	}
	std::cout << std::endl;
	for (int i = 0; i < (2 * H - 1); i++) {
		for (int j = 0; j < W; j++) {
			std::cout << C[(i + 1) / 2][j];
		}
		std::cout << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    VL a(n), b(n);
    REP(i, n) cin >> a[i];
    REP(i, n) cin >> b[i];
    
    ll ans = 0;
    REP(k, 30) {
        ll cnt = 0;
        ll t = 1 << k;
        VL b_mod(n);
        REP(i, n) b_mod[i] = b[i] % (2 << k);
        sort(ALL(b_mod));
        REP(i, n) {
            ll mod_a = a[i] % (2 << k);
            cnt += lower_bound(ALL(b_mod), 2 * t - mod_a)
                - lower_bound(ALL(b_mod), t - mod_a);
            cnt += lower_bound(ALL(b_mod), 4 * t - mod_a)
                - lower_bound(ALL(b_mod), 3 * t - mod_a);
        }
        ans += (cnt % 2) << k;
    }
    cout << ans << endl;

    return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 110
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1e9+7;


int main() {
    int n;
    cin >> n;
    vector<int> vx(n);
    vector<int> vy(n);
    vector<int> vh(n);
    int tmp = 0;
    rep(i, n) {
        cin >> vx[i] >> vy[i] >> vh[i];
        if (vh[i]) tmp = i;
    }

    int ans_x, ans_y, ans_h;
    for(int x=0; x<=100; ++x) {
        for(int y=0; y<=100; ++y) {
            int H = vh[tmp] + abs(vx[tmp]-x) + abs(vy[tmp]-y);

            bool check = true;
            for(int i=0; i<n; ++i) {
                if (vh[i] > 0 && H - vh[i] != abs(vx[i]-x) + abs(vy[i]-y)) check = false; 
                if (vh[i] == 0 && H > abs(vx[i]-x) + abs(vy[i]-y)) check = false;
            }
            if (check) {
                ans_x = x;
                ans_y = y;
                ans_h = H;
            }

        }
    }

    cout << ans_x << " " << ans_y << " " << ans_h << endl;


}



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

using namespace std;

void hawawa()
{
	string str;
	cin >> str;
	int sum1 = 0, sum2 = 0;
	for (auto&& i : str) {
		sum1 += i - '0';
	}
	sum2 += str[0] - '0' - 1;
	for (int i = 1; i < str.size(); i++) {
		sum2 += 9;
	}
	cout << max(sum1, sum2) << "\n";
}

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


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

typedef long long int Int;

void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
Int n,s;

int main()
{
    faster();
    Int a,b,k;
    cin>>a>>b>>k;
    
    if (k>=a)
    {
        b -= k-a;
        a = 0;
        if (b<0) b =0;
    }
    else
    {
        a -= k;
    }
    cout<<a<<" "<<b<<'\n';
    
    

    return 0;
}

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


int main(){
   ll n,a,b;
   cin>>n>>a>>b;
   ll m=n % (a+b);
    if(m<a)cout<<n/(a+b)*a+m;
    else cout<<n/(a+b)*a+a;
    return 0;
}


Measured memory_bytes: 256
N, M, S = map(int, input().split(" "))
adj = [ [] for _ in range(N) ] 
convert = []
for _ in range(M) :
    u, v, a, b = map(int, input().split(" "))
    adj[u-1].append( (v-1,a,b) )
    adj[v-1].append( (u-1,a,b) )

for _ in range(N) :
    c, d = map(int, input().split(" "))
    convert.append( (c, d) )  

import heapq 

limit = 2500
S = min(S, limit)
h = [ (0, 0, S) ] 
ans = [  [float('inf')]*(limit+1) for _ in range(N) ]

while h != [] :
    time_consumed, city, coin = heapq.heappop(h)
    if ans[city][coin] < time_consumed:
        continue
    ans[city][coin] = time_consumed
    
    if coin + convert[city][0] < limit and ans[city][coin + convert[city][0]] > time_consumed + convert[city][1] :
        ans[city][coin + convert[city][0]] = time_consumed + convert[city][1]
        heapq.heappush(h, (time_consumed + convert[city][1], city, coin+convert[city][0] ) )

    for v, a, b in adj[city] :
        if coin - a < 0 or ans[v][coin-a] <= time_consumed+b :
            continue
        ans[v][coin-a] = time_consumed+b
        heapq.heappush( h, (time_consumed+b, v, coin-a) )
    
for i in range(1, N) :
    print(min(ans[i]))


Measured memory_bytes: 26320
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#define ll long long
using namespace std;
int main(){
    int k;
    string s;
    cin>>k>>s;
    if(s.length()<=k){
        cout<<s<<endl;
    }else{
        string sb=s.substr(0,k);
        sb+="...";
        cout<<sb<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int sum=0;
  cin>>N;
  for(int i=0;i<N;i++){
    int a,b;
    cin>>a>>b;
    sum+=b-a+1;
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**5+3
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


n,a,b,c=map(int,input().split())
ans=0
for i in range(n):#A,B:n勝,i勝
  ans=(ans+pow(a,n,mod)*pow(b,i,mod)*cmb(n-1+i,i)*(n+i)*pow(pow(a+b,mod-2,mod),n+i,mod))%mod
for i in range(n):
  ans=(ans+pow(b,n,mod)*pow(a,i,mod)*cmb(n-1+i,i)*(n+i)*pow(pow(a+b,mod-2,mod),n+i,mod))%mod
print(ans*100*pow(a+b,mod-2,mod)%mod)

Measured memory_bytes: 81648
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

const int N = 200005;
const int mod = (int) 1e9 + 7;

int n;
long long fenw[N];
int arr[N];

void update(int i, long long val) {
  for (; i < N; i += i & (-i)) {
    fenw[i] = max(fenw[i], val);
  }
}

long long query(int i) {
  long long ans = 0;
  for (; i > 0; i -= i & (-i)) {
    ans = max(ans, fenw[i]);
  }
  return ans;
}

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    long long here = query(arr[i]) + x;
    ans = max(ans, 1ll * here);
    update(arr[i], here);
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

ll N;
vector<ll> A;

map<ll, ll> A_map;

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

    cin >> N;
    A.resize(N);
    REP(i, N) {
        cin >> A[i];
        A_map[A[i]]++;
    }

    if(A_map.size() == 3) {
        vector<ll> val(3);
        ll j = 0;
        for(auto& a_tmp : A_map) {
            if(a_tmp.second != N / 3) {
                printf("No\n");
                return 0;
            }
            val[j] = a_tmp.first;
            j++;
        }

        if(val[0] == (val[1] ^ val[2]) &&
                val[1] == (val[0] ^ val[2]) &&
                val[2] == (val[1] ^ val[0]) ) {
            printf("Yes\n");
            return 0;
        }
    }
    else if(A_map.size() == 2) {
        vector<ll> val(2);
        for(auto& a_tmp : A_map) {
            if(a_tmp.first == 0) { val[0] = a_tmp.second; }
            else { val[1] = a_tmp.second; }
        }
        if(val[1] == (N / 3) * 2 && val[0] == N / 3) {
            printf("Yes\n");
        }
        else {
            printf("No\n");
        }
        return 0;
    }
    else if(A_map.size() == 1) {
        for(auto& a_tmp : A_map) {
            if(a_tmp.first != 0) {
                printf("No\n");
            }
            else {
                printf("Yes\n");
            }
            return 0;
        }
    }
    printf("No\n");



    return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	int n,count;
	double s;
	int x[100],y[100];

	s=0;
	count=0;
	cin>>n;

	while (n!=0)
	{
		for (int i=0;i<n;++i)
		{
			cin>>x[i]>>y[i];
		}

		for (int i=0;i<n;++i)
		{
			s += (x[i]*y[(i+1)%n]-x[(i+1)%n]*y[i])*1.0;
		}
		++count;
		printf("%d %.1f\n",count,fabs(s/2.));
		s=0;
		cin>>n;
	}
	

}

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

int A[1000001];

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

int main()
{
    int s;
    int a;

    cin >> s;

    a = s;
    int i = 1;

    if(a == 1 || a == 2 || a == 4){
        cout << 4 << endl;
        return 0;
    }
    while(A[a] != 2){
        i++;
        a = f(a);
        A[a]++;
    }
    cout << i << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

//++時計回り --反時計回り
// int dx[4] = {1, 0, -1, 0};
// int dy[4] = {0, 1, 0, -1};

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (A - B >= C) {
    cout << 0 << '\n';
  } else {
    cout << C - (A - B) << '\n';
  }
}


Measured memory_bytes: 256
#include <iostream>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using ll = long long;

using namespace std;



int main() {
    double n;
    cin >> n;
    double ans = (int)(n+1)/2/n;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3732
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int N = 2e6 + 100;
int mod = 998244353;
namespace Combi {
    int fact[N], inv[N];

    int bm(int b, int p, int m) {
        if(p == 0) return 1%m;
        int t = bm(b,p/2,m);
        t = (1ll*t*t)%m;
        if(p&1) return 1ll*t*b%m;
        return t;
    }

    int C(int n, int r) {
        if(n < 0 or r < 0 or r > n) return 0;
        int ret = 1ll*fact[n]*inv[r]%mod;
        ret = 1ll*ret*inv[n-r]%mod;
        return ret;
    }
    // X1 + X2 + ... + Xvar = Sum
    int no_of_eqns(int sum, int var) {
        return C(sum+var-1,var-1); // Xi >= 0
        // return C(sum-1,var-1); // Xi > 0
    }
    void init() {
        fact[0] = 1;
        for(int i = 1; i < N; i++) {
            fact[i] = 1ll*fact[i-1]*i%mod;
        }
        inv[N-1] = bm(fact[N-1], mod-2, mod);
        for(int i = N-2; i >= 0; i--) {
            inv[i] = 1ll*inv[i+1]*(i+1)%mod;
        }
    }
}
inline int ad(int x,int y)
{
    int ret=(x+y)%mod;
    if(ret<0)
    {
        ret+=mod;
        ret=ret%mod;
    }
    return ret;
}
inline int gun(int x,int y)
{
    int ret=(x*y)%mod;
    if(ret<0)
    {
        ret+=mod;
        ret=ret%mod;
    }
    return ret;
}
 main()

{
    fast
    Combi::init();
    int n,a,b,k,x,y;
    cin>>n>>a>>b>>k;
    int ses=0;
    for(int x=0;x<=n;x++)
    {
        int yo=k-a*x;
        if(yo<0)continue;
        if(yo%b!=0)continue;
        int y=yo/b;
        if(x+y>2*n)continue;
        ses=ad(ses,gun(Combi::C(n,x),Combi::C(n,y)));
    }
    cout<<ses<<endl;
    return 0;

}













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

using namespace std;

int main(){

    int n;
    float p[4][2], ab, cd;

    cin >> n;

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

        for(int j = 0; j < 4; ++j){
            for(int k = 0; k < 2; ++k){
                cin >> p[j][k];
            }
        }

        ab = (p[0][1] - p[1][1]) / (p[0][0] - p[1][0]);
        cd = (p[2][1] - p[3][1]) / (p[2][0] - p[3][0]);

        if(ab == cd){
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }

    }

}

Measured memory_bytes: 1224
# 初期入力
N = int(input())
S = input()

#
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase_2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

#Sの文字をN右にずらす
kotae =""
for i in S:
    x = ascii_uppercase_2.index(i)
    kotae +=ascii_uppercase_2[x+N]
print(kotae)

Measured memory_bytes: 3060
program prob1
    implicit none
    integer :: q,w,e
    read(*,*) q,w,e
    if(q <= e .and. e <= w) then
        write(*,*) "Yes"
        stop
    end if
    if(q >= e .and. e >= w) then
        write(*,*) "Yes"
        stop
    end if
    write(*,*) "No"

    stop
contains
end program prob1

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

int N;
int x[128], y[128], h[128];

int main(void) {
	int i;
	int cx, cy;
	int mizuhasu = -1;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d%d%d", &x[i], &y[i], &h[i]) != 3) return 1;
		if (mizuhasu < 0 && h[i] > 0) mizuhasu = i;
	}
	if (mizuhasu < 0) {
		puts("ERROR!!!!!");
		return 2;
	}
	for (cy = 0; cy <= 100; cy++) {
		for (cx = 0; cx <= 100; cx++) {
			int H = h[mizuhasu] + abs(x[mizuhasu] - cx) + abs(y[mizuhasu] - cy);
			int ok = 1;
			for (i = 0; i < N; i++) {
				int koudo = H - abs(x[i] - cx) - abs(y[i] - cy);
				if (koudo < 0) koudo = 0;
				if (koudo != h[i]) {
					ok = 0;
					break;
				}
			}
			if (ok) {
				printf("%d %d %d\n", cx, cy, H);
				return 0;
			}
		}
	}
	puts("ERROR!!!!!!!!!!!");
	return 2;
}


Measured memory_bytes: 128
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]
robot = []

for v in xl:
    robot.append([v[0]-v[1], v[0]+v[1]])
robot.sort(key=lambda x:x[1])

prev = 0
cnt = 0
for i in range(1, n):
    if robot[prev][1] > robot[i][0]:
        cnt += 1
    else:
        prev = i
print(n-cnt)

Measured memory_bytes: 42792
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	int a,b,c,d;
	cin >> a;
	cin >> b;
	//cin >> c;
	a*b % 2 == 0? cout <<"Even"<< endl: cout << "Odd" << endl;
}

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


int main() {
  int n;
  cin >> n;
  vector<string> d(n);
  rep(i,n) cin >> d[i];
  set<string> values;
  rep(i,n){
    values.insert(d[i]);
  }
  cout << values.size() << endl;
  return 0;
}

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

char buffer[9000]={'0'},ans[9000];

struct factorial{
	char fact[9999];
	} nth[9999];
	
void reverse(char string[])
{
	int I,J,LEN;
	char temp;
	LEN=strlen(string)-1;
	
	for(I=0,J=LEN;I<J;I++,J--)
	{
		temp=string[I];
		string[I]=string[J];
		string[J]=temp;
		
	}
	return ;
}
	
void string_multiply(char numb[], int a)
{
	int result,len,i,carry;
	
	reverse(numb);
	len=strlen(numb);
	
	carry=0;
	for(i=0;i<len;i++)
	{
		result=((numb[i]-'0')*a)+carry;
		buffer[i]=(result%10)+'0';
		
		carry=0;
		if(result>9)
		{
			carry=result/10;
		}
	}
	
	if(carry>0)
	{
		up:;
		buffer[i]=(carry%10)+'0';
		carry=carry/10;
	}
	if(carry>0)
	{
		i++;
		goto up;
	}
	
	reverse(buffer);
	strcpy(nth[a].fact,buffer);
	
	return ;
}

int main()
{
	long long unsigned z,y,used[9900]={0};
    char A[9900],D[]={'1','\0'},E[]={'2','\0'};

    strcpy(nth[0].fact,D);
    strcpy(nth[1].fact,D);
    strcpy(nth[2].fact,E);

    used[0]=2;
    used[1]=2;

    while(scanf("%llu",&z)!=EOF)
    {
        if(strlen(nth[z].fact)>0)
        {
            goto skip;
        }
        else
        {
            for(y=2;y<=z;y++)
            {
                if(!used[y])
                {
                strcpy(A,nth[y-1].fact);
                string_multiply(A,y);
                }
                used[y]=2;
            }
        }
        skip:;
        puts(nth[z].fact);
    }
	return 0;
}

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

int main() {
  int n, d;
  cin>>n>>d;
  vector<vector<double>> s(n, vector<double>(d));
  for (int i=0;i<n;i++) {
    for (int j=0;j<d;j++) {
      cin>>s[i][j];
    }
  }
  int count=0;
  for (int i=0;i<n;i++) {
    for (int j=0;j<n;j++) {
      if (i == j) continue;
      double dis2=0;
      for (int k=0;k<d;k++) {
        dis2 += (s[i][k]-s[j][k])*(s[i][k]-s[j][k]);
      }
      double dis = sqrt(dis2);
      if (dis == floor(dis)) count++;
    }
  }
  cout<<count/2<<endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
#define el endl
#define INF 1e8
typedef long long ll;
typedef long double ld;
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25
int main() {
    string s;
    int k;
    cin >> s;
    cin >> k;
    
    rep(i, s.length()){
        char c = s[i];
        int d = c == 'a' ? 0 : 26 - ((int)c - 97);
        if(d <= k){
            s[i] = 'a';
            k -= d;
        }
    }
    if(k != 0){
        int a = s.back() - 'a';
        a += k;
        a %= 26;
        s.back() = 'a' + a;
    }
    cout << s << endl;
}




Measured memory_bytes: 512
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

INF = 100000000000

AB = []

for a in A:
    for b in B:
        AB.append(a + b)

AB.sort(reverse=True)

ABC = []

for ab in AB[:K]:
    for c in C:
        ABC.append(ab + c)

ABC.sort(reverse=True)

for i in range(K):
    print(ABC[i])


Measured memory_bytes: 145776
#include <stdio.h>

int main(void)
{
	/*?????°??£?¨?*/
	int i,j,k,c,n,x;
	
	/*??????*/
	while(1){
		scanf("%d %d",&n,&x);
		if(n==0&&x==0) break;
		c=0;
		for(i=1;i<=n;i++){
			for(j=1;j<=n;j++){
				for(k=1;k<=n;k++){
					if(i!=j&&j!=k&&k!=i){
						if(i+j+k==x){
							c++;
						}
					}
				}
			}
		}
		printf("%d\n",c/6);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <array>
#include <string>

using namespace std;

constexpr int SURFACE_NUM = 6;

class Dice {
private:
    array<int, SURFACE_NUM> m_surface;

public:
    explicit Dice(array<int, SURFACE_NUM> surface)
        : m_surface(surface) {}

    int surface(int i) const
    {
        return m_surface.at(i);
    }

    void roll(char direction)
    {
        switch (direction) {
        case 'N':
            roll(0, 1, 5, 4);
            break;
        case 'S':
            roll(0, 4, 5, 1);
            break;
        case 'E':
            roll(0, 3, 5, 2);
            break;
        case 'W':
            roll(0, 2, 5, 3);
            break;
        }
    }

    void roll(int i, int j, int k, int l)
    {
        int tmp = m_surface.at(i);
        m_surface.at(i) = m_surface.at(j);
        m_surface.at(j) = m_surface.at(k);
        m_surface.at(k) = m_surface.at(l);
        m_surface.at(l) = tmp;
    }
};

int main()
{
    array <int, SURFACE_NUM> init;
    for (auto i = 0; i < SURFACE_NUM; i++) {
        cin >> init.at(i);
    }
    Dice one(init);

    string op;
    cin >> op;
    for (auto i = 0; i < op.size(); i++) {
        char direction = op.at(i);
        one.roll(direction);
    }

    cout << one.surface(0) << endl;;
}

Measured memory_bytes: 1208
import math

A,B,H,M=map(int,input().split())
ax = A * math.cos( (H/12 + M/60/12) * 2 * math.pi )
ay = A * math.sin( (H/12 + M/60/12) * 2 * math.pi )
bx = B * math.cos( M/60 * 2 * math.pi )
by = B * math.sin( M/60 * 2 * math.pi )
print( math.sqrt( (ax-bx)*(ax-bx) + (ay-by)*(ay-by) ) )



Measured memory_bytes: 9512
import numpy as np
N, K, Q = map(int, input().split(" "))
point_list = np.array([K-Q]*N)
ans_num_list = [int(input()) for _ in range(Q)]

num_answer_correct = np.array([0]*N)
for i in ans_num_list:
  num_answer_correct[i-1] += 1

point_list = point_list + num_answer_correct
# print(output)

for i in point_list:
  if i > 0:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 18408