akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;
typedef long long ll;

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

    if (a + b == 0) {
        cout << 0;
    } else {
        ll ans = n / (a + b) * a;
        ll r = n % (a + b);
        ans += (r >= a ? a : r);
        cout << ans;
    }

    return 0;
}


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

int solve(int n,int arr[]){
    int temp[n];
    for(int i=1;i<=n;i++){
        temp[i-1]=i;
    }
    int idx=0;
    do{   
        int flag=0;
        for(int i=0;i<n;i++){
            if(arr[i]!=temp[i]){
                flag=1;
                break;
            }
        }
        if(!flag){
            return idx;
        }
        idx++;
    }
    while(next_permutation(temp,temp+n));
}
int32_t main()
{
    int n;cin>>n;

    int arr1[n],arr2[n];

    for(int i=0;i<n;i++) cin>>arr1[i];
    for(int i=0;i<n;i++) cin>>arr2[i];

    int num1=solve(n,arr1);
    int num2=solve(n,arr2);

    cout<<abs(num1-num2)<<endl;

    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
using namespace std;
int main() {
    while (1) {
    int p[201] = { 0 };
    int n, i, k, l, o = 1;
    cin >> n;
    if (n == 0)break;
    for (i = 0; i < n; i++)
    {
        cin >> k;
        p[k] = 1;
    }
    k = n;
    l = n;
    while (k != 0 && l != 0) {
        for (i = 1; i <= 2 * n; i++) {
            if (k == 0 || l == 0)
                break;
            if (p[i] == 1 && o == 1) {
                p[i] = 2;
                k--;
                o = 0;
            }
            if (p[i] == 0 && o == 0) {
                p[i] = 2;
                l--;
                o = 1;
            }
        }
        if (o == 1)o = 0;
        else o = 1;
    }
    cout << l << endl << k << endl;
}
    return 0;
}

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

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

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

  int g = a[0];
  for (int i = 1; i < n; ++i) g = gcd(g, a[i]);

  int m = *max_element(a.begin(), a.end());

  if (k % g == 0 && k <= m) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;

  return 0;
}

Measured memory_bytes: 3708
a,b=map(int,input().split())
s=str(input())
count=0
if len(s)==a+b+1:
  count+=1
if s[a]=='-':
  count+=1
if '-' not in s[:a] and '-' not in s[a+1:]:
  count+=1
if count==3:
  print('Yes')
else:
  print('No')
  

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

const int MaxN = 400000;
int n, m;
vector <int> g[MaxN + 5];
bool vis[MaxN + 5];

int main()
{
	while (~scanf("%d%d", &n, &m)) {
		memset(vis, 0, sizeof(vis));
		for (int i = 1; i <= m; i++) {
			int u, v;
			scanf("%d%d", &u, &v);
			g[u].push_back(v);
			g[v].push_back(u);
		}
		for (int i = 0; i < g[1].size(); i++) vis[g[1][i]] = true;
		bool flag = false;
		for (int i = 0; i < g[n].size(); i++) 
			if (vis[g[n][i]]) flag = true;
		if (flag) printf("POSSIBLE\n"); else printf("IMPOSSIBLE\n");
	}
	return 0;
}

Measured memory_bytes: 17008
#include<stdio.h>
#define N 100

int main(){
  int i,n,j,k,num[N],A[N][N] = {},id[N],judge,a;
  scanf("%d",&n);

 
  
  for(i=0;i<n;i++){
    
    scanf("%d%d",&a,&num[i]);
    for(j=0;j<num[i];j++){
      scanf("%d",&judge);
      A[i][judge-1] = 1;
    }
  }
  
  for(i=0;i<n;i++){
    
    for(k=0;k<n-1;k++){
      printf("%d ",A[i][k]);
    }
    printf("%d",A[i][k]);
    printf("\n");
      }
      
    
      
   
  return 0;
}



Measured memory_bytes: 2144
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int []ans=new int[n+1];
		int cnt=0;
		for(int x=1;x<=100;x++)for(int y=1;y<=100;y++)for(int z=1;z<=100;z++) {
			int d=x*x+y*y+z*z+x*y+y*z+z*x;
			if(d<=n)ans[d]++;
		}
		for(int i=1;i<=n;i++) {
			System.out.println(ans[i]);
		}
	}
}

Measured memory_bytes: 39028
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

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

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

		String s = sc.next();
		String t = sc.next();

		int ls = s.length();
		int lt = t.length();
		int ld = ls-lt;

		int chg = lt+1;
		for ( int i=0; i<=ld; i++ ) {
			int chg1 = lt;
			for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			}
			chg = Math.min(chg, chg1);
		}
		System.out.println(chg);
	}
}

Measured memory_bytes: 35768
a,b = map(int,input().split())

