akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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




/* パスカルの三角形 */
const long long table_size = 50;
long long comb_table[table_size + 1][table_size + 1];   // nCr = comb_table[n][r]

void make_table(){
    for(long long i = 0; i <= table_size; i++){
        for(long long j = 0; j <= i; j++){
            if(i == 0 || j == i){
                comb_table[i][j] = 1;
            }
            else{
                comb_table[i][j] = comb_table[i - 1][j - 1] + comb_table[i - 1][j];
            }
        }
    }
}



int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    vector<double> v(n);
    REP(i, n){
        cin >> v[i];
    }
    
    sort(v.begin(), v.end(), greater<double>());
    
    double sum = 0;
    REP(i, a){
        sum += v[i];
    }
    
    printf("%.8lf\n", sum / (double)a);
    
    make_table();
    
    if(v[0] != v[a - 1]){
        ll x = 0, y = 0;
        REP(i, n){
            if(v[i] == v[a - 1])x++;
        }
        REP(i, a){
            if(v[i] == v[a - 1])y++;
        }
        
        cout << comb_table[x][y] << endl;
    }
    else{
        ll x = 0;
        REP(i, n){
            if(v[i] == v[a - 1])x++;
        }
        ll sum = 0;
        for(ll i = a; i <= b; i++){
            sum += comb_table[x][i];
        }
        
        cout << sum << endl;
    }
}


Measured memory_bytes: 256
N=int(input())
cnt = 0
ans = 0
for i in range(1,N+1):
    if i % 2 != 0:
        for j in range(1,i+1):
            if i%j == 0:
                cnt += 1
                #print(j)
    if cnt == 8:
        ans += 1
    cnt = 0
print(ans)


Measured memory_bytes: 9084
s = input()
q = int(input())
query = [list(input().split()) for _ in range(q)]

f = True
l, r = [], []
for i in range(q):
    if query[i][0] == "1":
        f = not f
    else:
        if f:
            if query[i][1] == "1":
                l.append(query[i][2])
            else:
                r.append(query[i][2])
        else:
            if query[i][1] == "1":
                r.append(query[i][2])
            else:
                l.append(query[i][2])

if f:
    print("".join(l[::-1]) + s + "".join(r))
else:
    print("".join(r[::-1]) + s[::-1] + "".join(l))

Measured memory_bytes: 112856
#include<bits/stdc++.h>
#define ll long long
#define fo(i,n) for(int i=0;i<n;i++)
#define rfo(i,n) for(int i=n-1;i>=0;i--)
#define Fo(i,q,n) for(int i=q;i<n;i++)
#define rFo(i,q,n) for(int i=n-1;i>=q;i--)
#define fO(i,n,k) for(int i=0;i<n;i+=k)
#define FO(i,q,n,k) for(int i=q;i<n;i+=k)
#define zero(a,n) memset(a,0,sizeof(a[0])*n)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define Endl "\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
using namespace std;
const int MOD=1000000007;
void print(){cout <<endl;}
template <typename T, typename... Types> 
void print(T var1, Types... var2){cout << var1 << " " ;print(var2...) ;}
//ceil of a/b
template <typename T>
T fceil(T a,T b){return (T)(a+b-1)/b;}
//const int N=2e5;
//int arr[N+1];

 
int main(){
	int n;
	cin>>n;
	vector<int> a(n,0);
	fo(i,n){
		cin>>a[i];	
	}
	//reverse(a.begin(),a.end());
	int dp[n];
	memset(dp,0,sizeof(dp[0])*n);
	dp[0]=0;
	dp[1]=abs(a[0]-a[1]);
	Fo(i,2,n){
		dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));	
	}
	cout<<dp[n-1]<<Endl;
	return 0;
}






/*NOTE: Take MOD after sorting and not before sorting!*/


Measured memory_bytes: 3992
import java.util.*;

class Main{

  public static void main(String[] args){
  
    Scanner sc = new Scanner(System.in);
    
    int x = sc.nextInt();
    
    if(x == 7 || x == 5 || x == 3) System.out.println("YES");
    else System.out.println("NO");
    
  }
  
}


Measured memory_bytes: 23892
#include <vector>
#include <iostream>
#include <string>
#include <math.h>

using namespace std;



