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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	string S;
	cin >> S;
	if (S.size()%2==1) {
		cen;
		return 0;
	}
	fx(S.size()-1) {
		if (!(S[x]=='h'&&S[x+1]=='i')) {
			cen;
			return 0;
		}
		x++;
	}
	cey;

    return 0;
}



Measured memory_bytes: 384
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	Scanner sc;

	void run() {

		boolean[] p = new boolean[1000000];

		Arrays.fill(p, true);
		p[0] = false;
		p[1] = false;

		for (int i = 0; i * i < 1000000; i++) {
			if (p[i]) {
				for (int j = i + i; j < 1000000; j += i) {
					p[j] = false;
				}
			}
		}

		int c = 0;
		for (int i = 0; i < 1000000; i++) {
			if (p[i]) {
				c++;
			}
		}
		int pt[] = new int[c];

		int ind = 0;
		for (int i = 0; i < 1000000; i++) {
			if (p[i]) {
				pt[ind] = i;
				ind++;
			}
		}

		for (;;) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			if ((a | b) == 0) {
				break;
			}

			int ka = 0;
			{
				int key = 0;
				int sum = 0;
				for (int i = 0; i < c && pt[i] <= a; i++) {
					if (a % pt[i] == 0) {
						sum += pt[i];
						key = pt[i];
					}
				}
				ka = key + key - sum;
			}
//			System.out.println(ka);
			int kb = 0;
			{
				int key = 0;
				int sum = 0;
				for (int i = 0; i < c && pt[i] <= b; i++) {
					if (b % pt[i] == 0) {
						sum += pt[i];
						key = pt[i];
					}
					kb = key + key - sum;
				}

			}
//			System.out.println(ka+ " " +kb);
			System.out.println(ka > kb ? "a" : "b");
		}
	}

	/**
	 * @param args
	 */

	Main() {
		sc = new Scanner(System.in);
		try {
			sc = new Scanner(new File(""));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			// e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}

Measured memory_bytes: 14000
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
	int K; cin >> K;
	
	int N = (1 << K);
	
	multiset<int,greater<int> > data;
	
	F0R(i, N) {
		int cur; cin >> cur; data.insert(cur);
	}
	//for(auto u:data) cout<<u<<endl;
	vi vals;
	vals.pb(*data.begin());
	data.erase(data.begin());
	
	F0R(iteration, K) {
		vi newVals;
		F0R(i, sz(vals)) {
			if (data.upper_bound(vals[i]) == data.end()) {
				cout << "No" << endl; return 0;
			}
			newVals.pb(*(data.upper_bound(vals[i])));
			data.erase(data.upper_bound(vals[i]));
		}
		
		F0R(i, sz(newVals)) {
			vals.pb(newVals[i]);
		}
		//sort(all(vals));
	}
	
	cout << "Yes" << endl; return 0;	
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343


Measured memory_bytes: 13984
s_a = input()
s_b = input()
s_c = input()
next_ = s_a[0]
s_a = s_a[1:]
for i in range(100**3):
  if next_ == 'a':
    if s_a == '':
      print('A')
      break
    next_ = s_a[0]
    s_a = s_a[1:]
  elif next_ == 'b':
    if s_b == '':
      print('B')
      break
    next_ = s_b[0]
    s_b = s_b[1:]
  else:
    if s_c == '':
      print('C')
      break
    next_ = s_c[0]
    s_c = s_c[1:]

Measured memory_bytes: 3064
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
	public static void main(String[] args) { 
		/*First ever A, last ever Z */
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		long x = I.nextLong();
		long ans = (x/11)*2; //Can always achieve 11 points/2 moves using 6,5 alternation
		x%=11;
		if (x>0) {
			x-=6;
			ans++;
		}
		if (x>0) {
			x-=5;
			ans++;
		} 
		O.pln(ans);
	}
	public static double max(double a, double b) {return Math.max(a, b);}
	public static double min(double a, double b) {return Math.min(a, b);}
	public static long min(long a, long b) {return Math.min(a,b);}
	public static long max(long a, long b) {return Math.max(a,b);}
	public static int min(int a, int b) {return Math.min(a,b);}
	public static int max(int a, int b) {return Math.max(a,b);}
	public static long abs(long x) {return Math.abs(x);}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return max(a,b);
		return GCD(min(a,b),max(a,b)%min(a,b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	public static int pop(long x) { //Returns number of bits within a number
		int cnt = 0;
		while (x>0) {
			if (x%2==1) cnt++;
			x/=2;
		}
		return cnt;
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
		double nextDouble() {return Double.parseDouble(next());}
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(double x) {w.println(x);w.flush();}
		void pln(boolean x) {w.println(x);w.flush();}
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void pln(BigInteger x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
		void p(BigInteger x) {w.print(x);w.flush();}
		void p(double x) {w.print(x);w.flush();}
		void p(boolean x) {w.print(x);w.flush();}
	}
}

Measured memory_bytes: 25540
module Main where

import Control.Applicative
import Text.Printf

getInt :: IO Int
getInt = head <$> getInts

getInts :: IO [Int]
getInts = map read . words <$> getLine

main :: IO ()
main = do
  { ss <- getInt
  ; let (q, s) = divMod ss 60
  ; let (h, m) = divMod q 60
  ; putStrLn (show h ++ ":" ++ show m ++ ":" ++ show s)
  }



Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll N = 1e9+7;
const int n_max = 1e5+10;

int main(){
    string s;cin >> s;
    int len = s.size();
    vector<int> sint(len);
    rep(i,len){
        int temp = s[i] - '0';
        sint[i] = temp;//'?'の時は15
    }
    // cout << '?' - '0' << endl;
    int dp[len+1][13] = {};//is small, length, あまり
    // dp[0][0] = 1;
    rep(i,len){
        if(!i){
            if(sint[i] > 9){
                rep(k,10){
                    dp[i+1][k] = 1;
                }
            }
            else dp[i+1][sint[i]] = 1;
            continue;
        }
        rep(j,13){
            if(sint[i] > 9){
                rep(k,10){
                    dp[i+1][(j * 10+k)%13] = (dp[i+1][(j * 10+k)%13] + dp[i][j]) %N;
                }
            }
            else{
                // cout << i << ' ' << j  << ' ' <<  (j*10+sint[i])%13  << ' ' << dp[i][j]  << ' ' << dp[i+1][(j*10+sint[i]) % 13]<< endl;
                dp[i+1][(j*10+sint[i])%13] = (dp[i+1][(j * 10+sint[i])%13] + dp[i][j]) %N;
            }
            // cout << i << ' ' << j  << ' ' <<  (j*10+sint[i])%13  << ' ' << dp[i][j]  << ' ' << dp[i+1][(j*10+sint[i]) % 13]<< endl;
        }
    }
    // if(!small){
    //     int temp = min(9,sint[i]);
    //     rep(k,temp){
    //         dp[i+1][(j * 10+k)%13] = (dp[i+1][(j * 10+k)/13] + dp[i][0][j]) %N;
    //     }
    //     dp[i+1][(j*10+temp)%13] = (dp[i+1][(j*10+temp)%13] + dp[i][0][j]) % N;
    // }
    // else{
    //     rep(k,10){
    //         dp[i+1][(j * 10+k)%13] = (dp[i+1][(j * 10+k)/13] + dp[i][1][j]) %N;
    //     }
    // }
    // rep(i,len+1){
    //     rep(j,13){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    cout << (dp[len][5]) % N << endl;
    return 0;
}

Measured memory_bytes: 6016
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
	fast_io 
	int a,b; cin>>a>>b;
	if(a<=9 and b<=9) cout<<a*b;
	else cout<<-1;
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()

r = [0] * n #n人目をリーダーとしたときに東を向かなければいけない人数
l = [0] * n #n人目をリーダーとしたときに西を向かなければいけない人数

r[0] = 0
l[-1] = 0
for i in range(1,n):
    r[i] = r[i-1] + (s[i-1]=='W')
    l[-i-1] = l[-i] + (s[-i]=='E')

ans = n

for i in range(n):
    ans = min(ans, r[i]+l[i])

print(ans)

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long d = sc.NextLong();
        long[] c = sc.LongArray();
        long[,] s = new long[d, 26];
        for (int i = 0; i < d; i++)
        {
            for (int j = 0; j < 26; j++)
            {
                s[i, j] = sc.NextLong();
            }
        }

        long[] last = new long[26];

        for (int i = 0; i < d; i++)
        {
            long maxDiff = long.MinValue;
            long answerIndex = 0;
            long secondDiff = long.MinValue;
            long secondIndex = 0;
            long nextMaxScore = 0;
            for (int j = 0; j < 26; j++)
            {
                long diff = 0;
                diff += s[i, j];
                diff += c[j] * (i + 1 - last[j]);
                if (diff > maxDiff)
                {
                    secondDiff = maxDiff;
                    maxDiff = diff;
                    secondIndex = answerIndex;
                    answerIndex = j;
                }
                if (i != d - 1 && s[i + 1, j] > nextMaxScore)
                {
                    nextMaxScore = s[i + 1, j];
                }
            }
            if ((i != d - 1) && (s[i + 1, answerIndex] > s[i, answerIndex] + 200) && (s[i + 1, answerIndex] == nextMaxScore))
            {
                answerIndex = secondIndex;
            }
            last[answerIndex] = i;
            Console.WriteLine(answerIndex + 1);
        }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

int gcb(int a,int b){
    if(b==0){
        return a;
    }
    return gcb(b,a%b);
}

int main(){
    int K;
    cin >> K;
    long long ans=0;
    if(K==1){
        cout << 1 <<endl;
        return 0;
    }
    if(K==2){
        cout << 9 << endl;
        return 0;
    }
    ans+=K*(K+1)/2;
    for(int i=1;i<K;i++){
        for(int j=i+1;j<K+1;j++){
            int r=gcb(i,j);
            ans+=6*r;
        }
    }
    for(int i=1;i<K-1;i++){
        for(int j=i+1;j<K;j++){
            for(int k=j+1;k<K+1;k++){
                int r=gcb(i,j);
                int m=gcb(r,k);
                ans+=6*m;
            }
        }
    }
    cout << ans;
    return 0;
}

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

int main() {
  ll N; cin >> N;
  vector<ll> A(N),S(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) {
    if (i == 0) S[i] = A[i];
    else S[i] = S[i-1] + A[i];
  }
  
  map<ll, ll> count;
  for (int i = 0; i < N; i++) count[S[i]]++;
  
  ll ans = count[0];
  for (auto i : count) ans += (i.second) * (i.second-1) / 2;
  
  cout << ans << endl;
}

Measured memory_bytes: 15872
N = input()
length = len(N)
n = int(N)
dic = {1:9,3:900,5:90000}
if length == 1:
    ans = n
elif length == 2:
    ans = 9
elif length == 3:
    ans = n - 90
elif length == 4:
    ans = 909
elif length == 5:
    ans = n - 9090
elif length == 6:
    ans = 90909
print(ans)
    

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;
const int INF = 1 << 25;
const LL MOD = 1000000007LL;
using namespace std;
typedef pair<int, int> P;
int T[100000];
int A[100000];
int h1[100000];
int h2[100000];
int c[100000];
int main() {
	int N;
	cin >> N;
	rep(i, N) cin >> T[i];
	rep(i, N) cin >> A[i];
	h1[0] = T[0];
	for (int i = 1; i < N; i++) {
		if (T[i - 1] < T[i]) h1[i] = T[i];
		else c[i] = T[i];
	}
	bool NG = 0;
	h2[N - 1] = A[N - 1];
	for (int i = N - 2; i >= 0; i--) {
		if (A[i + 1] < A[i]) h2[i] = A[i];
		else if (c[i] == 0) c[i] = A[i];
		else c[i] = min(c[i], A[i]);
	}
	LL ans = 1;
	rep(i, N) {
		bool NG = 0;
		NG |= (h1[i] != 0 && h2[i] != 0 && h1[i] != h2[i]);
		NG |= (h1[i] != 0 && h2[i] == 0 && c[i] < h1[i]);
		NG |= (h1[i] == 0 && h2[i] != 0 && c[i] < h2[i]);
		if (NG) {
			cout << 0 << endl;
			return 0;
		}
		if (h1[i] == 0 && h2[i] == 0) (ans *= c[i]) %= MOD;
	}
	cout << ans << endl;
}

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

int main() {
	int x;
	int result = 0;
	std::string S;
	std::cin >> x >> S;
	x = 0;
	std::for_each( S.begin(), S.end(), [&x, &result]( char& n ) {
		x += n == 'I' ? 1 : -1;
		result = result < x ? x : result;
	} );
	std::cout << result;

	return 0;
}

Measured memory_bytes: 256
# ABC 166 E - This Message Will Self-Destruct in 5s
# https://atcoder.jp/contests/abc166/tasks/abc166_e

# TLE
# https://atcoder.jp/contests/abc166/submissions/12768938

n = gets.chomp.to_i
a = gets.chomp.split(/ /).map(&:to_i)

class Person
  def initialize(index, height)
    @index = index
    @height = height
  end

  attr_reader :index, :height

  def index_minus_height
    @index_minus_height ||= index - height
  end

  def index_plus_height
    @index_plus_height ||= index + height
  end
end

people = a.map.with_index(1) { |height, i| Person.new(i, height) }

h_index_minus_height = Hash.new
h_index_plus_height = Hash.new

people.each do |person|
  h_index_minus_height[person.index_minus_height] ||= []
  h_index_plus_height[person.index_plus_height] ||= []

  h_index_minus_height[person.index_minus_height].push(person)
  h_index_plus_height[person.index_plus_height].push(person)
end

count = 0

h_index_minus_height.each do |index_minus_height, people_from_index_minus_height|
  people_from_index_plus_height = h_index_plus_height[index_minus_height]
  next if people_from_index_plus_height.nil?
  people_in_both_array = people_from_index_minus_height & people_from_index_plus_height
  count += people_from_index_minus_height.size * people_from_index_plus_height.size - people_in_both_array.size
end

puts count


Measured memory_bytes: 94044
#include <stdio.h>
int rot[5][7]={{0,1,2,3,4,5,6},{0,2,6,3,4,1,5},{0,4,2,1,6,5,3},{0,3,2,6,1,5,4},{0,5,1,3,4,6,2}};
int assign[7];
int tr['Z'];
void dice_init(int*a){
    int i;
    int t[5]={0,'N','E','W','S'};
    for(i=1;i<=6;i++)assign[i]=a[i];
    for(i=1;i<=4;i++)tr[t[i]]=i;}
    
char s[102];
int main (){
    int i,k1,k2;
    int a[7],dice[2][7];
    char*p;
    for(i=1;i<=6;i++)scanf("%d",a+i);
    dice_init(a);
    scanf("%s",p=s);
    for(i=1;i<=6;i++)dice[0][i]=rot[0][i];
    for(k1=0,k2=1;*p;k1=k2,k2=!k2){
        for(i=1;i<=6;i++)dice[k2][i]=dice[k1][rot[tr[*p]][i]];
        p++;
    }
    printf("%d\n",assign[dice[k1][1]]);
    return 0;
}


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

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define IN1(x) ll x; cin >> x;
#define OUT1(x) cout << x << endl;

// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int) (lower_bound(s, t, x) - s)
#define UB(s, t, x) (int) (upper_bound(s, t, x) - s)

ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1) ans = 1ll * ans * a % mo; a = 1ll * a * a % mo; } while (b >>= 1); return ans; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll temp = gcd(a, b); return temp ? (a / temp * b) : 0; }
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx8[] = { 1, -1, 0, 0, 1, 1, -1, -1 }, dy8[] = { 0, 0, -1, 1, -1, 1, -1, 1 };

template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) { return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...)); }
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }
// auto dp = make_v<int>(4, h, w);
// fill_v(dp, 0);

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

