akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------

void solve(){
}
int main(){
    dbg = true;
    int n;
    cin >> n;
    vector<vector<int> >data(10, (vector<int> (10)));
    int num;
    for(int i = 1; i <= n; i++){
        data.at(to_string(i).at(0) - '0').at(to_string(i).at(to_string(i).size() - 1) - '0')++;
    }
    long long ans = 0;
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            ans += data.at(i).at(j) * data.at(j).at(i);
        }
    }
    cout << ans << endl;
    solve();
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

int main (void){
    int N;
    cin >> N;
    vector<int> v;
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        v.push_back(a);
    }
    int max_iter=0;
    for(int i=0; i<(int)v.size(); i++){
        if(v[i] > v[max_iter])
            max_iter = i;
    }
    int sum=0;
    for(int i=0; i<(int)v.size(); i++){
        if(i != max_iter)
            sum += v[i];
    }
    if(sum > v[max_iter])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

int main(int argc, char const* argv[])
{
	string s;
	cin >> s;
	LL ans = 0;
	for (LL i = 0; i < 1 << s.size() - 1; i++) {
		int left = 0;
		dump(i);
		for (int right = 0; right < s.size(); right++) {
			dump(right);
			if ((1 & i >> right) == 1) {
				dump(s.substr(left,right - left + 1));
				ans += stoll(s.substr(left,right - left + 1));
				left = right + 1;
			}
		}
		dump(s.substr(left,s.size()));
		ans += stoll(s.substr(left,s.size()));
	}

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


Measured memory_bytes: 256
import java.util.*;

public class Main {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int num = sc.nextInt();
            int x = sc.nextInt();
            int sum = 0;
            int count = 1;
            for(int i=0; i<num; i++){
                sum += sc.nextInt();
                if(sum <= x) count++;
            }
            System.out.println(count);
        }
    }

Measured memory_bytes: 21588
#include <iostream>
#include <numeric>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

inline int gcd(int a, int b){
  if(b<a) std::swap(a, b);
  int r = a % b;
  if(r==0) return b;
  while(r!=0) r = a % b, a = b, b = r;
  return a;
}

inline int read(){
	int x=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=x*10+c-'0';c=getchar();}
	return x*f;
}

int cnt[1000001];
int main(){
  int n = read();
  int num = read();
  int o = 0, g = num;
  if(num==1) o=1;
  int ex = (n-1)/16;
  cnt[num] = 1;

  for(int i=0;i<ex;i++){
    int num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;
  }

  for(int i=0;i<(n-1)%16;i++){
    int num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;
  }

  if(n - o > 80000){
    if(g==1) printf("setwise coprime\n");
    else printf("not coprime\n");
    return 0;
  }

  int max_S = 0;
  for(int i=2;i<=1000000;i++){
    int S = 0;
    for(int j=i;j<=1000000;j+=i) S += cnt[j];
    if(max_S<S) max_S = S;
  }
  if(max_S<2) printf("pairwise coprime\n");
  else if(max_S != n) printf("setwise coprime\n");
  else printf("not coprime\n");
}


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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define cAll(x) (x).cbegin(),(x).cend()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
//const int INF = INT64_MAX;
const int INF = INT_MAX;

template<typename T> inline constexpr auto sqr(T x) { return (x) * (x); }
inline void printd(double x) { printf("%.10lf\n", x); }
inline void upsort(VI& x) { sort((x).begin(), (x).end()); }
inline void downsort(VI& x) { sort((x).begin(), (x).end(), greater<int>()); }
inline int absdiff(int a, int b) { return (a - b)*(1|((a - b)>>(8*sizeof(int))));}

signed main()
{
	string S;
	cin >> S;

	if ((S[2] == S[3]) && (S[4] == S[5])) COL("Yes");
	else COL("No");
	

	return 0;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define prinrynl(a) printf(a ? "yes\n" : "no\n")
#define prinryn(a) printf(a ? "Yes\n" : "No\n")
#define prinrYN(a) printf(a ? "YES\n" : "NO\n")
#define prinrin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)
#define all(x) (x).begin(), (x).end()

using ll = long long;

const int INF = 2147483647;
const ll LINF = ll(9223372036854775807);

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>

using namespace std;

int ggd(int number1, int number2) {
	int m = number1;
	int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}

	while (m != n) {
		int temp = n;
		n = m - n;
		m = temp;
	}

	return m;
}

int lcm(int number1, int number2) {
	return number1 * number2 / ggd(number1, number2);
}

