akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<bits/stdc++.h>
using namespace std;




bool isSubSequence(string str1, string str2, int m, int n)
{

    if (m == 0) return true;
    if (n == 0) return false;


    if (str1[m-1] == str2[n-1])
        return isSubSequence(str1.substr(0,m-1), str2.substr(0,n-1), m-1, n-1);


    return isSubSequence(str1, str2.substr(0,n-1), m, n-1);
}

int main()
{
    string s;
    cin>>s;
    int n = s.length();



    char check[5] = {'K','I','H','B','R'};


    if(isSubSequence(s,"AKIHABARA",n,9))
    {
        int c = 0;
        for(int i=0; i<5; i++)
        {
            for(int j=0; j<n; j++)
            {
                if(s[j]==check[i])
                {
                    c++;
                    break;
                }
            }
        }
        if(c==5)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }


    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;


public class Program{
    public static void Main(){
        TextReader reader;
        string filename="";
                if(filename.Length!=0){
            reader = new StreamReader(filename);
        }else{
            reader = Console.In;
        }
        var abc = reader.ReadLine().Split().Select(int.Parse).ToArray();
        var a = abc[0];
        var b = abc[1];
        var c = abc[2];
        if(b-a == c-b){
            Console.WriteLine("YES");
        }else{
            Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 13268
import math
import itertools
import collections
import bisect
import heapq

def IN(): return int(input())
def sIN(): return input()
def MAP(): return map(int,input().split())
def LMAP(): return list(map(int,input().split()))
def TATE(n): return [input() for i in range(n)]
MOD = 10**9 + 7

s = sIN()

print(s[0]+s[1]+s[2])

Measured memory_bytes: 9356
#include<bits/stdc++.h>
using namespace std;
int n, k, w[100000];

bool loadable(int p){
    int sum = 0, cnt = 0;
    for(int i = 0; i < n; i++){
        if(cnt > k){
            return false;
        }
        if(sum + w[i] <= p){
            sum += w[i];
        }
        else{
            sum = 0;
            cnt++;
            i--;
        }
    }
    if(sum){
        cnt++;
    }
    return cnt <= k;
}

int bsearch(int l, int r){
    int mid = (l + r) / 2;
    if(l + 1 == r){
        if(loadable(l)){
            return l;
        }
        else{
            return r;
        }
    }
    if(loadable(mid)){
        bsearch(l, mid);
    }
    else{
        bsearch(mid, r);
    }
}

int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> w[i];
    }
    cout << bsearch(0, 1000000000) << endl;
}


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

map<string, int> mp;

int main(){
    int T; scanf("%d", &T);
    while (T--){
        string s;
        cin >> s;
        ++mp[s];
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
    return 0;
}


Measured memory_bytes: 3700
#pragma target("avx")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define rep(i,b,e) for(ll i=b; i<e; i++)
#define be(vec) vec.begin(),vec.end()
#define print(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define scan(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

ll modpow(ll a, ll p){
        ll ret = 1;
        while(p){
                if(p&1) ret = ret * a % MOD;
                a = a * a % MOD;
                p >>= 1;
        }
        return ret;
}

int main(){
        std::string s;
        std::cin >> s;
        V a(s.size()+1, 0);
        ll dig = 1;
        for(ll i=s.size()-1; i>=0; i--){
                a[i] = (a[i+1] + (s[i]-'0')*dig) % 2019;
                dig = dig * 10 % 2019;
        }
        std::map<ll,ll> mp;
        for(ll x: a) mp[x]++;
        ll ans = 0;
        for(auto [v, cnt]: mp) ans += cnt*(cnt-1)/2;
        printf("%ld\n", ans);
        return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

void Main(){
    char a;
    cin >> a;
    if (isupper(a)) {
        cout << "A" << endl;
    } else {
        cout << "a" << endl;
    }
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> P;

int main(){
    LL x, y;
    cin >> x >> y;
    if(abs(x-y) > 1)    cout << "Alice" << endl;
    else    cout << "Brown" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
   int a,b,c,d;
   string s;
   cin >> a >> b >> c >> d;
   cout << max(a*b,c*d) << endl;


   return 0;
}



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

using namespace std;

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

    int a[10000];
    for(int i=0;i<m;i++)

    {
        cin>>a[i];
    }
    int s=0;

    for(int i=0;i<m;i++)

        s+=a[i];
        if(s>n){
            cout<< -1<<endl;
        }else{
            cout<< n-s<<endl;
    }
    return 0;
}


Measured memory_bytes: 3608
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size))scanf("%d",&(name)[i])
#define MOD 1000000007

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

bool is_prime(int n){
    int s=sqrt(n)+1;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=n;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

struct UnionFind{
    vector<int> data;
    UnionFind(int size){
        data=vector<int>(size,-1);
    }
    bool union_set(int x,int y){
        x=root(x);
        y=root(y);
        if(x!=y){
            if(data[y]<data[x])swap(x,y);
            data[x]+=data[y];
            data[y]=x;
        }
        return x!=y;
    }
    bool find(int x,int y){
        return root(x)==root(y);
    }
    int root(int x){
        return data[x]<0?x:data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    ll X,Y;
    cin>>X>>Y;
    print(abs(X-Y)<2?"Brown":"Alice");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1

using namespace std;

const double g=10.0,eps=1e-9;
const int N=500000+10,maxn=1000000+10,inf=0x3f3f3f;

char s[N];
int dp[N];
int main()
{
    int n,last=0;
    scanf("%d%s",&n,s);
    for(int i=2;i<n;i++)
    {
        dp[i]=max(dp[i],dp[i-1]);
        if(s[i-2]=='1'&&s[i-1]=='0'&&s[i]=='1')
        {
            last=i;
            for(int j=i-2;j>=0&&s[j]=='1';j--)dp[i]=max(dp[i],dp[j-1]+i-j-1);
        }
        if(s[i]=='0')last=0;
        if(last!=0)dp[i]=max(dp[i],dp[last-3]+i-last+1);
       // cout<<last<<endl;
    }
    printf("%d\n",dp[n-1]);
    return 0;
}
/****************
6
101011
****************/


Measured memory_bytes: 2688
// AOJ 2408 Social
// 2017.9.26 bal4u@uu

#include <stdio.h>
#include <string.h>

int bt[52][52], len[52];	// ?????????????????¶???
char rel[52][52];			// ?????????????????¢???
char f[52];					// ?°??????????????????????

int main()
{
	int n, k, r, i, j, m, ans;

	scanf("%d%d", &n, &k);
	for (i = 0; i < k; i++) {
		scanf("%d", len+i);
		for (j = 0; j < len[i]; j++) scanf("%d", bt[i]+j);
	}
	memset(rel, 0, sizeof(rel));
	scanf("%d", &r);
	while (r-- > 0) {
		scanf("%d%d", &i, &j);
		rel[i][j] = rel[j][i] = 1;
	}
	ans = 0;
	memset(f, 0, n+1);
	for (i = 0; i < k; i++)
		for (j = 0; j < len[i]; j++)
			for (m = 0; m < len[i]; m++)
				if (rel[bt[i][j]][bt[i][m]]) f[bt[i][j]] = f[bt[i][m]] = 1;
	
	for (ans = 0, i = 1; i <= n; i++) if (f[i]) ans++;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1848
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define lf long double
#define vi vector<int>
#define vl vector<long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define MOD 1000000007
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define in insert
#define all(x) x.begin(),x.end()
#define zapp ios::sync_with_stdio(false);cin.tie(0)
ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll power(ll x, ll y) {if (y < 0) return 1; ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
//const bool is_in = container.find(element) != container.end();
int main()
{
	zapp;
	string s;
	cin>>s;
	if(s == "ABC")
		cout<<"ARC\n";
	else
		cout<<"ABC\n";
}



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

int main(){
  int i,j,cnt=0;
  string s;
  cin>>s;
  int a[3];
  for(i=0;i<3;i++)a[i]=0;
  for(i=0;i<s.size();i++){
    if(s[i]=='a')a[0]++;
    if(s[i]=='b')a[1]++;
    if(s[i]=='c')a[2]++;
  }
  sort(a,a+3);
  if((a[0]==a[1] && a[1]==a[2]) || (a[0]==a[1] && a[1]==a[2]-1) || (a[0]+1==a[1] && a[1]==a[2])){
    cout<<"YES"<<endl;
  }else cout<<"NO"<<endl;
}

Measured memory_bytes: 512
//
//  main.cpp

#include <iostream>
using namespace std;


int main(){	
	int input;
	int sum=0;
	for(int i=0;i<5;i++){
		cin >> input;
		if(input < 40)input = 40;
		sum += input;
	}
	cout << sum / 5 << endl;
	return 0;
}

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

int main () {
    int n, c, k;
    int data[100001];
    scanf("%d%d%d", &n, &c, &k);
    
    for (int i = 0; i < n; i++) {
        scanf("%d", data + i);
    }
    
    int buscount = 0;
    sort (data, data + n);
    for (int i = 0; i < n; i++) {
        buscount++;
        int dtime = data[i] + k;
        int passenger = 1;
        i++;
        while (passenger < c && data[i] <= dtime && i < n) {
            i++;
            passenger++;
        }
        i--;
    }
    printf("%d", buscount);
}


Measured memory_bytes: 512
while True:
  n = int(raw_input())
  if n == 0: break
  max_n = max_m = -100000
  r = 0

  for i in range(n):
    m = int(raw_input())
    max_n = max(max_n, m)
    r = max(r+m, 0)
    max_m = max(max_m, r)

  if max_n > 0:
    print max_m
  else:
    print max_n

Measured memory_bytes: 4288
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var P = ReadInts();

            for (int i = P.Max(); i > 0; i--)
            {
                var list = P.Select(x => x)
                    .Where(x => x >= i);

                if (list.Count() >= i)
                {
                    WriteLine(i);
                    return;
                }
            }
        }
        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}



Measured memory_bytes: 20408
import std.stdio;
import std.array;
import std.math;
import std.conv;
import std.algorithm;
import std.string;

void main()
{
	foreach(str; stdin.byLine())
	{
		if(str == "") break;
		//auto tmp = str.split(" ").map!(to!int);
		auto tmp = str.split(" ").map!(to!int);
		auto res = tmp[0] + tmp[1];
		res = cast(int)res.to!string.length;
		writeln(res);
	}
}

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

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef set<int> si;
typedef set<ll> sll;
typedef map<int, int> mii;
typedef map<int, ll> mil;
typedef map<ll, int> mli;
typedef map<ll, ll> mll;

const double pi = acos(-1.0);
const long long INF = 2e18;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define in insert
#define endl "\n"
#define sqr(a)((a) *(a))
#define jor(a) !(a & 1)	// jor means EVEN number
#define bjor(a)(a & 1)	// bjor means ODD number
#define all(a) a.begin(), a.end()
#define mem(arr, b) memset(arr, b, sizeof(arr))	//memset only for -1 and 0
//fill(a, a+n, 5)	//fill for any value
#define for0(i, b) for (int i = 0; i < (b); i++)
#define for1(i, b) for (int i = 1; i <= (b); i++)
#define forab(i, a, b) for (int i = (a); i <= (b); i++)
#define forba(i, b, a) for (int i = (b); i >= (a); i--)
#define rep(i, a, b, c) for (int i = (a); i != (b); i += (c))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define fileRead freopen("input.txt", "r", stdin);

void print(int a[], int n)
{
	// for testing or debugging
	for (int i = 0; i < n; i++) cout << a[i] << " ";
	cout << endl;
}

//______________________________________________________\\

int main()
{
    IOS;
    //fileRead;
    int a[5];
    int indx;
    for0(i,5) {
        cin>>a[i];
        if(!a[i]) indx=i;
    }
    cout<<indx+1;
}


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

 public class Main{
// taking inputs
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
static long[] f;
static long mod=(long)1e9+7;
//......................................@uthor_Alx..............................................
  static int f(char[][] c){
  	int res=0;
  	 for(int i=0;i<c.length;i++){
  	 	for(int j=0;j<c[0].length;j++){
  	 		if(c[i][j]=='#'){
  	 			res++;
  	 		}
  	 	}
  	 }
  	 return res;
  }
  static void do1(int h,int w, char[][] c1, char[][] c) throws  IOException{
  		for(int i=0;i<h;i++){
  			for(int j=0;j<w;j++){
  				c1[i][j]=c[i][j];
  			}
  		}
  }
   public static void main(String[] args) throws  IOException{
	        		  assign();
	        		  	int[] x=int_arr();
	        		  	
	        		  	
	        		  	int res=0;
	        		  	int h=x[0],w=x[1],k=x[2];
	        		  	char[][] c=new char[h][w];
	        		  	for(int i=0;i<h;i++){
	        		  		c[i]=read().toCharArray();
	        		  	}
	        		  	for(int i=0;i<(1<<h);i++){
	        		  		for(int j=0;j<(1<<w);j++){
	        		  			char[][] c1=new char[h][w];
	        		  			do1(h,w,c1,c);
	        		  			for(int b=0;b<h;b++){
	        		  				if((i&1<<b)!=0){
	        		  					Arrays.fill(c1[b],'.');
	        		  				}
	        		  			}
	        		  			for(int b=0;b<w;b++){
	        		  				if((j&1<<b)!=0){
	        		  					for(int cc=0;cc<h;cc++){
	        		  						c1[cc][b]='.';
	        		  					}
	        		  				}
	        		  			}
	        		  			if(f(c1)==k){
	        		  				res++;
	        		  			}

	        		  		}
	        		  	}
	        		  	out.write(res+"");
                      	out.flush();
	        		 
	}
}

	       

	       


Measured memory_bytes: 40024
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        BigInteger power = BigInteger.ONE;
        Scanner scanner = new Scanner(System.in);
        BigInteger amount = scanner.nextBigInteger();
        BigInteger v = BigInteger.valueOf(1000000007L);
        for (BigInteger i = power; i.compareTo(amount) < 1 ; i = i.add(BigInteger.ONE)) {
            power = power.multiply(i).mod(v);
        }
        System.out.println(power.remainder(v));
    }
}

Measured memory_bytes: 40560
while True :
    score = input()
    if score == "0" :
        break
    
    score_a = score.count("A")
    score_b = score.count("B")
    if score[0] == "A" :
        score_a -= 1
    elif score[0] == "B" :
        score_b -= 1
    if score_a > score_b :
        score_a += 1
    else :
        score_b += 1
    print(score_a, score_b)


Measured memory_bytes: 5556
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k;cin>>n>>k;
  vector<ll>h(n);
  rep(i,n)cin>>h[i];
  sort(all(h),greater<ll>());
  rep(i,min(k,n))h[i]=0;
  ll cnt=0;
  rep(i,n)cnt+=h[i];
  cout<<cnt<<endl;
  

  return 0;

}


Measured memory_bytes: 1792
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
lst1 = list(map(int,readline().split()))
res = 0
for i in lst1:
    res = res^i
ans = []
for i in lst1:
    ans.append(res^i)
print(*ans)

Measured memory_bytes: 110992
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n%1000==0)
    {
        cout<<"0"<<endl;
    }
    else
    {
        cout<<(1000-n%1000)<<endl;
    }
    return 0;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main{
  public static void main(String[] args){
    int a=0,b=0,n=0;
    Scanner scan = new Scanner(System.in);
    n = scan.nextInt();
    a = scan.nextInt();
    b = scan.nextInt();

    int kotae1 = a * n;
    int kotae2 = b;


    if(kotae1 >= kotae2){
      System.out.println(kotae2);
    } else if(kotae1 < kotae2){
      System.out.println(kotae1);
    }
  }
}

Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <stdio.h>
using namespace std;
#define ll long long


int main() {
	int n, d, ans;
	cin >> n >> d;
	for (ans = 1;; ans++) {
		if (ans * (2 * d + 1) >= n)break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  	int a,b;
  	cin >> a >> b;
  	if(a>12)
      	cout << b << endl;
  	else if(a>5)
      	cout << b/2 << endl;
    else
      	cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
object Main extends App {
	import scala.math._
	val Array(t1, t2) = scala.io.StdIn.readLine.split(" ")
	val n = t1.toInt
	val x = t2.toLong

	val a = scala.io.StdIn.readLine.split(" ").map(_.toLong).sorted

	if(n==1){
		println(abs(a(0) - x))
	}else{
		val s = new Array[Long](n)
		s(0) = a.map(z => abs(z - x)).min
		for(i<-1 until n){
			s(i) = a(i) - a(i-1)
		}

		if(n == 2){
			println(gcd(s(0), s(1)))
		}else{
			var elm = gcd(s(0), s(1))
			for(i<-2 until n){
				elm = gcd(elm, s(i))
			}
			println(elm)
		}
	}

	def gcd(x: Long, y: Long) : Long = {
		if(y == 0L) return x
		else gcd(y, x%y)
	}

}

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

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

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

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

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

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

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

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



void solve() {
  ll X, Y; cin >> X >> Y;
  if((X+Y)%3){
    cout << 0 << endl;
    return;
  }
  ll n = (2*Y - X)/3;
  ll m = (2*X - Y)/3;
  
  modint res = comb(m+n, n);
  
  cout << res << endl;
}

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


Measured memory_bytes: 16640
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
using namespace std;
#define rep(i, j) for(int i = 0; i < j; i++)
#define f(i, k, j) for(int i = k; i < j; i++)
#define P pair<int, int>
const int INF = (1 << 26);
const int MAX_N = 31;
long long int dp[MAX_N];

void solve(){
    memset(dp, 0, sizeof(dp));
    dp[1] = 1; dp[2] = 2; dp[3] = 4;
    for(int i = 4; i < MAX_N; i++){
        dp[i] = dp[i - 3] + dp[i - 2] + dp[i - 1];
    }
}

int main(){
    solve();
    int n;
    while(cin >>n && n != 0){
        int ans = dp[n] / 3650;
        if(dp[n] % 3650 != 0) ans++;
        cout <<ans <<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#define M 39999
T[M],t[M];main(i,j,k,L,r){
for(i=2;i<M;i++)if(!T[i])for(j=i*2;j<M;j+=i)T[j]=1;
for(i=2,j=0;i<M;i++)if(!T[i])t[j++]=i;
for(;scanf("%d",&L),L;printf("%d\n",r))for(r=i=0;t[i]<L;i++)for(j=i;;j++){
	k=L-t[i]-t[j];
	if(k<t[j])break;
	if(!T[k]&&t[j]-t[i]<k&&k<t[j]+t[i])r++;
}exit(0);}

Measured memory_bytes: 768
//Dragon_warrior7(IITK)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define deb(x) cout << #x << " " << x << "\n"
#define pll pair<ll, ll> 
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}

void print(vector<ll> v)
{
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << " ";
}
ll n,m,a,b,c,t,temp,x,y;
string str;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>t>>x;
	cout<<fixed<<setprecision(10)<<(float)t/x;
	
	
	
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define modul 1000000007
//no of ways to reach ith row and jth column
int dp[1001][1001];


int32_t main()
{
	int H, W;
	cin >> H >> W;
	char arr[H][W];
	for(int i=0; i<H;i++ ){
		for(int j=0;j<W;j++){
			cin >> arr[i][j];			 
		}
	}

	//trivial case
	for(int i=0;i<1001;i++)
	{
		dp[0][i]=0;
		dp[i][0]=0;
	}

	//base case
	int flag=0;
	for(int i=0;i<H;i++)
	{
		if(arr[i][0]=='#')
			flag=1;
		if(flag)
			dp[i+1][1]=0;
		else
			dp[i+1][1]=1;
	}

	flag=0;
	for(int i=0;i<W;i++)
	{
		if(arr[0][i]=='#')
			flag=1;
		if(flag)
			dp[1][i+1]=0;
		else
			dp[1][i+1]=1;
	}

	for(int i=2;i<=H;i++)
	{
		for(int j=2;j<=W;j++)
		{
			if(arr[(i-1)-1][j-1]=='#' && arr[i-1][(j-1)-1]=='#')
				dp[i][j] = 0;
			else if(arr[(i-1)-1][j-1]=='#' || arr[i-1][(j-1)-1]=='#')
			{
				if(arr[(i-1)-1][j-1]=='#')
					dp[i][j] = dp[i][j-1]; 
				if(arr[i-1][(j-1)-1]=='#')
					dp[i][j] = dp[i-1][j];
			}
			else
				dp[i][j] = (dp[i-1][j]%modul + dp[i][j-1]%modul);
		}
	}


	cout << dp[H][W]%modul;



	return 0;
}

Measured memory_bytes: 8404
o =0
t1 = list(map(int,input().split()))
t2 = list(map(int,input().split()))
t3 = list(map(int,input().split()))
o = sum(t1)+sum(t2)+sum(t3)
if o%3 >0:
  print('No')
elif (t1[0]-t1[1]==t2[0]-t2[1]==t3[0]-t3[1] and t1[2]-t1[1]==t2[2]-t2[1]==t3[2]-t3[1] and t1[0]-t2[0]==t1[1]-t2[1]==t1[2]-t2[2] and t1[0]-t3[0]==t1[1]-t3[1]==t1[2]-t3[2]):
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3064
#include <stdio.h>

int table[105][105];

int main(void) {
	int i, j, n, q;
	int id, t;
	char buff[1024];
	
	scanf("%d\n", &n);
	for(i=0;i<=n;i++) {
		for(j=0;j<=n;j++) {
			table[i][j] = 0;
		}
	}
	
	for(i=0;i<n;i++) {
		scanf("%d %d", &id, &q);
		for(j=0;j<q;j++) {
			scanf("%d", &t);
			table[id][t] = 1;
		}
		gets(buff);
	}
	
	for(i=1;i<=n;i++) {
		for(j=1;j<=n;j++) {
			printf("%d", table[i][j]);
			if(j<n) {
				printf(" ");
			} else {
				printf("\n");
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define ll long long
#define bit(x,i) (x&(1<<i))
#define pi 3.1415926535897932384626
#define pb push_back
#define pf push_front
#define mt make_tuple
#define ff first
#define ss second
#define debug(x) cout << #x " = " << (x) << endl
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define endl '\n'
#define EPS 1e-9
#define INF 1e18
#define ALL(x) for(int i=0; i<x; i++)
#define fori(a,b,c) for(int a=b; a<c; a++)
#define PRESENT(c,x) ((c).find(x) != (c).end())
#define m0(x) memset((x), 0, sizeof(x))
#define m1(x) memset((x), -1, sizeof(x))

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef __gnu_pbds::tree<int, __gnu_pbds::null_type, std::less<int>, __gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update> indexed_set;

inline int mod(int n){ return (n%1000000007); }

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

int fpow(int x, unsigned int y, int p){ 
    int res = 1;
    x = x % p;
    while (y > 0){
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
} 
const int maxn = 1e5+10;

int32_t main(){
	DESYNC;
    vector<int> arr(5);

    for(int i=0; i<5; i++){
        cin>>arr[i];
        if(!arr[i]) cout<<i+1<<endl;
    }
    
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
#define Pll pair<ll,ll>

template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

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

int main(void){
	int N;
	string S,T;

	cin>>N;
	cin>>S>>T;
	
	RREP(i,N+1){
		if(S.substr(N-i,i)==T.substr(0,i)){
			print(2*N-i);
			return 0;
		}
	}
	print(2*N);
	return 0;
}


Measured memory_bytes: 256
n, k = gets.chomp.split(' ').map(&:to_i)
a = gets.chomp.split(' ').map(&:to_i).sort

M = (1e9+7).to_i

if a.any? { |i| i > 0 } || k % 2 == 0

  b = []
  (0...(k / 2)).each do |m|
    if a[0] * a[1] >= a[-2] * a[-1]
      b.append(a.shift(2))
    else
      b.append(a.pop(2))
    end
  end
  if k % 2 == 1
    b.append(a.pop)
  end

  b.flatten!

  answer = 1
  b.each do |i|
    answer *= i
    answer %= M
  end
  puts answer
else
  answer = 1
  a[(n - k)...n].each do |i|
    answer *= i
    answer %= M
  end
  puts answer
end


Measured memory_bytes: 37124
#include<bits/stdc++.h>
using namespace std;
int n,ans,m,k,max1[2000020],max2[2000020],a[2000020];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&a[i]);
		max1[i]=max(max1[i-1],a[i]);
	}
	for(int i=n;i>=1;i--){
		max2[i]=max(max2[i+1],a[i]);
	}
	for(int i=1;i<=n;i++){
		printf("%d\n",max(max1[i-1],max2[i+1]));
	}
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A+B < C+D) {
    cout << "Right" << endl;
  }
  else if (A+B == C+D) {
    cout << "Balanced" << endl;
  }
  else if (A+B > C+D) {
    cout << "Left" << endl;
  }
  return 0;
}

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


int main(){
    char str[100100];
    list<char> S;
    scanf("%s",str);
    int i = 0;
    rep(i,strlen(str)){
        S.push_back(str[i]);
    }
    int Q,T,F,RevC=1;
    char C;
    cin >> Q;
    rep(i,Q){
        cin >> T;
        if (T == 1){
           RevC *=-1;
        } 
        else{
            cin >> F >> C;
            if (F == 1){
                if (RevC ==1) S.push_front(C);
                if (RevC ==-1) S.push_back(C);
            }
            else{
                if (RevC ==1) S.push_back(C);
                if (RevC ==-1) S.push_front(C);
            }
        }
    }
    if(RevC== -1){
        S.reverse();
    }
    for (const auto& e : S){
        cout <<e;
    }
    cout <<endl;
    return 0;
}


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

typedef long long ll;
const ll INF=1000000000000000000;

int main(){
	int n;
	int a[100010];
	scanf("%d",&n);
	for(int i=0;i<=n;i++)scanf("%d",&a[i]);
	
	ll CNT=1;
	bool ok=true;
	for(int i=0;i<=n;i++){
		CNT-=a[i];
		if(CNT<0){
			ok=false;
			break;
		}
		CNT*=2;
		CNT=min(CNT,INF);
	}
	if(!ok){
		puts("-1");
		return 0;
	}
	
	ll ret=0;
	ll MAX[100010];
	MAX[0]=1;
	for(int i=1;i<=n;i++){
		MAX[i]=(MAX[i-1]-a[i-1])*2;
		MAX[i]=min(MAX[i],INF);
	}
	ll sum=0;
	for(int i=n;i>=0;i--){
		sum+=a[i];
		ret+=min(MAX[i],sum);
	}
	cout<<ret<<endl;
}

Measured memory_bytes: 4820
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main  {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		//int t = sc.nextInt();
		List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();

		for(int i=0;list.size()-1>i;i++) {
			if(list.get(i).equals(list.get(i+1))){
				System.out.println("Bad");
				System.exit(0);
			}
		}
		System.out.println("Good");
	}

}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; i++)
const long long MOD = 1000000007;

int main(){
    int N; cin >> N;
    vector<ll> a(N); rep(i,N) cin >> a[i];
    int ans = 0;
    rep(i,N){
        if(a[i] % 2 == 0){
            while(a[i]%2 == 0){
                a[i] /= 2;
                ans++;
            }
        }
    }
    cout << ans << endl;
}

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

int main() {

  int N;
  cin >> N;

  vector<int> A(N);
  vector<int> B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    B[i] = A[i] - (i + 1);
  }

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

  long long answer = 0;

  int d_ = 0;

  d_ = N / 2;

  for (int i = 0; i < N; i++) {
    answer += abs(A[i] - (B[d_] + i + 1));
  }

  cout << answer << endl;

  return 0;

}

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

using namespace std;

vector<int> v;
void go(){
	for(int i = 2; i < 1000; ++i){
		bool ok = true;
		for(int j = 2; j*j <= i; ++j){
			if(i%j==0){
				ok = false; break;
			}
		}
		if(ok) v.push_back(i);
	}
}


int main(){
	int n; cin >> n;
	int a[n]; cin >> a[0]; int t = a[0];
	for(int i = 1; i < n; ++i){
		cin >> a[i]; t = __gcd(t, a[i]);
	}
	if(t != 1){
		cout << "not coprime";
		return 0;
	}
	go();
	vector<bool> check(1e6 + 1);
	bool ok = true;
	for(int i : a){
		if(!ok) break;
		for(int &j : v){
			if(j*j > i) break;
			if(i%j==0){
				if(check[j]){
					ok = false;
					break;
				} 
				check[j] = 1;
				while(i%j==0) i/=j;
			}
		}
		if(i>1){
			if(check[i]){
				ok = false; break;
			}
			check[i] = 1;
		}
	}
	if(ok) cout << "pairwise coprime";
	else cout << "setwise coprime";
}

Measured memory_bytes: 7592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main() {
    int N; cin >> N;
    map<string,int> mp;
    int sum = 0;
    REP(i,N) {
        string s; int a;
        cin >> s >> a;
        sum += a;
        mp[s] = sum;
    }
    for(auto &p:mp) {
        p.second = sum - p.second;
    }
    string t; cin >> t;
    cout << mp[t] << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int> > Matrix;

static const int MOD = 1000000007;

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> broken(n+1);
  rep(i, m){
    int a;
    cin >> a;
    broken[a] = 1;
  } 
  vector<int> dp(n+2);
  dp[n] = 1;
  for (int i = n-1; i >= 0; i--){
    if (broken[i]){
      dp[i] = 0;
      continue;
    }
    dp[i] = (dp[i+1] + dp[i+2]) % MOD;
  }

  cout << dp[0] << endl;
  return 0;

  
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <deque>
using namespace std;
using P = pair<int,int>;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){ 
  ll n; cin >> n;
  ll ans = 1e18;
  for(ll i= 1; i*i <= n; i++){
    if(n%i != 0)continue;
    ll j = n/i;
    ans = min(ans,i+j-2);
  } 
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;

int main(){
  int n;
  cin >> n;
  long long dp[n];
  vector<int> h(n);
  for(int i = 0; i < n; i++){
    cin >> h[i];
  }
  for(int i = 0; i < n; i++){
    dp[i] = INF;
  }
  dp[0] = 0;
  for(int i = 1; i < n; i++){
    dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
    if(i > 1)
      dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
  }
  cout << dp[n - 1] << endl;
}

Measured memory_bytes: 4584
package main

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

var (
	scanner = bufio.NewScanner(os.Stdin)
	w       = bufio.NewWriter(os.Stdout)
)

func readInt() (read int) {
	scanner.Scan()
	read, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return
}

func dfs(A []int) {
	if len(A) == n+1 {
		cnt := 0
		for i := 0; i < q; i++ {
			if A[b[i]]-A[a[i]] == c[i] {
				cnt += d[i]
			}
		}
		ans = int(math.Max(float64(ans), float64(cnt)))
		return
	}

	for l := A[len(A)-1]; l <= m; l++ {
		dfs(append(A, l))
	}
}

var n, m, q int
var ans int
var a, b, c, d []int

func main() {
	scanner.Split(bufio.ScanWords)
	defer w.Flush()

	n = readInt()
	m = readInt()
	q = readInt()

	for i := 0; i < q; i++ {
		a = append(a, readInt())
		b = append(b, readInt())
		c = append(c, readInt())
		d = append(d, readInt())
	}
	dfs([]int{1})

	fmt.Println(ans)
}

Measured memory_bytes: 5016
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


const int MOD = 998244353;


long long modpow(long long x, long long n, long long mod) {
    if (n == 0) return 1;
    long long res = modpow(x * x % mod, n / 2, mod);
    if (n & 1) res = res * x % mod;
    return res; 
}


void solve() {
    int N, S; cin >> N >> S;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    vector<vector<long long>> dp(N, vector<long long>(S+1));

    dp[0][0] = 1;
    if (A[0] <= S) dp[0][A[0]] = 1;

    for (int i = 1; i < N; i++) {
        for (int j = 0; j <= S; j++) {
            if (j - A[i] == 0) {
                dp[i][j] += modpow(2, i, MOD);
                dp[i][j] %= MOD;
            }
            if (j - A[i] > 0) {
                dp[i][j] += dp[i-1][j-A[i]];
                dp[i][j] %= MOD;
            }
            dp[i][j] += dp[i-1][j] * 2;
            dp[i][j] %= MOD;
        }
    }

    // for (int i = 0; i < N; i++) {
    //     for (int j = 0; j < S+1; j++) {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    cout << dp[N-1][S] << endl;
}


int main() {
    solve();
    return 0;
}


Measured memory_bytes: 73724
#include <iostream>

using namespace std;

int main()
{
    long long n, W, w[105], v[105];
    cin>>n>>W;
    for(int i=0; i<n; i++){
      cin>>w[i]>>v[i];
    }
       long long dp[n+1][W+1];
       for(int i=0; i<=W; i++){
         dp[0][i]=0;
       }
       for(int i=0; i<=n; i++){
           for(int j=0; j<=W; j++){
               if((i==0)||(j==0)){
                   dp[i][j]=0;
               }else if(w[i-1]<=j){
                     dp[i][j]=max(dp[i-1][j-w[i-1]]+v[i-1], dp[i-1][j]);
                     //cout<<dp[i-1][j-w[i-1]]+v[i-1]<<'\n';
               }else{
                     dp[i][j]=dp[i-1][j];
                   }
           }
       }
// for(int i=0; i<=n; i++){
//   for(int j=0; j<=W; j++){
//     cout<<dp[i][j]<<" ";
//   }
//   cout<<'\n';
// }
       cout<<dp[n][W];
    return 0;
}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int last = s.size()-1;
  if(s.at(last) == 's') {
    s = s + "es";
  } else {
    s = s + "s";
  }
  cout << s << endl;
}

Measured memory_bytes: 3624
package main

import "fmt"

func main() {
	var A, B int
	fmt.Scan(&A, &B)
	// 1009までなので普通に全探索でもOK
	for i := 1; i <= 1009; i++ {
		if int(float64(i)*0.08) == A && int(float64(i)*0.1) == B {
			fmt.Println(i)
			return
		}
	}
	fmt.Println(-1)
}


Measured memory_bytes: 512
use proconio::input;

fn main() {
        input!{
                h1: i32,
                m1: i32,
                h2: i32,
                m2: i32,
                k:  i32,
        }

        let t1 = 60 * h1 + m1;
        let t2 = 60 * h2 + m2;

        let ans = if t1 < t2 {
                t2 - t1
        } else {
                60*24 + t2 - t1
        } - k;
        println!("{}", ans);
}

Measured memory_bytes: 2136
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main (void) {

  int n, a[201], j = 0, ans = 0;

  cin >> n;

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

  while (1) {
    for (int i = 0; i < n; i++) {
      if (a[i]%2 == 1) {
	j = 1;
	break;
      }
      a[i] /= 2;
    }
    if (j == 1)
      break;
    ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
a, b, c, d = map(int, input().split())

ans = -float("INF")  # 答えがマイナスになることがあるので、負の無限大を初期値にしておきます

for x in (a, b):
    for y in (c, d):
        ans = max(ans, x * y)

print(ans)

Measured memory_bytes: 9028
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

void dfs(int cur, int prev, vector<vector<int>> &graph, vector<int> &cnt, vector<int> &ans) {
    ans[cur] += cnt[cur];
    for (int next : graph[cur]) {
        if (next == prev) continue;
        ans[next] = ans[cur];
        dfs(next, cur, graph, cnt, ans);
    }
}

int main() {
    int n, q;
    cin >> n >> q;
    vector<vector<int>> graph(n);
    for (int i = 0; i < n - 1; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }
    vector<int> cnt(n);
    while (q--) {
        int p, x;
        cin >> p >> x;
        p--;
        cnt[p] += x;
    }
    vector<int> ans(n);
    dfs(0, -1, graph, cnt, ans);
    for (int x : ans) cout << x << " ";
    cout << endl;

    return 0;
}


Measured memory_bytes: 30464