template <typename T>
vector<T> pows(int n) {
	vector<T> ret;
	T x = 1;
	while (ret.size() < n) {
		ret.push_back(x);
		x *= 10;
	}
	return ret;
}

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

inline tuple<ll, ll> rotate45(tuple<ll, ll> point) { ll x = get<0>(point), y = get<1>(point); return tuple<ll, ll>(x + y, x - y); }
inline bool rangeCheck2D(int nx, int ny, int Width, int Height) { return nx >= 0 and nx < Width and ny >= 0 and ny < Height; }

template <typename T>
void out(T o) { cout << o << endl; }
template <typename T>
void out(vector<T> &out) { REP(i, (int)out.size()) { cout << out[i]; if (i == (int)out.size() - 1) cout << endl; else cout << " "; } }



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

	IN1(N);
	ll n = N / 2;

	OUT1(n * (N-n));

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4


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

  int cnt = 0, max_cnt = 0; 
  for (int i=0;i<N;i++){
    set<char> L;
    cnt = 0;
    for (int j=0;j<N;j++){
      if (j<=i) L.insert(S[j]);
      else if (L.count(S[j])){
        cnt++;
        L.erase(S[j]);
      }
      
    }
    max_cnt = max(max_cnt, cnt);
  }

  cout << max_cnt << endl;

  return 0;
}

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

