akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

typedef pair<int, int> P;
int main() {
    int n;
    cin>>n;
    vector<int> w(n);
    rep(i,n){
        cin>>w[i];
    }
    rep11(i,n){
        w[i]+=w[i-1];
    }
    int mi=1002000007;
    rep(i,n-1){
        mi=min(mi,abs((w[n-1]-w[i])-w[i]));
    }
    cout<<mi<<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
#include <chrono>
#include <iomanip>
#include <utility>
#include <assert.h>
 
#pragma GCC optimize("Ofast")
#pragma target("sse", "sse1")
 
#define mp make_pair
#define pb push_back
 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
 mt19937 gen(34);

int n, h[100000], dp[100000];

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
//	freopen("memory.in", "r", stdin);
//	freopen("memory.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> h[i];
	dp[n - 1] = 0;
	for(int i = n - 2; i >= 0; i--)
		if(h[i] >= h[i + 1])
			dp[i] = 1 + dp[i + 1];
		else
			dp[i] = 0;
	int ans = 0;
	for(int i = 0; i < n; i++)
		ans = max(ans, dp[i]);
	cout << ans;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
 
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    long n = sc.nextLong();
    long[] array = new long[5];
    for (int i=0; i<array.length; i++) {
      array[i] = sc.nextLong();
    }
    
    long min_move = array[0];
    for (int i=1; i<array.length; i++) {
      if (array[i] < min_move) {
        min_move = array[i];
      }
    }
    
    long result = 4L;
    result += (long)n/min_move;
    if (n % min_move != 0) {
    	result += 1L;
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 22100
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class  Main{
   static   Integer arr[];
   static int b[];
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;


        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                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());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {
        FastReader sc = new FastReader();
        String s=sc.next();
        if ( s.contains("7") )
        {
            System.out.println("Yes");
        }else System.out.println("No");



    }
}

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

namespace B___Choose_Integers
{
    class Program
    {
        static void Main(string[] args)
        {
            var A_B_C = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int A = A_B_C[0], B = A_B_C[1], C = A_B_C[2];
            int sum = -C, count = 0;

            while (count < B)
            {
                sum += A;

                if (sum % B == 0)
                {
                    Console.WriteLine("YES");
                    return;
                }
                count++;
            }
            Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 13396
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

void main()
{
    char A, B;
    scan(A, B);
    writeln((A == B) ? "H" : "D");
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

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

ll dp[10000];
ll p[4];
ll t[4];
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	ll N; scanf("%lld", &N);
	for (ll i = 0; i < 10000; i++) dp[i] = INF;
	dp[0] = 0;
	for (ll i = 0; i < 4; i++) scanf("%lld", &p[i]);
	for (ll i = 0; i < 4; i++) scanf("%lld", &t[i]);
	for (ll i = 0; i < 4; i++) {
		for (ll j = 0; j <= N; j++) {
			chmin(dp[min(j + t[i], N)], dp[j] + p[i]);
		}
	}
	printf("%lld\n", dp[N]);
	return 0;
}


Measured memory_bytes: 3304
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]

x, y = map(int, input().split())
ans = "No"
for group in [A, B, C]:
  if x in group and y in group:
    ans = "Yes"
print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
const int size = 100010;

ll knapsack[110][size];
ll weight[size];
ll value[size];

ll dp(ll n, ll w, ll wNow, ll nNow)
{
    if(nNow > n)
        return 0;
    if(knapsack[nNow][wNow] != -1)
        return knapsack[nNow][wNow];
    if(wNow + weight[nNow] > w)
        return knapsack[nNow][wNow] = dp(n, w, wNow, nNow + 1);
    else
        return knapsack[nNow][wNow] = max(value[nNow] + dp(n, w, wNow + weight[nNow], nNow + 1), dp(n, w, wNow, nNow + 1));
}


int main(){
    ll w, n;
    cin >> n >> w;
    memset(knapsack, -1, sizeof(knapsack));
    for(ll i = 0; i < n; i++)
        cin >> weight[i] >> value[i];
    /*
    ll maxCount = -1;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            if(maxCount < knapsack[i][j])
                maxCount = knapsack[i][j];
    */
    cout << dp(n, w, 0, 0) << endl;
    return 0;
}


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

int main(){
  long long i,n,k,ans=0;cin>>n>>k;
  i=n/k;
  ans=i*i*i;
  if(!(k%2)){
    i=(n+k/2)/k;
    ans+=i*i*i;
  }
  cout<<ans;
}

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

int f(int n, int v, int count, vector<bool> &passed, vector< forward_list<int> > &side)
{
  if (count == n) return 1;
  
  int sum = 0;
  passed[v] = true;
  for (auto itr = side[v].begin(); itr != side[v].end(); ++itr)
    if (!passed[*itr]) sum += f(n, *itr, count+1, passed, side);
  passed[v] = false;
  
  return sum;
}

int main()
{
  int n, m;
  cin >> n >> m;
  vector< forward_list<int> > side(n);
  for (int i = 0; i < m; ++i)
  {
    int a, b; cin >> a >> b; --a; --b;
    side[a].push_front(b);
    side[b].push_front(a);
  }
  
  vector<bool> passed(n, false);
  passed[0] = true;
  cout << f(n, 0, 1, passed, side) << endl;
}

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

int main(){
  int a,b,c,d;
  cin >> a>>b>>c>>d;
  int l =max(abs(a-b),abs(b-c));
  if(min(l,abs(a-c)) <= d) cout <<"Yes"<<endl;
  else cout << "No"<<endl;
}

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

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

const int N = int(1e5) + 2;
const int LG = 20;
const ll mod = 998244353;
const int INF = 2147483647;
const ll linf = 1e18;
const ld pi = acos(-1);
const ld EPS = 1e-10;

int n, m, used[1005][1005], d[1005][1005], timer;
char a[1005][1005];
int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m;
    queue < pii > q;
    memset (d, -1, sizeof(d));
    for (int i = 1; i <= n; ++i){
        for (int j = 1; j <= m; ++j){
            cin >> a[i][j];
            if (a[i][j] == '#'){
                d[i][j] = 0;
                q.push({i, j});
            }
        }
    }
    while (!q.empty()){
        int x = q.front().fi, y = q.front().se;
        q.pop();
        if (x + 1 <= n && d[x + 1][y] == -1){
            d[x + 1][y] = d[x][y] + 1;
            q.push({x + 1, y});
        }
        if (y + 1 <= m && d[x][y + 1] == -1){
            d[x][y + 1] = d[x][y] + 1;
            q.push({x, y + 1});
        }
        if (x - 1 >= 1 && d[x - 1][y] == -1){
            d[x - 1][y] = d[x][y] + 1;
            q.push({x - 1, y});
        }
        if (y - 1 >= 1 && d[x][y - 1] == -1){
            d[x][y - 1] = d[x][y] + 1;
            q.push({x, y - 1});
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i){
        for (int j = 1; j <= m; ++j){
            ans = max(ans, d[i][j]);
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 14608
#include <iostream>
using namespace std;
//
// Created by karayuu on 2018-12-19.
//
int main() {
    int S;
    cin >> S;

    int h = S / 3600;
    int m = (S - h * 3600) / 60;
    int s = (S - h * 3600) % 60;

    cout << h << ":" << m << ":" << s << endl;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
// atoi : atoi(str.c_str())
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  int h,w;
  cin >> h >> w;
  vvc c(h+2,vc(w+2,'@'));
  queue<pair<int,int>> que;
  vvi dis(h+2,vi(w+2,-1));
  rep(i,h){
    rep(j,w){
      char tmp;
      cin >> tmp;
      if(tmp == '#'){
        pair<int,int> p(i+1,j+1);
        que.push(p);
        dis.at(i+1).at(j+1) = 0;
      }
      c.at(i+1).at(j+1) = tmp;
    }
  }
  vi gox = {0,0,1,-1};
  vi goy = {1,-1,0,0};
  while(!que.empty()){
    pair<int,int> p = que.front();
    que.pop();
    int x,y;
    tie(x,y) = p;
    rep(i,4){
      int nx = x + gox.at(i);
      int ny = y + goy.at(i);
      if(dis.at(nx).at(ny) >= 0) continue;
      if(c.at(nx).at(ny) != '.') continue;
      p = make_pair(nx,ny);
      que.push(p);
      dis.at(nx).at(ny) = dis.at(x).at(y) + 1;
    }
  }
  int maxi = 0;
  rep(i,h){
    rep(j,w){
      maxi = max(maxi,dis.at(i+1).at(j+1));
    }
  }
  cout << maxi << endl;
}

Measured memory_bytes: 13456
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()
 
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
 
const ll oo = 1e11 + 7;
const int mod = 1e9 + 7, maxn = (3 * 1e5) + 10;
const long double PI = acos(-1);

long double fexp(long double a, int b){
    long double ans = 1.0;

    while (b){
        if (b&1) ans = (ans * a);
        a = (a * a);
        b = (b >> 1);
    }

    return ans;
}

int count(int num, int lim){
    int ans = 0;
    while (lim  < num){
        lim*=2;
        ans++;
    }
    return ans;
}

int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long double ans = 0, n, k;
    cin >> n >> k;

    for (int i=1; i<=n; i++){
        long double val = 1.0/n;
        val = (val * fexp(0.5, count(k, i)));
        ans += val;
    }

    cout << fixed << setprecision(10)<<  ans << endl;
    return 0;
}

Measured memory_bytes: 3752
#include <stdio.h>
 
int main(void) {
    int i,j;
    int H, W;
    
    while(1){
        scanf("%d %d",&H,&W);
        //???????????¶
        if(H==0&&W==0) break;
        for(i=0;i<W;i++) printf("#");
        printf("\n");
        for(i=0;i<H-2;i++){
            printf("#");
            for(j=0;j<W-2;j++){
                printf(".");
            }
            printf("#");
            printf("\n");
        }
        for(i=0;i<W;i++) printf("#");
        printf("\n");
        printf("\n");
    }
         
        return 0;
}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for(int i = (int)(n); i > 0; --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(x), end(x), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(x), rend(x), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T>
constexpr int sz(const T& a) { return (int)a.size(); }
template<class T, class ... Args>
constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args>
constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class T>
constexpr T ceiling(const T a, const T b) { return (a + b - 1) / b; }
ll plusMod(ll& a, const ll b) { return a = (a % mod + b % mod) % mod; }
template<typename A, size_t N, typename T>
constexpr void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

int n, k;
ll dp[55][55][2000];
void solve() {
    cin >> n >> k;

    dp[0][0][0] = 1;
    rep(i, n) {
        rep(j, i + 1) {
            rep(l, k / 2 + 1) {
                plusMod(dp[i + 1][j][l + j], dp[i][j][l]);
                plusMod(dp[i + 1][j + 1][l + j + 1], dp[i][j][l]);
                plusMod(dp[i + 1][j][l + j], dp[i][j][l] * j * 2);
                if (j >= 1)
                    plusMod(dp[i + 1][j - 1][l + j - 1], dp[i][j][l] * j * j);
            }
        }
    }

    if (k % 2 == 1)
        cout << 0 << endn;
    else
        cout << dp[n][0][k / 2] << endn;

}


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    solve();

    cout << flush;

    return 0;
}


Measured memory_bytes: 43392
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,k1,k2;
  int64_t k,ans=0;
  cin >> a >> b >> c >> k;
  for(int i=0;i<k;i++){
    k1=a;
    k2=b;
    a=b+c;
    b=k1+c;
    c=k1+k2;
    if(abs(a-b)>=1000000000000000000){
      cout << "Unfair" << endl;
      return 0;
    }
  }
  ans=a-b;
  cout << ans << endl;
}


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

using namespace std;

int main() {
    int D, G; cin >> D >> G;
    vector<int> p(D), c(D); for (int i = 0; i < D; i++) cin >> p[i] >> c[i];

    int ans = 1001;
    for (int bit = 0; bit < (1 << D); bit++) { // すべてのビットを列挙
        int num = 0;
        int sum = 0;
        for (int i = 0; i < D; i++) { // 難易度のループ
            if (bit&(1 << i)) { // ビット i が立っていればその難易度を全完する
                num += p[i];
                sum += 100*(i + 1)*p[i] + c[i];
            }
        }

        if (sum >= G) { // 目標を超えていれば終了
            ans = min(num, ans);
        } else { // 超えていない場合は難易度順に途中まで解いていく
            for (int i = D - 1; i >= 0; i--) {
                if (bit&(1 << i)) continue; // 全完済みなら飛ばす
                else {
                    for (int j = 0; j < p[i]; j++) {
                        if (sum >= G) break;
                        num++;
                        sum += 100*(i + 1);
                    }
                }
            }
            ans = min(num, ans);
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

ll x[100002];
ll v[100002];
ll rv[100001];//時計回り
ll rmin[100001];
ll lv[100001];//反時計回り
ll lmin[100001];

int main()
{
	int n;
	ll c;
	ll ans=0;
	ll ansr,ansl;
	ll man=0;
	ll rm;
	ll lm;
	
	cin>>n>>c;
	x[0]=0;
	v[0]=0;
	for(int i=1;i<n+1;i++)
	{
		cin>>x[i]>>v[i];
		ans+=v[i];
	}
	x[n+1]=c;
	v[n+1]=0;
	ans-=x[n-1];
	rv[0]=0;
	lv[0]=0;
	for(int i=1;i<n+1;i++)
	{
		rv[i]=rv[i-1]+v[i]-(x[i]-x[i-1]);
		lv[i]=lv[i-1]+v[n+1-i]-(x[n+2-i]-x[n+1-i]);
	}
	rm=0;
	lm=0;
	rmin[0]=0;
	lmin[0]=0;
	for(int i=1;i<n+1;i++)
	{
		if(rv[rm]<rv[i])
			rm=i;
		
		if(lv[lm]<lv[i])
			lm=i;
		
		rmin[i]=rm;
		lmin[i]=lm;
	}

	//時計回りに順番に調べる
	ansr=0;
	ansl=0;
	for(int i=1;i<n+1;i++)
	{
		ll temp = rv[i];
		man = temp;
		man-=x[i];
		man+=lv[lmin[n+1-i-1]];
		temp=max(temp,man);
		if(temp>ansr)
			ansr=temp;
	}
	//反時計回り
	for(int i=1;i<n+1;i++)
	{
		ll temp=lv[i];
		man = temp;
		man-=(c-x[n+1-i]);
		man+=rv[rmin[n+1-i-1]];
		temp=max(temp,man);
		if(temp>ansl)
			ansl=temp;
	}
	//cerr<<ansl<<" "<<ansr<<endl;
	ans = max(ansr,ansl);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <stdio.h>
#include <string>
#include <cctype>
using namespace std;

int main() {
    char c;
    int numbers[26] = {0};
    int num;

    while (cin >> c) {
        if (isupper(c)) c = tolower(c);
        num = c - 'a';
        numbers[num]++;
    }

    for (int i = 0; i < 26; i++) {
        printf("%c : ", i+97);
        cout << numbers[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3204
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> s(N);
  int sum = 0;
  for (int i = 0; i < N; i++)
  {
    cin >> s[i];
    sum += s[i];
  }
  if (sum % 10 != 0)
  {
    cout << sum << endl;
    return 0;
  }
  else
  {
    sort(s.begin(), s.end());
    for (int i = 0; i < N; i++)
    {
      if (s[i] % 10 != 0)
      {
        cout << sum - s[i] << endl;
        return 0;
      }
    }
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 550000
void merge(int A[], int left, int mid, int right, int *c) {
   int n1, n2;
   int i, j, k;
   int L[MAX], R[MAX];

   n1 = mid - left;
   n2 = right - mid;

   for (i = 0; i < n1; ++i) {
	  L[i] = A[left + i];
   }
   for (i = 0; i < n2; ++i) {
	  R[i] = A[mid + i];
   }
   L[n1] = MAX * MAX;
   R[n2] = MAX * MAX;
   i = 0;
   j = 0;

   for (k = left; k < right; ++k) {
	  if (L[i] <= R[j]){
		 A[k] = L[i];
	     i = i + 1;
	     *c += 1;
	  }
	  else {
		 A[k] = R[j];
		 j = j + 1;
		 *c += 1;
	  }
   }
}

void mergeSort(int A[], int left, int right, int *c) {
   int mid;
   if (left + 1 < right) {
	  mid = (left + right) / 2;
	  mergeSort(A, left, mid, c);
	  mergeSort(A, mid, right, c);
	  merge(A, left, mid, right, c);
   }
}

int main()
{
   int n, i, count;
   int S[MAX];
   int *c;
   c = &count;
   i = 0;

   scanf("%d", &n);
   while (i < n) {
	  scanf("%d", &S[i]);
	  i++;
   }

   mergeSort(S, 0, n, c);

   i = 0;
   while (i < n) {
	  printf("%d", S[i]);
	  i++;
	  if (i != n)
		 putchar(' ');
   }
   putchar('\n');
   printf("%d\n", count);
   return 0;
}

Measured memory_bytes: 5612
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout<<a<<" "<<b<<" "<<c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
//
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const double dINF = 1000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 998244353ll;
//const ll MOD = 67280421310721ll;
const dou pi=3.141592653589793;
//メモ
//二次元配列のresizeのしかた
//vv.resize(n);
//for(size_t i=0; i<n; i++){
// vv[i].resize(n);
//}

//メモ
//負の辺を持つ最短経路問題では到達不可経路でも初期化値より小さくなりうるので注意しよう
int main(){
    int n,m,v,p;
    std::cin >> n>>m>>v>>p;
    VEC(ll,a,n);
    std::vector<ll> sa(n+1);
    
    sort(all(a),gre(ll));
    rep(i,n){
        sa[i+1]=sa[i]+a[i];
    }
    int ans=p;
    int dd=a[p-1];
    rrep(i,p,n){
        ll can=a[i]+m;
        ll need=max(0ll,ll(i-(p-1))-(n-v))*m;
        bool b=0;
      //  ll d=0;
        ll dd=(i-p+1)*can-(sa[i]-sa[p-1]);
       // pppri(i,p-1,sa[i]-sa[p-1]);
        if(can<a[p-1])break;
        if(dd>=need)ans++;
        /*
        rrep(j,p-1,i){
          //  std::cout << j << std::endl;
            if(can<a[j]){
                b=1;
                break;
            }
            d+=can-a[j];
            //if(d>=need)ans++;
        }
        */
        if(b)break;
        //ppri(d,dd);
        
        
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<cmath>
#include<complex>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<ctime>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	printf("ABC%d",n);
}


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

int main(){
    map <int, int> mp;
    int n; cin >> n;
    for(int i = 0; i<n; ++i){
        int tmp; cin >> tmp;
        if(mp.count(tmp) == 0)mp[tmp] = 1;
        else mp.erase(tmp);
    };
    cout << mp.size() << endl;
}

Measured memory_bytes: 4864
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long s = in.nextLong();
            long c = in.nextLong();
            long count = 0;
            if (s * 2 > c) {
                count = c / 2;
            } else {
                count = s;
                c -= s * 2;
                count += c / 4;
            }
            out.println(count);
        }
    }

    static boolean permutation_2(String s, String t) {
        if (s.length() != t.length()) {
            return false;
        }

        int[] letters = new int[256];

        char[] s_array = s.toCharArray();
        for (char c : s_array) {
            letters[c]++;
        }

        for (int i = 0; i < t.length(); i++) {
            int c = (int) t.charAt(i);
            if (--letters[c] < 0) {
                return false;
            }
        }
        return true;
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public char nextChar() {
            return next().charAt(0);
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


Measured memory_bytes: 24788
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n, m, p = LI()
abc = [LI() for _ in range(m)]
edges = [[] for _ in range(n)]
inv_edges = [[] for _ in range(n)]
for a, b, c in abc:
    edges[a-1].append((b-1, c))
    inv_edges[b-1].append(a-1)

visited = [False] * n
stack = [n-1]
while stack:
    v = stack.pop()
    visited[v] = True
    for u in inv_edges[v]:
        if visited[u]:
            continue
        stack.append(u)

dp = [-float('inf')] * n
dp[0] = 0
tmp = -1
for _ in range(n+1):
    flag = False
    for v in range(n):
        score = dp[v]
        for u, c in edges[v]:
            if dp[u] < score + c - p and visited[u]:
                dp[u] = score + c - p
                flag = True
if flag:
    print(-1)
else:
    print(max(0, dp[n-1]))

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

const int N = 1e5 + 5;

int n, m;
int cnt[N];
bool vis[N];
int ans;

int main()
{
	scanf("%d%d", &n, &m);
	int x, y;
	vis[1] = 1;
	for (int i = 1; i <= n; i ++)
	    cnt[i] = 1;
	for (int i = 1; i <= m; i ++)
	{
		scanf("%d%d", &x, &y);
		if (vis[x])
		{
		    vis[y] = 1;
		    if (cnt[x] == 1)
		        vis[x] = 0;
		}
		cnt[x] --, cnt[y] ++;
	}
	for (int i = 1; i <= n; i ++)
	    ans += vis[i];
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 768
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 130000;
char cn[CM + 10], * ci = cn + 10, * owa = cn + CM;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	char c = ci[8];
	ci[8] = 0;
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci[8] = c;
	ci += (64 - dig >> 3) + 1;

	if (ci - owa > 0) {
		memcpy(cn, owa, 10);
		ci -= CM;
		fread(cn + 10, 1, CM, stdin);
	}
	return tmp;
}

char* di = cn;
const int MAX = 200000;
class shuturyoku_unko {
public:
	char C[MAX * 6 - 100000];
	int K[MAX + 10];
	constexpr shuturyoku_unko() : C(), K() {
		auto di = C + 1;
		C[0] = '0';
		K[1] = 1;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			K[i + 1] = K[i] + keta;
		}
	}
} f;
inline void putint(ll X) {
	int ue = X / 100000;
	if (ue) {
		memcpy(di, f.C + f.K[ue], f.K[ue + 1] - f.K[ue]);
		di += f.K[ue + 1] - f.K[ue];
		int sita = X - ue * 100000ll;
		rep(i, 5 - f.K[sita + 1] + f.K[sita])* di++ = '0';
		for (int i = f.K[sita]; i < f.K[sita + 1]; i++)* di++ = f.C[i];
	}
	else {
		memcpy(di, f.C + f.K[X], f.K[X + 1] - f.K[X]);
		di += f.K[X + 1] - f.K[X];
	}
	*di++ = '\n';
}

int B[200001];

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


	fread(ci, 1, CM, stdin);

	int N = getint();
	ll kotae = 1;
	int A[200000];
	rep(i, N) kotae += B[(A[i] = getint())]++;
	int *a = A;
	
	int amari = N % 10800;
	int shou = N / 10800;
	rep(j, shou) {
		rep(k, 10800) putint(kotae - B[*a++]);
		fwrite(cn, 1, di - cn, stdout);
		di = cn;
	}
	rep(k, amari) putint(kotae - B[*a++]);
	fwrite(cn, 1, di - cn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 3712
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, K,W, H, P, Q, R, X, Y;
  ll ans;
  string S, T;
  cin >>N;
  ll w[N];
  ll count_s2 = 0;
  rep(i, N) {
    cin>>w[i];
    count_s2+= w[i];
  }
  ll count_s1 = 0;
  ans =1e+6;
  rep(i, N-1){
    count_s2-=w[i];
    count_s1 += w[i];
    ans = min(ans, abs(count_s2-count_s1));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;

int main(){
    ll ans=0;
    ll m=-1;
    rep(i,3){
        ll x;
        cin >> x;
        ans+=x;
        m=max(m,x);
    }
    cout << ans-m << endl;
    return 0;
} 

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

a_list.sort(reverse=True)

Alice = 0
Bob = 0
for num,i in enumerate(a_list):
    if (num+1)%2 != 0:
        Alice+=i
    else:
        Bob+=i
        
print(Alice - Bob)

Measured memory_bytes: 3060
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	const inputLines = input.split("\n");
	const line0 = inputLines[0];

	if (line0 === "RRR") {
		return console.log(3);
	}
	if (-1 < line0.indexOf("RR")) {
		return console.log(2);
	}
	if (-1 < line0.indexOf("R")) {
		return console.log(1);
	}
	console.log(0);

	// tmp = input[1].split(" ");
	// //文字列から10進数に変換するときはparseIntを使います
	// var a = parseInt(input[0], 10);
	// var b = parseInt(tmp[0], 10);
	// var c = parseInt(tmp[1], 10);
	// var s = input[2];

	//出力
	// console.log('%d %s',a+b+c,s);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

// node index.js
// 1
// 2 3
// test
// (Ctrl + D)


Measured memory_bytes: 29708
#include <iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<string>
#define ll long long int
using namespace std;
const int maxn=1000010;

int high[maxn];
int dp[maxn];

int main( )
{
    int i,n;;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>high[i];
    }
    dp[1]=0;
    dp[2]=abs(high[1]-high[2]);
    for(i=3;i<=n;i++)
    {
        dp[i]=min(dp[i-1]+abs(high[i-1]-high[i]),dp[i-2]+abs(high[i-2]-high[i]));
        //cout<<dp[i]<<endl;
    }
    cout<<dp[n]<<endl;;
	 return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
//i64 mod = 998244353;
int int_max = 2147483647;
i64 INF = 1e16;
int max_n = 1e5;


int main(int argc, char **argv) {
    i64 n;
    cin >> n;

    i64 cnt=0;
    for (i64 a=1; a<n; ++a) {
        i64 b = n/a;
        if (b==0) break;

        if (a*b==n) {
            cnt += (b-1);
        } else {
            cnt += b;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3604
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
const int maxn=307;
const int MOD=1000000007;
struct data{
	int l,x;
};
int n,m,ll,rr,xx,f[maxn][maxn][maxn],ans;
vector <data> a[maxn];
bool check(int r,int g,int b){
	int k=max(max(r,g),b);
	for (int i=0; i<a[k].size(); i++) {
		data now=a[k][i];
		int cnt=0;
		int left=now.l;
		if (r>=left) ++cnt;
		if (g>=left) ++cnt;
		if (b>=left) ++cnt;
		if (cnt!=now.x) return false;
	}
	return true;
}
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for (int i=1; i<=m; i++) {
		cin>>ll>>rr>>xx;
		data tmp;
		tmp.l=ll; tmp.x=xx;
		a[rr].push_back(tmp);
	} 
	f[0][0][0]=1;
	for (int r=0; r<=n; r++)
		for (int g=0; g<=n; g++)
			for (int b=0; b<=n; b++) {
				int c=f[r][g][b];
				if (!c) continue;
				if (!check(r,g,b)) {f[r][g][b]=0; continue;}
				int k=max(max(r,g),b)+1;
				if (k==n+1) ans=(ans+f[r][g][b]) % MOD;
				f[k][g][b]=(f[k][g][b]+f[r][g][b]) % MOD;
				f[r][k][b]=(f[r][k][b]+f[r][g][b]) % MOD;
				f[r][g][k]=(f[r][g][k]+f[r][g][b]) % MOD;
			} 
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 112896
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
//using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int dh[8] = {0, 0, 1, 1, 1, -1, -1, -1};
const int dw[8] = {1, -1, 0, 1, -1, 0, 1, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
using Edge = pair<int,int>;
using Graph = vector<vector<Edge>>;
Graph G;
  
/*------------------------------------------------------------------*/

int main(){
    int n, q; cin >> n >> q;
    string s; cin >> s;
    vector<int> l(n);
    vector<int> r(n);
    rep(i, q){
        cin >> l[i] >> r[i];
    }

    vector<int> AC(n);
    AC[0] = 0;
    rep(i, n - 1){
        if(s.substr(i, 2) == "AC"){
            AC[i + 1] = 1;
        }
    }
    vector<int> AC_sum(n + 1);
    AC_sum[0] = 0;
    _rep(i, 1, n + 1){
        AC_sum[i] = AC_sum[i - 1] + AC[i - 1];
    }
    rep(i, q){
        cout << AC_sum[r[i]] - AC_sum[l[i]] << endl;
    }


}


Measured memory_bytes: 2688
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


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


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

D, G = LI()
PC = []
for i in range(D):
    PC.append([(i+1)*100] + LI())

PC = [tuple(i) for i in PC]

# 全探索でよくね
# 組み合わせを選んで、高いほうから選んでいく。
# 組み合わせの数が少ない順に試していく
"""
1種類の場合
2種類の場合
3種類の場合
...
10種類の場合
Gを超えだしたらその種類数の中で決める。

10Cr
という形になる。
最大でも組み合わせの数は260通りほどなのでいけそうだ。
"""
results = []
def dfs(ls, limit, combis, count):
    is_end = True
    for i in range(len(ls)):
        #  print('saiki i, ls', i, ls)
        new_list = [_ for _ in ls]
        if new_list[i] < combis[i][1]:
            # 余力があればプラス
            new_list[i] += 1
            is_end = False

            p = 0
            for idx, j in enumerate(ls):
                #  if ls == [2,5]:
                #      import pdb
                #      pdb.set_trace()
                # 点数計算
                p += combis[idx][0] * j
                if j == combis[idx][1]:
                    p += combis[idx][2]

            if p >= G:
                results.append(count)
                return

            dfs(new_list, limit, combis, count+1)

# 完答しない場合もある。
result = 0
count = 0
for i in range(PC[-1][1]):
    result += PC[-1][0]
    count += 1
    if result >= G:
        results.append(count)
for i in range(1, D+1):
    # i種類の組み合わせを選ぶ
    combis = list(itertools.combinations(PC, i))
    #  print('i, combis', i, combis)
    for combi in combis:
        limit = sum([j[1] for j in PC])
        # iは完答する種類数
        result = 0
        result += sum([c[0] * c[1] + c[2] for c in combi])
        count = sum([c[1] for c in combi])
        if result >= G:
            results.append(count)
            continue
        rest = [_ for _ in PC if _ not in combi]
        for r in rest[::-1]:
            for ridx in range(r[1]):
                result += r[0]
                count += 1
                if result >= G:
                    results.append(count)

                

print(min(results))



Measured memory_bytes: 70744
import java.util.*;
 
public class Main{

       public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        String S = sc.next();
        sc.close();

        int[] dp = new int[N];//i番目の左にいる西を向いた人数
        dp[0] = 0;
        for(int i = 1; i < N; i++){
            if(S.charAt(i-1) == 'W'){
                dp[i] = dp[i-1] + 1;
            } else {
                dp[i] = dp[i-1];
            }
        }
        int min = N;
        for(int i = 0; i < N; i++){
            if(S.charAt(N-1) == 'W' && i != N-1)
                min = Math.min(min, dp[i] + N - i - 1 - dp[N-1]+dp[i]);
            if(S.charAt(N-1) == 'E' && i != N-1)
                min = Math.min(min, dp[i] + N - i - dp[N-1]+dp[i]);
            if(i == N-1)
                min = Math.min(min, dp[i]);
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 29188
#include <bits/stdc++.h>
    using namespace std;
    int main() {
     int n;
     cin>>n;
     long long v[n];
     for(int i=0;i<n;i++)
     cin>>v[i];
     
     int cnt=0;
     for(int i=0;i<n;i++){
     	long long num=v[i];
     	int j=1;
     	while(num%(long long)(pow(2,j))==0){
     		j++;
	}
	//cout<<cnt<<" ";
	
	cnt+=j-1;
     }
     //cout<<endl;
     cout<<cnt;
     
      
      return 0;
    }

Measured memory_bytes: 384
import sys
input=sys.stdin.readline
import math
rt=math.sqrt
eps=10**(-6)
n=int(input())
XY=[]
for i in range(n):
  XY.append(tuple(map(int,input().split())))

def dist2(xy1,xy2):
  return (xy1[0]-xy2[0])**2+(xy1[1]-xy2[1])**2

def dist1(xy1,xy2):
  return rt(dist2(xy1,xy2))

def center(xy1,xy2,xy3):
  den=(xy1[0]-xy2[0])*(xy2[1]-xy3[1])-(xy1[1]-xy2[1])*(xy2[0]-xy3[0])
  if den==0:
    if dist2(xy1,xy2)>=dist2(xy2,xy3):
      if dist2(xy1,xy2)>=dist2(xy3,xy1):
        return [(xy1[0]+xy2[0])/2,(xy1[1]+xy2[1])/2,dist1(xy1,xy2)/2]
      else:
        return [(xy3[0]+xy1[0])/2,(xy3[1]+xy1[1])/2,dist1(xy3,xy1)/2]
    else:
      if dist2(xy2,xy3)>=dist2(xy3,xy1):
        return [(xy2[0]+xy3[0])/2,(xy2[1]+xy3[1])/2,dist1(xy2,xy3)/2]
      else:
        return [(xy3[0]+xy1[0])/2,(xy3[1]+xy1[1])/2,dist1(xy3,xy1)/2]

  else:  
    retx1=(xy1[0]**2+xy1[1]**2)-(xy2[0]**2+xy2[1]**2)
    rety1=(xy2[0]**2+xy2[1]**2)-(xy3[0]**2+xy3[1]**2)
  
    retx2=(xy2[1]-xy3[1])*retx1-(xy1[1]-xy2[1])*rety1
    rety2=(xy3[0]-xy2[0])*retx1+(xy1[0]-xy2[0])*rety1
  
  
    retx3,rety3=retx2/2/den,rety2/2/den
    retr=dist1([retx3,rety3],xy1)
    return [retx3,rety3,retr]

ans=float("inf")
import itertools
for a,b in itertools.combinations(XY,2):
  x,y,r=center(a,b,b)
  chk=True
  for xy in XY:
    if dist1([x,y],xy)>r+eps:
      chk=False
  if chk:
    ans=min(ans,r)

if n>=3:
  for a,b,c in itertools.combinations(XY,3):
    x,y,r=center(a,b,c)
    chk=True
    for xy in XY:
      if dist1([x,y],xy)>r+eps:
        chk=False
    if chk:
      ans=min(ans,r)
print(ans)


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

int main()
{
  int n;
  cin >> n;
  
  long double x[n];
  string u[n];
  rep(i,n) cin >> x[i] >> u[i];
  
  long double ans = 0.0;
  rep(i,n){
    if(u[i] == "JPY"){
      ans += (long double)x[i];
    }else{
      ans += x[i] * 380000.0;
    }
  }
  
  cout << fixed;
  cout << setprecision(20);
  cout << ans << endl;
  
}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define Cout(s) cout << s << endl;
typedef long long ll;
typedef pair<int, int> P;

const ll INF = 1ll << 60;
ll MOD = 1e9 + 7;

int main()
{

    int n, m;
    cin >> n >> m;
    int ml = -1, mr = 100000;
    REP(i, m)
    {
        int left, right;
        cin >> left >> right;
        --left, --right;
        if (ml < left)
            ml = left;
        if (mr > right)
            mr = right;
    }

    int ans = max(0, mr - ml + 1);
    Cout(ans);

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c;
    char all[2005];
    int suzu[1005];
    int ans;
    scanf("%d %d %d",&a,&b,&c);
    if(a==b&&b==c)
    {
        printf("No\n");
        return 0;
    }
    if(a==b||b==c||a==c)
        printf("Yes\n");
    else
        printf("No\n");
    
    
   // printf("%d\n",ans);
    return 0;
}


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

using namespace std;

int main(){
	while (true){
		int array[10][10], a, b, c, i, j, k, m = 0, n, ans_map = 0, ans_cost = 1 << 25;
		scanf("%d", &n);
		if (!n){
			return 0;
		}
		for (i = 0; i < 10; i++){
			for (j = 0; j < 10; j++){
				if (i == j){
					array[i][j] = 0;
				}
				else{
					array[i][j] = 1 << 25;
				}
			}
		}
		for (i = 0; i < n; i++){
			scanf("%d %d %d", &a, &b, &c);
			array[a][b] = array[b][a] = c;
			m = max(m, b);
		}
		m++;
		for (i = 0; i < m; i++){
			for (j = 0; j < m; j++){
				for (k = 0; k < m; k++){
					array[j][k] = array[k][j] = min(array[j][k], array[j][i] + array[i][k]);
				}
			}
		}
		for (i = 0; i < m; i++){
			int cost = 0;
			for (j = 0; j < m; j++){
				cost += array[i][j];
			}
			if (cost < ans_cost){
				ans_cost = cost;
				ans_map = i;
			}
		}
		printf("%d %d\n", ans_map, ans_cost);
	}
}

Measured memory_bytes: 1188