akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=998244353;

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

int n,a[100010],b[100010],ans = 0;

signed main(){
	cin >> n;
	for(int i = 0;i <= n;i++) cin >> a[i];
	for(int i = 0;i < n;i++) cin >> b[i];
	for(int i = 0;i < n;i++){
		if(a[i] >= b[i]) ans += b[i];
		else{
			b[i] -= a[i];
			ans += a[i];
			if(a[i + 1] >= b[i]){
				a[i + 1] -= b[i];
				ans += b[i];
			}else{
				ans += a[i + 1];
				a[i + 1] = 0;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

class Main{
    public static void main(String[] args){
    final Scanner sc=new Scanner(System.in);
    while(true){
        int m = sc.nextInt();
        int f = sc.nextInt();
        int r = sc.nextInt();
        char G;
        if(m==-1 && f==-1 && r==-1) break;
        if(m ==-1 && f>0 || m > 0 && f==-1)G='F';
        else if(m+f>=80) G='A';
        else if(m+f>=65) G='B';
        else if(m+f>=50) G='C';
        else if(m+f>=30) G='D';
        else G='F';
        if(r>=50)G='C';
        System.out.println(G);
    }
    }
}

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

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

    vector<int> sequence(N/2, 0);
    sequence.resize(N, 1);

    vector< vector<int> > card(K, vector<int>(N/2));
    for(int i=0; i<K; i++) {
        for(int j=0; j<N/2; j++) {
            cin>>card[i][j];
        }
    }

    bool ok = false;
    while(!ok) {
        ok = true;
        random_shuffle(sequence.begin(), sequence.end());
        for(int i=0; i<K; i++) {
            int sum = 0;
            for(int j=0; j<N/2; j++) sum += sequence[card[i][j]-1];
            if(sum<N/8 || 3*N/8<sum) ok = false;
        }
    }

    for(int i=0; i<N; i++) cout<<sequence[i];
    cout<<endl;
}

Measured memory_bytes: 2060
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

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

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

const double EPS = 1e-10;

typedef complex<double> P;
double cross(const P& a, const P& b){
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b){
	return real(conj(a)*b);
}

struct L : public vector<P> {
	L(){}
	L(const P& a, const P& b){
		push_back(a);
		push_back(b);
	}
};

int ccw(P a, P b, P c)
{
	b -= a;
	c -= a;
	if(cross(b,c) > 0)  return  1;
	if(cross(b,c) < 0)  return -1;
	if(dot(b,c)   < 0)  return  2;
	if(norm(b)<norm(c)) return -2;
	return 0;
}

bool intersectSS(const L& s, const L& t) {
	return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 &&
		   ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0;
}

bool crosspoint(const L& l, const L& m, P& out) {
	if(!intersectSS(l, m))
		return false;
	
	double A = cross(l[1]-l[0], m[1]-m[0]);
	double B = cross(l[1]-l[0], l[1]-m[0]);
	if(abs(A) < EPS && abs(B) < EPS)
		return false;
	out = m[0] + B/A*(m[1]-m[0]);
	return true;
}


int main()
{
	for(;;){
		L s[3];
		rep(i, 3){
			int x1, y1, x2, y2;
			scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
			if(!x1 && !y1 && !x2 && !y2)
				return 0;
			s[i].push_back(P(x1, y1));
			s[i].push_back(P(x2, y2));
		}
		
		P p[3];
		bool ok = true;
		rep(i, 3){
			if(!crosspoint(s[i], s[(i+1)%3], p[i])){
				ok = false;
				break;
			}
		}
		
		double area = 0.0;
		if(ok){
			area = abs(cross(p[1]-p[0], p[2]-p[1])/2.0);
		}
		if(area >= 1900000.0)
			puts("dai-kichi");
		else if(area >= 1000000.0)
			puts("chu-kichi");
		else if(area >= 100000.0)
			puts("kichi");
		else if(area >= EPS)
			puts("syo-kichi");
		else
			puts("kyo");
	}
	return 0;
}

Measured memory_bytes: 1040
#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector <int> ant;
    for(int i=0;i<5;i++)
    {
        int Temp;
        cin>>Temp;
        ant.push_back(Temp);
    }
    int K;
    cin>>K;

    if(ant[4]-ant[0]>K)
    {
        cout<<":(";
    }
    else
    {
        cout<<"Yay!";
    }
}

Measured memory_bytes: 256
import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		int rect = 0, diamond = 0;
		while (sc.hasNext()) {
			String[] ss = sc.next().split(",");
			int[] a = new int[10];
			for (int i = 0; i < 10; i++)
				a[i] = Integer.parseInt(ss[i]);
			int v1 = Integer.parseInt(ss[10]);
			int v2 = Integer.parseInt(ss[11]);
			System.out.println(solve(a, v1, v2));
		}
	}

	int solve(int[] a, int v1, int v2) {
		int sum = 0;
		for(int i = 0; i < a.length; i++) sum += a[i];
		double t = (double) sum / (v1 + v2);
		double meet = v1 * t;
		int ans = 0;
		int acc = 0;
		for(int i = 0; i < 10; i++) {
			acc += a[i];
			if( acc + 0.000001 >= meet )
				return i + 1;
		}
		return 10;
	}
}