int main(void){
  int H, W;
  cin >> H >> W;
  char a[H][W];
  for (int i = 0; i<H; i++){
    for (int j = 0; j<W; j++) cin>>a[i][j];
  }
  for(int i = 0; i<H+2; i++){
    if (i == 0 || i == H+1){
      for (int j = 0; j<W+2; j++) cout <<"#"; 
    }
    else {
      for (int j = 0; j<W+2; j++){
        if (j == 0 || j == W+1){
          cout << "#";
        }
        else {
          cout << a[i-1][j-1];
        }
      }
    }
    cout << endl;
  }
    
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,q,i,j,c=0,t,start;
  
  scanf("%d",&n);
  int s[n];
  for(i=0;i<n;i++) scanf("%d",&s[i]);
  
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&t);
    start=0;
    for(j=start;j<n;j++){
      if(s[j]==t){c++;start=j;break;}
    }
  }
  printf("%d\n",c);
  return 0;
}



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

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

	vector<int> x(n), y(n), p(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		p[i] = i;
	}
	
	double sum = 0;
	
	do {	
		for (int i = 0; i < n - 1; i++) {
			double tmp;
			tmp = (double)((x[p[i + 1]] - x[p[i]]) * (x[p[i + 1]] - x[p[i]]) + (y[p[i + 1]] - y[p[i]]) * (y[p[i + 1]] - y[p[i]]));
			sum += sqrt(tmp);
		}
	} while (next_permutation(p.begin(), p.end()));

	int d = 1;
	for (int i = 1; i <= n; i++) d *= i;	

	cout << fixed << setprecision(11) << sum / d << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,a) repi(i,0,a)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define repit(i,a) for(__typeof((a).begin()) i=(a).begin();i!=(a).end();i++)