dis = 0
if a >= b :
    dis = a - b
    if abs(a - int(dis / 2 + b)) == abs(b - int(dis / 2 + b)) :
        print(int(dis / 2 + b))
    else :
        print("IMPOSSIBLE")
else :
    dis = b - a
    if abs(a - int(dis / 2 + a)) == abs(b - int(dis / 2 + a)) :
        print(int(dis / 2) + a)
    else :
        print("IMPOSSIBLE")


Measured memory_bytes: 3060
n = int(input())
t,a = map(int,input().split())
li = list(map(int,input().split()))
tmp = 0
ans_no = 1
ans_val = abs(a - (t - (li[0] * 0.006)))
for i in range(1,len(li)):
    tmp = abs(a - (t - (li[i] * 0.006)))
    if ans_val > tmp:
        ans_val = tmp
        ans_no = i + 1
print(ans_no)


Measured memory_bytes: 3060
from operator import itemgetter


input_ = input().split('\n')
N = int(input_[0])
list_ = list()


for i in range(1, N + 1):
    city, score = input().split(' ')

    list_.append([city, int(score), i])


list_sortByScore = sorted(list_,          key=itemgetter(1), reverse=True)
list_sortByCity = sorted(list_sortByScore, key=itemgetter(0))


[print(x[2]) for x in list_sortByCity]


Measured memory_bytes: 3060
a  = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

main = do
    k <- readLn
    print $ a !! (k - 1)


Measured memory_bytes: 3896
#include<stdio.h>

int n,A[2000],M[200],i,j,q;

int so(int i,int m){
  if(m==0)return 0;
  if(i>=n)return 1;
  return so(i+1,m)*so(i+1,m-A[i]);
}

int main(){

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++) scanf("%d",&M[i]);

  for(i=0;i<q;i++) {
    if(so(0,M[i])==0) printf("yes\n");
    else printf("no\n");
  }
}
  

  
    



Measured memory_bytes: 2052
sx, sy, tx, ty = map(int, input().split())

dx = abs(tx - sx)
dy = abs(ty - sy)

ans  = 'U'*dy + 'R'*dx
ans += 'D'*dy + 'L'*(dx)
ans += 'L' + 'U'*(dy+1) + 'R'*(dx+1) + 'D'
ans += 'R' + 'D'*(dy+1) + 'L'*(dx+1) + 'U'

print(ans)