Measured memory_bytes: 12000
require "prime"
N = gets.to_i

if N == 1
  p 1
  exit
end

numbers = [1]
primes = N.prime_division
while e = primes.pop
  e[1].times { numbers << e[0] }
end

result = 10**10
(1..numbers.length-1).each do |index|
  (index..numbers.length+1).each do |index2|
    copy = numbers.dup
    a_group = copy.select.with_index { |_, i| (index..index2).cover?(i) }
    b_group = copy.select.with_index { |_, i| !(index..index2).cover?(i) }
    result = [result, [a_group.inject(&:*).to_s.length, b_group.inject(&:*).to_s.length].max].min
  end
end
p result

Measured memory_bytes: 2300
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;


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

signed main() {
    string s;
    cin >> s;
    
    stack<char> stk;
    
    rep(i, (ll)s.size()) {
        if (stk.empty()) {
            stk.push(s[i]);
        } else {
            if ((stk.top() == '1' && s[i] == '0') || (stk.top() == '0' && s[i] == '1')) {
                stk.pop();
            } else {
                stk.push(s[i]);
            }
        }
    }
    mes(s.size()-stk.size());
    re0;
    
    
    
}

Measured memory_bytes: 3788
package main

import (
	"fmt"
)

func main() {
	as := make([][]int, 3)
	for i := 0; i < 3; i++ {
		as[i] = make([]int, 3)
		for j := 0; j < 3; j++ {
			fmt.Scan(&as[i][j])
		}
	}
	var n int
	fmt.Scan(&n)
	bm := make(map[int]bool)
	for i := 0; i < n; i++ {
		var b int
		fmt.Scan(&b)
		bm[b] = true
	}
	var bingo bool
	for i := 0; i < 3; i++ {
		var ng bool
		for j := 0; j < 3; j++ {
			if _, ok := bm[as[i][j]]; !ok {
				ng = true
			}
		}
		if !ng {
			bingo = true
		}
	}
	for i := 0; i < 3; i++ {
		var ng bool
		for j := 0; j < 3; j++ {
			if _, ok := bm[as[j][i]]; !ok {
				ng = true
			}
		}
		if !ng {
			bingo = true
		}
	}
	{
		var ng bool
		for j := 0; j < 3; j++ {
			if _, ok := bm[as[j][j]]; !ok {
				ng = true
			}
		}
		if !ng {
			bingo = true
		}
	}
	{
		var ng bool
		for j := 0; j < 3; j++ {
			if _, ok := bm[as[j][2-j]]; !ok {
				ng = true
			}
		}
		if !ng {
			bingo = true
		}
	}
	if bingo {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int MAX=1e5;
vector <bool> visited(MAX);
vector<int> dist(MAX);
vector<vector<int>> adj(MAX);
void dfs(int u){
    visited[u]=true;
    dist[u]=0;
    for(int it:adj[u]){
        if(!visited[it]){
            dfs(it);
        }
        dist[u]=max(dist[u],1+dist[it]);
    }
}
void solve(){
    int n,m;
    cin>>n>>m;
    visited.assign(n,false);
    while(m--){
        int x,y;
        cin>>x>>y;
        x--,y--;
        adj[x].push_back(y);
    }
    int res=0;
    for(int i=0;i<n;i++){
        if(!visited[i]){
            dfs(i);
        }
        res=max(res,dist[i]);
    }
    cout<<res<<'\n';
}

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


Measured memory_bytes: 8192
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if (a % 2 == 0 && a == b && b == c)
        cout << -1 << endl;
    else {
        ll ans = 0;
        while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
            ll ta = (b + c) / 2;
            ll tb = (a + c) / 2;
            ll tc = (a + b) / 2;
            a = ta, b = tb, c = tc;
            ++ans;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct node{
    int a,b;
    node(int a,int b):a(a),b(b){}
    node():a(0),b(0){}

    bool f(){
        return (a>0 and b>0);
    }
};

int n,m;
vector<set<int>> g;
vector<bool> check;
vector<node> v;
string s;

void dfs(int now){
    v[now].a=0;v[now].b=0;
    for(auto to:g[now])if(check[to]){
        if(s[now]=='A') v[to].a--;
        else            v[to].b--;
        g[to].erase(now);
        // cout<<now<<" -> "<<to<<" ? "<<v[to].a<<" "<<v[to].b<<endl;
        if(!v[to].f()){
            check[to]=false;
            dfs(to);
        }
    }
    g[now].clear();
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    cin>>n>>m;
    g.resize(n);check.resize(n,true);v.resize(n);
    cin>>s;
    rep(i,m){
        int k,l;cin>>k>>l;k--,l--;
        if(!g[k].count(l) and !g[l].count(k)){
            g[k].insert(l);g[l].insert(k);
            if(s[k]=='A')   v[l].a++;
            else            v[l].b++;
            if(s[l]=='A')   v[k].a++;
            else            v[k].b++;
        }
    }

    rep(i,n)if(check[i]){
        // cout<<"Start : "<<i<<endl;
        if(!v[i].f()){
            // cout<<"Dfs suruyo\n";
            check[i]=false;
            dfs(i);
            // cout<<"To a : ";rep(i,n)cout<<v[i].a<<" ";cout<<endl;
            // cout<<"To b : ";rep(i,n)cout<<v[i].b<<" ";cout<<endl;
            // debug(check);
        }
    }

    // debug(check);

    bool ans=false;
    rep(i,n)ans|=check[i];
    cout<<(ans?"Yes":"No")<<endl;
    return 0;
}


Measured memory_bytes: 36560
while (h, w = gets.split(" ").map(&:to_i)) != [0,0]
  h.times do |n|
    if n.even?
        puts Array.new((w+1)/2,["#","."]).flatten[0..w-1].join("")
    else
        puts Array.new((w+1)/2,[".","#"]).flatten[0..w-1].join("")
    end
  end
  puts "\n"
end



Measured memory_bytes: 7628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int cnt=0;
  for(int i=1;i<=3;i++){
    if((a*b*i)%2==1)cnt++;
  }
  if(cnt>0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return(0);
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
ll t1,t2;
int i,j,k,n,m,a[201];
int main(){
	scanf("%d%d",&n,&m);
	for (i=1;i<=n;i++) scanf("%d",&a[i]),a[i]%=2;
	for (t1=1,t2=0,i=1;i<=n;i++)
	 if (a[i]){
		t1+=t2;t2=t1;
	 }else{
	 	t1=2LL*t1;t2=2LL*t2;
	 }
	printf("%lld\n",(m)?t2:t1);
	return 0;
}

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

template <class T> using V = vector<T>;

using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;


#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;



int main() {
  ll a,b,c;
  	ci(a>>b>>c);
  co(min(a*b,c))
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <algorithm>
//#include <functional>
//#include <boost/foreach.hpp>
using namespace std;

int main(){
 pair<int,pair<int,int> > pai[1001];
 int n,m,a,t,y1,y2;
 while(1){
   cin>>n>>m>>a;
   if(n==0)break;
   for(int i=0;i<m;i++){//?¨??£??????°??????
     cin>>t>>y1>>y2;
     pai[i].first=t;
     pai[i].second.first=y1;
     pai[i].second.second=y2;
   }
   sort(pai,pai+m);
   reverse(pai,pai+m);
   for(int i=0;i<m;i++){
     if(pai[i].second.first==a)a=pai[i].second.second;
     else if(pai[i].second.second==a)a=pai[i].second.first;
   }
   cout<<a<<endl;
 }
 return 0;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
int N,T,ans,t,c;
int main(){
	scanf("%d%d",&N,&T);
	ans=0x7fffffff;
	fo(i,1,N){
		scanf("%d%d",&c,&t);
		if (t<=T&&c<ans) ans=c;
	}
	if (ans==0x7fffffff) printf("TLE\n");else printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
import sys
a,b,c=map(int,input().split())
i=1
l=[]
while True:
    aa=a*i%b
    if aa in l:
        break
    l.append(aa)
    i+=1
    if aa!=0 and c%aa==0:
        print('YES')
        sys.exit()
print('NO')

Measured memory_bytes: 9176
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

typedef long long ll;
const int mod=1e9+7;

int main(){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		char c;
		cin >> c;
		if(c == 'Y'){
			cout << "Four" << endl;
			return 0;
		}
	}
	cout << "Three" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int mod;
int fac[3010], facinv[3010], g[3010][3010], n;
inline int power(int a, int b) {
    long long res = a, ans = 1;
    for (; b; b >>= 1, res = res * res % mod) if (b & 1) ans = ans * res % mod;
    return ans;
}
int C[3010][3010];
int main() {
    cin >> n >> mod;
    fac[0] = 1;
    for (int i = 1; i <= n; i++) fac[i] = 1ll * i * fac[i - 1] % mod;
    facinv[n] = power(fac[n], mod - 2);
    for (int i = n; i --> 0; ) facinv[i] = 1ll * (i + 1) * facinv[i + 1] % mod;
    int ans = 0;
    for (int i = 0; i <= n; i++) g[i][0] = 1, C[i][0] = C[i][i] = 1;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= i; j++) g[i][j] = (g[i - 1][j - 1] + 1ll * (j + 1) * g[i - 1][j]) % mod, C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    for (int i = 0; i <= n; i++) {
        int now = 1ll * (i & 1 ? mod - 1 : 1) * C[n][i] % mod;
        mod--;
        int tmp = power(2, n - i);
        mod++;
        now = 1ll * now * power(2, tmp) % mod;
        for (int j = 0; j <= i; j++) {
            ans = (ans + 1ll * now * g[i][j] % mod * power(power(2, n - i), j)) % mod;
        }
    }
    return cout << ans << endl, 0;
}

Measured memory_bytes: 69632
#include <stdio.h>
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)<(b)?(b):(a))
int main(){
int a,b,c;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
printf("%d\n",MIN(a,b)+MIN(MAX(a,b),c));
return 0;
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define IMP cout << "IMPOSSIBLE" << endl
#define Imp cout << "Impossible" << endl
#define imp cout << "impossible" << endl
#define M1 cout << "-1" << endl
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

ll f(ll level, ll x)
{
    if (level == 0)
        return 1;

    ll length = (1ll << (level + 1)) - 3;
    ll pnum = (1ll << level) - 1;

    if (x <= 1)
        return 0;
    else if (x <= length + 1)
        return f(level - 1, x - 1);
    else if (x == length + 2)
        return pnum + 1;
    else if (x <= length * 2 + 2)
        return pnum + 1 + f(level - 1, x - (length + 2));
    else
        return pnum * 2 + 1;
}

void Main()
{
    ll n = in(), x = in();
    cout << f(n, x) << endl;
}

signed main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
const int MAX = 1000000;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    COMinit();
    ll n,m,k;
    cin >> n >> m >> k;
    ll D = 0;
    for(ll i=1;i<n;i++){
        D += (((i*m) % MOD) * (((n-i)*m) % MOD))%MOD;
        D %= MOD;
    }
    for(ll i=1;i<m;i++){
        D += (((i*n) % MOD) * (((m-i)*n) % MOD))%MOD;
        D %= MOD;
    }
    ll ans = (D * COM(n*m-2,k-2))%MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 23808
N, P = map(int, input().split())
A = list(map(int, input().split()))
even = 0
odd = 0
for i in range(N):
    if A[i]%2==0:
        even += 1
    else:
        odd += 1
if odd>=1:
    ans = pow(2,even+odd-1)
elif P==0:
    ans = pow(2,even)
else:
    ans = 0
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int mod=1e9 ;
vector<vector<int>>dp;

int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>A(n);
    for(int &i:A)
        cin>>i;
    dp.resize(n+1,vector<int>(k+1,1));
    vector<vector<int>>p=dp;
    // dp[0][0]=1;
    // for(int i=1;i<=k;i++)
    //     p[0][i]=1;
    // for(int i=1;i<=n;i++)
    //     p[i][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            if(j>A[i-1])
            dp[i][j]=(p[i-1][j]-p[i-1][j-A[i-1]-1])<0?(p[i-1][j]-p[i-1][j-A[i-1]-1]+(mod+7)):(p[i-1][j]-p[i-1][j-A[i-1]-1]);
            else {dp[i][j]=p[i-1][j];}
            p[i][j]=(dp[i][j]+p[i][j-1])%(mod+7);
        }
    }
    cout<<dp[n][k];
}

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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

using ll    = long long;
using vll   = vector<ll>;
using pll   = pair<ll,ll>;
using ld    = long double;

const ll mod = (ll)1e9 + 7;
const ll mxN = (ll)2e6 + 3;

void solve() {
	ll x,y;
	cin>>x>>y;
	if(y%2!=0) cout<<"No\n";
	else if(y/2>=x&&2*x>=y/2) cout<<"Yes\n";
	else cout<<"No\n";
	
}
int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(nullptr);
//	cout.precision(20);
//	cout << fixed;
//	pre();
//	ll t;cin>>t;while (t--)
		solve();
}


Measured memory_bytes: 3552
n,time=map(int,input().split())
c=[]
t=[]
for i in range(n):
    a,b=map(int,input().split())
    c.append(a)
    t.append(b)
ans=10**10
for i in range(n):
    if t[i]<=time:
        ans=min(ans,c[i])

print(ans if ans!=10**10 else "TLE")

Measured memory_bytes: 9056
#include <iostream>

long long int A, B;

using namespace std;

int main() {
	cin >> A >> B;
	if (A % 3 == 0) {
		cout << "Possible" << endl;
		return 0;
	}
	else if (B % 3 == 0) {
		cout << "Possible" << endl;
		return 0;
	}
	else if ((A + B) % 3 == 0) {
		cout << "Possible" << endl;
		return 0;
	}
	cout << "Impossible" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>

using namespace std;
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	int left, right;
	left = a + b;
	right = c + d;

	if (left > right) cout << "Left" << endl;
	else if (left < right) cout << "Right" << endl;
	else cout << "Balanced" << endl;
}

Measured memory_bytes: 256
import numpy as np
from bisect import bisect_left, bisect_right


def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2, N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum


def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


sosu = seachPrimeNum(10**5)[1:]
like_2017 = [i for i in sosu if is_prime((i+1) / 2)]

Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    l_ix = bisect_left(like_2017, l)
    r_ix = bisect_right(like_2017, r)
    print(r_ix - l_ix)


Measured memory_bytes: 31296
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>

using namespace std;
using boost::sort;
using boost::adaptors::reversed;

int main() {
    long n, x, m;
    cin >> n >> x >> m;
    vector<long> a, s;
    unordered_map<long, long> ls;
    a.push_back(-1);
    a.push_back(x);
    s.push_back(0);
    s.push_back(x);
    ls[x] = 1;
    long l = 1, r = n;
    for (long i = 1; i < n; i++) {
        long an1 = a[i] * a[i] % m;
        a.push_back(an1);
        s.push_back(an1 + s[i]);
        if (ls[an1] > 0) {
            l = ls[an1];
            r = i + 1;
            break;
        } else {
            ls[an1] = i + 1;
        }
    }
    long ans = 0;
    n -= l;
    ans += s[l];
    if (l < r) {
        ans += (s[r] - s[l]) * (n / (r - l));
        ans += s[l + n % (r - l)] - s[l];
    }
    cout << ans << endl;
}


Measured memory_bytes: 5988
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {

			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			
			int capacity = a - b;
			
			if ( c > capacity ) {
				System.out.println(c - capacity);
			}
			else {
				System.out.println(0);
			}
			
		}
	}
}


