akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int k = sc.nextInt();
		
		// 計算
		long result = 0;
		ArrayDeque<Long> q = new ArrayDeque<Long>();
		q.add(1L);
		q.add(2L);
		q.add(3L);
		q.add(4L);
		q.add(5L);
		q.add(6L);
		q.add(7L);
		q.add(8L);
		q.add(9L);
		for(int i = 0; i < k; i++){
		    result = q.poll();
		    if(result%10 != 0) q.add(result*10 + result%10 - 1);
		    q.add(result*10 + result%10);
		    if(result%10 != 9) q.add(result*10 + result%10 + 1);
		}
		
		// 出力
		System.out.println(result);
	}
}



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

using namespace std;

#define X first
#define Y second
#define eps  1e-5
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;

const int maxn = 2e5+7;
const int INF  = 1<<30;
const int mod  = 1e9+7;

vector<int>G[maxn];
long long res[maxn];

void dfs(int x,long long val,int fa){
	//printf("x = %d ,val = %lld\n",x,val );
	int len = G[x].size();
	res[x] += val;
	val =  res[x];
	for(int i=0;i<len;i++){
		if(G[x][i] != fa){
			dfs(G[x][i],val,x);
		}
	}
}

void solve(){
    int n,m,q,x,y;
    cin>>n>>q;
    for(int i=1;i<n;i++){
    	cin>>x>>y;
    	G[x].pb(y);G[y].pb(x);
    } 
    for(int i=1;i<=q;i++){
    	cin>>x>>y;
    	//printf("x = %d ,y = %d \n",x,y );
    	res[x]+=y;
    }
    dfs(1,0ll,-1);
    for(int i=1;i<=n;i++){
    	printf("%lld%c",res[i], " \n"[i==n] );
    }
    return;
}

int main()
{
#ifndef ONLINE_JUDGE
   // freopen("in.txt","r",stdin);
#endif
//    freopen("out.txt","w",stdout);
//    ios::sync_with_stdio(false);
    int t = 1;
    //scanf("%d",&t);
    while(t--){
    //    printf("Case %d: ",cas++);
        solve();
    }
#ifndef ONLINE_JUDGE
    //printf("%.10f\n",1.0*clock()/CLOCKS_PER_SEC);
#endif
    return 0;
}

Measured memory_bytes: 27392
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, sum, diff;
  cin >> A >> B;
  diff = abs(A-B);
  if (diff < 2){
    sum = A+B;
  }
  else {
    if (A > B){
      sum = A + (A-1);
    }
    else {
      sum = B + (B-1);
    }
  }
  cout << sum << endl;
  return 0;
}

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

typedef struct pp
{
    char name[105];
    int t;
} P;

int n, q;
queue<P> que;


int main()
{
    P p;
    int ti = 0;
    scanf("%d %d", &n, &q);
    for(int i=0;i<n;i++)
    {
        scanf("%s %d", p.name, &p.t);
        que.push(p);
    }
    while(!que.empty())
    {
        P k = que.front();
        que.pop();
        if(k.t<=q)
        {
            ti += k.t;
            printf("%s %d\n", k.name, ti);
        }
        else
        {
            ti += q;
            k.t -= q;
            que.push(k);
        }
    }

    return 0;
}



Measured memory_bytes: 8660
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

int main() {
    int a, b;

    std::cin >> a >> b;

    if (a >= 0 && b >= 0 && a <= b) {
        std::cout << std::abs(b) - std::abs(a) << std::endl;
        return 0;
    }

    if (a >= 0 && b >= 0 && a > b) {
        int ans = std::abs(std::abs(b) - std::abs(a)) + 2;
        if (b == 0) ans--;
        std::cout << ans << std::endl;
        return 0;
    }

    if (a < 0 && b < 0 && a <= b) {
        std::cout << std::abs(std::abs(b) - std::abs(a)) << std::endl;
        return 0;
    }

    if (a < 0 && b < 0 && a > b) {
        int ans = std::abs(std::abs(b) - std::abs(a)) + 2;
        std::cout << ans << std::endl;
        return 0;
    }

    if (a > b) {
        int ans = std::abs(std::abs(b) - std::abs(a)) + 1;
        std::cout << ans << std::endl;
        return 0;
    } else {
        int ans = std::abs(std::abs(b) - std::abs(a));
        if ((a < 0 && b > 0) || (a > 0 && b < 0)) ans++;
        std::cout << ans << std::endl;
        return 0;
    }
}

Measured memory_bytes: 256
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as UV

r2[a,b]=(a,b)
inf=maxBound`div`2
main=do
    [n,w]<-map read.words<$>getLine
    wvs<-UV.replicateM n $ r2.unfoldr(B.readInt.B.dropWhile(<'!'))<$>B.getLine
    print $ f w wvs
