akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class D { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long A = GetLong();
		long B = GetLong();
		WriteLine((A == 0) ? g(B) : g(A - 1) ^ g(B));
	}

	private long g(long x)
	{
		switch(x % 4)
		{
			case 0:
				return x;

			case 1:
				return 1;

			case 2:
				return x + 1;

			case 3:
				return 0;

			default:
				return -1;
		}
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 11092
#include <stdio.h>
	int main(){
		int input,suu[101]={0},i,max=0;
		while(scanf("%d",&input)!=EOF){
			suu[input]++;
			if(max<=suu[input]) max=suu[input];
		}
		for(i=1;i<101;i++){
			if(max==suu[i]){
				printf("%d\n",i);
			}
		}
	return 0;
}

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

string solve(vector<int>&v,int k){

	bool dp[k+1];
	memset(dp,0,sizeof dp);
	for(int i=1;i<=k;i++){
		for(int move: v){
           if(move >i)continue;
           if(dp[i-move]==0){
           	dp[i]=1;
           }
		}
	}
	return (dp[k])? "First" : "Second";


}

int main(){
int n,k;
cin>>n>>k;
vector<int>v(n);
for(int i=0;i<n;i++){
	cin>>v[i];
}
cout<<solve(v,k)<<endl;
return 0;

}


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

int main() {
	long long X;
	cin >>X;
	long long A,B;
	for(long long i=1;i<300;i++){
		for(long long j=0;j<i;j++){
			if(i*i*i*i*i-j*j*j*j*j==X){
				B=j;
				A=i;
				break;
			}
			if(i*i*i*i*i+j*j*j*j*j==X){
				B=j*(-1);
				A=i;
				break;
			}
			
		}
	}
	cout <<A<<" "<<B;
}

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

int main() {
    int X;
    cin >> X;
  
    if (X >= 30 && X <= 40) {
      cout << "Yes" << endl;
    }
  
    if (X >= -40 && X < 30) {
      cout << "No" << endl;
    }
  
}

Measured memory_bytes: 3612
fun main(args: Array<String>) {
    val (N, A, B) = readLine()!!.split(" ").map { it.toInt() }
    var sum = 0
    for (i in 1..N) {
        var t = 0
        for (c in i.toString()) {
            t += c.toString().toInt()
        }
        if (t >= A && t <= B) sum += i
    }
    println(sum)
}


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

int main() {
  long n,a,b,c,d,e;
  cin>>n>>a>>b>>c>>d>>e;
  long buntai = ceil((double)n/min(min(min(a,b),min(c,d)),e));
  cout<<buntai+4;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

    int ans = 800 * n - n / 15 * 200;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct node{
  int key;
  node *left,*right,*p;
  node(){}
  node(int key):key(key){left=right=p=NULL;};
};
node *root;
void insert(node z){
  node *y=NULL;
  node *x=root;
  while(x!=NULL){
    y=x;
    if(z.key<x->key) x=x->left;
    else x=x->right;
  }
  z.p=y;
  if(y==NULL) root=new node(z);
  else if(z.key<y->key) y->left=new node(z);
  else y->right=new node(z);
}
bool find(int z){
  node *x=root;
  while(x!=NULL){
    if(z==x->key) return true;
    if(z<x->key) x=x->left;
    else x=x->right;
  }
  return false;
}
node *nxt(node *x){
  if(x->left!=NULL) return nxt(x->left);
  return x;
}
void del(node *x){
  //cout<<x->key<<endl;
  node *y=x->p;
  if(x->left==NULL&&x->right==NULL){
    if(y!=NULL&&y->left==x) y->left=NULL;
    if(y!=NULL&&y->right==x) y->right=NULL;
    delete(x);
    return;
  }
  if(x->left==NULL&&x->right!=NULL){
    if(y!=NULL&&y->left==x) y->left=x->right;
    if(y!=NULL&&y->right==x) y->right=x->right;
    x->right->p=y;
    delete(x);
    return;
  }
  if(x->left!=NULL&&x->right==NULL){
    if(y!=NULL&&y->left==x) y->left=x->left;
    if(y!=NULL&&y->right==x) y->right=x->left;
    x->left->p=y;
    delete(x);
    return;
  }
  node *z=nxt(x->right);
  x->key=z->key;
  del(z);
}
void del(int k){
  node *x=root;
  while(x!=NULL){
    if(k==x->key) break;
    if(k<x->key) x=x->left;
    else x=x->right;
  }
  //cout<<k<<" "<<x->key<<endl;
  del(x);
}
void inorderTreeWalk(node *v){
  if(v==NULL) return;
  inorderTreeWalk(v->left);
  cout<<" "<<v->key;
  inorderTreeWalk(v->right);
}
void preorderTreeWalk(node *v){
  if(v==NULL) return;
  cout<<" "<<v->key;
  preorderTreeWalk(v->left);
  preorderTreeWalk(v->right);
}
signed main(){
  int n;
  cin>>n;
  root=NULL;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    //cout<<(root==NULL?-1:root->key)<<endl;
    if(s=="print"){
      inorderTreeWalk(root);
      cout<<endl;
      preorderTreeWalk(root);
      cout<<endl;
      continue;
    }
    int x;
    cin>>x;
    if(s=="insert"){
      insert(node(x));
    }
    if(s=="find"){
      cout<<(find(x)?"yes":"no")<<endl;
    }
    if(s=="delete"){
      del(x);
    }
  }
  return 0;
}

Measured memory_bytes: 21900
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int[][] matrix = new int[H+2][W+2];
        for(int j=0;j<=W+1;j++) matrix[0][j] = 0;
        for(int row = 1;row<=H;row++){
            matrix[row][0]=0;
            String cur = sc.next();
            for(int col=1;col<=W;col++){
                char c = cur.charAt(col-1);
                if(c=='#') matrix[row][col]=1;
                else matrix[row][col]=0;
            }
            matrix[row][W+1]=0;
        }
        for(int j=0;j<=W+1;j++) matrix[H+1][j] = 0;
        for(int row=1;row<=H;row++){
            for(int col=1;col<=W;col++){
                if(matrix[row][col]==0) continue;
                int cur = matrix[row][col-1]|matrix[row][col+1]|matrix[row-1][col]|matrix[row+1][col];
                if(cur==0){
                    System.out.println("No");
                    System.exit(0);
                }
            }
        }
        System.out.println("Yes");

    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
std::vector<int> num;
std::vector<std::vector<int> > mapx;
int tmp,n,fg;
std::string ans="No";

void solve(){
        rep(i,n){
                fg=1;
                rep(j,3){
                        rep(k,3){
                                if(num.at(i)==mapx.at(j).at(k)) {
                                        mapx.at(j).at(k) = 0;
                                        fg=0;
                                }
                                if(fg==0) break;
                        }
                        if(fg==0) break;
                }
        }


        rep(i,3){
                rep(j,3){
                        if(mapx.at(i).at(j)!=0) {
                                break;
                        }
                        if(j==2) {
                                ans="Yes";
                        }
                }
        }

        rep(i,3){
                rep(j,3){
                        if(mapx.at(j).at(i)!=0) {
                                break;
                        }
                        if(j==2) {
                                ans="Yes";
                        }
                }
        }

        rep(i,3){
                if(mapx.at(i).at(i)!=0) {
                        break;
                }
                if(i==2) {
                        ans="Yes";
                }
        }


        if(mapx.at(0).at(2)==0&&mapx.at(1).at(1)==0&&mapx.at(2).at(0)==0) {
                ans="Yes";
        }

        cout<<ans<<endl;

}

int main(){
        rep(i,3){
                mapx.push_back(vector<int>());
                rep(j,3){
                        cin>>tmp;
                        mapx.at(i).push_back(tmp);
                }
        }
        cin>>n;
        rep(i,n){
                cin>>tmp;
                num.push_back(tmp);
        }

        solve();
        return 0;
}


Measured memory_bytes: 256
n = gets.to_i
arr = gets.split.map(&:to_i).sort_by{|i| -i}

count = n - 2
sum = arr[0]
(1..n).each do |i|
  if count == 0
    puts sum
    return
  elsif count == 1
    puts sum + arr[i]
    return
  end
  
  count -= 2
  sum += 2 * arr[i]
end



Measured memory_bytes: 34180
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 998244353
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 100000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int x;
    cin>>x;
    for(int i=-300;i<=300;i++){
        for(int j=i+1;j<=300;j++){
            if(j*j*j*j*j-i*i*i*i*i==x){
                cout<<j<<" "<<i;
                return 0;
            }
            if(j*j*j*j*j-i*i*i*i*i==-x){
                cout<<i<<" "<<j;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF (1e9)
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

void Main(){

  int N;
  ll A,B;
  ll ct=0;
  cin>>N>>A>>B;
  vector<ll> x;
  rep(i,N){
    ll aa;
    cin>>aa;
    x.emplace_back(aa);
  }
  reps(i,1,N){
    ct+=min(B,A*(x[i]-x[i-1]));
  }

  cout << ct <<"\n";

}
//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 1400
n = int(input())
max=0
d={}
m=[]
for i in range(n):
    k=input()
    if k in d:
        d[k]+=1
    else:
        d[k]=1
for e in d:
    if max<d[e]:
        max=d[e]
for e in d:
    if d[e]==max:
        m.append(e)
m.sort()        
for e in m:
    print(e)

Measured memory_bytes: 32220
#include<stdio.h>
#include<string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if(ch=='A') return 1;
  else if(ch=='C') return 2;
  else if(ch=='G') return 3;
  else if(ch=='T') return 4;
  else return 0;
}

long long getkey(char *str){
  long long sum=0,p=1,i;
  for(i=0;i<strlen(str);i++){
    sum+=p*(getChar(str[i]));
    p*=5;
  }
  return  sum;
}

int h1(int key){
  return key%M;
}
int h2(int key){
  return 1+(key%(M-1));
}

int find(char *str){
  long long key,i,h;
  key = getkey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0) return 1;
    else if(strlen(H[h])==0) return 0;
  }
  return 0;
}

int insert(char *str){
  long long key,i,h;
  key = getkey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0) return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i,n,h;
  char str[L],com[9];

  for(i=0;i<n;i++) H[i][0]='\0';

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",com,str);

    if(com[0]=='i'){
      insert(str);
    }else{
      if(find(str)){
        printf("yes\n");
      }else{
        printf("no\n");
      }
    }
  }
  return 0;
}


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