int main(void){

  
  int K ,X,min,max;

  cin >> K >> X ; 

 if(K == 1){
   cout << X << endl;
 } else {
   min = X - (K-1);
   max = X + (K - 1);

   for(int i = min ; i <= max; i++){
     cout << i << " ";
   }  
    cout << endl;

 }


  return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>

using namespace std;

typedef long long int ll;
typedef vector<ll> V;
typedef vector<V> VV;

int main() {
  // Happy hacking!
  string s;
  ll e_hdist = 0; // 0101...
  ll o_hdist = 0; // 1010...
  bool is_even = false;
  cin >> s;
  for(ll i=0; i<s.length(); i++) {
    char c = s[i];
    if(is_even) {
      if(c == '0') {
        o_hdist++;
      } else {
        e_hdist++;
      }
    } else {
      if(c == '0') {
        e_hdist++;
      } else {
        o_hdist++;
      }
    }
    is_even = !is_even;
  }

  cout << min(e_hdist, o_hdist) << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>

using namespace std;

struct Piece{
	int width=0;
	int depth=0;
	int area=0;
	int born_time=0;
};

void calc_area(Piece *p){
	p->area = p->depth*p->width;
}

bool cmp1(Piece &a, Piece &b){
	return a.born_time == b.born_time ? a.area < b.area : a.born_time < b.born_time;
}
bool cmp2(Piece &a, Piece &b){
	return a.area < b.area;
}

int main(){
	while(1){
		int n, w, d; cin >> n >> w >> d;
		if(!n && !w && !d) break;
		Piece piece[1001];
		piece[1].width = w; piece[1].depth = d; piece[1].born_time = 0; calc_area(&piece[1]);

		for(int i=1; i<=n; i++){
			int p, s; cin >> p >> s;
			piece[p].born_time = i;
			Piece newPiece = piece[p];
			s %= (piece[p].width+piece[p].depth);
			if(s < piece[p].width){
				newPiece.width  = s;
				piece[p].width -= s;
			} else{
				s -= piece[p].width;
				newPiece.depth  = s;
				piece[p].depth -= s;
			}
			calc_area(&piece[p]);
			calc_area(&newPiece);
			piece[i+1] = newPiece;
			sort(piece+1, piece+i+2, cmp1);
		}

		sort(piece+1, piece+n+2, cmp2);
		for(int j=1; j<=n+1; j++){
			cout << piece[j].area;
			if(j != n+1) cout << " ";
			else cout << endl;
		}
	}
	return 0;
}


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

int main(){
	long long a,b,c,d;
	cin >> a >> b >> c >> d;
	long long  x = max(a,b);
	long long  x1 = min(a,b);
	long long  y = max(c,d);
	long long  y1 = min(c,d);
	long long  f1 = x*y;
	long long  f2 = x*y1;
	long long  f3 = y*x1;
	long long  f4 = y1*x1;
	long long  ans1 = max(f1,f2);
	long long  ans2 = max(f3,f4);
	long long  ans = max(ans1,ans2);
	cout << ans << endl;
return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
using namespace std;

int main() {
	vector <int> t;
	int n, min = 0, max = 0;
	cin >> n;
	for (int i = 0; i < 9; ++i) {
		t.push_back(0);
	}
	for (int i = 0; i < n; ++i) {
		int tmp;
		cin >> tmp;
		if (tmp < 3200) {
			++t[tmp / 400];
		}
		else {
			++t[8];
		}
	}
	for (int i = 0; i < 8; ++i) {
		if (t[i] > 0) {
			++min;
			++max;
		}
	}
	max += t[8];
	if (min == 0) {
		min = 1;
	}
	cout << min << " " << max << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<set>
using namespace std;

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

    set<int> d;

    for(int i = 0; i < n; i++){
        int k;
        scanf("%d", &k);
        d.insert(k);
    }

    int ans = d.size();

    printf("%d\n", ans);

    return 0;
}

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

namespace ConsoleApp14
{
    class Program
    {
        static void Main(string[] args)
        {
            var solver = new Solver();
            solver.Calc();
        }
    }

    public class Solver
    {


        public void Calc()
        {

            var p = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
            var A = p[0];
            var B = p[1];

            if (B > A)
            {
                var tmp = A;
                A = B;
                B = tmp;
            }

            var r = A % B;
            var xxx = A * B;
            while (r != 0)
            {
                A = B;
                B = r;
                r = A % B;
            }

            Console.WriteLine(xxx / B);


        }
    }
}

Measured memory_bytes: 13396
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	static int[] MASKS = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
	static int DAY_NUM = 5, HOUR_NUM = 2;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		boolean[][] F = new boolean[N][DAY_NUM * HOUR_NUM];
		for (int i = 0; i < N; ++i) {
			tokens = in.readLine().split(" ");
			for (int j = 0; j < DAY_NUM * HOUR_NUM; ++j) {
				F[i][j] = tokens[j].equals("1") ? true : false;
			}
		}
		int[][] P = new int[N][DAY_NUM * HOUR_NUM + 1];
		for (int i = 0; i < N; ++i) {
			tokens = in.readLine().split(" ");
			for (int j = 0; j <= DAY_NUM * HOUR_NUM; ++j) {
				P[i][j] = Integer.parseInt(tokens[j]);
			}
		}
		List<boolean[]> patterns = genPattern();
		long result = Long.MIN_VALUE / 2;
		for (boolean[] pattern : patterns) {
			result = Math.max(result, calcProfit(pattern, F, P));
		}
		System.out.println(result);

	}

	static long calcProfit(boolean[] pattern, boolean[][] F, int[][] P) {
		long result = 0;
		for (int i = 0; i < F.length; ++i) {
			int count = 0;
			for (int j = 0; j < 10; ++j) {
				if (pattern[j] && F[i][j]) {
					count++;
				}
			}
			result += (long) P[i][count];
		}
		return result;
	}

	static List<boolean[]> genPattern() {
		List<boolean[]> patterns = new ArrayList<>(1024);
		for (int i = 1; i < 1024; ++i) {
			patterns.add(genPattern(i));
		}
		return patterns;
	}

	static boolean[] genPattern(int value) {
		boolean[] pattern = new boolean[10];
		for (int i = 0; i < 10; ++i) {
			pattern[i] = (value & MASKS[i]) == 0 ? false : true;
		}
		return pattern;
	}
}

Measured memory_bytes: 23892
h, _w = gets.split(' ').map!(&:to_i)

masu = Hash.new([])
h.times do |i|
  masu[i] = gets.chomp!.split('')
end

ans = {}
masu.each do |i, arr|
  convert = []
  arr.each.with_index do |s, j|
    next if s == ''

    if s == '#'
      convert << s
    else
      count = 0
      start, len = (j - 1).negative? ? [0, 2] : [(j - 1), 3]
      3.times do |k|
      # 周囲の 8 マスとして前の行、現在の行、次の行を調査
        count += masu[i - 1 + k].slice(start, len).count('#') unless masu[i - 1 + k].empty?
      end

      convert << count
    end
  end
  ans[i] = convert
end

ans.each do |_, arr|
  puts arr.join
end


Measured memory_bytes: 2172
#ABC045a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

a = input()[:-1]
b = input()[:-1]
c = input()[:-1]

aa = 0
bb = 0
cc = 0

nextPerson = "a"

while (True):
    #print(nextPerson)
    if (nextPerson == "a"):
        if (len(a) - aa == 0):
            break
        nextPerson = a[aa]
        aa += 1
    elif (nextPerson == "b"):
        if (len(b) - bb == 0):
            break
        nextPerson = b[bb]
        bb += 1
    else:
        if (len(c) - cc == 0):
            break
        nextPerson = c[cc]
        cc += 1
print(nextPerson.capitalize())

Measured memory_bytes: 3064
import itertools
h, w = [int(i) for i in input().split()]
a = [input() for i in range(h)]

for way in itertools.combinations([i for i in range(h + w - 2)], h - 1):
    k = 0
    l = 0
    ij_list =[[k, l]]
    #print(way)
    for i in range(h + w - 1):
        k += (i in way)
        l += (i not in way)
        ij_list.append([k, l])

    for i, j in itertools.product(range(h), range(w)):
            if [i, j] not in ij_list:
                if a[i][j] != ".":
                    break
            else:
                if a[i][j] != "#":
                    break
    else:
        print("Possible")
        break

else:
    print("Impossible")

Measured memory_bytes: 3064
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

n=0
m=0
ans=-inf
l=[]

def dfs(s):
  global n
  global m
  global ans
  global l

  if len(s)==n:
    _ans=0
    for a,b,c,d in l:
      a-=1
      b-=1
      if s[b]-s[a]==c:
        _ans+=d
    ans=max(ans,_ans)

  if len(s)!=n:
    x=s[-1]
    for i in range(x,m+1):
      dfs(s+[i])

def main():
  global n
  global m
  global ans
  global l

  n,m,q=LI()
  l=[LI() for _ in range(q)]

  for i in range(1,m+1):
    dfs([i])

  return ans

# main()
print(main())


Measured memory_bytes: 10820
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int x,y,z=0;
    int p[101][101];
    int p1[101];
    int p2[101];
    scanf("%d %d",&x,&y);
    for(int n=1;n<=x;n++){
        for(int m=1;m<=y;m++){
            scanf("%d",&p[n][m]);
        }
    }
    for(int n=1;n<=x;n++){
        for(int m=1;m<=y;m++){
            p1[n]+=p[n][m];

            printf("%d ",p[n][m]);

        }
        z+=p1[n];

        printf("%d",p1[n]);
        printf("\n");

    }
    for(int m=1;m<=y;m++){
        for(int n=1;n<=x;n++){
            p2[m]+=p[n][m];
        }
        printf("%d ",p2[m]);
    }
    printf("%d",z);

    printf("\n");

    return 0;
}



Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
//x=a^5-b^5
int main()
{
	int x;
	cin>>x;
	for(int i=1;;i++)
	{
		int tmp=pow(x+pow(i,5),0.2);
		if(pow(tmp,5)==pow(i,5)+x)
		{
			cout<<tmp<<" "<<i;
			return 0;
		}
		i=-i;
		tmp=pow(x+pow(i,5),0.2);
		if(pow(tmp,5)==pow(i,5)+x)
		{
			cout<<tmp<<" "<<i;
			return 0;
		}
		i=-i;
	}
}