Measured memory_bytes: 21844
from collections import Counter


class Mint:
    MOD = 1000000007  # Must be a prime
    CACHE_FACTORIALS = [1, 1]

    def __init__(self, v):
        if self.__isally(v):
            self.v = v.v % self.MOD
        else:
            self.v = v % self.MOD

    @property
    def inv(self):
        return Mint(self.__minv(self.v))

    @classmethod
    def factorial(cls, v):
        for i in range(len(cls.CACHE_FACTORIALS), int(v) + 1):
            cls.CACHE_FACTORIALS.append(cls.CACHE_FACTORIALS[-1] * i % cls.MOD)
        return Mint(cls.CACHE_FACTORIALS[int(v)])

    @classmethod
    def perm(cls, n, r):
        if n < r or r < 0:
            return 0
        return cls.factorial(n) // cls.factorial(n - r)

    @classmethod
    def comb(cls, n, r):
        if n < r or r < 0:
            return 0
        return cls.perm(n, r) // cls.factorial(r)

    @classmethod
    def __isally(cls, v) -> bool:
        return isinstance(v, cls)

    @classmethod
    def __minv(cls, v) -> int:
        return pow(v, cls.MOD - 2, cls.MOD)

    @classmethod
    def __mpow(cls, v, w) -> int:
        return pow(v, w, cls.MOD)

    def __str__(self):
        return str(self.v)
    __repr__ = __str__

    def __int__(self):
        return self.v

    def __eq__(self, w):
        return self.v == w.v if self.__isally(w) else self.v == w

    def __add__(self, w):
        return Mint(self.v + w.v) if self.__isally(w) else Mint(self.v + w)
    __radd__ = __add__

    def __sub__(self, w):
        return Mint(self.v - w.v) if self.__isally(w) else Mint(self.v - w)

    def __rsub__(self, u):
        return Mint(u.v - self.v) if self.__isally(u) else Mint(u - self.v)

    def __mul__(self, w):
        return Mint(self.v * w.v) if self.__isally(w) else Mint(self.v * w)
    __rmul__ = __mul__

    def __floordiv__(self, w):
        return Mint(self.v * self.__minv(w.v)) if self.__isally(w) else \
            Mint(self.v * self.__minv(w))

    def __rfloordiv__(self, u):
        return Mint(u.v * self.__minv(self.v)) if self.__isally(u) else \
            Mint(u * self.__minv(self.v))

    def __pow__(self, w):
        return Mint(self.__mpow(self.v, w.v)) if self.__isally(w) else \
            Mint(self.__mpow(self.v, w))

    def __rpow__(self, u):
        return Mint(self.__mpow(u.v, self.v)) if self.__isally(u) else \
            Mint(self.__mpow(u, self.v))


