akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <vector>

using namespace std;
typedef long long ll;


int main()
{
    int N,Q;
    string S;





    int cnt = 0;

//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());
    cin >> N >> Q;
    vector <pair <int,int>> p(Q);

    vector <int> point;

    cin >> S;

    int ac_Cnt = 0;
    int t[N+1];
    //先頭は0にする
    t[0] = 0;
    for (int i = 0; i < N-1; i++)
    {
        if(S[i] == 'A' && S[i+1] == 'C' )
        {
            ac_Cnt++;
        }
        t[i+1] = ac_Cnt;

    }


    for(int i = 0; i < Q; i++)
    {
        cin >> p[i].first >> p[i].second;
        cnt = t[p[i].second - 1] - t[p[i].first - 1];
        cout << cnt << endl;
    }

    return 0;
}



Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N;
    ll K;
    cin >> N >> K;
    vector<int> A(N),L(N),memo2(N+1);
    vector<bool> memo(N+1,false);
    rep(i,N) cin >> A[i];
    int now = 1;
    memo[1] = true;
    int cnt = 1;
    L[0]=1;
    rep(i,N){
        now = A[now-1];
        if(memo[now]){ //訪問済み
            //cout << cnt << endl;
            break;
        }else{
            memo[now]= true;
            memo2[now]= cnt;
            if(i!=N-1){
                L[i+1]=now;
            }else{
                L[0]=now;
            }
            cnt++;
        }
    }
    vector<int> Loop;
    //cout << memo2[now] << endl;
    int now2 = 1;
    if(now==1) Loop.push_back(1);
    rep(i,N){
        now2 = A[now2-1];
        if(i>=memo2[now]-1&&i<cnt-1){
            Loop.push_back(now2);
        }
    }
    //rep(i,Loop.size()) cout << Loop[i] << " ";
    ll id = (K-(cnt-Loop.size()))%Loop.size();
    //cout << cnt << endl;
    //rep(i,N)cout << L[i] << " " ;
    if(K-cnt<0){
        cout << L[K] << endl;
        return 0;
    }
    cout << Loop[id] << endl;
    return 0;
}

Measured memory_bytes: 6700
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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


int main() {

  ll L ,R;
  cin >> L >> R;

  ll tmp = (R - L) % 2019;
  ll ans = 2018;
  if ((R - L + 1) > 2019) ans = 0;
  else{
    for(ll i = L; i < R; i++) for(ll j = L + 1; j <= R; j++){
      ll left = i % 2019;
      ll right = j % 2019;
      ll hoge = (left * right) % 2019;
      //cout << left << right<< endl;
      ans = hoge < ans ? hoge : ans;
      if (ans == 0) break;
    }
  }

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


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

int main() {
  int N;
  int c[55], v[55];

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

  int plus = 0;
  for (int i = 0; i < N; i++) {
    if (v[i] - c[i] > 0) {
      plus += v[i] - c[i];
    }
  }

  cout << plus << endl;

  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
using namespace std;

#define ll long long

int main()
{
    ll N;
    scanf("%lld", &N);

    vector<ll> ans(N, 0);
    for (ll i = 2; i <= N; i++)
    {
        ll A;
        scanf("%lld", &A);
        ans[A - 1]++;
    }

    for (ll i = 0; i < N; i++)
        printf("%lld\n", ans[i]);
}


Measured memory_bytes: 4860
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args)
    {
        Scanner r=new Scanner(System.in);
        int A=r.nextInt();
        int B=r.nextInt();
        if(A>=13)
        {
            System.out.println(B);
        }else if(A>=6 && A<=12)
        {
            System.out.println(B/2);
        }
        else
        {
            System.out.println(0);
        }
    }
    public static class Reader {
        BufferedReader br;
        StringTokenizer st;

        public Reader(File s) throws IOException
        {
            br = new BufferedReader(new FileReader(s));
        }


        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------
}



Measured memory_bytes: 23508
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int n;
	while(cin>>n,n){
	for(int i=0;i<n;i++){
		int a,b,c;
		bool f1=0,f2=0;
		cin>>a>>b>>c;
		if(a==100||b==100||c==100)f1=1;
		if((a+b)/2>=90)f1=1;
		if((a+b+c)/3>=80)f1=1;
		if((a+b+c)/3>=70)f2=1;
		if((a+b+c)/3>=50&&a>=80||b>=80)f2=1;
		if(f1==1)cout<<"A";
		else if(f2==1)cout<<"B";
		else if(f1==0&&f2==0) cout<<"C";
		cout<<endl;
		}
	}
}

Measured memory_bytes: 1156
#include <stdio.h>