Measured memory_bytes: 4060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0 ; i < n ; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = a.length - 1 ; i >=0 ; i--) {
			if(i > 0) {
				System.out.print(a[i] + " ");
			}else if(i == 0) {
				System.out.println(a[i]);
			}
		}
	}
}

Measured memory_bytes: 26096
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

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

	int N;
	cin >> N;
	ll T[N];
	rep(i, 0, N) cin >> T[i];

	ll rsl = T[0];
	rep(i, 1, N) rsl = lcm(rsl, T[i]);
	cout << rsl << endl;


}


Measured memory_bytes: 256
#include<stdio.h>

#define MAX 100000
#define NIL -1

struct Type{ 
  int p, l, r;
};
struct Type A[MAX];

int n,D[MAX];

int getDepth(int u){
  int d = 0;

  while(A[u].p!=NIL){
    u=A[u].p;
    d++;
  }
  return d;
}

void print(int u){
  int i;
  printf("node %d: parent = %d, depth = %d, ",u,A[u].p,D[u]);
  if(A[u].p==NIL) printf("root, ");
  else if(A[u].l==NIL) printf("leaf, ");
  else if(A[u].l!=NIL) printf("internal node, ");
  printf("[");
  if(A[u].l!=NIL){
    printf("%d",A[u].l);
    u=A[u].l;
    if(A[u].r!=NIL) printf(", ");
    
    while(A[u].r!=NIL){
      printf("%d",A[u].r);
      u=A[u].r;
      if(A[u].r!=NIL) printf(", ");
    }
  }
  printf("]\n");
}