f::Int->UV.Vector (Int,Int)->Int
f w wvs = UV.length $ UV.takeWhile(<=w) $ UV.foldl' p (UV.replicate 100000 inf) wvs where
    p v0 (wi,vi) = UV.generate 100000 m where
        m j | j < vi = min (v0 UV.! j) wi
            | j >= vi = min (v0 UV.! j) (wi + v0 UV.! (j-vi))

Measured memory_bytes: 4604
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;
typedef pair<ll, l_l> lll;
ll dp[50][10001];
ll C[105], D[105];
const ll MaxS = 10000;
ll N, M, S;
vector<lll> paths[50];

void Dijkstra() {
    for(int i = 0; i < N; i++) {
        for(int j = 0; j <= MaxS; j++) {
            dp[i][j] = 1e18;
        }
    }
    dp[0][S] = 0;
    priority_queue<lll, vector<lll>, greater<lll>> que;
    que.push({0, {0, S}});
    while(!que.empty()) {
        auto tmp = que.top();
        que.pop();
        ll nowpos = tmp.second.first;
        ll nows = tmp.second.second;
        ll nowcost = tmp.first;
        //cerr << nowpos << " " << nows << " " << nowcost << endl;
        for(auto tmp : paths[nowpos]) {
            ll to = tmp.first;
            ll newcost = tmp.second.second + nowcost;
            ll news = nows - tmp.second.first;
            if(news >= 0) {
                if(chmin(dp[to][news], newcost)) {
                    que.push({newcost, {to, news}});
                }
            }
        }
        ll newcost = nowcost + D[nowpos];
        ll news = nows + C[nowpos];
        chmin(news, MaxS);
        if(chmin(dp[nowpos][news], newcost)) {
            que.push({newcost, {nowpos, news}});
        }
    }
}

int main() {
    cin >> N >> M >> S;
    chmin(S, MaxS);
    for(int i = 0; i < M; i++) {
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        u--;
        v--;
        paths[u].push_back({v, {a, b}});
        swap(u, v);
        paths[u].push_back({v, {a, b}});
    }
    for(int i = 0; i < N; i++) cin >> C[i] >> D[i];
    Dijkstra();
    for(int i = 1; i < N; i++) {
        ll ans = 1e18;
        for(int j = 0; j <= MaxS; j++) {
            chmin(ans, dp[i][j]);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 19256
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fr(i,a,n) for(i=a;i<n;i++)
#define frn(i,a,n) for(i=a;i<=n;i++)
#define vll vector<ll>
#define pll pair<ll,ll>
#define vp vector<pll>
#define ub upper_bound
#define lb lower_bound
//#define map map<ll,ll>
#define mem(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(),v.end()
#define bs binary_search
#define qll queue<ll>
#define sll set<ll>
#define ma 500000
ll power(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return power(x*x,n/2);
    else                             //n is odd
        return x*power(x*x,(n-1)/2);
}
int highestPowerof2(int n)
{
   int p = (int)log2(n);
   return (int)pow(2, p);  
}
ll powermod(ll x, ll y, ll p)  
{  
    ll res = 1;
    x = x % p;
    if (x == 0) return 0;  
  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
}
 
int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    ll val =  a/b;
    if(a%b==0)
    cout<<val*c<<endl;
    else
    cout<<(val+1)*c<<endl;
}


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

int main(){
	int h, w;
	cin >> h >> w;
	int a[26]{};
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			char c;
			cin >> c;
			a[c - 'a']++;
		}
	}
	int one = h * w % 2, two = (h % 2) * w / 2 + h * (w % 2) / 2, four = (h * w - one - 2 * two) / 4;
	int puni = 0, muni = 0, f = 0;
	for(int i = 0; i < 26; i++){
		f += a[i] / 4;
		a[i] %= 4;
		muni += a[i] / 2;
		a[i] %= 2;
		puni += a[i];
	}
	cerr << one << ' ' << two << ' ' << four << endl;
	cerr << puni << ' ' << muni << ' ' << f << endl;
	cout << (one == puni && muni <= two && (two - muni) % 2 == 0 && four == f - (two - muni) / 2 ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;

static void solve(){
 int cnt=0;
 for(;;){
  int n=ir.nextInt();
  if(n==0) break;
  cnt++;
  Vector[] vs=new Vector[n];
  for(int i=0;i<n;i++) vs[i]=new Vector(ir.nextInt(),ir.nextInt());
  double ans=0;
  for(int i=0;i<n;i++) ans+=vs[i].crossP(vs[(i+1)%n])/2;
  out.println(cnt+" "+Math.abs(ans));
 }
}
 
static class Vector{
 
 double x,y;
 
 public Vector(double x,double y){this.x=x; this.y=y;}
 
 public double crossP(Vector v){return this.x*v.y-this.y*v.x;}
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
 
 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
 
 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
 
 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
 
 public boolean hasNext(){skip(); return hasNextByte();}
 
 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }
 
 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
}
}

Measured memory_bytes: 24448
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