#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())

#define pb push_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

const int N = 1000000;

int p[N] = {1, 1}, a[N] = {};

void gen()
{
    for (int i = 2; i * i < N; ++i) {
        if (not p[i]) {
            for (int j = i * i; j < N; j += i) {
                p[j] = 1;
            }
        }
    }
    a[0] = 0;
    repi(i, 1, N) {
        a[i] = a[i - 1] + (1 - p[i]);
    }
}

int main()
{
    gen();

    int n;
    while (cin >> n and n) {
        int ans = a[2 * n] - a[n];
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 8972
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define int long long

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

// const int kMaxN;

string S;
int K;
char ans;

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

  REP(i, S.length()) {
    if (S[i] != '1') {
      ans = S[i];
      break;
    }
    if (i+1 == K) {
      ans = S[i];
      break;
    }
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;
using Graph = vector<vector<int>>;

int main(){
    int N;
    cin >> N;
    string S[N];
    REP(i,N) cin >> S[i];
    map<string,int> V;
    REP(i,N){
        if(V.count(S[i])) ++V[S[i]];
        else V[S[i]] = 1;
    }
    int ma = 0;
    for(auto x:V){
        int a = x.second;
        ma = max(ma,a);
    }
    for(auto x:V){
        int a = x.second;
        if(a==ma) cout << x.first << endl;
    }
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;
  while(N--){
	int x, y, b, p;
	cin >> x >> y >> b >> p;
	int ans = 1e9;
	REP(bb,10) REP(pp,10){
	  if(bb < b || pp < p) continue;
	  int cost = (x*bb + y*pp) * (bb>=5&&pp>=2? 0.8:1.);
	  mini(ans, cost);
	}
	cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 3148
#define INF 2000000001
#define ll long long int
 
#include<bits/stdc++.h>
using namespace std;
 
void input(ll a[], ll n)
{
    for(ll i = 0; i < n; i++)
        cin >> a[i];
}
 
void print(ll a[], ll n)
{
    for(ll i = 0; i < n; i++)
        cout << a[i] << ' ';
    cout << '\n';
}


bool pal(string s, int i, int j)
{
    string s1 = "";
    string s2 = "";
    for(int k = i; k <= j; k++)
        s1 += s[k];
    for(int k = j; k >= i; k--)
        s2 += s[k];
    return s1 == s2;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    string S;
    cin >> S;
    ll n = S.length();
    if(pal(S, 0, n - 1) && pal(S, 0, (n - 3)/2) && pal(S, (n + 1)/2, n - 1))
        cout << "Yes";
    else
        cout << "No";
    
    return 0;
}

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

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        long d = int.Parse(spl[1]);

        d = d*d;
        long co = 0;

        for(int i=0; i<n; i++) {
            spl = input.ReadLine().Split(' ');
            var a = long.Parse(spl[0]);
            var b = long.Parse(spl[1]);

            var x = a*a + b*b;
            if(x<=d) co++;
        }


        return co;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        if (n == 0) return ret;
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


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

int main(){
  int a,b;
  cin >>a;
  cin >>b;
  
  int c=0;
  int v=1;
  
  while(v<b){
    v=v-1+a;
    c++;
  }
  
  cout <<c<<endl;
  

}

Measured memory_bytes: 256
import java.util.*;


public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] p = new int[n];
        Arrays.setAll(p, i -> sc.nextInt());
        sc.close();
        
        int resa = x;
        for (int i = x; i <= 1000; i++) {
            boolean ok = false;
            for (int j = 0; j < n; j++) {
                if (p[j] == i) ok = true;
            }   
            if (ok) continue;
            else {
                resa = i;
                break;
            }
        }
        int resb = x;
        for (int i = x; i >= -1000; i--) {
            boolean ok = false;
            for (int j = 0; j < n; j++) {
                if (p[j] == i) ok = true;
            }
            if (ok) continue;
            else {
                resb = i;
                break;
            }
        }

        int res = x;
        if (resb >= 0) {
            if (Math.abs(x-resa) < Math.abs(x-resb)) {
                res = resa;
            } else if (Math.abs(x-resa) >= Math.abs(x-resb)) {
                res = resb;
            }
        } else {
            if (Math.abs(x-resa) < Math.abs(x+resb)) {
                res = resa;
            } else if (Math.abs(x-resa) >= Math.abs(x+resb)) {
                res = resb;
            }
        }
        System.out.println(res);
        
    }
}



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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	int n,k;
	cin>>n>>k;
	k--;
	string s;
	cin>>s;
	s[k]=tolower(s[k]);
	cout<<s<<endl;

	return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        // 入力
        var s = Console.ReadLine();
        var k = long.Parse(Console.ReadLine());

        var ans = '1';


        for (int i = 0; i < k; i++)
        {
            if (s[i] != '1')
            {
                ans = s[i];
                break;
            }
        }
        Console.WriteLine(ans);

    }

}