main(){
  int i, j, d, v, c, l;
  scanf("%d", &n);
  for(i=0;i<n;i++) {
    A[i].p=NIL;
    A[i].l=NIL;
    A[i].r=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d %d", &v, &d);
    for(j=0;j<d;j++){
      scanf("%d", &c);
      A[c].p=v;
      if(j==0) A[v].l=c;
      if(j>0) A[l].r=c;
      l=c;
    }
  }
  for(i=0;i<n;i++){
    D[i]=getDepth(i);
  }
  for(i=0;i<n;i++)print(i);
  return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
typedef pair<int, int> P_i;
typedef pair<double,double> P_d;
#define rep(i,n) for(int i=0;i<(n);++i)
#define alrep(i,j,n) for(int i=0;i<(n);++i)for(int j=i+1;j<(n);++j)
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;int ans=0;
#define answer cout << ans << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int MOD=1e9+7;
const long long INF = 1LL << 60;

using P=pair<int,int>;

signed main(){
  int N,M;
  cin >> N >> M;
  int first,last;
  if(N==1){
    first=0;
    last=9;
  }
  else if(N==2){
    first=10;
    last=99;
  }
  else{
    first=100;
    last=999;
  }
  P input[M];
  rep(i,M){
    cin >> input[i].first >> input[i].second;
  }
  for(int i=first;i<=last;i++){
    bool flag=false;
    string S=to_string(i);
    rep(j,M){
      if(S[input[j].first-1]=='0'+ input[j].second);
      else{
        flag=true;
        break;
      }
    }
    if(flag);
    else{
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

const ll mod = 998244353;

string s;
ll cum1[2010], cum2[2010];
ll d[4010][4010];

signed main() {
	cin >> s;
	int n = (int)s.size();
	for (int i = 0; i < n; i++) {
		if (s[i] == '0')cum1[i + 1] += 2;
		if (s[i] == '1')cum1[i + 1]++, cum2[i + 1]++;
		if (s[i] == '2')cum2[i + 1] += 2;
		cum1[i + 1] += cum1[i];
		cum2[i + 1] += cum2[i];
	}
	d[0][0] = 1;
	for (int i = 0; i < 2 * n; i++) {
		for (int j = 0; j <= i; j++) {
			if (j + 1<= cum1[min(n, i + 1)])d[j + 1][i - j] = (d[j + 1][i - j] + d[j][i - j]) % mod;
			if (i - j + 1 <= cum2[min(n, i + 1)])d[j][i + 1 - j] = (d[j][i + 1 - j] + d[j][i - j]) % mod;
		}
	}
	cout << d[cum1[n]][cum2[n]] << endl;
}


Measured memory_bytes: 81136
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N];
typedef long long ll;

int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	
	if(b <= 0) {
		if(c <= 0) {
			cout << a * c;
		} else {
			cout << b * c;
		}
	} else if(a <= 0){
		if(d <= 0) {
			cout << a * c;
		} else if(c <= 0) {
			cout << max(a * c, b * d);
		} else {
			cout << b * d;
		}
	} else {
		if(d <= 0) {
			cout << d * a;
		} else {
			cout << d * b;
		}
	}
	
	
	
	return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> a(n);
  int cnt0=0,cnt2=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    a[i]%=4;
    if(a[i]==0){
      cnt0++;
    }
    else if(a[i]==2){
      cnt2++;
    }
  }
  int cnt1=n-cnt0-cnt2;
  bool can=false;
  if(cnt2==0){
    if(cnt1<=cnt0+1) can=true;
  }
  cnt1++;
  if(cnt1<=cnt0+1) can=true;
  cout<<(can? "Yes":"No");
}

Measured memory_bytes: 640
N = int(input())
a_list = list(map(int, input().split()))

from collections import Counter

a_set = set(a_list)
counter = Counter(a_list)

remove = 0
for k, v in counter.items():
    if v > 1:
        remove += v -1

if remove % 2 == 0:
    print(len(a_set))
else:
    print(len(a_set)-1)

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

using namespace std;

typedef int in;
#define int long long

int n,m,a[10000],ans = INT_MAX;
vector<int> v[10000];
int vis[20],ms[1050];
int dp[1050][80000];

int fun(int idx,int mask){
    if(mask == (1 << n) - 1){
        return 0;
    }
    if(idx == m){
        if(mask == (1 << n) - 1){
            return 0;
        }
        return INT_MAX;
    }
    int &ret = dp[idx][mask];
    if(ret){
        return ret;
    }
    ret = INT_MAX;
    ret = min(ret,fun(idx + 1,mask));
    ret = min(ret,fun(idx + 1,(mask | ms[idx])) + a[idx]);
    return ret;
}

in main() {
    cin >> n >> m;
    for(int i = 0 ; i < m ; i ++){
        int bla;
        cin >> a[i] >> bla;
        for(int j = 0 ; j < bla ; j ++){
            int sf;
            cin >> sf;
            ms[i] |= (1ll << (sf - 1));
            v[i].push_back(sf);
        }
        //cout << ms[i] << endl;
    }
    //memset(vis,0,sizeof vis);
    ans = fun(0,0);
    if(ans >= INT_MAX){
        cout << "-1\n";
        return 0;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 623232
n = gets.to_i
a = [0] + gets.split.map(&:to_i)
n.downto(1) do |i|
  j = i
  b = 0
  while j <= n
    b += a[j]
    j += i
  end
  a[i] = b % 2
end
puts a.sum
1.upto(n) do |i|
  puts i if a[i] == 1
end

Measured memory_bytes: 32080
#include<iostream>
#include<queue>
using namespace std;
#include<iostream>
#include<cstdlib>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define fir first
#define sec second

const int N = 100;
const int inf =(1<<25);
enum{A=0,B=1};
enum{WIN=1,LOSE=0,UNKNOWN=-1};
class st{
public:
  bool who;//previous move
  int a,b;
  int cost;
};

int win[2][N][N];
int deg[2][N][N];
int cost[2][N][N];
int hoge[2][N][N];
vector<int> edge[N];
int revdeg[N];

void solve(int n,int ta,int tb){
  rep(j,n)rep(k,n){
    cost[A][j][k]=0,cost[B][j][k]=0;
    win[A][j][k]=win[B][j][k]=UNKNOWN;
    hoge[A][j][k]=hoge[B][j][k]=0;
  }

  //dge ini
  rep(i,n){
    rep(j,n){
      deg[A][i][j]=revdeg[j];
      deg[B][i][j]=revdeg[i];
    }
  }

  //initial state
  queue<st> Q;
  rep(i,n){
    win[A][i][i]=LOSE;
    cost[A][i][i]=0;
    Q.push((st){A,i,i,0});
  }

  while(!Q.empty()){
    st now = Q.front();Q.pop();
    //    cout <<"now " <<  now.who <<" " << now.a <<" " << now.b << " " << win[now.who][now.a][now.b] <<" " << cost[now.who][now.a][now.b]<< endl;
    int cur=now.who==A?now.a:now.b;
    
    rep(i,edge[cur].size()){
      bool nexw=!now.who;
      int  next=edge[cur][i];
      int  nexa=now.who==A?next:now.a;
      int  nexb=now.who==B?next:now.b;
      hoge[nexw][nexa][nexb]++;
      if (win[nexw][nexa][nexb] != UNKNOWN)continue;
      
      if (now.who==A){
	cost[nexw][nexa][nexb]=max(cost[nexw][nexa][nexb],now.cost+1);
      }
      
      deg[nexw][nexa][nexb]--;
      if (win[now.who][now.a][now.b] == LOSE){//B only
	cost[nexw][nexa][nexb]=now.cost+1;
	win[nexw][nexa][nexb]=WIN;
	Q.push((st){nexw,nexa,nexb,now.cost+1});
      }else if (deg[nexw][nexa][nexb] == 0){
	//A only
	win[nexw][nexa][nexb]=LOSE;
	cost[nexw][nexa][nexb]=now.cost+1;
	Q.push((st){nexw,nexa,nexb,now.cost+1});
      }
    }
  }
  
  //cout <<"test " <<  A <<" " << ta <<" " << tb <<" deg " << deg[A][ta][tb]<<" cost " << cost[A][ta][tb] <<  endl;
//   cout <<"tmp " 
//        << cost[A][7][7] << " "
//        << cost[B][7][6]<<" "
//        << cost[A][6][4] << " "
//        << cost[B][6][2]<<" "
//        << cost[A][4][2]<<" "
//        << cost[B][4][1]<<" " 
//        << cost[A][2][1]<<" " 
//        << cost[B][2][0]<<" "
//        << cost[A][3][0]
//        << endl;

//   rep(i,n){
//     rep(j,n){
//       cout <<i<<" " << j << " " << 
// 	cost[A][i][j]<<" " << 
// 	cost[B][i][j] << endl;
//     }
//   }

  if (win[A][tb][ta]==LOSE)cout << cost[A][tb][ta]/2<<endl;
  else cout << "infinity"<<endl;
}

main(){
  int te;
  cin>>te;
  while(te--){
    int n;
    cin>>n;
    rep(i,n)edge[i].clear(),revdeg[i]=0;
    rep(i,n){
      rep(j,n){
	bool a;cin>>a;
	if (a){
	  edge[i].push_back(j);
	  revdeg[j]++;
	}	
      }
      edge[i].push_back(i);
      revdeg[i]++;
    }

    int a,b;
    cin>>a>>b;
    solve(n,a,b);
  }
  return false;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int w;
  cin >> w;
 
  cout << w * 32 << endl;

}


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

int cost[200][200];
int a[8];
signed main() {
	memset(cost, 0x3f, sizeof(cost));
	int n, m, r; cin >> n >> m >> r;
	for (int i = 0; i < r; i++) { cin >> a[i]; a[i]--; }
	sort(a, a + r);
	for (int i = 0; i < m; i++) {
		int b, c, d; cin >> b >> c >> d;
		b--; c--;
		cost[b][c] = cost[c][b] = d;
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < n; k++) {
				cost[j][k] = min(cost[j][k], cost[j][i] + cost[i][k]);
			}
		}
	}
	int ans = 1 << 29;
	do {
		int sum = 0;
		for (int i = 1; i < r; i++) {
			sum += cost[a[i - 1]][a[i]];
		}
		ans = min(ans, sum);
	} while (next_permutation(a, a + r));
	cout << ans << endl;
}


Measured memory_bytes: 384
require 'pp'

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end

N, M = gets_i_list

students = []
N.times do
  students.push(gets_i_list)
end

checkpoints = []
M.times do
  checkpoints.push(gets_i_list)
end

students.each do |s|
  sx, sy = s
  min_point    = nil
  min_distance = nil
  checkpoints.each_with_index do |c, i|
    cx, cy = c
    distance = (sx - cx).abs + (sy - cy).abs
    if min_point.nil?
      min_point = i + 1
      min_distance = distance
    elsif !min_point.nil? && min_distance > distance
      min_point = i + 1
      min_distance = distance
    end
  end
  puts min_point
end


Measured memory_bytes: 2300
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
  int N, T; 
  cin >> N >> T;
  vector<int> c(N);
  vector<int> t(N);
  for(int i = 0; i < N; ++i) {
    cin >> c[i] >> t[i];
  }
  int MAX = 1 << 30;
  int ans = MAX;

  for (int i = 0; i < N; ++i){
    if(t[i] <= T){
      ans = min(ans, c[i]);
      
    }
  }

  if (ans <  MAX){
    cout << ans << endl;
  }
  else {
    cout << "TLE" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
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 long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int n, m; cin >> n >> m;
    vector<int> g[n + 1];
    vector<int> v(n - 1);
    rep(i, m)
    {
        int a, b; cin >> a >> b;
        //a--;b--;
        g[a].push_back(b), g[b].push_back(a);
    }
    rep(i, n - 1) v[i] = i + 1;

    int ans = 0;
    do
    {
        int now = 1;
        bool ok;
        rep(i, n - 1)
        {
            ok = false;
            for(auto it : g[now])
            {
                if (it == v[i] + 1)
                {
                    ok = true;
                    now = v[i] + 1;
                    break;
                }
            }
            if (!ok) break;
        }
        if (ok) ans++;
    } while (next_permutation(v.begin(), v.end()));
    cout << ans << endl;
}

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

const int Maxn = 100010;
int N, L, A[ Maxn ], Max;

int main() {
	scanf( "%d%d", &N, &L );
	for( int i = 1; i <= N; ++i ) scanf( "%d", &A[ i ] );
	for( int i = 1; i < N; ++i ) Max = max( Max, A[ i ] + A[ i + 1 ] );
	if( Max < L ) {
		printf( "Impossible\n" );
		return 0;
	}
	int t = 0;
	for( int i = 1; i < N; ++i ) 
		if( A[ i ] + A[ i + 1 ] >= L ) 
			t = i;
	printf( "Possible\n" );
	for( int i = 1; i < t; ++i ) printf( "%d\n", i );
	for( int i = N - 1; i > t; --i ) printf( "%d\n", i );
	printf( "%d\n", t );
	return 0;
}

Measured memory_bytes: 1152
function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});    
    var C = 1e+9 +7;
    var C2 = 1e+5;
    var N = parseInt(input[0][0], 10);
    var vec_A = input[1];
    var bitAlist = [];
    var v_ruijo = [1n];
    var v_ruijoR = [1];
    for (var i = 0; i < 59; i++){
        v_ruijo.push(v_ruijo[i] * 2n);
        v_ruijoR.push(v_ruijoR[i] * 2 % C);
    }
    var tmp, tmp2;
    for (var i = 0; i < N; i++){
        bitAlist.push([]);
        if (BigInt(vec_A[i]) < v_ruijo[53]){
            tmp = parseInt(vec_A[i]).toString(2);
            tmp = ('0'.repeat(60) + tmp).substr(-60, 60);
            bitAlist[i] = tmp.split("").map(e => parseInt(e, 10));
        } else {
            tmp2 = BigInt(vec_A[i]);
            tmp = '';
            for (var j = 0; j < (60 - 53); j++){
                if (tmp2 >= v_ruijo[59 - j]){
                    tmp2 = tmp2 - v_ruijo[59 - j];
                    tmp += '1';
                } else {
                    tmp += '0';
                }
            }
            tmp += ('0'.repeat(53) + tmp2.toString(2)).substr(-53, 53);
            bitAlist[i] = tmp.split("").map(e => parseInt(e, 10));
        }
    }
    var ans = 0;
    var nZero, nOne;
    for (var i = 0; i < 60; i++){
        nZero = nOne = 0;
        for(var j = 0; j < N; j++){
            if (bitAlist[j][i] === 1) nOne++;
            else nZero++;
        }
        ans = ans + kakeruR(v_ruijoR[59 - i], (nOne * nZero % C), C, C2);
        ans %= C;
    }
    console.log(ans);
}


