akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  int N;
  cin >> N;
  vector< pair<int, int> > A[N];
  
  for(int i = 0; i < N; i++){
    int n;
    cin >> n;
    pair<int, int> a;
    for(int j = 0; j < n; j++){
      cin >> a.first >> a.second;
      a.first--; 
      A[i].push_back(a);
    }
  }

  int res = 0;
  
  for(int i = 0; i < (1 << N); i++){
    vector<int> people(N, 0);
    int num = 0;
    bool flag = true;

    for(int j = 0; j < N; j++){
      if((i >> j) & 1){
	people[j] = 1;
	num++;
      }
    }

    for(int j = 0; j < N; j++){
      if(people[j] == 1){
	for(auto x: A[j]){
	  if(people[x.first] != x.second){
	    flag = false;
	  }
	}
      }
    }

    if(flag){
      res = max(num, res);
    }
  }

  cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <sstream>
using namespace std;
#define pr(x) cout<<x
#define prs cout<<" "
#define prn cout<<"\n"
#define sc(x) cin>>x
#define ll long long int


int dp[100005];
int a[100005];
int n;

int solve(int i)
{
    if(i == (n-1))  return 0;
    if(i >= n)  return INT_MAX;
    if(dp[i] != -1)  return dp[i];
    
    int left = abs(a[i]-a[i+1])+solve(i+1);
    int right = INT_MAX;
    if((i+2) <= (n-1))
       right = abs(a[i]-a[i+2])+solve(i+2);
    dp[i] = min(left, right);
    
    return dp[i];
}
int main()
{
    //ios :: sync_with_stdio(false); cin.tie(0);
    int t=1;
    
    for(int i9 = 1; i9 <= t; i9++)
    {
        cin>>n;
        int res=0;
        //cout<<"Cae #"<<i9<<": "<<res<<endl;
        for(int i=0; i<n; i++)   
           cin>>a[i];
        memset(dp, -1, sizeof(dp));
        cout<<solve(0)<<endl;
        
    }
}

Measured memory_bytes: 5760
#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'
#define kill(x) return cout<<x<<'\n', 0;
using namespace std;
const int N=2e3+10;
char c[N][N];
ll dp[N][N];
int32_t main(){
    sync;
    ll n,m;
    cin >> n >> m;
    for (int i=1;i<=n;i++){
        for (int j=1;j<=m;j++){
            cin >> c[i][j];
        }
    }
    memset(dp,31,sizeof dp);
    if(c[1][1]=='#') dp[1][1]=1;
    else dp[1][1]=0;
    for (int i=1;i<=n;i++){
        for (int j=1;j<=m;j++){
            if (i>1){
                if (c[i][j]=='#'){
                    if (c[i-1][j]=='#'){
                        dp[i][j]=dp[i-1][j];
                    }
                    else{
                        dp[i][j]=dp[i-1][j]+1;
                    }
                }
                else{
                    if (c[i-1][j]=='#'){
                        dp[i][j]=dp[i-1][j];
                    }
                    else {
                        dp[i][j]=dp[i-1][j];
                    }
                }
            }
            if (j>1){
                if (c[i][j]=='#'){
                    if (c[i][j-1]=='#'){
                        dp[i][j]=min(dp[i][j],dp[i][j-1]);
                    }
                    else dp[i][j]=min(dp[i][j],dp[i][j-1]+1);
                }
                else{
                    if (c[i][j-1]=='#'){
                        dp[i][j]=min(dp[i][j],dp[i][j-1]);
                    }
                    else dp[i][j]=min(dp[i][j],dp[i][j-1]);
                }
            }
        }
    }
    cout << dp[n][m];
}


Measured memory_bytes: 33024
import itertools
N,M,Q = map(int,input().split())

Sd = [list(map(int, input().split())) for i in range(Q)]
A = [1] * N

def point(ablock,A):
    p = 0
    for qlist in ablock:
        if(A[qlist[1]-1] - A[qlist[0]-1] == qlist[2]):
            p += qlist[3]
    return p

comb = itertools.combinations_with_replacement(range(1, M+1), N)

ans = 0
for c in comb:
    sug = point(Sd, c)
    if ans < sug:
        ans = sug

print(ans)

Measured memory_bytes: 9224
#include<iostream>

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	int count=0;
	
	for(int i=1;i<=n;i++)
	{
		int p;
		cin >> p;
		if(p==i)
		{
			count++;
			cin >> p;
			i++;
		}
	}

	cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int v[35][35];

