akhauriyash/Code-Regression huggingface dataset:
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

struct s_t{
  string s;
  ll p;
  ll x;
};

bool asc(s_t left,s_t right) {
  return left.s == right.s ? left.p > right.p : left.s < right.s;
}

int main(){
  ll n;
  cin>>n;
  vector<s_t>v;
  s_t z;
  for(ll i=0;i<n;i++){
    cin>>z.s>>z.p;
    z.x=i+1;
    v.push_back(z);
  }
  sort(v.begin(),v.end(),asc);
  for(ll i=0;i<n;i++){
    cout<<v[i].x<<endl;
  }
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	ll n;
	cin >> n;
	ll ans = n * (n-1) / 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=1004;
vector<string>s4=
{
 "aabc",
 "ddbc",
 "bcaa",
 "bcdd"
};
vector<string>s5=
{
  "..abc",
  "..abc",
  "ddeef",
  "ggh.f",
  "iihjj"
};
vector<string>s6=
{
    "...abc",
    "...abc",
    "ddee.f",
    "..gghf",
    "iij.h.",
    "kkj.ll"
};
vector<string>s7=
{
    "....abc",
    "....abc",
    "....def",
    "....def",
    "gghh..i",
    "jjkk..i",
    "llmmnn."
};
vector<vector<string > >ok={s4,s4,s4,s4,s4,s5,s6,s7};
 main()

{
    fast
    int n;
    cin>>n;
    if(n<=2)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    if(n==3)
    {
        cout<<"aa."<<endl;
        cout<<"..a"<<endl;
        cout<<"..a"<<endl;
        return 0;
    }
    vector<string>ses(n,string(n,'.'));
    int x=n;
    int z=0;
    while(x>7)
    {
        f(i,0,3)
        {
            f(j,0,3)
            {
                ses[z+i][z+j]=s4[i][j];
            }
        }
        z+=4;
        x-=4;
    }
    f(i,0,x-1)
    {
        f(j,0,x-1)
        {
            ses[z+i][z+j]=ok[x][i][j];
        }
    }
    f(i,0,n-1)
    {
        cout<<ses[i]<<"\n";
    }
    return 0;

}





































Measured memory_bytes: 4220
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    public static void Main()
    {
        int N = NextInt();
        int[] p = LineInt();
        int ans = 0;
        for (int i = 0; i < N; i++)
        {
            if (i < N - 1 && p[i] == (i + 1))
            {
                int box = p[i];
                p[i] = p[i + 1];
                p[i + 1] = box;
                ans++;
                //Console.WriteLine(i + " swap");
            }
            else if (i != 0 && p[i] == (i + 1))
            {
                int box = p[i];
                p[i] = p[i - 1];
                p[i - 1] = box;
                ans++;
                //Console.WriteLine(i + " swap");
            }
        }
        Console.WriteLine(ans);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 18144
#include <iostream>
#include <string>
#include<cstring>
#include<stdio.h>
using namespace std;
const int MAX = 1e5 + 5;
int Xi[MAX]; int Li[MAX];int yes[MAX] ;
int cmp(const void *a, const void *b)
{
	return *(char *)a - *(int *)b;
}
int  main() {
	int a = 0, b = 0;
	cin >> a >> b; 
	if (a > b) {
		for (int i=0;i<a;i++)
		{
			cout << b;
		}
	}
	else {
		for (int i =0;i<b;i++)
		{
			cout << a;
		}

	}


	return 0;

}

Measured memory_bytes: 256
// g++ -std=gnu++1y -O2 main.cpp

#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <climits>

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

int main() {
	int N, M;
	cin >> N >> M;

	int total = (N + M) * (N + M - 1) / 2;
	cout << (total - (N * M)) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
vector<pii>pat[100000];
bool flag[100000];
int siz[100000];
int num;
int cent;
ll len = -1;
void dfs(int node)
{
	if (flag[node])return;
	flag[node] = true;
	siz[node] = 1;
	int maxi = 0;
	for (int i = 0; i < pat[node].size(); i++)
	{
		if (!flag[pat[node][i].first])
		{
			dfs(pat[node][i].first);
			siz[node] += siz[pat[node][i].first];
			maxi = max(maxi, siz[pat[node][i].first]);
			if (siz[pat[node][i].first] * 2 == num)len = pat[node][i].second;
		}
	}
	maxi = max(maxi, num - siz[node]);
	if (maxi <= num / 2)cent = node;
}
ll sum = 0, mini = 1000000000LL;
void dfs2(int node, ll d)
{
	if (flag[node])return;
	flag[node] = true;
	sum += d * 2;
	if (node != cent)mini = min(mini, d);
	for (int i = 0; i < pat[node].size(); i++)dfs2(pat[node][i].first, pat[node][i].second + d);
}
int main()
{
	scanf("%d", &num);
	for (int i = 0; i < num - 1; i++)
	{
		int za, zb, zc;
		scanf("%d%d%d", &za, &zb, &zc);
		za--, zb--;
		pat[za].push_back(make_pair(zb, zc));
		pat[zb].push_back(make_pair(za, zc));
	}
	dfs(0);
	fill(flag, flag + num, false);
	dfs2(cent, 0);
	if (len == -1)printf("%lld\n", sum - mini);
	else printf("%lld\n", sum - len);
}

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

ll *dp;
ll *a;
/*
ll solution(int s)
{

    if (dp[s] != 0)
    {
        return dp[s];
    }

    dp[s] += min(solution(s+1), (solution(s+2)));
    return dp[s];
}
*/
int main()
{
    int n, t, k;
    cin >> n>>k;
     ll a[ n ];
     ll dp[n + 1];
    for(int i=0;i<n;i++){
        cin>>a[i];
        dp[i] = INT_MAX;
        //a[i] = t;
    }
    dp[0] = 0;
    for(int i=1;i<n;i++){
            for(int j = i - 1; j >= i - k && j >= 0; j--){
                dp[i] = min(dp[i], dp[j] + abs(a[j] - a[i]));
        }
    }
    cout<<dp[n-1]<<endl;

    return 0;
}


Measured memory_bytes: 5172
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n, k);
    int ans = 1;
    int tmp = 1;
    while(true){
        tmp *= k;
        if(tmp > n) break;
        ans ++;
    }
    Cout(ans);
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N = int(input())
di = []
tmp =[]

for i in range(N):
    si, pi = input().split()
    pi = int(pi) * (-1)
    tmp = [si, pi, i]
    di.append(tmp)
di = sorted(di, key=lambda x: (x[0], x[1]))    

for i in range(N):
    print(di[i][2]+1)






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

int main() {
	string s, t;
	cin >> s;
	cin >> t;

	int count = 0;

	for (int i = 0; i < s.length(); i++) {
		if (s[i] != t[i])
			count++;
	}

	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3616
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int k = scanner.nextInt();
		int abc[] = new int[3];

		abc[0] = a;
		abc[1] = b;
		abc[2] = c;
		Arrays.sort(abc);

		for (int i = 0; i < k; i++) {
			abc[2] *= 2;
		}

		int sum = 0;
		for (int i = 0; i < 3; i++) {
			sum += abc[i];
		}

		System.out.println(sum);

	}
}


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

int main()
{
    int n;
    cin >> n;
    queue<int> que;
    int64_t tsum = 0;
    int con;
    int64_t s = 0;
    int64_t mod = 1000000007;
    for (int i = 0; i < n; i++)
    {
        cin >> con;
        que.push(con);
        tsum += con;
    }
    for (int i = 0; i < n - 1; i++)
    {
        tsum -= que.front();
        s += ((que.front() % mod) * (tsum % mod)) % mod;
        que.pop();
    }

    cout << s % mod << endl;
}

Measured memory_bytes: 4040
#include <cstdio>
#include <algorithm>

typedef long long int64;

const int MAXN = 100000 + 10;

int n, m, v, p;
int a[MAXN];

bool judge(int k) {
	int i, overcnt = 0, x;
	int64 sum = 0;
	
	x = a[k] + m;

	for(i=n; i; i--) {
		if(i == k) {
			sum += m;
			continue;
		}
			
		if(a[i] > x or overcnt < p - 1) {
			overcnt++;
			sum += m;
		}
		else 
			sum += std::min(x - a[i], m);
	}
	return overcnt <= p - 1 and sum >= 1ll * m * v;
}

int main() {
	int i, l, r, mid;
	int ans=0;
	
	scanf("%d %d %d %d", &n, &m, &v, &p);
	for(i=1; i<=n; i++) 
		scanf("%d", &a[i]);

	std::sort(a+1, a+1+n);
	
	l = 1;
	r = n;
	while(l ^ r) {
		mid = (l + r) >> 1;
		if(judge(mid))
			r = mid;
		else
			l = mid + 1;
	}
	for(i=1; i<=n; i++)
		if(a[i] >= a[l])
			ans++;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>
#include<bitset>


using namespace std;

#define rep(i,n) for(int i=0;i<n;i++) //0から
#define REP(i,n) for(int j=i;j<n;j++) //iから

typedef long long ll;



//英字ならture、数字ならfalse
bool isalpha(char s){
    if(('A'<=s&&s<='Z')||('a'<=s&&s<='z')){
        return 1;
    }else{
        return 0;
    }
}
//全ての文字が英字ならture、数字ならfalse
bool Isalpha(string s){
    ll n;
    bool tmp = true;
    rep(i,n){
        if(isalpha(s[i])){
            tmp = false;
        }
    }
    return tmp;
}




using Graph = vector<vector<ll>>;



//cout<<fixed<<setprecision(10);

ll binary_search(vector<ll> a, ll n, ll key){
    ll right = n, left = -1;
    ll md = (right + left) / 2;

    while(right - left > 1){
        if(a[md] <= key){
            right = md;
        }else{
            left = md;
        }
        md = (right + left) / 2;
    }
    if(left == -1) return -1; //無い場合
    return right;
}

#define MOD 1000000007

ll INFLL =  pow(10,9)+1;




string periodic_table[104] = {
    "None","H(1)","He(2)", //2
    "Li(3)","Be(4)","B(5)","C(6)","N(7)","O(8)","F(9)","Ne(10)", //10
    "Na(11)","Mg(12)","Al(13)","Si(14)","P(15)","S(16)","Cl(17)","Ar(18)", //18
    "K(19)","Ca(20)","Sc(21)","Ti(22)","V(23)","Cr(24)","Mn(25)","Fe(26)","Co(27)","Ni(28)","Cu(29)","Zn(30)","Ga(31)","Ge(32)","As(33)","Se(34)","Br(35)","Kr(36)", //36
    "Rb(37)","Sr(38)","Y(39)","Zr(40)","Nb(41)","Mo(42)","Tc(43)","Ru(44)","Rh(45)","Pd(46)","Ag(47)","Cd(48)","In(49)","Sn(50)","Sb(51)","Te(52)","I(53)","Xe(54)", //54
    "Cs(55)","Ba(56)","La(57)","Ce(58)","Pr(59)","Nd(60)","Pm(61)","Sm(62)","Eu(63)","Gd(64)","Tb(65)","Dy(66)","Ho(67)","Er(68)","Tm(69)","Yb(70)","Lu(71)","Hf(72)","Ta(73)","W(74)","Re(75)","Os(76)","Ir(77)","Pt(78)","Au(79)","Hg(80)","Tl(81)","Pb(82)","Bi(83)","Po(84)","At(85)","Rn(86)", //86
    "Fr(87)","Ra(88)","Ac(89)","Th(90)","Pa(91)","U(92)","Np(93)","Pu(94)","Am(95)","Cm(96)","Bk(97)","Cf(98)","Es(99)","Fm(100)","Md(101)","No(102)" //102
};

int main(){
    ll d,t,s;
    cin>>d>>t>>s;
    if(d<=t*s){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

    return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]
typedef vector< int > vi;
typedef vector< ll > lvi;
typedef vector< vi > vvi;
typedef vector< lvi > lvvi;
typedef pair< int,int > ii;
typedef pair< ll,ll > lii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define mp make_pair
#define ld long double
#define ull unsigned long long int
#define mod 1000000007
lvvi adj;
lvi size,ans;
ll curr=1,n_fac=1;
ll modpow(ll x,ll y)
{
	ll ans=1;
	while(y>0)
	{
		if(y&1) ans=(ans*x)%mod;
		x=(x*x)%mod;
		y=y>>1;
	}
	return ans;
}
void dfs(int x,int par=-1)
{
	size[x]=1;
	for(auto next:adj[x])
	{
		if(next!=par)
		{
			dfs(next,x);
			size[x]+=size[next];
			size[x]%=mod;
		}
	}
	curr=(curr*size[x])%mod;
}
void dfs1(int x,int par=-1)
{
	ans[x]=(n_fac*modpow(curr,mod-2))%mod;
	for(auto next:adj[x])
	{
		if(next==par) continue;
		ll s_curr=curr,s_next=size[next],s_x=size[x];
		size[x]-=s_next;
		size[next]=s_x;
		curr=(curr*modpow(s_next,mod-2))%mod;
		curr=(curr*modpow(s_x,mod-2))%mod;
		curr=(curr*size[next])%mod;
		curr=(curr*size[x])%mod;
		dfs1(next,x);
		curr=s_curr;
		size[next]=s_next;
		size[x]=s_x;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
	ll n;
	cin>>n;
	adj.resize(n+2);
	ans.resize(n+2);
	size.resize(n+2);
	for (int i = 1; i < n; ++i)
	{
		ll x,y;
		cin>>x>>y;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	dfs(1);
	for (int i = 1; i <=n; ++i)
	{
		n_fac=(i*n_fac)%mod;
	}
	dfs1(1);
	for (int i = 1; i <=n; ++i)
	{
		cout<<ans[i]<<endl;
	}
	return 0;
}

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

using namespace std;

bool mark[100010];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, k, r, s, p, ans = 0;
	string t;
	cin >> n >> k >> r >> s >> p >> t;
	for (int i = 1; i <= n; ++i) {
		if (i <= k) {
			if (t[i - 1] == 'r')
				ans += p;
			else if (t[i - 1] == 's')
				ans += r;
			else if (t[i - 1] == 'p')
				ans += s;
			mark[i - 1] = true;
		} else {
			if (t[i - 1] == 'r' && t[i - k - 1] != 'r')
				ans += p, mark[i - 1] = true;
			else if (t[i - 1] == 's' && t[i - k - 1] != 's')
				ans += r, mark[i - 1] = true;
			else if (t[i - 1] == 'p' && t[i - k - 1] != 'p')
				ans += s, mark[i - 1] = true;
			else if (t[i - 1] == 'r' && !mark[i - k - 1] && t[i - k - 1] == 'r')
				ans += p, mark[i - 1] = true;
			else if (t[i - 1] == 's' && !mark[i - k - 1] && t[i - k - 1] == 's')
				ans += r, mark[i - 1] = true;
			else if (t[i - 1] == 'p' && !mark[i - k - 1] && t[i - k - 1] == 'p')
				ans += s, mark[i - 1] = true;
		}
	}
	cout << ans << '\n';
  return 0;
}



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

using namespace std;

int main() {
  int n,k;
  cin>>n>>k;
  
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
  cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  int ans=0;
  for (int i = 0; i < k; i++) {
  ans+=vec.at(i);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
void qmax(int &x,int y) {if (x<y) x=y;}
void qmin(int &x,int y) {if (x>y) x=y;}
int read()
{
    char s;
    int k=0,base=1;
    while((s=getchar())!='-'&&s!=EOF&&!(isdigit(s)));
    if(s==EOF)exit(0);if(s=='-')base=-1,s=getchar();
    while(isdigit(s)){k=k*10+(s^'0');s=getchar();}
    return k*base;
} 
void write(int x)
{
    if(x<0){putchar('-');write(-x);}
    else{if(x/10)write(x/10);putchar(x%10+'0');}
}
int n;
struct node
{
	int x,y,z,t;
} a[100100];
bool cmp(node aa,node bb)
{
	return aa.t<bb.t;
}
int nx,ny,flag;
int main()
{
	n=read();
	for (int i=1;i<=n;i++)
	{
		a[i].t=read();
		a[i].x=read();
		a[i].y=read();
	}
	sort(a+1,a+n+1,cmp);flag=true; 
	nx=ny=0;
	a[0].t=0;
	for (int i=1;i<=n;i++)
	{
		if (a[i].t-a[i-1].t>=abs(a[i].x-nx)+abs(a[i].y-ny)&&(abs(a[i].x-nx)+abs(a[i].y-ny))%2==(a[i].t-a[i-1].t)%2)
		{
			flag=true; 
			nx=a[i].x;ny=a[i].y;
		} else
		{
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;
} 

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	cout << (char)(a[0] - 32)<< (char)(b[0] - 32) << (char)(c[0] - 32 )<< endl;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    cin >> n;
    vector<ll> v(n);
    ll sum = 0;
    for(auto& i : v){
        ll a;
        cin >> a;
        i = a;
        sum += i;
    }

    ll ng = 0, ok = sum;
    vector<ll> u(n);
    while(1){
        ll mid = (ok + ng) / 2;
        u[0] = mid;
        ll s = mid;
        FOR(i, 1, n){
            u[i] = v[i-1]*2 - u[i-1];
            s += u[i];
        }
        if(s > sum) ok = mid;
        else if(s < sum) ng = mid;
        else break;
    }

    for(auto i : u) cout << i << " ";
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 2944
N = int(input())
xs = []
ys = []
hs = []
for i in range(N):
	x, y, h = map(int, input().split())
	xs.append(x)
	ys.append(y)
	hs.append(h)
for cx in range(101):
	for cy in range(101):
		h = 0
		for i in range(N):
			if hs[i] > 0:
				h = hs[i] + abs(cx - xs[i]) + abs(cy - ys[i])
				break
		ok = True
		for i in range(N):
			if max(h - abs(cx - xs[i]) - abs(cy - ys[i]), 0) != hs[i]:
				ok = False
				break
		if ok:
			print(cx, cy, h)
			exit(0)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9 + 7;
const int INF = 2e18;

signed main() {
    int N, M, V, P;
    cin >> N >> M >> V >> P;
    vector<int> A(N);
    cin >> A;
    sort(A.rbegin(), A.rend());
    int base = A[P - 1];
    int same = 0;
    int ans = P;
    int minus = 0;
    for (int i = P; i < N; i++) {
        if (base == A[i]) {
            same++;
            ans++;
            continue;
        }
        int count = (P - 1) + N - i;
        if (count >= V && base - A[i] <= M) ans++;
        else if (count < V) {
            int mid = i - (P - 1);
            int temp = V - (P - 1) - (N - i);
            temp = temp * M;
            temp -= minus;
            int check = 0;
            if (temp > 0) check = temp / mid + (temp % mid != 0);
            if (base + check - A[i] <= M) ans++;
        }
        minus += (base - A[i]);
    }
    cout << ans << endl;
}


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

using namespace std;

#define ll long long

const int INF = 1e9+9999;

vector <int> a;
vector <pair <int, int>> r;
vector <pair <int, int>> l;
stack <int> s;
set <pair <int, int>> q;

void func_stack(int i, vector <pair <int, int>>& dir) {
    while (!s.empty() && a[s.top()] < a[i]) {
        int idx = s.top();
        dir[idx].first = i;
        s.pop();
        q.insert({a[idx], idx});
    }
    s.push(i);
}

void func_set(int i, vector <pair <int, int>>& dir) {
    while (!q.empty() && q.begin()->first < a[i]) {
        int idx = q.begin()->second;
        dir[idx].second = i;
        q.erase(q.begin());
    }
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    ll ans = 0;
    cin >> n;

    a.resize(n);
    r.resize(n);
    l.resize(n);
    for (int i=0; i<n; ++i)
        l[i] = {-1, -1}, r[i] = {n, n};

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

    for (int i=0; i<n; ++i) {
        func_set(i, r);
        func_stack(i, r);
    }

    q.clear();
    while (!s.empty())
        s.pop();

    for (int i=n-1; i>=0; --i) {
        func_set(i, l);
        func_stack(i, l);
    }

    for (int i=0; i<n; ++i) {
        int r1 = r[i].first;
        int r2 = r[i].second;
        int l1 = l[i].first;
        int l2 = l[i].second;
        ans += (ll) a[i] * ( (i - l1) * (r2 - r1) + (r1 - i) * (l1 - l2) );
    }


    cout << ans;


}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>

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

using namespace std;

int getCk(vector<int> &v, int k){
    int res = 0;
    rep(i, v.size()-k+1){
        int spro = 1;
        rep(j, k){
            spro *= v[i+j];
        }
        res = max(res, spro);
    }
    return res;
}

int main(){
    int n, k;
    while(cin >> n >> k, n|k){
        vector<int> v(n);
        rep(i, n) cin >> v[i];
        int ck = getCk(v, k);
        int ans = 0;
        rep(i, n){
            for(int j = i+1; j < n; j++){
                swap( v[i], v[j] );
                ans = max(ans, getCk(v, k));
                swap( v[i], v[j] );
            }
        }
        if(ck <= ans) cout << ans-ck << endl;
        else cout << "NO GAME" << endl;
    }

    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, x;
	cin >> n >> x;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	ll ans = 0;
	rep(i, n - 1) {
		if (a[i] + a[i + 1] <= x) continue;
		int tmp = a[i] + a[i + 1];
		ans += tmp - x;
		a[i + 1] = max(0, a[i + 1] - tmp + x);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
# https://tjkendev.github.io/procon-library/python/max_flow/dinic.html
# Dinic's algorithm
from collections import deque
class Dinic:
    def __init__(self, N):
        self.N = N
        self.G = [[] for i in range(N)]

    def add_edge(self, fr, to, cap):
        forward = [to, cap, None]
        forward[2] = backward = [fr, 0, forward]
        self.G[fr].append(forward)
        self.G[to].append(backward)

    def add_multi_edge(self, v1, v2, cap1, cap2):
        edge1 = [v2, cap1, None]
        edge1[2] = edge2 = [v1, cap2, edge1]
        self.G[v1].append(edge1)
        self.G[v2].append(edge2)

    def bfs(self, s, t):
        self.level = level = [None]*self.N
        deq = deque([s])
        level[s] = 0
        G = self.G
        while deq:
            v = deq.popleft()
            lv = level[v] + 1
            for w, cap, _ in G[v]:
                if cap and level[w] is None:
                    level[w] = lv
                    deq.append(w)
        return level[t] is not None

    def dfs(self, v, t, f):
        if v == t:
            return f
        level = self.level
        for e in self.it[v]:
            w, cap, rev = e
            if cap and level[v] < level[w]:
                d = self.dfs(w, t, min(f, cap))
                if d:
                    e[1] -= d
                    rev[1] += d
                    return d
        return 0

    def flow(self, s, t):
        flow = 0
        INF = 10**9 + 7
        G = self.G
        while self.bfs(s, t):
            *self.it, = map(iter, self.G)
            f = INF
            while f:
                f = self.dfs(s, t, INF)
                flow += f
        return flow


# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

h,w = map(int,readline().split())
b = read().split()

#g = [[] for _ in range(h+w+2)]

S = h+w
T = h+w+1

D = Dinic(h+w+2)

for i in range(h):
    for j in range(w):
        if b[i][j] == "S":
            #print("S")
            sh,sw = i,j
            D.add_edge(S, i, 200)        
            D.add_edge(S, j+h, 200)        
            #g[S].append((i,200))
            #g[S].append((j+h,200))
        elif b[i][j] == "T":
            #print("T")
            th,tw = i,j
            D.add_edge(i, T, 200)        
            D.add_edge(j+h, T, 200)        
            #g[i].append((T,200))
            #g[j+h].append((T,200))
        elif b[i][j] == "o":
            #print("o")
            D.add_edge(i, j+h, 1)        
            D.add_edge(j+h, i, 1)        
            #g[i].append((j+h,1))
            #g[j+h].append((i,1))
            

if sh==th or sw==tw: print(-1)
else:
    print(D.flow(S,T))
    
    
    
    
    
    









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

constexpr int MOD = 1'000'000'007; //'

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

    const int n = s.length();
    vector<vector<int>> dp(n + 1, vector<int>(13, 0));
    dp[0][0] = 1;

    for (int i = 0; i < n; i++) {
        const int d = (s[i] == '?' ? -1 : s[i] - '0');
        for (int j = 0; j < 10; j++) {
            for (int k = 0; k < 13; k++) {
                if (d == -1 or d == j) {
                    dp[i + 1][(k * 10 + j) % 13] += dp[i][k];
                    dp[i + 1][(k * 10 + j) % 13] %= MOD;
                }
            }
        }
    }

    cout << dp[n][5] << '\n';

    return 0;
}

Measured memory_bytes: 8960
in_data = list(input())
if in_data[0] == "R":
    if in_data[1] == "R":
        if in_data[2] == "R":
            print("3")
        else:
            print("2")
    else:
        print("1")
elif in_data[0] == "S":
    if in_data[1] == "R":
        if in_data[2] == "R":
            print("2")
        else:
            print("1")
    elif in_data[1] == "S":
        if in_data[2] == "R":
            print("1")
        else:
            print("0")

Measured memory_bytes: 8968
#include<iostream>
#include<math.h>
using namespace std;
int n,m,a[15][15],sum=0;
double ans=0,h=1;
int main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)
		for(int o=0;o<m;o++)
			cin>>a[i][o];
	for(int i=n-1;i>=1;i--)
	{
		for(int o=i-1;o>=0;o--)
		{
			for(int j=0;j<m;j++)
				ans+=abs(a[i][j]-a[o][j])*abs(a[i][j]-a[o][j]);
			ans = sqrt(ans);
			if(ans == int(ans))
				sum++;
			ans=0;
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
import math
from collections import Counter
n, m = map(int, input().split())
a = list(map(int, input().split()))

if 9 in a and 6 in a:
    a.remove(6)
if 5 in a:
    if 2 in a:
        a.remove(2)
    if 3 in a:
        a.remove(3)
if 3 in a and 2 in a:
    a.remove(2)

req_m = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [None] * (n+1)
dp[0] = Counter([])

int_dp = [0] * (n+1)

for i in range(1, n+1):
    for j in a:
        if i >= req_m[j] and dp[i-req_m[j]] is not None:
            v = dp[i-req_m[j]] + Counter([j])
            if dp[i] is None:
                dp[i] = v
            else:
                if sum(dp[i].values()) < sum(v.values()):
                    dp[i] = v
                elif sum(dp[i].values()) == sum(v.values()):
                    if sorted(dp[i].elements(), reverse=True) < sorted(v.elements(), reverse=True):
                        dp[i] = v

print(''.join(map(str, sorted(dp[-1].elements(), reverse=True))))


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

#define MAX 100002

int n;

bool flag[MAX];

int main(){
	cin >> n;
	
	for (int i = 1; i <= n; i++){
		int p;
		scanf("%d", &p);
		flag[i] = (p == i);
	}
	int ans = 0;
	for (int i = 1; i <= n; i++){
		if (flag[i]){
			ans++;
			flag[i + 1] = false;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
def main():
    n = int(input())
    numbers = list(map(int, input().split(" ")))
    numbers.sort()
    if numbers[-1] % 2:
        target = (numbers[-1] + 1) // 2
    else:
        target = numbers[-1] // 2
    answer = 0
    for i in range(n):
        if target <= numbers[i]:
            if i == 0:
                answer = numbers[0]
                break
            elif abs(target - numbers[i]) < abs(target - numbers[i - 1]):
                answer = numbers[i]
                break
            else:
                answer = numbers[i - 1]
                break
    print(numbers[-1], answer)


if __name__ == '__main__':
    main()

Measured memory_bytes: 14052
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
string s;
cin>>s;
set<char>set;
for(ll i=0;i<s.size();i++){
    set.insert(s[i]);
}
if(set.size()==s.size()){
    cout<<"yes"<<endl;
}else{
    cout<<"no"<<endl;
}
}










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

int main (){
    ios_base::sync_with_stdio(false);
    string str;int k;cin>>str>>k;
    set<string>s;int len=str.length();

    for(int i=0;i<len;i++){
        string tmp;
        for(int j=i;j<len&&j<=i+k;j++){
            tmp+=str[j];
            s.insert(tmp);
            if(s.size()>k) {
                set<string>::reverse_iterator st=s.rbegin();
                s.erase(*st);
            }
        }
    }
    cout<<*s.rbegin()<<endl;
    return 0;
}


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

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

template <typename T>
string to_string(T t) {
  ostringstream ss;
  ss << t;
  return ss.str();
}

int n;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int res = INT_MAX;
  range(a, 1, n) {
    int b = n - a;
    if(a > b) break;
    string sa = to_string(a);
    string sb = to_string(b);
    int cur = 0;
    for(auto i : sa) cur += i - '0';
    for(auto i : sb) cur += i - '0';
    res = min(cur, res);
  }
  cout << res;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <inttypes.h>

#define MAX (1 << 18) /* 262144 */
#define INF INT64_C(99999999999999999)

int64_t ki[MAX * 2 - 1], ki_all[MAX * 2 - 1];

void ki_add_i(int idx, int qs, int qe, int qdelta, int ss, int se) {
	if (qe <= ss || se <= qs) { /* query ga segument kara kanzen ni hazurete iru */
		/* NOP */
	} else if (qs <= ss && se <= qe) { /* segment ga query ni kanzen ni fukumareru */
		ki_all[idx] += qdelta;
	} else {
		int sm = ss + (se - ss) / 2;
		int lidx = idx * 2 + 1, ridx = idx * 2 + 2;
		int64_t l, r;
		ki_all[lidx] += ki_all[idx];
		ki_all[ridx] += ki_all[idx];
		ki_all[idx] = 0;
		ki_add_i(lidx, qs, qe, qdelta, ss, sm);
		ki_add_i(ridx, qs, qe, qdelta, sm ,se);
		l = ki[lidx] + ki_all[lidx];
		r = ki[ridx] + ki_all[ridx];
		ki[idx] = l >= r ? l : r;
	}
}

void ki_add(int s, int e, int delta) {
	ki_add_i(0, s, e, delta, 0, MAX);
}

int64_t ki_get_i(int idx, int qs, int qe, int ss, int se) {
	if (qe <= ss || se <= qs) { /* query ga segument kara kanzen ni hazurete iru */
		return -INF;
	} else if (qs <= ss && se <= qe) { /* segment ga query ni kanzen ni fukumareru */
		return ki[idx] + ki_all[idx];
	} else {
		int sm = ss + (se - ss) / 2;
		int lidx = idx * 2 + 1, ridx = idx * 2 + 2;
		int64_t l, r;
		l = ki_get_i(lidx, qs, qe, ss, sm);
		r = ki_get_i(ridx, qs, qe, sm ,se);
		return (l >= r ? l : r) + ki_all[idx];
	}
}

int64_t ki_get(int idx) {
	return ki_get_i(0, idx, idx + 1, 0, MAX);
}

int N, Q, S, T;
int A[222222];
int L[222222], R[222222], X[222222];

int64_t getDelta(int64_t from, int64_t to) {
	if (from >= to) {
		return (int64_t)T * (from - to);
	} else {
		return -(int64_t)S * (to - from);
	}
}

int main(void) {
	int i;
	int64_t kaze = 0;
	if (scanf("%d%d%d%d", &N, &Q, &S, &T) != 4) return 1;
	for (i = 0; i <= N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	for (i = 0; i < Q; i++) {
		if (scanf("%d%d%d", &L[i], &R[i], &X[i]) != 3) return 1;
	}
	ki_add(0, 1, A[0]);
	for (i = 1; i <= N; i++) {
		ki_add(i, i + 1, A[i]);
		kaze += getDelta(A[i - 1], A[i]);
	}
	for (i = 0; i < Q; i++) {
		int64_t prev = ki_get(L[i] - 1);
		int64_t next = ki_get(R[i] + 1);
		int64_t asumi = ki_get(L[i]);
		int64_t iguti = ki_get(R[i]);
		ki_add(L[i], R[i] + 1, X[i]);
		kaze -= getDelta(prev, asumi);
		kaze += getDelta(prev, ki_get(L[i]));
		if (R[i] < N) {
			kaze -= getDelta(iguti, next);
			kaze += getDelta(ki_get(R[i]), next);
		}
		printf("%" PRId64 "\n", kaze);
	}
	return 0;
}



Measured memory_bytes: 9716
n = int(input())
ans = [0 for i in range(10050)]
for x in range(1, 105):
    for y in range(1, 105):
        for z in range(1, 105):
            f = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if f < 10050:
                ans[f] += 1
for i in range(n):
    print(ans[i+1])

Measured memory_bytes: 74288
from collections import Counter
import sys
N = int(input())
A = [int(_) for _ in input().split()]

key_val_lis = []
for key, value in Counter(A).items():
    if value >= 2:
        key_val_lis.append((key, value))

ans_lis = sorted(key_val_lis, key=lambda x: -x[0])
#print(ans_lis)
if not ans_lis:
    print(0)
    sys.exit()

if len(ans_lis) == 1 and ans_lis[0][1] < 4:
    print(0)
elif len(ans_lis) == 1 and ans_lis[0][1] >= 4:
    print(ans_lis[0][0] ** 2)
elif len(ans_lis) >= 2:
    area_1 = ans_lis[0][0] * ans_lis[1][0]
    area_2 = 0
    if ans_lis[0][1] >= 4:
        area_2 = ans_lis[0][0] ** 2
    print(max(area_1, area_2))


Measured memory_bytes: 18600
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main() {
  uint32_t N;
  cin >> N;

  cout << 3 * N * N << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "]"; return os; }


int main(){
    LL n, k;
    cin >> n >> k;
    if((n+1)/2 >= k){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template <typename float_type>
bool LE(float_type n, float_type m) { return n < m + EPS; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c;
    cin >> a >> b >> c;
    if(c - a - b >= 0 && 4 * a * b < (c - b - a) * (c - b - a)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
n,w=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]

dp=[0]*(w+1)

for i in range(n):
 for j in range(w,-1,-1):
  if j+l[i][0]<=w:
   dp[j+l[i][0]] =max(dp[j+l[i][0]],dp[j]+l[i][1])

print(max(dp))

Measured memory_bytes: 42604
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位


int main(void){
    ll n;
    cin >> n;
    ll MIN = 100 * (n/100);
    ll MAX = 105 * (n/100);
    if(MIN <= n && MAX >= n)
        cout << 1 << endl;
    else
        cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
a, b, c, x, y = map(int,input().split())

value = a+b
values = c*2

ans = 0

if value <= values:
    ans += a*x + b*y
    print(ans)
    exit()

if x>=y:
    ans += c*y*2
    
    if a <= c*2:
        ans += a*(x-y)
    else:
        ans += c*2*(x-y)

else:
    ans += c*x*2
    
    if b <= c*2:
        ans += b*(y-x)
    else:
        ans += c*2*(y-x)
        
print(ans)

Measured memory_bytes: 3064
def agc_014_a
    a,b,c = gets.chomp.split(/\s/).map{|x| x.to_i}

    cnt = 0
    while true
        break if a%2 == 1 or b%2 == 1 or c%2 == 1

        if a == b and b == c
            puts -1
            exit
        end

        ah = a/2
        bh = b/2
        ch = c/2

        a = bh + ch
        b = ch + ah
        c = ah + bh

        cnt += 1
    end

    puts cnt
end

agc_014_a

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

#define ll long long
#define pll pair<ll,ll> 

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	ll n;
	cin>>n;
	ll A[n][3];
	ll M[n][3];
	for(ll i=0;i<n;i++)
		cin>>A[i][0]>>A[i][1]>>A[i][2];
	
	for(ll i=0;i<3;i++)
		M[0][i]=A[0][i];
	for(ll i=1;i<n;i++){
		for(ll j=0;j<3;j++){
			M[i][j]=INT_MIN;
			for(ll k=0;k<3;k++){
				if(j!=k){
					M[i][j]=max(M[i][j], M[i-1][k]+A[i][j]);
				}
			}
		}
	}
	ll ans=*max_element(M[n-1],M[n-1]+3);
	cout<<ans<<endl;
}




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

#define ll long long
#define ld long double
#define F first
#define S second

#define ONLINE_JUDGE 1

using namespace std;

const int mod = 1e9+7;

void solve(){
	int k;
	cin >> k;
	int s = 0;
	for(int i = 1; i <= k; i++){
		for(int j = 1; j<=k; j++){
			for(int jj = 1; jj <=k; jj++){

				s+= __gcd(__gcd(i,j),jj);

			}
		}
	}	
	cout << s << "\n";
}

int main(){
	#ifndef ONLINE_JUDGE	
		freopen("in.txt","r",stdin);
		freopen("out.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);		
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

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

    res = ceil(N / 1.08);

    int result = res * 1.08;

    if(result == N) {
        cout << res << endl;
    } else {
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const long long MOD = 1e9+7;
using namespace std;
#define ll long long
#define ar array

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

	string s;
	cin >> s;

	cout << s.replace(0,4,"2018") << endl;
	return 0;
}


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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong N;
	cin >> N;
	llong ans = 1;
	for(int i = 1; i <= N; i++)
		(ans *= i) %= mod;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
x = gets.to_i
is_prime = [true] * 200000

(2...200000).each{|a|
    if is_prime[a]
        ((a * 2)...200000).step(a){|m|
            is_prime[m] = false
        }
    end
}

(x...200000).each{|n|
    if is_prime[n]
        puts n
        break
    end
}


Measured memory_bytes: 15884
# coding: utf-8

# https://atcoder.jp/contests/abc106


def main():
    N = int(input())

    ans = 0
    for n in range(1, N+1, 2):
        n_yakusu = 0
        for m in range(1, n+1):
            if n % m == 0:
                n_yakusu += 1
        if n_yakusu == 8:
            ans += 1
    
    return ans


print(main())


Measured memory_bytes: 9148