N = int(input())
A = [int(s) for s in input().split()]
v = Counter(A).most_common(1)[0][0]
i = A.index(v)
j = A.index(v, i+1)
m = j - i - 1
for k in range(1, N + 2):
    ans = Mint.comb(N + 1, k) - Mint.comb(N - m - 1, k - 1)
    print(ans)


Measured memory_bytes: 72168
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

const ll MOD = ll(1e9 + 7);
const ll INF = LLONG_MAX;
const ll MAX_N = ll(1e3) + 5;
const double EPS = 10e-8;
const double PI = 3.14159265359;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)

int main() {
   int n;
   cin >> n;
    if(n<1000)cout << "ABC" << endl;
    else cout << "ABD" << endl;
    return 0;
}


Measured memory_bytes: 256
Q, H, S, D = map(int, input().split())
N = int(input())

cQ = Q*8
cH = H*4
cS = S*2
cD = D 

m = min(cQ, cH, cS, cD)

if m == cQ:
    print(Q * N * 4)
elif m == cH:
    print(H * N * 2)
elif m == cS:
    print(S * N)
else:
    if N % 2 == 0:
        print(D * N // 2)
    elif N == 1:
        print(min(Q * 4, H * 2, S))
    else:
        c = (N-1) // 2 * D
        print(c + min(Q * 4, H * 2, S))


Measured memory_bytes: 9132
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF = 2e9;
#define LINF = 1e18;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << = << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO")
#define Yes(n) cout << ((n) ? "Yes" : "No")

void input(vector<int> x, auto n){
   rep(i,n)cin >> x[i];
}

void xysort(){
    int x, y;
    cin >> x >> y;
    if(x == 0 && y == 0)return;
    else if(x > y)swap(x, y);
    cout << x  << " " << y << endl;
    return xysort();
}

int main(){
    xysort();
}


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

int main() {
  
  int N,K,A;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if ( x >= K ) A += (x - K) * 2;
    else if ( K - x < x ) A += (K - x) * 2;
    else A += x * 2;
  }
  cout << A << endl;
}