int main(void) {
	long n, m;
	cin >> n >> m;
	long ans;
	if (n > m / 2) ans = m / 2;
	else {
		ans = n;
		long r;
		r = m - 2 * n;
		ans += r / 4;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    ll sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    ll dx=abs(sx-tx),dy=abs(sy-ty);
    rep(i,dx) cout<<'R';
    rep(i,dy) cout<<'U';
    rep(i,dx) cout<<'L';
    rep(i,dy+1) cout<<'D';
    rep(i,dx+1) cout<<'R';
    rep(i,dy+1) cout<<'U';
    cout<<"LU";
    rep(i,dx+1) cout<<'L';
    rep(i,dy+1) cout<<'D';
    cout<<'R'<<endl;
    return 0;
}

Measured memory_bytes: 256
from bisect import bisect_right, bisect_left
N = int(input())
L = [int(_) for _ in input().split()]
ans = 0
L.sort()

for n in range(N - 1, -1, -1):
    for m in range(n - 1, -1, -1):
        ans += bisect_left(L, L[n] + L[m]) - n - 1

print(ans)

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int C[51];
    int n, r; //カードの枚数、シャッフル回数
    int p, c; //山の一番上からp枚目の札から連続したc枚の札を抜き山の上にそのまま置く
    while(true){
        cin >> n >> r;
        if(n + r == 0) break;

        //山全体の構成
        for(int i = 0; i < n; i++){
            C[i] = n - i;
        }
        // for(int i = 0 ; i < n; i++){
        //     cout << C[i] << endl;
        // }


        for(int i = 1; i <= r; i++){
            cin >> p >> c;

            //シャッフルする
            rotate(C, C + p - 1, C + p - 1 + c);
            // for(int i = 0; i < n; i++){
            //     cout << C[i] << endl;
            // }  
        }
        cout << C[0] << endl;
    }
}



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