Measured memory_bytes: 13140
n = int(input())
list1 = [int(i)for i in input().split()]
pos = 1
cnt = 0
if list1.count(1)==0:
    print(-1)
else:
    for x in range(n):
        if pos==n:
            break
        if list1[x]==pos:
            pos+=1
        else:
            cnt+=1
    print(cnt)

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

typedef long long ll;
#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define int ll

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define ALL(s) (s).begin(),(s).end()
#define ALLn(s,n) s,s+n
#define F first
#define S second
#define pb push_back
#define tc(t) int t; cin >> t; while(t--)
#define _ ios_base::sync_with_stdio(false); cin.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }

const ll MOD = 1e9 + 7;
const ll MAXN = 1e6 + 7;
const ll INF = LONG_LONG_MAX;

vi rowcnt[300007];
int colcnt[300007];

multiset<int> s;

void update(int pos, int n) {
	s.erase(s.find(colcnt[pos]));
	colcnt[pos] += n;
	s.insert(colcnt[pos]);
}

void solve() {
	int h, w, m;
	cin >> h >> w >> m;

	F0R(i, m) s.insert(0);
	F0R(i, m) {
		int u, v;
		cin >> u >> v;

		u--, v--;

		rowcnt[u].pb(v);
		// colcnt[v]++;
		update(v, 1);
	}

	int ans = 0;

	for (auto x : rowcnt) {
		int sz = 0;
		sz = x.size();

		for (auto y : x) {
			update(y, -1);
		}

		sz += *s.rbegin();

		ans = max(ans, sz);

		for (auto y : x) {
			update(y, 1);
		}
	}

	cout << ans;
}