int main(void) {
    int A[3];
    int a7,a5;
    a7 = a5 = 0;
    
    for(int i = 0;i < 3 ; i++){
        scanf("%d",&A[i]);
    }
    
    for(int i = 0; i < 3;i++){
        if(A[i] == 5){
            a5++;
        }
        if(A[i] == 7){
            a7++;
        }
    }
    if(a5 == 2 && a7 == 1){
        printf("YES");
    }else{
        printf("NO");
    }
    
    //printf("%d",A);
	return 0;
}



Measured memory_bytes: 128
import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


a,b,c,d = map(int,input().split())

c -= a
d -= b

c = abs(c)
d = abs(d)

ll = gcd(c,d)



k = d/c
co = 0
kkk = 0


print((c//ll + d//ll - 1)*ll) 

Measured memory_bytes: 66540
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,d=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		d+=x!=i;
	}
	if(d==0||d==2)	
		puts("YES");
	else
		puts("NO");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
   int n;
   cin>>n;
   cout<<n*n<<endl;
    return 0;
}



Measured memory_bytes: 3564
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long lint;

int main(){
    char c;
    cin >> c;
    cout << (char)(c+1) << endl;
    
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n;
  cin >> n;
  vector<int> a(n), p(n), q(n);
  rep(i, n) cin >> p[i];
  rep(i, n) cin >> q[i];

  rep(i, n) a[i] = i + 1;

  ll i = 1, np, nq;
  do {
    bool flgp = true, flgq = true;
    rep(i, n) if (a[i] != p[i]) flgp = false;
    rep(i, n) if (a[i] != q[i]) flgq = false;

    if (flgp) np = i;
    if (flgq) nq = i;

    i++;
  } while (next_permutation(a.begin(), a.end()));

  cout << abs(np - nq) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#define chmax(a,b) (a<(b)?a=(b),1:0)
#define chmin(a,b) (a>(b)?a=(b),1:0)
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  int k,n; cin >>k >>n;
  int pr,m=0,f; cin >>f;pr=f;
  rep(i,n-1){
    int tmp; cin >>tmp;
    chmax(m,tmp-pr);
    if(df)print(tmp-pr);
    pr=tmp;
  }
  chmax(m,k+f-pr);
  if(df)print(k+f-pr);
  print(k-m);
}


Measured memory_bytes: 256
=begin
N = gets.to_i               # 単一整数
a = gets.split.map(&:to_i)  # スペースで区切られた複数の整数
a = N.times.map{gets.to_i}  # 縦に並んだ複数の整数。たまにある
s = gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
=end
N = gets.to_i               # 単一整数
s = gets.chomp              # 文字列。chompを付けないと改行文字がついてくる

if N % 2 == 1 or s[0,N/2] != s[N/2,N/2]
  puts "No"
else
  puts "Yes"
end

Measured memory_bytes: 1788
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    int ans = 0;
    rep(i, k) ans += a[i];
    cout << ans << endl;
}


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

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

    int ans = 1, cnt = 0;

    for (int i = 1; i <= n; i++){
        int tmp = i, tmpcnt = 0;
        while(1){
            if (tmp % 2 != 0) break;
            tmp /= 2;
            tmpcnt++;
        }
        if (tmpcnt > cnt) {
            cnt = tmpcnt;
            ans = i;
        }
        
    }

    

    cout << ans << endl;

}

Measured memory_bytes: 256
import collections
n, q = map(int, input().split())
P = collections.deque()
for _ in range(n):
    name, time = input().split()
    P.append([name, int(time)])

total_time = 0
while P:
    name, time = P.popleft()
    if time <= q:
        total_time += time
        print(name, total_time)
    else:
        time -= q
        total_time += q
        P.append([name, time])

Measured memory_bytes: 16576
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <cstring>
 
using namespace std;
 
#define MAX 25
#define INF (1<<29)
typedef pair<int,int> P;
 
int H,W;
char field[MAX][MAX];
vector<P> vec;
const int dx[] = {-1,0,0,1};
const int dy[] = {0,-1,1,0};
 
struct State{
    int x,y,S;
    State() {}
    State(int x,int y,int S) : x(x),y(y),S(S) {}
};
 
bool inField(int y,int x){
    return 0 <= y && y < H && 0 <= x && x < W;
}
 
int bfs(int sx,int sy,int gx,int gy){
    int res = INF;
    int dist[MAX][MAX];
    for(int i = 0 ; i < H ; i++){
	for(int j = 0 ; j < W ; j++){
	    dist[i][j] = INF;
	}
    }
    dist[sy][sx] = 0;
    queue<P> Q;
    Q.push(P(sx,sy));
 
    while(!Q.empty()){
	P p = Q.front(); Q.pop();
	if(p.first == gx && p.second == gy){
	    res = dist[gy][gx];
	    break;
	}
	for(int i = 0 ; i < 4 ; i++){
	    int nx = p.first + dx[i];
	    int ny = p.second + dy[i];
	    if(!inField(ny,nx)) continue;
	    if(field[ny][nx] == 'x') continue;
	    if(dist[p.second][p.first] + 1 < dist[ny][nx]){
		dist[ny][nx] = dist[p.second][p.first] + 1;
		Q.push(P(nx,ny));
	    } 
	}
    }
 
    return res;
}
 
