akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int med3(int x, int y, int z){
	if(x<y){
		if(y<z){
			return y;
		}
		else if(z<x){
			return x;
		}
		else{
			return z;
		}
	}
	else{
		if(x<z){
			return x;
		}
		else if(z<y){
			return y;
		}
		else{
			return z;
		}
	}
}

void sort(int a[], int left, int right){
	if(left<right){
		int i=left, j=right;
		int pivot=med3(a[i], a[i+(j-i)/2], a[j]);
		int temp;
		while(1){
			while(a[i]<pivot){
				i++;
			}
			while(pivot<a[j]){
				j--;
			}
			if(i>=j){
				break;
			}
			temp=a[i];
			a[i]=a[j];
			a[j]=temp;
			
			i++;
			j--;
		}
		sort(a, left, i-1);
		sort(a, j+1, right);
	}

}

int main(void){
	int array[210000], n, k, j, i;
	
	scanf("%d", &n);
	
	for(i=0; i<n; i++){
		scanf("%d", &array[i]);
	}
	
	sort(array, 0, n-1);
	for(i=1; i<n; i++){
      if(array[i-1]==array[i]){
        printf("NO\n");
        return 0;
      }
    }
  printf("YES\n");
  return 0;
  
	
}

Measured memory_bytes: 896
// Author :
// Date :
// Problem:
// Solution:
// Comment:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstring>

#define pp push
#define pb push_back
#define mp make_pair
#define xx first
#define yy second

using namespace std;