int main(){
    long N,a=0;
    cin>>N;
    vector<long> A(N);
    for(int i=0;i<N;i++){
        cin >>A.at(i);
     }
    sort(A.begin(),A.end());
    a=A.at(0);
    for(int i=1;i<N;i++){
        if(a==A.at(i)){
            cout <<"NO"<<endl;
            exit(0);
        }
        a=A.at(i);
    }
    cout<<"YES"<<endl;

}

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

int main()
{
  string s;
  cin >> s;
  int k = s.size();
  
  int l = 0;
  rep(i, k) if(s[i] == 'x') l++;
  
  if(l <= 7) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    string str;
    cin >> str;
    bool answer = true;
    if(N % 2 != 0){
        cout << "No" << endl;
    }
    if(N % 2 == 0){
        for(int i = 0; i < N/2; i++){
            if(str.at(i) != str.at(N/2 + i)){
              answer = false;
              break;
            }
        }
    if(answer) cout << "Yes" << endl;
    if(answer == false) cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
 
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int K = sc.nextInt();
      int num[] = new int[N];
      for(int i=0;i<N;i++){
        num[i] = sc.nextInt();
      }
      for(int i=K;i<N;i++){
        //System.out.print(num[i-K]+":"+num[i]);
        if(num[i-K]<num[i]){
          System.out.println("Yes");
        }else{
        System.out.println("No");
      	}
      }
  }
}