Measured memory_bytes: 384
// Header {{{
#include <bits/stdc++.h>

using namespace std;
template<typename T>
using reversed_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T> >;
typedef unsigned long long int ull;
typedef long long int ll;
#define rep(i,a,b) for (ll i=(a); i<(b); i++)
typedef pair<ll,ll> PLL;
// }}}

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

ll lcm(ll x, ll y){
    return x/gcd(x,y)*y;
}

signed main() {
    ll n, ans;
    cin>>n;
    vector<ll> v(n);
    rep(i,0,n) cin>>v[i];
    ans = v[0];
    rep(i,1,n)
        ans=lcm(ans,v[i]);
    cout<<ans<<endl;
    return 0;
}


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 INF = 1000000009;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    ll sumall=0;
    rep(i,n){
        cin >> a[i];
        sumall += a[i];
    }
    ll sum[n];
    sum[0]=a[0];
    rep(i,n-1){
        sum[i + 1] = sum[i] + a[i+1];
    }
    ll ans = 1e+18;
    rep(i, n - 1)
    {
        ans = min(ans, abs(sumall - 2 * sum[i]));
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb emplace_back
#define koto_memory(a) cout<<(sizeof(a)/1048576.0)<<" MB";
#define res(v) sort(all(v)),v.erase(unique(all(v)), v.end());
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
#define deb(x) cout<<"\n["<<#x<<" = "<<x<<"]\n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
void solve(){
  int x,y,z,k;
  cin>>z>>y>>x>>k;
  while(k--){
    if(y<=z)y*=2;
    else if(x<=y)x*=2;
  }
  if(x>y and y>z)cout<<"Yes";
  else cout<<"No";
}
int32_t main()
{
  ibs;cti;
  solve();return 0;
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N;
	cin >> N;
	int four = (N / 1000);
	int three = (N / 100) - (four * 10);
	int two = (N / 10) - (four * 100) - (three * 10);
	int one = N - (four * 1000) - (three * 100) - (two * 10);
	if(four == three && three == two) cout << "Yes" << endl;
	else if (three == two && two == one) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int a, b, c, mn, mx;
int main()
{
    cin >> a >> b >> c;
    mn = min(min(a, b), c);
    mx = max(max(a, b), c);
    cout <<  mn * (a + b + c - mn - mx) / 2;
    return 0;
}


Measured memory_bytes: 256
use proconio::input;

use std::cmp::*;
// use std::collections::*;
use proconio::marker::Chars;

fn main() {
    input! {
        h:usize,
        w:usize,
        C:[Chars;h]
    }
    for c in C {
        for i in 0..2 {
            for cv in &c {
                print!("{}", cv);
            }
            println!();
        }
    }
}


Measured memory_bytes: 2196
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }

    sort(A.begin(), A.end());
    ll M = 0;
    for (ll i = 0; i < N; i++) {
        M += abs(A[i]);
    }

    if (A.front() < 0 && A.back() > 0) {
        cout << M << endl;

        for (ll i = 1; i < N - 1; i++) {
            if (A[i] >= 0) {
                cout << A.front() << " " << A[i] << endl;
                A.front() -= A[i];
            } else {
                cout << A.back() << " " << A[i] << endl;
                A.back() -= A[i];
            }
        }
        cout << A.back() << " " << A.front() << endl;
    } else {
        if (A.front() < 0) {
            cout << M + 2 * A.back() << endl;

            for (ll i = 0; i < N - 1; i++) {
                cout << A.back() << " " << A[i] << endl;
                A.back() -= A[i];
            }
        } else {
            cout << M - 2 * A.front() << endl;

            for (ll i = 1; i < N - 1; i++) {
                cout << A.front() << " " << A[i] << endl;
                A.front() -= A[i];
            }
            cout << A.back() << " " << A.front() << endl;
        }
    }
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

vector<ll> pw2(51,1);
vector<ll> pw10(19,1);

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}
ll myceil(ll x,ll y){
	if(x<=y) return 1;
	else if(x%y==0) return x/y;
	else return x/y+1;
}

