akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>
#include<cmath>
#include<math.h>
#include <iomanip>
#include<algorithm>
#include<vector>
#include <map>
#define rep(i,N) for(int (i)=0;(i) < (N); (i)++)

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i;
  int n;
  long long m;
  cin >> n >> m;
  /*
  std::vector<long long> a;
  rep(i,n){
    cin >> input;
    a.push_back(input);
  }
  sort(a.begin(), a.end());
  rep(i, m){
    int b;
    long long c;
    int count = 0;
    cin >> b >> c;
    while(a[0] < c && count < b){
      a.push_back(c);
      a.erase(a.begin());
      ++count;
    }
  }
  */
  vector<long long> a(n);
  rep(i, n){
    cin >> a[i];
  }
  sort(a.begin(), a.end());

  vector<pair<long long, int> > op(m);
  rep(i,m){
    int b;
    long long c;
    cin >> b >> c;
    op[i] = make_pair(c, b);
  }
  sort(op.begin(), op.end(), greater<pair<long long, int> >());
  int idx = 0;
  long long res = 0;
  rep(i,n){
    if(a[i] < op[idx].first && op.size() > idx){
      res += op[idx].first;
      --op[idx].second;
      if(op[idx].second == 0) ++idx;
    }else{
      res += a[i];
    }
  }

  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

struct SegT {
private:
	int sz; vector<ll> node;
	const ll init_c = 0;
public:
	SegT(int n) {
		sz = 1;
		while (sz < n)sz *= 2;
		node.resize(2 * sz - 1, init_c);
	}
	ll f(ll a, ll b) {
		return a + b - (a + b >= mod)*mod;
	}
	void update(int k, ll a) {
		k += sz - 1;
		node[k] += a; if (node[k] >= mod)node[k] -= mod;
		while (k > 0) {
			k = (k - 1) / 2;
			node[k] = f(node[k * 2 + 1], node[k * 2 + 2]);
		}
	}
	ll query(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0)r = sz;
		if (r <= a || b <= l)return init_c;
		else if (a <= l && r <= b)return node[k];
		else {
			ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
			ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
			return f(vl, vr);
		}
	}
};
bool comp(P x, P y) {
	if (x.first != y.first)return x.first < y.first;
	return x.second > y.second;
}
void solve() {
	int n, m; cin >> n >> m;
	vector<int> x(n), y(m);
	rep(i, n)cin >> x[i];
	rep(i, m)cin >> y[i];
	vector<P> v;
	rep(i, n) {
		if (x[i]<y[0] || x[i]>y[m - 1])continue;
		int id = lower_bound(y.begin(), y.end(), x[i]) - y.begin();
		int ri = y[id] - x[i], le = x[i] - y[id - 1];
		v.push_back({ le,ri });
	}
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	vector<int> vy; rep(i, v.size())vy.push_back(v[i].second);
	sort(vy.begin(), vy.end()); vy.erase(unique(vy.begin(), vy.end()), vy.end());
	map<int, int> mp;
	rep(i, vy.size()) {
		mp[vy[i]] = i + 1;
	}
	rep(i, v.size())v[i].second = mp[v[i].second];
	SegT st(n + 1);
	st.update(0, 1);
	sort(v.begin(), v.end(), comp);
	rep(i, v.size()) {
		//cout << v[i].first << " " << v[i].second << endl;
		int id = v[i].second;
		ll s = st.query(0, id);
		st.update(id, s);
	}
	cout << st.query(0, n + 1) << endl;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}


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

#include <cstdlib>  // abs() for integer 絶対値求めやつ

#include <cmath>    // abs() for float, and fabs()

#include <algorithm>
#include <vector>
#define rep(i,n) for(int i = 0; i< (n);i++)

#define SORT(a) sort((a).begin(),(a).end());

#define che(a,string) cout<<string<<":"<<(a)<<endl;

#define ch(a,string) cout<<string<<":"<<(a)<<" ";

using namespace std;

typedef pair<int,int> P;

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




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

int main() {
    vector<int> n(5);
    vector<int> diff(5);
    int max = 0;
    int ans = 0;
    for (int i = 0; i < 5; i++) {
        cin >> n[i];
        diff[i] = 10 - n[i] % 10;
        if (diff[i] != 10) {
            n[i] = n[i] + diff[i];
            if (max < diff[i]) {
                max = diff[i];
            }
        }
        ans += n[i]; 
    }
    cout << ans - max << endl;
}


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    dp[i]=min((dp[i-1]+abs(h[i]-h[i-1])),(dp[i-2]+abs(h[i]-h[i-2])))              
print(dp[n-1])

