akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	s := nextInt()
	w := nextInt()
	if w >= s {
		fmt.Println("unsafe")
	} else {
		fmt.Println("safe")
	}
}


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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

string S;
int ki[100100], gu[100100];
int ans[100100];

pii rec(int idx) {
    if (ki[idx] != -1)return pii(ki[idx], gu[idx]);
    int nex;
    if (S[idx] == 'R') nex = idx + 1;
    else nex = idx - 1;
    if (S[idx] != S[nex]) {
        ki[idx] = nex;
        gu[idx] = idx;
        return pii(ki[idx], gu[idx]);
    } else {
        pii p = rec(nex);
        ki[idx] = p.second;
        gu[idx] = p.first;
        return pii(ki[idx], gu[idx]);
    }
}

signed main() {
    cin >> S;
    memset(ki, -1, sizeof(ki));
    memset(gu, -1, sizeof(gu));
    rep(i, S.length()) {
        rec(i);
    }
    rep(i, S.length()) {
        ans[gu[i]]++;
    }
    rep(i, S.length()) {
        if (i != 0)cout << " ";
        cout << ans[i];
    }
    return 0;
}


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

using namespace std;

#define MAX 2010
typedef long long ll;
const ll MOD = (1e9) + 7;

ll dp[MAX][MAX];

ll extgcd(ll a, ll b, ll &x, ll &y)
{
    ll d = a;
    if (b != 0) {
	d = extgcd(b, a % b, y, x);
	y -= (a / b) * x;
    } else {
	x = 1; y = 0;
    }
    return d;
}

ll mod_inverse(ll a, ll m)
{
    ll x, y;
    extgcd(a, m, x, y);
    return (m + x % m) % m;
}