int main() {
  int n,m;cin >> n>> m;
  
  cout << (n*(n-1))/2+(m*(m-1))/2;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

template<typename T>
struct BinaryIndexedTree{
    vector<T> data;
    BinaryIndexedTree(int sz){
        data.assign(sz+1, 0);
    }
    // 区間[0,k]の合計
    T sum(int k){
        T ret=0;
        for(++k;k>0;k-=(k&-k)) ret+=data[k];
        return ret;
    }
    void add(int k,T x){
        for(++k;k<data.size();k+=(k&-k)) data[k]+=x;
    }
    int lower_bound(int w){
        int x=0,r=1;
    }
};


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n,q;cin>>n>>q;
    BinaryIndexedTree<ll> bit(n);
    while(q--){
        ll com,x,y;cin>>com>>x>>y;
        if(com==0) bit.add(x-1,y);
        else cout<<bit.sum(y-1)-bit.sum(x-2)<<endl;
    }
    return 0;
}



Measured memory_bytes: 3516
import sys
from sys import stdin,stdout
import bisect
N=input()
A=list(map(int,stdin.readline().strip().split(' ')))
count4=0
count1=0
for i in xrange(len(A)):
    if A[i]%4==0:
        count4+=1
    elif A[i]%2==1:
        count1+=1
if count4>=count1:
    if count4>0:
        print('Yes')
    else:
        if len(A)>1:
            print('Yes')
        else:
            print('No')
else:
    if count4<count1-1:
        print('No')
    elif count4==count1-1:
        if len(A)==count4+count1:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
            
 

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

int main(){
    size_t H, W;
    cin >> H >> W;
    size_t d;
    cin >> d;if(d & 1){
        string s(H + W, 'R');
        for(size_t i = 0; i < H + W; ++i)s[i] ^= (i & 1) << 4;
        for(size_t i = 0; i < H; ++i, cout << endl)copy(s.begin() + i, s.begin() + i + W, ostream_iterator<char>(cout));
    }else{
        vector<vector<char>> c{{'R', 'G'}, {'B', 'Y'}};
        for(size_t i = 0; i < H; ++i, cout << endl)for(size_t j = 0; j < W; ++j)cout << c[(i + j) / d & 1][(i + W - j) / d & 1];
    }
    return 0;
}

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



int main(){
   
    string S;
    cin >> S;
    
    int ans=0;
    int len;
    len=S.size();
    for(int i=2; i<len; i+=2){
        if(S.substr(0,i/2)==S.substr(i/2, i/2)){
            ans=i;
        }
    }
    cout << ans <<endl;
}

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  ll x,y,z;
  cin >> x >> y >> z;

  cout << (x * y) / 2 << endl;

}


Measured memory_bytes: 256
n=int(input())
l=[int(input()) for i in range(n)]
l.sort()
#print(l)
a=0
for i in l:
    a+=i
if a%10!=0:
    print(a)
else:
    for i in l:
        if i%10!=0:
            print(a-i)
            break
    else:
        print(0)

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