bool is_prime(int64_t x) {
	for (int64_t i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}
/*-----------------------------------------ここまでライブラリ-----------------------------------------*/



int main() {

	int a;
	char s[114514];
	scanf("%d%*c%s", &a, s);
	printf("%s\n", a >= 3200 ? s : "red");

	return 0;
}


Measured memory_bytes: 128
import std.string,
       std.stdio,
       std.conv;

void main() {
  int[] xab = readln.chomp.split.to!(int[]);
  int x = xab[0],
      a = xab[1],
      b = xab[2];

  int z = b - a;

  if (z <= 0) {
    writeln("delicious");
  } else if (0 < z && z <= x) {
    writeln("safe");
  } else {
    writeln("dangerous");
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector <int> X(M);
  for (int i = 0; i < M; i++) {
	  cin >> X[i];
	}
  sort(X.begin(), X.end());
  vector <int> d;
  for (int i = 0; i < M - 1; i++) {
	  d.push_back(X[i + 1] - X[i]);
	}
  sort(d.begin(), d.end());
  long long ans = 0;
  for (int i = 0; i < M - N; i++) {
	  ans += d[i];
	}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1276
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int n,w;
  	cin>>n>>w;
  	vector<int> weights(n);
  	vector<int> values(n);
  	for(int i =0;i<n;i++){
      cin>>weights[i]>>values[i];
    }
  	vector<vector<long long>> dp(w+1, vector<long long>(n, -1e9));
  
  	for(int i = 0;i<=w;i++){
      if(i<weights[0])
      	dp[i][0] = 0;
      else
    	dp[i][0] = values[0];
    }
  	for(int i =0;i<n;i++){
    	dp[0][i] = 0;
    }
  
    for(int j = 1;j<n;j++){
  		for(int i = 0;i<=w;i++){
          	dp[i][j] = dp[i][j-1];
          	if(i>=weights[j])
        		dp[i][j] = max(dp[i][j], values[j] + dp[i-weights[j]][j-1]);
        }
    }
  	cout<<dp[w][n-1]<<endl;
}

Measured memory_bytes: 84852
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000




int main(){
	
	int x1,x2,y1,y2;
	cin>>x1>>y1>>x2>>y2;
	
	int N;
	cin>>N;
	
	vector<int> X(N),Y(N);
	
	for(int i=0;i<N;i++){
		cin>>X[i]>>Y[i];
	}
	
	if(x1>x2){
		for(int i=0;i<N;i++){
			X[i] += (x1-X[i])*2;
		}
		x2 += (x1-x2)*2;
	}
	
	if(y1>y2){
		for(int i=0;i<N;i++){
			Y[i] += (y1-Y[i])*2;
		}
		y2 += (y1-y2)*2;
	}
	
	vector<pair<long long,long long>> P;
	for(int i=0;i<N;i++){
		if(X[i]>=x1&&X[i]<=x2&&Y[i]>=y1&&Y[i]<=y2){
			P.emplace_back(X[i],Y[i]);
		}
	}
	
	sort(P.begin(),P.end());
	
	vector<long long> V(N+1,Inf);
	V[0] = -Inf;
	
	for(int i=0;i<P.size();i++){
		long long y = P[i].second;
		int ok = 0;
		int ng = N+1;
		while(ng-ok>1){
			int mid = (ok+ng)/2;
			if(V[mid]<y)ok=mid;
			else ng=mid;
		}
		V[ok+1] = min(V[ok+1],y);
	}
	int cnt = 0;
	for(int i=0;i<V.size();i++){
		if(V[i]!=Inf){
			cnt = i;
		}
	}
	
	double ans = 0.0;
	double PI = acos(-1);
	ans += 100.0*((x2-x1)+(y2-y1));
	ans -= cnt * 20.0;
	ans += PI * 5 * cnt;
	if(cnt == y2-y1+1||cnt==x2-x1+1){
		ans += PI * 5;
	}
	
	cout<<fixed<<setprecision(20)<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 8048
s=input()
s=[str(c) for c in s]
x1=s[0::2]
x2=s[1::2]

l1=len(x1)
l2=len(x2)
k=0
for i in range(l1):
  if x1[i]=="R" or x1[i]=="U" or x1[i]=="D":
    k+=1
for i in range(l2):
  if x2[i]=="L" or x2[i]=="U" or x2[i]=="D":
    k+=1
if k==l1+l2:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 38384
/*
 *  author : Atul Anand   
 *  created on : Wed Apr 01 2020
 */

import java.io.*;
import java.util.*;

public class Main{

    public static void main(String[] args) throws IOException {
        int A1 = in.nextInt();
        int A2 = in.nextInt();
        int A3 = in.nextInt();
        if(A1 + A2 + A3 >= 22){
            println("bust");
        }
        else{
            println("win");
        }
        
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);

    static void read(int arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextInt(); 
    	} 
    }
    
    static void read(long arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextLong(); 
    	} 
    }
    
    static void read(String arr[], int N) throws IOException { 
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.next(); 
    	} 
    }
    
    static void print(Object O) {  
    	out.print(O); 
    }
    
    static void println(Object O) { 
    	out.println(O); 
    }
    
    static void println(int arr[]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		print(arr[i]+" "); 
    	} 
    	println(""); 
    }

    static void println(int arr[][]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		println(arr[i]); 
    	}
    }
    
    static void debug(Object O) { 
    	System.out.println(O); 
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
const double Pi = acos(-1);
int sx, sy, tx, ty, N;
struct node
{
	int x, y;
}A[200000 + 100];
int F[200000 + 100];
int Lis[200000 + 100], sum;
inline void LIS()
{
	Lis[1] = A[1].y;
	sum = 1;
	for (int i = 1; i <= N; ++i)
	{
		if (A[i].y > Lis[sum])
			Lis[++sum] = A[i].y;
		else 
		{
			int pos = lower_bound(Lis + 1, Lis + sum + 1, A[i].y) - Lis;
			Lis[pos] = A[i].y;
		}
	}
}
inline int cmp(node a, node b)
{
	return a.x < b.x;
}
int main()
{
	int fl = 1;
	scanf("%d%d%d%d%d", &sx, &sy, &tx, &ty, &N);
	if (sx > tx) swap(sx, tx),swap(sy, ty);
	if (sy > ty) fl = 0, sy = -sy, ty = -ty;
	double Ans = (abs(sx - tx) + abs(sy - ty)) * 100.0;
	int n = N;
	N = 0;
	for (int i = 1; i <= n; ++i)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		if (!fl) y = -y;
		if (x >= sx && x <= tx && y >= sy && y <= ty)
			A[++N].x = x, A[N].y = y;
	}
	if (N == 0)
	{
		printf("%.15lf", Ans);
		return 0;
	}
	if (sx == tx || sy == ty)
	{
		Ans =Ans - N * 20 + N * 10.0 * Pi;
		printf("%.15lf", Ans);
		return 0;
	}
	sort(A + 1, A + N + 1, cmp);
	LIS();
	Ans = Ans - sum * 20 + sum * 5 * Pi;
	if (sum == (min(abs(sx - tx), abs(sy - ty))) + 1)
			Ans += 5 * Pi;
	printf("%.15lf", Ans);
	return 0;
}