int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        int w, t;
        cin >> w;
        for (int j = 1; j <= w; j++) {
            cin >> t;
            v[i][t]++;
        }
    }
    int s = 0;
    for (int i = 1; i <= m; i++) {
        int f = 0;
        for (int j = 1; j <= n; ++j) {
            f += v[j][i];
        }
        if (f == n)
            s++;
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
arr=[[0,1,0] for _ in range(N)]
arr[0]=[1,1,1]
for i in range(M):
  a,b=map(int,input().split())
  arr[a-1][1]-=1
  arr[b-1][1]+=1
  if arr[a-1][0]==1:
    arr[b-1][0]=1
  if arr[a-1][2]==1:
    arr[a-1][2],arr[b-1][2]=0,1
  if arr[a-1][1]==0:
    arr[a-1][0]=0
ans=0
for i in range(N):
  if arr[i][0]==1 and arr[i][1]!=0:
    ans+=1
print(ans)

Measured memory_bytes: 19484
#include <iostream>
using namespace std;
int main(){
    int n;
    int temp,low=1000000;
    
    int ans=0;
    cin>>n;
    for (int x=0;x<n;x++){
        cin>>temp;
        if (temp<low){
            low=temp;
            ans++;
        }
    }
    
    cout<<ans;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 X, Y, A, B, C;
  std::cin >> X >> Y >> A >> B >> C;
  std::vector<i64> p, q, r;
  tools::read(p, A);
  tools::read(q, B);
  tools::read(r, C);

  std::nth_element(p.begin(), p.begin() + (X - 1), p.end(), std::greater<i64>());
  std::nth_element(q.begin(), q.begin() + (Y - 1), q.end(), std::greater<i64>());
  std::priority_queue<i64, std::vector<i64>, std::greater<i64>> old_values;
  for (auto it = p.begin(); it != p.begin() + X; ++it) {
    old_values.push(*it);
  }
  for (auto it = q.begin(); it != q.begin() + Y; ++it) {
    old_values.push(*it);
  }
  std::priority_queue<i64> new_values;
  for (const i64& r_i : r) {
    new_values.push(r_i);
  }
  i64 answer = std::accumulate(p.begin(), p.begin() + X, static_cast<i64>(0)) + std::accumulate(q.begin(), q.begin() + Y, static_cast<i64>(0));

  while (!old_values.empty() && !new_values.empty() && old_values.top() < new_values.top()) {
    answer -= old_values.top();
    answer += new_values.top();
    old_values.pop();
    new_values.pop();
  }

  std::cout << answer << std::endl;
  return 0;
}

Measured memory_bytes: 5872
#include <cstdio>
#include <cstring>
using namespace std;

typedef unsigned int U;
#define L 3194304
bool HA[L];
char T[256];

int main() {
    U n, sum, t;
    char c;
    T['A'] = (char)1, T['C'] = (char)2, T['G'] = (char)3, T['T'] = (char)4;
    scanf("%d", &n);
    while ( getchar() != '\n' );
    for ( U i = 0; i++ < n; ) {
        sum = 0;
        t = 1;
        bool flag = ( c = getchar() ) == 'i';
        while ( ( c = getchar() ) != ' ' );
        while ( ( c = T[getchar()] ) != 0 ) {
            sum += c * t;
            t *= 4;
        }
        if ( flag ) {
            HA[sum] = true;
        } else {
            puts( HA[sum] ? "yes" : "no" );
        }
    }
    return 0;
}

Measured memory_bytes: 2100
n = int(input())
for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = ((xa - xb) ** 2 + (ya - yb) ** 2)**(1/2)
    if d > ra + rb:
        print(0)
    else:
        if d + rb < ra:
            print(2)
        elif d + ra < rb:
            print(-2)
        else:
            print(1)



Measured memory_bytes: 5640
using System;
 
namespace Sample
{
  class Sample
  {
    static void Main()
    {
      var line = System.Console.ReadLine(); 
      string[] arr =  line.Split(' ');
      long a = long.Parse(arr[0]);
      long b = long.Parse(arr[1]);
      
      if(a==1 || b ==1){
        Console.WriteLine(1);
      }else if((a % 2==1) && (b % 2==1)){
      	// 奇数+奇数
      	Console.WriteLine(a*b/2+1);
      }else{
      	Console.WriteLine(a*b/2);
      }
    }
  }
}

Measured memory_bytes: 11092
import sys
import numpy as np
input = sys.stdin.readline
N = int(input())
a = [int(x) for x in input().split()]
a = np.array(a)
a_o = np.count_nonzero(a % 2 == 1)
a_4 = np.count_nonzero(a % 4 == 0)
a_2 = N - a_o - a_4
if a_2 == 0 and a_4 + 1 == a_o:
    print("Yes")
    sys.exit()
if a_o == 1 and a_4 == 0:
    print("No")
    sys.exit()
if a_o == 2 and a_4 == 1 and N == 3:
    print("Yes")
    sys.exit()
if a_o == 2 and a_4 < 2:
    print("No")
    sys.exit()
if a_o >= 3 and a_4 < a_o:
    print("No")
    sys.exit()
print("Yes")


Measured memory_bytes: 23144
#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 x, y, z;
    cin >> x >> y >> z;
    
    cout << z << " " << x << " " << y << endl;

return 0;
}


Measured memory_bytes: 3616
#include <string>
#include <iostream>
 
using namespace std;
 