int main(){
    vector<int> a(4);
    for(int i=0; i<4; i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());

    if(a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3580
#include <iostream>

using namespace std;

typedef unsigned long long int num;

int main(int argc, char** argv) {
	num n, m;
	cin >> n >> m;
	if (n == 1 && m == 1) {
		cout << 1;
		return 0;
	}
	if (n == 1) {
		cout << m - 2;
		return 0;
	}
	if (m == 1) {
		cout << n - 2;
		return 0;
	}
	cout << (n - 2) * (m - 2);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

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





Measured memory_bytes: 2744
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

#define TRACE(x) cerr << #x << " = " << x << endl
#define REP(i, n) for (int i=0; i<n; i++)
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define _ << " " <<

typedef long long ll;
typedef pair<int, int> P;
#define X first
#define Y second

vector <int> V[4];

int main()
{
  int n, W, x;
  ll w0;

  scanf("%d%d", &n, &W);
  scanf("%lld%d", &w0, &x);
  V[0].push_back(x);

  REP(i, n-1) {
    int w, v;
    scanf("%d%d", &w, &v);
    V[w-w0].push_back(v);    
  }

  REP(i, 4) sort(V[i].begin(), V[i].end(), greater<int>());
  REP(i, 4) {
    FOR(j, 1, (int) V[i].size())
      V[i][j] += V[i][j-1];

    V[i].insert(V[i].begin(), 0);
  }  

  ll rje = 0;
  REP(i1, (int) V[0].size())
    REP(i2, (int) V[1].size())
    REP(i3, (int) V[2].size()) {
    ll tmp = w0 * i1 + (w0+1) * i2 + (w0+2) * i3;
    if (tmp > W) continue;
    ll k = min((ll) V[3].size() - 1, (W - tmp) / (w0 + 3));
    rje = max(rje, (ll) V[0][i1] + V[1][i2] + V[2][i3] + V[3][k]);
  }

  printf("%lld\n", rje); 

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int maxH = 0;
        int result = 0;
        for(int i=0; i<n; i++) {
            int h = in.nextInt();
            if(h >= maxH) {
                result++;
            }
            maxH = Math.max(maxH, h);
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 22612
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> pii;

int n, q;
vector<int> root;
vector< vector<int> > edge;

void update(int p, int v) {
	if(p <= 0 || n < p) return;

	root[p] = v;
	for(int i=0; i<edge[p].size(); i++) {
		if( root[edge[p][i]] == edge[p][i] ) {
			continue;
		} else {
			update(edge[p][i], v);
		}
	}
}

int main() {
	while(cin >> n >> q, n||q) {
		root.clear();
		edge.clear();
		root.resize(n+1);
		edge.resize(n+1);
		for(int i=2; i<=n; i++) {
			int p;
			cin >> p;
			root[i] = 1;
			edge[p].push_back(i);
		}
		root[1] = 1;
		ll sum = 0;
		rep(i, q) {
			char c;
			int v;
			cin >> c >> v;
			if(c == 'Q') {
				sum += root[v];
			} else if(c == 'M') {
				update(v, v);
			}
		}
		cout << sum << endl;
	}
	return 0;
}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int maxn = 18;
int dp[maxn + 1][1 << maxn];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    int n;
    cin >> n;   
    vi a(n), b(n);
    forn(i, n) cin >> a[i];
    forn(i, n) cin >> b[i];

    forn(i, n) forn(j, 1 << n) dp[i][j] = 1e9;
    forn(i, n) dp[i][1 << i] = 0;

    forn(mask, 1 << n) forn(i, n) {
        int p = __builtin_popcount(mask);
        int x = (i % 2 == (p - 1) % 2 ? a[i] : b[i]);
        forn(j, n) { 
            if ((mask >> j) & 1) continue; // j-th bit of mask = 0-th bit of (mask >> j)
            int y = (j % 2 == p % 2 ? a[j] : b[j]);
            if (y < x) continue;
            int D = dp[i][mask] + __builtin_popcount(mask >> j);
            uin(dp[j][mask | (1 << j)], D);
        }
    }

    int ans = 1e9;
    forn(i, n) uin(ans, dp[i][(1 << n) - 1]);
    if (ans > 1e8) ans = -1;
    cout << ans << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


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

using namespace std;
vector < pair < int , bool > > v[20];
bool trusted[20];

int main()
{
    int n;  cin >> n;
    for(int i = 1;i<=n;i++){
        int m;  cin >> m;
        while(m--){
            int x;
            bool t;
            cin >> x >> t;
            v[i].push_back({x , t});
        }
    }
    int Ans = 0;
    for(int i = 0;i<(1 << n);i++){
        memset(trusted , 0 , sizeof(trusted));
        for(int j = 0;j<n;j++){
            if(i & (1 << j)){
                trusted[j + 1] = true;
            }
        }
        bool ok = true;
        for(int j = 1 ; j<=n;j++){
            if(trusted[j]){
                for(auto x : v[j]){
                    if(trusted[x.first] != x.second)  ok = false;
                }
            }
        }
        if(ok){
            int Res =0 ;
            for(int j =1 ;j<=n;j++)  if(trusted[j])  Res++;
            Ans = max(Ans , Res);
        }
    }
    cout << Ans;
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  for(int i = 0; i < n; i++)
    cin >> d[i];
  int m;
  cin >> m;
  vector<int> t(m);
  for(int i = 0; i < m; i++)
    cin >> t[i];

  sort(d.begin(), d.end());
  sort(t.begin(), t.end());
  reverse(d.begin(), d.end());
  reverse(t.begin(), t.end());

  for(int i = 0, j = 0; i < n; i++){
    if(d[i] == t[j]){
      j++;
    } else if(d[i] < t[j]){
      cout << "NO" << endl;
      return 0;
    }
    if(j == m){
      cout << "YES" << endl;
      return 0;
    }
  }

  cout << "NO" << endl;
}


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

int main()
{
	char s[100],t[100];
	int n;
	cin>>n;
	for (int i = 0; i <n; ++i)
	{
		cin>>s[i];
	}
	for (int i = 0; i <n; ++i)
	{
		cin>>t[i];
	}
	char p[200];
	for (int i = 0; i < 2*n; ++i)
	{
		if(i%2==0)
			p[i]=s[i/2];
		else
			p[i]=t[i/2];
	}
	for (int i = 0; i < 2*n; ++i)
	{
		cout<<p[i];
	}
}

Measured memory_bytes: 256
n, k = gets.chomp.split.map(&:to_i)
arr = gets.chomp.split
n.upto(10*n) do |i|
  flag = true
  i.to_s.chars.each do |c|
    if arr.include?(c)
      flag = false
      break
    end
  end
  if flag
    puts i
    exit
  end
end

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

using namespace std;
 
int main() {
		string S;
		cin >> S;

		int length = S.length();

		string res = "";

		for (int i = 0; i < length; i++)
		{
			res += "x";
		}

		cout << res << endl;
		return 0;
}


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

int main(){

    int N;
    cin >> N;
    vector<int> L(N);
    for(int i = 0; i < N; i++) cin >> L[i];

    bool ans = true;

    for(int i = 0; i < N; i++){
        int sum = 0;
        for(int j = 0; j < N; j++){
            if(i == j) continue;
            sum += L[j];
        }
        if(L[i] >= sum){
            ans = false;
            break;
        }
    }

    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

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

    int n,k;
    cin >> n >> k;

    int sum = 0;
    vector<int> w(n),v(n);
    rep(i,n){
        cin >> w[i];
        sum += w[i];
    }
    int l = 0, r = sum;     
    while(l+1 < r){
        int md = (l + r) / 2;  //max_weight P

        int cnt = 1, current = 0;
        bool ok = true;
        rep(i,n){
            //cout << i << endl;;
            if(w[i] > md) ok = false;
            if(current + w[i] > md){
                cnt++;
                current = w[i];
            }else{
                current += w[i];
            }
            //cout << "cnt:" << cnt << endl;
            //cout << "current:" << current << endl; 
            //cout << endl;
        }

        if(ok && cnt<=k) r = md;
        else l = md; 
    }
    
    cout << r << endl;

    return 0;
}



Measured memory_bytes: 4416
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    long long N, A, B, re = 0, res = 0, ans = 0;
    cin >> N >> A >> B;
    re = N / (A + B);
    res = N % (A + B);
    if(res <= A) ans = re * A + res;
    else ans = re * A + A;
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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;}

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

int main(){
    ll n;cin>>n;
    vl a(n),b(n);
    ll sum1=0,sum2=0;
    rep(i,n){cin>>a[i];sum1+=a[i];}
    rep(i,n){cin>>b[i];sum2+=b[i];}
    bool c=true;
    rep(i,n){
        if(a[i]!=b[i])c=false;
    }
    if(c){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(sum2<=sum1){
        cout<<"No"<<endl;
    }
    else{
        ll sum3=0,sum4=0;
        rep(i,n){
            if(b[i]<a[i]){
                sum3+=a[i]-b[i];
            }
            else sum4+=(b[i]-a[i])/2;
        }
        if(sum3>sum4){
            cout<<"No"<<endl;
        }
        else{
            cout<<"Yes"<<endl;
        }
    }
}


Measured memory_bytes: 384
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=gets.to_i
a=get_i
ans=0
N.times do|i|
  if i+1==a[a[i]-1] and i<a[i]
      ans+=1
  end
end
puts ans

Measured memory_bytes: 8708
import java.util.Comparator;
import java.util.PriorityQueue;

public class Main {
	private static int h, w, n;
	private static boolean[] wall;
	private static int[] sx, sy;
	
	private static int[] dx = { 0, 1,  0, -1 };
	private static int[] dy = { 1, 0, -1,  0 };
	
	private static int getInt() throws Exception {
		int i = 0;
		while(true){
			int buf = System.in.read();
			if('0' > buf || buf > '9'){
				break;
			}
			i = i * 10 + buf - '0';
		}
		return i;
	}
	private static int heuristic(final int sx, final int sy, final int ex, final int ey) {
		return Math.abs(sx - ex) + Math.abs(sy - ey);
	}
	private static int search(final int sx, final int sy, final int ex, final int ey) {
		Comparator<int[]> cmp = new Comparator<int[]>() {
			@Override
			public int compare(int[] a, int[] b) {
				return Integer.compare(a[2] + heuristic(a[0], a[1], ex, ey), b[2] + heuristic(b[0], b[1], ex, ey));
			}
		};
		int[] costs = new int[h*w];
		costs[sx + sy*w] = Integer.MAX_VALUE;
		PriorityQueue<int[]> q = new PriorityQueue<>(cmp);
		q.offer(new int[]{sx, sy, 0});
		while(true){
			int[] now = q.poll();
			int newCost = now[2] + 1;
			for(int i = 0; i < 4; i++){
				int nx = now[0] + dx[i];
				int ny = now[1] + dy[i];
				int p = nx + ny*w;
				if(0 <= nx && nx < w && 0 <= ny && ny < h && !wall[p] && (costs[p] == 0 || costs[p] > newCost)){
					if(nx == ex && ey == ny) return now[2] + 1;
					costs[p] = newCost;
					q.offer(new int[]{nx, ny, newCost});
				}
			}
		}
		
	}
	public static void main(String[] args) throws Exception {
		h = getInt();
		w = getInt();
		n = getInt();
		wall = new boolean[h*w];
		sx = new int[10];
		sy = new int[10];
		for(int y = 0; y < h; y++){
			for(int x = 0; x < w; x++) {
				int buf = System.in.read();
				if(buf =='\n' || buf == '\r'){
					x--;
					continue;
				}
				wall[x + y*w] = buf == 'X';
				if(buf == 'S'){
					sx[0] = x;
					sy[0] = y;
				}
				if('1' <= buf && buf <= '9'){
					buf -= '0';
					sx[buf] = x;
					sy[buf] = y;
				}
			}
		}
		int a = 0;
		for(int i = 1; i <= n; i++) a += search(sx[i-1], sy[i-1], sx[i], sy[i]);
		System.out.println(a);
	}

}

Measured memory_bytes: 82176
import java.util.*;

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

        int longestStreak = 0;
        int currentStreak = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'S') {
                currentStreak = 0;
            } else {
                currentStreak++;
                if (currentStreak > longestStreak) { 
                    longestStreak = currentStreak;
                }
            }
        }
        System.out.println(longestStreak);
    }
}


Measured memory_bytes: 26992
#include<cstdio>
#include<cstring>
#include<string>
#include<stack>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  char buf[256];
  while(cin.getline(buf,sizeof(buf))){
    vector<string> s;
    string S = buf;
    int sc = 0;
    S+=" ";

    for(int i=0;i<(int)S.size();i++){
      if(S[i]==' '){
	s.push_back(S.substr(sc,i-sc));
	sc = i+1;
      }
    }
    stack<double> st;
    for(int i=0;i<(int)s.size();i++){
      if(s[i]=="-" || s[i]=="+" || s[i]=="/" || s[i]=="*"){
	double k1 = st.top(); st.pop();
	double k2 = st.top(); st.pop();
	if(s[i]=="+")
	  st.push(k2+k1);
	else if(s[i]=="-")
	  st.push(k2-k1);
	else if(s[i]=="/")
	  st.push(k2/k1);
	else if(s[i]=="*")
	  st.push(k2*k1);
      } else {
	double c;
	sscanf(s[i].c_str(),"%lf",&c);
	st.push(c);
      } 
    }
    printf("%.6lf\n",st.top());
    while(!st.empty()) st.pop();
  }
}