int32_t main() {
	_

#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif

	// tc(t)
	solve();
	cerr << "[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}


Measured memory_bytes: 36640
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

typedef long long ll;

const int nax = 2e5 + 5;
char sl[nax];
vector<int> w[nax];
int cnt[nax][2];
bool removed[nax];

pair<int,int> f(int a) {
	return make_pair( min(cnt[a][0], cnt[a][1]), a );
}

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	scanf("%s", sl);
	while(m--) {
		int a, b;
		scanf("%d%d", &a, &b);
		--a;
		--b;
		w[a].push_back(b);
		w[b].push_back(a);
		++cnt[a][sl[b]-'A'];
		++cnt[b][sl[a]-'A'];
	}
	set<pair<int,int>> secik;
	for(int a = 0; a < n; ++a) {
		secik.insert(f(a));
	}
	while(!secik.empty()) {
		debug() << imie(secik);
		pair<int,int> p = *secik.begin();
		if(p.first != 0) {
			break;
		}
		secik.erase(secik.begin());
		int a = p.second;
		assert(!removed[a]);
		removed[a] = true;
		secik.erase(f(a));
		debug() << "remove" imie(a);
		for(int b : w[a]) {
			if(removed[b]) {
				continue;
			}
			secik.erase(f(b));
			--cnt[b][sl[a]-'A'];
			secik.insert(f(b));
		}
	}
	puts(secik.size() ? "Yes" : "No");
}