int main()
{
    ll N, D, X;
    while (cin >> N >> D >> X, N) {
        ll res = 0, comb = 1;
        memset(dp, 0, sizeof(dp));
        dp[0][0] = 1;
        for (int i = 1; i <= min(N, D); i++) {                        
            comb *= (D - i + 1) % MOD;
            comb %= MOD;
            comb *= mod_inverse(i, MOD);
            comb %= MOD;

            ll sum[MAX] = {};
            for (int j = 0; j <= N; j++) {
                sum[j] += dp[i-1][j];                
                if (j > 0) sum[j] += sum[j-1];
                sum[j] %= MOD;
            }

            for (int j = 0; j <= N; j++) {
                if (j > 0) dp[i][j] = sum[j-1];
                if (j - X >= 0) {
                    dp[i][j] += (-sum[j-X] + MOD) % MOD;
                }
                dp[i][j] %= MOD;
            }                
            res += dp[i][N] * comb;
            res %= MOD;
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 34556
#include <cstdio>
#include <cstdint>
#include <algorithm>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
using namespace std;
template <class T> inline void setmax(T & a, T const & b) { a = max(a, b); }

constexpr int max_h = 100;
constexpr int max_w = 100;
int16_t dp[max_h][max_w][max_h][max_w];
bool f[max_h][max_w];
int row_acc[max_h][max_w+1];
int col_acc[max_w][max_h+1];
int main() {
    int h, w; scanf("%d%d", &h, &w);
    int ey = -1, ex = -1;
    repeat (y,h) repeat (x,w) {
        char c; scanf(" %c", &c);
        if (c == 'o') f[y][x] = true;
        if (c == 'E') { ey = y; ex = x; }
    }
    repeat (y,h) repeat (x,w) row_acc[y][x+1] = row_acc[y][x] + f[y][x];
    repeat (y,h) repeat (x,w) col_acc[x][y+1] = col_acc[x][y] + f[y][x];
    repeat (ly,ey+1) {
        repeat (lx,ex+1) {
            repeat (ry,h-ey) {
                repeat (rx,w-ex) {
                    auto col = [&](int x) { return rx <= x and x < w-lx ? col_acc[x][min(ey+ry+1,h-ly)] - col_acc[x][max(ey-ly,ry)] : 0; };
                    auto row = [&](int y) { return ry <= y and y < h-ly ? row_acc[y][min(ex+rx+1,w-lx)] - row_acc[y][max(ex-lx,rx)] : 0; };
                    if (ey-(ly+1) >= 0) setmax<int16_t>(dp[ly+1][lx][ry][rx], dp[ly][lx][ry][rx] + row(ey-(ly+1)));
                    if (ex-(lx+1) >= 0) setmax<int16_t>(dp[ly][lx+1][ry][rx], dp[ly][lx][ry][rx] + col(ex-(lx+1)));
                    if (ey+(ry+1) <  h) setmax<int16_t>(dp[ly][lx][ry+1][rx], dp[ly][lx][ry][rx] + row(ey+(ry+1)));
                    if (ex+(rx+1) <  w) setmax<int16_t>(dp[ly][lx][ry][rx+1], dp[ly][lx][ry][rx] + col(ex+(rx+1)));
                }
            }
        }
    }
    printf("%d\n", dp[ey][ex][h-ey-1][w-ex-1]);
    return 0;
}


Measured memory_bytes: 193280
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	const long mod = 998244353;
	public void Solve(){
		
		long tot = ModPow(2, N);
		tot += mod - N - 1; if(tot >= mod) tot -= mod;
		tot += mod - ((long) N * (long) (N - 1) / 2 ) % mod; if(tot >= mod) tot -= mod;
		HashSet<long> H = new HashSet<long>();
		for(int i=0;i<N;i++){
			for(int j=i+1;j<N;j++){
				
				List<int> L = new List<int>();
				L.Add(i);
				L.Add(j);
				long vx = X[j] - X[i];
				long vy = Y[j] - Y[i];
				for(int k=0;k<N;k++){
					if(k == i || k == j) continue;
					long wx = X[k] - X[i];
					long wy = Y[k] - Y[i];
					if(vx * wy - vy * wx == 0){
						L.Add(k);
					}
				}
				if(L.Count == 2) continue;
				L.Sort();
				var hash = L[0] * 1L + L[1] * 1000L + L[2] * 1000000L;
				if(H.Contains(hash)) continue;
				
				H.Add(hash);
				int NN = L.Count;
				long three = ModPow(2, NN);
				three += mod - NN - 1; if(three >= mod) three -= mod;
				three += mod - ((long) NN * (long) (NN - 1) / 2 ) % mod; if(three >= mod) three -= mod;
				
				tot += mod - three; if(tot >= mod) tot -= mod;
				
			}
		}
		
		Console.WriteLine(tot);
		
		
		
		
	}
	
	long ModPow(long x, long k){
		if(k == 0) return 1;
		if(x == 0) return 0;
		long ret = 1;
		long v = x;
		while(k > 0){
			if((k & 1) == 1){
				ret *= v;
				if(ret >= mod) ret %= mod;
			}
			v *= v;
			if(v >= mod) v %= mod;
			k >>= 1;
		}
		return ret;
	}
	
	
	int N;
	long[] X,Y;
	public Sol(){
		N = ri();
		X = new long[N];
		Y = new long[N];
		for(int i=0;i<N;i++){
			var d = rla();
			X[i] = d[0]; Y[i] = d[1];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 17488
from collections import deque

def main():
    n = int(input())
    a = []
    for i in range(n):
        a.append(list(map(int, input().split())))

    que = deque()
    lastdone = []
    next = []
    for i in range(n):
        que.append((i, 1))
        lastdone.append(-1)
        next.append(0)
    while len(que) > 0:
        now, day = que.popleft()
        if lastdone[now] == day:
            continue
        if next[now] == n-1:
            continue
        candidate = a[now][next[now]]-1
        if lastdone[candidate] == day:
            continue
        if next[candidate] == n-1:
            continue
        if a[candidate][next[candidate]]-1 == now:
            next[now] += 1
            next[candidate] += 1
            lastdone[now] = day
            lastdone[candidate] = day
            que.append((now, day+1))
            que.append((candidate, day+1))

    for i in range(n):
        if next[i] != n-1:
            print(-1)
            return

    print(max(lastdone))

if __name__ == '__main__':
    main()


Measured memory_bytes: 35584
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String Sd = in.next();
		String T = in.next();
		int S = Sd.length();
		String ans = "UNRESTORABLE";
		for(int i = 0; i < S-T.length()+1; i++){
			for(int j = 0; j < T.length(); j++){
				if(!(( Sd.charAt(i+j) == T.charAt(j) ) || Sd.charAt(i+j) == '?'))break;
				if(j == T.length()-1){
					ans = Sd.substring(0,i)+T+Sd.substring(i+j+1);
					ans = ans.replace('?','a');
				}
			}
		}
		System.out.println(ans);
	}
}

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

class Dice{
public:
    long r[6];
    Dice(){};
    void roll(long a, long b, long c, long d){
        swap(r[a], r[b]);swap(r[b], r[c]);swap(r[c], r[d]);
    }
    void spin(char c){
        if (c == 'W') roll(0, 2, 5, 3);
        else roll(0, 1, 5, 4);
    }
};

int main() {
    bool ans = 0;
    int n;
    cin >> n;
    vector<Dice> D(n);
    for (int i = 0; i < n ; i++) {
        for (int j = 0; j < 6; j++) cin >> D[i].r[j];
    }
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            char SWS[8]={"NNNWNNN"};
            for (int k = 0; k < 8; k++){
                if (D[i].r[1] == D[j].r[1]) break;
                D[j].spin(SWS[k]);
            }
            for (int k = 0; k < 4; k++){
                if (D[i].r[0] == D[j].r[0]){
                    if (D[i].r[1] == D[j].r[1] && D[i].r[2] == D[j].r[2] && D[i].r[3]==D[j].r[3] && D[i].r[4] == D[j].r[4] && D[i].r[5] == D[j].r[5])
                        ans = 1;
                }
                D[j].spin('W');
            }
        }
    }
    if (ans == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1196
# coding: utf-8
import sys
import math
import fractions
input = sys.stdin.readline


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


a, b = map(int, input().split())
x = fractions.gcd(a, b)
check_list = []
i = 2
"""
while (1):
    flag = False
    if i > x:
        break
    while(x % i == 0):
        x /= i
        flag = True

    if flag == True:
        check_list.append(i)
    i += 1
"""
while x % 2 == 0:
    check_list.append(2)
    x //= 2
i = 3
while i * i <= x:
    if x % i == 0:
        check_list.append(i)
        x //= i
    else:
        i += 2
if x != 1:
    check_list.append(x)

print(len(set(check_list))+1)

# print(check_list)
"""
ans = 1
for check in check_list:
    if is_prime(check):
        ans += 1

print(ans)
"""


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll h, a;
	cin >> h >> a;
	cout << (h+a-1)/a << endl;

}



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
double pie=3.14159265358979;
long long mod=998244353;
//
int main(){
	int a[5];
	for(int i=0;i<5;i++){
		cin>>a[i];
		if(a[i]==0){
			cout<<i+1<<endl;
		}
	}
	return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;

int main() {
    ll n,c;
    cin>>n>>c;
    vector<pair<ll,ll>> vec;
    rep(i,n){
        ll x,v;
        cin>>x>>v;
        vec.push_back(make_pair(x,v));
    }
    //sort(all(vec));
    vll vecs1,vecs2;//時計回りと反時計回り
    ll now1=vec[0].second;//-vec[0].first,
    ll now2=vec[n-1].second;//-abs(c-vec[n-1].first);
    vecs1.push_back(now1-vec[0].first);
    vecs2.push_back(now2-c+vec[n-1].first);
    rep(i,n-1){
        now1+=vec[i+1].second;//-vec[i+1].first+vec[i].first;
        vecs1.push_back(now1-vec[i+1].first);

        now2+=vec[n-2-i].second;//-abs(vec[n-2-i].first-vec[n-1-i].first);
        vecs2.push_back(now2-c+vec[n-2-i].first);
        
    }
    ll ans=0;

    rep(i,n){
        ans=max(ans,max(vecs1[i],vecs2[i]));
    }

    ll nowmax1=vecs1[0];
    for (int i=2;i<n+1;i++){
        nowmax1=max(nowmax1,vecs1[i-2]);
        ll ans1=vecs2[n-i];
        ans=max(ans,ans1+nowmax1-c+vec[i-1].first);
    }
    ll nowmax2=vecs2[0];
    for (int i=n-2;i>=0;i--){
        nowmax2=max(nowmax2,vecs2[n-2-i]);
        ll ans1=vecs1[i];
        ans=max(ans,ans1+nowmax2-vec[i].first);
        
    }
    cout<<ans<<endl;
    /*ans=max(ans,vecs1[n-1]);
    ll nowmax1=vecs2[0];
    for (int i=0;i<n-1;i++){
        ll ans1=vecs1[n-2-i];
        ll ans2=vecs2[i];
        nowmax1=max(ans2,nowmax1);
        ans=max(max(nowmax1,ans),max(ans1+nowmax1-vec[n-2-i].first,ans1)));
    }

    ll nowmax2=vecs1[0];
    for (int i=0;i<n-1;i++){
        ll ans1=vecs1[i];
        ll ans2=vecs2[n-2-i];
        nowmax1=max(ans1,nowmax2);
        ans=max(max(nowmax2,ans),max(ans2+nowmax2-vec[i].first,ans2)));
    }
    
    cout<<max(ans,vecs2[n-1])<<endl;*/



    /*rep(i,n){
        cout<<vecs1[i]<<endl;
        cout<<vecs2[i]<<endl;
    }*/
    
    

    return 0;
}

Measured memory_bytes: 4720
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll,ll> Pll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define repp(i, n) for(int i=1;i<=n;i++)
#define all(x) x.begin(), x.end()

#define ABS(x) (((x) > 0 ) ? (x) : (-(x)))
#define MAX2(x, y) (((x) > (y)) ? (x) : (y))
#define MIN2(x, y) (((x) < (y)) ? (x) : (y))
#define MAX3(x, y, z) ( (x) > (y)  ? ( (x) > (z) ? (x) : (z)  ) : ( (y) > (z) ? (y) : (z) )  )
#define MIN3(x, y, z) ( (x) < (y)  ? ( (x) < (z) ? (x) : (z)  ) : ( (y) < (z) ? (y) : (z) )  )
#define MID3(val1,val2,val3) MAX2(MIN2(MAX2(val1,val2),val3),MIN2(val1,val2))


#define geti1(X) scanf("%d",&X)
#define geti2(X,Y) scanf("%d%d",&X,&Y)
#define geti3(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define geti4(X,Y,Z,W) scanf("%d%d%d%d",&X,&Y,&Z,&W)

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define geti(...) GET_MACRO(__VA_ARGS__, geti4, geti3, geti2, geti1) (__VA_ARGS__)

#define INF 987654321
#define IINF 987654321987654321

int N,M,K,T;
ll A[100050], B[100050];
int main(void)
{
	geti(N);
	repp(i,N){
		scanf("%lld%lld",A+i,B+i);
	}
	ll ans = 0; ll cur = 0;
	for(int i=N;i>=1;i--){
		A[i] += cur;

		if( A[i] % B[i] == 0 ){
			continue;
		}
		ll t = (A[i]+B[i]-1)/B[i];
		t *= B[i];
		ans += t - A[i];
		cur += t - A[i];
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 1920
//gauravsinghh
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define db double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int> 
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define os cout<<" "
#define bitcount __builtin_popcount
#define gcd __gcd
#define endl "\n"
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define ford(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fors(container, it, a, b) for(__typeof(container.begin()) it = a; it != b; it++) 
#define MOD 1000000007
#define MAXI (1<<32)
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 999999999999999999
#define siz 100005
#define SIZ 1000005
#define SIZE 200005
#define fbo find_by_order
#define ook order_of_key
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(int i = a; i <= b; i++)
#define ffo(i, a, b) for(int i = a; i >= b; i--)
#define MAX 100005
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")

void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

/*bool comp(const pair<ll,ll>&a,const pair<ll,ll>&b){
	return a.ff<b.ff || (a.ff==b.ff && a.ss<b.ss);
}*/

//ll p[20000005]={0};
//vector<ll>ans;
/*void sieve(){
    ll i,j;
    p[0]=p[1]=1;
    for(i=2;i*i<=20000005;i++){
        if(!p[i]){
            for(j=2*i;j<20000005;j+=i){
                p[j]=1;
            }
        }
    }
    fo(i,2,20000005){
        if(!p[i]){
            ans.pb(i);
        }
    }
}*/

signed main(){ 
    IOS
    //io_set();
    ll n, a, b;
    cin >> n >> a >> b;
    cout << min(a*n,b) << endl;
    return 0;
}



Measured memory_bytes: 256
#ABC091-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n=I()
R=[]
B=[]
for i in range(n):
    x,y=IL()
    R.append([x,y,x+y])
for i in range(n):
    x,y=IL()
    B.append([x,y,x+y])
R.sort(key=lambda x:-x[1])
B.sort(key=lambda x:x[0])
Rb=[True]*n
Bb=[True]*n

ans=0
for i in range(n):
    bx,by,bz=B[i]
    for j in range(n):
        rx,ry,rz=R[j]
        if rx<bx and ry<by and Rb[j] and Bb[i]:
            ans+=1
            Rb[j]=False
            Bb[i]=False
print(ans)

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

int main(int argc, char const *argv[]) {
    int n, d;
    cin >> n >> d;

    int now = 0;
    int ans = 0;
    while (now < n) {
        now += 2 * d + 1;
        ans++;
    }

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


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#include <math.h>
#include <iomanip>
#include <fstream>
#include <random>
using namespace std;
inline void InitRand()
{
    srand((unsigned int)time(NULL));
}
int main() {
    InitRand();
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int n;
    cin>>n;
    int ans=0;
    int tmp=0;
    int a[2][100]={};
    for(int i=0;i<2;++i){
        for(int j=0;j<n;++j){
            cin>>a[i][j];
        }
    }
    ans+=a[0][0];
    for(int i=0;i<n;++i){ans+=a[1][i];}
    for(int i=1;i<n;++i){
        tmp=0;
        for(int j=0;j<=i;++j){
            tmp+=a[0][j];
        }
        for(int j=i;j<n;++j){
            tmp+=a[1][j];
        }
        if(ans<=tmp){ans=tmp;}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int n;
    cin >> n;
    vector<ll>a(n);
    vector<ll>b(n);
    vector<ll>c(n);
    rep(i,n){
        scanf("%lld",&a[i]);
        if(i==0){
            b[i] = a[i];
            c[i] = a[i];
        }else{
            b[i] = b[i-1]+a[i];
            c[i] = c[i-1]^a[i];
        }
    }
    ll ans = 0;
    rep(i,n){
        int l = i;
        int r = n;
        while(r-l>1){
            int mid = (l+r)/2;
            ll k = b[mid];
            if(i)k-=b[i-1];
            ll kk = c[mid];
            if(i)kk^=c[i-1];
            if(k==kk){
                l = mid;
            }else{
                r = mid;
            }
        }
        ans += l-i+1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;
const int MOD = 1000000007;

int main() {
	string S;
	cin >> S;
	ll fin = S.size();
	for (ll i = 1; i < fin/2; i++) {
		for (ll j = 0; j < (fin - 2*i)/2; j++) {

			if (S[(fin - i * 2) / 2 + j] != S[j]) {

				break;
			}
			if (j == (fin - 2*i) / 2 - 1) {


				cout << fin - i * 2;
				return 0;
			}

		}



	}
	cout <<0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

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



void solve()
{
    int a,b;cin>>a>>b;
    cout<<max({a+b,a-b,a*b});
}
int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
import numpy as np

n = int(input())
a = list(map(int, input().split()))
MAX = 10 ** 6

arr = np.zeros(MAX + 1, np.int64)
for e in a:
    arr[e] += 1

for i in range(MAX + 1):
    if arr[i]:
        arr[2*i::i] = 0

    arr[i] = arr[i] == 1

ans = arr.sum()
print(ans)


Measured memory_bytes: 51200
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String args[]) {
        int n = 0;
        int k = 0;
        long MOD = 1000*1000*1000 + 7;
        int[] arr = null;
        long[] sums = null;
        try (Scanner scanner = new Scanner(System.in)) {
            n = scanner.nextInt();
            arr = new int[n];
            sums = new long[n];
            long sum = 0;
            for(int i = 0; i < n ;i++) {
                arr[i] = scanner.nextInt();
                sum += arr[i];
                sums[i] = sum;
            }
        }
        
        //dp[i][j] min cost for range i to j 
        long[][] dp = new long[n][n];
        for(int l = n - 1; l >= 0; l--) {
            for(int r = l; r < n; r++) {
                if(l == r)
                    dp[l][r] = 0;
                else {
                    dp[l][r] = Long.MAX_VALUE;
                    for(int i = l; i < r ;i++) {
                        dp[l][r] = Math.min(dp[l][r], dp[l][i] + dp[i+1][r] 
                                    + Math.abs((l-1 >=0?sums[l - 1]:0) - sums[r]));
                    }
                }
            }
        }
        
        // for(long[] d : dp)
        //     System.out.println(Arrays.toString(d));
        System.out.println(dp[0][n- 1]);
        
    }
    
}

Measured memory_bytes: 24532
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    a, b = list(map(int, input().rstrip('\n').split()))
    if 1  <= a <= 9 and 1 <= b <= 9:
        print(a * b)
    else:
        print(-1)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38472
import bisect
from copy import deepcopy
N = int(input())
L = sorted(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(i + 1, N - 1):
        b = L[j] + L[i]
        x = bisect.bisect_left(L, b) - j - 1
        if x > 0:
            ans += x

print(ans)


Measured memory_bytes: 9492
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

ll P = 1000000007;
//-------------------------------------------------------------------
vvl T(vvl A){
  vvl B = vv(A[0].size(),A.size(), 0, ll);
  for(int i=0;i<A[0].size();i++) for(int j=0;j<A.size();j++) B[i][j] = A[j][i];
  return B;
}
vvl dot(vvl A, vvl B){
  vvl C = vv(A.size(), B[0].size(), 0, ll);
  for(int i=0;i<A.size();i++){
    for(int j=0;j<A[0].size();j++){
      for(int k=0;k<B.size();k++) C[i][j] = (C[i][j] + (A[i][k]*B[k][j])%P)%P;
    }
  }
  return C;
}
vvl gaussian_elimination(vvl A, vvl B){
  if(B.size()==A.size()) {
    for(int i=0;i<A.size();i++) for(int j=0;j<B[0].size();j++) A[i].push_back(B[i][j]);
  }
  return A;
}
//-------------------------------------------------------------------
int main(int argc, char const *argv[]) {
  ll n, k;std::cin >> n >> k;
  vvl d = vv(n, n, 0, ll);
  re(i, n) re(j, n) std::cin >> d[i][j];
  vvl ans = vv(n, n, 0, ll);
  re(i, n) ans[i][i] = 1;
  while(k>0){
    if(k%2==1) ans = dot(ans, d);
    k/=2;
    d = dot(d, d);
  }
  ll r = 0;
  re(i, n) re(j, n) r = (r + ans[i][j])%P;
  std::cout << r << '\n';
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void){
    // 変数
    int COIN_500 = 500;
    int COIN_5 = 5;
    int value = 0;
    int point_500 = 0;
    int point_5 = 0;
    int sum = 0;

    // 入力
    scanf( "%d", &value );

    // 演算
    point_500 = ( value / COIN_500 ) * 1000 ;
    value = value % COIN_500;

    point_5 = ( value / COIN_5 ) * 5 ;

    sum = point_500 + point_5 ;

    // 出力
    printf( "%d\n", sum );


    return 0;
}

Measured memory_bytes: 128
class Tree:
    def __init__(self,parent,left,right):
        self.parent = parent
        self.left = left
        self.right = right
        self.sibling = -1
        self.degree = 0
        self.depth = -1
        self.height = -1

def getdepth(u):
    for i in range(N):
        depth = 0
        j = i
        while trees[j].parent != -1:
            j = trees[j].parent
            depth += 1
        trees[i].depth = depth

def getheight(u):
    hleft = hright = 0
    if trees[u].left != -1:
        hleft = getheight(trees[u].left) + 1
    if trees[u].right != -1:
        hright = getheight(trees[u].right) + 1

    trees[u].height = hleft if hleft > hright else hright
    return trees[u].height


N = int(input())
# ?????????
trees = [Tree(-1,-1,-1) for i in range(N)]
for i in range(N):
    l = list(map(int, input().split()))
    no = l[0]
    left = l[1]
    right = l[2]
    trees[no].left = left
    trees[no].right = right
    if left != -1:
        trees[left].parent = no
        trees[left].sibling = right
        trees[no].degree += 1
    if right != -1:
        trees[right].parent = no
        trees[right].sibling = left
        trees[no].degree += 1

r = 0
for i in range(N):
    if trees[i].parent == -1:
        r = i

getdepth(r)
getheight(r)

for i in range(N):
    type = ""
    if trees[i].parent == -1: type = "root"
    elif trees[i].left == -1 and trees[i].right == -1: type = "leaf"
    else: type = "internal node"

    print("node {0}: parent = {1}, sibling = {2}, degree = {3}, depth = {4}, height = {5}, {6}".format(
        i,
        trees[i].parent,
        trees[i].sibling,
        trees[i].degree,
        trees[i].depth,
        trees[i].height,
        type))

Measured memory_bytes: 7852
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define forn(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pb push_back
 
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
//27 'a'

//1

//26 

void solve(){
	ll n; cin >> n;
	string ans = "";
	while(n){
		if(n%26==0){
			ans = 'z' + ans;
			--n;
		} else{
			char c = (n%26 - 1) + 'a';
			ans = c + ans;
		}
		n/=26;
	}
	cout << ans;
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string>
#include <set>
#include <vector>
#include <functional>

using namespace std;

int N, H;
vector<int> v;

int max_att;
int counter;

int main()
{

    scanf("%d%d", &N, &H);
    for (int i=0; i<N; i++)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        v.push_back(b);
        max_att = max(a, max_att);
    }
    sort(v.begin(), v.end(), greater<int>());
    for (int i=0; i<N; i++)
    {
        if (v[i]<max_att)
            break;

        H -= v[i];
        counter++;
        if (H<=0)
        {
            printf("%d", counter);
            return 0;
        }
    }
    counter += H/max_att;
    if (H%max_att)
        counter++;
    printf("%d", counter);
    return 0;
}


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

using namespace std;

#define debug(x) cout << "\n" << __LINE__ << " " <<  (#x) << " is " << (x) << endl

int main(){
	#ifdef EVAL	
		freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
	#endif
	int A, B, C;
	cin >> A >> B >> C;
	int to_empty = A - B;
	int to_give = min(to_empty,C);
	C -= to_give;
	cout << C;
	return 0;
}

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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			int a = cin.Int();
			int b = cin.Int();
			if (b == 1) {
				Console.WriteLine(0);
				return;
			}

			int ans = 0;
			while (ans * (a - 1) + a < b) {
				++ans;
			}

			Console.WriteLine(ans + 1);
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;

		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int()
		{
			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] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			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] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			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] = Double() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 13140
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

N, K = inpl()
A = inpl()
ls = [1] * (N+10)
for i in range(K, N):
    if A[i] > A[i-K]:
        print('Yes')
    else:
        print('No')

# -----------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


Measured memory_bytes: 31852
using System;
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    private const ulong MOD9 = 1000000007;

    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var v = Console.ReadLine().Split(' ');
        var c = Console.ReadLine().Split(' ');

        var benefit = 0;
        for (int i = 0; i < n; ++i)
        {
            var diff = int.Parse(v[i]) - int.Parse(c[i]);
            if (diff > 0)
                benefit += diff;
        }

        Console.WriteLine(benefit);
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int, int> > vp;
#define pb push_back
#define mp make_pair
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
vector<vector<ll> > mult(vector<vector<ll> >  A,vector<vector<ll> > B){
	ll n = A.size();
	vector<vector<ll> > C(n, vector<ll> (n, 0));
	for(ll i = 0; i < n ; i++)
		for(ll j = 0; j < n; j++)
			for(ll k = 0; k < n; k++)
				C[i][j] = (C[i][j] + (A[i][k] * B[k][j]) % (MOD)) % (MOD);
	return C;
}
vector<vector<ll> > expo(vector<vector<ll> > A, ll k){
	ll n = A.size();
	vector<vector<ll> > B(n, vector<ll> (n, 0));
	for(ll i = 0; i < n; i++)
		B[i][i] = 1;
	while(k){
		if(k & 1)
			B = mult(B, A);
		A = mult(A, A);
		k /= 2;
	}
	return B;
}
ll rs(ll a, ll b){
	ll ans = 1;
	while(b){
		if(b & 1){
			ans = (ans * a) % MOD;
		}
		a = (a * a) % MOD;
		b /= 2;
	}
	return ans;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, k;
	cin >> n >> k;
	//cin >> n >> f1 >> f2 >> f3 >> c;
	//n -= 3;
	vector<vector<ll> > A;
	for(int i = 0; i < n; i++){
		vector<ll> temp;
		for(int j = 0; j < n; j++){
			ll x;
			cin >> x;
			temp.pb(x);
		}
		A.pb(temp);
	}
	vector<vector<ll> > res = expo(A, k);
	ll ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			ans = (ans + res[i][j]) % MOD;
		}
	}
	cout << ans << '\n';
}

Measured memory_bytes: 384
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (ll i = ll(a); i <= ll(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, a;
    in >> n;
    vector<ll> rate(9);
    REP(i, 9) rate[i] = 0;
    REP(i, n){
        in >> a;
        if(a < 3200){
            rate[int(a/400)] += 1;
        }else{
            rate[8] += 1;
        }
    }
    int ans = 0;
    REP(i, 8){
        if(rate[i] > 0) ans += 1;
    }

    out << max(1, ans) << " " << ans + rate[8] << endl;
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 1;

struct Item {
  int index;
  int a;
  int b;
};

bool Solve() {
  int n;
  cin >> n;
  vector<int> as(n);
  vector<int> bs(n);
  for (int i = 0; i < n; i++) {
    cin >> as[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> bs[i];
  }

  vector<int> as_sorted(as.begin(), as.end());
  vector<int> bs_sorted(bs.begin(), bs.end());
  sort(as_sorted.begin(), as_sorted.end());
  sort(bs_sorted.begin(), bs_sorted.end());

  for (int i = 0; i < n; i++) {
    if (as_sorted[i] > bs_sorted[i]) return false;
  }

  for (int i = 0; i + 1 < n; i++) {
    if (as_sorted[i + 1] <= bs_sorted[i]) return true;
  }

  vector<Item> items;
  for (int i = 0; i < n; i++) {
    items.push_back(Item({i, as[i], bs[i]}));
  }
  sort(items.begin(), items.end(), [](Item item1, Item item2) { return item1.b < item2.b; });

  vector<pair<int, int>> pairs;
  for (int i = 0; i < n; i++) {
    pairs.push_back(make_pair(items[i].a, i));
  }
  sort(pairs.begin(), pairs.end());

  vector<int> visited(n);
  int current = 0;
  int cycle_count = 0;
  while (true) {
    if (visited[current]) break;
    visited[current] = 1;
    current = pairs[current].second;
    cycle_count++;
  }
  // cout << "cycle_count: " << cycle_count << endl;
  return cycle_count < n;
}

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

  if (Solve()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 4852
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define BUF_SIZE 30

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

// 1-billion + 7
#define DIVISOR 1000000007

int main(void) {
    int m, power;
    get_int2(&m, &power);
    uint64_t power_m[31]; // [*]: bitpos
    int i;
    power_m[0] = m;
    for(i = 1; i < 31; i++) {
        power_m[i] = (power_m[i-1] * power_m[i-1])%DIVISOR;
    }

    uint64_t ans = 1;
    for(i = 0; i < 31; i++) {
        if(power & (1<<i)) {
            ans *= power_m[i];
        }
        ans %= DIVISOR;
    }
    printf("%d\n", (int)ans);
    return 0;
}


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

int main(){
	int count[100];
	int n,k;
	int i,j;
	int d;
	int a;
	int ans=0;
	for(i=0;i<100;i++){
		count[i]=0;
	}
	cin>>n>>k;
	for(i=0;i<k;i++){
		cin>>d;
		for(j=0;j<d;j++){
			cin>>a;
			count[a-1]+=1;
		}
	}
	for(i=0;i<n;i++){
		if(count[i]==0) ans+=1;
	
	}
	cout<<ans;
}	

Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <cassert>
#include <vector>

using namespace std;


class Solution{

private:
    const long long MOD = 1e9 + 7;

    vector<vector<long long>> dp;

public:
    int ways(const string& s, int N){

        dp = vector<vector<long long>>(N + 1, vector<long long>(N + 1, -1ll));

        long long sum = 1ll;
        for(int i = 0; i < s.size(); i ++) sum *= 2ll, sum %= MOD;
        return go(N, s.size()) * mypow(sum, MOD - 2) % MOD;
    }

private:
    long long go(int n, int l){

        if(n == 0) return l == 0 ? 1ll : 0ll;
        if(n < l) return 0ll;
        if(dp[n][l] != -1ll) return dp[n][l];

        long long res = 0ll;
        if(l >= 1) res += go(n - 1, l - 1) * 2ll % MOD, res %= MOD;
        if(l == 0) res += go(n - 1, 0), res %= MOD;
        res += go(n - 1, l + 1), res %= MOD;

        return dp[n][l] = res;
    }

    long long mypow(long long x, int k){

        if(k == 0) return 1ll;

        long long t = mypow(x, k / 2);
        long long res = t * t % MOD;
        if(k % 2) res = res * x % MOD;
        return res;
    }
};

int main() {

//    cout << Solution().ways("0", 3) << endl;
//    // 5
//
//    cout << Solution().ways("1100100", 300) << endl;
//    // 519054663

    int N;
    cin >> N;
    assert(N <= 300);

    string s;
    cin >> s;

    printf("%d\n", Solution().ways(s, N));

    return 0;
}


Measured memory_bytes: 199036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
    int N,M; cin >> N >> M;
    vei p(N);
    rep(i,N) p[i] = 0;
    rep(i,2*M) {
        int road;
        cin >> road;
        p[road-1]++;
    }
    rep(i,N) cout << p[i] << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx,tune=native")

#include <bits/stdc++.h>

using namespace std;

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

template<typename T>
using pq_gt = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using pq_lt = priority_queue<T, vector<T>, less<T>>;

#define se second
#define fi first
#define pb push_back

int main() {
    int n;
    cin>>n;
    int cur = 0;
    cout<<cur<<endl;
    fflush(stdout);
    string res;
    cin>>res;
    int lo =0, hi = n;
    while(res!="Vacant") {
    	int mid = (lo+hi)/2;
    	cout<<mid<<endl;
    	fflush(stdout);
    	string tmp;
    	cin>>tmp;
    	if(abs(mid - cur)%2 != (res==tmp)) {
    		if(mid>cur) {
    			lo = mid+1;
    		} else {
    			hi = mid-1;
    		}
    	} else {
    		if(mid>cur) {
    			hi = mid-1;
    		} else {
    			lo = mid+1;
    		}
    	}
    	res = tmp;
    	cur = mid;
    }
    
}

Measured memory_bytes: 852
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
#define yn(x) puts((x ? "Yes" : "No"))
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int A,B,N;
void input() {
  ;
  ;
  cin>>A>>B>>N;
}
void solve() {
  // nibun
auto isOK = [&](int mid, int key) {
  // x = CC * B - 1
  // N/B+1
  int k = min(N,B);
  k--;
  
  bool ret = false;
  ret |= (A*k/B) - (int)(k/B)*A >= mid;
  ret |= (A*N/B) - (int)(N/B)*A >= mid;
  ret |= A*(N-1)/B - (int)((N-1)/B)*A >= mid;

return ret;

};
auto binary_search = [&](int key) {
  int ng = INF;
  int ok = -1;
  while (abs(ok - ng) > 1) {
    int mid = (ok + ng) >> 1;
    (isOK(mid, key) ? ok : ng) = mid;
  }
  return ok;
};
cout<<binary_search(0)<<endl;
  ;
  ;
}
signed main() {
  cout << setprecision(12);
  input();
  solve();
  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}


int main(){
	char X, Y;
	cin >> X >> Y;
	if(X < Y) Cout('<');
	else if(X > Y) Cout('>');
	else Cout('=');
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <math.h> // sqrt
using namespace std;

long long ruijo(int n) {
    long long ans = 1;
    for (int i = 0; i < n; i++) {
        ans *= 2;
    }
    return ans;
}

int main() {
    int N;
    cin >> N;
    vector<long long> data(N);
    for (int i = 0; i < N; i++) {
        cin >> data.at(i);
    }
    vector<int> two(31, 0);
    long long num;
    int j;
    for (int i = 0; i < N; i++) {
        num = data.at(i);
        j = 0;
        while(true) {
            if (num % 2 == 1) {
                two.at(j)++;
            }
            if (num < 2) {
                break;
            }
            num = floor(num/ 2);
            j++;
        }
    }
    long long ans = 0;
    for (int i = 0; i < 31; i++) {
        if (two.at(i) % 2 == 1) {
            ans += ruijo(i);
        }
    }
    long long ansa;
    for (int i = 0; i < N; i++) {
        ansa= ans;
        num = data.at(i);
        j = 0;
        while(true) {
            if (num % 2 == 1) {
                if (two.at(j) % 2 == 0) {
                    ansa += ruijo(j);
                }
                else {
                    ansa -= ruijo(j);
                }
            }
            if (num < 2) {
                break;
            }
            num = floor(num / 2);
            j++;
        }
        cout << ansa << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 4712
import numpy as np
import copy

N = int(input())
X = [int(i) for i in input().split()]

max_value = max(X)
min_value = min(X)

tmp_list = copy.deepcopy(X)
tmp_list.sort()
all_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

tmp_list.remove(max_value)
min_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

tmp_list = copy.deepcopy(X)
tmp_list.remove(min_value)
tmp_list.sort()
max_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

for i in range(N):
    if X[i] <= all_med:
        print(int(max_med))
    else:
        print(int(min_med))

Measured memory_bytes: 34152
import std;

bool calc(int k, int a, int b) {
    return a <= b / k * k;
}

void main() {
    int k; scan(k);
    int a, b; scan(a, b);
    writeln(calc(k, a, b) ? "OK" : "NG");
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;


Measured memory_bytes: 3652
#include <algorithm>
#include <complex>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::cerr;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::stack;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

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

int main() {
    int n, l;
    cin >> n >> l;

    vector<string> ss(n);
    for (int i = 0; i < n; i++) {
        cin >> ss[i];
    }

    sort(ss.begin(), ss.end());

    for (int i = 0; i < n; i++) {
        cout << ss[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define all(v) v.begin(),v.end()
    using namespace std;
    int main(){
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d;
	e=a-c;
	f=b-d;
	cout<<c+f<<" ";
	cout<<d-e<<" ";
	cout<<c+f+e<<" ";
	cout<<d-e+f<<endl;
    return(0);
    }

Measured memory_bytes: 3556