function kakeruR(a, b, C, C2){
    var tmpQ, tmpR, ans;
    tmpQ = (b / C2 | 0);
    tmpR = b - (tmpQ * C2);
    ans = (a * tmpQ % C) * C2 % C + (a * tmpR);
    ans %= C;
    return ans;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 249996
//#pragma GCC optimize "trapv"
//-D_GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define pm(m) for(auto itr=(m).begin();itr!=(m).end();itr++){itr->first<<" "<<itr->second<<"\n";}
#define int long long int
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define ii pair<int,int>
#define Max 100000+5
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f first
#define s second
#define pb push_back
#define bug(x) cout<<(x)<<" ";exit(0);
int mod = 1000000007;
int mod1 = 998244353;
vector<int> g[Max];
bool vis[Max];
int d, x, y;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
void ex(int A, int B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        ex(B, A%B);
        int temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}





int power(int a,int b){
    if(b==1)return a;
    if(a>mod)a%=mod;
    int r=1;
    while(b){
        if(b&1)r=r%mod*a%mod;
        a=a%mod*a%mod;
        b/=2;
    }
    return r;
}
class uf{
    vector<int> v;
    vector<int> sz;
    
    
    public :
    uf(int n){
        v.resize(n+1);
        iota(v.begin()+1,v.end(),1);
        sz.resize(n+1,1);
        //1 to sz
    }
    int root(int b){
        while(v[b]!=b){
            b = v[b];
        }   
        return b;
    }
    void u(int a, int b){
        //combine a and b
        
        int ra=root(a);
        int rb=root(b);
        if(ra==rb)return ;
        if(sz[ra]<sz[rb]){
            v[ra] = v[rb];
            sz[rb]+=sz[ra];
        }else{
            v[rb]=v[ra];
            sz[ra]+=sz[rb];
        }
    }
    bool f(int a,int b){
        //same set
        return (root(a)==root(b));
    }
   
    
};
vector<int> matmul(vector<int> a,vector<int> b){
    vector<int> c(4,0);
    c[0] = (a[0]%mod*b[0]%mod + a[1]%mod*b[2]%mod)%mod;
    c[1] = (a[0]%mod*b[1]%mod + a[1]%mod*b[3]%mod)%mod;
    c[2] = (a[2]%mod*b[0]%mod + a[3]%mod*b[2]%mod)%mod;
    c[3] = (a[2]%mod*b[1]%mod + a[3]%mod*b[3]%mod)%mod;
    return c;
}
vector<int> id={1,0,0,1};

int n,m;
vector<vector<char> > v(1000,vector<char> (1000));
vector<vector<int> > dp(1000,vector<int> (1000,-1));

int solve(int i,int j){
    
    if(i<n and j<m and v[i][j]!='#'){
        
        if(dp[i][j]!=-1)return dp[i][j];
        int ans = solve(i+1,j)+solve(i,j+1);
        if(ans>mod)ans%=mod;
        dp[i][j]=ans;
        return ans;
    }
    return 0;
}

int32_t main(){
    
	IO
	//freopen("input.txt","r",stdin);
    	//freopen("output.txt","w",stdout);
    	
    

	cin>>n>>m;
	dp[n-1][m-1]=1;
	for(int i=0;i<n;i++){
	    for(int j=0;j<m;j++){
	        cin>>v[i][j];
	    }
	}
	
	cout<<solve(0,0);
	
}

Measured memory_bytes: 14908
#include<iostream>
#include<stdio.h>
#include<cmath>
#include <iomanip>


using namespace std;

int main(){
    double r;
    cin>>r;
    double l = 2*M_PI*r;
    double s = M_PI*r*r;
    
    cout<<fixed<<setprecision(6)<<s<<" "<<l<<endl;

}


Measured memory_bytes: 3276
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let n: usize = read_as_vec()[0];
    println!("{}", (n + 999) / 1000 * 1000 - n);
}