Measured memory_bytes: 20992
#include <iostream>
using namespace std;
int main(void){
    int a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;
    
    if(a < b && b < c){
        cout << "Yes" << endl;
    }
    
    else{
        cout << "No" << endl;
    }
    return 0;
}



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

map<char, char> mp = {
  { 'A', 'T' },
  { 'C', 'G' },
  { 'G', 'C' },
  { 'T', 'A' },
};

int main(void) {
  char b;
  cin >> b;
  cout << mp[b] << endl;
}

Measured memory_bytes: 256
n, x = map(int, input().split())


def pi(n):
    return 2**(n+1)-1


def ai(n):
    return 2**(n+2) - 3


def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    else:
        if x <= 1:
            return 0
        elif (x <= 1 + ai(n-1)):
            return f(n - 1, x - 1)
        elif x == 2 + ai(n - 1):
            return pi(n - 1) + 1
        elif (2 + ai(n - 1) < x) and (x <= 2 + 2 * ai(n - 1)):
            return pi(n-1) + 1 + f(n-1, x-2-ai(n-1))
        elif x >= ai(n):
            return pi(n)


print(f(n, x))


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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#define INF numeric_limits<int>::infinity()
#pragma endregion


int main()
{
    int n;
    cin >> n;
    vi v;
    rep(i,n*2) {
        int a;
        cin >> a;
        v.push_back(a);
    }
    sort(v);
    int ans = 0;
    rep(i,v.size()) {
        if (i%2==0) ans += v[i];
    }
    P(ans);
    return 0;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)

	ws := make([]int,n)
	sum := 0
	for i := 0; i < n; i++ {
		var w int
		fmt.Scan(&w)
		ws[i] = w
		sum += w
	}

	s1 := ws[0]
	s2 := sum - s1
	abs := math.Abs(float64(s1) - float64(s2))
	for i := 1; i < n; i++ {
		s1 += ws[i]
		s2 = sum - s1
		tmpAbs := math.Abs(float64(s1) - float64(s2))
		if tmpAbs < abs {
			abs = tmpAbs
		}
	}
	fmt.Println(abs)
}

Measured memory_bytes: 512
// -_-
#include <bits/stdc++.h>
#define int long long
#define read(a) int a; cin >> a;
#define readarr(a, n) int a[(n) + 1] = {}; fori(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; fori(i, 1, n) {fori(j, 1, m) cin >> a[i][j];}
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for(int i = a; i <= b; i++)
#define ford(i, a, b) for(int i = a; i >= b; i--)
#define mod 1000000007
#define  sort1(v) sort(v.begin(), v.end()) 
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;

 
signed main() 
{

	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	read(n);
	int a[n+1], b[n+1], c[n+1];

	fori(i, 1, n) {cin >> a[i] >> b[i] >> c[i];}

	int dp[n+1][4];
	dp[1][1] = a[1]; dp[1][2] = b[1]; dp[1][3] = c[1];

	fori(i, 2, n)
	{
		dp[i][1] = a[i] + max(dp[i-1][2] ,dp[i-1][3]);
		dp[i][2] = b[i] + max(dp[i-1][1], dp[i-1][3]);
		dp[i][3] = c[i] + max(dp[i-1][1], dp[i-1][2]);
	}

	cout << max(dp[n][1], max(dp[n][2], dp[n][3]));
	return 0;
}

Measured memory_bytes: 5760
S = str(input())
mid = S[2:-1]
cnt = 0
if S[0] != "A":
    print("WA")
    exit()
for i in range(len(mid)):
    if mid[i] == "C":
        cnt += 1
        if cnt >= 2:
            print("WA")
            exit()
if cnt == 0:
    print("WA")
    exit()
jud_S = S.replace("A","").replace("C","")
if not jud_S.islower():
    print("WA")
    exit()
print("AC")

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