int main () {
        string text;
        cin >> text;
        for (int i = 0; i < 4; i++) {
                cout << text[i];
        }
        cout << " ";
 
        for (int i = 4; i < 12; i++) {
                cout << text[i];
        }

       cout<<"\n";
       return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
 
#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
 
typedef long long ll;
typedef pair<ll, int> P;
 
ll n,m,ans;
const ll MOD=1000000007;
 
ll calc(ll a) {
	ll sum=1;
	FOR(i,1,a+1) (sum*=i)%=MOD;
	return sum;
}
 
int main(){
	//cin.tie(0);
	//ios::sync_with_stdio(false);
 
	cin>>n>>m;
	if(abs(n-m)>=2) {
		cout<<'0'<<endl;
		return 0;
	}
	if(n==m) {
		ans=calc(n)%MOD;
		(ans*=ans*2)%=MOD;
	}
	else {
		ans=calc(max(n,m))%MOD;
		(ans*=calc(max(n,m)-1))%=MOD;
	}
	cout<<ans%MOD<<endl;
 
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#define pb push_back
#define int ll
#ifndef JOEON
#define D(...)
#define R(x, l)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
int w[50000];
signed main(void)
{
	#ifdef JOEON
//		freopen("C:\Users\Joeon\Desktop\IN.txt", "r", stdin);
//		freopen("C:\Users\Joeon\Desktop\OUT.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k, cnt = 0;
	cin>>n>>k;
	while(k--)
	{
		int p = next<int>();
		while(p--) w[next<int>()] = 1;
	}
	R(w, 100);
	hrp(i, 1, n) if (!w[i]) cnt++;
	cout<<cnt<<endl;
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}


Measured memory_bytes: 3640
//__n1colai__
#include <bits/stdc++.h>
#include<stdint.h>
using namespace std;
#define vi vector<int>
#define pb emplace_back
#define w(t)   int t;cin>>t;while(t--)
#define show(ar) for(int i=0;i<ar.size();i++) cout<<ar[i]<<" "; cout<<endl;
#define mod 1e9+7
#define ff first
#define ss second
#define fio ios::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL);
#define all(x) (x.begin(),x.end())
#define inf 1e9+7
#define MAX 90000000
#define ll long long


int main()
{
	fio
	int n; cin>>n;
	int count=1,num=n;
	while(num%360!=0){
		count++;
		num+=n;
	}
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
long long a, b, c;
int main(){
	scanf("%lld%lld%lld", &a, &b, &c);
	if(c - a - b < 0) return puts("No") * 0; 
	puts(4*a*b < (c-a-b) * (c-a-b) ? "Yes" : "No");
}

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


int N,M;
vector<int> check(vector<int> p){
	vector<int> answer;
	for(int i = 0 ; i < N ; i++) answer.push_back(i);
	for(int i = 0 ; i < M ; i++) swap(answer[p[i]],answer[p[i]+1]);
	return answer;
}
int calc(vector<int> a){
	int h[20];
	for(int i = 0 ; i < M ; i++) h[i] = i;
	while(1){
		int flag = 0;
		for(int i = 0 ; i < M ; i++){
			if( h[i] == 0 ) continue;
			
			int bad = 0;
			for(int j = 0 ; j < M ; j++){
				if( i == j ) continue;
				if( h[i] == h[j] || h[i]-1 == h[j] && ( a[i] == a[j]+1 || a[i]+1 == a[j] || a[i] == a[j])   ){
					bad = 1;
				}
				
			}
			if( !bad ){
				flag = 1;
				h[i]--;
			}
		}
		if(!flag)break;
	}
	
	int ans = 0;
	for(int i = 0 ; i < M ; i++) ans = max(ans,h[i]);
	return ans;
}
int main(){	
	cin >> N >> M;
	int cnt = 0;
	vector<int> a(M);
	for(int i = 0 ; i < M ; i++){
		cin >> a[i];
		a[i]--;
	}
	
	int ans = 1e9;
	vector<int> v = check(a);
	sort(a.begin(),a.end());
	do{
		if( v == check(a) ){
			ans = min(ans,calc(a));
		}
	}while(next_permutation(a.begin(),a.end()));
	cout << ans + 1 << endl;
}
	

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

int H,W;
int L=2;
int tatami[25][25];
int dfs(int x,int y){
	if( x == W ){ y++; x=0; }
	int K = y * W + x + 1;
	if( y == H ){
		/*for(int i = 0 ; i < H ; i++){
			for(int j = 0 ; j < W ; j++) cout << (char)('A'+tatami[i][j]);
			cout << endl;
		}
		cout << endl;
		*/
		return 1;
	}
	if( tatami[y][x] ) return dfs(x+1,y);
	
	if( x && y ){
		int a = tatami[y-1][x-1];
		int b = tatami[y][x-1];
		int c = tatami[y-1][x];
		if( a != b && a != c && b != c ){
			return 0;
		}
	}
	int ans = 0;
	{
		int l = L;
		int h = l / 2;
		if( l % 2 == 0 && x + l <= W &&  y + h <= H ){
			int f = 0;
			for(int j = 0 ; j < h ; j++)
				for(int k = 0 ; k < l ; k++)
					f += tatami[y+j][x+k];
			if(!f){
				for(int j = 0 ; j < h ; j++)
					for(int k = 0 ; k < l ; k++)
						tatami[y+j][x+k] = K;
				ans += dfs(x+1,y);
				for(int j = 0 ; j < h ; j++)
					for(int k = 0 ; k < l ; k++)
						tatami[y+j][x+k] = 0;		
			}
		}
	}
	
	{
		int h = L;
		int l = h / 2;
		if( h % 2 == 0 && x + l <= W &&  y + h <= H ){
			int f = 0;
			for(int j = 0 ; j < h ; j++)
				for(int k = 0 ; k < l ; k++)
					f += tatami[y+j][x+k];
			if(!f){
				for(int j = 0 ; j < h ; j++)
					for(int k = 0 ; k < l ; k++)
						tatami[y+j][x+k] = K;
				ans += dfs(x+1,y);
				for(int j = 0 ; j < h ; j++)
					for(int k = 0 ; k < l ; k++)
						tatami[y+j][x+k] = 0;		
			}
		}
	}
	return ans;
}
int main(){
	while(cin >> H >> W && H){
		int ans = 0;
		for(int i = 2 ; i <= 2 ; i+=2){
			L = i;
			ans += dfs(0,0);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1172
#include <stdio.h>
#include <string.h>
int main(void){
    char s[200001];
    scanf("%s",s);
    int i,j,ans;
    int len=strlen(s);
    for(i=0;s[i]!='\0';i++){
        if(s[i]=='A'){
            for(j=len-1;j>=i;j--){
                if(s[j]=='Z'){
                    ans=j-i+1;
                    printf("%d\n",ans);
                    return 0;
                }
            }
        }
    }
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#define ll long long
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define loop(i,start, stop) for(int i = start; i < (stop); i++)
using namespace std;

int main(){

  int X, N;
  cin >> X >> N;

  if (N == 0){
    cout << X << endl;
    return 0;
  }

  int p[102];
  int buf[102] = {0};
  loop(i,0,N) {
    cin >> p[i];
    buf[p[i]]++;
  }

  bool b_flag = false;
  bool b_flag1 = false;
  bool b_flag2 = false;
  int i=0;
  while(true){
    if(buf[abs(X)] == 0) b_flag = true;
    if(buf[abs(X+i)] == 0) b_flag1 = true;
    if(buf[abs(X-i)] == 0) b_flag2 = true;
    if(b_flag || b_flag1 || b_flag2) break;
    i++;
  }

  if(b_flag) cout << X << endl;
  else if(b_flag2) cout << X-i << endl;
  else if(b_flag1) cout << X+i << endl;

  return 0;
}

Measured memory_bytes: 3600
import sys
import heapq
import numpy as np
input=sys.stdin.readline

n,m=map(int, input().split())
a=list(map(int, input().split()))
h=[]
for val in a:
    heapq.heappush(h, -val)

for _ in range(m):
    val=(-heapq.heappop(h))//2
    heapq.heappush(h, -val)

print(-sum(h))


Measured memory_bytes: 25156
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
char s[100];
int main()
{
	scanf("%s",s);
	for (int i=0;i<strlen(s)-1;i++) if (s[i]=='A'&&s[i+1]=='C') {printf("Yes");return 0;}
	printf("No");
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

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

    rep(i, n)
    {
        vector<int> v(3);

        rep(i, 3) cin >> v[i];

        sort(ALL(v));

        if (v[2] * v[2] == v[1] * v[1] + v[0] * v[0])
        {
            OP("YES")
        }
        else
        {
            OP("NO")
        }
    }

    return 0;
}


Measured memory_bytes: 3104
//
// Created by Hideaki Imamura on 2020-03-22.
//
# include <bits/stdc++.h>

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

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

int N, M;

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

    cout << N * (N - 1) / 2 + M * (M - 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
//============================================================================
// Name        : HelloWorld.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
typedef long long ll;
using namespace std;
int P,Q,R;
int sum=0;

int main() {
	cin>>P>>Q>>R;

	sum=P+Q;
	sum=min(sum,(Q+R));
	sum=min(sum,(R+P));

	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 256
import copy

S = list(input())
T = list(input())

ans = 'UNRESTORABLE'
len_s = len(S)
len_t = len(T)

is_matched = False

for i in range(len_s - len_t + 1):
    s = copy.deepcopy(S)
    for j in range(len_t):
        sc = s[(-1) - i - j]
        tc = T[(-1) - j]
        if sc == tc or sc == '?':
            s[(-1) - i - j] = tc
            if len_t == (j + 1):
                is_matched = True
        else:
            break
    if  is_matched:
        ans = ''.join(s).replace('?', 'a')
        break
print(ans)


Measured memory_bytes: 3444
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <ctime>
#include <queue>
#include <vector>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <assert.h>  
#include <unordered_map>  
#include <string.h>
#include <algorithm>
 
using namespace std;
 
typedef long long ll;
 
#define y1 needtrainharder
#define f first
#define s second
#define gg exit(0)
#define sz() size()
#define pb push_back
#define mp make_pair
#define skip continue
#define all(x) x.begin(), x.end()
#define alln(x, y) x, x + y
#define boost ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL)
#define file(s) if(fopen(task".in", "r"))freopen(s".in","r",stdin),freopen(s".out","w",stdout);
#define task "sorting"    
 
const int inf = 1e9 + 5;  
const ll infll = 1e18 + 5ll;  
const long double eps = 1e-9;
const long double pi = acos(-1);
const int maxn = 3e5;
const ll maxlog = 21;
const int P = 97;
const int mod = 1e9 + 7;   
const int block = 707;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

int n, a[maxn], dp[maxn];

int main() {
  file(task); 
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    dp[i] = inf;
  }
  dp[1] = 0;
  dp[0] = inf;
  for (int i = 2; i <= n; ++i) {
    dp[i] = min({dp[i], dp[i - 1] + abs(a[i - 1] - a[i]), dp[i - 2] + abs(a[i - 2] - a[i])});
  }
  cout << dp[n];
  return 0;
}
/*





*/

Measured memory_bytes: 1024
/*
 * Matheus Oliveira
 * 09:32:46 12/04/2020
 * e.cpp
*/

#include <bits/stdc++.h>
using namespace std;

#define EPS
#define INF
#define MAXN 200010
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define sc(x) scanf("%d", &x);
#define sc2(x, y) scanf("%d %d", &x, &y);
#define sc3(x, y, z) scanf("%d %d %d", &x, &y, &z);
#define debug(x) printf("%s: %d\n", #x, x);
#define debugarr(x, bg, ed) printf("%s: ", #x); for(int i = bg; i < ed; i++) printf("%d%c", x[i], (i == ed-1) ? '\n' : ' ');

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

const ll mod = 1e9 + 7;

ll st[MAXN];

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

ll fexp(ll n, ll e) {
	if(e == 0LL) return 1LL;
	if(e&1LL) return mul(n, fexp(n, e-1LL));
	return fexp(mul(n, n), e >> 1LL);
}

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
		
	st[k] = 1LL;
	ll ans = mul(k, st[k]);

	for(int i = k-1; i >= 1; i--) {
		st[i] = fexp(k/i, n);
		for(int j = i+i; j <= k; j += i) st[i] = sub(st[i], st[j]);
		ans = add(ans, mul(i, st[i]));
	}

	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 4596
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	long long int m, n;
	cin >> n >> m;
	vector<long long int> a(n);
	long long int sigma = 0;
	for(int i=0;i<n;i++){
		cin >> a.at(i);
		sigma += a.at(i);
	}
	sort(a.begin(),a.end());
	long long int b = sigma/(4*m);
	if(sigma%(4*m) != 0){
		b++;
	}
	if(a.at(n-m) >= b){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
N = int(input())
L = []
for i in range(N):
    L.append([])
    A = int(input())
    for j in range(A):
        x,y = map(int, input().split())
        L[i].append([x-1,y])
def check(i, N):
    flg = True
    for j in range(N):
        if i >> j & 1:
            for x, y in L[j]:
                if (i >> x) & 1 != y:
                    flg = False
                    return flg
    return flg
ans = 0
for i in range(2 ** N):
    if check(i, N):
        ans = max(bin(i).count("1"), ans)
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define srt(v) sort(v.begin(),v.end())
int main() {
  int n,m,ans=0;
  cin >> n >> m;
  vector<int> x(m),y(m-1);
  rep(i,m)
    cin>>x[i];
  srt(x);
  rep(i,m-1)
    y[i]=x[i+1]-x[i];
  srt(y);
  rep(i,m-n)
    ans+=y[i];
  cout<<ans;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define range(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, b) for (int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}
template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
	rep(i, v.size()) { os << v[i] << (i == v.size() - 1 ? "" : " "); }
	return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S>& p) {
	os << '(' << p.first << ',' << p.second << ')';
	return os;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (T& x : v) { is >> x; }
	return is;
}

int b, n;
vector<int> a(200);

map<vector<bool>, int> m;

int dfs(vector<bool> obj) {
	if (m.count(obj)) return m[obj];
	auto& res = m[obj];

	int sum = 0;
	rep(i, n) { sum += obj[i]; }
	if (sum <= 1) return res = 0;

	res = b;
	rep(idx, b) {
		vector<bool> x(n, 0), y(n, 0);
		bool xf = 0, yf = 0;
		rep(i, n) {
			if (not obj[i]) continue;
			if ((a[i] >> idx) bitand 1) {
				x[i] = 1;
				xf = true;
			} else {
				y[i] = 1;
				yf = true;
			}
		}
		if (not xf or not yf) continue;
		// show(idx)
		//	cout <<  q  << endl;
		// cout << obj << endl;
		// cout << x << endl;
		// cout << y << endl;
		res = min(res, 1+max(dfs(x), dfs(y)));
	}
	return res;
}

signed main() {
	while (cin >> b >> n, n) {
		m.clear();
		rep(i, n) {
			string s;
			cin >> s;
			a[i] = bitset<11>(s).to_ulong();
		}
		// rep(i,n)cout << bitset<11>(a[i]) << endl;

		cout << dfs(vector<bool>(n, 1)) << endl;
	}
}



Measured memory_bytes: 5544
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <assert.h>
#include <algorithm>
#include <iomanip>
#include <time.h>
#include <math.h>
#include <bitset>

#pragma comment(linker, "/STACK:256000000")

using namespace std;

typedef long long int ll;
typedef long double ld;

const int INF = 1000 * 1000 * 1000 + 21;
const ll LLINF = (1ll << 60) + 5;
const int MOD = 1000 * 1000 * 1000 + 7;


int main()
{
#ifdef CH_EGOR
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen("", "r", stdin);
	//freopen("", "w", stdout);
#endif
	
	int a, b;
	cin >> a >> b;
	string st;
	cin >> st;

	if (st.size() != a + b + 1) return 0 * printf("No\n");

	for (int i = 0; i < a; ++i)
		if (st[i] < '0' || st[i] > 'a') return 0 * printf("No\n");
	
	for (int i = a + 1; i < st.size(); ++i) 
		if (st[i] < '0' || st[i] > 'a') return 0 * printf("No\n");

	if (st[a] != '-') return 0 * printf("No\n");

	printf("Yes\n");
	
	return 0;
}



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

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

  rep(i, N) {
    string S;
    cin >> S;
    
    if (S == "Y") {
      cout << "Four" << endl;
      return 0;
    }
  }
  
  cout << "Three" << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Math;

class Program
{
    static void Main()
    {
        string[] input = Console.ReadLine().Split();
        if (int.Parse(input[1]) == 1)
        {
            Console.WriteLine(0);
            return;
        }
        Console.WriteLine(int.Parse(input[0]) - int.Parse(input[1]));
    }
}


Measured memory_bytes: 13140
import java.io.*;
import java.util.*;

public class Main {
    
    class Answer {
        int N;
        
        public int solve() {
            int max = -1;
            for (int i = 1; i*i<=N; i++) {
                max = Math.max(max, i*i);
            }
            
            return max;
        }
        
        public void main(FastScanner in, PrintWriter out) {
            N = in.nextInt();
            out.println( solve() );
        }
        
        public void p(Object o) { System.out.print(o); }
        public void pl(Object o) { System.out.println(o); }
        public void arp(int[] o) { pl( Arrays.toString(o) ); }
        public void arpp(int[][] o) { 
            for (int i = 0; i < o.length; i++) {
                for (int j = 0; j < o[0].length; j++) { p(o[i][j] + " "); }
                pl("");
            }
        }
        public void ck(Object o1, Object o2) { pl(o1 + " " + o2); }
        public void ckk(Object o1, Object o2, Object o3) { pl(o1 + " " + o2 + " " + o3); }
        public void ckkk(Object o1, Object o2, Object o3, Object o4) { 
            pl(o1 + " " + o2 + " " + o3 + " " + o4);
        }
    }

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        
       Main problem = new Main();
        Answer ans = problem.new Answer();
        ans.main(in, out);
        
        out.close();
        in.close();
    }
    
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(InputStream in) { br = new BufferedReader(new InputStreamReader(in)); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try { st = new StringTokenizer(br.readLine()); } 
                catch (IOException e) { e.printStackTrace(); }
            }
            return st.nextToken();
        }
        public String nextLine() {
            String str = "";
            try { str = br.readLine();
            } catch (IOException e) { e.printStackTrace(); }
            return str;
        }
        public void close() throws IOException { br.close(); }
    }
}

Measured memory_bytes: 21460
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <cmath>
#define all(x) (x).begin(),(x).end()
#define FIRST first 
#define SECOND second
#define FRONT front
#define PUSH_BACK push_back
#define MAKE_PAIR make_pair 
#define EMPTY empty
#define size(x) ((int)(x).size()) 
#define PRIORITY_QUEUE priority_queue
using namespace std;
typedef long long LL;
typedef unsigned int uii;
typedef pair<int,int> pii;
typedef unsigned long long uLL;  
//head

const int maxn = 1001;
const int inf = 5e8;
int n, m;
int d[111][111];
int p[maxn], w[maxn];
int vis[maxn];
std::vector<int> G[maxn];

void init(int x){
	for(int i = 0; i < x; i++){
		G[i].clear();
	}
}

int dfs(int x){
	for(int i = 0; i < size(G[x]); i++){
		int u = G[x][i];
		if(!vis[u]){
			vis[u] = 1;
			if(p[u] < 0 || dfs(p[u])){
				p[u] = x;
				return 1;
			}
		}
	}
	return 0;
}

int match(int x){
	int num = 0;
	memset(p, -1, sizeof(p));
	for(int i = 0; i < x; i++){
		memset(vis, 0, sizeof(vis));
		if(dfs(i)){
			num++;
		}
	}
	return num;
}

int main(int argc, char const *argv[])
{
#ifndef ONLINE_JUDGE
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int L;
	while(cin >> n >> m >> L && n){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(i == j) d[i][j] = 0;
				else d[i][j] = inf;
			}
		}
		init(L);
		for(int i = 0; i < m; i++){
			int x, y, z;
			cin >> x >> y >> z;
			d[x][y] = z;
			d[y][x] = z;
		}
		for(int k = 0; k < n; k++){
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
				}
			}
		}
		for(int i = 0; i < L; i++){
			cin >> p[i] >> w[i];
		}
		for(int i = 0; i < L; i++){
			for(int j = 0; j < L; j++){
				if(d[p[i]][p[j]] + w[i] <= w[j] && i != j){
					G[i].push_back(j);
				}
			}
		}
		cout << L - match(L) << endl;
	}	
	return 0;
}


Measured memory_bytes: 7384
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

class UnionFind:
    """ Union-Find木 """

    def __init__(self, n):
        self.n = n
        # 親要素のノード番号を格納。par[x] == xの時そのノードは根
        # 1-indexedのままでOK、その場合は[0]は未使用
        self.par = [i for i in range(n+1)]
        # 木の高さを格納する（初期状態では0）
        self.rank = [0] * (n+1)
        # あるノードを根とする集合に属するノード数
        self.size = [1] * (n+1)
        # あるノードを根とする集合が木かどうか
        self.tree = [True] * (n+1)

    def find(self, x):
        """ 根の検索(グループ番号と言えなくもない) """
        # 根ならその番号を返す
        if self.par[x] == x:
            return x
        else:
            # 走査していく過程で親を書き換える
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """ 併合 """
        # 根を探す
        x = self.find(x)
        y = self.find(y)

        # 木かどうかの判定用
        if x == y:
            self.tree[x] = False
            return
        if not self.tree[x] or not self.tree[y]:
            self.tree[x] = self.tree[y] = False

        # 木の高さを比較し、低いほうから高いほうに辺を張る
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            # 木の高さが同じなら片方を1増やす
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def is_same(self, x, y):
        """ 同じ集合に属するか判定 """
        return self.find(x) == self.find(y)

    def get_size(self, x=None):
        if x is not None:
            """ あるノードの属する集合のノード数 """
            return self.size[self.find(x)]
        else:
            """ 集合の数 """
            res = set()
            for i in range(self.n+1):
                res.add(self.find(i))
            # グループ0の分を引いて返却
            return len(res) - 1
    
    def is_tree(self, x):
        """ 木かどうかの判定 """
        return self.tree[self.find(x)]

N, M, K = MAP()
uf = UnionFind(N)
ans = [0] * N
# 友達の数を引く
for i in range(M):
    a, b = MAP()
    a -= 1; b -= 1
    uf.union(a, b)
    ans[a] -= 1
    ans[b] -= 1
# 同じグループ内全部(自分除く)を足す
for a in range(N):
    ans[a] += uf.get_size(a) - 1
# 同じグループなら、ブロックの数を引く
for i in range(K):
    a, b = MAP()
    a -= 1; b -= 1
    if uf.is_same(a, b):
        ans[a] -= 1
        ans[b] -= 1
print(*ans)


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

// long long l[100];

int main() {
  int a,b,c; 
  cin >> a >> b >> c;
  if (a+b>=c) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;

using namespace std;


int main() {
	ios::sync_with_stdio(false);
	cin >> N >> L >> R >> K >> Q;
	for (int i = 0; i < N - 1; i++) {
		long long int big = Q*i - K*(N - 1 - i);
		long long int small = K*i - Q*(N - 1 - i);
		if (L + big >= R&&L + small <= R) {
			cout << "YES\n";
			return 0;
		}
	}
	cout << "NO\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
    ll N,sum=0;
    cin >>N;
    for(ll i =1;i<=N;i++){
        for(ll j=1;j<=N;j++){
            ll x = 0,A = i,B = j;
            if(A<B){
                swap(A,B);
            }
            while(1){
                x =A%B;
                if(x==0){
                    break;
                }else
                {
                    A=B;
                    B=x;
                }
            }
            ll tmp=B;
            for(ll k=1;k<=N;k++){
                x = 0,A = tmp,B = k;
                if(A<B){
                    swap(A,B);
                }
                while(1){
                    x =A%B;
                    if(x==0){
                        break;
                    }else
                    {
                        A=B;
                        B=x;
                    }
                }
                sum+=B;
            }
        }
    }
    cout << sum << endl;
    return 0;    
}


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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    int N;
    scanf("%d", &N);
    vector<int> p(N);
    vector<int> q(N);
    int cnt = 0;
    REP(int, i, 0, N){ 
        scanf("%d", &p.at(i));
        q.at(i) = p.at(i);
    }

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

    REP(int, i, 0, N){
        if ( p.at(i) != q.at(i) ) cnt++;
    }
    
    if ( cnt == 0 || cnt == 2 ) printf("YES\n");
    else printf("NO\n");

    return 0;
}

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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  int pos = 0;
  int a;
  rep(i, N)
  {
    cin >> a;
    if (a == 1)
    {
      pos = i;
    }
  }

  int sum = 0;
  int left = pos;
  int right = N - pos - 1;

  sum += left / (K - 1);
  sum += right / (K - 1);

  int mod_l = left % (K - 1);
  int mod_r = right % (K - 1);
  if (0 < mod_l + mod_r && mod_l + mod_r <= K - 1)
    sum++;
  else
  {
    if (mod_l > 0)
      sum++;
    if (mod_r > 0)
      sum++;
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int a,b=0;
  scanf("%d%d",&a,&b);
  if(a < b)
    printf("a < b\n");
  if(a > b)
    printf("a > b\n");
  if(a == b)
    printf("a == b\n");
  return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

int main (int argc, char* argv[]) {
	int n, k;
	cin >> n >> k;

	double res = 0.0;
	for (int i = 1; i <= n; i++) {
		int c = i;
		double c_res = 1.0;
		while (c < k) {
			c_res *= 0.5;
			c *= 2;
		}
		res += c_res / n;
	}

	cout << setprecision(20) << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
int n, k;
std::vector<int> h;
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cin >> n >> k;
    if (k > n)
        k = n;
    h.resize(n);
    for (int i = 0; i < n; ++i)
        std::cin >> h[i];
    std::sort(h.begin(), h.end());
    std::cout << std::accumulate(h.begin(), h.begin() + n - k, 0LL) << "\n";
    return 0;
}

Measured memory_bytes: 1024
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    public void solve() {
    	char C = ns().toCharArray()[0];
    	out.println((char)(C + 1));
	}
    static class PP{
    	public int key, val;
    	public PP(int key, int val) {
    		this.key = key;
    		this.val = val;
    	}
		public int getKey() {
			return key;
		}
		public void setKey(int key) {
			this.key = key;
		}
		public int getVal() {
			return val;
		}
		public void setVal(int val) {
			this.val = val;
		}
    }

    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return sc.nextInt();
    }
    public long nl() {
    	return sc.nextLong();
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] nddi(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//入力（Nと配列）
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.nextLine());
		int[] PList = new int[N];

		//左に自分より小さい数があればNG
			//今まで出てきた最も小さい数を記憶する。比較する。
		//配列の最初は比較対象がない。
		PList[0] = sc.nextInt();
		int minNumber = PList[0];
		int cnt=1;

		for(int i=1;i<N;i++) {
			PList[i] = sc.nextInt();
			if(minNumber>=PList[i]) {
				minNumber = PList[i];
				cnt++;
			}else {
			}
		}
		System.out.println(cnt);
	}
}


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