Measured memory_bytes: 2560
/*
 * author: Tran Minh Khoa
 * Ho Chi Minh University of Science
 */

#include <bits/stdc++.h>

using namespace std;

const int inf = (int) 1e9 + 7;
const long long INF = (long long) 1e18 + 7;

const int N = 123456;
const int M = 1010;
const int MOD = 1e9 + 7;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) (int) a.size()
#define all(a) a.begin(), a.end()
#define sqrt(x) (x) * (x)

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define DEBUG(x) cerr << #x << " = " << x << '\n';
#define PR(x, a, b) { cerr << #x << " = "; REP(i, a, b) cerr << x[i] << ' '; cerr << '\n'; }

#define x1 gg1
#define x2 wp1
#define x3 ggwp1


long long dp[M][5][5][5];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr); cout.tie(nullptr);

  int n;
  cin >> n;
  
  const int A = 0, G = 1, C = 2, T = 3;
  memset(dp, 0, sizeof dp);
  
  
  for (int x1 = 0; x1 < 4; x1++) {
    for (int x2 = 0; x2 < 4; x2++) {
      for (int x3 = 0; x3 < 4; x3++) {
        if (x1 == A && x2 == G && x3 == C) continue;
        if (x1 == A && x2 == C && x3 == G) continue;
        if (x1 == G && x2 == A && x3 == C) continue;
        dp[3][x1][x2][x3] = 1;
      }
    }
  }
  
  for (int i = 4; i <= n; i++) {
    for (int x2 = 0; x2 < 4; x2++) {
      for (int x3 = 0; x3 < 4; x3++) {
        for (int x4 = 0; x4 < 4; x4++) {
          for (int x1 = 0; x1 < 4; x1++) {
            if (x1 == A && x3 == G && x4 == C) continue;
            if (x2 == A && x3 == G && x4 == C) continue;
            if (x3 == A && x2 == G && x4 == C) continue;
            if (x2 == A && x4 == G && x3 == C) continue;
            if (x1 == A && x2 == G && x4 == C) continue;
            dp[i][x2][x3][x4] = (dp[i][x2][x3][x4] + dp[i - 1][x1][x2][x3]) % MOD;
          }
        }
      }
    }
  }


  long long result = 0;
  for (int x1 = 0; x1 < 4; x1++) {
    for (int x2 = 0; x2 < 4; x2++) {
      for (int x3 = 0; x3 < 4; x3++) {
        result = (result + dp[n][x1][x2][x3]) % MOD;
      }
    }
  }
  cout << result << '\n';
  return 0;
}


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