Measured memory_bytes: 60524
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1'000'000'007;
template <class T> bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T> bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

template <typename T> set<T> factors(T a) {
    set<T> facs;
    for (T i = 1; i * i <= a; ++i) {
        if (a % i == 0) {
            facs.insert(i);
            facs.insert(a / i);
        }
    }
    return facs;
}

int main() {
    int n, m;
    cin >> n >> m;
    auto facs = factors(m);
    int mingcd = *facs.lower_bound(n);
    cout << m / mingcd << endl;
    return 0;
}

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

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	bool f = false;
	rep(i, 101) {
		if ((n - 4 * i) >= 0 && (n - 4 * i) % 7 == 0) {
			// printf("%d\n", i);
			f = true;
		}
	}
	printf("%s\n", f ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int k,a,b,m,n;
    scanf("%d",&k);
    scanf("%d%d",&a,&b);
    if(k==1)printf("OK");
    else if( a%k==0 || b%k==0) 
    printf("OK");
    else if(a/k!=b/k) printf("OK");
    else printf("NG");
    
    
    return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int max_tc=-1e9;
    for(int i=0;i<s.size();i++){
        if(s[i]=='R'){
            int tc=1;
            i++;
            while(i<s.size() && s[i]=='R'){
                tc++;
                i++;
            }
            i--;
            max_tc=max(max_tc,tc);
        }
    }
if(max_tc!=-1e9)
    cout<<max_tc<<endl;
    else
    cout<<0<<endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <math.h>
using namespace std;
const double pi=acos(-1.0);

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int max3(int a,int b,int c) {return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
int min3(int a,int b,int c) {return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

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

int main(void){
    long long n,m,k,x,y,ans,sum;
    cin>>n>>m>>k;
    long long a[200010],b[200010]={0};
    rep(i,n){cin>>a[i+1];}
    rep(i,m){cin>>b[i+1];}
    a[0]=0;b[0]=0;sum=0;
    rep(i,m){sum+=b[i+1];}
    x=0;y=sum;ans=0;
    int j=m;
    for(int i=0;i<=n;++i){
        sum+=a[i];
        
        while(j>0&&sum>k){
            sum=sum-b[j];
            j--;
            
        }
        if(sum>k)break;
        ans=max(ans,i+j);
        if(i==n)break;
        //sum+=a[i];
    }
    cout<<ans<<endl;
    
}


Measured memory_bytes: 6720
using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            long total = long.Parse(ReadLine());
            string input = ReadLine();
            string []array = input.Split(' ');
            long [] n =new  long[array.Length];
            for (long i = 0; i < total; i++) {
                n[i] = long.Parse(array[i]);
            }
            long count = 0;
            long result = 1000000000;

            for (long i = 0; i < total; i++) {
                for (long m = 0; m < result; m++) {
                    if (n[i] % 2 == 0)
                    {
                        n[i] = n[i] / 2;
                        count++;
                    }
                    else {
                        break;
                    }
                    
                    
                }
                if (count<result) {
                    result = count;
                    
                }
                count = 0;
            }
            WriteLine("{0}",result);
            ReadKey();
            
        }
    }
}



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

#define NMAX 1000000
#define QMAX 50000