int test(int n){
    int mas[40][40]={0};
    int x,y;
    int w;
    
    for(int i = 0 ; i < n ; i++){
        cin >> x >> y;
        mas[x][y]=1;
    }
    
    int m;
    int curx = 10, cury = 10;
    char d;
    
    cin >> m;
    
    while(m--){
        cin >> d >> w;
        
        if(d == 'N'){
        //    if((cury+w)>20) continue;
            while(w--){
                if(cury<20){
                    cury++;
                    if(mas[curx][cury]==1){
                        mas[curx][cury]=0;
                        n--;
                    }
                }
            }
        }
        
        if(d == 'E'){
        //    if((curx+w)>20) continue;
            while(w--){
                if(curx<20){
                    curx++;
                    if(mas[curx][cury]==1){
                        mas[curx][cury]=0;
                        n--;
                    }
                }
            }
        }
        
        if(d == 'S'){
          // if((cury-w)<0) continue;
            while(w--){
                if(cury>0){
                    cury--;
                    if(mas[curx][cury]==1){
                        mas[curx][cury]=0;
                        n--;
                    }
                }
            }
        }
        
        if(d == 'W'){
        //    if((curx-w)<0) continue;
            while(w--){
                if(curx>0){
                    curx--;
                    if(mas[curx][cury]==1){
                        mas[curx][cury]=0;
                        n--;
                    }
                }
            }
        }
    }
    
    if(n==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

main(){
    int n;
    
    while(cin >> n){
        if(n == 0) break;
        test(n);
    }
    
    #ifdef GEREL
        for(;;);
    #endif

    return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
vector<int> x = {1,-1,0,0};
vector<int> y = {0,0,-1,1};
int main(){
    double n,k;
    double ans = 0;
    cin >> n >> k;
    double end = n;
    int dice = 0;
    while(k>=0.05){
        int basic;
        if(k-int(k)==0){
            basic = k;
        }else{
            basic = int(k)+1;
        }
        
        if(end>=basic){
            ans += (end-basic+1)*pow(2,dice*(-1))/n;
            //cout<<pow(2,dice*(-1))<<basic<<endl;
            end = basic-1;
            if(end==0){
                break;
            }
        }
        
        k/=2;
        
        dice ++;
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4212
#include <stdio.h>
int main(void) {
    int num,product[200][2],i,n,d,X,x,Y,y;
    while (1) {
        scanf("%d",&num);
        if (num==0) break;
        product[0][0]=0,product[0][1]=0,X=0,x=0,Y=0,y=0;
        for (i=1; i<=num-1; i++) {
            scanf("%d %d",&n,&d);
            switch (d) {
                case 0:
                    product[i][0]=product[n][0]-1;
                    product[i][1]=product[n][1];
                    break;
                
                case 1:
                    product[i][0]=product[n][0];
                    product[i][1]=product[n][1]-1;
                    break;
                    
                case 2:
                    product[i][0]=product[n][0]+1;
                    product[i][1]=product[n][1];
                    break;
                    
                case 3:
                    product[i][0]=product[n][0];
                    product[i][1]=product[n][1]+1;
                    break;
            }
            if (product[i][0]>X) X=product[i][0];
            if (product[i][1]>Y) Y=product[i][1];
            if (product[i][0]<x) x=product[i][0];
            if (product[i][1]<y) y=product[i][1];
        }
        printf("%d %d\n",X-x+1,Y-y+1);
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll N, A, B;

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

    ll ans;
    if ((B - A) % 2 == 0)
    {
        ans = (B - A) / 2;
    }
    else
    {
        ans = min(A + (B - A - 1) / 2, (N - B) + 1 + (B - A - 1) / 2);
    }

    OUT(ans);
}

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

int main()
{
    int n;
    int cnt = 1;
    cin >> n;
    vector<int> a(n);

    for(int i = 0; i < n; i++){
        cin >> a.at(i);
    }

    sort(a.begin(),a.end());

    for(int i = 0; i < n - 1; i++){
        if(a.at(i) != a.at(i + 1)){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] l = new long[n];
        List<Integer> list = new ArrayList<>();
        for(int i=0; i<n; i++) {
            l[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(l);
        
        for(int i=0; i<n; i++) {
            if(list.contains(l[i])) {
                continue;
            }else {
            }
        }
        
        long ans = 0;
        for(int i=0; i<n-2; i++) {
            for(int j=i+1; j<n-1; j++) {
                if(l[i]==l[j]) continue;
                for(int k=j+1; k<n; k++) {
                    if(l[i]==l[k] || l[j]==l[k]) continue;
                    if(l[i]+l[j]>l[k] && l[j]+l[k]>l[i] && l[k]+l[i]>l[j]) ans+=1;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 36220
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        Console.ReadLine();
        var s = Console.ReadLine();

        var max = 0;
        for (int i = 1; i < s.Length; i++)
        {
            max = Math.Max(max, m1(s.Substring(0, i), s.Substring(i)));
        }
        Console.WriteLine(max);
    }

    static int m1(string x, string y)
    {
        var set = new HashSet<char>();
        var ans = 0;
        for (int i = 0; i < x.Length; i++)
        {
            if (set.Add(x[i]))
            {
                for (int j = 0; j < y.Length; j++)
                {
                    if (x[i] == y[j])
                    {
                        ans++;
                        break;
                    }
                }
            }
        }
        return ans;
    }
}


Measured memory_bytes: 13396
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os, pdb
sys.setrecursionlimit(10**7)
from queue import PriorityQueue
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def perr(s): return print(s, file=sys.stderr)
"""
互いに素な整数の組を選ぶ
A.Bの公約数は
12 18なら
1, 2, 3, 6
ってやっていくと無理がある
そもそも約数がある時点でだめでは？

"""

A, B = LI()
if A == B == 1:
    print(1)
    exit()
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    print(a)
    return a

def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
A_fac = factorization(A)
B_fac = factorization(B)
perr(A_fac)
perr(B_fac)
ans = 1
b_fac = [b[0] for b in B_fac]
for a in A_fac:
    if a[0] in b_fac:
        ans += 1
#  for a, b in zip(A_fac, B_fac):
#      if a[0] == b[0]:
#          ans += 1

print(ans)


Measured memory_bytes: 78188
#include <iostream>
#include <vector>
#include <set>
#include <queue>
using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vector<vector<int>> L(N);
    for(int i=0; i<N; i++){
        int K;
        cin >> K;
        for(int j=0; j<K; j++){
            int l;
            cin >> l;
            l--;
            L[i].push_back(l);
        }
    }
    vector<vector<int>> P(M);
    for(int i=0; i<N; i++)
        for(int l : L[i])
            P[l].push_back(i);

    vector<bool> vis1(N, false);
    vector<bool> vis2(M, false);
    queue<int> que1, que2;
    que1.push(0);
    while(!que1.empty() || !que2.empty()){
        if(!que1.empty()){
            int s = que1.front();
            que1.pop();
            if(vis1[s]) continue;
            vis1[s] = true;
            for(auto t : L[s])
                que2.push(t);
        }
        if(!que2.empty()){
            int s = que2.front();
            que2.pop();
            if(vis2[s]) continue;
            vis2[s] = true;
            for(auto t : P[s])
                que1.push(t);
        }
    }
    for(int i=0; i<N; i++)
        if(!vis1[i]){
            cout << "NO" << endl;
            return 0;
        }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 8952
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
//const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};



int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	vp a(n),b(m);
	for(int i=0;i<n;i++) a[i]={i,i};
	for(int i=0;i<m;i++) cin>>b[i].first>>b[i].second;
	sort(b.begin(),b.end());
	for(int i=0;i<m;i++){
		int j=b[i].second-1;
		a[j].second=a[j+1].second;
		a[j+1].first=a[j].first;
	}
	for(int i=0;i<n;i++){
		if(i) cout<<' ';
		cout<<a[i].second-a[i].first+1;
	}
	cout<<endl;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 A, B;
	cin >> A >> B;
	int64 res = 0;
	int64 two = 2;
	if (((B+1)/2 - (A)/2)%2) res = 1;

	FOR(i, 1, 40) {
		two *= 2;
		int64 a = (A)%two, b = (B+1)%two;
		int64 one = (b >= two/2 && (b-two/2)%2 == 1) ^ (a >= two/2 && (a-two/2)%2 == 1);
		res |= one << i;
	}
	cout << res << endl;
}


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

using namespace std;

int main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

  int n, L;
  cin >> n >> L;
  int TheFlavor = (1 << 30);
  int SumFlavor = 0;

  for (int i = 1; i <= n; i++)
  {
    int curFlavor = L + i - 1;
    if (abs(curFlavor) < abs(TheFlavor))
    {
      TheFlavor = curFlavor;
    }
    SumFlavor += curFlavor;
  }

  cout << SumFlavor - TheFlavor << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>

int main(){
  int N;
  std::vector<int > target(4);
  scanf("%d", &N);
  scanf("%d", &target[1]);
  scanf("%d", &target[2]);
  scanf("%d", &target[3]);
  std::vector<int > l(N);
  for (int i=0; i<N; i++){
    scanf("%d", &l[i]);
  }
  int ans = 100000000;
  std::vector<int > take;
  for (int i=0; i<(1<<N*2); i++){
    //printf("=======-\n");
    //printf("i=%d\n",i);
    std::vector<int > count(4, 0);
    std::vector<int > length(4, 0);
    bool canuse = true;
    int temp=0;
    for (int j=0; j<N; j++){
      int val = 0;
      if (((1<<(2*j))&i)!=0){
        val += 1;
      }
      if (((1<<(2*j+1))&i)!=0){
        val += 2;
      }
      count[val]++;
      length[val]+=l[j];
    }
    for (int k=1; k<4; k++){
      if (count[k]==0){
        canuse = false;
      } else {
        temp += 10*(count[k]-1);
        temp += abs(length[k]-target[k]);
        //printf("temp+=10*(%d-1)=%d\n",count[k],10*(count[k]-1));
        //printf("temp+=|%d-%d|=%d\n",length[k],target[k],abs(length[k]-target[k]));
      }
    }
    if (canuse){
      //printf("canuse. temp=%d\n",temp);
      ans = std::min(ans, temp);
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 380
n, k = gets.split.map(&:to_i)
p = gets.split.map(&:to_i)
dp = Array.new(n+1)
dp[0] = 0
max_i = 0
max_dp = 0
p.each.with_index(1) do |pi, i|
  dp[i] = dp[i-1] + pi
  dp[i] -= p[i-1-k] if i-1-k >= 0
  if max_dp < dp[i]
    max_dp = dp[i]
    max_i = i
  end
end
puts p[max_i-k,k].map{|pi|pi*(pi+1)/2/pi.to_f}.inject(:+)


Measured memory_bytes: 18052
#include <iostream>
using namespace std;
int main(void){
    string a;
    cin>>a;
    if(a=="Sunny")
    {
        cout<<"Cloudy"<<endl;
        return 0;
    }
    if(a=="Cloudy")
    {
        cout<<"Rainy"<<endl;
        return 0;
    }
    if(a=="Rainy")
    {
        cout<<"Sunny"<<endl;
        return 0;
    }
}

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

using namespace std;

int main() {
    int n1, n2;

    cin >> n1 >> n2;

    if ((n1 > 0 && n1 < 10) && (n2 > 0 && n2 < 10))
        cout << n1 * n2 << endl;
    else 
    cout << "-1" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

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

  int result = 0;

  for (auto c : N) {
    result = (result + std::stoi(std::string{c})) % 9;
  }

  std::cout << ((result == 0) ? "Yes" : "No") << '\n';
}


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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    string S; cin>>S;
    int len = S.size();
    if(S.at(len-1)=='s'){
        cout<<S+"es"<<endl;
    }else{
        cout<<S+"s"<<endl;
    }



    return 0;
}

Measured memory_bytes: 3628
n,y = map(int,input().split())
a,b,c = 10000,5000,1000
for i in range(y//a+1):
    for j in range((y-(a*i))//b+1):
        d = (y-(a*i)-(b*j))//c
        if i+j+d == n:print(i,j,d);exit()
else:print(-1,-1,-1)

Measured memory_bytes: 3064
n, m, x = gets.split.map(&:to_i)
c = []
a = []
INIT = 10 ** 5 * 100
min_cost = INIT
n.times do |i|
  c[i], *a[i] = gets.split.map(&:to_i)
end
for b in 0...(2 ** n) do
  cost = 0
  skill = Array.new(m, 0)
  for i in 0...n do
    if ((b >> i) & 1) == 1
      cost += c[i]
      for j in 0...m do
        skill[j] += a[i][j]
      end
    end
  end
  ok = true
  for j in 0...m do
    if skill[j] < x
      ok = false
      break
    end
  end
  if ok
    min_cost = cost if min_cost > cost
  end
end
puts (min_cost < INIT) ? min_cost : -1


Measured memory_bytes: 14112
#include<bits/stdc++.h>
using namespace std;
int main(){int n,i,mx=0;
           map<string,int>mp;
           cin>>n;
           vector<string>v;
           string str[n];
           for(i=0;i<n;i++){cin>>str[i];
                           mp[str[i]]++;
                           mx=max(mx,mp[str[i]]);}
           for(i=0;i<n;i++){
             if(mp[str[i]]==mx){v.push_back(str[i]);
                               mp[str[i]]--;}
           }
           sort(v.begin(),v.end());
           for(i=0;i<v.size();i++){cout<<v[i]<<endl;}
  return 0;}

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

void bit(int n, vector<bool>& A){
    for(int i = 0; i < 10; i++){
        A[i] = n % 2;
        n = n / 2;
    }
}

int main(void){

    int n; cin >> n;
    bool array[110][11];
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < 10; j++){
            bool input; cin >> input;
            array[i][j] = input;
        }
    }

    long long P[110][12];
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= 10; j++){
            cin >> P[i][j];
        }
    }

    long long ans = -1000000000;
    for(int i = 1; i < 1024; i++){
        vector<bool> A(10, false);
        bit(i, A);
        /*for(int j = 0; j < 10; j++){
            cout << A[j];
        }
        cout << endl;
        */
        int c[110] = {};
        for(int j = 1; j <= n; j++){
            for(int k = 0; k < 10; k++){
                c[j] += (array[j][k] & A[k]);
                
            }
            //cout << c[j] << endl;
        }

        

        long long sum = 0;
        for(int j = 1; j <= n; j++){
            sum += P[j][c[j]];
        }

        ans = max(ans, sum);
    }
    cout << ans << endl;
    
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};
int main() {
    while(1){
        ll N,M;
        cin >>N>>M;
        if(N == 0 && M == 0) break;
        vector<ll> C(M);
        vector<ll> x(N);
        rep(i,M){
            cin >> C[i];
        }

        rep(i,N){
            cin >> x[i];
        }

        vector<vector<ll>> dp(N+2,vector<ll>(256,INF));
        dp[0][128] = 0;
        rep(i,N+1){
            rep(g,256){
                rep(j,M){
                    if(g+C[j] <= 255 && g+C[j] >= 0){
                        chmin(dp[i+1][g+C[j]],dp[i][g]+(g+C[j]-x[i])*(g+C[j]-x[i]));
                    }else if(g+C[j] > 255 ){
                        chmin(dp[i+1][255],dp[i][g]+(255-x[i])*(255-x[i]));
                    }else if(g+C[j] < 0){
                        chmin(dp[i+1][0],dp[i][g]+(0-x[i])*(0-x[i]));
                    }
                }
            }
        }
        ll ans = INF;
        rep(i,256){
            chmin(ans,dp[N][i]);
        }
        cout << ans << endl;
    }



    return 0;
    

}


Measured memory_bytes: 43772
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using vin=vector<int>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;

int main() {
 int n;
  cin>>n;
  vector<tuple<string,int,int>> sp(n);
  rep(i,n){
   string s;
   int p;
    cin>>s>>p;
    sp[i]=make_tuple(s,-p,i);
  
  }
  /////////
  sort(all(sp));
  for(auto v :sp){
   cout<<get<2>(v)+1<<endl; 
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
int main()
{
  int i,j;
  char s[200];
  scanf("%s",s);
  int len=0;
  for(i=0;s[i]!=0;i++)
  len++;
  int cnt=0;
  for(i=0,j=len-1;i<j;i++,j--){
    if(s[i]!=s[j])
        {cnt++;}
  }
  printf("%d",cnt);
  return 0;
    }

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<bool> vbool;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<llint> vllint;
typedef vector<vllint> vvllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define coutans rep(i, ans.size())cout << ans[i] << endl;
#define mod (llint)1000000007
#define int_max 2147483647
#define ll_max (llint)9223372036854775807

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aのb乗を求める(1000000007で割った余りやで)
llint modpow(llint a, llint b) {
	if (b == 0)return 1;
	if (b == 1)return a;
	llint tmp = modpow(a, b / 2);
	tmp %= mod;
	tmp = tmp * tmp % mod;
	if (b % 2)return tmp * a % mod;
	else return tmp;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= mod;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, mod);
		ans %= mod;
	}
	return ans;
}


int main() {
	int n;
	cin >> n;
	vint a(n);
	rep(i, n) {
		cin >> a[i];
		a[i]--;
	}
	int now = 0;
	rep(i, n) {
		if (now == 1) {
			cout << i << endl;
			return 0;
		}
		now = a[now];
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    int cnt = 0;
    repi(i,3,0){
        int n;
        cin >> n;
        if(n == 5)cnt++;
    }
    cout << (cnt==2?"YES":"NO") << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
import math

def cmb(n, r, mod):
    n_1 = 1
    n_2 = 1

    r = min(r, n-r)
    for i in range(1, r+1):
        n_1 = n_1 * i % mod
        n_2 = n_2 * (n - i + 1) % mod

    return (n_2 * pow(n_1, mod - 2, mod))%mod

mod = 10**9+7

X, Y = map(int, input().split())

x = (2*Y - X) / 3
y = (2*X - Y) / 3


if x.is_integer() == False or y.is_integer() == False or x < 0 or y < 0:
    print(0)
else:
    print(cmb(int(x+y), int(x), mod))


Measured memory_bytes: 12492
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    String S = sc.next();
    
    int ans = 0;
    int now = 0;
    for(int i = 0; i < N; i++){
      if(S.charAt(i) == 'I'){
        now++;
      }else{
        now--;
      }
      ans = ans < now ? now : ans;
    }
    
    System.out.println(ans);
  }
}

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

int main() {
    int x, y;
    while(1){
        cin >> x >> y;
        if (x == 0 && y == 0) break;
        if (x < y){
            cout << x << " " << y <<endl;
        }else{
            cout << y << " " << x <<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
V<ll>fac,rfac;void setFac(int n, int mod){fac=V<ll>(++n);fac[0]=1;rfac=fac;FOR(i,1,n)fac[i]=fac[i-1]*i%mod,rfac[i]=modInv(fac[i],mod);}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int k, n;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> k;
  cout << (k==1 ? 0 : n-k) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define INF 1007654321
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }

const int MOD = 1e9 + 7;
const int MAXV = 1e5;

int main() {
    FAST_IO();
    int N, K; cin >> N >> K;
    vector<int> L, R;
    R.push_back(0);
    rep(i, N) {
        int x; cin >> x;
        if(x < 0) L.push_back(-x);
        else R.push_back(x);
    }
    L.push_back(0);
    reverse(all(L));
    ll ans = 1e15;
    repp(x, max(0, K - sz(R) + 1), min(K, sz(L) - 1)) {
        ll q = 2LL * L[x] + R[K - x];
        ans = min(ans, q);
    }
    repp(x, max(0, K - sz(L) + 1), min(K, sz(R) - 1)) {
        ll q = 2LL * R[x] + L[K - x];
        ans = min(ans, q);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vpi vector<pair<int, int>>
#define vvi vector<vector<int>>
#define fi first
#define se second
#define pb push_back
#define ppb pop_back
#define forn(i, x, y) for (int i = (int)x; i < (int)y; ++i)
#define rforn(i, x, y) for (int i = (int)x; i >= (int)y; --i)
#define IOS                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(nullptr);                 \
    cout.tie(nullptr);                \
    cerr.tie(nullptr);
#define cases \
    int t;    \
    cin >> t; \
    while (t--)
// #define d long double
// #define ll long long
// #define ull unsigned long long

const int MOD = 1e9 + 7;

int gcd(int a, int b)
{
    return (b == 0 ? a : gcd(b, a % b));
}
int power(int x, int y)
{
    int ans = 1;

    while (y)
    {
        if (y & 1)
            ans = (ans * x) % MOD;

        y >>= 1;
        x = (x * x) % MOD;
    }
    return ans % MOD;
}

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int32_t main()
{
    IOS;
    int A[5], k;
    for (int i = 0; i < 5; ++i)
    {
        cin >> A[i];
    }
    cin >> k;
    sort(A, A + 5);
    for (int i = 0; i < 5; ++i)
    {
        for (int j = 0; j < 5; ++j)
        {
            int dis = abs(A[i] - A[j]);
            if (dis > k)
            {
                cout << ":(";
                return 0;
            }
        }
    }
    cout << "Yay!";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;//typo用
using uintl = unsigned long long;
using itn = int;//typo用
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a) - 1; i >= (intl)(b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl//1次元配列の出力
#define rrdebug(i, j, x) rep(i, alength(x))rep(j, alength(x[i]))cout << #x << "[" << i << "][" << j << "]:" << x[i][j] << endl//二次元配列の出力
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = acos(-1);
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
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; }
intl gcd(intl a, intl b){ if(!b)return a; return gcd(b, a % b); }
intl lcm(intl a,intl b){ return a / gcd(a, b) * b; }
intl kai(intl k){//k!を求める関数
    intl a = 1;
    for(int i = 2; i <= k; i++){ a *= i; }
    return a;
}
intl digit10(intl a){//aを10進数で表したときの桁数を求める関数
    intl b = 0;
    do{ a /= 10; b++; }while(a);
    return b;
}

signed main(){
    cout << fixed << setprecision(10);
    intl n,m,k;
    cin >> n >> m >> k;
    intl a[n],b[m];
    rep(i,n)cin >> a[i];
    rep(i,m)cin >> b[i];
    intl sumA = 0;
    intl sumB = 0;
    intl sum = 0;
    intl idx = -1;
    rep(i,m){
        if(sumB + b[i] > k)break;
        sumB += b[i];
        sum++;
        idx++;
    }
    intl ans = sum;
    rep(i,n){
        if(sumA + a[i] > k)break;
        sumA += a[i];
        sum++;
        while(sumA + sumB > k){
            sumB -= b[idx--];
            sum--;
            if(idx < -1)break;
        }
        if(idx < -1)break;
        chmax(ans,sum);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6724
#include <stdio.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
char mp[801][802];
int dist[801][801];
int main()
{
	int n,m,k;
	scanf("%d%d%d%*c",&n,&m,&k);
	int sx,sy;
	for (int i=1;i<=n;++i)
	{
		scanf("%s",mp[i]+1);
		for (int j=1;j<=m;++j)
		{
			if (mp[i][j]=='S')
			{
				sx=i;
				sy=j;
			}
		}
	}
	queue<pair<int,int> > q;
	q.push(make_pair(sx,sy));
	memset(dist,-1,sizeof(dist));
	dist[sx][sy]=0;
	while (!q.empty())
	{
		int fx=q.front().first,fy=q.front().second;
		q.pop();
		if (dist[fx][fy]==k)
			continue;
		for (int i=-1;i<=1;++i)
			for (int j=-1;j<=1;++j)
			{
				int ox=fx+i,oy=fy+j;
				if (ox>0&&ox<=n&&oy>0&&oy<=m&&(i==0||j==0)&&mp[ox][oy]!='#'&&dist[ox][oy]==-1)
				{
					dist[ox][oy]=dist[fx][fy]+1;
					q.push(make_pair(ox,oy));
				}
			}
	}
	int mindist=1000000000;
	for (int i=1;i<=n;++i)
		for (int j=1;j<=m;++j)
			if (dist[i][j]!=-1)
			{
				int curdist=min(i-1,min(n-i,min(j-1,m-j)));
				if (curdist<mindist)
					mindist=curdist;
			}
	printf("%d",1+(mindist%k?mindist/k+1:mindist/k));
	return 0;
}


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

int main(){
	// f[i] := 数値 i に対応する文字を返す('a'..'z' or 'A'..'Z')
	char f[100];
	// g[c] := 文字 c に対応する数値を返す(0..51)
	int g[256];
	// 文字の対応を最初に作っておく
	for(int i = 0 ; i < 26 ; i++ ){
		f[i] = 'a' + i;
		g['a' + i] = i;
	}
	for(int i = 0 ; i < 26 ; i++ ){
		f[i + 26] = 'A' + i;
		g['A' + i] = i + 26;
	}
	
	int n, k[101];
	string s;
	while( cin >> n , n ){
		for(int i = 0 ; i < n ; i++ ) cin >> k[i];
		cin >> s;
		
		string t = s;
		for(int i = 0 ; i < s.size() ; i++ ){
			int a = (g[s[i]] - k[i % n] + 52) % 52;
			t[i] = f[a];
		}
		cout << t << endl;
	}
}

Measured memory_bytes: 1212
import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

class Heapq:
    def __init__(self, que=[], asc=True):
        if not asc:
            que = [-a for a in que]
        self.__que = que
        heapq.heapify(self.__que)
        self.__sign = 1 if asc else -1

    def pop(self):
        return heapq.heappop(self.__que) * self.__sign

    def push(self, value):
        heapq.heappush(self.__que, value * self.__sign)

    def pushpop(self, value):
        return heapq.heappushpop(self.__que, value * self.__sign) * self.__sign

    def top(self):
        return self.__que[0] * self.__sign

    def size(self):
        return len(self.__que)


def sol():
    N = int(input())
    edges = [[] for _ in range(N)]

    for _ in range(N - 1):
        fr, to, cost = map(int, input().split())
        fr -= 1
        to -= 1
        edges[fr].append((to, cost))
        edges[to].append((fr, cost))

    Q, K = map(int, input().split())
    K -= 1

    minDist = [float('inf')] * N
    que = Heapq([])
    que.push((0, K))

    while que.size():
        dist, now = que.pop()

        if minDist[now] < dist:
            continue
        minDist[now] = dist

        for to, cost in edges[now]:
            if minDist[to] > dist + cost:
                que.push((dist + cost, to))

    for _ in range(Q):
        fr, to = map(int, input().split())
        print(minDist[fr - 1] + minDist[to - 1])


sol()

Measured memory_bytes: 46540
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9+7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 2e18;


void solve() {
	char c; cin >> c;
	print((char)(c + 1));
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;cin>>q;
	//while(q--)
	solve();
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
//#define int long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#define endl '\n'
using namespace std;
const int N=2e5+10;
ll mod=1e9+7;
deque <int> dp[N][2],dpp[3];
vector <int> g[N];
ll power(ll n,ll k){
    if (k==0) return 1;
    if (k%2==1){
        ll x=power(n,k/2);
        return x*x%mod*n%mod;
    }
    ll x=power(n,k/2);
    return x*x%mod;
}
void merg(ll v,ll u){
    for (int i=0;i<dp[u][0].size();i++){
        ll z=(ll)dpp[0][i]*(ll)dp[u][0][i]%mod;
        z%=mod;
        ll t=(ll)dpp[1][i]*(ll)dp[u][0][i]%mod+(ll)dp[u][1][i]*((ll)dpp[0][i])%mod;
        t%=mod;
        ll k=(ll)dpp[2][i]*((ll)dp[u][1][i]+(ll)dp[u][0][i])%mod+((ll)dpp[1][i]*dp[u][1][i])%mod;
        dpp[0][i]=z;
        dpp[1][i]=t;
        dpp[2][i]=k%mod;
    }
}
void dfs(ll v,ll p){
    for (auto u : g[v]){
        dfs(u,v);
    }
    int bg=-1;
    for (auto u : g[v]){
        if (bg==-1 || dp[u][0].size()>dp[bg][0].size()) bg=u;
    }
    if (bg!=-1){
        dp[bg][0].swap(dpp[0]);
        dp[bg][1].swap(dpp[1]);
    }
    int ma=0;
    for (auto u : g[v]){
        if (bg!=u){
            merg(v,u);
            ma=max(ma,(int)dp[u][0].size());
        }
    }
    for (auto u : g[v]){
        dp[u][0].clear();
        dp[u][1].clear();
        dp[u][2].clear();
        dp[u][0].shrink_to_fit();
        dp[u][1].shrink_to_fit();
        dp[u][2].shrink_to_fit();
    }
    dpp[0].push_front(power(2,mod-2));
    dpp[1].push_front(power(2,mod-2));
    dpp[2].push_front(0);
    for (int i=1;i<=ma;i++){
        dpp[0][i]+=dpp[2][i];
        dpp[0][i]%=mod;
        dpp[2][i]=0;
    }
    swap(dp[v][0],dpp[0]);
    swap(dp[v][1],dpp[1]);
}
int32_t main(){
    sync;
    ll n;
    cin >> n;
    for (int i=1;i<=n;i++){
        ll x;
        cin >> x;
        g[x].pb(i);
    }
    dfs(0,0);
    ll ans=0;
    for (int i=0;i<dp[0][1].size();i++){
        ans+=(ll)dp[0][1][i]%mod*power(2,n+1)%mod;
       // cout << i << " " << dp[0][1][i] << " " << dp[0][1][i]*power(2,n+1)%mod << endl;
        ans%=mod;
    }
    cout << ans%mod << endl;
}


Measured memory_bytes: 481528
#include <bits/stdc++.h>
using namespace std;
char s[510][510], r[510][510], b[510][510] ;
int main() {
    int h, w ;
    cin >> h >> w ;
    for (int i = 1; i <= h; i ++)
        scanf("%s", s[i] + 1) ;
    for (int i = 1; i <= h; i ++)
        for (int j = 1; j <= w; j ++) {
            r[i][j] = b[i][j] = '.' ;
            if (((i & 1) && (j != w)) || j == 1) r[i][j] = '#' ;
            else b[i][j] = '#' ;
        }
    for (int i = 1; i <= h; i ++) {
        for (int j = 1; j <= w; j ++)
            if (s[i][j] == '#') printf("#") ;
            else printf("%c", r[i][j]) ;
        printf("\n") ;
    }
    printf("\n") ;
    for (int i = 1; i <= h; i ++) {
        for (int j = 1; j <= w; j ++)
            if (s[i][j] == '#') printf("#") ;
            else printf("%c", b[i][j]) ;
        printf("\n") ;
    }
    return 0 ;
}


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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

#define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl

int main(){
	int a,b,c,d,e,K; cin>>a>>b>>c>>d>>e>>K;
	int mini = min({a,b,c,d,e});
	int maxi = max({a,b,c,d,e});
	ote(maxi-mini>K?":(":"Yay!");
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(void){
  int n;
  scanf("%d",&n);
  
  int a,b;
  int staff[n];
  int i;
  
  i = 0;
  while(i<n){
    staff[i] = 0;
    i++;
  }
  
  i = 0;
  while(i<n-1){
    scanf("%d",&a);
    b = a-1;
    staff[b] += 1;
    i++;
  }
  
  i = 0;
  while(i<n){
    printf("%d\n",staff[i]);
    i++;
  }
  return 0;
}

Measured memory_bytes: 2480
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#define ll long long
using namespace std;
struct node{int x,y,h;}t[110];
int cx,cy,n;
ll h;
bool cmp(node a,node b)
{
	return a.h>b.h;
}

bool check()
{
	for(int i=1;i<=n;i++)
	{
		ll x=max(h-abs(t[i].x-cx)-abs(t[i].y-cy),0ll);
		if(x!=t[i].h)	return 0;
	}
	return 1;
}

int main()
{
	int i;ll x;
	scanf("%d",&n);
	for(i=1;i<=n;i++)	scanf("%d%d%d",&t[i].x,&t[i].y,&t[i].h);
	sort(t+1,t+n+1,cmp);
	for(cx=0;cx<=100;cx++)
	{
		for(cy=0;cy<=100;cy++)
		{
			x=abs(t[1].x-cx)+abs(t[1].y-cy);
			h=t[1].h+x;
			if(check())	break;
		}
		if(cy<=100)	break;
	}
	printf("%d %d %lld\n",cx,cy,h);
	return 0;
}

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

using namespace std;

template<typename T>
struct BIT {
  std::vector<T> node;
  BIT(int n) : node(n+1, 0) {}
  void add(int idx, T w) {
    for (int i = idx; i < node.size()-1; i |= (i + 1)) {
      node[i] += w;
    }
  }
  T sum(int r) {
    T ret = 0;
    for (int i = r-1; i >= 0; i = ((i & (i+1)) - 1)) {
      ret += node[i];
    }
    return ret;
  }
  T sum(int l, int r) {
    return sum(r) - sum(l);
  }
};

int main() {
  std::cout << std::setprecision(20) << std::fixed;
  int n, k; cin >> n >> k;
  BIT<double> tree(n);

  for (int i = 0; i < n; i++) {
    int p; cin >> p;
    tree.add(i, (1+p)/2.0);
  }
  double ans = 0;
  for (int i = 0; i < n-k+1; i++) {
    ans = max(ans, tree.sum(i, i+k));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	string s; cin >> s;

	int cnt = 15-s.size();
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'o') cnt++;
	}

	if (cnt >= 8) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256