int main() {
		int a,b;

		cin >> a;
		cin >> b;

		if (a < b)
				cout << "a < b" << "\n";
		else if (a > b)
				cout << "a > b" << "\n";
		else 
				cout << "a == b" << "\n";
		
		return 0;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 1000000
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
struct P{int id;ll s;}a[N];
inline bool cmp(P x,P y){return x.s>y.s;}
map<ll,int> go; vector<int> e[N];
int sz[N],fa[N],n,dep[N]; ll D,gg[N];
void dfs1(int x,int la=0)
{	dep[x]=dep[la]+1; D+=dep[x];
	for(auto y:e[x]) dfs1(y,x);
}
void dfs2(int x,ll d)
{	if(d!=gg[x]){printf("-1");exit(0);}
	for(auto y:e[x]) dfs2(y,d+n-2*sz[y]);
}
int main()
{	cin>>n;
	for(rint i=1;i<=n;i++) scanf("%lld",&a[i].s),a[i].id=i,go[a[i].s]=i,gg[i]=a[i].s;
	sort(a+1,a+n+1,cmp);
	for(rint i=1;i<=n;i++) sz[i]=1;
	for(rint i=1;i<n;i++)
	{	int x=a[i].id; if(2*sz[x]-n>=0) return !printf("-1");
		ll sfa=a[i].s+2*sz[x]-n;
		if(!go[sfa]) return !printf("-1");
		fa[x]=go[sfa]; sz[fa[x]]+=sz[x];// debug(x);debug(fa[x]);
	}
	for(rint i=1;i<=n;i++) if(fa[i]) e[fa[i]].push_back(i);
	int rt=0; for(rint i=1;i<=n;i++) if(!fa[i]) rt=i;
	dep[0]=-1; dfs1(rt); dfs2(rt,D);
	for(rint i=1;i<=n;i++) if(fa[i]) printf("%d %d\n",i,fa[i]);
	return 0;
}


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

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

  int n; cin >> n;
  string s1,s2;
  cin >> s1 >> s2;
  int mod = 1000000007;

  ll ans;
  bool is_befv;
  rep(i, n) {
    bool is_v = s1[i] == s2[i];

    if(i == 0) {
      ans = is_v ? 3 : 6;
      is_befv = is_v;
      if(!is_v) i++;
      continue;
    }

    if(is_befv) {
      if(is_v) {
        ans = (ans * 2) % mod;
      } else {
        ans = (ans * 2) % mod;
      }
    } else {
      if(!is_v) {
        ans = (ans * 3) % mod;
      }
    }

    if(!is_v) i++;
    is_befv = is_v;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int i,j;

	for(i = 1 ; i < 10 ; i++){
		for(j = 1 ; j < 10 ; j++){
			printf("%dx%d=%d\n",i,j,i*j);
		}
	}
	
	return 0;
}

Measured memory_bytes: 524
import java.io.BufferedReader;
//import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		//System.setIn(new FileInputStream("./input.txt"));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] t = br.readLine().split(" ");
		int[] a = new int[n];
		for(int i = 0; i < n; ++i) {
			a[i] = Integer.parseInt(t[i]);
		}

		int q = Integer.parseInt(br.readLine());
		t = br.readLine().split(" ");
		int[] m = new int[q];
		for(int i = 0; i < q; ++i) {
			m[i] = Integer.parseInt(t[i]);
		}
		
		int sum;
		boolean[] flag = new boolean[q];
		for(int i = 1; i < Math.pow(2, n); ++i) {
			sum = 0;
			for(int j = 0; j < n; ++j) {
				if((i & (1 << j)) > 0){
					sum += a[j];
				}
			}
			for(int k = 0; k < q; ++k) {
				if(sum == m[k]) {
					flag[k] = true;
				}
			}
		}
		for(int k = 0; k < q; ++k) {
			if(flag[k]) {
				System.out.println("yes");
			}else{
				System.out.println("no");
			}
		}
	}

}

Measured memory_bytes: 25880
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 998244353LL

bool dbgflag = false;


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15);
  
  ll n;
  cin >> n;
  
  string nm = "";
  while (n > 26) {
    //cout << n % 26 << endl;
    nm += ((n % 26 == 0) ? 'z' : ('a' -1 + (n % 26)));
    if (n % 26 == 0) n--;
    n /= 26;
  }
  nm += ((n % 26 == 0) ? 'z' : ('a' -1 + (n % 26)));

  reverse(nm.begin(), nm.end());
  cout << nm << endl;
}


Measured memory_bytes: 3652