using namespace std;

vector<int>tree[10001];
vector<int>c;
int dist[10001];
vector<int> distinv[10001];
void bfs(){
queue<int>q;
q.push(1);
memset(dist,-1,sizeof(dist));
dist[1]=0;
while(!q.empty()){
    int cur=q.front();
    q.pop();
    for(int i=0;i<tree[cur].size();i++){
        if(dist[tree[cur][i]]==-1)
        {

          dist[tree[cur][i]]=dist[cur]+1;
          q.push(tree[cur][i]);}
    }
}






}
int main(void){
int n;
cin >> n;
for(int i=1;i<=n-1;i++){
    int a,b;
    cin >> a >> b;
    tree[a].push_back(b);
    tree[b].push_back(a);
}
int result[10001];
bfs();
for(int i=0;i<n;i++){
    int a;
    cin >> a;
    c.push_back(a);
}
sort(c.begin(),c.end());
for(int i=1;i<=n;i++){
    distinv[dist[i]].push_back(i);
}
int cur=0;
for(int i=10000;i>=0;i--){
    for(int j=0;j<distinv[i].size();j++){
        result[distinv[i][j]]=c[cur];
        cur++;
    }
}
int p=0;
for(int i=0;i<c.size()-1;i++){
    p+=c[i];
}
cout << p << "\n";
for(int i=1;i<=n;i++)
    cout << result[i] <<" ";
}



Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public long MOD = 1000000007;

        public void Run()
        {
            N = Input.ReadInt();
            int[] M = Input.ReadIntArray();

            int tot = M.Sum();
            int s = 0;
            int ret = Int32.MaxValue;;
            for (int i = 0; i < N; i++)
            {
                s += M[i];
                ret = Math.Min(ret, Math.Abs((tot - 2 * s)));
            }

            Console.WriteLine(ret);
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a,b,c;
	cin >> a >> b >> c;
	vector<vector<int>>dp(n,vector<int>(3));

	dp[0][0]=a;dp[0][1]=b;dp[0][2]=c;
	for(int i=1;i<n;i++){
	cin >> a >> b >> c;
	dp[i][0]=a+max(dp[i-1][1],dp[i-1][2]);
	dp[i][1]=b+max(dp[i-1][0],dp[i-1][2]);
	dp[i][2]=c+max(dp[i-1][0],dp[i-1][1]);
	}
	cout << max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
}

Measured memory_bytes: 5760
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i = 0;i < n; i++)
#define REP(i,n) for(int i = 1;i <= n; i++)
// ----GCC ONLY---- //
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// ----        ---- //
#define ll long long
#define MOD 10000007
#define PB push_back

using namespace std;



int main(){

    string s;
    cin >> s;
    int n = s.size();

    int ans = 0;

    rep(i,n){

        if(s[i] != s[n  - 1 - i]) ans ++;
    }

    cout << ans / 2 <<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int k = Integer.parseInt(in.readLine());
    int x = Integer.parseInt(in.readLine());
    int y = Integer.parseInt(in.readLine());
    System.out.println(n>=k?k*x+(n-k)*y:n*x);
  }
}

Measured memory_bytes: 32468
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000



int main(){
	
	int N,M;
	cin>>N>>M;
	
	priority_queue<int> Q;
	
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		Q.push(a);
	}
	
	for(int i=0;i<M;i++){
		int a = Q.top();
		Q.pop();
		a/=2;
		Q.push(a);
	}
	
	long long ans = 0;
	
	while(Q.size()!=0){
		long long a = Q.top();
		Q.pop();
		ans += (long long)a;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;
int main(){
  ll n,d; cin >> n >> d;

  ll ans = 0;

  rep(i,n){
    ll x,y;
    cin >> x >> y;
    if(d*d >= x*x + y*y) ans++;
  }

  cout << ans << endl;

}


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}


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

const ll MAX_N = 1e5;
ll N;
ll a[MAX_N], b[MAX_N], c[MAX_N];
ll dp[MAX_N + 1][3];
int main(){
  cin >> N;
  REP(i, N){
    cin >> a[i] >> b[i] >> c[i];
  }
  dp[0][0] = dp[0][1] = dp[0][2] = 0;
  REP(i, N){
    dp[i + 1][0] = max(dp[i][1], dp[i][2]) + a[i];
    dp[i + 1][1] = max(dp[i][0], dp[i][2]) + b[i];
    dp[i + 1][2] = max(dp[i][0], dp[i][1]) + c[i];
  }
  cout << max({dp[N][0], dp[N][1], dp[N][2]}) << endl;
}


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

