akhauriyash/Code-Regression huggingface dataset:
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

def check(i,s,s0):
    if i%2 == 0:
        if s == s0:
            return True
        else:
            return False
    else:
        if s != s0:
            return True
        else:
            return False

N = I()
print(0)
sys.stdout.flush()
s0 = str(input())
if s0 == 'Vacant':
    exit()

print(N-1)
sys.stdout.flush()
s1 = str(input())
if s1 == 'Vacant':
    exit()

ok = N-1
ng = 0
while True:
    mid = (ok+ng)//2
    print(mid)
    sys.stdout.flush()
    s = str(input())
    if s == 'Vacant':
        exit()
    flag = check(mid,s,s0)
    if flag:
        ng = mid
    else:
        ok = mid

Measured memory_bytes: 38852
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  
  if(s[0]==s[1] && s[1]==s[2]) cout << "Yes" << endl;
  else if(s[1]==s[2] && s[2]==s[3]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3624
s = str(input())

if len(s) % 2 == 0:
    fore = s[:len(s)//2]
    back = s[len(s)//2:]
else:
    fore = s[:len(s)//2]
    back = s[len(s)//2+1:]

rback = list(reversed(back))
fore = [s for s in fore]

count = 0
for rb, fo in zip(rback, fore):
    if rb != fo:
        count += 1

print(count)


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

// 
int main() {
    int L, R, d;
    cin >> L >> R >> d;
    int countD = 0;
    int i = 1;
    while (d * i <= R) {
        if (L <= d * i && d * i <= R) {
            countD++;
        }
        i++;
    }
    cout << countD;
}


Measured memory_bytes: 3596
#include<stdio.h>
int main (void)
{
	int i,j;
	int H,W;
	while(1){

	scanf("%d%d",&H,&W);

	if(H==0 && W==0){
	break;
	}

	for ( i = 0; i < H; i++ ){
	for ( j = 0; j < W; j++ ){
        printf("#");
    }
    printf("\n");
}
printf("\n");
}
return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, h[N];
long long a[N], st[4 * N];

void update_st(int v, int tl, int tr, int idx, long long val) {
	if (tl == tr && tl == idx) {
		st[v] = max(st[v], val);
		return;
	}
	int m = (tl + tr) / 2;
	if (idx <= m) {
		update_st(v * 2, tl, m, idx, val);
	}
	else {
		update_st(v * 2 + 1, m + 1, tr, idx, val);
	}
	st[v] = max(st[v * 2], st[v * 2 + 1]);
}

long long query_st(int v, int tl, int tr, int l, int r) {
	if (l > r) {
		return 0;
	}
	if (tl == l && tr == r) {
		return st[v];
	}
	int m = (tl + tr) / 2;
	long long ql = query_st(v * 2, tl, m, l, min(r, m));
	long long qr = query_st(v * 2 + 1, m + 1, tr, max(l, m + 1), r);
	return max(ql, qr);
}

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

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
		h[i]--;
	}
	
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (int i = 0; i < n; i++) {
		long long tans = a[i] + query_st(1, 0, n, 0, h[i]);
		update_st(1, 0, n, h[i], tans);
	}

	cout << query_st(1, 0, n, 0, n) << '\n';

	return 0;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(ll (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,q;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
U_MAP mp;
    
//------ Believe yourself as a genius!!!!!! ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    rep(i,n){
        cin>>a[i];
        mp[a[i]]++;
    }
    rep(i,n){
        if(mp[a[i]]==0)continue;
        if(mp[a[i]]>=a[i])ans+=mp[a[i]]-a[i];
        else ans+=mp[a[i]];
        mp[a[i]]=0;
    }
    Cout(ans);
    return 0;
}

Measured memory_bytes: 5028
/* 	* In the name of GOD 
	* Thanks God */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second

int32_t main(){
	int n;
	cin >> n;
	int a[n];
	int ans = 0;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		bool f = true;
		for (int j = 0; j < i; j++){
			if (a[j] > a[i])
				f = false;
		}
		if (f)
			ans ++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3580
#!/usr/bin/env python3
import sys
import itertools


def solve(N: int, d: "List[int]"):
    ans = sum([a * b for a, b in itertools.combinations(d, 2)])
    print(ans)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    d = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, d)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
//Using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> Ordered_set;

#define ll              long long
#define int             long long
#define ld             long double
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vi>
#define vip            vector<pii>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define lb(x)           (x&(-x))
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define itr(it,v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fir(i,k,n)       for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ff               first 
#define ss               second
#define deb(x) cout << #x << "=" << x << endl
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define check(x) (x && cout<<"Yes\n")||(cout<<"No\n");
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);

const ld pi = 3.141592653589793238462643383279502884;
const int xd[]={-1,0,1,0};
const int yd[]={0,-1,0,1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0,  1, -1, 1, -1, 0, 1 };

int expo(int a,int b,int m);
int mmi(int a,int m);
void ipgraph(int m);

const int N=5*(1e5)+10;
vii adj(N);
int a[N];

void  solve(){

}
int dp(int s){
    if(s==0) return 1;
    if(a[s]!=-1) return a[s];
    int ans=0;
    for(int i=3;i<=s;i++){
        ans=(ans+dp(s-i))%mod;
    }
    return a[s]=ans;
}
int32_t main()
{
    FIO
    int s; cin>>s;
    fi(i,s+1) a[i]=-1;
    a[0]=1;
    cout<<dp(s)<<"\n";
        return 0;

}

void ipgraph(int m){
    int i, u, v;
    while(m--){
          cin>>u>>v;
         u--, v--;
    adj[u].pb(v);
    adj[v].pb(u);
    }
}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

Measured memory_bytes: 15072
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
void chmin(int &a,int b){if(a>b) a=b;}

int N;


int main()
{
    int l;
    int i=0,ans=0;
    cin>>N;
    while (cin >> l) {
        ans+=l-1;
        i++;
        if (i >= N) {
            break;
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char s[] = br.readLine().toCharArray(), t[] = br.readLine().toCharArray();
		br.close();

		int row = t.length, col = s.length;
		int tb[][] = new int[row + 1][col + 1];

		for ( int r = 0; r < row; r++ ) {
			for ( int c = 0; c < col; c++ ) {
				if ( t[r] == s[c] ) {
					tb[r + 1][c + 1] = tb[r][c] + 1;
				} else {
					tb[r + 1][c + 1] = Math.max(tb[r + 1][c], tb[r][c + 1]);
				}
			}
		}

		int r = row, c = col;
		ArrayDeque<Character> stack = new ArrayDeque<Character>();
		stack.add(' ');
		while ( tb[r][c] != 0 ) {
			// 上
			if ( tb[r - 1][c] == tb[r][c] ) {
				r -= 1;
			} else
			// 左
			if ( tb[r][c - 1] == tb[r][c] ) {
				c -= 1;
			} else
			// 行き止まり
			{
				stack.addFirst(s[c - 1]);
				r -= 1;
				c -= 1;
			}
		}

		StringBuilder sb = new StringBuilder();
		while ( stack.size() > 0 ) {
			sb.append(stack.pollFirst());
		}
		System.out.println(sb);
	}
}

Measured memory_bytes: 79316
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];

    int res=0;
    rep(i,n){
        res=gcd(res,a[i]);
    }  
    cout<<res<<endl;
}

Measured memory_bytes: 3960
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

bitset<4000005> dp[2];

int main(){
  int N;
  cin >> N;
  vector<int> v(N);
  rep(i,N) cin >> v[i];


  int sum = 0;
  rep(i,N) sum += v[i];
  if(sum%2==0) sum /= 2;
  else sum = sum/2 + 1;

  int turn = 0;
  dp[turn][0] = 1;
  rep(i,N){
    dp[1-turn] = dp[turn] | (dp[turn] << v[i]);
    turn = 1-turn;
  }

  int ret = 0;
  REP(i,sum,dp[turn].size()){
    if(dp[turn][i] == 1){
      ret = i;
      break;
    }
  }
  
  cout << ret << endl;
  return 0;
}




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

int main() {
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());

    string s;
    cin >> s;

    string r = "";
    for (int i=0; i < s.size(); i++) {
        if (s[i] == '0' || s[i] == '1') {
            r += s[i];
        } else if (s[i] == 'B') {
            if(r.size()) {
                r = r.substr(0, r.size()-1);
            }
        }
    }
    cout << r << endl;
    
}


Measured memory_bytes: 256
/// sultanov

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
     
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type,
less<T>, rb_tree_tag, 
tree_order_statistics_node_update>;

using ll = long long;
using pii = pair<int, int>;                                   

const ll p = 1e7 + 7;
const int N = 5e3 + 1e2;
const ll MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;

ll h[N], po[N];

ll mult(ll a, ll b) {
    return (a % MOD) * (b % MOD) % MOD;
}

void calc(string s) {
    for (int i = 0; i < sz(s); ++i) 
        h[i] = ((i ? h[i - 1] : 0ll) * p + s[i]) % MOD;
    po[0] = 1ll;
    for (int i = 1; i <= sz(s); ++i)
        po[i] = mult(po[i - 1], p);
}

ll get(int l, int r) {
    if (!l)
        return h[r];
    return (h[r] - mult(h[l - 1], po[r-l+1]) + MOD) % MOD;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    string s;
    cin >> s;
    calc(s);
    int l = 1;
    int r = n / 2;
    int ans = 0;
    while (l <= r) {
        int m = l + r >> 1;
        bool ok = 0;
        for (int i = 0; i < n; ++i) {
            for (int j = i + m; j <= n - m; ++j) 
                if (get(i, i+m-1) == get(j, j+m-1)) {
                    ok = 1;
                    break;
                }            
            if (ok)
                break;
        }
        if (ok) { 
            ans = m;
            l = m + 1;
        } else 
            r = m - 1;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 384
// C - Next Prime
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

bool isprime(ll p){
	if(p <= 1L) return false;
	for(ll i=2L; i*i<=p; ++i) if(p%i == 0) return false;
	return true;
}

int main(){
	ll X; cin>>X;
	for(ll i=X;i<<X*X; ++i) if(isprime(i)){ cout<< i <<endl; return 0; }
}

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

int main() {
  string s, t;
  cin >> s >> t;
  bool ans = true;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) ans = false;
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll int,ll int>
#define pb push_back
#define sbit __builtin_popcount
#define vec vector <int>
#define ub upper_bound
#define lb lower_bound
#define bs binary_search
#define bg begin()
#define en end()
#define endl "\n"
#define ff first
#define ss second
#define all(x) x.bg,x.en
#define sz(a) (int)a.size()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define sp(x) setprecision(x)
#define fill(a,b) memset(a,b,sizeof(a))
#define fr(i,n) for(int i=0;i<n;i++)
#define rp(i,a,b) for(int i=a;i<b;i++)
#define rr(i,a,b) for(int i=a;i>=b;i--)
#define ft(it,x) for(auto it : x)
#define dbg(x) cerr<<#x<<" "<<x<<endl;
#define dbga(arr,n) cerr<<#arr<<": "; rep(tt,0,n)cerr<<arr[tt]<<" "; cerr<<endl;
#define mapi map<int,int>
#define mapl map<ll int,ll int>
#define val_at(x) find_by_order(x)
#define idx_of(x) order_of_key(x)
#define scni(x) scanf("%d",&x)
#define prt(x) printf("%d\n",x)
#define test(t) int t;cin>>t;while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define val_at(x) find_by_order(x)
#define idx_of(x) order_of_key(x)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> myset;
const int mod=1e9+7;
const int mex=1e6+1;
inline ll power(ll a,ll b)
{
    ll ans=1,temp=a;
    while(b!=0)
    {
        if(b&1)
        ans=ans*temp;
        ans=ans%mod;
        temp=temp*temp;
        temp=temp%mod;
        b/=2;
    }
    return ans;
}
int pr[mex];
vec prime;
inline void seive()
{
    rp(i,2,mex) pr[i]=1;
    for(int i=2;i*i<mex;i++)
    {
        if(pr[i])
        for(int j=i*i;j<mex;j+=i)
        pr[j]=0;
    }
    vec prime;
    rp(i,2,mex)
    {
        if(pr[i]) prime.pb(i);
    }
}
ll int xx,xy,d1;
void exeu(ll int a1,ll int b1)
{
    if(b1==0)
    {
        xx=1;
        xy=0;
        d1=a1;
    }
    else
    {
        exeu(b1,a1%b1);
        ll int temp=xx;
        xx=xy;
        xy=temp-(a1/b1)*xy;
    }
}
ll int modinv(ll int A,ll int M)
{
    exeu(A,M);
    return (xx%M+M)%M;
}
int main()
{
    fast
    int n;
    cin>>n;
    int a[n],mn=INT_MAX,cnt=0;
    fr(i,n){
      cin>>a[i];  
      mn=min(mn,a[i]);
      if(mn==a[i]) cnt++;
      
    } 
    cout<<cnt;
    return 0;
}

Measured memory_bytes: 1024
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll A = 0, B =0;
    cin(A);cin(B);

    //vll X(N)
    //REP(i,N) cin(X.at(i));
  
  ll k = A, ans = 1;
   if(B==1){
     cout << 0 << endl;
     return 0;
   }
   while(k < B){
      k = k + A - 1;
      ans ++;
    }
  


    //出力
    cout << ans << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
vector<string> lst={"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
int main() {
	string str;
	cin>>str;
	int pos=find(lst.begin(),lst.end(), str)-lst.begin();
	pos=-pos;
	pos+=7;
	pos%=7;
	if(pos==0) pos=7;
	cout<<pos<<"\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(){
    int i,j,k,l,m,n;
    while(cin>>m>>n){
    int x[m];
    l=0;
    for(i=0;i<m;i++){cin>>x[i]; l+=x[i];}
    j=0;
    for(i=0;i<m;i++) if(x[i]*n*4>=l)j++;
  if(j>=n) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
    }
     return 0;
}


Measured memory_bytes: 256
s = input()
tc = [ chr(i)*2 for i in range(ord('a'), ord('z')+1) ]  + [ chr(i)+chr(j)+chr(i) for i in range(ord('a'), ord('z')+1) for j in range(ord('a'), ord('z')+1)]
x=y=-1
t = "0"
for i in set(tc):
  if i in s:
    t = i
    break
for i in range(len(s)):
    if s[i:i+len(t)] == t:
      x = i+1
      y = i+len(t)
      break
print(x, y)

Measured memory_bytes: 3316
package main

import "fmt"

func main() {
	var a, b, c, k int
	fmt.Scanf("%d %d %d %d", &a, &b, &c, &k)
	if a >= k {
		fmt.Println(k)
	} else if a+b >= k {
		fmt.Println(a)
	} else {
		fmt.Println(a - (k - a - b))
	}
}


Measured memory_bytes: 1816
#include<iostream>
using namespace std;
int main(){
	int n,w=0;
	cin>>n;
	int a[n];
	for(int q=0;q<n;q++){
		cin>>a[q];
	}
	for(int q=1;q<n-1;q++){
		if((a[q]<=a[q-1]&&a[q]>a[q+1])||(a[q]<=a[q+1]&&a[q]>a[q-1]))w++;
	}
	cout<<w;
}

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

using namespace std;

#define all(c) ((c).begin()),((c).end())
#define debug(c) cerr<<"> "<<#c<<" = "<<(c)<<endl;
#define iter(c) __typeof((c).begin())
#define tr(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)

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

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


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

// a/b, c/d, p/q
void frac_sub(int a,int b,int c,int d,int &p,int &q) {
	p = a * d - c * b;
	q = b * d;
	int g = abs(gcd(p, q));
	p /= g;
	q /= g;
}

int a;
int go(int p, int q,int m,int n, int prev_q) {
	if (n < 0 || p < 0) return 0;
	if (p == 0) return 1;
	int res = 0;
	for (int i = prev_q; m * i <= a; i++) {
		int rp, rq;
		frac_sub(p, q, n, i, rp ,rq);
		if(rp > 0) break;
		frac_sub(p, q, 1, i, rp, rq);
//		printf("%d / %d\n", rp, rq);
		res += go(rp, rq, m * i, n - 1, i);
	}
	return res;
}

int main() {
	for (int p, q, n; cin >> p >> q >> a >> n, (p | q | a | n) != 0; ) {
		int g = gcd(p, q);
		p /= g;
		q /= g;
		cout << go(p, q, 1, n, 1) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int intH;
		int intW;
		while(true){
			intH = scan.nextInt();
			intW = scan.nextInt();
			if(intH == 0 && intW ==0){
				break;
			}
			for(int i = 0; i < intH; i++){
				for(int j = 0; j < intW; j++){
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}

		scan.close();

	}
}

Measured memory_bytes: 26984
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,K;
  cin >> N >> K;
  int now = 1;
  for(int i = 0; i < N; i++){
    if(now > K){
      now += K;
    }
    else{
      now *= 2;
    }
  }
  cout << now;
}

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

int main()
{
  int n , k ;
  cin >> n >> k;
  int sumhealth = 0 ; 
  int a[n];
  for(int i = 0 ; i < n ; i++)
  {
    cin >> a[i];
  }
  
  sort(a,a+n);
  long long ans = 0 ;
  for(int i = 0 ; i < n-k ; i++)
  {
    ans += a[i];
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 1024
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<utility>//pair
#include<list>
#include<vector>//可変長配列
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
int dx[8] = { 1,0,-1,0,1,-1,-1,1 };
int dy[8] = { 0,1,0,-1,1,1,-1,-1 };


int n;
map<string, int>ta;

int main() {
    cin >> n;
    rep(i, n) {
        string s;
        cin >> s;
        ta[s]++;
    }

    int cnt = -1;
    for (auto it = ta.begin(); it != ta.end(); it++) {
        cnt = max(cnt, (*it).second);
    }
    for (auto it = ta.begin(); it != ta.end(); it++) {

        if(cnt==(*it).second)
        cout << (*it).first << endl;

    }

    return 0;
}


Measured memory_bytes: 25216
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
    char ch;
    while(1){
        scanf("%c", &ch);
        if(ch=='\n'){
            break;
        }
        if('a'<=ch & ch<='z'){
            char m=ch-32;
            printf("%c",m);
        }
        else if('A'<=ch & ch<='Z'){
            char n=ch+32;
            printf("%c",n);
        }
        else{
            printf("%c",ch);
        }
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3248
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<iomanip>
#include<set>
using namespace std ;

#define MAXN 100007

int n ;
int k , q ;
int a[ MAXN ] ;


void input ( ) {
    scanf ( "%d%d%d" , &n , &k , &q ) ;
    for ( int i = 1 ; i <= q ; ++ i ) {
        int x ;
        scanf ( "%d" , &x ) ;
        ++ a[ x ] ;
    }
}

void solve ( ) {
    for ( int i = 1 ; i <= n ; ++ i ) {
        a[ i ] += k - q ;
        if ( a[ i ] > 0 ) { printf ( "Yes\n" ) ; }
        else { printf ( "No\n" ) ; }
    }
}

int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}



Measured memory_bytes: 1024
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main(){
    let n:u32 = read();
    let ans = match n {
        22 => "Christmas Eve Eve Eve",
        23 => "Christmas Eve Eve",
        24 => "Christmas Eve",
        _ => "Christmas",
    };
    println!("{}",ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
long long ans(long long a, long long b, long long x){
	return floor(a*x/b-a*(x/b));
}
int main(){
	long long a, b, n;
	cin >>  a >> b >> n;
	cout << (b-1<=n? ans(a,b,b-1) : ans(a,b,n)) << endl;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(2e5 + 5);

int n;
ll k;
ll a[MAX_N];

ll acc[MAX_N];

int main(void) {
  // Here your code !
  scanf("%d %lld", &n, &k);

  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &(a[i]));
  }

  for (int i = 1; i <= n; ++i) {
    acc[i] = acc[i - 1] + a[i];
  }

  ll ans = 0LL;

  unordered_map<ll, ll> cnt;

  cnt[0LL] = 1LL;

  for (int i = 1; i <= n; ++i) {
    ll lli = (ll)(i);

    ll last = lli - k;
    if (last >= 0LL) {
      ll remove = (acc[int(last)] - last) % k;
      cnt[remove] -= 1LL;
    }

    ll target = (acc[i] - lli) % k;

    ans += cnt[target];

    cnt[target] += 1LL;
  }

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

  return 0;
}


Measured memory_bytes: 12324
#include <iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(void){
    int n,min2=2000000000,max2=-2;
    int a[101];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        max2=max(max2,a[i]);
        min2=min(min2,a[i]);
    }
    cout<<max2-min2<<endl;
    
    
}


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

#define int long long
#define forn(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())


int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int h, n;
	cin >> h >> n;
	vector<int> a(n);
	int sum = 0;
	forn(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum >= h) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int n, a[205];
int main() {
	//freopen("D:\\input.txt", "r", stdin);
	cin >> n;
	n *= 2;
	for (int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + 1 + n);
	int ans = 0;
	for (int i = 1; i <= n; i += 2) ans += a[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,x,to) for(int i=x;i<to;i++) 
  
int main() {
    long long n,m,l,a[100][100],b[100][100],ans[100][100]={};
    cin >> n >> m >> l;
    rep(i,0,n){
        rep(j,0,m){
            cin >> a[i][j];
        }
    }
    rep(i,0,m){
    	rep(j,0,l){
    	 cin >> b[i][j];
    	}
    }
   
    rep(i,0,n){
        rep(j,0,m){
        	rep(k,0,l){
        		ans[i][k] += a[i][j]*b[j][k]; 	
        	}
        }
    }
     
     rep(i,0,n){
	rep(j,0,l){
		if(j!=l-1) cout << ans[i][j] << " ";
		else cout << ans[i][j];
	}
	cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3288
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	vector<ll> a(3 * n);
	for(int i = 0; i < 3 * n; ++i) {
		cin >> a[i];
	}		
	
	sort(a.rbegin(), a.rend());
	
	ll ans = 0LL;
	for(int i = 0; i < n; ++i) {
		ans += a[i * 2 + 1];
	}
	
	cout << ans << endl;
	
	return 0;
}


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

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

  ll x;
  cin >> x;

  for (ll i = -200; i <= 200; ++i) {
    for (ll j = -200; j <= 200; ++j) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << " " << j << '\n';
        return (0);
      }
    }
  }

  return (0);
}


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

def main():
    A, B, C, D = [int(i) for i in input()]
    B, C, D = [[i, -i] for i in [B, C, D]]
    pm = ["+", ""]
    for i in range(2):
        for j in range(2):
            for k in range(2):
                if A + B[i] + C[j] + D[k] == 7:
                    ans = [A, pm[i], B[i], pm[j], C[j], pm[k], D[k], "=7"]
                    return("".join(map(str,ans)))

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

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;
 int main(){
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if(s[0]==s[1] && s[1]!=s[2] && s[2] == s[3]){
        cout << "Yes" <<endl;
    }
    else cout << "No" << endl;
    return 0;
 } 

Measured memory_bytes: 256
#include<stdio.h>
 int main()
{
  int W;
  int H;
  int x;
  int y;
  int r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(W>=x+r&&H>=y+r&&0<=x-r&&0<=y-r){
                     printf("Yes\n");
                    }
                         
  else{
        printf("No\n");
      }
 
       
  return 0;
}

Measured memory_bytes: 584
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*
import kotlin.comparisons.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val (a, b) = readListOfInt()

    println(if(b % a == 0) a + b else b - a)
    pw.flush()
}

/****** Declared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }


// Extensions
fun<T> List<T>.toBuckets(bucketKeys: List<T>): Map<T, Int> {
    val buckets = bucketKeys.associate { t -> Pair(t, 0) }.toMutableMap()
    this.forEach { t ->
        buckets[t] = buckets[t]!! + 1
    }
    return buckets
}

fun <K, V> Map<K, V>.toMutableMap(): MutableMap<K, V> = HashMap(this)

// Util Functions
fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j]) % MOD
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


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

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

int main()
{
    string s,t; cin >> s >> t;
    int n = s.size(),m = t.size();
    bool ok = true;
    if(n < m){
        cout << "UNRESTORABLE";
        return 0;
    }
    else{
        rep(i,n-m+1){
            int st = n-m - i;
            bool same = true;
            rep(j,m){
                if(s[st+j] == '?') continue;
                if(s[st+j] != t[j]) same = false;
            }
            if(same){
                rep(j,m) s[st+j] = t[j];
                rep(j,n){
                    if(s[j] == '?') cout << "a";
                    else cout << s[j];
                }
                return 0;
            }
        }
    }
    cout << "UNRESTORABLE";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
    cin>>s;
    for(int i=0;i<3;i++)
        if(s[i]=='7')
        {
            printf("Yes\n");
            return 0;
        }
    printf("No\n");
    return 0;
}

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

typedef long long ll;
ll N,M;

ll pro(ll x)
{
    ll res = 1;
    for(int i = 1; i <= x; i++)
    {
        res *= i;
        res %= 1000000007;
    }
    return res;
}

int main()
{
    scanf("%lld%lld",&N,&M);
    if(abs(N - M) > 1)
    {
        printf("0\n");return 0;
    }
    ll ans;
    if(N == M)
    {
        ans = (pro(N) * pro(M)) * 2 % 1000000007;
        printf("%lld\n",ans);
    }
    else{ans = (pro(N) * pro(M)) % 1000000007;
        printf("%lld\n",ans);}
    return 0;
}


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




int n;
vector<int> record;
int m;
multiset<int> E[101];
int num[101];
int dep[101];
int par[101];
//-----------------------------------------------------------------
void dfs(int& idx, int cur, int dpt) {
	if (idx == record.size()) return;
	if (E[cur].size() == num[cur]) return;

	if (0 < record[idx]) {
		m++;
		num[m] = record[idx];
		if (0 < cur) {
			E[m].insert(cur);
			E[cur].insert(m);
		}
		dep[m] = dpt;
		par[m] = cur;
		idx++;
		dfs(idx, m, dpt + 1);
	} else {
		//printf("<%d : %d : %d>\n", cur, dpt - 1, record[idx]);
		rep(i, 0, m) if (dep[i] == dpt - 1 + record[idx] && E[i].size() < num[i]) {
			E[i].insert(cur);
			E[cur].insert(i);
			//printf("Break!\n");
			break;
		}
		idx++;
	}

	dfs(idx, cur, dpt);
}
void solve() {
	int idx = 0;
	m = 0;
	rep(k, 0, 101) E[k].clear();
	dep[0] = -1;
	par[0] = -1;
	num[0] = -1;
	dfs(idx, 0, 0);
	//rep(i, 0, m) cout << dep[i] << endl;
	rep(i, 0, m) {
		cout << (i + 1);
		for (int j : E[i + 1]) cout << " " << j;
		cout << endl;
	}
}
//-----------------------------------------------------------------
int main() {
	cin >> n;
	rep(i, 0, n) {
		record.clear();

		int j;
		while (cin >> j) {
			if (j == 0) break;
			record.push_back(j);
		}

		solve();
	}
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int H,W;
int cnt[26];
bool solve(){
	cin>>H>>W;
	rep(i,H){
		string s;
		cin>>s;
		rep(j,W) cnt[s[j]-'a']++;
	}
	if(H%2 + W%2 == 0){
		rep(i,26) if(cnt[i]%4!=0) return 0;
		return 1;
	}
	if(H%2 + W%2 == 1){
		if(H%2==0) swap(H,W);
		rep(i,26) if(cnt[i]%2!=0) return 0;
		int num2 = 0;
		rep(i,26) if(cnt[i]%4!=0) num2++;
		if(num2>W/2) return 0;
		return 1;
	}
	if(H%2 + W%2 == 2){
		int num1 = 0;
		rep(i,26) if(cnt[i]%2!=0) num1++;
		if(num1>1) return 0;
		int num2 = 0;
		rep(i,26) if(cnt[i]%4==2) num2++;
		if(num2>H/2+W/2) return 0;
		return 1;
	}

}
int main(){
	if(solve()) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    string s;
    cin >> s;
    ll ans = 0;
    reps(i, 1, len(s)) {
        if (i % 2 == 1) continue;
        string ls = s.substr(0, i / 2);
        string rs = s.substr(i / 2, i / 2);
        if (ls == rs) ans = max(ans, i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut queries = vec![];
    for i in 0..n {
        let v = read_vec::<usize>();
        queries.push((v[0], v[1]));
    }

    let mut pressed = 0;
    for &(a, b) in queries.iter().rev() {
        let a = a + pressed;
        if a % b == 0 {
            continue;
        }
        pressed += b - a % b;
    }

    println!("{}", pressed);
}

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

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


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

int main(void){
    int h,w,n,ans;cin >> h >> w >> n;
    set<int> st[w+1];//st[i]にはi列目にある障害の高さの一覧を格納
    rep(i,n){
        int h1,w1;
        cin >> h1 >> w1;
        st[w1].insert(h1);
    }//入力
    auto itr = st[0].begin();
    if(st[0].size()==0)ans=h;//1列目に障害がない
    else ans = *itr-1;//1列目の最もwが低い障害
    int loss = 0;//青木が障害にぶつかる回数
    rep1(i,w+1){//i列目のloss+iより大きい位置にある障害の中で最もwが低い障害を調べる
        while(st[i].find(i+loss)!=st[i].end())loss++;//青木が障害にぶつかる
        itr = st[i].begin();
        rep(j,(int)st[i].size()){
            if(j!=0)itr++;
            if(*itr>loss+i){
                if(ans>*itr-1)ans = *itr-1;//答えの更新
                break;//見つけたらその列の探索は終了
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 18944
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
// #include <bits/stdc++.h>
using namespace std;

#define size_t int
typedef long long ll;
// #define int long long
typedef vector<int> VI;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define debug(x) cerr << #x << " = " << (x) << " (line " << __LINE__ << ")" << endl;
#define debug1(i, x) cerr << "(" << (i) <<  ") " << #x << " = " << (x) << " (line " << __LINE__ << ")" << endl;
#define debug2(i, j, x) cerr << "(" << (i) << ", " << (j) <<  ") " << #x << " = " << (x) << " (line " << __LINE__ << ")" << endl;
template <typename T> class vec2d : public vector<vector<T>> {
public:
    vec2d(int H, int W): vector<vector<T>> (H, vector<T>(W)) {
    }
};
template <typename T> istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template <typename T> ostream& operator << (ostream& os, vector<T>& vec){
  REP(i, vec.size()) {
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0);
        // cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

signed main(signed argc, char **argv) {
  int N;
  cin >> N;
  VI h(N);
  cin >> h;
  int r = 0;
  while (1) {
    bool f = 0;
    bool end = 0;
    for (size_t i = 0; i < N; i++) {
      // debug1(i, h[i]);
      if (f) {
        if (h[i] == 0) {
          f = 0;
          r++;
        } else {
          end = 1;
          h[i]--;
        }
      } else {
        if(h[i] != 0) {
          f = 1;
          h[i]--;
          end = 1;
        }
      }
    }
    if (f == 1) {
      r++;
    }
    if (end == 0) {
      cout << r << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
   int i,j,k;
   scanf("%d",&i);
   scanf("%d",&j);
   scanf("%d",&k);
   if(i==j && j!=k || i==k && j!=k || k==j && j!=i){
     printf("Yes");
     }
     else{
     printf("No");
     }
     return 0;
     }

Measured memory_bytes: 128
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

int gcd(int a, int b) {
    if (b == 0) { return a; }
    return gcd(b, a % b);
}

const int MAX_N = 100050;
int N;
long long K, A[MAX_N];

int main(int argc, char **argv) {
    std::cin >> N >> K;

    for (int i = 1; i <= N; i++) {
        std::cin >> A[i];
    }

    if (N == 1) {
        if (A[1] == K) {
            std::cout << "POSSIBLE" << std::endl;
        } else {
            std::cout << "IMPOSSIBLE" << std::endl;
        }
        return 0;
    }

    long long max = A[1];
    long long divisor = A[1];

    for (int i = 2; i <= N; i++) {
        divisor = gcd(divisor, A[i]);
    }

    for (int i = 1; i <= N; i++) {
        if (A[i] >= K && (A[i] - K) % divisor == 0) {
            std::cout << "POSSIBLE" << std::endl;
            return 0;
        }
    }

    std::cout << "IMPOSSIBLE" << std::endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
  int a,b,c,d;
  d=0;
  cin>>a>>b>>c;
  if(a==b){
  if(b==c){
  d++;
  }
  }
  if(d==1){
  cout<<"Yes"<<endl;
  }else{
  cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.141592653589793238
#define dcout cout<<fixed<<setprecision(50)
#define _popcnt __builtin_popcount

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long
#define double long double

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

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

  int N, A[200000]; cin >> N;
  REP(i, N) cin >> A[i];
  bool ok = 1;
  if(A[0] != 0) ok &= 0;
  REP(i, N-1){
    if(A[i] < A[i+1]-1) ok &= 0;
  }
  if(!ok){
    cout << -1 << endl;
    return 0;
  }
  int ans = 0;
  REP(i, N-1){
    if(A[i+1] <= A[i]) ans += A[i];
  }
  ans += A[N-1];
  cout << ans << endl;
}

Measured memory_bytes: 1792