Measured memory_bytes: 1296
#include <bits/stdc++.h>
using namespace std;
int util(vector<int> adj[], int curr, int dp[]){
    if(dp[curr] != -1){
        return dp[curr];
    }
    int res = 0;
    for(int i=0;i<adj[curr].size();i++){
        int next = adj[curr][i];
        res = max(res, 1 + util(adj, next, dp));
    }
    dp[curr] = res;
    return res;
}
int main() {
	int n, m;
	cin>>n>>m;
	vector<int> adj[n];
	for(int i=0;i<m;i++){
	    int x,y;
	    cin>>x>>y;
	    adj[x-1].push_back(y-1);
	}
	int dp[n];
	for(int i=0;i<n;i++){
	    dp[i] = -1;
	}
	int lp = 0;
	for(int i=0;i<n;i++){
	    lp = max(lp, util(adj, i, dp));
	}
	cout<<lp;
	return 0;
}

Measured memory_bytes: 12120
#include<stdio.h>
int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    int A[n][m + 1];
    for(int i = 0; i < n; i++){
        scanf("%d", &A[i][0]);
        for(int j = 1; j <= A[i][0]; j++){
            scanf("%d", &A[i][j]);
        }
    }
    int like = 0;
    int a[m + 1];
    for(int i = 1; i <= m; i++){
        a[i] = 0;
        for(int j = 0; j < n; j++){
            for(int k = 1; k <= A[j][0]; k++){
                if(i == A[j][k]) a[i]++;
            }
        }
        if(a[i] == n) like++;
    }
    printf("%d",like);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define RG register