Measured memory_bytes: 2132
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        final String input = sc.next();
        String[] days = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
        for (int i = 0; i < days.length; i++) {
            if (input.equals(days[i])) {
                System.out.println(7 - i);
                break;
            }
        }
    }
}


Measured memory_bytes: 23764
x=int(input())

if 400<=x<=599 :
    print(8)
elif 600<=x<=799 :
    print(7)
elif 800<=x<=999 :
    print(6)
elif 1000<=x<=1199 :
    print(5)
elif 1200<=x<=1399 :
    print(4)
elif 1400<=x<=1599 :
    print(3)
elif 1600<=x<=1799 :
    print(2)
elif 1800<=x<=1999 :
    print(1)

Measured memory_bytes: 9188
import java.util.Scanner;

/**
 * http://arc060.contest.atcoder.jp/tasks/arc060_a
 *  version-2
 * @author Cummin
 */

public class Main {
   
    static int N ;
    static int A ;
    static int plus[], minus[], zero[] ;
    static int plus_i, minus_i, zero_i ;
    
    public static void main(String[] args) {
//        System.out.printf("At Coder Regular Contest 060 問題C \n") ;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt() ;
        A = sc.nextInt() ;
        plus = new int[N];
        minus = new int[N] ;
        zero = new int[N] ;
        for (int i=0 ; i<N; i++) {
            plus[i] = 51; minus[i] = 51 ;
        }
        for (int i= 0 ; i<N; i++) {
            int x ;
            x = sc.nextInt() ;
            if (x<A) {
                minus[minus_i] = A - x ;
                minus_i ++ ;
            }else if (x>A) {
                plus[plus_i] = x - A ;
                plus_i ++ ;
            }else { // x==A
                zero[zero_i] = 0 ;
                zero_i ++ ;
            }
        }
        
        System.out.println(solve2()) ;    
    }
    
