akhauriyash/Code-Regression huggingface dataset:
N = int(input())
D = []
c = 0
for i in range(N):
  D.append([int(i) for i in input().split()])
for d in D:
  if d[0] == d[1]:
    c += 1
  else:
    c = 0
  if c == 3:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 9180
#include <bits/stdc++.h>
  #define hell                         1000000007 
  #define M                            1000000007
  #define Maxi                      10000000000000000
      #define lcm(a,b)                     (a*b)/__gcd(a,b)
      #define ll                           long long

      #define vll                          vector<ll>
      #define vi                           vector<long long>
      #define pll                          vector< pair<ll,ll> >
      #define pb                           push_back
      //#define mp                           make_pair
      #define all(v)                       v.begin(),v.end()
      #define lbnd                         lower_bound
      #define ubnd                         upper_bound
      #define bs                           binary_search
      #define F                            first
      #define S                            second
      #define rep(i,a,b)                   for(i=a;i<b;i++)
      #define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
      #define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
      #define ret(x)                       return cout<<x,0;
      #define dbg(x)                       cout << #x << " is " << x << endl;
      //#define endl                           '\n'
   
   
      // Debug //
   
      #define trace(x)                 cerr << #x << ": " << x << endl;
      #define trace1(x)                cerr << #x << ": " << x << endl;
      #define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
      #define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
      #define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
      #define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
      #define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;


  using namespace std;

bool f(ll n)
{
  ll c=0;
  while(n!=0)
  {
    n/=10;
    c++;

  }
  if(c%2==1)
    return 1;
  return 0;
}


  int main()
  {

        ios_base::sync_with_stdio(false);
        cin.tie(NULL);cout.tie(NULL);
      
        
        ll arr[100005];
        arr[0]=0;

        arr[1]=1;
        ll i,j;
        for(i=2;i<=100000;i++)
        {
          if(f(i))
          {
            arr[i]=1+arr[i-1];
          }
          else
          {
            arr[i]=arr[i-1];
          }
        }
        ll n;
        cin>>n;
        cout<<arr[n]<<endl;

        
    return 0;

        
    }



  //10773275
  //4306643

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int dp[110][5040];
int d[100],a[100],del[110];
map<vector<int>,int> encord;
map<int,vector<int> > decord;
int brute(int n){
	vector<int> v(n);
	for(int i=0;i<n;i++)v[i]=i;
	int ans=0,cnt=0;
	do{
		int tmp=0;
		memset(del,0,sizeof(del));
		for(int i=0;i<(int)v.size();i++){
			tmp+=del[v[i]];
			for(int j=max(0,v[i]-d[v[i]]);j<=min(n-1,v[i]+d[v[i]]);j++){
				del[j]+=a[v[i]];
			}
		}
		ans=max(ans,tmp);
		encord[v]=cnt;
		decord[cnt]=v;
		dp[n-1][cnt]=tmp;	cnt++;
	}while(next_permutation(v.begin(),v.end()));
	return ans;
}	

int main(){
	int n;	cin>>n;
	for(int i=0;i<n;i++)	cin>>d[i];
	for(int i=0;i<n;i++)	cin>>a[i];
	if(n<=7){
		cout<<brute(n)<<endl;
		return 0;
	}
	else 	brute(7);
	for(int i=7;i<n;i++){
		for(int j=0;j<5040;j++){
			vector<int> v=decord[j];
			vector<int> next(8),prv(7);
			for(int t=0;t<8;t++){//新しく食べるi番目の順番
				next[t]=7;
				for(int k=0;k<7;k++){
					if(k>=t)	next[k+1]=v[k];
					else 	next[k]=v[k];
				}
				int tmp=0;
				memset(del,0,sizeof(del));
				for(int k=0;k<8;k++){
					int pos=(i-7)+next[k];
					tmp+=del[pos];
					for(int l=max(i-7,pos-d[pos]);l<=min(i,pos+d[pos]);l++){
						if(l==i||pos==i)	del[l]+=a[pos];
					}
				}
				int cnt=0;
				for(int k=0;k<8;k++){
					if(next[k]!=0){
						prv[cnt]=next[k]-1;
						cnt++;
					}
				}
				int e=encord[prv];
				dp[i][e]=max(dp[i][e],dp[i-1][j]+tmp);
			}
		}
	}
	auto ans=max_element(dp[n-1],dp[n-1]+5040);
	cout<<*ans<<endl;
	return 0;
}

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

int gcd(int x, int y){
    if(y == 0){
        return x;
    }
    else {
        return gcd(y, x%y);
    }
}