int main(void){
  int i,j,n,S[NMAX],q,T[QMAX],C=0;
  int l,r,m,key;
  
  scanf("%d", &n);
  if(n>NMAX) exit(1);
  for(i=0;i<n;i++)scanf("%d", &S[i]);

  scanf("%d", &q);
  if(q>QMAX) exit(1);
  for(i=0;i<q;i++)scanf("%d", &T[i]);

  for(i=0;i<q;i++){
    l=0; r=n;
    while(l<r){
      m=(l+r)/2;
      if(S[m]==T[i]){
        C++;
        break;
      } else if(T[i]<S[m]){
        r=m;
      } else {
        l=m+1;
      }
    }
  }
    
  printf("%d\n",C);
  return 0;
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);

    int k,n;
    cin>>k>>n;
    vi a(n);
    rep(i,n){
        cin>>a[i];
    }
    sort(all(a));

    int ans=INF;
    int l=a[0],r=a[n-1];

    FOR(i,1,n){
        ans=min(ans,r-l);
        l=a[i];
        r=k+a[i-1];
    }

    rep(i,n){
        a[i]=k-a[i];
    }

    sort(all(a));

    l=a[0],r=a[n-1];

    FOR(i,1,n){
        ans=min(ans,r-l);
        l=a[i];
        r=k+a[i-1];
    }

    cout<<ans<<endl;


}

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

vector<int>cost[10];
int dp[15][2001];

int main() {
	int n, k; scanf("%d%d", &n, &k);
	rep(i, n) {
		int c, g; scanf("%d%d", &c, &g);
		cost[--g].push_back(c);
	}
	rep(i, 10)sort(cost[i].begin(), cost[i].end(), greater<int>());
	for(int i=1;i<=10;i++){
		for(int j=0;j<=k;j++){
			dp[i][j]=dp[i-1][j];
			int sum=0;
			for(int t=0;t<min(j,(int)cost[i-1].size());t++){
				sum+=cost[i-1][t];
				dp[i][j]=max(dp[i][j],dp[i-1][j-t-1]+sum+t*(t+1));
			}
		}
	}
	printf("%d\n", dp[10][k]);
}

Measured memory_bytes: 3316
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
using namespace std;
signed main()
{
	int n;
	cin>>n;
	int a[n];
	mii mp;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		mp[a[i]]+=1;
	}
	mii ::iterator it;
	int cnt[200005]={0};
	int sum=0;
	for(it=mp.begin();it!=mp.end();it++)
	{
		cnt[it->first]=it->second*(it->second-1)/2;
		sum+=cnt[it->first];
	}
	for(int i=0;i<n;i++)
	{
		int x=sum-cnt[a[i]];
		int temp=mp[a[i]]-1;
		temp=temp*(temp-1)/2;
		x+=temp;
		cout<<x<<endl;
	}
}












Measured memory_bytes: 12672
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>

using namespace std;