void solve(int x,int y){
    int size = vec.size(),ans = INF;
    int dist[MAX][MAX][1<<10];
    for(int i = 0 ; i < H ; i++){
	for(int j = 0 ; j < W ; j++){
	    for(int k = 0 ; k < 1<<size ; k++){
		dist[i][j][k] = INF;
	    }
	}
    }
    dist[y][x][0] = 0;
    queue<State> Q;
    Q.push(State(x,y,0));
    while(!Q.empty()){
	State now = Q.front(); Q.pop();
	if(__builtin_popcount(now.S) == size){
	    ans = min(ans,dist[now.y][now.x][now.S]);
	    continue;
	}
 
	for(int i = 0 ; i < size ; i++){
	    int S = now.S;
	    if(now.S >> i & 1) continue;
	    S |= 1<<i;
	    int nx = vec[i].second, ny = vec[i].first;
	    int d = bfs(now.x,now.y,nx,ny);
	    if(dist[now.y][now.x][now.S] + d < dist[ny][nx][S]){
		dist[ny][nx][S] = d + dist[now.y][now.x][now.S];;
		Q.push(State(nx,ny,S));
	    } 
	}
    }
 
    cout << (ans == INF ? -1 : ans) << endl;
}
 
int main(){
    int sx,sy;
    while(cin >> W >> H, (W | H)){
	vec.clear();
	for(int i = 0 ; i < H ; i++){
	    for(int j = 0 ; j < W ; j++){
		cin >> field[i][j];
		if(field[i][j] == 'o'){
		    sx = j; sy = i;
		}else if(field[i][j] == '*'){
		    vec.push_back(P(i,j));
		}
	    }
	}
	solve(sx,sy);
    }
    return 0;
}

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

int main(void)
{
	char n,m,i,j;
	char *k,*a;
	char *c,ans=0;
	scanf("%hhd %hhd",&n,&m);
	k = (char *)malloc(sizeof(char) * n);
	a = (char *)malloc(sizeof(char) * m*n);
	c = (char *)malloc(sizeof(char) * m);
	
	for (i=0;i<n;i++) {
		scanf("%hhd",&k[i]);
		for (j=0;j<k[i];j++) {
			scanf("%hhd",&a[i*m+j]);
		}
	}
	
	for (i=0;i<m;i++) c[i] = 0;
	for (i=0;i<n;i++) {
		for (j=0;j<k[i];j++) c[a[i*m+j]-1]++;
	}

	for (i=0;i<m;i++) {
		if (c[i]>=n) ans++;
	}

	printf("%hhd\n",ans);

	free(k);
	free(a);
  	free(c);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define MOD 998244353LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll extgcd(ll a,ll b,ll& x,ll& y){
	ll d=a;
	if(b!=0LL){
		d=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}else{
		x=1;
		y=0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}

ll mod_pow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1){
			res=res*x%MOD;
		}
		x=x*x%MOD;
		n>>=1LL;
	}
	return res;
}


int n,s;
int a[3005];
ll dp[3005][3005];

int main(void){
	scanf("%d%d",&n,&s);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	ll tm=mod_inverse(2,MOD);
	dp[0][0]=mod_pow(2,n);
	for(int i=0;i<n;i++){
		for(int j=0;j<=s;j++){
			dp[i+1][j]+=dp[i][j];
			dp[i+1][j]%=MOD;
			if(j+a[i]<=s){
				dp[i+1][j+a[i]]+=dp[i][j]*tm%MOD;
				dp[i+1][j+a[i]]%=MOD;
			}
		}
	}
	printf("%lld\n",dp[n][s]);
	return 0;
}


Measured memory_bytes: 74228
#define r(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#include <bits/stdc++.h>
#include <cmath>
#include <fstream>
#define f first
#define endl "\n"
#define s second
#define pb push_back
#define ms(a,b) memset(a,b,sizeof(a))
#define fori(a,b) for(int i=a;i<b;i++)
#define forj(a,b) for(int j=a;j<b;j++)
typedef long long ll;
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
char _;

int nums[100001];
int n,q,a,b;
ll sum=0;
int mod(const int input, const int ceil) {
    return input >= ceil ? input % ceil : input;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    r(n);
    fori(0,n) {r(a); sum+=a; nums[a]++;}
    r(q);

    fori(0,q){
        r(a);r(b);
        nums[b]+=nums[a];
        sum = sum + ((b-a) * nums[a]);
        nums[a] = 0;
        cout << sum << endl;
    }


    return 0;
}


