akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const auto INF = (ll)1e9;
using v = vector<ll>;
using m = map<int,int>;
using vv = vector<v>;

int main(){
    int x,y,z;
    cin >> x >> y >>z;
    auto ans = x/(y+z);
    auto d   = ans*(y+z);
    cout <<(x-d>=z?ans:ans-1);
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

(n, k), s, res, sm = map(int, input().split()), list(map(lambda x: (int(x) + 1) / 2, input().split())), 0, 0
for i in range(n):
	if i < k: sm += s[i]
	else: sm += s[i]; sm -= s[i-k]
	res = max(res, sm)
print(f'{res:.10f}')
# print(f'{max([sum(s[i:i+k]) for i in range(n - k + 1)]):.10f}')

Measured memory_bytes: 91064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main() {
  int i, j;

  char str[20];
  char orig[] = "YAKI";
  
  scanf("%s", &str);

  if (strstr(str, orig) == str) {
    printf("Yes");
  }
  else {
    printf("No");
  }

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<ll, int> mp;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b;
	cin >> a >> b;
	cout << a / b << " " << a % b << " ";
	cout << fixed << setprecision(10) << (double)a / (double)b << endl;
	return 0;
}


Measured memory_bytes: 3308
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
#define rep(i,s,n) for(ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(),a.end()
#define mod 1000000007
using namespace std;
using graph =vector<vector<ll>>;
/*階乗*/
ll factorial(ll n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

/* ユークリッドの互除法 最大公約数*/
ll gcd(ll a, ll b) {
	return b ? gcd(b,a%b) : a;
}



/*最小公倍数*/

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


/*二点間の距離*/
double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}
/*
ll solve(ll i,ll m,vector<ll>t,ll n){
    if(m==0){
        return 1;
    }
    if(i>=n){
        return 0;
    }
    
    
    cout<<i+1<<" "<<m<<endl;
    cout<<i+1<<" "<<m-t[i]<<endl;
    ll res=solve(i+1,m,t,n)||solve(i+1,m-t[i],t,n);
    return res;
}
*/

//小数点12桁
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;


int main()
{
    ll a,b,c,x;
    cin>>a>>b>>c;
    if(c-a-b<0){
        cout<<"No"<<endl;
        exit(0);
    }
    x=(c-a-b)*(c-a-b)-4*a*b;
    //cout<<x<<endl;
    if(x>0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
   
    
    
}


Measured memory_bytes: 256
from fractions import gcd

n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(set(a))

a=list(map(lambda x: x//2, a))

def lcm(q):
  x = q[0]
  for i in range(1, len(q)):
    x = (x * q[i]) // gcd(x, q[i])
  return x

lcma=lcm(a)

if (lcma//a[0])%2==0:
  print(0)
else:
  flg=0
  for i in range(1,len(a)):
    if (lcma//a[i])%2==0:
      print(0)
      flg=1
      break
  if flg==0:
    temp=m//lcma
    print(temp//2 if temp%2==0 else temp//2+1)

Measured memory_bytes: 16316
#include <bits/stdc++.h>
#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 REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = (LL)1e9+7;
const int SIZE = 2e5+5;
const LL INF = 1LL<<60;
const double eps = 1e-4;
const double PI=3.1415926535897932;

vector<int> adj[2000009];
vector<LL> orow;//occupied rows
unordered_set<LL> q;
LL n,m,rowblock;
bool vis[2000009];

void dfs(int x){
	for(int i:adj[x]){
		if(vis[i])continue;
		vis[i]=1;dfs(i);
	}
}

LL solve(int bc){//block count
	REP(i,2000009)adj[i].clear();
	vector<LL> orow2;
	REP(i,bc){
		for(LL j:orow){
			orow2.PB(j+rowblock*i);
		}
	}
	MS0(vis);
	int nn=0;
	REP(i,SZ(orow2)){
		LL ri=orow2[i];
		REP(j,7){
			if(q.find((ri*7+j)%m)!=q.end())vis[nn+j]=1;
		}
		REP(j,6){
			if((!vis[nn+j])&&(!vis[nn+j+1])){
				adj[nn+j].PB(nn+j+1);
				adj[nn+j+1].PB(nn+j);
			}
		}
		if(i){
			REP(j,7){
				if((!vis[nn-7+j])&&(!vis[nn+j])){
					adj[nn-7+j].PB(nn+j);
					adj[nn+j].PB(nn-7+j);
				}
			}
		}
		nn+=7;
	}
	int con=0;
	REP(i,nn){
		if(vis[i])continue;
		dfs(i);
		con++;
	}
	return con;
}

int main(){
	scanf("%lld%lld",&n,&m);
	DRI(qn);//find m value for m rows ? D:
	rowblock=m;
	if(m%7==0)rowblock/=7;
	REP(i,qn){
		DRI(x);
		q.insert(x);
		while(x<rowblock*7){
			LL ri=x/7;
			orow.PB(ri);
			x+=m;
			if(ri+1<rowblock)orow.PB(ri+1);
		}
	}
	orow.PB(0);orow.PB(rowblock-1);
	sort(ALL(orow));
	orow.resize(unique(ALL(orow))-orow.begin());
	if(n/rowblock<=3){
		printf("%lld\n",solve(n/rowblock));
	}
	else{
		LL v2=solve(2),v3=solve(3);
		printf("%lld\n",(v3-v2)*(n/rowblock-2)+v2);
	}
}


Measured memory_bytes: 104308
#include <iostream>
#include <cstdio>
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
int N;
int64 S,X[MAXN],P[MAXN],ans;
void Solve() {
    scanf("%d%lld",&N,&S);
    for(int i = 1 ; i <= N ; ++i) {
        scanf("%lld%lld",&X[i],&P[i]);
    }
    int L = 1,R = N;
    int dir = 0;
    while(1) {
        if(X[L] >= S) {ans += X[R] - S;break;}
        if(X[R] <= S) {ans += S - X[L];break;}
        if(P[L] >= P[R]) {
            if(dir != 1) {dir = 1;ans += X[R] - X[L];}
            P[L] += P[R];R--;
        }
        else {
            if(dir != 2) {dir = 2;ans += X[R] - X[L];}
            P[R] += P[L];L++;
        } 
    }
    printf("%lld\n",ans);
}
 
int main() {
    Solve();
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a,b;
  cin>>a>>b;
  vector<ll>vec(0);
  for(ll i=0;i<a;i++){
    ll c,d;
    cin>>c>>d;
    if(d<=b){
      vec.push_back(c);
    }
  }
  if(vec.size()==0){
    cout<<"TLE"<<endl;
  }
  else{
    sort(vec.begin(),vec.end());
    cout<<vec.at(0)<<endl;
  }
  return 0;
}
  
  
    
    
  


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    vector<int> a(10);
    for (int i = 0; i < 5; i++)
    {
        cin >> a[i];
    }
    int hoge = 10;
    int ans = 0;
    for (int i = 0; i < 5; i++)
    {
        int tmp = a[i] % 10;
        if (tmp < hoge && tmp != 0)
        {
            hoge = tmp;
            ans = a[i];
        }
    }
    bool flag = true;
    int an = 0;
    for (int i = 0; i < 5; i++)
    {
        if (ans == a[i] && flag)
        {
            an += a[i];
            flag = false;
        }
        else
        {
            if (a[i] % 10 == 0)
                a[i] -= 1;
            an += (a[i] / 10 + 1) * 10;
        }
    }
    cout << an << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 int bingo[3][3];
 for(int j = 0;j<3;j++){
  for(int k = 0;k<3;k++){
    cin >> bingo[j][k];
  }
 }
 int n;
 cin >> n;
 int num[n];
 for (int i = 0;i<n;i++){
   cin >> num[i];
   for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++)
    if(bingo[j][k] == num[i]) bingo[j][k] = -1;
 }
 string ans = "No";
  for(int i = 0; i < 3; i++)
    if(bingo[i][0] == -1 && bingo[i][1] == -1 && bingo[i][2] == -1)
      ans = "Yes";
  for(int i = 0; i < 3; i++)
    if(bingo[0][i] == -1 && bingo[1][i] == -1 && bingo[2][i] == -1)
      ans = "Yes";
  if(bingo[0][0] == -1 && bingo[1][1] == -1 && bingo[2][2] == -1)
    ans = "Yes";
  if(bingo[0][2] == -1 && bingo[1][1] == -1 && bingo[2][0] == -1)
    ans = "Yes";
  cout << ans;
  return 0;
  }

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
    int H = 0, N = 0;
    int max = 0;
    int count = 0;

   cin >> N;

    for(int i=0; i<N; i++){
        cin >> H;

        if(H >= max){
            max = H;
            count++;
        }
    }

    cout << count;

    return 0;
}

Measured memory_bytes: 256
while True:
	a, b, c = input().split()
	a = int(a)
	c = int(c)
	if b == "?":
		break
	if b == "+":
		print(a + c)
	if b == "-":
		print(a - c)
	if b == "*":
		print(a * c)
	if b == "/":
	    print(a // c)


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

int main(){
    string s;
    cin>>s;
    int n = s.size();
    vector<int> ans(n,0);
    
    int r = 0;
    for(int i=0; i<n; i++){
        if(s[i]=='R') r++;
        else{
            ans[i-1]+=(r+1)/2;
            ans[i]+=r/2;
            r=0;
        }
    }
    
    int l = 0;
    for(int i=0; i<n; i++){
        if(s[n-i-1]=='L')l++;
        else{
            ans[n-i]+=(l+1)/2;
            ans[n-i-1]+=l/2;
            l=0;
        }
    }
    for(int i=0; i<n; i++){
        cout<<ans[i]<<" ";
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cmath>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <fstream>
#include <list>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <ctime>
#include<numeric>


using namespace std;
#define vec vector
#define pb push_back
#define en '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<ll, ll> pull;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef long double ld;
typedef pair<ld, int> pli;
typedef unsigned int ui;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vi2;
typedef vector<vector<ll>> vll2;
typedef vector<vector<ll>> matrix;
typedef vec<vec<vec<int>>> vi3;

#define _DEBUG

#define pb push_back
#define en '\n'
#define for0(i,n) for(int i = 0;i<n;i++)
#define for1(i,n) for(int i = 1;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pii pair<int,int>
#define pll pair<ll,ll>
#define REP(a,i,b) for (int i = a;i<b;i++);
#pragma warning(disable : 4996)
/*
 #pragma GCC optimize("Ofast")
 #pragma GCC target("avx,avx2,fma")
 */
const int inf = 2e9;
const ll linf = 2e18;
const ld LDINF = 2e18;


void solve()
{
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ans = -linf;
	ans = max(a * c, ans);
	ans = max(a * d, ans);
	ans = max(b * c, ans);
	ans = max(b * d, ans);
	cout << ans;
}


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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int tst = 1;
	//cin >> tst;
	while (tst--)
		solve();
	return 0;
}

Measured memory_bytes: 3648
from operator import itemgetter

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=itemgetter(0))

res = 0
count = 0
for a, b in AB:
    if count + b < M:
        res += a * b
        count += b
    else:
        res += (M - count) * a
        break
print(res)


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

int main(void) {
    int N,X,L;
    int sum,cnt;
    cin >> N >> X;

    sum = 0;
    cnt = 1;
    for(int i=0;i<N;i++) {
        cin >> L; 
        sum += L;
        if(sum <=X) {
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int n;
    String[] ring;
    String s;
    int count;
    int i, point;

    void run(){
	while(sc.hasNext()){
	    s = sc.next();
	    n = sc.nextInt();
	    ring = new String[n];
	    for(i=0; i<n; i++)
		ring[i] = sc.next();
	    count = 0;
	    solve();
	}
    }

    void solve(){
	for(i=0; i<n; i++)
	    if(search(ring[i])) count++;
	System.out.println(count);
    }

    boolean search(String c){
	point = 0;
	int start = 0;
	int m = 0;
	boolean cont = true;
	boolean[] flag = new boolean[c.length()];
	Arrays.fill(flag, true);
	boolean now = true;
	boolean find = false;

	while(cont){
	    //System.out.println("*"+point+" "+m);
	    boolean tf = 
		s.substring(m, m+1).equals(c.substring(point, point+1));
	    if(tf){
		point = (point+1)%10;
		m++;
		if(m>=s.length()) find = true;
	    }
	    else{
		flag[start] = false;
		start = (start+1)%10;
		point = start;
		m = 0;
	    }
	    cont = !find && flag[start];
	}

	return find;
    }
}
	

Measured memory_bytes: 17388
n, w = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

dp = [[0 for j in range(w + 1)] for i in range(2)]

for i, (wi, vi) in enumerate(x):
    dp_pre = dp[1 - i % 2]
    dp_cur = dp[i % 2]
    for j in range(1, wi):
        dp_cur[j] = dp_pre[j]
    for j in range(wi, w + 1):
        dp_cur[j] = max(dp_pre[j], dp_pre[j - wi] + vi)
print(max(dp_cur))


Measured memory_bytes: 51056
#include<bits/stdc++.h>
#define ls(x) (x)<<1
#define rs(x) (x)<<1|1
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ll rt<<1
#define rr rt<<1|1
#define PI acos(-1)
#define MM int m=(l+r)>>1;
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
#define lcm(a,b) (a*b)/__gcd(a,b)
#define Case(i,ans) cout<<"Case "<<i<<": "<<ans<<endl;
#define cp(i,ans) printf("%.if",ans);
#define cpp(i,ans) cout<<setprecision(i)<<fixed<<ans<<endl;
#define ppb pop_back
#define ppf pop_front
#define pb push_back
#define pf push_front
#define pq priority_queue
#define lowbit(x) (x)&(-x)
#define all(V) V.begin(),V.end()
#define ms multiset
#define mod(x) (x)%mo_num
#define vc vector
#define vct vector<int>
#define fa(i,V) for(auto i:V)
#define out(i) cout<<(i)<<endl;
#define fi first
#define sc second
#define fun(i) fu(i,1,n)
#define fut(i) fu(i,1,t)
#define fum(i) fu(i,1,m)
#define ld long double
//#define P pair<int,int>
using namespace std;
const int INF=LLONG_MAX;
const int maxn=1e6+5;
const int mo_num=1e9+7;
int n,m,a[maxn],b[maxn],ans;
struct node{
    int to,next;
}e[maxn];
int cnt,head[maxn];
void add(int x,int y){
    e[cnt]={y,head[x]};//这一行实现了简洁！
    head[x]=cnt++;
}
int du[maxn],vis[maxn],f[maxn];
void dfs(int to,int from)
{
    vis[to]=1;
    for(int i=head[to];~i;i=e[i].next)
    {
        int v=e[i].to;
        if(v==from)continue;
        if(!vis[v]) {
            dfs(v, to);
        }
        else if(!f[i]){
            f[i]=f[i^1]=1;
            cout<<to<<" "<<v<<endl;
            du[to]^=1;
        }
    }
    if(!from)return;
    if(du[to]%2)cout<<to<<" "<<from<<endl;
    else {
        cout << from << " " << to << endl;
        du[from]^=1;
    }

}
int32_t main()
{
    IOS
    cin>>n>>m;
    memset(head,-1,sizeof head);
    if(m%2)return cout<<-1,0;
    fum(i)
    {
        int u,v;
        cin>>u>>v;
        add(u,v),add(v,u);
    }
    dfs(1,0);
    return 0;
}


Measured memory_bytes: 28160
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

ll nums[1009];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, K;
    cin>>N>>K;
    
    rep1(i,N) cin>>nums[i];
    rep1(i,N-1) nums[i+1]+=nums[i];
    
    map<ll,int> dic;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N+1;j++){
            ll n=nums[j]-nums[i];
            dic[n]++;
        }
    }
    
    ll ans=0;
    for(int i=40;i>=0;i--){
        ll b=(1LL<<i);
        map<ll,int> nxt;
        int cnt=0;
        for(auto& a:dic){
            ll n=a.first;
            if((n&b)==b){
                nxt[n]+=a.second;
                cnt+=a.second;
            }
        }
        if(cnt>=K){
            swap(dic,nxt);
            ans|=b;
        }
    }
    cout1(ans);
}

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

int main(){
    int n,s[100000],q,t[50000],total=0;
    cin >> n;
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    cin >> q;
    for(int i=0;i<q;i++){
        cin >> t[i];
    }
    sort(s,s+n);
    for(int i=0;i<q;i++){
        if(binary_search(s,s+n,t[i])){
        total++;
        }
    }
    
    cout<<total<<endl;
    return 0;
    
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int64_t dp[100000];
  dp[0]=1;
  dp[1]=1;
  dp[2]=2;
 for(int i=1;i<100000;i++)
 { 
   dp[i+2]=dp[i]%1000000007+dp[i+1]%1000000007;
 }
 int N;
   cin>>N;
  int M;
  cin>>M;
  vector<int>sd(M); 
  int c=1;
  
for(int i=0;i<M;i++)  

{
int a;
  cin>>a;
  sd.at(i)=a;
  if(i>0 && sd.at(i)-sd.at(i-1)==1)
  {c=0; }
}
 if(c==0) cout<<0;
 else if(M==0) cout<<dp[N];
  else
  {int64_t g=1;
    for(int i=0;i<M+1;i++)
    {
    if(i==M) g=g*dp[N-sd.at(M-1)-1]%1000000007;

  
     if(i==M-1) g=g*dp[sd.at(0)-1];
   else if(i<M-1)g=g*dp[sd.at(i+1)-sd.at(i)-2]%1000000007;
    }
  cout<<g<<endl;
  }
  
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int a[110000] = {};
int sum[110000] = {};

int main()
{
    int n;
    cin >> n;
    a[0] = a[n + 1] = 0;
    int su = 0;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        sum[i] = abs(a[i] - a[i - 1]);
        su += sum[i];
    }
    sum[n + 1] = abs(a[n]);
    su += abs(a[n]);
    for (int i = 1; i <= n; i++)
    {
        int ans = 0;
        ans = su - sum[i] - sum[i + 1];
        ans += abs(a[i + 1] - a[i - 1]);
        cout << ans << "\n";
    }
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
const int inf=1<<30;
int dp[9][1000][1000];
int mx[]={1,0,-1,0},my[]={0,1,0,-1};
int main(){
	int h,w,n;	cin>>h>>w>>n;
	vector<string> s(h);
	int sx,sy;
	for(int i=0;i<h;i++){
		cin>>s[i];
		for(int j=0;j<w;j++){
			if(s[i][j]=='S'){
				sx=j,sy=i;
				break;
			}
		}
	}
	for(int i=0;i<9;i++){
		for(int j=0;j<1000;j++){
			for(int k=0;k<1000;k++)	dp[i][j][k]=inf;
		}
	}
	queue<pair<int,int>> q;
	int ans=0;
	for(int i=0;i<n;i++){
		dp[i][sy][sx]=0;
		q.push(make_pair(sy,sx));
		while(!q.empty()){
			auto now=q.front();	q.pop();
			int y=now.first,x=now.second;
			for(int j=0;j<4;j++){
				int nx=x+mx[j],ny=y+my[j];
				if(nx<0||w<=nx||ny<0||h<=ny)	continue;
				if(s[ny][nx]=='X')	continue;
				if(s[ny][nx]-'0'==i+1){
					sy=ny;	sx=nx;
					ans+=dp[i][y][x]+1;
					while(!q.empty())	q.pop();
					break;
				}
				if(dp[i][ny][nx]==inf){
					dp[i][ny][nx]=dp[i][y][x]+1;
					q.push(make_pair(ny,nx));
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  string s; cin >> s;
  int blue = 0;
  
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) - '0' == 1) {
      blue++;
    }
  }
  
  if (blue < s.size() - blue) cout << blue * 2 << endl;
  else cout << (s.size() - blue) * 2 << endl;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC133C
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var l = input[0];
            var r = input[1] + 1;
            var r2 = l + 5000;
            var r3 = Math.Min(r, r2);

            var min = 9999;

            foreach (var x in Enumerable.Range(l, r3 - l))
                foreach (var y in Enumerable.Range(x + 1, r3 - x - 1))
                {

                    var result = (long)x * y % 2019;
                    if (min > result)
                    {
                        //Console.WriteLine($"{x} * {y} = {(long)x * y % 2019}");
                        min = (int)result;
                    }
                }

            Console.WriteLine(min);
        }
    }
}


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

public class Main {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer stok;

    String nextToken() throws IOException {
        while (stok == null || !stok.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null) {
                return null;
            }
            stok = new StringTokenizer(s);
        }
        return stok.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    char nextChar() throws IOException {
        return (char) (br.read());
    }

    String nextLine() throws IOException {
        return br.readLine();
    }

    void solve() throws IOException {
        int x = nextInt();
        int y = nextInt();
        int z = nextInt();
        out.println((x - z) / (y + z));

    }

    void run() throws IOException {
        // br = new BufferedReader(new FileReader("dragons.in"));
        //out = new PrintWriter("dragons.out");
        // br = new BufferedReader(new FileReader("input.txt"));
        // out = new PrintWriter("output.txt");
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        br.close();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        // Locale.setDefault(Locale.US);
        new Main().run();
    }
}

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

using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;

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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
#define debug(x)  cout << #x << " = " << (x) << endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//グラフ用
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};	
//ここから書き始める

ll combination(ll n, ll i){
	ll count = 0;
	ll multi = 1;
	ll div =1;
	int limit = i;
	while(count < limit){
		multi *= n;
		n--;
		multi/= count+1;
		count ++ ;
	}
	return multi / div;
}

int main()
{
	cout <<setprecision(10);
	int n ;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];

	bool up = false , down = false;
	int ans = 1;
	for(int i = 1; i< n ; i++){
		if(up){
			if(a[i-1] > a[i]){
				up = down = false; 
				ans++;
			}
		}else if(down){
			if(a[i-1] < a[i]){
				up = down = false; 
				ans ++;
			}
		}
		else{
			if(a[i-1] == a[i]){
				//何もしなくていい
			}else if(a[i-1] < a[i]){
				up = true;
				down = false;
			}
			else{
				up = false;
				down = true;
			}
		}
	}
	cout << ans << endl;
}	


Measured memory_bytes: 640
class BinaryIndexedTree():
    def __init__(self, N):
        self.N = N
        self.arr = [0] * (N+1)

    def query(self, i):
        ret = 0
        i += 1
        while i:
            ret += self.arr[i]
            lsb = i & (-i)
            i -= lsb
        return ret

    def add(self, i, v):
        i += 1
        while i < self.N+1:
            lsb = i & (-i)
            self.arr[i] += v
            i += lsb


def main():
    N, Q = map(int, input().split())
    C = list(map(int, input().split()))

    queries = [None] * Q
    for i in range(Q):
        l, r = map(int, input().split())
        queries[i] = [l, r, i]
    queries.sort(key=lambda x: x[1])

    bit = BinaryIndexedTree(N)
    numdupls = 0
    prevs = [-1] * N
    cur = 0
    ans = [-999] * Q
    for i in range(Q):
        l, r, qindex = queries[i]
        while cur < r:
            c = C[cur] - 1
            if prevs[c] != -1:
                bit.add(prevs[c], 1)
                numdupls += 1
            prevs[c] = cur
            cur += 1
        ans[qindex] = r-l+1 - (numdupls - bit.query(l-2))
#        print(ans, "l=", l, "r=", r, numdupls, bit.query(l-2))
    for i in range(Q):
        print(ans[i])


if __name__ == "__main__":
    main()


Measured memory_bytes: 178276
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 10e9+7LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

void solve()
{
    IN(n);
    vector<ll> v(n);
    rep(i, n)
    {
        cin >> v[i]; --v[i];
    }
    vector<ll> t(n);
    rep(i, n)
    {
        ++t[v[i]];
    }
    ll s = 0;
    rep(i, n)
    {
        s += t[i] * (t[i] - 1) / 2;
    }
    rep(i, n)
    {
        cout << s - (t[v[i]] * (t[v[i]] - 1) / 2) + (t[v[i]] > 0 ? (t[v[i]] - 1) * (t[v[i]] - 2) / 2 : 0) << endl;
    }
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 5760
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define m_p make_pair
#define sz(x) (int)x.size()
#define out(x) cerr<<#x<<" = "<<x<<" "
#define outln(x) cerr<<#x<<" = "<<x<<endl
#define outarr(x,l,r) cerr<<#x"["<<l<<"-"<<r<<"] = "; for (int _i=l;_i<=r;++_i) cerr<<x[_i]<<" ";cerr<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned int ui;
#define gc() getchar()
//char buf[1<<23],*p1=buf,*p2=buf;
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <class T> void read(T &x)
{
    x=0; char c=gc(); int flag=0;
    while (c<'0'||c>'9') flag|=(c=='-'),c=gc();
    while (c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=gc();
    if (flag) x=-x;
}
template <class T> T _max(T a,T b){return a>b ? a : b;}
template <class T> T _min(T a,T b){return a<b ? a : b;}
template <class T> bool checkmax(T &a,T b){return b>a ? a=b,1 : 0;}
template <class T> bool checkmin(T &a,T b){return b<a ? a=b,1 : 0;}
int n;
void init()
{
	read(n);
}

void solve()
{
	if (n%2==0)
	{
		printf("%d\n",n*(n-1)/2-n/2);
		for (int i=1;i<=n;++i)
		{
			for (int j=i+1;j<=n;++j)
			{
				if (i+j==n+1) continue;
				printf("%d %d\n",i,j);
			}
		}
	}
	else
	{
		printf("%d\n",n*(n-1)/2-(n-1)/2);
		for (int i=1;i<=n;++i)
		{
			for (int j=i+1;j<=n;++j)
			{
				if (i+j==n) continue;
				printf("%d %d\n",i,j);
			}
		}
	}
}

#undef int
int main()
{
	init();
	solve();
    return 0;
}


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

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

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    ll K; cin >> K;
    cout << 50 << endl;
    vector<ll> a(50);
    rep(i, 50) a[i] = i;
    ll x = K/50, y=K%50;
    rep(i, 50){
        a[i] += x;
        if(i < y){
            a[i] += 50-y+1;
        }else{
            a[i] -= y;
        }
        cout << a[i];
        if(i != 49) cout << " ";
        else cout << endl;
    }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

#define int long long

signed main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; ++i) cin >> v[i];
    sort(v.begin(), v.end());
    vector<int> ans;
    for(int i=v.size()-1; i>0; i--) {
        if(v[i]==v[i-1]) {
            ans.push_back(v[i]);
            i--;
        }
    }
    if(ans.size()<=1) {
        cout << 0 << endl;
        return 0;
    }
    sort(ans.begin(), ans.end());
    cout << ans[ans.size()-1] * ans[ans.size()-2] << endl;
    return 0;
}



Measured memory_bytes: 1660
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (3e9)

using namespace std;
typedef long long int ll;

int N;
int A[200000];
int main(void){
    cin >> N;

    bool f = true;
    REP(i,N){
        cin >> A[i];
        if(A[i] == 1) f = false;
    }

    if(f){
        cout << -1 << endl;
        return 0;
    }

    int count = 0;
    REP(i,N){
        if(A[i] == count + 1) count++;
    }
    cout << N - count << endl;

    return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
	int n;
	scanf("%d", &n);
	n %= 10;
	if(n == 3) puts("bon");
	else if(n == 0 || n == 1 || n == 6 || n == 8) puts("pon");
	else puts("hon");
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

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

int main(){
    long long n;
    cin >> n;
    vector<long long> a(n);

    for(long long i = 0; i < n; i++) cin >> a[i];

    long long g = a[0];
    for(long long i = 0; i < n; i++){
        g = gcd(a[i], g);
    }

    if(g > 1){
        printf("not coprime\n");
        return 0;
    }
    
    vector<bool> is_prime(1100000, true);
    is_prime[0] = false;
    is_prime[1] = false;

    for(long long i = 2; i < 1100000; i++){
        if(is_prime[i] == false) continue;
        for(long long j = i*2; j < 1100000; j += i){
            is_prime[j] = false;
        }
    }

    vector<long long> primes;
    vector<long long> not_primes;
    vector<bool> used(1100000, false);
    vector<long long> small_prime;

    for(long long i = 0; i < 1100; i++){
        if(is_prime[i] == true) small_prime.push_back(i);
    }

    for(long long i = 0; i < n; i++){
        if(is_prime[a[i]] == true) primes.push_back(a[i]), used[a[i]] = true;
        else not_primes.push_back(a[i]);
    }

    for(long long i = 0; i < not_primes.size(); i++){
        for(long long j = 0; j < small_prime.size(); j++){
            if(not_primes[i] == 1) break;
            if(not_primes[i] % small_prime[j] != 0) continue;

            if(used[small_prime[j]] == true){
                printf("setwise coprime\n");
                return 0;
            }

            used[small_prime[j]] = true;

            while(not_primes[i] % small_prime[j] == 0){
                not_primes[i] /= small_prime[j];
            }

            if(not_primes[i] > 1){
                if(used[not_primes[i]] == true){
                    printf("setwise coprime\n");
                    return 0;
                }
                used[not_primes[i]] = true;
            }
        }
    }

    printf("pairwise coprime\n");
    return 0;
}

Measured memory_bytes: 20120
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC093.A
{
    class Program
    {
        static void Main ()
        {
            var sc = new Scanner ();
            int a = sc.NextInt ();
            int b = sc.NextInt ();
            int c = sc.NextInt ();
            var num = 0;
            if (a % 2 == b % 2 && a % 2 != c % 2)
            {
                a++;
                b++;
                num++;
            }
            else if (a % 2 == c % 2 && a % 2 != b % 2)
            {
                a++;
                c++;
                num++;
            }
            else if (b % 2 == c % 2 && b % 2 != a % 2)
            {
                b++;
                c++;
                num++;
            }
            var list = new List<int> { a, b, c };
            list.Sort ();
            Console.Error.WriteLine (string.Join (" ", list));
            num += (list[2] - list[1] + list[2] - list[0]) / 2;
            Console.WriteLine (num);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner ()
        {
            s = new string[0];
            i = 0;
        }

        public string Next ()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine ();
            while (st == "") st = Console.ReadLine ();
            s = st.Split (cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next ();
            i = 0;
            return s[i++];
        }

        public int NextInt ()
        {
            return int.Parse (Next ());
        }
        public int[] ArrayInt (int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextInt () + add;
            }
            return Array;
        }

        public long NextLong ()
        {
            return long.Parse (Next ());
        }

        public long[] ArrayLong (int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextLong () + add;
            }
            return Array;
        }

        public double NextDouble ()
        {
            return double.Parse (Next ());
        }

        public double[] ArrayDouble (int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDouble () + add;
            }
            return Array;
        }

        public decimal NextDecimal ()
        {
            return decimal.Parse (Next ());
        }

        public decimal[] ArrayDecimal (int N, decimal add = 0)
        {
            decimal[] Array = new decimal[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDecimal ();
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13268
//
//  main.cpp
//  Study
//
//  Created by 佐々木勇星 on 2020/03/12.
//  Copyright © 2020 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <sstream>
#include <iomanip>

using namespace std;


int main(int argc, const char * argv[]) {
    
    char s;
    
    cin >> s;
    
    s = s + 1;
    
    cout << s << endl;
    
    return 0;
}


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

int main() {
  string n;
  cin >> n;
  int A = n[n.size()-1]- '0';
  
  if(A == 3){
    cout << "bon" << endl;
    return 0;
  }
  if(A == 0 || A == 1 || A == 6 || A == 8){
    cout << "pon" << endl;
    return 0;
  }
  else cout << "hon" << endl;
}

Measured memory_bytes: 3624
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_G&lang=ja
from collections import deque

def main():
    n, wn = MI()
    dp = [0] * (wn + 1)
    for _ in range(n):
        v, w, m = MI()
        # wのmodごとに１つの数列として扱う
        for md in range(w):
            # スライド最大値をいれておくdeque
            q = deque()
            # インデックスのmodが等しい要素だけ取り出した数列のi番目に対しての処理
            for i in range((wn - md) // w + 1):
                # 更新したい場所の今の値を、先頭まで戻したと仮定した値で持っておく
                val = dp[i * w + md] - v * i
                # deque内は単調減少にしたいのでこれから追加するval以下の値は削除
                while q and q[-1][1] <= val: q.pop()
                # 今の値を追加
                q.append((i, val))
                # dequeの先頭を使って更新
                dp[i * w + md] = q[0][1] + v * i
                # 先頭が次に範囲外に出るようであれば削除
                if q[0][0] == i - m: q.popleft()
    print(dp[-1])

main()



Measured memory_bytes: 7672
import sys
input = sys.stdin.buffer.readline

N, M = map(int, input().split())
A = list(map(int, input().split()))
Need = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6]
Usable = {}
for a in A:
    if Need[a] in Usable:
        for key, value in Usable.items():
            if Need[a] == key and a > value:
                Usable[key] = a
    else:
        Usable[Need[a]] = a
Num = [-1] * (N + 1)
Num[0] = 0
for i in range(1, N+1):
    for u, v in Usable.items():
        if i < u:
            continue
        if Num[i - u] >= 0:
            if Num[i - u] == 0:
                Num[i] = max(v, Num[i])
            elif Num[i] < Num[i - u] * 10 + v:
                Num[i] = Num[i - u] * 10 + v

print(Num[N])

Measured memory_bytes: 84476
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let n = read!(usize);
    let a: Vec<i64> = read![[i64]];

    let mut ans_even = 0;
    let mut ans_odd = 0;
    let mut s_even = 0;
    let mut s_odd = 0;

    // 偶数番目を正にする場合
    let mut even = true;
    for &ai in &a {
        let tmp = s_even + ai;
        if even {
            // 偶数
            if tmp > 0 {
                s_even = tmp;
            } else {
                ans_even += 1 - tmp;
                s_even = 1;
            }
        } else {
            // 奇数
            if tmp < 0 {
                s_even = tmp;
            } else {
                ans_even += 1 + tmp;
                s_even = -1;
            }
        }
        even = !even;
    }

    // 奇数番目を正にする場合
    let mut odd = false;
    for &ai in &a {
        let tmp = s_odd + ai;
        if odd {
            // 奇数
            if tmp > 0 {
                s_odd = tmp;
            } else {
                ans_odd += 1 - tmp;
                s_odd = 1;
            }
        } else {
            // 偶数
            if tmp < 0 {
                s_odd = tmp;
            } else {
                ans_odd += 1 + tmp;
                s_odd = -1;
            }
        }
        odd = !odd;
    }

    println!("{}", min(ans_even, ans_odd));
}


Measured memory_bytes: 8444
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
 
int main(){
  int n, t, a, ans;
  double temp=1000;
  cin >> n >> t >> a;
  rep(i, n){
    int j;
    cin >> j;
    double x = t - j * 0.006;
    if(temp > abs(a - x)){
      temp = abs(a - x);
      ans = i + 1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
def int_to_str(n):
    if n == 0:
        return "a"
    elif n == 1:
        return "b"
    elif n == 2:
        return "c"
    elif n == 2:
        return "c"
    elif n == 2:
        return "c"
    elif n == 2:
        return "c"
    elif n == 2:
        return "c"
    elif n == 2:
        return "c"
    elif n == 2:
        return "c"

def Base_10_to_n(X, n):
    if (int(X/n)):
        if X%n != 0:
            return Base_10_to_n(int(X/n), n)+chr((X%n)+96)
        else:
            return Base_10_to_n(int(X/n)-1, n)+chr(26+96)
    if(X%n != 0):
        return str(chr(X%n+96))
    else:
        return ""

N = int(input())

s = Base_10_to_n(N,26)
print(s)


Measured memory_bytes: 9128