int main(){

    int ans=0;

    int n,k;

    cin>>n>>k;

    while(n>0){
        n=n/k;
        ans++;
    }


    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <bitset>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <list>
#include <sstream>

#define ll long long
#define ld long double
#define ull unsigned long long
using namespace std;

const ll mod = 1000000007;
const ll inf = 9223372036854775803;
const int maxN = 300005;

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> H(n+1);
    map<ll, int> m;

    for (int i = 0; i < n; i++) {
        cin >> H[i];
        m[H[i] + i + 1]++;
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ll t = i + 1 - H[i];
        if (t > 1) {
            ans += m[t];
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 18496
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int a, b, cnt=0, n, sm=0;
    cin>>n>>a>>b>>s;
    for(int i=0; i<n; ++i){
      if(s[i]=='a'){
        if(sm<a+b){
          cout<<"Yes"<<endl;
          ++sm;
        }
        else{
          cout<<"No"<<endl;
        }
      }
       else if(s[i]=='b'){
          if(cnt<b&&sm<a+b){
            cout<<"Yes"<<endl;
            ++cnt;
            ++sm;
          }
          else{
            cout<<"No"<<endl;
          }
      }
      else{
        cout<<"No"<<endl;
      }
    }
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, digitDP, treeDP//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vll flag, D; vll path;
//***********//
int main() {
	cin >> H >> W;
	ans = INF;
	for (i = 1; i <= H - 1; i++) {
		ll A = i * W;
		ll B = (H - i) * (W / 2);
		ll C = H * W - A - B;
		ll D = D = max(abs(A - B), max(abs(A - C), abs(B - C)));
		ans = min(ans, D);
		B = ((H - i) / 2) * W;
		C = H * W - A - B;
		D = max(abs(A - B), max(abs(A - C), abs(B - C)));
		ans = min(ans, D);
	}
	for (j = 1; j <= W - 1; j++) {
		ll A = H * j;
		ll B = H / 2 * (W - j);
		ll C = H * W - A - B;
		ll D = D = max(abs(A - B), max(abs(A - C), abs(B - C)));
		ans = min(ans, D);
		B = H * ((W - j) / 2);
		C = H * W - A - B;
		D = max(abs(A - B), max(abs(A - C), abs(B - C)));
		ans = min(ans, D);
	}
	co(ans);
}

Measured memory_bytes: 3584
#include <iostream>
#include <cmath>
typedef unsigned long long int lli; 
#define MOD 1000000007
#define MAX 200002
using namespace std;

lli fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
lli COM(lli n, lli k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    lli num = 1;
    for(int i=0;i<k;i++){
      num = (num*(n-i)%MOD)%MOD;
    }
    num = (num*finv[k])%MOD;
    return num;
}

int main(void){
  lli n,a,b;
  lli total = 1;
  lli count = n;
  COMinit();
  cin >> n >> a >>b;
  int power = (int)log2(n);
  //cout << power << endl;
  int rem = n - pow(2,power);
  while(true){
    lli num = 2;
    for(int i=0;i<power;i++){
      num = (num*num)%MOD;
    }
    total = (total * num)%MOD;
    if(rem <= 0){
      break;
    }
    power = (int)log2(rem);
    rem = rem - pow(2,power);
  }
  //cout << total << endl;
  total = (total + (MOD-1))%MOD;

  lli nca = MOD - COM(n,a);
  lli ncb = MOD - COM(n,b);
  //cout << COM(n,b) << endl;
  total = (total + nca + ncb)%MOD;
  cout << total << endl;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    string s,t;
    cin >> s >> t;
    int res = 0;
    for (int i = 0; i < 3; ++i) {
        if (s[i] == t[i]) res++;
    }
    cout << res << endl;
}

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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, start, end) for(int i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int d, g;
    cin >> d >> g;

    vector<pair<int, int>> nums(d);
    rep(i, d){
        cin >> nums[i].first >> nums[i].second;
    }

    int min_val = INF;
    rep(i, pow(2, d)){
        int sum = 0, cnt = 0, i_copy = i, select[10] = {0};

        rep(j, d){
            int bit = (int)(i_copy & 1);
            sum += bit * ((j + 1) * 100 * nums[j].first + nums[j].second);
            cnt += bit * nums[j].first;
            select[j] = bit;
            i_copy = i_copy >> 1;
        }

        for(int j = d; j > 0; -- j){
            int tmp = nums[j-1].first;
            while(1 - select[j-1] && g - sum > 0 && tmp > 0){
                sum += j * 100 + (tmp == 1) * nums[j-1].second;
                ++ cnt;
                -- tmp;
            }
        }

        if(sum >= g) min_val = min(min_val, cnt);
    }

    cout << min_val << endl;
}

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

using namespace std;
typedef long long ll;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; ll k;
  cin >> n >> k;
  vector<ll> a(n), f(n);
  for(auto &x: a) {
    cin >> x;
  } 
  for(auto &x: f) {
    cin >> x;
  }
  sort(f.begin(), f.end());
  sort(a.begin(), a.end(), greater<ll>());
  ll lo = 0, hi = ll(1e18);
  ll res = 1e18;
  auto can = [&](ll x) {
    ll req = k;
    for(int i = 0; i < n; ++i) {
      ll p = x / f[i];
      req -= max(0LL, a[i] - p);
    }
    return req >= 0;
  };
  while(lo <= hi) {
    ll m = (lo + hi) / 2;
    if(can(m)) {
      res = m;
      hi = m - 1;
    } else {
      lo = m + 1;
    }
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;

typedef pair<int, int> PII;


int main()
{
    int h, w, d, q;
    int i, j, k;
    
    cin >> h >> w >> d;
    
    int a[h][w];
    vector<PII> g(90001);
    int dp[90001] = {0};
    
    for(i = 0; i < h; i++) {
        for(j = 0; j < w; j++) {
            cin >> a[i][j];
            
            g[a[i][j]].first = j;
            g[a[i][j]].second = i;
        }
    }
    
    for(i = d+1; i <= d*2; i++) {
        for(j = i; j <= h*w; j += d) {
            dp[j] = dp[j-d] + abs(g[j-d].first - g[j].first) + abs(g[j-d].second - g[j].second);
        }
    }
    
    cin >> q;
    
    int l[q], r[q];
    int cost[q];
    
    for(k = 0; k < q; k++) {
        cin >> l[k] >> r[k];
        cost[k] = dp[r[k]] - dp[l[k]];
    }
    
    for(k = 0; k < q; k++) {
         cout << cost[k] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define boost ios_base::sync_with_stdio(false), cin.tie(NULL);

using namespace std;
const int N = 1e6 + 44;
const int mod = 1e9 + 7;
const long long INF = 1e18;
const int inf = 1e9 + 44;

long long mx, f[N], a[N], cost;

void upd (int pos, long long x) {
	for (int i = pos ; i < N ; i |= (i + 1)) {
		f[i] = max (f[i], x);
	}
}

long long get (int pos) {
	long long res = 0;
	for (int i = pos ; i >= 0 ; i &= (i + 1), --i) {
		res = max (f[i], res);
	}
	return res;
}

int main () {
	boost;
	int n;
	cin >> n;
	for (int i = 1 ; i <= n ; ++ i) {
		cin >> a[i];
	}
	for (int i = 1 ; i <= n ; ++ i) {
		cin >> cost;
		long long cur = get (a[i]) + cost;
		upd (a[i], cur);
		mx = max (mx, cur);
	}
	cout << mx;
}

Measured memory_bytes: 8064
n = int(input())

a = [0 for _ in range(5)]

for _ in range(n):
    temp = list(input())
    if temp[0] == 'M':
        a[0] += 1
    elif temp[0] == 'A':
        a[1] += 1
    elif temp[0] == 'R':
        a[2] += 1
    elif temp[0] == 'C':
        a[3] += 1
    elif temp[0] == 'H':
        a[4] += 1

ans = 0
for i in range(3):
    for j in range(i + 1, 4):
        for k in range(j + 1, 5):
            ans += a[i] * a[j] * a[k]

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
//#define ARRAY(type,n) (type *)malloc(sizeof(type)*n)
template<typename T>
T* ARRAY(int n){
	(T*)malloc(sizeof(T)*n);
}
template<typename T>
T** ARRAY2(int m,int n){
	T** type = (T**)malloc(sizeof(T*)*m);
	for(int i=0;i<m;i++){
		type[i]=(T*)malloc(sizeof(T)*n);
	}
	return type;
}
 
int par[100000];
void init(int n){
	rep(i,n){
		par[i]=i;
	}
}
 
int root(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x] = root(par[x]);
	}
}
 
void unite(int x,int y){
	x=root(x);
	y=root(y);
	if(x==y)return;
	par[x]=y;
}
 
 
 
struct a{
	ll a;
	int num;
	int par;
	bool use;
};
 
bool operator< (const a& left,const a& right){
        return left.a < right.a;
}
 
/*
rep(i,n){
	cin>>aa[i].a;
	aa[i].num=i;
}*/
 
 
 
int main(void){
	int n,m;
	cin>>n>>m;
	if(m*2-1<=n){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	
 
	return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define repll(i,n) for(ll i = 0; i < n; i++)
#define REPll(i,n) for(ll i = 1; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n") 
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  vii f(n, vi(10));
  rep(i,n){
    rep(j,10) cin >> f[i][j];
  }
  vii p(n, vi(11));
  rep(i,n)rep(j,11) cin >> p[i][j];

  int ans = -inf;
  for(int bit = 1; bit < (1<<10); bit++){
    bitset<10> b(bit);
    int tmp = 0;
    rep(i,n){
      int cnt = 0;
      rep(j,10){
        if(b[j]){
          cnt += f[i][j];
        }
      }
      tmp += p[i][cnt];
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;

}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	rawTimes := make([]int, 5)
	var adjustedTimes []int

	for i := 0; i < 5; i++ {
		fmt.Scan(&rawTimes[i])

		raw := rawTimes[i]
		if raw%10 != 0 {
			adjustedTimes = append(adjustedTimes, 10 - raw%10)
		}
	}

	sort.Sort(sort.Reverse(sort.IntSlice(adjustedTimes)))

	if len(adjustedTimes) != 0 {
		adjustedTimes[0] = 0
	}

	totalTime := 0
	for _, v := range append(rawTimes, adjustedTimes...) {
		totalTime += v
	}

	fmt.Println(totalTime)
}

Measured memory_bytes: 512
n = int(input())
l = []
for i in range(n):
    tmp = list(map(int,input().split()))
    l.append(tmp)

l.sort(key=lambda x:-x[2])

for i in range(101):
    for j in range(101):
        h = abs(l[0][0] - i) + abs(l[0][1] - j) + l[0][2]
        if h<=0:
            continue

        ok=True
        for k in range(len(l)):
            tmp_h = max(h - abs(l[k][0] - i) - abs(l[k][1] - j),0)
            if tmp_h != l[k][2]:
                ok=False
                break
        if ok:
            print(i,j,h)
            exit()

Measured memory_bytes: 41964
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  string s;
  cin >> s;
  if(s[0] == 'A') {
    cout << "T" << endl;
  } else if(s[0] == 'T') {
    cout << "A" << endl;
  } else if(s[0] == 'G') {
    cout << "C" << endl;
  } else {
    cout << "G" << endl;
  }

  return 0;
}


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

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var A = new int[3][];
            for (int i = 0; i < 3; i++)
            {
                A[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            }

            var N = int.Parse(Console.ReadLine());

            var b = new int[N];
            for (int i = 0; i < N; i++)
            {
                b[i] = int.Parse(Console.ReadLine());
            }

            var C = new bool[3][];
            for (int i = 0; i < 3; i++)
            {
                C[i] = new bool[3];
                for (int j = 0; j < 3; j++)
                {
                    C[i][j] = false;
                }
            }

            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    for (int k = 0; k < 3; k++)
                    {
                        if (A[j][k] == b[i])
                        {
                            C[j][k] = true;
                        }
                    }
                }
            }

            var result = false;
            for (int i = 0; i < 3; i++)
            {
                if (C[i][0] == true && C[i][1] == true && C[i][2] == true)
                {
                    result = true;
                }
                if (C[0][i] == true && C[1][i] == true && C[2][i] == true)
                {
                    result = true;
                }
            }
            if (C[0][0] == true && C[1][1] == true && C[2][2] == true)
            {
                result = true;
            }
            if (C[2][0] == true && C[1][1] == true && C[0][2] == true)
            {
                result = true;
            }

            Console.WriteLine($"{(result ? "Yes" : "No")}");
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

ll mod = 1000000007;



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

    ll n, m;
    cin >> n >> m;

    vll a(m), ok(n + 1, 1);
    REP(i, m){
        cin >> a[i];
        ok[a[i]] = 0;
    }
    vll dp(n + 1);
    dp[0] = 1;
    REP(i, n + 1){
        if(i - 1 >= 0 && ok[i]) dp[i] += dp[i - 1];
        if(i - 2 >= 0 && ok[i]) dp[i] += dp[i - 2];
        dp[i] %= mod;
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 2560
#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};

int main(){
	int n;
	scanf("%d", &n);
	int b[2+n], w[2+n];
	b[0] = w[0] = b[n+1] = w[n+1] = 0;
	getchar();
	rep(i, 1, n+1){
		if(getchar()=='#') b[i]=1, w[i]=0;
		else b[i]=0, w[i]=1;
	}
	rep(i, 0, n+1) b[i+1] += b[i];
	rep(i, 0, n+1) w[n-i] += w[n+1-i];
	int ans = 2e9;
	rep(i, 0, n+1){
		ans = std::min(ans, b[i]+w[i+1]);
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1792
while True:
    n,m=map(int,raw_input().split())
    if n==m==0:break
    up=map(int,raw_input().split()) if n!=0 else []
    down=map(int,raw_input().split()) if m!=0 else []
    upDown=up+down
    upDown.sort()
    maxlen=upDown[0]
    for i in range(n+m-1):
        maxlen=max(maxlen,upDown[i+1]-upDown[i])
    print maxlen

Measured memory_bytes: 5484