int main(){
  int N; cin >>N;
  int ans=0;

  for(int i=1; i<=N; i++){
    if(i<10) ans++;
    else if(i>99 && i<1000) ans++;
    else if(i>9999 && i<100000) ans++;
  }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>                
using namespace std;
int i,j,h,N;
string S;
long long march[8], answer;
int main(){
	cin >> N;
	for(i = 0; i < N; i++){
		cin >> S;
		if(S[0] == 'M') march[0]++;
		if(S[0] == 'A') march[1]++;
		if(S[0] == 'R') march[2]++;
		if(S[0] == 'C') march[3]++;
		if(S[0] == 'H') march[4]++;
	}

  for(i = 0; i < 5; i++){
		for(j = i+1; j < 5; j++){
			for(h = j+1; h < 5; h++){
				answer += march[i] * march[j] * march[h]; 
			}
		}
	}
	cout << answer << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a,b) make_pair(a,b)


//RUQ RMQ セグメント木
struct SegmentTree{
private:
	int n;
	vector<long long> nodes,lazy;
	vector<bool> lazyFlg;
public:
	void init(int N){ //初期化する O(N)
		nodes.clear();
		lazy.clear();
		n = 1;
		while(n < N) n *= 2;
		n = 2 * n -1;
		for(int i=0; i<n; i++){
			nodes.push_back((1LL<<31)-1);
			lazy.push_back(0);
			lazyFlg.push_back(false);
		}
	}
	void eval(int k, int l, int r){ //遅延評価を行う
		if(!lazyFlg[k]) return;
		nodes[k] = lazy[k];
		if(r-l > 1){
			lazy[2*k+1] = lazy[k];
			lazyFlg[2*k+1] = true;
			lazy[2*k+2] = lazy[k];
			lazyFlg[2*k+2] = true;
		}
		lazy[k] = 0;
		lazyFlg[k] = false;
	}
	void update(int a, int b, long long x){ //区間に対して値を変更する O(log N)
		update_query(a, b, x, 0, 0, n/2+1);
	}
	void update_query(int a, int b, long long x, int k, int l, int r){
		eval(k, l, r);
		if(r <= a || b <= l) return; //交差する場合
		if(a <= l && r <= b){ //完全に含む場合
			lazy[k] = x;
			lazyFlg[k] = true;
			eval(k, l, r);
			return;
		}
		update_query(a, b, x, 2*k+1, l, (l+r)/2);
		update_query(a, b, x, 2*k+2, (l+r)/2, r);
		nodes[k] = min(nodes[2*k+1], nodes[2*k+2]);
	}
	long long minimum(int a, int b){ //[a,b)の最小値を求める O(log N)
		return minimum_query(a, b, 0, 0, n/2+1);
	}
	long long minimum_query(int a, int b, int k, int l, int r){
		if(r <= a || b <= l) return 1LL<<62; //交差する場合
		eval(k, l, r);
		if(a <= l && r <= b) return nodes[k]; //完全に含む場合
		long long valueL = minimum_query(a, b, k*2+1, l, (l+r)/2);
		long long valueR = minimum_query(a, b, k*2+2, (l+r)/2, r);
		return min(valueL, valueR);
	}
	void print(){
		cout << "nodes" << endl;
		int sp = n;
		int nx = 0;
		for(int i=0; i<nodes.size(); i++){
			cout << nodes[i];
			for(int j=0; j<sp; j++) cout << " ";
			if(i == nx){
				nx = nx*2+2;
				sp /= 2;
				cout << endl;
			}
		}
		cout << "lazy" << endl;
		sp = n;
		nx = 0;
		for(int i=0; i<lazy.size(); i++){
			cout << lazy[i];
			for(int j=0; j<sp; j++) cout << " ";
			if(i == nx){
				nx = nx*2+2;
				sp /= 2;
				cout << endl;
			}
		}
		cout << endl;
	}
};

int main(){
	
	int n,q;
	cin >> n >> q;
	SegmentTree st;
	st.init(n);
	for(int i=0; i<q; i++){
		int t;
		cin >> t;
		if(t == 0){
			int a,b;
			LL x;
			cin >> a >> b >> x;
			b++;
			st.update(a, b, x);
		}
		else{
			int a,b;
			cin >> a;
			cout << st.minimum(a, a+1) << endl;
		}
		//st.print();
	}

	return 0;
}



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

int main() {
  int number, coin_count;
  string message;
  cin >> number >> coin_count;
  if (number % 500 <= coin_count) {
    message = "Yes";
  } else {
    message = "No";
  }
  cout << message << endl;
}

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

count = 0
for a in range(1,n):
  #a=1ならBはn-1通り
  #a=2ならBはint(n-1/2)通り
  #a=3ならBはint(n-1/3)
  count += int((n-1)/a)
print(count)

Measured memory_bytes: 63616