    static long solve2() {
        long cnt = 0 ;
        long plus_list[] = new long[2500] ;
        long minus_list[] = new long[2500] ;
        comb_list(plus_i, plus, plus_list) ;
        comb_list(minus_i, minus, minus_list) ;

        for (int i=1 ; i<2500; i++) {
            cnt = cnt + plus_list[i]*minus_list[i] ;
        }
     
        if (zero_i >0 ) {
            //System.out.printf("cnt=%d, zero_i=%d, p2=%d \n", cnt, zero_i, power_2(zero_i)) ;
            cnt = (cnt * power_2(zero_i)) + power_2(zero_i)-1 ; // plus/minusとゼロの組み合わせ + zeroだけで構成する場合
            return cnt ;
        } else 
            return cnt;
    }

    static void  comb_list(int n, int[] X, long list[]) {
        int max  ;
        list [0] = 1 ; // dummy (マーク用)
        max = 0 ;
        for (int i = 0; i < n ; i++) {
            // 1..maxの値を、X[i]だけシフトして加算コピーする, X[i]をマーク(1)
            for (int j=max; 0<=j ; j-- ){
                list[j + X[i]] = list[j + X[i]] + list[j] ;
            }
            max = max + X[i] ; 
        }
    }

    static int comb_add(long n, int[] X) {
        int count = 0;
        int sum = 0 ;
        while (n > 0) {
            if ((n & 0x01) == 1) {
                sum = sum + X[count];
            }
            count++;
            n = n >> 1;
        }
        return sum;
    }

    static long power_2(int n) { // n個の要素の組み合わせは、2^n通り
        long a = 1 ;
        for (int i=1 ; i<=n ; i++) {
            a = a+a ;
        }
        return a ;
    }
    
}


Measured memory_bytes: 9428
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	const initialBufSize = 4096
	const maxBufSize = 1000000
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	scanner.Split(bufio.ScanWords)
	var A int
	scanner.Scan()
	A, _ = strconv.Atoi(scanner.Text())
	var B int
	scanner.Scan()
	B, _ = strconv.Atoi(scanner.Text())
	fmt.Println(solve(A, B))
}
func solve(A int, B int) int {
	return A * B
}


Measured memory_bytes: 1760
#include<cstdio>
#include<cstring>

using namespace std;

typedef long long ll;