//a,b x
int main(){
	ll N,C,K; cin>>N>>C>>K;
	vector<ll> T(N);
	rep(i,N) cin>>T[i];
	sort(T.bg,T.ed);
	ll lim=T[0]+K;//最初乗る人、到着time
	ll pe=1,ans=1;
	rep1(i,N-1){
		if(pe<C){
			if(T[i]<=lim) pe++;
			else{
				lim=T[i]+K;
				pe=1;
				ans++;
			}
		}
		else if(pe==C){
			lim=T[i]+K;
			pe=1;
			ans++;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
const int mxN=3005;
int n;
double a[mxN];
double dp[mxN][mxN];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		}
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			dp[i][j]=dp[i-1][j]*(1-a[i])+dp[i-1][j-1]*a[i];
			}
		
		}
		double sum=0;
	for(int i=n;i>n/2;i--){
		sum+=dp[n][i];
		}
	cout<<fixed<<setprecision(10)<<sum;
	return 0;
	}


Measured memory_bytes: 70912
#include <iostream>
#include <vector>
using namespace std ;
bool solve ( const vector < string >& W ) {
const int n = W . size ();
// condition 1
for ( int i = 0; i < n -1; ++ i ) {
if ( W [ i ]. back () != W [ i +1]. front ()) {
return false ;
}
}
// condition 2
for ( int i = 0; i < n ; ++ i ) {
for ( int j = i +1; j < n ; ++ j ) {
if ( W [ i ] == W [ j ]) {
return false ;
}
}
}
return true ;
}
vector < string > input () {
int n; cin >> n ;
vector < string > W ( n );
for ( int i = 0; i < n ; ++ i ) {
cin >> W [ i ];
}
return W ;
}
 
 
int main () {
const vector < string > W = input ();
if ( solve ( W )) {
cout << " Yes " << endl ;
}
else {
cout << "No" << endl ;
}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int y = 700;
  int sum = y;
  if (s[0] == 'o'){
    sum += 100;
  }
  if (s[1] == 'o'){
    sum += 100;
  }
  if(s[2] == 'o'){
    sum += 100;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  string s;
  cin >> n >> s;
  if(n%2==0) {
    string t=s.substr(n/2);
    s=s.substr(0,n/2);
    if(s==t) {
      pr("Yes");
      return;
    }
  }
  pr("No");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
H, W = map(int, input().split())
S = [input() for _ in range(H)]

result = [[] for _ in range(H)]
for y in range(H):
    Sy = S[y]
    resulty = result[y]
    for x in range(W):
        if Sy[x] == '#':
            resulty.append('#')
        else:
            t = 0
            for i in range(max(y - 1, 0), min(y + 2, H)):
                Si = S[i]
                for j in range(max(x - 1, 0), min(x + 2, W)):
                    if Si[j] == '#':
                        t += 1
            resulty.append(str(t))

for y in range(H):
    print(''.join(result[y]))


Measured memory_bytes: 3188
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const LL N = 3005;
LL P;

LL kpw(LL x,LL y,LL M){
	LL ans = 1,tmp = x;
	while(y){
		if(y & 1) ans = (ans * tmp) % M;
		tmp = (tmp * tmp) % M;
		y >>= 1;
	}
	return ans;
}

LL c[N][N],s[N][N];
void init_cs(){
	for(LL i = 0;i <= 3001;i ++) c[i][0] = c[i][i] = 1;
	s[0][0] = 1;
	for(LL i = 1;i <= 3001;i ++){
		for(LL j = 1;j <= 3001;j ++){
			c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % P;
			s[i][j] = (s[i - 1][j - 1] + j * s[i - 1][j]) % P;
		}
	}
}

int main(){
	LL n,tmp,ans = 0;
	cin >> n >> P; init_cs();
	for(LL i = 0;i <= n;i ++){
		tmp = 0;
		for(LL j = 1;j <= i + 1;j ++) tmp = (tmp + s[i + 1][j] * kpw(2LL,(j - 1) * (n - i),P) % P) % P;
		tmp = ((kpw(2LL,kpw(2LL,n - i,P - 1),P) * c[n][i]) % P * tmp) % P;
		if(i & 1) ans = (ans - tmp + P) % P;
		else ans = (ans + tmp) % P;
	}
	cout << ans << '\n';
	return 0;
}

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

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,L,R) for(int i=L;i<=R;i++)
using namespace std;

const int N=2e5+5;

struct node
{
    int v;
    ll w;
    node(ll sw,int sv)
    {
        w=sw;
        v=sv;
    }
};

vector<node>v[2*N+1];
int vis[N]= {0},vis1[N]= {0};

void dfs(int u,ll d)
{
 
    for(int i=0; i<v[u].size(); i++)
    {
        int vv=v[u][i].v;
        if(vis1[vv])
            continue;
            
        vis1[vv]=1;
        
		if((d+v[u][i].w)%2)
            vis[vv]=1;
        
		dfs(vv,d+v[u][i].w);
    }
}

int main()
{
    int n;
    
    scanf("%d",&n);
    
	memset(vis,0,sizeof(vis));
    
	loop(i,1,n-1)
    {
        int x,y;
    
	    scanf("%d%d",&x,&y);
    
	    ll w;
    
	    cin>>w;
    
	    v[x].push_back(node(w,y));
        v[y].push_back(node(w,x));
 
    }
    
	vis1[1]=1;
    dfs(1,0);
    
	for(int i=1; i<=n; i++)
        printf("%d\n",vis[i]);
        
    return 0; 
}

Measured memory_bytes: 17664
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int cnt = 0;

void merge(int a[], int count);

int main(int argc, char const *argv[])
{
    int n;
    int i;
    cin >> n;
    int a[n];
    rep(i,n) {
        cin >> a[i];
     //   P(a[i]);
    }
    merge(a, n);
    rep(i, n - 1){
        cout << a[i] << " ";
    }
    cout << a[n -1] << endl;
    P(cnt);
    return 0;
}

void merge(int a[], int count){
    if (count <= 1){
        return ;
    }
    int middle = (count - 1) / 2;   //index
    //cout << "middle: " << middle << " count: " << count << std::endl;;
    int b1[middle + 1];
    int b2[count - (middle + 1)];
    int i = 0;
    int j = 1;
    int k = 0;
    REP(i, 0, middle + 1) {
        b1[i] = a[i];
        //P(a[i]);
    }
    REP(i, 1, count - middle) {
        b2[i - 1] = a[middle + i];
        //P(b2[i - 1]);
    }
    merge(b1, middle + 1);
    merge(b2, count - (middle + 1));
    i = 0;
    while(i <= middle && middle + j <= count - 1) {
        if(b1[i] <= b2[j - 1]){
            //cout << "aaa  " <<  "b1: " << b1[i] << " b2: " << b2[j - 1] << endl;
            a[k] = b1[i];
            i++;
        }else {
            //cout << "aaa  " <<  "b1: " << b1[i] << " b2: " << b2[j - 1] << endl;
            a[k] = b2[j - 1];
            j++;
        }
        k++;
        cnt++;
    }

    if(i > middle){
        while(middle + j <= count - 1) {
            a[k] = b2[j - 1];
            j++;
            k++;
            cnt++;
        }
    }else if(middle + j > count - 1){
        while(i <= middle) {
            a[k] = b1[i];
            i++;
            k++;
            cnt++;
        }
    }
    // rep(i, count){
    //     cout << a[i] << " ";
    // }
    // cout << endl;
}

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

#define MAXN 123456
#define INF 0x3f3f3f3f

int n, k, h[MAXN], memo[MAXN], resp=INF;

int solve(int ind){
    if(memo[ind]!=INF) return memo[ind];
    if(ind==n-1){
        return 0;
    }
    if(ind>n-1){
        return INF;
    }

    for(int i=1;i<=k;i++){
        memo[ind] = min(memo[ind], solve(ind+i)+abs(h[ind+i]-h[ind]));
    }

    return memo[ind];
}

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

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

    memset(memo, INF, sizeof memo);

    cout << solve(0) << endl;

}


Measured memory_bytes: 5760
d = {
    "+": lambda a,b: a+b,
    "-": lambda a,b: a-b,
    "*": lambda a,b: a*b,
    "/": lambda a,b: a//b
}

while True:
    lst = input().split()

    if lst[1] == "?":
        break
    else:
        print(d[lst[1]](int(lst[0]), int(lst[2])))

Measured memory_bytes: 7688
#include <stdio.h>
#include <stdlib.h>

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

int main()
{
    long long a, b, g, l;
    while(scanf("%lld %lld", &a, &b)!=EOF){
        g = gcd(a,b);
        l = (a/g)*b;
        printf("%lld %lld\n", g, l);
    }
    return 0;
}

Measured memory_bytes: 596
s=input()
s_len=len(s)
acgt=["A","C","G","T"]
ans=0
for i in range(s_len):
    if s[i] in acgt:
        buf=0
        for j in range(s_len-i):
            if s[i+j] in acgt:
                buf+=1
            else:
                break
        ans=max(ans,buf)
print(ans)

Measured memory_bytes: 3060