#define maxn 1000005
#define maxm 205
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}
 
int n, m, w;
struct p{
	int x, y;
}nd[300005];
int ansx,ansy,sx,sy,tot;

map<int,int> mp[2];
int main(){
	int i, j;
	n =read(), m = read(), w = read();
	for(i = 1;i <= w;i++) {
		nd[i].x = read(),nd[i].y = read();
		mp[0][nd[i].x] ++, mp[1][nd[i].y]++;
		if(mp[0][nd[i].x] > ansx) { ansx = mp[0][nd[i].x], sx = 1;}
		else if(mp[0][nd[i].x] == ansx) sx++;
		if(mp[1][nd[i].y] > ansy) { ansy = mp[1][nd[i].y], sy = 1;}
		else if(mp[1][nd[i].y] == ansy) sy++;
	}
	for(i = 1;i <= w;i++){
		if(mp[0][nd[i].x] == ansx && mp[1][nd[i].y] == ansy) tot++;
	}
	int ans = ansx+ansy;
	if(tot == 1ll*sx*sy) ans--;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 34092
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::collections::BinaryHeap;

fn main() {
    let n: usize = read();
    let a: Vec<usize> = read_vec();
    let b: Vec<u32> = read_vec();
    let c: Vec<u32> = read_vec();
    let mut ans: u32 = b.iter().fold(0, |x, y| x + y);

    for i in 0..(n - 1) {
        if a[i + 1] == a[i] + 1 {
            ans += c[a[i] - 1];
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

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

    int N;
    cin>>N;
    vector<ll> P(N);
    rep(i,N)cin>>P[i];
    vector<ll> Q(N);
    rep(i,N)cin>>Q[i];
    vector<ll> v(N);
    rep(i,N)v[i] = i+1;
    /*
    昇順にソート済みのvector（またはstring）を入れると
    辞書順で次の並びのvectorに置き換えてくれる
    辞書順最後になったら -1 を返し止まる
    */
    int cnt = 0;
    int a = 0;
    int b = 0;
    sort(all(v));
    do{
        cnt++;
        //print(v);
        if(v == P)a = cnt;
        if(v == Q)b = cnt;
    }while(next_permutation(all(v)));
    cout<<abs(a - b)<<endl;
};

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

# In[5]:


s = input()


# In[6]:


ans = []
for i,w in enumerate(s):
    if w == "B" and len(ans) != 0:
        ans.pop(-1)
    elif w == "0" or w == "1":
        ans.append(w)
print("".join(ans))


# In[ ]:






Measured memory_bytes: 9036
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mk make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  std::cin >> n>>m;
  std::vector<int> p(m);
  std::vector<string> s(m);
  std::vector<bool> han(n,0);
  int a1=0,aa=0;
  std::vector<int> a2(n,0);
  rep(i,m)std::cin >> p[i]>>s[i];
  rep(i,m)p[i]--;
  rep(i,m){
    if(s[i]=="AC")han[p[i]]=1;
    else{
      if(han[p[i]]==0)a2[p[i]]++;
    }
  }
  rep(i,n)if(han[i])a1++;
  rep(i,n)if(han[i])aa+=a2[i];
  std::cout << a1<<' '<<aa << std::endl;
  
}

Measured memory_bytes: 6528
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String c = sc.next();
		if(c.equals("a") || c.equals("e") || c.equals("i") ||
			c.equals("o") || c.equals("u"))
			System.out.println("vowel");
		else
			System.out.println("consonant");
	}
}