void solve()
{
  int N;
  cin >> N;
  string S, T;
  cin >> S >> T;
  string ans = "";
  rep(i, N){
      ans += S[i];
      ans += T[i];
  }
  cout << ans;
}
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(11);
  solve();
  return 0; 
}


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

#define int long long
#define all(v) begin(v), end(v)
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,b) FOR(i,0,b)

int x,y;
signed main(){
  cin>>x>>y;
  cout<<(x+y)%24<<endl;

  return 0;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.buffer.readline

n, m, q = map(int, input().split())

counts = [[0 for _ in range(n+1)] for _ in range(n+1)]
for _ in range(m):
    l, r = map(int, input().split())
    counts[l][r] += 1

s = [[0 for _ in range(n+1)] for _ in range(n+1)]
# 横方向
for i in range(n+1):
    v = 0
    for j in range(n+1):
        v += counts[i][j]
        s[i][j] = v
# 縦方向
cs = [[0 for _ in range(n+1)] for _ in range(n+1)]
for i in range(n+1):
    v = 0
    for j in range(n+1):
        v += s[j][i]
        cs[j][i] = v


ans = []
for i in range(q):
    p, q = map(int, input().split())
    t = 0
    for i in range(p, q+1):
        t += s[i][q] - s[i][p-1]
    ans.append(str(t))
print("\n".join(ans))

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

int main(){
  vector<int> v(26);
  ios::sync_with_stdio(false);
  // string str;
  // getline(cin, str);
  // for(char c : str){
  char c;
  while(cin >> c){
    if((int)c >= (int)'A' && (int)c <= (int)'Z'){
      v[(int)c - (int)'A']++;
    } else if ((int)c >= (int)'a' && (int)c <= (int)'z'){
      v[(int)c - (int)'a']++;
    }
  }
  for(int i = 0; i < v.size(); i++){
    cout << (char)(i + (int)'a') << " : " << v[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 1176
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int a,b; cin>>a>>b;
    if(b%a==0) cout<<a+b<<endl;
    else cout<<b-a<<endl;
}


Measured memory_bytes: 3620
#include<stdio.h>
int main(){
  int n,a[101],x=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;k<n;k++){
        if(a[i]==a[j]||a[j]==a[k]||a[k]==a[i]){}
        else{
          if(a[i]+a[j]>a[k]&&a[j]+a[k]>a[i]&&a[k]+a[i]>a[j]){
          x++;
          }
        }
      }
    }
  }
      printf("%d\n",x);
}

Measured memory_bytes: 1692
use io::*;

fn main() {
    let con = read_string();
    let mut sc = Scanner::new(&con);

    let a: i32 = sc.next();
    let b: i32 = sc.next();

    let ans = if a <= 8 && b <= 8 { "Yay!" } else { ":(" };

    println!("{}", ans);
}

//-----

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


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

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double eps = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1};