Measured memory_bytes: 3952
mod = 10**9+7

h,w,k = map(int,input().split())
fibonacchi =[1, 1, 2, 3, 5, 8, 13, 21, 34]
dp = [[0] * (w + 1) for _ in range(h + 1)]
dp[0][1] = 1
for i in range(h):
  for j in range(w+1):
    #dp[i][j]からdp[i+1][j-1]に遷移する条件
    #jとj-1の間に横棒がある&j-1とj-2の間、j+1とjの間に横棒がない
    #この置き方は
    #（縦棒1から縦棒j-2までの横棒の置き方）* （縦棒j+1から縦棒wまでの横棒の置き方置き方）
    if j >= 2:
      dp[i+1][j-1] += (fibonacchi[j-2]*fibonacchi[w-j])*dp[i][j]
      dp[i+1][j-1]%=mod

    #dp[i][j]からdp[i+1][j+1]への遷移が起こる条件は
    #j+1とjの間に横棒がある&jとj-1の間、j+2とj+1の間に横棒がない
    #この置き方は
    #(縦棒1から縦棒j-1の置き方)*(縦棒j+2*wまでの横棒の置き方)
    if j <= w-1:
      dp[i+1][j+1] += (fibonacchi[j-1]*fibonacchi[w-j-1])*dp[i][j]
      dp[i+1][j+1]%=mod

    #dp[i][j]からdp[i+1][j]への遷移が起こる条件は
    #j-1とjの間、jとj+1の間に横棒がない
    #このような横棒の置き方は
    #（縦棒1から縦棒j-1の置き方）*（縦棒j+1からwまでの棒の置き方）
    dp[i+1][j] += (fibonacchi[j-1]*fibonacchi[w-j])*dp[i][j]
    dp[i+1][j] %=mod

print(dp[h][k])



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a==b) cout << c << endl;
  else if(b==c) cout << a << endl;
  else cout << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define DEBUG
typedef long long ll;
using namespace std;
template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}

void solve(){
    int n;
    int k;
    cin >> n >> k;
    vector<ll> a;
    a.reserve(n);
    for(int i = 0 ; i < n ; i++){
        ll x;
        cin >> x;
        a.push_back(x);
    }
    vector<bool> ans;
    ans.reserve( n - k);
    for(int i = k; i < n ; i++){
        if( a[i] > a[i-k]){
            ans.push_back(true);
        }else{
            ans.push_back(false);
        }
    }
    for(int i = 0; i < ans.size() ; i++){
        if( ans[i]){
            cout << "Yes\n";
        }else{
            cout << "No\n";
        }
    }
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 2;
    while(TEST_CASES--){
    #endif // DEBBUG

    solve();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}


Measured memory_bytes: 4756
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = INT32_MAX;
const ll INFL = INT64_MAX;
const int mod = 1e9 + 7;

template <typename T>
void print_vec(vector<T> v) {
  for (T i : v) cout << i << " ";
  cout << endl;
}

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  k--;
  s[k] += 'a' - 'A';
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
import sys


def _i(): return int(sys.stdin.readline().strip())


def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    _ = _i()
    a = list(_ia())
    s = 0
    for ai in a:
        s ^= ai

    return " ".join(map(str, map(lambda x: s^x, a)))


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 121828
# -*- coding: utf-8 -*-
from collections import defaultdict
def inpl(): return list(map(int, input().split()))

N = int(input())
P = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
X = [0]*25
for i in range(1, N+1):
    for j in range(25):
        while i % P[j] == 0:
            i = i//P[j]
            X[j] += 1

ans = 0

for i in range(25):
    if X[i] >= 74:
        ans += 1

over = defaultdict(set)
for i in range(25):
    for j in [2, 4, 14, 24]:
        if X[i] >= j:
            over[j].add(i)

for o2 in over[2]:
    o4 = over[4] - set([o2])
    o24 = over[24] - set([o2])
    ans += len(o4) * (len(o4)-1) // 2
    ans += len(o24)

for o4 in over[4]:
    o14 = over[14] - set([o4])
    ans += len(o14)

print(ans)

Measured memory_bytes: 3444
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kishan Sairam Adapa
 */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define ll long long int
#define MOD ((int)(1e9) + 7)

using namespace std;

class CMaximalValue {
public:
    void solve(istream& cin, ostream& cout) {
        ll n;
        cin >> n;
        vector<ll> b;
        for(int i=0; i<n; i++) {
            ll tp;
            cin >>tp;
            b.push_back(tp);
        }
        vector<ll> a(n, 0);
        a[n-1] = b[n-1];
        for(int i=n-1; i>0; i--) {
            a[i-1] = b[i-1];
            if(b[i-1] < a[i]) {
                a[i] = b[i-1];
            }
        }
        ll sum = 0;
        for(auto k: a) sum+= k;
        cout << sum << '\n';
    }
};


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    CMaximalValue solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int main()
{
    string s;
    cin >> s;
    string ans = "Good";
    if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]) ans = "Bad";

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