int main(){
    int n;
    cin >> n;
    vector<int> v(n, 0);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }

    vector<int> l(n), r(n);

    for(int i = 0; i < n-1; i++){
        l[i+1] = gcd(l[i], v[i]);
        //cout << l[i+1] << endl;
    }

    for(int i = n-1; i >= 1; i--){
        r[i-1] = gcd(r[i], v[i]);
        ///cout << r[i-1] << endl;
    }
    
    int ans = 1;
    for(int i = 0; i < n; i++){
        ans = max(ans, gcd(l[i], r[i]));
        //cout << gcd(l[i], r[i]) << endl;
    }
    cout << ans << endl;

}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int n,m;
  	cin>>n>>m;
  	vector<int>a(n);
  	for(int i=0;i<n;i++){
    	cin>>a[i];
    }
  	int s=0;
  	for(int i=0;i<n;i++){
    	s+=a[i];
    }
  	int cnt=0;
  	for(int i=0;i<n;i++){
    	if(a[i]*(4*m) >= s){
        	cnt++;
        }
    }
  	if(cnt>=m){
    	cout << "Yes" << endl;
    }
  	else{
    	cout << "No" << endl;
    }
  	return 0;
}

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

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


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <cctype>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <stack>
#include <unordered_set>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <queue>
#include <unordered_map>

int main() {
	int32_t n;
	std::cin >> n;

	int32_t* coords = new int32_t[n];
	for(int32_t i = 0; i < n; i++) {
		std::cin >> coords[i];
	}

	int64_t best_total = INT64_MAX;
	for(int32_t i = 1; i <= 100; i++) {
		int64_t total = 0;
		for(int32_t j = 0; j < n; j++) {
			int32_t dx = coords[j] - i;
			total += dx * dx;
		}
		best_total = std::min(best_total, total);
	}
	std::cout << best_total;
	return 0;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define N 100000

typedef struct{
	char name[100];
	int time;
} P;


void enqueue(P);
P dequeue(void);

int n;
int head=0, tail=0;
P Q[N+1];

int main()
{
	int i,q;
	int st=0,cnt=0;
	P u;
	
	scanf("%d%d",&n,&q);
	
	for(i=1;i<=n;i++){
		scanf("%s",Q[i].name);
		scanf("%d",&Q[i].time);
	}
	
	head = 1;
	tail=n+1;
	while(cnt < n)
	{
		if(Q[head].time <= q)
		{
			st = st + Q[head].time;
			u = dequeue();
			printf("%s %d\n", u.name, st);
			cnt++;
		}
		else
		{
			st = st + q;
			Q[head].time = Q[head].time - q;
			u = dequeue();
			enqueue(u);
		}
	}
	return 0;
}

void enqueue(P x) {
	Q[tail] = x;
	if(tail + 1 == N){
		tail = 0;
	}
	else{
		tail++;
	}
}
 
P dequeue(void) {
	P x;
	x = Q[head];
	if(head + 1 == N)
	{
		head = 0;
	}
	else
	{
		head++;
	}
	return x;
}

Measured memory_bytes: 10756
#include<bits/stdc++.h>
using namespace std;
const int N= 1e5+10;
string a[N];
map<string,long long> p;
int main(){
	int n;
	cin>>n;
	getchar();
	for(int i=0;i<n;i++){
	//	getchar();
		cin>>a[i];
		
	//	int len=a[i].size();
		sort(a[i].begin(),a[i].end());
		if(!p.count(a[i]))	p[a[i]]=1;
		else p[a[i]]++;
	}
	long long cnt=0;
	map<string,long long>::iterator it;
	for(it=p.begin();it!=p.end();it++){
		long long k=it->second;
		if(k>1) cnt=cnt+(k-1)*k/2;
	}
	cout<<cnt<<endl;
}  

Measured memory_bytes: 18176
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int ans=0,n;
  cin>>n;

  for(int i=1;i<=n;i++){
    if((i>=1)&&(i<=9)){
      ans++;
    }
    if((i>=100)&&(i<=999)){
      ans++;
    }
    if((i>=10000)&&(i<=99999)){
      ans++;
    }
  }
  cout << ans << endl;
}

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

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

const ll mod =  1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

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

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