Measured memory_bytes: 9680
#include<iostream>
using namespace std;
int main(){
    int a,b;    cin>>a>>b;
    char s[a+b+2];  cin>>s;
    for(int i=0;i<a+b+2;i++)if(s[i]!='-'&&i==a||s[i]=='-'&&i!=a){cout<<"No"<<endl;return 0;}
    cout<<"Yes"<<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;
using ll = long long;
using P = pair<int,int>;

int main(){
    int a, b, ans;
    cin >> a >> b;
    ans = 0;
    while(ans * a - ans + 1 < b){
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<long,long>
#define vi          vector<long>
#define vii         vector<pii>
#define mi          map<long,long>
#define mii         map<pii,long>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

ll sub(ll a, ll b){return (a-b+hell)%hell;}
ll add(ll a, ll b){return (a+b)%hell;}
ll mul(ll a, ll b){return (a*b)%hell;}



int main()
{
fIO;


/*#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif*/


long long n,sum=0,t=1,m=0;
//cin >> t;
while(t--){
  char c;
cin>>c;
  int x=c;
  x++;
  cout<<(char)x;



}
	
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

import java.io.PrintWriter;

public class Main {
	public static long MOD = 1000000007L;
	public static void main(String[] args) {
		int i=0,j=0,k=0;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		sc.close();
		if(abs(n-m)>1) {
			out.println(0);
			return;
		}
		int mx = Math.max(n, m);
		long[] fa = new long[mx+1];
		fa[0] = fa[1] = 1L;
		for(i=2;i<=mx;i++) {
			fa[i] = i*fa[i-1];
			if(fa[i] >= MOD)fa[i]%=MOD;
		}
		out.println(m==n?(fa[n]*fa[m]*2)%MOD:(fa[n]*fa[m])%MOD);
	}
}


Measured memory_bytes: 22996
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <bitset>
#include <stack>
#include <atcoder/convolution>
#include <atcoder/modint>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
using namespace atcoder;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)

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;
    }
}

lli gcd2(lli x, lli y)
{
    lli t;
    while (y != 0)
        t = x % y, x = y, y = t;
    return (x);
}

lli lcm2(lli x, lli y)
{
    lli xy = x * y;
    if (xy < 0)
        xy = -xy;
    return (xy / gcd2(x, y));
}

int main(void)
{
    int N, M;
    cin >> N >> M;
    vector<long long> a, b;
    long long tmp;
    for (int i = 0; i < N; i++)
    {
        cin >> tmp;
        a.push_back(tmp);
    }
    for (int i = 0; i < M; i++)
    {
        cin >> tmp;
        b.push_back(tmp);
    }
    vector<long long> c = convolution<998244353>(a, b);
    for (int i=0;i<N+M-1;i++)
    {
        cout << c[i] << " ";
    }
  	cout << endl;
    return 0;
}


Measured memory_bytes: 27376
#include <stdio.h>

int main(void)
{
	int cardA, cardB;
	scanf("%d %d", &cardA, &cardB);

	if ( cardA == 1 )
	{
		cardA += 13;
	}

	if ( cardB == 1 )
	{
		cardB += 13;
	}

	if ( cardA > cardB )
	{
		printf("Alice\n");
	}else if ( cardB > cardA ){
		printf("Bob\n");
	}else{
		printf("Draw\n");
	}

	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

#define MAX 100000

int main(void){

	int H, i ,A[MAX + 1];
	
	scanf("%d",&H);
	for(i=1;i<=H;i++){
		scanf("%d",&A[i]);
	}

	for(i=1;i<=H;i++){
		printf("node %d: key = %d, ",i , A[i]);
		if(i/2>=1) printf("parent key = %d, ",A[i/2]);
		if(i*2<=H) printf("left key = %d, ",A[i*2]);
		if(i*2+1<=H) printf("right key = %d, ",A[i*2+1]);
		printf("\n");
	}
return 0;
}



Measured memory_bytes: 2040
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

#include <cmath>
#include <cstdlib>
#include <climits>

//#include <stdio.h>
//#include <stdlib.h>
//#include "show_vector.hh"


using namespace std;

#define debug false

int main(int argc, char *argv[]){

  int A, B;
  int K;

  cin >> A >> B >> K;

  for(int k = 0; k < K; k++){
    if(k % 2 == 0){
      // 高橋くん
      A = A/2;
      B += A;
    }else{
      B = B/2;
      A += B;
    }
  }
  printf("%d %d\n", A, B);
  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    string s; cin >> s;
    ll ac = 0;
    ll bc = 0;
    ll cc = 0;
    REP(i, s.size()) {
        if (s[i] == 'a') {
            ac++;
        } else if (s[i] == 'b') {
            bc++;
        } else if (s[i] == 'c') {
            cc++;
        }
    }
    ll mx = 0;
    ll mn = 10e10;
    mx = max(mx, ac); mx = max(mx, bc); mx = max(mx, cc);
    mn = min(mn, ac); mn = min(mn, bc); mn = min(mn, cc);
    if (mx - mn < 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

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

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

int a[101];

int main() {
    int n;
    vector<ll> b;
    cin >> n;
    ll tmp;
    rep(i, n-1) {
        cin >> tmp;
        b.push_back(tmp);
    }

    a[n-1] = b[n-2];
    for(int i=n-2; i>0; --i) {
        a[i]=min(b[i], b[i-1]);
    }

    a[0] = b[0];

    ll ans=0;
    rep(i, n) {
        ans += a[i];
    }
        
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main()
{
	int n,a = 0,b = 0;
	cin >> n;
	rep(i,n)
	{
		string s,s2;
		cin >> s >> s2;
		if(s > s2) a += 3;
		else if(s < s2) b += 3;
		else
		{
			a++;
			b++;
		}
	}

	cout << a << " " << b << endl;
	return 0;
}

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

int main() {
	int N;
  cin >> N;
  vector<int> H(N);
  int mx = 0;
  int count = 0;
  rep(i,N) {
    int tmp;
    cin >> tmp;
    if(tmp >= mx) count++;
    mx = max(mx,tmp);
  }
  cout << count << endl;

}

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

#define ll long long

using namespace std;

string str = "CODEFESTIVAL2016";

int main() {
    string temp;
    int ans = 0;
    cin >> temp;
    for(int i = 0;i < temp.size();i++){
        if(temp[i] != str[i])
        ans++;
    }
    cout << ans << endl;

	return 0;
}        


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

int main() {
    int n, k;
    while(cin >> n >> k) {
        if (n == 0) break;
        vector<int> card(n);
        rep(i, n) {
            cin >> card[i];
        }
        
        sort(card.begin(), card.end());
        set<int> ans;
        int sum;
        do {
            sum = 0;
            rep(i, k) {
                if (card[i] < 10) {
                    sum = 10 * sum + card[i];
                } else {
                    sum = 100 * sum + card[i];
                }
            }
            ans.insert(sum);
        } while (next_permutation(card.begin(), card.end()));

        cout << ans.size() << endl;
        
    } 
    return 0;
}


Measured memory_bytes: 3224
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    string S;
    cin >> S;
    string T = "ACGT";
    int ma = 0;
    for (int i = 0; i < S.size(); i++) {
        if (find(begin(T), end(T), S.at(i)) == end(T)) continue;
        int cnt = 1;
        for (int j = i + 1; j < S.size(); j++) {
            if (find(begin(T), end(T), S.at(j)) == end(T)) break;
            cnt++;
        }
        ma = max(ma, cnt);
    }
    cout << ma << endl;
}

Measured memory_bytes: 256