Measured memory_bytes: 256
n,m,x = map(int, input().split())
costs = [list(map(int, input().split())) for _ in range(n)]

'''
n,m,x = [int(i) for i in input().split()]
costs =[]

for i in range(n):
    a = [int(i) for i in input().split()]
    costs.append(a)
'''


INF = 1000000000000000000000000000
ans = INF

for i in range(1<<n):  #n bits all searches
    # 1<<n == 2**n
    c = 0
    sums = [0]*m
    for j in range(n):
        if i>>j & 1: #i>>j %2 == 1  is also fine.
            #apply this candidate. 
            c += costs[j][0]
            for k in range(m):
                sums[k] += costs[j][k+1]    
    '''
    cost = 0
    c = 0
    sums = [0] * m
    use_index=[]
    for j in range(n):
        if i%2==1:
            use_index.append(j)
        i >>= 1
    
    for v in use_index:
        c += costs[v][0]        
        for j in range(m):
            sums[j] += costs[v][j+1]
    '''
    
    if min(sums) >= x:
        ans = min(ans, c)
'''            
    judge=True
    for j in range(m):
        if sums[j]<x:
            judge=False
            break
    
    if judge:
        ans = min(ans, c)
'''
if ans==INF:
    print(-1)
else:
    print(ans)
 