int main(){
	char s[110]; ll k;
	scanf("%s %lld", s, &k);
	int p = 0;
	while(s[p] != '\0'){
		if(s[p] != '1') break;
		p++;
	}
	char res;
	if(s[p] == '\0' || k <= p) res = '1';
	else res = s[p];
	printf("%c\n", res);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <functional>
#include <map>
#include <iomanip>
using namespace std;

int main()
{
    int num=0;
    int numa=0,numb=0,numc=0,numd=0,nume=0;
    int numz=2000000000,numy = 2000000000, numx=2000000000;
    string str, stra, strb, strc, strd, stre;

    cin >> numa >> numb;
    if(numa>=numb){
        cout << "10" <<endl;
    }else{
        cout << "0" <<endl;
    }
    return 0;
}

Measured memory_bytes: 888
import itertools

N=input()

ans=0
for i in range(3,len(N)+1):
    for j in itertools.product('357', repeat=i):
        s=''.join(j)
        if int(s)<=int(N) and s.count('3')>=1 and s.count('5')>=1 and s.count('7')>=1:
            ans+=1

print(ans)

Measured memory_bytes: 3060
use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let n: i64 = input.split_whitespace().next().unwrap().parse().unwrap();
    let mut result = 0;
    for i in 1..(n+1) {
        result += i;
    }
    println!("{}", result);
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;

  auto prev = 'A';
  int count = 0;
  for(int i = 0; i < N; ++i) {
    if(S[i] != prev)
      count++;
    prev = S[i];
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        double xDouble = Double.valueOf(x);

        int ans = 0;
        double tot = 100;
        while (tot < xDouble) {
            tot = Math.floor(tot * 1.01);
            ans ++;
        }

        System.out.println(ans);    

    }
}


Measured memory_bytes: 35916
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>

using namespace std;
int main() {
    int n;
    while(1){
        cin >>n;
        double a[n];
        if(n==0) break;
        double b=0;
    for (int i=0; i<n; i++) {
        cin>>a[i];
        b+=a[i];
    }
    double m=b/n;
    double c=0;
        for (int j=0; j<n; j++) {
            c += pow(m-a[j],2);
        }
        double x=c/n;
    printf("%.8f\n",sqrt(x) );
    }
}


Measured memory_bytes: 3188
using System;

namespace AtCoderABC135C
{
    class Program
    {
        static void Main(string[] args)
        {
            long ans = 0;

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

            string[] s = Console.ReadLine().Split(' ');

            int[] A = new int[N+1];

            for (int i = 0; i < N+1; i++)
            {
                A[i] = int.Parse(s[i]);
            }

            s = Console.ReadLine().Split(' ');


            int[] B = new int[N];

            for (int i = 0; i < N; i++)
            {
                B[i] = int.Parse(s[i]);
            }

            for(int i=0;i<N;i++)
            {
                int M = A[i] + A[i+1];

                if(M > B[i])
                {
                    ans += B[i];

                    M -= B[i];
                    if (M < A[i + 1])
                        A[i + 1] = M;
                }
                else
                {
                    ans += M;
                    A[i + 1] = 0;
                }
            }



            Console.WriteLine(ans.ToString());
        }
    }
}


Measured memory_bytes: 32860
res = 0
n = int(input())
a = [list(map(int,input().split())) for _ in range(2)]
# したにいくます
for i in range(n):
    t = 0
    tmp = 0
    for j in range(n):
        tmp += a[t][j]
        if i==j:
            t += 1
            tmp += a[t][j]
    res = max(res,tmp)
print(res)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <map>

using namespace std;

void swap(int &a,int &b){int tem;tem=a,a=b,b=tem;}

class dice {
	public :
	int up,front,right;
	int UP(){return up;}
	int DOWN(){return 7-up;}
	int RIGHT(){return right;}
	int LEFT(){return 7-right;}
	int FRONT(){return front;}
	int BACK(){return 7-front;}
	void South(){ swap(front,up);up=7-up;};
	void North(){ South(),South(),South();};
	void East(){ swap(right,up);up=7-up;};
	void West(){ East(),East(),East();};
	void Right(){swap(front,right),right=7-right;};
	void Left(){Right(),Right(),Right();};
};

int main(void){
	int n;
	map<string,int> list;
	list["North"]=1;
	list["South"]=2;
	list["West"]=3;
	list["East"]=4;
	list["Left"]=5;
	list["Right"]=6;
	while(cin >> n,n){
		int sum=1;
		dice d;
		d.up=1,d.front=2,d.right=3;
		for(int i=0;i<n;i++){
			string S;
			cin >> S;
			int tmp=list[S];
			switch(tmp){
				case 1:
					d.North();
					sum+=d.UP();
					break;
				case 2:
					d.South();
					sum+=d.UP();
					break;
				case 3:
					d.West();
					sum+=d.UP();
					break;
				case 4:
					d.East();
					sum+=d.UP();
					break;	
				case 5:
					d.Left();
					sum+=d.UP();
					break;	
				case 6:
					d.Right();
					sum+=d.UP();
					break;	
				}
		}
	cout << sum << endl;
	}
	return 0; 
}

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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  string s, t;
  cin >> s >> t;
  int res = 0;
  rep(i, 3)if(s[i] == t[i])res++;
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long lint;

lint a[7];
lint z0,z1;

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

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


	z0 = (a[0]/2+a[3]/2+a[4]/2)*2ll;
	if(a[0]&&a[3]&&a[4]){
		a[0]--;
		a[3]--;
		a[4]--;
		z1 = (a[0]/2+a[3]/2+a[4]/2)*2ll + 3ll;
	}

	cout << a[1] + max(z0,z1) << endl;

	return 0;
}

Measured memory_bytes: 256