Measured memory_bytes: 3064
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
    let n:usize = get_input().parse().unwrap();

    let mut ans = 0;

    for i in 1..n+1 {
        if i.to_string().len() % 2 != 0 {
            ans += 1;
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
int n, m;

struct PP {
	int p, y;
	int ans, res;
	int pos;
} a[maxx];

bool cmp(PP u, PP v) {
	if(u.p == v.p) return u.y < v.y;
	return u.p < v.p;
}

bool cmp0(PP u, PP v) {
	return u.pos < v.pos;
}

int Cnt(int x) {
	int dd = 0;
	while(x) {
		dd++;
		x /= 10;
	}
	return dd;
}

int main() {
	scanf("%d %d", &m, &n);
	for(int i = 1; i <= n; i++) {
		scanf("%d %d", &a[i].p, &a[i].y);
		a[i].pos = i;
	}
	sort(a + 1, a + n + 1, cmp);
	a[1].ans = a[1].p, a[1].res = 1;
	int t = 1;
	for(int i = 2; i <= n; i++) {
		a[i].ans = a[i].p;
		if(a[i].p != a[i - 1].p) {
			t = 1;
			a[i].res = 1;
		}
		else {
			t++;
			a[i].res = t;
		}
	}
	sort(a + 1, a + n + 1, cmp0);
	for(int i = 1; i <= n; i++) {
		int l = a[i].ans, r = a[i].res;
		int c1 = Cnt(l), c2 = Cnt(r);
		int L = 6 - c1, R = 6 - c2;
		while(L--) printf("0");
		printf("%d", l);
		while(R--) printf("0");
		printf("%d\n", r);
	}
}

Measured memory_bytes: 3456
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

const long long int mod=1000000007;
const long long int INF=99999999999999999;
long long int kaizyou[200005],kaizyouex[200005];
long long int n,k,res=1,coub=0,couw=0,y,m,d,a[20005],ooki[2005]={};
long long int dp[200005]={};
queue<pair<long long int,long long int> >que;
string str,strtmp="f";


//累乗(繰り返し2乗法)　aのb乗(mod)を求める。
long long int rui(long long int a, long long int b, long long mod) {
	int memo[65] = {};
	long long int A[65] = {};
	long long int tmp = 1;
	for (int i = 0; i < 65; i++) {
		memo[i] = b % 2;
		b /= 2;
	}

	A[0] = a;
	A[0] %= mod;

	for (int i = 1; i < 65; i++) {
		A[i] = A[i - 1] * A[i - 1];
		A[i] %= mod;
	}
	for (int i = 0; i < 65; i++) {
		if (memo[i] == 1) {
			tmp *= A[i];
			tmp %= mod;
		}
	}
	tmp %= mod;
	return tmp;
}


int main() {
	cout << fixed << setprecision(10);
	cin>>n>>str;
	kaizyou[0]=1;
	for(int i=1;i<=2*n;i++){
		res*=i;
		res%=mod;
		kaizyou[i]=res;
		//cout<<kaizyou[i]<<endl;
	}
	m=1;
	kaizyouex[0]=1;
	for(int i=1;i<=2*n;i++){
		m*=kaizyou[i];
		m%=mod;
		kaizyouex[i]=m;
		//cout<<kaizyouex[i]<<endl;
	}
	long long int now=0;
	bool key=true;
	for(int i=0;i<2*n;i++){
		if(now%2==0&&key&&str[i]=='B'){
			now++;
			key=true;
		}else if(now%2==0&&!key&&str[i]=='B'){
			now--;
			key=false;
		}else if(now%2==0&&key&&str[i]=='W'){
			now=now;
			key=false;
		}else if(now%2==0&&!key&&str[i]=='W'){
			now=now;
			key=true;
		}else if(now%2==1&&key&&str[i]=='B'){
			now=now;
			key=false;
		}else if(now%2==1&&!key&&str[i]=='B'){
			now=now;
			key=true;
		}else if(now%2==1&&key&&str[i]=='W'){
			now++;
			key=true;
		}else if(now%2==1&&!key&&str[i]=='W'){
			now--;
			key=false;
		}
		if(now<=0||now>n){
			cout<<0<<endl;
			return 0;
		}
		if(key==true){
			strtmp.push_back('s');
		}else{
			strtmp.push_back('f');
		}
	}
	
	if(now!=1){
		cout<<0<<endl;
		return 0;
	}
	res=kaizyou[n];
	
	long long int nows=0,nowf=0;
	for(int i=2*n;i>=0;i--){
		if(strtmp[i]=='f'){
			nowf++;
		}else{
			res*=nowf;
			res%=mod;
			//res*=kaizyou[nows];
			
			nowf--;
			//cout<<res<<endl;
		}
		//cout<<nows<<" "<<nowf<<endl;
	}

	cout<<res<<endl;
} 


Measured memory_bytes: 3968
#include <bits/stdc++.h>
// e.g. sort(all(a), [](int a1, int a2) { return a1 < a2; });
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

int main() {
  string s;
  cin >> s;

  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  int N=S.size();
  vector<int>a(N);
  for(int i=0;i<N;i++){
    if(S.at(i)=='0'){
      a.at(i)=0;
    }
    else if(S.at(i)=='1'){
      a.at(i)=1;
    }
    else if(S.at(i)=='2'){
      a.at(i)=2;
    }
    else if(S.at(i)=='3'){
      a.at(i)=3;
    }
    else if(S.at(i)=='4'){
      a.at(i)=4;
    }
    else if(S.at(i)=='5'){
      a.at(i)=5;
    }
    else if(S.at(i)=='6'){
      a.at(i)=6;
    }
    else if(S.at(i)=='7'){
      a.at(i)=7;
    }
    else if(S.at(i)=='8'){
      a.at(i)=8;
    }
    else if(S.at(i)=='9'){
      a.at(i)=9;
    }
  }
  int ans=0;
   for(int i=0;i<N;i++){
     ans+=a.at(i);
   }
  if(ans%9==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
   
  

Measured memory_bytes: 4448
def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

    n = int(input())
    a1s = list(map(int, input().split()))
    a2s = list(map(int, input().split()))
    a1_sum = a1s[0]
    a2_sum = sum(a2s)
    ans = a1_sum + a2_sum
    for i in range(1, n):
        a1_sum += a1s[i]
        a2_sum -= a2s[i - 1]
        ans = max(ans, a1_sum + a2_sum)
    print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include<stdio.h>
#include<queue>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int nex[400001];
int to[400001];
int val[400001];
int head[200001];
int f[200001];
int idx,x,y,z;
int inf=2147483647;
bool vis[200001];
struct Point
{
    int number,dis;
    inline bool operator < (const Point &a) const
    {
        return dis>a.dis;
    }
};
void addedge(int a,int b,int c)
{
    nex[++idx]=head[a];
    head[a]=idx;
    to[idx]=b;
    val[idx]=c;
}
int n;int answer[100050];
int main()
{
    int n,x,y;scanf("%d%d%d",&n,&x,&y);
    for(int i=1;i<n;i++)
    {
        addedge(i,i+1,1);addedge(i+1,i,1);
    }addedge(x,y,1);addedge(y,x,1);//cout<<"ddjxd";
	for(int s=1;s<n;++s){
    memset(vis,0,sizeof(vis));
priority_queue <Point> q;
    for(int i=1;i<=n;i++)
        f[i]=inf;Point tmp;
    tmp.number=s,tmp.dis=0;
    f[tmp.number]=0;  
    q.push(tmp);
    while(!q.empty())
    {
        int here=q.top().number;
        q.pop();
        if(vis[here])
            continue;
        vis[here]=1;
        for(int j=head[here];j;j=nex[j])
            if(f[to[j]]>val[j]+f[here]&&(!vis[to[j]]))
            {
                f[to[j]]=f[here]+val[j];
                tmp.number=to[j];
                tmp.dis=f[to[j]];
                q.push(tmp);
            }
    }
    for(int i=s+1;i<=n;++i)answer[f[i]]++;
    //for(int i=1;i<=n;i++)printf("%d ",f[i]);
	}for(int i=1;i<n;++i)cout<<answer[i]<<endl;
}


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

	int ans = -1;
	int res  = 0;
	int n; cin >>n ;
	for(int i = 0; i< n; i++){
		int a; cin >> a;
		ans = max(ans, a);
		res += a;
	}
	int x = res - ans / 2;
	cout << x;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(range(1,N+1))
N_3 = N//3
N_5 = N//5
for i in range(1,N_3+1):
    a[3*i-1] = 0
for i in range(1,N_5+1):
    a[5*i-1] = 0
print(sum(a))

Measured memory_bytes: 48364
r,g,b,n = gets.chomp.split.map(&:to_i)
cnt = 0
(0..n/r).each do |i|
  (0..n/g).each do |j|
      if (n -(r*i + g*j))%b == 0 && (n -(r*i + g*j)) >= 0
        cnt += 1
      end
  end
end

puts cnt

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
//T+N
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
template<class T> inline void fix(T &x) {if(x >= mod | x <= -mod) {x %= mod;} if(x < 0) {x += mod;}}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl

const ll MAX_N = 1e6 + 10;
ll perm[MAX_N], inv[MAX_N];

ll fpow(ll x, ll p) {
    if(p == 0) {return 1;}
    ll ans = fpow(x, p / 2);
    ans = (ans * ans ) % mod;
    if(p & 1) {
        return (ans * x) % mod;
    } else {
        return ans;
    }
}

ll comb(ll k, ll n) {
    if(k < 0 || n < 0) {return 0;}
    if(n - k < 0) {return 0;}
    return (((perm[n] * inv[n - k]) % mod) * inv[k]) % mod;
}

signed main() {
    //ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    perm[0] = inv[0] = 1;
    for(ll i = 1; i < MAX_N; i ++) {
        perm[i] = (perm[i - 1] * i) % mod;
        inv[i] = (inv[i - 1] * fpow(i, mod - 2)) % mod;
    }
    ll n, m, k;
    cin >> n >> m >> k;
    ll rangel = 0, ranger = 0;
    ll sum = 1;
    ll ans = 0;
    m ++;
    k ++;
    for(ll ij = 0; ij <= m + k - 2; ij ++) {
        ll nwl = max(0ll, ij - k + 1);
        ll nwr = min(m - 1, ij);
        while(nwl < rangel) {
            sum = (sum + comb(rangel - 1, ij)) % mod;
            rangel --;
        }
        while(nwl > rangel) {
            sum = (sum - comb(rangel, ij)) % mod;
            rangel ++;
        }
        while(nwr > ranger) {
            sum = (sum + comb(ranger + 1, ij)) % mod;
            ranger ++;
        }
        while(nwr < ranger) {
            sum = (sum - comb(ranger, ij)) % mod;
            ranger --;
        }
        ll sum2 = 0;
        for(ll i = nwl; i <= nwr; i ++) {
            sum2 += comb(i, ij) ;
        }
        fix(sum);
        ans += ((comb(n - 1, n - 1 + ij) * sum) % mod) * fpow(3, m + k - 2 - ij);
        fix(ans);
        sum = (sum * 2) % mod;
        sum += comb(ranger + 1, ij) + comb(rangel - 1, ij);
        sum %= mod;
        ranger ++;
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 15872
#include <iostream>
using namespace std;
int main(){
	int  A,B;
    cin >> A >> B;
    if((A*B*1)%2==1){
        cout << "Yes" << endl;
    }else if((A*B*2)%2==1){
        cout << "Yes" << endl;
    }else if((A*B*3)%2==1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    string s;
    cin >> n >> s;

    if(n % 2 == 0 && s.substr(0, n/2) == s.substr(n/2, n-1)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2*1e5+7;
int a[maxn],b[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        b[i]=a[i];
    }

    sort(a+1,a+n+1);
    int cnt=0;
    int nn=n;
    while(nn--)
    {
        cnt++;
        if(b[cnt]==a[n]) printf("%d\n",a[n-1]);
        else printf("%d\n",a[n]);
    }

    return 0;
}


Measured memory_bytes: 3200
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        int N = sc.nextInt();
        var a = sc.ArrayInt(N);

        if (N / 2 <= a.Count(i => i % 4 == 0) + (a.Count(i => i % 4 != 0 && i % 2 == 0)) / 2) {
            WriteLine("Yes");
        } else {
            WriteLine("No");
        }
    }
}



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

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}

Measured memory_bytes: 18528
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: u64 = itr.next().unwrap().parse().unwrap();
    let mut ans = 0u64;
    let mut i = 1u64;
    // n = m * q + q かつ m > q
    while i * i <= n {
        if n % i == 0 {
            let a = n / i - 1;
            if a > 0 && n / a == n % a {
                ans += a;
            }
        }
        i += 1;
    }
    println!("{}", ans);
}


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

public class Main {
  private static void execute(ContestReader reader, PrintWriter out) {
    char c = reader.nextCharArray()[0];
    out.println((char)(c + 1));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 21076
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <iomanip>
#include <tuple>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;

void print(int v, char c){
	printf("%02d:%02d:%02d%c",v/(60*60),(v/60)%60,v%60,c);
}
int main() {
while(1){
	int n;
	cin >> n;
	if(n==0)return 0;
	int num[12*60*60]={0};
	for(int i=0;i<n;i++){
		int in[3];
		cin >> in[0] >> in[1] >> in[2];
		sort(in,in+3);
		do{
			int s=in[0],t=in[1],u=in[2];
			for(int j=0;j<60;j++){
				int r=(t-(s*12%60)+60)%60;
				if(r<12){
					num[12*s*60+r*60+u]|=1<<i;
				}

				s++;s%=60;
				t++;t%=60;
				u++;u%=60;
			}
		} while(next_permutation(in,in+3));
	}
	int len=INT_MAX;
	int start=-1;
	int c[10]={0};
	int d=0;
	int a=0;
	int b=-1;
	while(1){
		if(b<a||d<n){
			b++;
			if(b==12*60*60)break;
			for(int i=0;i<n;i++){
				if(num[b]&(1<<i)){
					if(c[i]==0){
						d++;
					}
					c[i]++;
				}
			}
		}
		else
		{
			for(int i=0;i<n;i++){
				if(num[a]&(1<<i)){
					c[i]--;
					if(c[i]==0){
						d--;
					}
				}
			}
			a++;
		}
		if(d==n&&b-a<len){
			start=a;
			len=b-a;
		}
	}
	print(start, ' ');
	print(start+len,'\n');
}
}

Measured memory_bytes: 1332
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int value = 700;
		if ( s.charAt(0) == 'o' ) value+=100; 
		if ( s.charAt(1) == 'o' ) value+=100; 
		if ( s.charAt(2) == 'o' ) value+=100; 
		System.out.println(value);
	}	
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define dump(x) cout << #x << " = " << (x) << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

#define int long long

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, C, K;
  cin >> N >> C >> K;
  vector<int> T(N);
  REP(i, N) cin >> T[i];
  sort(all(T));
  int i = 0;
  int ans = 0;
  while(i < N) {
    int bus = T[i] + K;
    ans++;
    int j = 1;
    for(; j < C; j++) {
      if(T[i + j] <= bus && bus <= T[i + j] + K) {
      } else {
        break;
      }
    }
    i += j;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	for(ll i=0;i<n;i++){
		ll now;
		cin>>now;
		if(now>=k){
			ans++;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
#define LL long long
#define INF 0x3f3f3f3f
#define MX 2005

int n,m,q;
int ans;
char mp[MX][MX];
int d[MX][MX];
int x[MX][MX];
int up[MX][MX];
int lef[MX][MX];

void slv()
{
    memset(x,0,sizeof(x));
    memset(d,0,sizeof(d));
    memset(up,0,sizeof(up));
    memset(lef,0,sizeof(lef));
    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=m;j++)
        {
            d[i][j]=d[i-1][j]+d[i][j-1]-d[i-1][j-1];
            x[i][j]=x[i-1][j]+x[i][j-1]-x[i-1][j-1];
            up[i][j]=up[i][j-1];
            lef[i][j]=lef[i-1][j];
            if (mp[i][j]=='1')
            {
                d[i][j]++;
                if (i>1&&mp[i-1][j]=='1') x[i][j]++;
                if (j>1&&mp[i][j-1]=='1') x[i][j]++;
                if (i>1&&mp[i-1][j]=='1') up[i][j]++;
                if (j>1&&mp[i][j-1]=='1') lef[i][j]++;
            }
        }
    }
}

int main()
{
    scanf("%d%d%d",&n,&m,&q);

    for (int i=1;i<=n;i++)
        scanf("%s",mp[i]+1);

    slv();

    while (q--)
    {
        int x1,y1,x2,y2;
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        if (x1>x2) swap(x1,x2);
        if (y1>y2) swap(y1,y2);
        int ans = d[x2][y2]-d[x2][y1-1]-d[x1-1][y2]+d[x1-1][y1-1];

        ans -= x[x2][y2]-x[x2][y1-1]-x[x1-1][y2]+x[x1-1][y1-1];

        ans += up[x1][y2]-up[x1][y1-1];
        ans += lef[x2][y1]-lef[x1-1][y1];

        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 68480
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_3_C-in10.txt"));
		// while (scan.hasNext()) {

		int n = scan.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = scan.nextInt();

		msort(a, 0, n);

		System.out.print(a[0]);
		for (int i = 1; i < n; i++)
			System.out.print(" " + a[i]);
		System.out.print("\n" + cnt + "\n");

		scan.close();
		System.exit(0);
	}

	static int cnt;

	private static void msort(int[] a, int st, int max) {
		if (max - st < 2)
			return;
		int mid = (max + st) / 2;
		msort(a, st, mid);
		msort(a, mid, max);
		marge(a, st, mid, max);
	}

	private static void marge(int[] a, int st, int mid, int max) {
		int[] m1 = new int[mid - st + 1];
		int[] m2 = new int[max - mid + 1];

		for (int p = st, i = 0; p < mid; p++, i++)
			m1[i] = a[p];
		m1[m1.length - 1] = Integer.MAX_VALUE;

		for (int p = mid, i = 0; p < max; p++, i++)
			m2[i] = a[p];
		m2[m2.length - 1] = Integer.MAX_VALUE;

		int p1 = 0, p2 = 0;
		for (int i = st; i < max; i++)
			if (m1[p1] > m2[p2])
				a[i] = m2[p2++];
			else
				a[i] = m1[p1++];
		cnt += (max - st);
	}

}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;



int main() {
  string S;
  cin >> S;
  if(S[1]!=S[0]||S[1]!=S[2])cout << "Yes";
  else cout << "No";
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int main() {
  int N; cin >> N;
  int a = 0;
  for (int i = 1; i < N + 1; i += 2) {
    int c = 0;
    REP(j, 1, i + 1) {
      if (i % j == 0) {
        c++;
      }
    }
    if (c == 8) {
      a++;
    }
  }
  cout << a << endl;
}


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

using ll = long long;

int main() {
    ll X, Y, ans = 0;
    cin >> X >> Y;
    while (X <= Y) {
        ans++;
        X *= 2;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

const long long mod = 1000000007;
map<int, vector<pair<int, int> > > E,W;

int N,M,P[10010]; long long X;

int find(int x)
{
	if (x != P[x]) P[x] = find(P[x]);
	return P[x];
}

int main()
{
	scanf ("%d %d %lld",&N,&M,&X);
	for (int i=0;i<M;i++){
		int x,y,c; scanf ("%d %d %d",&x,&y,&c);
		E[c].push_back({x,y});
	}

	for (int i=1;i<=N;i++) P[i] = i;

	int c = 0, d = 0, e = 0;
	long long mst = 0;
	for (auto &v : E){
		for (auto &p : v.second){
			if (find(p.first) != find(p.second)) c++;
			else{
				d++;
				W[v.first].push_back(p);
			}
		}

		for (auto &p : v.second){
			int x = find(p.first);
			int y = find(p.second);
			if (x != y){
				mst += v.first;
				P[x] = y;
			}
		}
	}

	long long ans = 1;
	if (X == mst){
		for (int i=0;i<c;i++) ans = ans * 2 % mod;
		ans = (ans + mod - 2) % mod;
		for (int i=0;i<d;i++) ans = ans * 2 % mod;
	}
	else{
		for (auto &v : W){
			for (auto &p : v.second){
				long long nmst = v.first;
				for (int i=1;i<=N;i++) P[i] = i;
				int x = find(p.first);
				int y = find(p.second);
				P[x] = y;

				for (auto &v : E){
					for (auto &p : v.second){
						int x = find(p.first);
						int y = find(p.second);
						if (x != y){
							P[x] = y;
							nmst += v.first;
						}
					}
				}

				if (nmst == X){
					d--;
					e++;
				}
				else if (nmst < X) d--;
			}
		}
		for (int i=0;i<e;i++) ans = ans * 2 % mod;
		ans = (ans + mod - 1) % mod;
		for (int i=0;i<=d;i++) ans = ans * 2 % mod;
	}
	printf ("%lld\n",ans);

	return 0;
}

Measured memory_bytes: 512
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#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 fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

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;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  rpq que;
  rrep(i, 1, 10) que.push(i);
  while (1) {
    ans = que.top();
    que.pop();
    cnt++;
    if (cnt == n) break;

    s = to_string(ans);
    ll oo = (s[Size(s) - 1] - '0');
    tmp = ans * 10 + oo - 1;
    if (oo - 1 >= 0 && Size(que) - cnt <= n) {
      que.push(tmp);
    }

    s = to_string(ans);
    oo = (s[Size(s) - 1] - '0');
    tmp = ans * 10 + oo;
    if (Size(que) - cnt <= n) {
      que.push(tmp);
    }

    s = to_string(ans);
    oo = (s[Size(s) - 1] - '0');
    tmp = ans * 10 + oo + 1;
    if (oo + 1 != 10 && Size(que) - cnt <= n) {
      que.push(tmp);
    }
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
  int n;
  cin >> n;
  long long int ans = 1;
  for(int i = 0; i < n; i++){
    ans *= (n - i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1156
L = int(input())


N = L.bit_length()
ans = []
for i in range(N - 1):
    ans.append((i, i + 1, 0))
    ans.append((i, i + 1, 2 ** (N - i - 2)))


X = L - 2 ** (N - 1)
dist = 2 ** (N - 1)
for i in reversed(range(X.bit_length())):
    if X & (1 << i):
        ans.append((0, N - i - 1, dist))
        dist += (2 ** i)


print(N, len(ans))
for a, b, d in ans:
    print(a + 1, b + 1, d)


Measured memory_bytes: 3064
X = int(input())
mem = dict()
i = 0
while True :
    a = pow(i, 5)
    if X == a*2 :
        print(-i, i)
        break
    if a in mem :
        print ( i, mem[a] )
        break

    mem[X-a] = -i
    mem[X+a] = i
    
    i += 1

Measured memory_bytes: 9188
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;

int main(){

    int n;
    int a[210];

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

    int cnt = 0;
    bool break_flg = 0;

    while(1){
        rep(i,n){
            if(a[i]%2 != 0) {
                break_flg = 1;
            }else{
                a[i] = a[i]/2;
            };
        };
        if(break_flg) break;
        cnt++;
    };

    cout << cnt << endl;

    return 0;
};


Measured memory_bytes: 256
import java.util.Scanner; 
public class Main{
  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int[] a = new int[3];
    int count5 = 0;
    int count7 = 0;
    for(int i = 0;i < 3;i++){
      a[i] = stdIn.nextInt();
      if(a[i] == 5)
        count5 += 1;
      else if(a[i] == 7)
        count7 += 1;
    }
    if(count5 == 2 && count7 == 1)
      System.out.println("YES");
    else 
      System.out.println("NO");
  }
}


Measured memory_bytes: 22612
using System;
using System.Linq;

namespace ABC115
{
    class Program
    {

        static long[] P;
        static long[] A;

        static void Main(string[] args)
        {
            long[] input = Console.ReadLine().Split().Select(long.Parse).ToArray();

            long N = input[0];
            long X = input[1];

            P = new long[N + 1];
            A = new long[N + 1];

            P[0] = 1;
            A[0] = 1;

            for (int i = 1; i < N; i++)
            {
                P[i] = 2 * P[i - 1] + 1;
                A[i] = 2 * A[i - 1] + 3;
            }
            Console.WriteLine(f(N, X));
        }

        static long f(long N, long X)
        {
            if (N == 0) { if (X <= 0) return 0; else return 1; }
            else if (X <= 1 + A[N - 1]) return f(N - 1, X - 1);
            else return P[N - 1] + 1 + f(N - 1, X - 2 - A[N - 1]);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define upperlimit 1000100
#define INF 1000000100
#define INFL 1000000000000000100
#define eps 1e-8
#define endl '\n'
#define sd(n) scanf("%d",&n)
#define slld(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define plld(n) printf("%lld",n)
#define pds(n) printf("%d ",n)
#define pllds(n) printf("%lld ",n)
#define pdn(n) printf("%d\n",n)
#define plldn(n) printf("%lld\n",n)
#define REP(i,a,b) for(i=a;i<=b;i++)
#define mp make_pair
#define pb push_back
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define F first
#define S second
#define clr(a) memset(a,0,sizeof(a))
using namespace std;
 
ll gcd(ll n1,ll n2){
    if(!n1)return n2;
    if(!n2)return n1;
    if(n1%n2==0)return n2;
    return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent){
    base%=mod;
    ll ans=1;
    while(exponent){
        if(exponent&1)ans=(ans*base)%mod;
        base=(base*base)%mod;
        exponent/=2;
    }
    ans%=mod;
    return ans;
}
int main()
{
    string s;
    
    cin>>s;
    int n;
   n=s.size();
   s=s.erase(n-8); 
   
    cout<<s; 
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))
#define mod 10000000007
#define pb push_back

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;
typedef long long ll;


int power(int x, unsigned int y) 
{ 
    if (y == 0) 
        return 1; 
    else if (y % 2 == 0) 
        return power(x, y / 2) * power(x, y / 2); 
    else
        return x * power(x, y / 2) * power(x, y / 2); 
} 
int gcd(int a,int b,int &x,int &y){
	if(b == 0){
		x = 1;
		y = 0;
		return a;
	}
	int x1,y1;
	int ans = gcd(b, a%b, x1, y1);
	x = y1;
	y = x1 - y1 * (a/b);
	return ans;

}
int main(){
 	/*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    int n;
    cin>>n;
    cout<<(n+n*n+n*n*n);
	return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>

int main( void ) {
	int a, b;
	scanf("%i %i", &a, &b);
	
	if( a <= 0 && 0 <= b ) {
		puts("Zero");
	} else if( a > 0 ) {
		puts("Positive");
	} else {
		int len = b - a + 1;
		if( len % 2 ) {
			puts("Negative");
		} else {
			puts("Positive");
		}
	}
	
	return 0;
}

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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define FOR(n) for(int i = 0;i < n;i++)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK\n"

const double PI = M_PI;
const long long INF = int(999999999);
const long long MOD = int(1000000007);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

void solve(){
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    for(int i = 2;i < N;i++){
        if(S.substr(i-2,3) == "ABC"){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    ll l,r;
    ll num = 2019;
    cin >> l >> r;

    for(ll i = l; i < r ; i++){
        for(ll j = i + 1; j <= r; j++){
            num = min((i * j) % 2019,num);
            if(num == 0){
                cout << num << endl;
                return 0;
            }
        }
    }

    cout << num << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;
const bool debug = 0;
//----------------------//

int cnt[2123456][26];

int main() {
	string s; cin >> s;
	
	REP(i, s.size()) cnt[i][s[i]-'a']++;
	
	for (int i = s.size() - 1; i > 0; i--) {
		REP(j, 26) cnt[i - 1][j] += cnt[i][j];
	}
	
	ll ans = 1;
	REP(i, s.size()) {
		REP(j, 26) if (s[i] != j + 'a') {
			ans += cnt[i + 1][j];
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 20996
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9+7;
//const ll MOD = 998244353;
//const ll MOD = 924844033;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
const double EPS = 1e-5;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), outendl())
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

ll MIN_N = 1;
ll MAX_N = 100000;
ll MIN_K = 0;
ll MIN_S = 1;
ll MAX_S = 1000000000;

int main(){
	ll n;
	ll k;
	ll s;
	cin >> n >> k >> s;
	assert(MIN_N<=n&&n<=MAX_N);
	assert(MIN_K<=k&&k<=n);
	assert(MIN_S<=s&&s<=MAX_S);
	rep(i,k){
		output(s);
	}
	rep(i,n-k){
		if(s==MAX_S){
			output(MAX_S-1);
		}else{
			output(s+1);
		}
	}
	outendl();
	return 0;
}


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


def main():
    s_dash = input()
    t = input()
    s_dash_count = len(s_dash)
    t_count = len(t)
    ans = list()

    if s_dash_count >= t_count:
        for k in range(s_dash_count - t_count + 1):
            mod_s_dash = s_dash[k:k + t_count]
            count = 0

            for i in range(t_count):
                if mod_s_dash[i] == t[i]:
                    count += 1
                elif mod_s_dash[i] == '?':
                    count += 1

            if count == t_count:
                s = s_dash[:k] + t + s_dash[k + t_count:]
                s = s.replace('?', 'a')
                ans.append(s)

        if len(ans) == 0:
            print('UNRESTORABLE')
        else:
            print(sorted(ans)[0])

    else:
        print('UNRESTORABLE')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <algorithm>
#include <cstdio>
#include <cstring>

#define int long long

const int Maxv = 300010; 

int ans[Maxv], max[Maxv], num, n; 

signed main() {
    scanf("%lld", &n); 
    
    for (int i = 0; i < (1 << n); i++) {
        scanf("%lld", &num); 
    
        for(int j = i; j < (1 << n); ((++j) |= i)) {
            ans[j] = std::max(ans[j], max[j] + num); 
            max[j] = std::max(max[j], num); 
        }
    }
       
    for (int i = 1; i < 1 << n; i++) {
        printf("%lld\n", ans[i]); 
        ans[i + 1] = std::max(ans[i + 1], ans[i]); 
    }
    
    return 0; 
}

Measured memory_bytes: 7424