Measured memory_bytes: 52208
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,zx,xc;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	if(a*2>b||a*4<b||b%2==1){
		cout<<"No";
	}else{
		cout<<"Yes";
	}
	return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  vector<int> vec1(30);
  vector<int> vec2(30);
  for (int i = 0; i < a.size(); i++) {
    vec1[a[i] - 97]++;
    vec2[b[i] - 97]++;
  }
  sort(vec1.begin(), vec1.end());
  sort(vec2.begin(), vec2.end());
  for (int i = 0; i < 30; i++) {
    if (vec1[i] != vec2[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 776
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

bool check(const string &s) {
    FOR(i, 1, s.size()) {
        if (s[0] != s[i]) return false;
    }
    return true;
}

int f(string s, char c) {
    int cnt = 0;
    while (!check(s)) {
        ++cnt;
        string ns = "";
        FOR(i, 1, s.size()) {
            if (s[i - 1] == c) ns += s[i - 1];
            else ns += s[i];
        }
        s = ns;
    }
    return cnt;
}

int main(void) {
    string s;
    cin >> s;
    int ans = INF;
    for (char c = 'a'; c <= 'z'; c++) {
        chmin(ans, f(s, c));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include "iostream"
#include "math.h"
#include "string"
using namespace std;
int main(){
int a , b;
cin >> a >> b;
int n = max(a,b);
int s = n ==a? b:a;
    for (int i = 0; i < n; ++i) {
       cout << s;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    int n; cin >> n;
    vector<int> p;
    rep(i,n){
        int a; cin>>a;
        p.push_back(a);
    }
    vector<int> q(p.size());
    copy(p.begin(), p.end(), q.begin());
    sort(p.begin(), p.end());

    int cnt=0;
    string ans = "NO";
    
    rep(i,n) if(p[i]!=q[i]) cnt++;

    if(cnt==0 || cnt==2) ans = "YES";

    cout << ans << ln;
    return 0;
}

Measured memory_bytes: 256
n,k=map(int, input().split())
a=sorted([list(map(int, input().split())) for i in range(n)], key=lambda x:-x[1])
q=[]
ans=0
s=set()
for i in range(k):
    ans+=a[i][1]
    if a[i][0] in s:
        q.append(a[i][1])
    s.add(a[i][0])
ans+=len(s)**2
k1=k
ans1=ans
while k1<n and q:
    if a[k1][0] not in s:
        ans1=ans1+a[k1][1]-q.pop()-len(s)**2+(len(s)+1)**2
        ans=max(ans,ans1)
        s.add(a[k1][0])
    k1+=1
print(ans)


Measured memory_bytes: 69208
-module('Main').
-export([main/1]).

main(_) ->
    {ok, [N]} = io:fread("", "~d"),
    {_Max, MaxN} = lists:last(lists:keysort(1,
                                           lists:map(fun(X) ->
                                                             Most = divideBy2(X),
                                                             {Most, X}
                                                     end,
                                                     lists:seq(1, N)))),
    io:format("~p~n", [MaxN]),
    halt().


divideBy2(N) ->
    divideBy2(N, 0).
divideBy2(1, C) ->
    C;
divideBy2(N, C) when N rem 2 =:= 0->
    NewN = N div 2,
    divideBy2(NewN, C + 1);
divideBy2(_N, C) ->
    C.



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

using namespace std;

int main() {
  int n, t;
  cin >> n >> t;
  int res = 0;
  int now = 0;
  while (n--) {
    int a;
    cin >> a;
    res += a + t - max(a, now);
    now = a + t;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int t = in.nextInt();
            out.println(Math.max(0, x - t));
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

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

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 22740
from fractions import gcd

import sys
input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    B = []

    ok = True
    a = A[0]
    c = 0
    while a%2 == 0:
        a //= 2
        c += 1
    
    p = 2**c

    for a in A:
        if a % p == 0 and a % (2*p) != 0:
            B.append(a//p)
        else:
            ok = False
            break
    if not ok:
        print(0)
    else:
        B.sort()
        g = 1
        for b in B:
            l = gcd(b, g)
            g = g*b//l
            if g > M:
                ok = False
                break
        if not ok:
            print(0)
        else:
            p = g*2**(c-1)
            ans = (M+p)//(2*p)
            print(ans)


if __name__ == "__main__":
    main()

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;


void solve()
{
	int a, b;
	cin >> a >> b;
	cout << (a < 10 && b < 10 ? a * b : -1);
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

struct UnionFind{
	vector<int> data;
	UnionFind(int size) : data(size,-1) {}

	bool merge(int x,int y){
		x=root(x);y=root(y);
		if(x==y) return false;
		if(data[y]<data[x]) swap(x,y);
		data[x]+=data[y];
		data[y]=x;
		return true;
	}

	int root(int x){
		return data[x]<0 ? x : (data[x]=root(data[x]));
	}

	int size(int x){
		return -data[root(x)];
	}
};

int main(){
	ll N,M; cin>>N>>M;
	vector<ll> a(M),b(M);
	rep(i,M){
		cin>>a[i]>>b[i];
		a[i]--;b[i]--;
	}

	UnionFind UF(N);
	vector<ll> ans(M,0);
	ans[M-1]=N*(N-1)/2;

	for(int i=M-1;i>0;i--){
		if(UF.root(a[i])==UF.root(b[i])){
			ans[i-1]=ans[i];
			continue;
		}
		ans[i-1]=ans[i]-1LL*UF.size(a[i])*UF.size(b[i]);

		UF.merge(a[i],b[i]);
	}
	rep(i,M) cout<<ans[i]<<endl;
}

Measured memory_bytes: 4096
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		String DNA, RNA;
		try (Scanner sc = new Scanner(System.in)) {
			DNA = sc.nextLine();
			RNA = sc.nextLine();
			DNA = DNA + DNA;
			if(DNA.indexOf(RNA) == -1) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			
		}
	}
}


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

int main() {
	ll n, k;
	cin >> n >> k;
	ll ans = 0;
	for(int b = 1; b <= n; b++) {
		ans += (n / b) * max(0LL, b - k);
		ans += max(0LL, n % b - k + 1);
	}
	if(k == 0) ans -= n;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string> 
using namespace std;
long long n,a[30],b,ans;
string s;
int main()
{
	cin>>s;	
	for(int i=0;i<s.size();i++)
		a[s[i]-'a']++;
	for(int i=0;i<26;i++)
	{
		if(a[i]==0)
		{
			cout<<char('a'+i)<<endl;
			break;
		}
		else if(i==25)
			cout<<"None"<<endl;	
	}	
} 

Measured memory_bytes: 512
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

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

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

ll nPrS(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--){
        ret *= i;
        ret %= MOD;
    }
    return ret;
}

int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    bool colors[8] = {false};
    int free  = 0;

    for(int i = 0; i < n; i++){
        if(a[i] <= 399){
            colors[0] = true;
        } else if(a[i] <= 799){
            colors[1] = true;
        } else if(a[i] <= 1199){
            colors[2] = true;
        } else if(a[i] <= 1599){
            colors[3] = true;
        } else if(a[i] <= 1999){
            colors[4] = true;
        } else if(a[i] <= 2399){
            colors[5] = true;
        } else if(a[i] <= 2799){
            colors[6] = true;
        } else if(a[i] <= 3199){
            colors[7] = true;
        } else {
            free++;
        }
    }

  
    if(free >= n){
        cout << 1 << " " << free << endl;
    } else {
        int minimum = 0;
        int maximum = 0;
        for(int i = 0; i < 8; i++){
            if(colors[i])minimum++;
        }
        maximum = minimum + free;
        cout << minimum << " " << maximum << endl;
    }

}

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

int main(){
	int n, m;
	char op;
	cin>>n>>op>>m;
	if(op=='+') cout<<n+m<<endl;
	else cout<<n-m<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean[]ans = new boolean[3+1];
        ans[sc.nextInt()] = true;
        ans[sc.nextInt()] = true;
        for(int i=1; i<=3; i++) {
            if(!ans[i]) System.out.println(i);
        }
    }
}

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

#define CFOR(i, str) for(int i = 0; (str)[i]!='\0'; (i)++)
#define FOR(i, s, r) for(int i = (s); i < (r); i++)
#define INF 1e9
#define NINF -1e9
#define SUM(a) accumulate(a.begin(), a.end(), 0)
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.rbegin(), v.rend())
#define vmax(v) *max_element(v.begin(), v.end())
#define vmin(v) *min_element(v.begin(), v.end())
#define cnt(v, n) count(v.begin(), v.end(), (n))
#define vi vector<int>
#define vvi vector<vi>
#define vvvi vector<vvi>
#define vpii vector<pair<int, int>>
#define vpic vector<pair<int, char>>
#define mp make_pair
#define ll long long

using namespace std;

long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }


void solve(){
    int n;
    cin>>n;
    int arr[n][3];
    FOR(i, 0, n)
        FOR(j, 0, 3)
            cin>>arr[i][j];
    
    vvi dp(n, vi(3, NINF));
    FOR(i, 0, 3) dp[0][i] = arr[0][i];
    FOR(i, 1, n){
        FOR(j, 0, 3){
            FOR(k, 0, 3)
                if(j != k)
                    dp[i][j] = max(arr[i][j] + dp[i-1][k], dp[i][j]);
        }
    }
    cout<<vmax(dp[n-1]);
}

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

    // // COMMENT BEFORE SUBMISSION /////////////////////////////////////////////////
    // clock_t start = clock();
    // //

    // int t;
    // cin>>t;

    // while(t--){
        solve();
    // }

    // //COMMENT BEFORE SUBMISSION /////////////////////////////////////////////////
    // clock_t stop = clock();
    // double elapsed = (double) (stop - start) / CLOCKS_PER_SEC;
    // cout<<setprecision(5)<<fixed;
    // cout<<"\nProcess finished in: "<<elapsed<<"s\n";
    
    return 0;

}



Measured memory_bytes: 9748
#include <bits/stdc++.h>
using namespace std;
#define ll long long                  // Short form for long long
#define ld long double                // Short form for long double
typedef pair<ll, ll> pii;              // Pair of long long
typedef vector<ll> vi;                // Vector of long long
typedef vector<vi> vvi;               // Vector of vector of long long
typedef vector<pii> vii;               // Vector of pairs
typedef vector<vii> vvii;             // Vector of vector of pairs
#define pq priority_queue             // Max heap (To convert to min heap, use negative sign before every value)
#define ff first                      // For pairs
#define ss second                     // For pairs
#define pb push_back                  // Pushback to vector
#define mp make_pair                  // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end() // Mainly used by me in sorting

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
bool isPrime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false;   
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false;   
    return true; 
} 

ll mod = 1e9 + 7;
ll t=1;



vvi adj;
ll n,m,x,y,k;
// vi p,vis;
#define max 309

double p[max][max][max],ev[max][max][max];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // cin>>t;
    while(t--){
        cin>>n;
        vi cnt(4),arr(n);
        
        for(ll &x:arr){cin>>x; cnt[x]++;}
        
        p[cnt[1]][cnt[2]][cnt[3]]=1;
        
//        cout<<cnt[1]<<" "<<cnt[2]<<cnt[3]<<"\n";
        
        for(int c=n;c>=0;c--){
            for(int b=n;b>=0;b--){
                for(int a=n;a>=0;a--){
                    if(a+b+c>n || a+b+c==0)continue;
                    
                    double p_wasted = (double)(n-(a+b+c))/n;
                    double ev_wasted = p_wasted/(1-p_wasted);                    
                    
                    ev[a][b][c] += ev_wasted*p[a][b][c];
                    
                    if(a>0){
                    	double x =(double) (a)/(a+b+c);
						p[a-1][b][c] += (double) p[a][b][c]*x;
						ev[a-1][b][c] += ev[a][b][c]*x;
                		}
                    if(b>0){
                    	double y =(double) (b)/(a+b+c);
						p[a+1][b-1][c] += (double) p[a][b][c]*y;
						ev[a+1][b-1][c] += ev[a][b][c]*y;
							}
                    
                    if(c>0){
                    	double z =(double) (c)/(a+b+c);
						p[a][b+1][c-1] += (double) p[a][b][c]*z;
						ev[a][b+1][c-1] += ev[a][b][c] * z;
						}

                }
            }
        }

//    cout<<p[0][0][0]<<"\n";
//    cout<<p[cnt[1]][cnt[2]][cnt[3]];
	cout<<setprecision(10)<<fixed<<ev[0][0][0]+cnt[1]+2*cnt[2]+3*cnt[3];

    }
    return 0;
}    

Measured memory_bytes: 450816
#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
#define P pair<int,int>
using namespace std;
signed main(){
	int a,ans=0;
	string s,t,r;
	cin>>a>>s>>t>>r;
	f(i,a){
		int x=0;
		if(s[i]!=t[i]) x++;
		if(t[i]!=r[i]) x++;
		if(s[i]!=r[i]) x++;
		ans+=max((int)(0),x-1);
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
    int n;cin>>n;
    pair<int,int> a[n];
    for (int i=0;i<n;i++) {
        int b,c;
        cin>>b>>c;
        a[i]={c,b};
    }
    sort(a,a+n);
    for (int i=0,t=0;i<n;i++) {
        t+=a[i].second;
        if (t>a[i].first) {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>

int main(int argc, char** argv)
{
		int N;
		std::vector<int> A;
		int ret = scanf("%d", &N);
		int tmp;
		int even_num = 0;
		for(int i=0; i<N; i++) {
			ret = scanf("%d", &tmp);
			A.push_back(tmp);
			if(0 == tmp%2){
				even_num++;
			}
		}

		double base1 = 3;
		double base2 = 2;
		double n1 = N;
		double n2 = even_num;

		double result = pow(base1, n1) - pow(base2, n2);
		printf("%d\n", int(result));
		return 0;
}


Measured memory_bytes: 640
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*                                                    
      I ♥ CLARICE STARLING...                                                               
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
const ll INF = (ll)2e18 + 77;
void solve()
{
    int x;cin>>x;
    if(x>=30)cout<<"Yes\n";
    else cout<<"No\n";
}
int main()
{
   fastio
   //Test_cases
   solve();
  return 0;
}
//**always check if you are not killing input in between
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
// Syntax to create a min heap for priority queue priority_queue <int, vector<int>, greater<int>>; 
//for modinverse use modularexponention(x,M-2,M);
//for "each" subtraction from ans(ans-k) if(ans<0) do ans+=MOD,ans%=MOD
//vector<vector<int>>dp(201,vector<int>(n+1)); A way to initialize vector of vector
//string2=string1.substr(pos,length);if len no specified then till end
//void fill (ForwardIterator first, ForwardIterator last, const T& val);
//The range filled is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.


//If wrong on pretest 2 means logically wrong
/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>
int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    if(n==m){
        printf("Yes");
        return 0;
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 1732
##D
a,b,x = map(int,input().split())

import math
if x >= a*a*b/2:
    y = 2*(a*a*b-x)/(a*a)
    if y == 0:
        atan1 = 0
    else:
        atan1 = 90-math.degrees(math.atan(a/y))
else:
    y = 2*x/(a*b)
    if y == 0:
        atan1 = 0
    else:
        atan1 = math.degrees(math.atan(b/y))
print(atan1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vector<int>>
#define fin(ar,k,n) for(int i=k;i<n;i++) cin>>ar[i]
#define fout(ar,k,n) for(int i=k;i<n;i++) cout<<ar[i]<<' '
#define all(z) z.begin(),z.end()
#define mcc ((int)1e9+7)
#define mcf 998244353
#define mi map<int,int>
#define mem(a,n) memset(a,n,sizeof(a))
#define pii pair<int,int>
#define mp(a,b) make_pair(a,b)

using namespace std;
typedef long long ll;

const int N=1e5+7;
int dp[N],ar[N],n;

void solve()
{
    cin>>n;
	fin(ar,0,n);
	dp[1]=abs(ar[1]-ar[0]);
	for (int i=2;i<n;i++)
	{
		dp[i]=min(abs(ar[i]-ar[i-2])+dp[i-2],abs(ar[i]-ar[i-1])+dp[i-1]);
	}
	cout<<dp[n-1]<<endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<tuple<string, int, int>> sp;
    for(int i = 1;i <= n;i++){
        string s;
        cin >> s;
        int p;
        cin >> p;
        sp.emplace_back(s, p, i);
    }
    sort(sp.begin(), sp.end(), [](auto a, auto b){
        return (get<0>(a) != get<0>(b)) ? (get<0>(a) < get<0>(b)) : (get<1>(a) > get<1>(b));
    });
    for(auto& e : sp){
        cout << get<2>(e) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
 int a,b,c,x,y=0;
 scanf("%d%d%d",&a,&b,&c);
 for(x=a;x<=b;x++)
  {
   if(c%x==0)
    y++;
  }
 printf("%d\n",y);
 return 0;
}


Measured memory_bytes: 2104
import java.util.Scanner;
import java.lang.StringBuilder;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        StringBuilder sb = new StringBuilder();

        for(int i = 0; i < s.length(); i++){
            char c = s.charAt(i);
            if(c >= 97 && c <= 122) c -= 32;
            else if(c >= 65 && c <= 90) c += 32;

            sb.append(c);
        }

        System.out.println(sb.toString());

        sc.close();
    }
}


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

int a, b;

int main(){
	cin >> a >> b;
	if (a*b % 2 == 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 768
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,M = I()
links = [[] for _ in range(N)]
for i in range(M):
    x,y,z = I()
    links[x-1].append(y-1)
    links[y-1].append(x-1)
ans = 0
visited = [0]*N
def dfs(n):
    if visited[n]:
        return
    visited[n] = 1
    for l in links[n]:
        dfs(l)
for i in range(N):
    if not visited[i]:
        dfs(i)
        ans += 1
print(ans)


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

using namespace std;

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < v.size();i++)

#define INF 1000000000
#define pb(a) push_back(a)
#define llong long long
#define vi vector<int>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())

int main(){
	int a,b,c,d,e;
	int ans=0;
	cin>>a>>b>>c>>d>>e;
	if(a<0){
		ans+=-a*c;
		ans+=d;
		ans+=b*e;
	}else{
		ans=(b-a)*e;
	}

	cout<<ans<<"\n";
	return 0;
}

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

int main()
{
  int N;
  cin >> N;
  vector<int> h(N);
  rep(i, N)
  {
    cin >> h[i];
  }
  int shower_count = 0;
  bool is_showering = false;

  rep(i, 100)
  {
    rep(j, N)
    {
      if (i + 1 > h[j])
      { //水を上げない
        if (is_showering)
        {
          is_showering = false;
          shower_count++;
        }

        continue;
      }

      if (is_showering)
        continue;
      else
      {
        is_showering = true;
      }
    }
    if (is_showering)
    {
      shower_count++;
      is_showering = false;
    }
  }

  cout << shower_count << endl;

  return 0;
}

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

int main() {
    int h, w; cin >> h >> w;
    vector<vector<char>> v(h, vector<char>(w));
    vector<int> hc(h, 1);
    vector<int> wc(w, 1);
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            cin >> v[i][j];
        }
    }

    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            if (v[i][j] == '#') {
                hc[i] = 0;
            }
        }
    }
    
    for (int i=0; i<w; i++) {
        for (int j=0; j<h; j++) {
            if (v[j][i] == '#') {
                wc[i] = 0;
            }
        }
    }

    for (int i=0; i<h; i++) {
        if (hc[i] == 0) {
            for (int j=0; j<w; j++) {
                if (wc[j] == 0) {
                    cout << v[i][j];
                }
            }
            cout << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		for(int i = a;i<=b;i++) {
			if(c%i==0) count++;
		}
		System.out.println(count);
	}
}



Measured memory_bytes: 26272
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <climits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;

#define ten(n) (1e##n)
#define COUT cout <<
#define SPACE_COUT << " "  <<
#define COMMA_COUT << ", " <<
#define ENDL << endl;

const ll DDD = ten(9) + 7;

map<pair<ll, ll>, ll> dp;
ll func(ll S, ll X) {
  if (S < 0 || X < 0) return 0;
  if (S == 0 && X == 0) return 1;
  
  pair<ll, ll> key = make_pair(S, X);
  if (dp.find(key) != dp.end()) {
    return dp[key];
  }

  dp[key] = func(S/2, X/2);
  if (S-1 >= 0 && X-1 >= 0) 
    dp[key] = (dp[key] + func((S-1)/2, (X-1)/2)) % DDD;
  if (S-2 >= 0)
    dp[key] = (dp[key] + func((S-2)/2, X/2)) % DDD;  	 
  return dp[key];
}

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

    cin >> N;
    cout << func(N, N) << endl;
    return 0;
}


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

using namespace std;


//dpは行ったかどうか、vは行けるかどうか
void depth_search(int x,int y,vector< vector<int> >& dp,vector< vector<int> >& v,int w,int h){
  if(x>0){if(v[x-1][y]==1 and dp[x-1][y]!=1){dp[x-1][y]=1;depth_search(x-1,y,dp,v,w,h);}}
  if(x<h-1){if(v[x+1][y]==1 and dp[x+1][y]!=1){dp[x+1][y]=1;depth_search(x+1,y,dp,v,w,h);}}
  if(y>0){if(v[x][y-1]==1 and dp[x][y-1]!=1){dp[x][y-1]=1;depth_search(x,y-1,dp,v,w,h);}}
  if(y<w-1){if(v[x][y+1]==1 and dp[x][y+1]!=1){dp[x][y+1]=1;depth_search(x,y+1,dp,v,w,h);}}
}


void solve(int w,int h){
  vector< vector<int> > dp(h,vector<int>(w,0));
  vector< vector<int> > v(h,vector<int>(w,0));
  int x,y;
  for(int i=0;i<h;i++){
    string s;cin >>s;
    for(int j=0;j<w;j++){
      if(s[j]!='#') v[i][j]=1;
      if(s[j]=='@'){dp[i][j]=1;x=i;y=j;}
    }
  }
  depth_search(x,y,dp,v,w,h);
  int c=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(dp[i][j]==1)c+=1;
    }
  }
  cout << c << endl;
}


int main(){
  int w,h;
  while(cin >> w >> h and w!=0){
    solve(w,h);
  }
}



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

using namespace std;

int main()
{
  vector<int> a(3,0);
  for(int i=0;i<3;i++)
  {
      cin >> a.at(i);
  }
//   cin >> a >> b >> c;
    sort(a.begin(),a.end());
    for(int i=0;i<2;i++)
    {
        cout << a.at(i) << " ";
    } 
    cout <<a.at(2)<<  endl;
}


Measured memory_bytes: 3168
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;

bool is_square(int x){
    for (int i = 1; i * i <= x; i++){
        if(i * i == x) return true;
    }
    return false;    
}

int norm(int x[], int y[], int num){
    int res = 0;
    rep(i, num){
        res += (x[i] - y[i]) * (x[i] - y[i]);
    }
    return res;
}

int main(){
    int n, d;
    cin >> n >> d;
    int x[n][d];
    rep(i, n){
        rep(j, d) cin >> x[i][j];
    }
    int ans = 0;
    for (int i = 0; i < n - 1; i++){
        for (int j = i + 1; j < n; j++){
            int dis = norm(x[i], x[j], d);
            if(is_square(dis)) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
{
    public static void Main()
    {
        var s = Console.ReadLine().Split(' ');
        int N = int.Parse(s[0]);
        int L = int.Parse(s[1]);

        int Sum = N * (L - 1) + N * (N + 1) / 2;
        
        int M = int.MaxValue;

        int D = 0;

        for (int i = 1; i <= N; i++)
        {
            if (M > Math.Abs(Sum - (Sum - 2 * (L + i - 1))))
            {
                M = Math.Abs(Sum - (Sum - 2 * (L + i - 1)));
                D = i;
            }
        }

                
        Console.WriteLine(Sum - (L + D - 1));                
    }
}

Measured memory_bytes: 11092
#include <cstdio>
#include <cstring>
#include <stack>
#include <deque>

int main(void)
{
	std::deque<int> dq;
	int n;
  scanf("%d", &n);
	for(int i = 0; i < n; i++) {
		char command[10];
		int tmp;
    scanf("%s", command);
		if(!strcmp(command, "insert")) {
      scanf("%d", &tmp);
			dq.push_front(tmp);
		} else if(!strcmp(command, "delete")) {
      scanf("%d", &tmp);
			std::stack<int> st;
			int now = -1;
			while(now != tmp && dq.size() > 0) {
				now = dq.front();
				dq.pop_front();
				st.push(now);
				if(now == tmp) {
					st.pop();
				}
			}
			while(st.size() > 0) {
				now = st.top();
				st.pop();
				dq.push_front(now);
			}
		} else if(!strcmp(command, "deleteFirst")) {
			dq.pop_front();
		} else if(!strcmp(command, "deleteLast")) {
			dq.pop_back();
		}
/* 		std::deque<int> dq_ = dq;
		while(dq_.size() > 0) {
			int now = dq_.front();
			dq_.pop_front();
      printf("%d%c", now, dq_.size() ? ' ' : '\n');
		} */
	}
	while(dq.size() > 0) {
		int now = dq.front();
		dq.pop_front();
    printf("%d%c", now, dq.size() ? ' ' : '\n');
	}
	return 0;
}


Measured memory_bytes: 6540
import collections

_, *a = map(int, open(0).read().split())
c=collections.Counter(a)
tmp=[]
for k,v in c.items():
    if v>3:
        tmp.append(k)
    if v>1:
        tmp.append(k)
tmp.sort()
print(tmp[-1]*tmp[-2] if len(tmp) >1 else 0)

Measured memory_bytes: 22492
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
const int N=100;
int n,m,a[N],b[N],c[N],d[N];
using namespace std;

int dis(int i,int j){return abs(a[i]-c[j])+abs(b[i]-d[j]);}
int main()
{
	#ifdef Kay
		freopen ("code.in","r",stdin);
		freopen ("code.out","w",stdout);
	#endif
	cin>>n>>m;
	int i,j,k;
	for (i=1;i<=n;i++) cin>>a[i]>>b[i];
	for (i=1;i<=m;i++) cin>>c[i]>>d[i];
	for (i=1;i<=n;i++)
	{
		for (j=2,k=1;j<=m;j++)
		if (dis(i,j)<dis(i,k)) k=j;
		printf ("%d\n",k);
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define mp make_pair
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 100005  //check the limits, man
const ll INF = 1e18;
int main()
{
    ll n,x,t;
    cin >> n;
    for(x=1;x<=n;x++)
    {
        t=(x+1),t*=x;
        t/=2;
        if(t>=n)
        {
            llout(x);
            return 0;
        }
    }
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<char,int> P;

int main(){
	char s[1000005];
	scanf("%s",s);
	vector<P> d;//(?¨????,??°)
	int count=1; char before=s[0];
	for(int i=1;s[i]!=0;i++){
		if(s[i]!=before){
			d.push_back(P(before,count));
			before=s[i];
			count=1;
		}else count++;
	}
	d.push_back(P(before,count));
	int res=0;
	if(d.size()==1||d.size()==2) printf("0\n");
	else{
		for(int i=0;i<d.size()-2;i++)
			if(d[i].first=='J'&&d[i+1].first=='O'&&d[i+2].first=='I')
				if(d[i].second>=d[i+1].second&&d[i+1].second<=d[i+2].second) res=max(res,d[i+1].second);
		printf("%d\n",res);
	}
}

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

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

using ll = long long;
using P = pair<int,int>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

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

int main() {
    string S;
    cin>>S;
    int t = S.size();
    ll ans = 0;
    vector<int> v;
    int p = 0;
    while(p<t){
        if(S[p]=='A'){
            v.push_back(0);
            p++;
            continue;
        }
        if(S[p]=='C'){
            v.push_back(-1);
            p++;
            continue;
        }
        if(S[p]=='B'){
            if(p==t-1||S[p+1]!='C') {
                v.push_back(-1);
                p++;
                continue;
            }
            else {
                v.push_back(1);
                p+=2;
                continue;
            }
        }
    }
    ll cnt = 0;
    reverse(v.begin(),v.end());
    rep(i,(int)v.size()){
        if(v[i]==1) cnt++;
        if(v[i]==0) ans+=cnt;
        if(v[i]==-1) cnt=0;
    }
    cout<<ans<<endl;
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll X,N;
    string S;
    cin >> X>>N;
    vector<ll> p(N);
    REP(i,N){
        cin >> p.at(i);
    }

    vector<bool> flag(300);

    REP(i,101){
        flag.at(i) = false;
    }

    REP(i,N){
        flag.at(p.at(i)) = true;
    }

    ll ans = INF;
    ll tmp_min = INF;

    for (ll i = -100; i <= 200; i++) {

        if(i>=0){
            if (flag.at(i))
            {
            }
            else
            {
                ll tmp = abs(X - i);
                if (tmp_min > tmp)
                {
                    ans = i;
                    tmp_min = tmp;
                }
            }
        }
        else{
            ll tmp = abs(X - i);
            if (tmp_min > tmp)
            {
                ans = i;
                tmp_min = tmp;
            }
        }

    }
    cout << ans << endl;
}


Measured memory_bytes: 3656
#![allow(non_snake_case)]

use std::io;

fn main() {
    let mut buf = String::new();
    let sin = io::stdin();
    sin.read_line(&mut buf).ok();
    let mut ws = buf.split_whitespace();
    let a = ws.next().unwrap().parse::<i32>().unwrap();
    let b = ws.next().unwrap().parse::<i32>().unwrap();

    let d = a / b;
    let r = a % b;
    let f = a as f64 / b as f64;

    println!("{} {} {:.5}", d, r, f);
}



Measured memory_bytes: 5040
bingo_card = [list(map(int,input().split())) for _ in range(3)] 
bingo_card_series = bingo_card[0] + bingo_card[1] + bingo_card[2]
n = int(input())
nums = [int(input()) for _ in range(n)]

for i,x in enumerate(bingo_card_series):
    if x in nums:
        bingo_card_series[i] = -1

if bingo_card_series[0] == bingo_card_series[1] == bingo_card_series[2]:
    print("Yes")
elif bingo_card_series[3] == bingo_card_series[4] == bingo_card_series[5]:
    print("Yes")
elif bingo_card_series[6] == bingo_card_series[7] == bingo_card_series[8]:
    print("Yes")
elif bingo_card_series[0] == bingo_card_series[3] == bingo_card_series[6]:
    print("Yes")
elif bingo_card_series[1] == bingo_card_series[4] == bingo_card_series[7]:
    print("Yes")
elif bingo_card_series[2] == bingo_card_series[5] == bingo_card_series[8]:
    print("Yes")
elif bingo_card_series[0] == bingo_card_series[4] == bingo_card_series[8]:
    print("Yes")
elif bingo_card_series[2] == bingo_card_series[4] == bingo_card_series[6]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#define full(c) c.begin(), c.end()
typedef unsigned long long int ull;
using namespace std;

int main(){
	int i, n, s = 0;
	cin >> n;
	for (i = 0; i < n; i++){
		int a;
		cin >> a;
		s += --a;
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
#58
import decimal
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))

near = float("inf")
num = 0

for i in h:
    x = t - i*decimal.Decimal("0.006")
    if near > abs(a-x):
        near = abs(a-x)
        num = i
        
print(h.index(num)+1)

Measured memory_bytes: 9980