int main() {
	int e;
	while (cin >> e, e) {
		int ans = inf;
		for (int z = 0; z * z * z <= e; ++z) {
			int y = floor(sqrt(e - z * z * z));
			ans = min(ans, (e - (y * y + z * z * z)) + y + z);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
from bisect import bisect
s = input()
t = input()
def ctoi(c):
	return ord(c) - ord("a")
if not (set(s) >= set(t)):
	print(-1)
else:
	alph = [[] for _ in range(26)]
	for i in range(len(s)):
		alph[ctoi(s[i])].append(i)
	for a in alph:
		if a:
			a.append(a[0] + len(s))
	cur = len(s)-1
	ans = 0
	for i in range(len(t)):
		ind = bisect(alph[ctoi(t[i])], cur)
		ans += alph[ctoi(t[i])][ind] - cur
		cur = alph[ctoi(t[i])][ind] % len(s)
	print(ans)

Measured memory_bytes: 7540
#pragma region GNUC
//以下を参考にした
//https://yukicoder.me/wiki/auto_vectorization
#ifdef __GNUC__
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#endif
#pragma endregion

#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>

#include <string>
#include <cstring>
#include <vector>
#include <valarray>
//#include <array>//x C++ (G++ 4.6.4)

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <cassert>//assert();
#include <fstream>
#include <random>
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)

/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#define PII pair<int,int>
/////////
using namespace::std;

// 最大公約数
template<class T>
inline T gcd(T a, T b){return b ? gcd(b, a % b) : a;}
//inline T gcd(T a, T b){return b == 0 ? a : gcd(b, a % b);}

// 最小公倍数
template<class T>
inline T lcm(T a, T b){return a / gcd(a, b) * b;}
//inline T lcm(T a, T b){return a * b / gcd(a, b);}
////////////////////////////////

void solve(){
	set<int> pSet;
	for(int i=0;i<3;++i){
		int c;
		cin >> c;
		pSet.insert(c);
	}
	cout << pSet.size();
}

signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	//std::cout << std::fixed;//小数を10進数表示
	//cout << setprecision(16);//小数点以下の桁数を指定
	
	solve();
}


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

using namespace std;

int main(){
    string T;
    cin >> T;
    string ans = "";
    

    for(long long i=0; i<T.size(); ++i){
        if(i == 0){
            if(T[i] == '?'){
                if(T.size() == 1){
                    ans += "D";
                }else{
                    if(T[i+1] == 'P'){
                        ans += "D";
                    }else{
                        ans += "P";
                    }
                }
            }else{
                ans += T[i];
            }
        }else if(i == T.size()- 1){
            if(T[i] == '?'){
                if(ans[i-1] == 'P'){
                    ans += "D";
                }else{
                    ans += "D";
                }
            }else{
                ans += T[i];
            }
        }else{
            if(T[i] == '?'){
                if(ans[i-1] == 'P' || T[i+1] == 'P'){
                    ans += "D";
                }else{
                    ans += "P";
                }
            }else{
                ans += T[i];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3924
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    long long fib[50];
    fib[0]=1; fib[1]=1;
    for (int i=2; i<=n; i++) fib[i]=fib[i-1]+fib[i-2];
    cout<<fib[n]<<'\n';
    return 0;
}



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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    ll x;
    cin >> x;
    ll now = 100;
    ll ans = 0;
    for(ans = 0; now < x; ans++) {
        now *= 1.01;
    }
    cout << ans << endl;
    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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


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

int main(void)
{
	char s[6];
	int i;
	for(i=0;i<6;i++)
		scanf("%c",&s[i]);
	if(s[2]==s[3]&&s[4]==s[5])
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,k; cin>>n>>k;
	vector<int> p(n);
	for (int i=0; i<n; i++)
		cin>>p[i];
	sort (p.begin(),p.end());
	int ret=0;
	for (int i=0; i<k; i++)
		ret+=p[i];
	cout<<ret<<endl;
	return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,n;
	cin>>a>>b>>c>>n;
	int ans=0;
	for(int i=0;i<=a;i++)
		for(int j=0;j<=b;j++)
			for(int k=0;k<=c;k++)
				if(i*500+j*100+k*50==n)ans++;
	cout<<ans<<endl;
	return 0;
 } 

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

using namespace std;
using ll = long long int;

int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;

  ll ans = 0;
  for (ll i = 1; i < n - 1; i++) {
    char mid = s[i];
    ll sum = 0;
    ll before_r = 0;
    ll before_g = 0;
    ll before_b = 0;
    ll after_r = 0;
    ll after_g = 0;
    ll after_b = 0;

    for (ll j = 0; j < n; j++) {
      if (s[j] == 'R') {
        if (j < i) {
          before_r += 1;
        } else if (i < j) {
          after_r += 1;
        }
      } else if (s[j] == 'G') {
        if (j < i) {
          before_g += 1;
        } else if (i < j) {
          after_g += 1;
        }
      } else if (s[j] == 'B') {
        if (j < i) {
          before_b += 1;
        } else if (i < j) {
          after_b += 1;
        }
      }
    }

    if (mid == 'R') {
      sum += (before_g * after_b);
      sum += (before_b * after_g);
    } else if (mid == 'G') {
      sum += (before_r * after_b);
      sum += (before_b * after_r);
    } else if (mid == 'B') {
      sum += (before_g * after_r);
      sum += (before_r * after_g);
    }
    for (ll j = 0; j < n; j++) {
      if ((n - 1) < (i + j) || 0 > (i - j)) {
        break;
      }
      if (s[i + j] != s[i - j] && s[i + j] != mid && s[i - j] != mid) {
        sum -= 1;
      }
    }

    ans += sum;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <sstream>
#include <map>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define PB push_back
#define F first
#define S second
typedef pair<char,string> P;
map<char,string> ma1;
vector<P> v;
vector<vector<P> > vv(10);
int main(){
	string aaa="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
	rep(i,aaa.size()){
		string t="00000";
		rep(j,5){
			t[4-j]=(i>>j)&1;
			t[4-j]+='0';
		}
		ma1[aaa[i]]=t;
		// cout<<aaa[i]<<" "<<ma1[aaa[i]]<<endl;
	}
	// char tmp=' ';
	string tmp="'";
	v.PB(P(' ',"101"));
	v.PB(P(tmp[0],"000000"));
	v.PB(P(',',"000011"));
	v.PB(P('-',"10010001"));
	v.PB(P('.',"010001"));
	v.PB(P('?',"000001"));
	v.PB(P('A',"100101"));
	v.PB(P('B',"10011010"));
	v.PB(P('C',"0101"));
	v.PB(P('D',"0001"));
	v.PB(P('E',"110"));
	v.PB(P('F',"01001"));
	v.PB(P('G',"10011011"));
	v.PB(P('H',"010000"));
	v.PB(P('I',"0111"));
	v.PB(P('J',"10011000"));
	v.PB(P('K',"0110"));
	v.PB(P('L',"00100"));
	v.PB(P('M',"10011001"));
	v.PB(P('N',"10011110"));
	v.PB(P('O',"00101"));
	v.PB(P('P',"111"));
	v.PB(P('Q',"10011111"));
	v.PB(P('R',"1000"));
	v.PB(P('S',"00110"));
	v.PB(P('T',"00111"));
	v.PB(P('U',"10011100"));
	v.PB(P('V',"10011101"));
	v.PB(P('W',"000010"));
	v.PB(P('X',"10010010"));
	v.PB(P('Y',"10010011"));
	v.PB(P('Z',"10010000"));
	rep(i,v.size()){
		vv[v[i].S.size()].PB(v[i]);
	}

	string s;
	while(getline(cin,s)){
		string t;
		rep(i,s.size()){
			t=t+ma1[s[i]];
		}
		// cout<<t<<endl;
		int pos=0;
		string ans;
		
		rep(i,t.size()){
			rep(j,vv[i-pos+1].size()){
				if(t.substr(pos,i-pos+1)==vv[i-pos+1][j].S){
					string ts="1";
					ts[0]=vv[i-pos+1][j].F;
					ans=ans+ts;
					pos=i+1;
					break;
				}
			}
		}
		
		cout<<ans<<endl;
	}

}


/*
101 ' '
110 E
111 P

0101 C
0001 D
0111 I
0110 K
1000 R

01001 F
00101 O
00100 L
00110 S
00111 T

000000 '
000011 ,
010001 .
000001 ?
100101 A
010000 H
000010 W















*/

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

long long mod = 1000000007LL;

long long dp(long long x){
	if(x == 1) return 1LL;
	
	return 2 * dp(x/2) + 1;
}

int main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	long long h; cin >> h;
	cout << dp(h);
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int n;
    string s;
    int ans=0;
    cin>>n>>s;
    bool a[10],b[100],c[1000];
    m0(a);
    m0(b);
    m0(c);
    for (int i = 0; i < n; i++)
    {
        int num=s[i]-'0';
        for (int j = 0; j < 100; j++)
        {
            if(b[j]==true)
            {
                c[j*10+num]=true;
            }
        }
        for (int j = 0; j < 10; j++)
        {
            if(a[j]==true)
            {
                b[j*10+num]=true;
            }
        }
        a[num]=true;
    }
    for (int i = 0; i < 1000; i++)
    {
        if(c[i]==true)
        {
            ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}

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

namespace ConsoleApp12
{
    class Program
    {
        static void Main(string[] args)
        {
            var A = Console.ReadLine().Split(' ');
            int a = int.Parse(A[0]);
            int b = int.Parse(A[1]);
            int c = int.Parse(A[2]);
            var x = new List<int>();
            
            for(int d=a; d<=b; d++)
            {
                if(c%d == 0)
                {
                    x.Add(d);
                }
            }
            int y = x.Count;
            Console.WriteLine(y);
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 9216
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>

int main(){
  long long int A, B;
  scanf("%lld%lld", &A, &B);
  
  if(A >= 10 || B >= 10){
    std::cout << -1 << std::endl;
  }
  else{
    std::cout << A*B << std::endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [x for x in map(int, input().split())]
B = [x for x in map(int, input().split())]

count = 0
for n in range(N):
  if A[n] <= B[n]:
    count += A[n]
    B[n] -= A[n]
    if A[n+1] <= B[n]:
      count += A[n+1]
      A[n+1] = 0
    else:
      count += B[n]
      A[n+1] -= B[n]
  else:
    count += B[n]
    
print(count)

Measured memory_bytes: 19156
import fractions

a, b, c, d = map(int, input().split())

# 割り切れる数を探す


left_c = (a - 1) // c
right_c = b // c

c_count = right_c - left_c

left_d = (a - 1) // d
right_d = b // d

d_count = right_d - left_d


lcm_cd = int(c * d / fractions.gcd(c, d))

left_cd = (a - 1) // (lcm_cd)
right_cd = b // (lcm_cd)

cd_count = right_cd - left_cd

print(b - a + 1 - (c_count + d_count - cd_count))



Measured memory_bytes: 5244
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
const long long INF = 1LL << 60;
using namespace std;
int n;
map<string, ll> mp;

void shiftX(vector<string> &s)
{
    rep(i, n)
    {
        s[i] = s[i].substr(1) + s[i][0];
        // cerr << s[i].size() << endl;
    }
}
void shiftY(vector<string> &s)
{
    string tmp = s[0];
    rep(j, n - 1)
    {

        s[j] = s[j + 1];
    }
    s.back() = tmp;
}

void add(vector<string> &s)
{
    string key = "";
    rep(i, n)
    {
        key += s[i];
    }
    //cerr << key << endl;
    mp[key]++;
}

int main(int argc, char const *argv[])
{
    cin >> n;
    vector<string> s(n, "");
    rep(i, n) cin >> s[i];
    ll ans = 0;

    rep(i, n)
    {

        shiftX(s);
        bool flag = true;
        rep(x, n) rep(y, n)
        {
            if (s[x][y] != s[y][x])
            {
                flag = false;
            }
        }
        if (flag)
        {
            ans += n;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
// AtCoder template
// sabaより胡蝶しのぶさんの方が可愛いのではないか？
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; ++i)

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

    string s,t; cin >> s >> t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end()); reverse(t.begin(),t.end());
    if(s < t) cout << "Yes" << endl;
    else cout <<"No" << endl;
}

Measured memory_bytes: 256
#coding:utf-8

ope = ["+","-","*"]

string = list(input().split())
num_list = []
for num in string:
    if num in ope:
        b = int(num_list.pop())
        a = int(num_list.pop())
        if num == "+":
            num_list.append(a+b)
        if num == "-":
            num_list.append(a-b)
        if num == "*":
            num_list.append(a*b)
    else:
        num_list.append(num)

print(num_list[0])



Measured memory_bytes: 5604
n = int(input())
a = [int(S) for S in input().split()]
c = 0
for x in range(n):
  if a[x] < 0:
    a[x] *= -1
    c += 1
    
ans = sum(a)

if c % 2 == 1:
  ans -= 2*min(a)

print(ans)

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	int n, m;
	cin >> n >> m;
	priority_queue<long long> q;

    for (int i = 0; i < n; i++) {
    	int x; cin >> x;
    	q.push(x);
    }
     
    while (m--) {
    	long long value = q.top();
    	q.pop();
    	q.push(value / 2);
    }
    long long ans = 0;
    while(!q.empty()) {
        ans += q.top();
        q.pop();
    }
    cout << ans << "\n";
    return 0;
}

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

int main() {
    int h, w, si, sj, ti, tj;
    cin >> h >> w >> si >> sj >> ti >> tj;
    si--;
    sj--;
    ti--;
    tj--;
    vector<string> s(h);
    for (int i = 0; i < h; i++) {
        cin >> s.at(i);
    }
    const int infty = 1e9;
    vector<vector<int>> dist(h, vector<int>(w, infty));
    deque<pair<int, int>> q;
    const vector<int> dx = {0, 1, 0, -1};
    const vector<int> dy = {1, 0, -1, 0};
    dist.at(si).at(sj) = 0;
    q.emplace_back(si, sj);

    while (!q.empty()) {
        int i = q.front().first;
        int j = q.front().second;
        q.pop_front();
        int d = dist.at(i).at(j);
        for (int v = 0; v < 4; v++) {
            int ni = i + dx.at(v);
            int nj = j + dy.at(v);
            if (ni < 0 || ni >= h || nj < 0 || nj >= w) {
                continue;
            }
            if (s.at(ni)[nj] == '#') {
                continue;
            }
            if (dist.at(ni).at(nj) <= d) {
                continue;
            }
            dist.at(ni).at(nj) = d;
            q.emplace_front(ni, nj);
        }
        for (int ei = -2; ei <= 2; ei++) {
            for (int ej = -2; ej <= 2; ej++) {
                int ni = i + ei;
                int nj = j + ej;
                if (ni < 0 || ni >= h || nj < 0 || nj >= w) {
                    continue;
                }
                if (s[ni][nj] == '#') {
                    continue;
                }
                if (dist.at(ni).at(nj) <= d + 1) {
                    continue;
                }
                dist.at(ni).at(nj) = d + 1;
                q.emplace_back(ni, nj);
            }
        }
    }
    int ans = dist.at(ti).at(tj);
    if (ans == infty) {
        ans = -1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9564