Measured memory_bytes: 9220
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
	int s[3];
	for(int i=0;i<3;i++)cin>>s[i];
	sort(s,s+3);
	if(s[0]==5&&s[1]==5&&s[2]==7)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[100010];
    rep(i, N){ 
        cin >> A[i];
        if(A[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    int num = 1;
    rep(i, N) {
        num *= A[i];
    }
    if(num > INF2) {
        cout << -1 << endl;
        return 0;
    }
    int ans = num;
    rep(i, N) {
        num /= A[i];
    }
    if(num != 1) {
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4420
N = int(input())

l = 10**10

lu = l
ru = l
ld = 0
rd = 0

for _ in range(N):
    x, y = map(int, input().split())
    lu = min(x+y, lu)
    ru = min(y-x, ru)
    ld = max(y-x, ld)
    rd = max(x+y, rd)

#print(lu, ru, ld, rd)
print(max(rd-lu, ld-ru))

Measured memory_bytes: 9204
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int N, R;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        R = sc.nextInt();
        System.out.println(R + (N < 10 ? (100*(10-N)) : 0));
    }
}


Measured memory_bytes: 35656
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>

using namespace std;

char sign(int a)
{
  if (a > 0) return '+';
  else return '-';
}

int main()
{
  vector<vector<int> > vv;
  vv.push_back({-1,-1,-1});
  vv.push_back({-1,-1,+1});
  vv.push_back({-1,+1,-1});
  vv.push_back({-1,+1,+1});
  vv.push_back({+1,-1,-1});
  vv.push_back({+1,-1,+1});
  vv.push_back({+1,+1,-1});
  vv.push_back({+1,+1,+1});

  string S;
  cin >> S;
  
  int A, B, C, D;
  A = S[0] - '0';
  B = S[1] - '0';
  C = S[2] - '0';
  D = S[3] - '0';
  
  for (auto v : vv) {
    int ans = A + v[0] * B + v[1] * C + v[2] * D;
    if (ans == 7) {
      cout << A << sign(v[0]) << B << sign(v[1]) << C << sign(v[2]) << D;
      cout << "=7" << endl;
      break;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reg(i,a,b) for(int i=(a);i<=(b);i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=(b);i>=(a);i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX

typedef string::iterator state;

lli addsub(state& s);
lli muldiv(state& s);
lli parent(state& s);
lli number(state& s);

lli number(state& s){
	lli res = 0;
	if(*s=='('){
		res = parent(s);
	}
	else if('0'<=*s && *s<='9'){
		while('0'<=*s && *s<='9'){
			res*=10;
			lli nc = *s-'0';
			res += nc;
			s++;
		}
	}
	else printf("error number\n");
	return res;
}

lli parent(state& s){
	if(*s!='(')printf("error kakko\n");
	s++;
	lli res = addsub(s);
	if(*s!=')')printf("error kokka\n");
	s++;
	return res;
}

lli muldiv(state& s){
	lli res = number(s);
	while(1){
		if(*s=='*'){
			s++;
			res *= number(s);
		}
		else if(*s=='/'){
			s++;
			res /= number(s);
		}
		else break;
	}
	return res;
}

lli addsub(state& s){
	lli res = muldiv(s);
	while(1){
		if(*s=='+'){
			s++;
			res += muldiv(s);
		}
		else if(*s=='-'){
			s++;
			res -= muldiv(s);
		}
		else break;
	}
	return res;
}


int main(void){
	int n;
	scanf("%d",&n);
	rep(i,n){
		char s[105];
		scanf("%s",s);
		string ns(s);
		state is = ns.begin();
		printf("%lld\n",addsub(is));
		if(*is!='=')printf("error finish\n");
	}
	return 0;
}

Measured memory_bytes: 1064
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int n;
    cin >> n;
    vector<int> t(n);
    rep(i,n) cin >> t.at(i);
    int m;
    cin >> m;
    vector<int> p(m);
    vector<int> x(m);
    rep(i,m) cin >> p.at(i) >> x.at(i);
    rep(i,m){
        int ans=0;
        int a=t.at(p.at(i)-1);
        t.at(p.at(i)-1)=x.at(i);
        rep(j,n){
            ans+=t.at(j);
        }
        cout << ans << endl;
        t.at(p.at(i)-1)=a;
    }

}


Measured memory_bytes: 3596
/**
 * Created by hiramekun at 01:25 on 2020-06-21.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for (auto &i : mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n, l;
    cin >> n >> l;
    vl a(n);
    cin >> a;
    string ans = "Impossible";
    ll pos = -1;
    rep(i, n - 1) {
        if (a[i] + a[i + 1] >= l) {
            ans = "Possible";
            pos = i;
        }
    }
    if (ans == "Impossible") {
        cout << ans << '\n';
        return;
    }
    cout << ans << '\n';
    rep(i, n - 1) {
        if (i == pos) {
            for (ll j = n - 2; j > i; --j) {
                cout << j + 1 << '\n';
            }
            break;
        }
        cout << i + 1 << '\n';
    }
    cout << pos + 1 << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}


Measured memory_bytes: 4048
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
max_x=max(x)
min_y=min(y)
if max_x<X:
    max_x=X
if min_y>Y:
    min_y=Y
if min_y<=max_x:
    print("War")
else:
    print("No War")

Measured memory_bytes: 3064
n = int(input())
a = list(map(int,input().split()))

cumsum = []
total = 0
for num in a:
    total+=num
    cumsum.append(total)

result = 0
MOD = pow(10,9)+7
for i,num in enumerate(cumsum):
    temp = total-num
    result += temp*a[i]
    
print(result%MOD)
    


Measured memory_bytes: 31632
N = int(input())
A = list(map(int, input().split()))

mymod = 1000000007

def modpow(a, n):
    res = 1
    while(n > 0):
        if n & 1:
            res = (res*a)%mymod

        a = (a * a)%mymod
        n >>= 1

    return res

def modinv(a, b):
    return (a * modpow(b, mymod-2))%mymod

inv2 = modinv

Ai2_sum = 0
for Ai in A:
    Ai2 = (Ai**2)%mymod
    Ai2_sum = (Ai2_sum + Ai2)%mymod

sumA = sum(A)%mymod
sumA_2 = (sumA**2) % mymod

print(modinv(sumA_2 - Ai2_sum, 2))





Measured memory_bytes: 94120
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define dame {cout<< "-1" <<"\n"; return;}
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll K; cin>>K;
    vector<ll> A(K);
    rep(i,K) cin>>A[i];
    ll ma=2,mi=2;
    repr(i,K-1,0){
        mi=((mi+A[i]-1)/A[i])*A[i];
        ma=((ma/A[i])+1)*A[i]-1;
    }
    if(ma<mi) dame;
    cout<<mi<<" "<<ma <<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    out(max(a*b, c*d));
    re0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 10000000000000000;
const ll mod = 1000000007;
//printf("%.10f\n", n);
signed main() {
	ll n, m, a = 0, b = 0, cnt = 0, ans = 0; string s; cin >> s;
	for (int h = 0; h < s.size(); h++) {
		if (h == 0) { if ((ll)s[h] == 65) { cnt++; } }
		else if ((ll)s[h] == 67) { 
			if (a == 0 && 2 <= h && h <= s.size() - 2) { cnt++; a++; }
		}
		else {
			if (97 <= (ll)(s[h]) && (ll)s[h] <= 122) { cnt++; }
		}
	}
	if (a == 1 && cnt == s.size()) { cout << "AC" << endl; }
	else { cout << "WA" << endl; }
	cin >> n; return 0;
}

Measured memory_bytes: 256
using namespace std;

#include <cstdio>
#include <cstdint>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

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

    int     N = 0;
    int     n = 0;
    cin >> N;
    vector<int>  A;
    int     tmp = 0;
    int     ans[N] = {0};
    A.push_back(0);
    for(n = 0; n<N-1; n++){
        cin >> tmp;
        A.push_back(tmp);
    }

    for(n = 0; n < N; n++){
        if(A[n]-1 >= 0){
            ans[A[n]-1]++;
        }
    }


    for(n = 0; n < N; n++){
        cout << ans[n] << "\n";
    }
    return 0;
    
}

Measured memory_bytes: 5032
def min(a)
  min = 0
  for i in 0...a.length()
    
    if a[i]<=a[min]
      min = i
    end
  end
  min
end

def circle(w,h,x,y,r)
  left = x
  right = w - x
  u = h - y
  s = y
  length = Array.new(4)
  length[0]=left
  length[1]=right
  length[2]=u
  length[3]=s
  if length[min(length)] >= r
    "Yes\n"
  else
    "No\n"
  end
end 

a = gets().split(" ")

print circle(a[0].to_i,a[1].to_i,a[2].to_i,a[3].to_i,a[4].to_i)

Measured memory_bytes: 8656
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int len = s.size();
    VI f(len), b(len);
    for (int i = 0; i < len; ++i) {
        if (s[i] == '(') ++f[i];
        else --f[i];
        if (i > 0) f[i] += f[i-1];
    }
    for (int i = len - 1; i >= 0; --i) {
        if (s[i] == '(') --b[i];
        else ++b[i];
        if (i < len - 1) b[i] += b[i+1];   
    }
    int minf = 0, minb = 0;
    REP(i,0,len) {
        if (f[i] < minf) minf = f[i];
        if (b[i] < minb) minb = b[i];
    }
    REP(i,0,-minf) cout << '(';
    cout << s;
    REP(i,0,-minb) cout << ')';
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int dig[3] = { 0 };
int ans = 0, n = 0, c = 0;

void cal(int c,int num = 0 , int keta = 0) {
	int N;

	if (keta == c) {
		if (num <= n && dig[0] > 0 && dig[1] > 0 && dig[2] > 0) {
			ans++;
			return;
		}
	}
	else {
		dig[0]++;; N = num * 10 + 3;
		cal(c,N, keta+1);
		dig[0]--;
		dig[1]++; N = num * 10 + 5;
		cal(c,N, keta+1);
		dig[1]--;
		dig[2]++; N = num * 10 + 7;
		cal(c,N, keta+1);
		dig[2]--;
	}

	return;
}


int main() {

	cin >> n;

	int s = n;

	while (s > 0) {
		s = s / 10;
		c++;
	}

	for (int i = 1; i <= c; i++) {
		cal(i);
	}

	cout << ans << endl;
	

	return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#from bisect import insort_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
#import heapq
#import numpy as np
#INF = float("inf")
a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print("red")

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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int a,b,c,d, A[100], B[100], C[100][100], D[100][100][100];
string s, t, r;




int main(){
	cin >> a >> b;
	cout << a*b - a-b+1 << endl;

	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define endl '\n'

//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#define SZ(x) ((int)x.size())
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back

using namespace std;
template<class T, class T2> inline int chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline int chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);

int n;
string a, b, c;

void read()
{
	cin >> n;
	cin >> a >> b >> c;
}

void solve()
{
	int answer = 0;
	for(int i = 0; i < n; i++)
	{
		map<char, int> C;
		C[a[i]]++;
		C[b[i]]++;
		C[c[i]]++;

		int mx = 0;
		for(auto it: C)
			chkmax(mx, it.second);

		answer += 3 - mx;
	}

	cout << answer << endl;
}

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

	read();
	solve();
	return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main(void) {
	
	int N = 10;int M = 10;
	int X, Y;
	scanf("%d %d %d %d", &N,&M,&X,&Y);

	int x[200];
	int y[200];
	for (int i = 0;i < N;i++)scanf(" %d", &x[i]);
	for (int i = 0;i < M;i++)scanf(" %d", &y[i]);

	int xmax = -100;
	int ymin = 101;
	int z;

	for (int i=0;i<N;i++)
	if (xmax < x[i]) xmax = x[i];

	for(int i=0;i<M;i++)
		if(ymin >y[i]) ymin = y[i];

	if (ymin > xmax) {

		for (z = -100; z < 100; z++) {
			if (z > X && z <= Y && xmax < z && ymin >= z) {
				printf("No War");
				return 0;
			}
		}
	}
	 printf(" War");
	
}

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

template<typename T>
inline int size_as_int(const T& cont) { return static_cast<int>(cont.size()); }

class BinaryIndexedTree
{
private:
    std::vector<int> vals;
public:
    BinaryIndexedTree(int n)
        : vals(n, 0) { }

    void add(int a, int w)
    {
        int n = size_as_int(vals);
        for (int x = a; x <= n; x += x & -x) {
            vals[x - 1] += w;
        }
    }

    int sum(int a) const
    {
        int ret = 0;
        for (int x = a; x > 0; x -= x & -x) {
            ret += vals[x - 1];
        }
        return ret;
    }
};

class SnLine
{
private:
    struct ProdRange
    {
        ProdRange() { l = r = 0; }
        ProdRange(int l_, int r_) { l = l_; r = r_; }
        int l, r;
    };

    std::vector<ProdRange> prList;

    int numStops;

public:
    SnLine(int numStops_, int numProds_)
    {
        numStops = numStops_;
        prList.reserve(numProds_);
    }

    void addProdRange(int l, int r)
    {
        prList.emplace_back(l, r);
    }

    void solve()
    {
        std::sort(prList.begin(), prList.end(),
            [](const auto& a, const auto& b)
            { return ((a.r - a.l) < (b.r - b.l)); });

        BinaryIndexedTree bit(numStops);

        int numRemainingProds = size_as_int(prList);
        auto pr = prList.begin();

        for (int d = 1; d <= numStops; ++d)
        {
            int r = numRemainingProds;

            if (1 < d)
            {
                for (int a = d; a <= numStops; a += d)
                    r += bit.sum(a);
            }

            std::cout << r << "\n";

            for(; pr != prList.end() && (d == pr->r - pr->l + 1); ++pr)
            {
                bit.add(pr->l, 1);
                bit.add(pr->r + 1, -1);
                --numRemainingProds;
            }
        }
    }
};

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

    int N, M;
    std::cin >> N >> M;

    SnLine sl(M, N);

    for (int i = 0; i < N; ++i)
    {
        int l, r;
        std::cin >> l >> r;

        sl.addProdRange(l, r);
    }

    sl.solve();
    return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

int main()
{
        using namespace std;

        /*
           まず、赤と緑のスタメンを出す
           その後、その中から一番弱いものを、無色の最大数とチェンジ
         */

        int x, y, a, b, c;
        int t;
        long ans = 0;

        cin >> x >> y >> a >> b >> c;

        vector<int> p, q, r;

        for(int i=0; i<a; i++)
        {
            cin >> t;
            p.push_back(t);
        }

        for(int i=0; i<b; i++)
        {
            cin >> t;
            q.push_back(t);
        }

        for(int i=0; i<c; i++)
        {
            cin >> t;
            r.push_back(t);
        }

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

        for(int i=0; i<x; i++)
        {
            r.push_back(p[i]);
        }
        for(int i=0; i<y; i++)
        {
            r.push_back(q[i]);
        }

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

        for(int i=0; i<x+y; i++)
        {
            //cout << r[i] << endl;
            ans += (long)r[i];
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 3316
/* -*- C -*- */

#include <stdio.h>

int main()
{
	int a,b,c,i;
	int count=0;
    
    scanf("%d %d %d",&a,&b,&c);
    
    for(i=a;i<=b;i++){
        if((c%i) == 0 ){
        	 count++;
        }
    }
    
    printf("%d\n",count);
    return 0;
        
}


Measured memory_bytes: 2756
iterate = int(input())
p = [int(x) for x in input().split()]

result_sum = 0
prev_min = 10  ** 9
for i in range(iterate):
  if p[i] <= prev_min:
    	result_sum += 1
  prev_min = min(prev_min, p[i])

print(result_sum)

Measured memory_bytes: 24744
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long t;
    cin>>t;
    long long a[t+1];
    for(int i=1;i<=t;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+1+t);
    for(int i=1;i<=t;i++)
    {
        if(a[i]==a[i+1])
        {   cout<<"NO";
            return 0;
        }

    }
    cout<<"YES";
}


Measured memory_bytes: 1792
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}
#ifdef LOCAL
	#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
	#define debug(...) 3
#endif

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
using ll = int64_t; using ull = uint64_t; using ld = long double;


int main() {
	fast_io; cout_precision;
	int n; cin >> n;
	map<int, int> cnt[2];
	for (int i = 0; i < n; ++i) {
		int x; cin >> x;
		cnt[i & 1][x]++;
	}
	vector<pair<int, int>> v[2];
	for (int i = 0; i < 2; ++i) {
		for (auto &p : cnt[i]) {
			v[i].emplace_back(p.second, p.first);
		}
		if (v[i].size() == 1) {
			v[i].emplace_back(0, -1);
		}
		sort(v[i].begin(), v[i].end(), greater<pair<int, int>>());
	}
	int ans = 0;
	for (int i = 0; i < 2; ++i) {
		for (int j = 0; j < 2; ++j) {
			if (v[0][i].second != v[1][j].second) {
				ans = max(ans, v[0][i].first + v[1][j].first);
			}
		}
	}
	cout << n - ans << endl;
}

Measured memory_bytes: 6140