int main() {
	double n;
	while(cin >> n){
		double ans = n;
		double prev = n;
		for(int i = 2; i <= 10; ++i){
			if(i % 2){
				prev = prev / 3.0;
				ans += prev;
			}
			else{
				prev = prev * 2.0;
				ans += prev;
			}
		}
		printf("%f\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <set>
#include <map>
#include <array>
#include <cassert>
#include <cstring>
#include <vector>
#include <list>
#include <algorithm>

#define forn(i, n) for (int i = 0; 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)

#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
#define eb emplace_back
#define pb push_back
#define mp make_pair

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

using namespace std;

typedef pair<int, int> pii;
typedef vector<pii> vpi;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef list<int> li;
typedef vector<li> vli;
typedef vector<vpi> vvpi;
typedef long long i64;

const int inf = 1e9;

void solve_a() {
  int a,b,c;
  cin >> a >> b >> c;
  i64 k;
  cin >> k;
  // a, b, c = a-b
  // b+c, a+c, a+b = b-a
  // 2a+b+c, 2b+a+c, 2c+a+b = a-b
  // 2a+3b+3c, 3a+2b+3c, 3a+3b+2c = b-a
  a = (k & 1) ? b - a : a - b;
  cout << a << endl;
}

void solve_b() {
  int n; cin >> n;
  vi a(n); forn(i, n) cin >> a[i];
  vi b(n + 1, 0);
  for(int x: a) b[x] = b[x-1] + 1;
  cout << n - *max_element(all(b)) << endl;
}

void solve_c() {
  int n; cin >> n;
  vi a(n); forn(i, n) cin >> a[i];
  i64 r = -1;
  if (a[0] == 0) {
    r = 0;
    ford(i, n) {
      int d = a[i] - a[i-1];
      if (d > 1) {
        r = -1;
        break;
      } else if (d == 1) {
        r += 1;
      } else r += a[i];
    }
  }
  cout << r << endl;
}

int main() {
#ifdef HOME
  freopen("input.txt", "rt", stdin);
#endif
  solve_c();
  return 0;
}


Measured memory_bytes: 1152
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <functional>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  string s;
  cin >> s;

  string t = s;
  reverse(t.begin(),t.end());
  int ans = 0;
  for(int i = 0;i < s.size();i++){
    if(s[i] != t[i])ans++;
  }

  cout << ans/2 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt(), Y = sc.nextInt(), Z = sc.nextInt();
		int ans = 0;
		for (int i = Z; i <= X - Y - Z; i += Y + Z) {
			ans++;
		}
		sc.close();
		System.out.println(ans);
	}
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll N, M;
  cin >> N >> M;
  vector<P> A(M);
  rep(i, M) cin >> A[i].second >> A[i].first;
  SORT(A);
  ll ans = 0;
  ll cursor = -INF;
  rep(i, M) {
    if (A[i].second >= cursor) {
      ans += 1;
      cursor = A[i].first;
    }
  }
  ANS;
  return 0;
}

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

int main() {
  vector<int> v(3);
  for (int i=0;i<3;++i) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  int t=v[0]+v[1];
  cout<<t<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#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;

int gojou(int a){
    return a*a*a*a*a;
}

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

    int x;
    cin >> x;

    int a,b;
    for(a=-1000;a<=1000;a++){
        for(b=-1000;b<=1000;b++){
            if(gojou(a)-gojou(b) == x){
              cout << a << " " << b << endl;
              return 0;
            }
        }
    }


    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> A(n), B(n);
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> B[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += max(A[i]-B[i], 0);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
A=[0,0,0]
A[0]=int(input())
A[1]=int(input())
A[2]=int(input())
X=int(input())

ans=0
for i in range(A[0]+1):
    for j in range(A[1]+1):
        rem=X-500*i - 100*j
        CC=rem//50
        if CC>=0 and CC<=A[2]:
            ans+=1
            
print(ans)
    




Measured memory_bytes: 38896
#include <bits/stdc++.h>
using namespace std;
int main() {
  long A, B, N;
  cin >> A >> B >> N;
  if (B - 1 > N) {
    cout << A * N / B << endl;
  } else {
    cout << A * (B - 1) / B << endl;
  }
  return 0;
}

Measured memory_bytes: 3640
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  int n;cin>>n;
  int a[n];
  REP(i,n){
    cin>>a[i];
  }
  int count = 0;
  for(int i=1;i<n-1;i++){
    if((a[i-1]>a[i]&&a[i]>a[i+1])||(a[i-1]<a[i]&&a[i]<a[i+1])){
      count++;
    }
  }
  cout<<count<<endl;

 

  return 0;
}

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

int main() {
  string s;
  cin >> s;
  for (char i = 'a'; i <= 'z'; i++) {
    if (s.find(i) == -1) {
      cout << i << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

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


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

	ll n, final = 0;	cin >> n;

	for (ll i = 2; i * i <= n; i++) {
		ll x = n;
		while (x % i == 0)	x /= i;
		if (x % i == 1)		final++;
	}

	ll x = n - 1;

	for (ll i = 1; i * i <= x; i++)
		if (x % i == 0 && (x / i) > sqrt(n))		final++;

	cout << final + 1 << endl;

	return 0;
}

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

int main() {
  int n;
  cin >> n;
  bool ok = true;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (x % 2 == 0) {
      if (x % 3 != 0 && x % 5 != 0) {
        ok = false;
      }
    }
  }
  cout << (ok ? "APPROVED" : "DENIED") << endl;
}


Measured memory_bytes: 256
import std.stdio, std.range, std.conv, std.string;
import std.algorithm.comparison, std.algorithm.iteration, std.algorithm.mutation, std.algorithm.searching, std.algorithm.setops, std.algorithm.sorting;

void main()
{
    int[] input = readln().split.to!(int[]);
    int H = input[0];
    int W = input[1];
    input = readln().split.to!(int[]);
    int h = input[0];
    int w = input[1];
    writeln((H-h)*(W-w));
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
S = input()
Sc = Counter(S)
rgb = Sc["R"] * Sc["G"] * Sc["B"]
for j in range(1, N-1):
    for i in range(j):
        k = j + (j-i)
        assert i < j < k
        if k < N:
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                rgb -= 1
print(rgb)

Measured memory_bytes: 68856
#include <bits/stdc++.h>
using namespace std;
string s;
int n,x,y,m;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n>>s;
for(int i=0;i<n;i++){
    if(s[i]=='I')x++;
    else if(s[i]=='D')x--;
    m=max(x,y);
    if(x>y)y=x;

    }
cout<<m;
return 0;}



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

inline int check(char c, int k){
  if( k == 0 && c == 'J' ) return 1;
  if( k == 1 && c == 'O' ) return 1;
  if( k == 2 && c == 'I' ) return 1;

  return 0;
}

const int R = 1010;
const int C = 1010;

int main()
{
  int r,c;
  
  while(cin >> r >> c){
    if( r == c && r == 0 ) break;

    int q;
    cin >> q;
    char A[r][c];

    for(int i = 0; i < r; ++i){
      for(int j = 0; j < c; ++j){
        cin >> A[i][j];
      }
    }

    static int r_sum[3][R][C];
    static int grid_sum[3][R][C];

    for(int i = 0; i < 3; ++i){
      for(int j = 0; j < R; ++j){
        for(int k = 0; k < C; ++k){
          r_sum[i][j][k] = 0;
          grid_sum[i][j][k] = 0;
        }
      }
    }

    for(int k = 0; k < 3; ++k){
      for(int i = 0; i < r; ++i){
        r_sum[k][i][0] = 0;
        for(int j = 1; j <= c; ++j){
          r_sum[k][i][j] += r_sum[k][i][j-1] + check(A[i][j-1],k);
        }
      }
    }

    for(int k = 0; k < 3; ++k){
      for(int i = 0; i <= r; ++i){
        for(int j = 0; j <= c; ++j){
          grid_sum[k][i][j] = 0;
          for(int l = 0; l < i; ++l){
            grid_sum[k][i][j] += r_sum[k][l][j];
          }
        }
      }
    }


    //cout << r_sum[0][0][2] << endl;
    
    for(int x = 0; x < q; ++x){
      int a,b,c,d;
      cin >> a >> b >> c >> d;
      --a;--b;
      int res[3];
      for(int i = 0; i < 3; ++i){
        res[i] = grid_sum[i][c][d] - grid_sum[i][a][d] -grid_sum[i][c][b] + grid_sum[i][a][b];
      }
      cout << res[0] << ' ' << res[1] << ' ' << res[2] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 25000
n,q=map(int,input().split())
s=input()
t=[0]*(n+1)
for i in range(n):
    t[i+1]=t[i]+(1 if s[i:i+2]=="AC" else 0)

for i in range(q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])


Measured memory_bytes: 52184
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#define FOR(idx, begin, end) for(int idx = (int)(begin); idx < (int)(end); ++idx)

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

using namespace std;
typedef long long lint;

const int MOD = 1000000007;
const int INF = 1 << 29;
const double EPS = 1e-9;


int main() {

	cin.tie(0);

	int W, a, b;
	cin >> W >> a >> b;

	if (a + W < b) cout << b - (a + W);
	else if (b + W < a) cout << a - (b + W);
	else cout << 0;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890123456789LL
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N, A, B;
	cin >> N >> A >> B;
	cout << (((B-A)%2) ? "Borys\n" : "Alice\n");
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
import sys
from collections import Counter, defaultdict
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline


class RollingHash():
    """
    Original code is https://tjkendev.github.io/procon-library/python/string/rolling_hash.html
    """
    class RH():
        def __init__(self, s, base, mod):
            self.base = base
            self.mod = mod
            self.rev = pow(base, mod-2, mod)

            l = len(s)
            self.h = h = [0]*(l+1)
            tmp = 0
            for i in range(l):
                num = ord(s[i])
                tmp = (tmp*base + num) % mod
                h[i+1] = tmp

            self.pw = pw = [1]*(len(s)+1)
            v = 1
            for i in range(l):
                pw[i+1] = v = v * base % mod

        def calc(self, l, r):
            return (self.h[r] - self.h[l] * self.pw[r-l]) % self.mod

    @staticmethod
    def gen(a, b, num):
        result = set()
        while 1:
            import random
            import math
            random.seed()
            while 1:
                v = random.randint(a, b)//2*2+1
                if v not in result:
                    break
            for x in range(3, int(math.sqrt(v))+1, 2):
                if v % x == 0:
                    break
            else:
                result.add(v)
                if len(result) == num:
                    break
        return result

    def __init__(self, s, rand=False, num=5):
        if rand:
            bases = RollingHash.gen(2, 10**3, num)
        else:
            assert num <= 10
            bases = [641, 103, 661, 293, 547, 311, 29, 457, 613, 599][:num]

        MOD = 10**9+7
        self.rhs = [self.RH(s, b, MOD) for b in bases]

    def calc(self, l, r):
        return tuple(rh.calc(l, r) for rh in self.rhs)


class Bisect:
    def __init__(self, func):
        self.__func = func

    def bisect_left(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if self.__func(mid) < x:
                lo = mid+1
            else:
                hi = mid
        return lo

    def bisect_right(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if x < self.__func(mid):
                hi = mid
            else:
                lo = mid+1
        return lo


def slv(N, S):
    srh = RollingHash(S)

    def f(m):
        h2i = defaultdict(list)
        for i in range(N-m+1):
            j = i + m
            h = srh.calc(i, j)
            h2i[h].append(i)

        for l in h2i.values():
            l0 = l[0]
            for i in range(1, len(l)):
                n = l[i] - l0
                if n >= m:
                    return 0
        return 1

    return Bisect(f).bisect_right(0, 1, N//2+1) - 1


def main():
    N = int(input())
    S = input()
    print(slv(N, S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 50268
n=gets.to_i
pt=px=py=0
n.times do
  t,x,y=gets.split.map(&:to_i)
  dt=t-pt
  dl=(x-px).abs+(y-py).abs
  if dl > dt || dt.odd? != dl.odd?
    puts 'No'
    exit
  end
  pt=t
  px=x
  py=y
end
puts 'Yes'


Measured memory_bytes: 3836
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <queue>
#include <algorithm>
using namespace std;

#define rep(i,n)for(int i=0; i<(int)(n); i++)
#define bitrep(tmp, N)for (int tmp=0; tmp < (1<<N);tmp++)
#define all(v) v.begin(), end.bigin()

int INF = 10e9;
using P = pair<int,int>;


int main(){
  int N, M;
  cin >> N >> M;
  vector<P> order(M);
  int a,b;
  rep(i,M){
    cin >> a>>b;
    order.at(i).second = a;
    order.at(i).first = b;
  }

  sort(order.begin(), order.end());
  int count=0, t=0;
  for(int i=0; i<M; i++){
    if(t<order.at(i).second){
      count++;
      t = order.at(i).first-1;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <math.h>
using namespace std;

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define PB push_back
#define putn(x,n) cout<< fixed<< setprecision(n)<< x << endl;
typedef long long ll;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> W(n,0);
	vector<int> E(n,0);

	string s;
	cin >> s;
	rep(i,1,n){
		if(s[i]=='E')E[0]++;
	}
	rep(i,0,n-1){
		W[i+1]=W[i];
		if(s[i]=='W')W[i+1]++;
		if(s[i]=='E' && i!=0)E[i]--;
		E[i+1]=E[i];
	}
	E[n-1]=0;
	int ans=8101919;
	rep(i,0,n){
		//cout << "W:"<<W[i]<<" E:"<<E[i]<<endl;
		ans=min(W[i]+E[i],ans);
	}
	cout << ans<<endl;

	return 0;
}


Measured memory_bytes: 3152
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,a[201000];
bool check(int k){
	map<int,int> mp;
	for(int i=2;i<=n;i++)
		if(a[i]<=a[i-1]){
			while(mp.size()&&(--mp.end())->first>a[i]) mp.erase(--mp.end());
			mp[a[i]]++;
			int now=a[i];
			while(now>0&&mp[now]>=k) mp.erase(now),mp[--now]++;
			if(!now) return 0;
		}
	return 1;
}
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	int flag=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(i>1&&a[i]<=a[i-1]) flag=1;
	}
	if(!flag){puts("1");return 0;}
	int l=1,r=n;
	while(l+1<r){
		int mid=l+r>>1;
		cerr<<mid<<'\n';
		if(check(mid)) r=mid;
		else l=mid;
	}
	cout<<r<<'\n';
	return 0;
}


Measured memory_bytes: 1024
type Scanner() = class
    let mutable hold = [||]
    let mutable index = 0
    member public this.Next() =
        if hold.Length > index
        then 
            index <- index + 1
            hold.[index - 1]
        else
            let mutable st = stdin.ReadLine()
            while st = "" do st <- stdin.ReadLine()
            hold <- st.Split(' ')
            if hold.Length = 0
            then
                this.Next()
            else
                index <- 1
                hold.[index - 1]
            
    member public this.NextI32() =
        this.Next() |> int

    member public this.ArrayI32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI32()|]

    member public this.NextI64() =
        this.Next() |> int64
    
    member public this.ArrayI64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI64()|]

    member public this.NextF32() =
        this.Next() |> float32
    
    member public this.ArrayF32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF32()|]

    member public this.NextF64() =
        this.Next() |> double
    
    member public this.ArrayF64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF64()|]

    member public __.Tuple2Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 2 |> fun x -> x.[0], x.[1]|]
    
    member public __.Tuple3Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 3 |> fun x -> x.[0], x.[1], x.[2]|]

end

let rec uc l s =
    if s = 0
    then l
    else l % s |> uc s

let ucSub a b = if a > b then uc a b else uc b a

[<EntryPoint>]
let main _ =
    let scanner = Scanner()
    let n = scanner.NextI32()
    let arrX = scanner.ArrayI32(n + 1)

    arrX
    |> Array.sort
    |> Array.pairwise
    |> Array.map (fun (x, y) -> y - x)
    |> Array.fold ucSub 0
    |> printfn "%i"

    0


Measured memory_bytes: 33240
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

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

  int a[5], b[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    b[i] = a[i];
    while (b[i] % 10 != 0) {
      b[i]++;
    }
  }
  cout << b[0] + b[1] + b[2] + b[3] + b[4] -
              std::max({b[0] - a[0], b[1] - a[1], b[2] - a[2], b[3] - a[3],
                        b[4] - a[4]})
       << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    char c, p;
    while ((c = getchar()) != '\n') {
        if (c == ' ' && ((c = getchar()) != p)) {
            printf("NO\n");
            return 0;
        }
        p = c;
    }
    printf("YES\n");
    return 0;
}



Measured memory_bytes: 128
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i = 0;i < n; i++)
#define REP(i,n) for(int i = 1;i <= n; i++)
// ----GCC ONLY---- //
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// ----        ---- //
#define ll long long
#define MOD 10000007
#define PB push_back
 
using namespace std;
int main(){
int a,b,c;
cin >> a >> b >> c;

swap(a,b);
swap(a,c);

cout << a <<" " << b <<" " << c <<endl;
}

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

int main(int argc, char const *argv[])
{
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; ++i)
		cin >> v[i];
	
	int total_xor = 0;

	for(int i = 0; i < n; i += 2)
		total_xor ^= (v[i] ^ v[i+1]);
	
	for(int i = 0; i < n; i++)
		cout << (total_xor ^ v[i]) << ' ';

	return 0;
}

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

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define fst first
#define snd second

int main()
{
    int a, b;
    cin >> a >> b;

    int sum = a + b;
    if(sum == 3)
        cout << "3";
    else if(sum == 4)
        cout << "2";
    else
        cout << "1";

    return 0;
}


Measured memory_bytes: 256
# 初期入力
H = int(input())

#モンスター１匹ずつは考えない、１ターンでHが半分、モンスターの数２倍
kougeki_kaisu = [1]
monster_num =1

while 1 < H:
    H = H // 2
    monster_num = monster_num * 2
    kougeki_kaisu.append(monster_num)
    # print(H,kougeki_kaisu)
# print(H,kougeki_kaisu)
print(sum(kougeki_kaisu))

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
#define k_p make_pair
const int inf=0x3f3f3f3f;
bool cmp(int a,int b){return a>b;}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
    int x,y,ia,ib,ic;
    while(cin>>x>>y>>ia>>ib>>ic)
    {
        vector<int> a(ia+1),b(ib+1),c(ic+1);
        a[0]=b[0]=c[0]=inf;
        for(int i=1;i<=ia;i++) cin>>a[i];
        for(int i=1;i<=ib;i++) cin>>b[i];
        for(int i=1;i<=ic;i++) cin>>c[i];
        sort(a.begin(),a.end(),cmp);
        sort(b.begin(),b.end(),cmp);
        sort(c.begin(),c.end(),cmp);
        vector<int> ans(x+y+1);
        for(int i=1;i<=x;i++)
            ans[i]=a[i];
        for(int i=1;i<=y;i++)
            ans[i+x]=b[i];
        sort(ans.begin(),ans.end());
        for(int i=1;i<=ic;i++){
            if(ans[i]<c[i])
                ans[i]=c[i];
            else break;
        }
        LL res=0;
        for(int i=1;i<=x+y;i++)
            res+=ans[i];
        cout<<res<<endl;
    }
    return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,v[200],W,w[200],k,dp[200][100009];
ll f(ll N, ll V){
	if (N==0){
		if(V==0)return 0;
		else return 1e15;
	}
	
	if(dp[N][V]!=-1)return dp[N][V];
	if (V>=v[N])dp[N][V]=min(f(N-1,V),f(N-1,V-v[N])+w[N]);
	else dp[N][V]=f(N-1,V);
	return dp[N][V];
}
 
int main(){
	cin >> n >> W;
	for(int i=1; i<=n; i++)cin >> w[i] >> v[i];
	memset(dp,-1,sizeof dp);
	ll jwb=0;
	for(ll i=0; i<=100000; i++){
		ll z=f(n,i);
		if (z<=W)jwb=max(jwb,i);
	}
	cout << jwb << endl;
}
 

Measured memory_bytes: 156544
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<Integer, Integer> map = new HashMap<>();
        HashSet<Integer> keys = new HashSet<>();
        for(int i = 0; i < n; i++) {
            int num = sc.nextInt();
            map.put(num, map.getOrDefault(num, 0) + 1);
            keys.add(num);
        }
        int count = 0;
        Integer[] k = keys.toArray(new Integer[keys.size()]);
        for(Integer key: k) {
            int value = map.get(key);
            if(value > key) count += (value - key);
            if(value < key) count += value;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 67636
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>

using namespace std;

typedef pair<long long, long long> pl;

long long N, M, k, a, b, c, d, e, H, W,X;
long long A[3][20000] = {};
long long B[20000] = {};
long long C[20000] = {};
bool f;
bool ff;
string S, SS;
set <long long>sll;
pl buf;
vector <long long>vl[7];


int main() {

	cin >> a>>b>>c>>k;
	for (int i = 0; i < a; i++) {
		cin >> A[0][i];
		vl[0].push_back(A[0][i]);
	}
	for (int i = 0; i < b; i++) {
		cin >> A[1][i];
		vl[1].push_back(A[1][i]);
	}
	for (int i = 0; i < c; i++) {
		cin >> A[2][i];
		vl[2].push_back(A[2][i]);
	}


	for (int i = 0; i < a; i++) {
		for (int j = 0; j < b; j++) {
			vl[3].push_back(A[0][i] + A[1][j]);
		}
	}


	for (int i = 0; i < 4; i++) {
		sort(vl[i].begin(), vl[i].end());
		reverse(vl[i].begin(), vl[i].end());
	}

	if (vl[3].size() > k) {
		for (int i = 0; i < k; i++) {
			vl[4].push_back(vl[3][i]);
		}
	}
	else {
		for (int i = 0; i < vl[3].size(); i++) {
			vl[4].push_back(vl[3][i]);
		}
	}

	for (int i = 0; i < vl[4].size(); i++) {
		for (int j = 0; j < c; j++) {
			vl[5].push_back(vl[4][i] + A[2][j]);
		}
	}

	sort(vl[5].begin(), vl[5].end());
	reverse(vl[5].begin(), vl[5].end());

	for (int i = 0; i < k; i++) {
		cout << vl[5][i]<< endl;
	}

	return 0;
}

Measured memory_bytes: 43152
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int INF = 2e9;

unsigned int randxor() {
  static unsigned int x=123456789,y=362436069,z=521288629,w=88675123;
  unsigned int t;
  t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}




int main() {
  int D;
  cin >> D;
  vector<int> c(26);
  rep(i,26) cin >> c[i];
  vector<vector<int>> s(D, vector<int>(26));
  vector<int> last_day(26, 0);
  vector<int> t(D);
  rep(i,D) rep(j,26) cin >> s[i][j];


  int score = 0;
  int res = 0;
  auto Scoring = [&](int d, int id) {
    last_day[id] = d;
    for (int i = 0; i < 26; i++) score -= c[i] * (d - last_day[i]); 
  };

  auto init = [&](){
    int ret = 0;
    for (int i = 0; i < D; i++) {
      int add = -INF;
      int p = -1;
      for (int j = 0; j < 26; j++) {
        int tmp = 0;
        tmp += s[i][j];
        last_day[j] = i + 1;
        for (int k = 0; k < 26; k++) tmp -= c[k] * (i + 1- last_day[k]);
        if (add < tmp) {
          add = tmp;
          p = j + 1;
        }
      }
      t[i] = p;
      ret += add;
    }
    score = ret;
  };
  
  //初期解生成 
  init();
  /*
  rep(p, 40000000) {

    int d = randxor() % D;
    int change_q = randxor() % 26;    
    int old_q = t[d];
    t[d] = change_q;
    int old_res = res;
    int old_score = score;
    Scoring(d + 1, change_q);
    if (res < old_res) {
      t[d] = old_q;
      res = old_res;
      score = old_score;
    }
  }
  */
  //cout << max(int(1e6 + score), 0) << endl;
  rep(i,D) cout << t[i] << endl;
  return 0;
} 

Measured memory_bytes: 3680
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	// if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}

void solve()
{	
	char c;
	cin >> c;
	cout << ++c;
}

 
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<queue>
#include<functional>
#include<limits.h>
#include<string.h>
#include<algorithm> 
#define int long long
using namespace std;

int S[1005][1005];
signed main() {
	int n; cin >> n;
	if (n == 1) {
		puts("Yes");
		cout << 2 << endl;
		cout << 1 << " " << 1 << endl;
		cout << 1 << " " << 1 << endl;
	}
	else {
		for (int i = 2; i <= 1000; i++) {
			if (i*(i - 1) / 2 == n) {
				int sum = 1;
				puts("Yes");
				cout << i << endl;
				for (int j = 0; j < i; j++) {
					for (int k = 0; k < i - j; k++) {
						S[j][j + k] = sum + k;
						S[j + k + 1][j] = sum + k;
					}
					sum += i - j - 1;
				}
				for (int j = 0; j < i; j++) {
					cout << i - 1;
					for (int k = 0; k < i - 1; k++) {
						cout << " " << S[j][k];
					}
					cout << endl;
				}
				return 0;
			}
		}
		puts("No");
	}
}

Measured memory_bytes: 5376
#include "bits/stdc++.h"
#define ll long long
using namespace std;
static const int INF = (1 << 21);


int main() {
	string S;
	cin >> S;
	int ptr = 0;
	while (1) {
		if (S[ptr] == 'd') {
			if (S.substr(ptr,5) == "dream") {
				if (S.substr(ptr + 5, 2) == "er"&&S.substr(ptr+7,3)!="ase") ptr += 2;
				ptr += 5;
			}
			else {
				cout << "NO" << endl;
				return 0;
			}
		}else if(S[ptr] == 'e'){
				if (S.substr(ptr,5) == "erase") {
					if (S.substr(ptr + 5,1) == "r") ptr += 1;
					ptr += 5;
				}
				else {
					cout << "NO" << endl;
					return 0;
				}
		}
		else {
			cout << "NO" << endl;
			return 0;
		}

		if (ptr >= S.length()) {
			cout << "YES" << endl;
			return 0;
		}

		}
}

Measured memory_bytes: 512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author IncubatorMan
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define long long long
typedef pair < long , long > pii;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
class CReplacingInteger {
public:
	void solve(std::istream& in, std::ostream& out) {
	    long n,k;
	    in>>n>>k;
	    n%=k;
	    long x = abs(n-k);
	    out<<min(n,x)<<endl;

	}
};


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


Measured memory_bytes: 256
n = int(input())
v = list(map(int, input().split()))

u = v[1::2] #奇数列
d = v[0::2] #偶数列

U = [0] * 100010
for i in range(len(u)): #何種類の数が何個現れるか記録
    U[u[i]] += 1
    
D = [0] * 100010
for i in range(len(d)): #何種類の数が何個現れるか記録
    D[d[i]] += 1
   
if U.index(max(U)) == D.index(max(D)): #最頻値が同じ場合
    u = sorted(U, reverse=True)
    d = sorted(D, reverse=True)
    s = n - u[1] - d[0] if u[1] > d[1] else n - u[0] - d[1]
    print(s)
    exit()
    
print(n - max(U) - max(D))


Measured memory_bytes: 87648
S = input()

N = len(S)
ans = [0] * N

left = -1
for i in range(N - 1):
    if not (S[i] == "R" and S[i + 1] == "L"):
        continue

    right = i + 1
    while right + 1 != N and S[right + 1] == "L":
        right += 1

    ans[i] += (i - left) // 2 + (i - left) % 2 + (right - i) // 2
    ans[i + 1] += (i - left) // 2 + (right - i) // 2 + (right - i) % 2
    left = right

print(*ans)


Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int n;
int a[N];
int ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		a[x]++;
	}
	ans=a[0]+a[1];
	for(int i=1;i<=100000;i++)
		ans=max(ans,a[i]+a[i-1]+a[i+1]);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
//#define ls (rt<<1)
//#define rs (rt<<1|1)
#define vi vector<int>
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define rep(i,a,b) for(int i=(a),i##end=(b);i<=i##end;i++)
#define fi first
#define se second
typedef long long ll;
const int maxn=205;
using namespace std;
ll a[maxn];
struct basis{
	ll a[maxn];
	void reset(){memset(a,0,sizeof(a));}
	void insert(ll x){
		for(int i=63;i>=0;i--){
			if(x&(1ll<<i)){
				if(!a[i]){
					a[i]=x;break;
				}
				x^=a[i];
			}
		}
	}
	bool exist(ll x){
		for(int i=63;i>=0;i--){
			if(x&(1ll<<i)){
				if(a[i])x^=a[i];
				else {return 0;}
			}
		}
		return 1;
	}
}t;
char s[maxn];
void solve(){
	int n;scanf("%d",&n);rep(i,1,n)scanf("%lld",&a[i]);
	scanf("%s",s+1);t.reset();
	if(s[n]=='1'){printf("1\n");return;}
	t.insert(a[n]);
	for(int i=n-1;i>=1;i--){
		if(s[i]=='0'){
			t.insert(a[i]);
		}
		else{
			if(!t.exist(a[i])){printf("1\n");return;}
		}
	}
	printf("0\n");
}
int main(){
	int t;scanf("%d",&t);
	while(t--)solve();
}


Measured memory_bytes: 3520
#include<iostream>
using namespace std;
int main(){
    int n,v[22],c[22],i;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> v[i];
    }
    for(i=0;i<n;i++){
        cin >> c[i];
    }
    int s=0;
    for(i=0;i<n;i++){
        if(v[i]>c[i])
            s+=v[i]-c[i];
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
s = []
for i in range(h):
    s.append(input())
ans = [[0 for j in range(w)] for i in range(h)]
for i in range(h):
    done = [False] * w
    for j in range(w):
        if s[i][j] == "#":
            continue
        if done[j]:
            continue
        l = 0
        while j+l < w:
            if s[i][j+l] == "#":
                break
            l += 1
        for k in range(j, j+l):
            ans[i][k] += l
            done[k] = True
for j in range(w):
    done = [False] * h
    for i in range(h):
        if s[i][j] == "#":
            continue
        if done[i]:
            continue
        l = 0
        while i+l < h:
            if s[i+l][j] == "#":
                break
            l += 1
        for k in range(i, i+l):
            ans[k][j] += l
            done[k] = True
res = 0
for i in range(h):
    res = max(max(ans[i]), res)
res -= 1
print(res)

Measured memory_bytes: 113348
N, M = map(int, input().split())
pyi = []
exists = [0] * N
for i in range(M):
    p, y = map(int, input().split())
    pyi.append([p, y, i])
pyi.sort(key = lambda x: x[1])
iid = []
for i in range(M):
    p = pyi[i][0]
    div = pyi[i][2]
    exists[p - 1] += 1
    iid.append([div, str(p).zfill(6)+str(exists[p - 1]).zfill(6)])
iid.sort()
for i in range(M):
    print(iid[i][1])

Measured memory_bytes: 41912
#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()
{
	char x, y;
	cin >> x >> y;

	if (x > y) cout << ">" << endl;
	else if (x == y) cout << "=" << endl;
	else cout << "<" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 1000000007
#define ll long long int
#define fo(i,a,n) for(int i=a;i<n;i++)
#define ull unsigned long long int
#define pb push_back
#define eb emplace_back
using namespace std;


int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    // int t;
    // cin>>t;
    // while(t--){
        string s;
        cin>>s;

        int n = s.length();
        if(s[n-1]!='s'){
            s.push_back('s');
        }
        else if(s[n-1]=='s'){
            s = s + "es";
        }

        cout<<s<<endl;

    // }
    return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner
object Main extends App {
  val sc = new Scanner(System.in)
  val tiles = sc.next.map(_ - '0').zipWithIndex
  println(Math.min(
    tiles.count{case (c, i) => c == i % 2},
    tiles.count{case (c, i) => c != i % 2}
  ))
}

Measured memory_bytes: 33808