akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
class Program
{
    public static long ReadInt()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] ReadInts()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
       
     
        var input = ReadInts();
        var r = input[0];
        var D = input[1];
        var X = input[2];
        for(int i = 0; i < 10; i++)
        {
            var y = r * X - D;
            X = y;
            Console.WriteLine(y);
              }
        Console.Out.Flush();
    }
}

Measured memory_bytes: 13396
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; cnt = 0; ansli = []; tmpli = []; candili = []; stillset = set()
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def s_list(): return list(input())
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]#NumberGrid
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def grid(n): return [s_list() for _ in range(n)]

n, k = wi()
a = wi()

for i in range(n):
    for j in range(i + 1, n):
        if a[i] > a[j]:
            ans += k * (k + 1) // 2
            ans %= mod
    for l in range(i):
        if a[i] > a[l]:
            ans += (k - 1) * k // 2
            ans %= mod
print(ans)

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

using namespace std;

int main()
{
	int h,w;
	cin>>h>>w;
	for(int i=0;i<h;i++)
	for(int j=0;j<w;j++)
	{
		string s;
		cin>>s;
		if(s=="snuke")cout<< (char)('A'+j)<< i+1<< endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define OUT(x) cout << (x) << endl
typedef long long ll;

int main() {
    int d;
    cin >> d;
    ll g;
    cin >> g;
    int p[d];
    ll c[d];
    for (int i = 0; i < d; i++) {
        cin >> p[i] >> c[i];
    }
    int ans = 10000;
    for (int bit = 0; bit < (1 << d); bit++) {
        ll point = 0;
        int cnt = 0, maxIdx = 0;
        for (int i = 0; i < d; i++) {
            if (bit & (1 << i)) {
                point += (i + 1) * 100 * p[i] + c[i];
                cnt += p[i];
            } else
                maxIdx = i;
        }
        if (point < g) {
            if ((g - point) > 100 * (maxIdx + 1) * p[maxIdx]) continue;
            cnt += (g - point) / (100 * (maxIdx + 1));
            if ((g - point) % (100 * (maxIdx + 1))) cnt++;
        }
        ans = min(ans, cnt);
    }
    OUT(ans);
}


Measured memory_bytes: 256
// Vicfred
// https://atcoder.jp/contests/abc158/tasks/abc158_b
// math
import std.algorithm;
import std.stdio;

void main() {
    long n, a, b;
    readf("%s %s %s", &n, &a, &b);

    long ans = n/(a+b)*a;
    ans += min(a, n%(a+b));
    ans.writeln;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
using namespace std;
int kaibunnsuu (int n){
    vector<int> N;
    while(n > 0){
        int ind_digit = n % 10;
        N.push_back(ind_digit) ;
        n = n /10;
    }
    int size = N.size() ;
    vector<int> rev_N(size);
    for(int i=0;i<size;i++){
        rev_N.at(i) = N.at(i);
    }
    reverse(rev_N.begin(), rev_N.end());
    
    bool judge = false;
    for(int i=0;i<size;i++){
        if( rev_N.at(i)!=N.at(i) ){
            break;
        }
        else if((i==size -1)&&(rev_N.at(i)==N.at(i))){
            judge = true;
        }
    }
    if(judge){
        return 1;
    }
    else{
        return 0;
    }
}

int main() {
    int A,B;
    cin >> A >> B;
    int count =0;
    for(int i=A;i<=B;i++){
        count = count +kaibunnsuu(i);
    }
    cout << count << endl;
}

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

int main(){
    string s;
    int n,cnt = 0,ans = 0;
    cin >> s >> n;
    
    string t[n];
    
    rep(i,0,n){
        cin >> t[i];
        t[i] += t[i];
    }
    
    rep(i,0,n){
        rep(j,0,t[i].size()-s.size()+1){
            cnt = 0;
            rep(k,0,s.size()){
                if(s[k] != t[i][j+k]){
                    break;
                }
                cnt++;
            }
            
            if(cnt == s.size()){
                ans++;
                break;
            }
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3168
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

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

    deque<char> que;
    for(auto s:S){
        que.push_back(s);
    }

    int flag =0;
    for(int i=0; i<Q; i++){
        int t;
        cin >> t;
        if(t==1){
            flag^=1;
        }else{
            int f;
            char c;
            cin >> f >> c;
            f--;
            if(flag^f){
                que.push_back(c);
            }else{
                que.push_front(c);
            }
        }
    }
    if(flag==1){
        reverse(que.begin(), que.end());
    }

    for(auto it=que.begin(); it!=que.end(); it++){
        cout << *it;
    }
    cout << endl;
}

Measured memory_bytes: 896
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;


long long dp[55][2555];
long long c[55], d[55];

const long long INF = 0x3f3f3f3f3f3f3f3fLL;

struct Edge{
    long long from, to, a, b;
};

Edge es[255];


void work(int x) {
    for (int i = 1; i <= 2500; i++) {
        if (i - c[x] >= 0) {
            dp[x][i] = min(dp[x][i], dp[x][i - c[x]] + d[x]);
        }
    }
}
int main() {
    int n, m, s;
    scanf("%d%d%d", &n, &m, &s);// don't forget &

    memset(dp, 0x3f, sizeof dp);
    if (s >= 2500) {
        s = 2500;
    }
    int tot = 0;
    for (int i = 1; i <= m; i++) {
        int u, v, x, y;
        scanf("%d%d%d%d", &u, &v, &x, &y);// don't forget &
        tot++;
        es[tot] = {u, v, x, y};
        tot++;
        es[tot] = {v, u, x, y};
    }
    for (int i = 1; i <= n; i++) {
        scanf("%lld%lld", &c[i], &d[i]);// don't forget &
    }
    dp[1][s] = 0;
    work(1);
    while (true) {
        bool update = false;
        for (int i = 1; i <= tot; i++) {
            Edge e = es[i];
            for (int j = 1; j <= 2500; j++) {
                if (j - c[e.from] >= 0) {
                    dp[e.from][j] = min(dp[e.from][j], dp[e.from][j - c[e.from]] + d[e.from]);
                }
                if (dp[e.from][j] != INF && j - e.a >= 0 && dp[e.to][j - e.a] > dp[e.from][j] + e.b) {
                    dp[e.to][j - e.a] = dp[e.from][j] + e.b;
                    update = true;
                }
            }
        }
        if (!update) {
            break;
        }
    }
    
    for (int i = 2; i <= n; i++) {
        long long ans = INF;
        for (int j = 0; j <= 2500; j++) {
            ans = min(ans, dp[i][j]);
            
        }
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 2836
#include<iostream>
#include<bitset>
#include<array>
#include<utility>
#include<vector>

using namespace std;

typedef array<bitset<200>,5> Board;

int main(){
  for(int n;cin>>n,n;){
    Board b;
    for(int i=0;i<5;i++){
      for(int j=0;j<n;j++){
	char c;
	cin>>c;
	b[i][j]=c=='X';
      }
    }
    const int BW=20;
    static bool t[1<<BW];
    for(int i=0;i<1<<BW;i++){
      Board c;
      Board cb=b;
      for(int j=0;j<BW;j++){
	if(i>>j&1){
	  for(int k=0;k<5;k++){
	    c[k]|=cb[k];
	  }
	}
	for(auto &e:cb){
	  e<<=1;
	}
      }
      bool f=false;
      for(int j=0;j<5;j++){
	f|=(c[j]&b[j]).any();
      }
      t[i]=!f;
    }
    static int mem[1<<BW];
    fill(begin(mem),end(mem),-1);
    vector<pair<int,int> > stats[222];
    stats[0].emplace_back(0,0);
    for(int i=0;;i++){
      for(auto e:stats[i]){
	int f=e.first;
	int s=e.second;
	if(f==10){
	  cout<<i+n-1<<endl;
	  goto next;
	}
	if(mem[s]>=f)continue;
	mem[s]=f;
	stats[i+1].emplace_back(f,s<<1&(1<<BW)-1);
	if(t[s]){
	  stats[i+1].emplace_back(f+1,(s|1)<<1&(1<<BW)-1);
	}
      }
    }
  next:
    ;
  }
}

	
	
	    
  
 

Measured memory_bytes: 6452
/*'TaxRateChanged'????§£?????????http://judge.u-aizu.ac. jp/onlinejudge/description.jsp?id=1192&lang=jp
???????????????2???????¨????????????????????¨????????????????????¨???????????????????????????¨???????????????????????????????????????????????£??????
??????????????¢??????????????????????????????????????¨???????¨??????????????????????????????????????????????????¨???????????????¨?????????????????????
??¢???????????????????????????????????????????¨?????????´???????¨???????????????????????????????
*/

#include<iostream>
using namespace std;
int add(int, int);

int main() {
	int x, y, s, max, a;

	while (true) {
		int max = 0;
		cin >> x >> y >> s;

		if (x == 0 && y == 0 && s == 0)	break;

		for (int i = 1; i < s; i++) {
			for (int j = 1; j < s; j++) {
				if ((add(i, x) + add(j, x)) == s) {
					a = (add(i, y) + add(j, y));
					if (a > max)	max = a;
				}
			}
		}
		cout << max << endl;
	}

	return 0;
}

int add(int a, int t) {
	return a*(100 + t)/100;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

int MOD = (ll)1000000000 + 7;
ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
const int MAX = 500050;
typedef pair<int, int>P;


int N;
int a[100010];
bool used[100010];
int bit[35];
signed main() {
	cin >> N;
	m0(bit);
	REP(i, N) {
		cin >> a[i];
		REP(j, 35) {
			if (a[i] & (1LL << j)) {
				bit[j]++;
			}
		}
	}
	int cnt = 0;
	m0(used);
	//上位ビットから偶奇を見ていく
	for (int i = 34; i >= 0; i--) {
		if (bit[i] % 2 == 0)continue;
		else {
			//pe(i)print(bit[i]);
			bool ok = false;
			REP(j, N) {
				if (used[j])continue;
				//print(a[j]);
				if (a[j] & (1LL << i)) {
					bool poss = 1;
					REP(k, i) {
						if (a[j] & (1LL << k)) {
							poss = 0;
						}
					}
					if (poss) {
						//print("possible");
						cnt++;
						used[j] = true;
						bit[i]--;
						ok = true;
						REP(k, i) {
							bit[k]++;
						}
						goto END;
					}
				}
			}
			if (!ok) {
				print(-1); return 0;
			}
		END:;
		}
	}
	print(cnt);
}

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

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


Measured memory_bytes: 256
import bisect
n=int(input())
a=sorted(list(map(int,input().split())))
b=list(map(int,input().split()))
c=sorted(list(map(int,input().split())))
ans=0

for i in b:
    ans+=(n-bisect.bisect_right(c,i))*bisect.bisect_left(a,i)

print(ans)

Measured memory_bytes: 102156
#include <bits/stdc++.h>
using namespace std;
long long n, A[10000005],dem=0,i,j,d[1000001];
int main()
{
    cin>>n;
    for (i =2;i<=n;i++)  cin>>A[i];
    for (i=2;i<=n;i++) d[A[i]]++;
    for (i=1;i<=n;i++) cout<<d[i]<<endl;

}

Measured memory_bytes: 6720
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)();
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
typedef priority_queue<string> priquestring;
typedef priority_queue<int> priqueint;
typedef priority_queue<ll> priquell;
typedef priority_queue<char> priquechar;
typedef priority_queue<string,vector<string>,greater<string>> rpriquestring;
typedef priority_queue<int,vector<int>,greater<int>> rpriqueint;
typedef priority_queue<ll,vector<ll>,greater<ll>> rpriquell;
typedef priority_queue<char,vector<char>,greater<char>> rpriquechar;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}

const ll big=1000000007;
int exp(int x,int y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (exp(x,y-1)*x)%big;
    int t=exp(x,y/2);
    return (t*t)%big;
}
void chmin(ll a,ll b){
    if(a>b)a=b;
    return;
}

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

void next(vector<int> &use){
    bool ans=true;
    int cnt=0;
    while(ans){
        use[cnt]++;
        if(use[cnt]<=2)ans=false;
        else use[cnt]=0;
        cnt++;
    }
}

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/
  
  ll n;cin >> n;
  if(n==1){cout << 0 << endl;return 0;}
  ll ans=0;
  for(ll i=2;i*i<=n;i++){
    if(n%i!=0)continue;
    ll j=i;
    while(n%j==0){
      n/=j;j*=i;ans++;
    }
    while(n%i==0)n/=i;
    if(n==1)break;
    if(i!=2)i++;
  }
  if(n!=1)ans++;
  if(ans==0)ans++;
  cout << ans << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
int main() {
    int n,m,R;
    cin>>n>>m>>R;
    vector<int> r(R);
    for(int i=0; i<R; i++) cin>>r[i];
    vector<int> a(m),b(m),c(m);
    for(int i=0; i<m; i++) cin>>a[i]>>b[i]>>c[i];
    vector<vector<ll>> dist(n,vector<ll>(n));
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            dist[i][j]=1e9;
        }
    }
    for(int i=0; i<m; i++){
        dist[a[i]-1][b[i]-1]=c[i];
        dist[b[i]-1][a[i]-1]=c[i];
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            for(int k=0; k<n; k++){
                if(dist[j][i]+dist[i][k]<dist[j][k]){
                    dist[j][k]=dist[j][i]+dist[i][k];
                }
            }
        }
    }
    for(int i=0; i<R; i++) r[i]--;
    sort(r.begin(),r.end());
    ll ans=1e9;
    do{
        ll tmp=0;
        for(int i=0; i<R-1; i++){
            tmp+=dist[r[i]][r[i+1]];
        }
        ans=min(ans,tmp);
    }while(next_permutation(r.begin(),r.end()));
    cout<<ans<<endl;
}


Measured memory_bytes: 768
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }


signed main()
{
	int N;
	cin >> N;
	cout << (N / 3) << endl;
}



Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef std::vector<vector<int> > vvi;
typedef pair<int, int> pi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
#define inf (ll)1e9

#define debugone(x) cout << #x << " " << x << "\n"; cout.flush();
#define debugtwo(x) cout << #x << "-------------" << "\n";for(auto &it: x) cout << it << " ";cout << "\n"; cout.flush();
#define debugthree(x, i, j) cout << #x << "------------" << "\n";cout << "from " << i << " to " << j << "\n";for(ll k=i; k<=j; k++) cout << x[k] << " ";cout << "\n"; cout.flush();



int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
		
	int a, b;
	cin >> a >> b;
	cout << max(a+b, max(2*a - 1, 2*b - 1));	

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll N=1000000007;
//ll power(ll a,ll b,ll mod)
//{
//    ll result=1;
//    while(b>0)
//    {
//        if(b%2==1)
//            result=(result*a)%mod;
//        a=(a*a)%mod;
//        b=b/2;
//    }
//    return result;
//}
//ll d,x,y;
//void extendedEuclid(ll a,ll b)
//{
//    if(b==0)
//    {
//        d=a; x=1; y=0;
//    }
//    else
//    {
//        extendedEuclid(b,a%b);
//        ll temp=x; x=y; y=temp-(a/b)*y;
//    }
//}
//ll modInverse(ll a,ll m)
//{
//    extendedEuclid(a,m);
//    return (x%m+m)%m;
//}
//ll lcm(ll a,ll b)
//{
//    if(a==0||b==0)
//        return 0;
//    return (a*b)/(__gcd(a,b));
//}
//void sieve(ll n)
//{
//    bool isPrime[n+1];
//    isPrime[0]=false; isPrime[1]=false;
//    for(ll i=2;i<=n;i++)
//        isPrime[i]=true;
//    for(ll i=2;i<=n;i++)
//    {
//        if(isPrime[i]==true)
//        {
//            for(ll j=i*i;j<=n;j+=i)
//                isPrime[j]=false;
//        }
//    }
//}
//bool isPowerOfTwo(ll n)
//{
//    return (n&&!(n&(n-1)));
//}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i;  cin>>n;   i=n%1000;
     if(i!=0)  cout<<(1000-i);
     else      cout<<0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<int, int>;

int main()
{
    int d;
    ll g;
    cin >> d >> g;
    vector<pii> pcs;
    for(int i=0; i<d; i++)
    {
        int p, c;
        cin >> p >> c;
        pcs.push_back(make_pair(p,c));
    }

    int min_cost = static_cast<int>(1e5);
    for(int bit=0; bit < (1<<d); bit++)
    {
        ll total = 0;
        int cost = 0;
        int mx_i = 0;
        int mx_p = 0;
        for(int i=0; i<d; i++)
        {
            if(bit & (1<<i))
            {
                total += pcs.at(i).first * 100 * (i+1) + pcs.at(i).second;
                cost += pcs.at(i).first;
            }
            else
            {
                mx_i = i;
                mx_p = pcs.at(i).first;
            }

        }

        if(total < g)
        {
            ll error = g - total;
            if(error < mx_p * 100 * (mx_i+1))
            {
                cost += error / (100 * (mx_i+1)) + (error % (100 * (mx_i+1)) != 0 ? 1 : 0);
            }
            else continue;
        }
        if(cost < min_cost)
        {
            min_cost = cost;
        }
    }
    cout << min_cost << endl;
    return 0;
}


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


using namespace std;

int main(){
  string o, e;
  cin >> o >> e;
  for(int i = 0; i < o.size(); i++) {
    cout << o[i];
    if(i < e.size()) {
      cout << e[i];
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<iostream>
#include<cctype>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

int main() {
    int n, d;
    int ans = 0;
    cin >> n >> d;
    for (int i = 0; i < n; i++) {
        long long p[2];
        cin >> p[0] >> p[1];
        if (sqrt(p[0]*p[0]+p[1]*p[1]) <= d) {
            ans++;
        }
    }
    cout << ans << endl;
}

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

using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=a; i>=b; i--)
#define pb push_back
#define mp make_pair
#define show(a) for(auto el:a)cout<<el<<" "
#define ff first
#define ss second
#define pair vector<pair<ll,ll>>
#define vec vector <ll> 
#define all(a) a.begin(),a.end()
#define fam(v,i) for(auto i=v.begin();i!=v.end();i++)
#define fai(v,i) for(auto i : v)
#define mo 1000000007
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   string s,t;
     cin>>s>>t;
     ll n=s.size();
     ll m=t.size();
     ll c=0,x=0;
     ll a=10000;
     ll i,j,k;
     for(i=0;i<n-m;i++)
     {
         c=0;
         for(j=i;j<i+m;j++)
         {
             k=j-i;
             if(s[j]!=t[k])
             {
                 c++;
             }
            
         }
        a=min(a,c);
     }
     if(n==m)
     {
         i=0;
            c=0;
         for(j=i;j<i+m;j++)
         {
             k=j-i;
             if(s[j]!=t[k])
             {
                 c++;
             }
            
         }
        a=min(a,c);

     }
  
 cout<<a;
     
    
     return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
long long  N,A,B;
long long value[51];
bool comp(long long a,long long b)
{
    return a>b?true:false;
}

long long dp[51][51];

void init()
{
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(int i=1; i<=50; i++)
    {
        dp[i][0]=1;
        for(int j=1; j<=i; j++)
            dp[i][j]=dp[i-1][j-1]+dp[i-1][j];
    }
}
int main(void)
{
   //ios::sync_with_stdio(0);
    cin>>N>>A>>B;
    init();
    for(int i=0; i<N; i++)
    {
        cin>>value[i];
    }
    sort(value,value+N,comp);
    double sum=0.0;
    for(int i=0; i<=A-1; i++)
    {
        sum+=value[i];
    }
    long long  num=0,k=0;
    for(int i=0; i<N; i++)
    {
        if(value[i]==value[A-1])
        {
            num++;
            if(i<A)
                k++;
        }
    }
    long long ans=0;
    if(k==A)//前A个相同,可以增加个数
    {
        for(int i=A; i<=B; i++)
            ans+=dp[num][i];
    }
    else
        ans+=dp[num][k];

    cout.precision(15);
    cout <<setiosflags(ios::fixed)<<sum/A<<endl;
    cout <<ans <<endl;
    return 0;
}


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

#define vi vector<int>
#define p pair<int, int>
#define REP(i, n) for(int i = 0;i < n; i++)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define BR cout << endl;
#define INF  2000000000

int main(){
    int c[10][10], h, w, a[200][200];

    cin >> h >> w;
    REP(i, 10) REP(j, 10) cin >> c[i][j];
    REP(i, h) REP(j, w) cin >> a[i][j];

    REP(k, 10) REP(i, 10) REP(j, 10){
        if(i == j) continue;
        c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
    }
    
    int ans = 0;
    REP(i, h) REP(j, w) if(a[i][j] != -1) ans += c[a[i][j]][1];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	string str;
	cin >> str;
	map<int, int> mc;
	for (auto &c : str) mc[c] = 1;
	for (int i = 'a'; i <= 'z'; i++)
	{
		if (mc.count(i)) continue;
		putchar(i);
		puts("");
		return 0;
	}
	puts("None");
	return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

vector<int> dp;

int main(){

    int n;
    cin >> n;
    dp.resize(n+2, 0);
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    dp[1] = abs(a[1]-a[0]);
    for(int i = 2; i < n; ++i){
        dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]));
    }
    ppp(dp[n-1]);

    return 0;
}


Measured memory_bytes: 1024
INF = 123456789

def main():
    n,m = map(int,input().split())

    d = [ [INF for i in range(n)] for j in range(n) ]
    for i in range(n):
        d[i][i] = 0

    a = [0 for _ in range(m)]
    b = [0 for _ in range(m)]
    c = [0 for _ in range(m)]
    for i in range(m):
        a[i],b[i],c[i] = map(int,input().split())
        a[i] -= 1
        b[i] -= 1
        d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])
        d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])

    # Warshall-Floyd
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])

    ans = 0
    for i in range(m):
        found = 1
        for j in range(n):
            if d[j][a[i]] + c[i] == d[j][b[i]]:
                found = 0
                break
        ans += found
    print(ans)

if __name__ == '__main__':
    main()


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

void fastio() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}
int main(int argc, char const *argv[])
{
	#define int long long
	const int MOD = 1e9 + 7;
	int n, m;cin >> n >> m;
	vector<string> wall(n);
	for (int i = 0; i < n; ++i) {
		cin >> wall[i];
	}
	vector< vector<int> > dp(n, vector<int>(m, 0));
	// check in the first column
	for (int i = 0; i < n; ++i)
		if (wall[i][0] == '.') dp[i][0] = 1;
		else break;
	// check in the first row
	for (int j = 0; j < m; ++j)
		if (wall[0][j] == '.') dp[0][j] = 1;
		else break;
	for (int i = 1; i < n; ++i) {
		for (int j = 1; j < m; ++j) {
			if (wall[i][j] == '.')
				dp[i][j] = (dp[i][j-1] + dp[i-1][j]) % MOD;
		}
	}
	cout << dp[n-1][m-1] << endl;
	return 0;
}

Measured memory_bytes: 9216
import os
import sys

import numpy as np


def solve(inp):
    def scc_dfs1(links, s, stack, checked, postorder, pi):
        stack[0] = 0
        stack[1] = s
        si = 2
        while si > 0:
            i = stack[si - 2]
            v = stack[si - 1]
            if i == 0 and checked[v]:
                si -= 2
                continue
            checked[v] = 1
            l = len(links[v])
            while i < l and checked[links[v][i]] == 1:
                i += 1
            if i == l:
                postorder[pi] = v
                pi += 1
                si -= 2
                continue
            stack[si - 2] = i + 1
            stack[si] = 0
            stack[si + 1] = links[v][i]
            si += 2
        return pi

    def scc_dfs2(rev_links, s, stack, checked):
        stack[0] = s
        si = 1
        checked[s] = 1
        scc = [s]
        while si > 0:
            si -= 1
            v = stack[si]
            for u in rev_links[v]:
                if checked[u] == 0:
                    checked[u] = 1
                    stack[si] = u
                    si += 1
                    scc.append(u)
        return scc

    def scc(n, links, rev_links):
        stack = np.zeros(n * 2, np.int64)
        checked = np.zeros(n, np.int8)
        postorder = np.zeros(n, np.int64)
        pi = 0

        for v in range(n):
            if checked[v]:
                continue
            pi = scc_dfs1(links, v, stack, checked, postorder, pi)

        postorder = postorder[::-1]
        checked = np.zeros(n, np.int8)
        sccs = []

        for v in postorder:
            if checked[v]:
                continue
            sccs.append(scc_dfs2(rev_links, v, stack, checked))

        return sccs

    n = inp[0]
    m = inp[1]
    aaa = inp[2::2]
    bbb = inp[3::2]

    int_list = [0]
    int_list.clear()
    links = [int_list.copy() for _ in range(n)]
    rev_links = [int_list.copy() for _ in range(n)]

    for i in range(m):
        a = aaa[i]
        b = bbb[i]
        if a != b:
            links[a].append(b)
            rev_links[b].append(a)

    return scc(n, links, rev_links)


if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC

    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()
    exit()

if os.name == 'posix':
    # noinspection PyUnresolvedReferences
    from my_module import solve
else:
    from numba import njit

    solve = njit('(i8[:],)', cache=True)(solve)
    print('compiled', file=sys.stderr)

inp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=' ')
ans = solve(inp)
print(len(ans))
for scc in ans:
    print(len(scc), *scc)


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

int main(){
    
    int n;
    cin >> n;
    
    int x;
    for(int i = 1; i <= n; ++i){
        x = i;
        if(x%3 ==0){
            cout << " " << i;
        }
        else{
            while(x){
                if(x%10==3){
                    cout << " " << i;
                    break;
                }
                else{
                    x /= 10;
                }
            }
        }
    }
    
    cout << endl;
    
    return 0;
    
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n,y;
	int i,j,k;
	while(1){
		cin>>n>>y;
		if(n==0&&y==0) break;
		int cnt=0;
		for(i=1;i<=n;i++){
			for(j=i+1;j<=n;j++){
				for(k=j+1;k<=n;k++){
					if(i+j+k==y){
						cnt++;
					}
				}
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}


Measured memory_bytes: 3100
import sys
from io import StringIO
import unittest

def resolve():
    n=int(input().strip())
    xs = list(map(int,input().strip().split()))

    minPw=9999999999999

    for i in range(1,101):
        sumPw=0
        for x in xs:
            sumPw+=(x-i)**2
        if sumPw < minPw:
            minPw = sumPw

    print(str(minPw))

    return

resolve()

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

int main() {
  vector<char> A(4);
  for (int i = 0; i < 4; i++) {
    cin >> A.at(i);
  }
  
  if (((A.at(0) == A.at(2)) &&(A.at(1) == A.at(3)) && (A.at(0) != A.at(1))) ||((A.at(0) == A.at(3)) &&(A.at(1) == A.at(2)) &&(A.at(0) != A.at(1)))||((A.at(0) == A.at(1)) &&(A.at(2) == A.at(3)) &&(A.at(0) != A.at(2)))){
    
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}
  
  
 




Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int N;
string S;

int main() {

	cin >> N >> S;

	set<string> able;

	for (auto ritr = S.rbegin(); ritr != S.rend(); ++ritr) {
		set<string> add;
		char t[2] = {};
		t[0] = *ritr;
		add.insert(t);
		for (auto a : able) {
			if (a.size() < 3)
				add.insert(*ritr + a);
		}
		for (auto a : add) {
			able.insert(a);
		}
	}

	int ans = 0;
	for (auto a : able) {
		if (a.size() == 3) ans++;
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;

#define N 100000
#define ll long long

int n, m, q;
ll a[N + 5], ans[N + 5], coef[N + 5];

void f(ll l, ll v) {
	if (!l) return ;
	int p = upper_bound(a + 1, a + m + 1, l) - a - 1;
	if (!p)
		ans[1] += v, ans[l + 1] -= v;
	else {
		coef[p] += v * (l / a[p]);
		f(l % a[p], v);
	}
}

int main() {
	scanf("%d%d", &n, &q);
	a[++m] = n;
	for (int i = 1; i <= q; ++i) {
		ll x;
		scanf("%lld", &x);
		while(m && x <= a[m])
			m--;
		a[++m] = x;
	}
	coef[m] = 1;
	for (int i = m; i >= 2; --i) {
		coef[i - 1] += coef[i] * (a[i] / a[i - 1]);
		f(a[i] % a[i - 1], coef[i]);
	}
	ans[1] += coef[1], ans[a[1] + 1] -= coef[1];
	for (int i = 2; i <= n; ++i)
		ans[i] += ans[i - 1];
	for (int i = 1; i <= n; ++i)
		printf("%lld\n", ans[i]);
	return 0;
}

Measured memory_bytes: 4096
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <fstream>
#include <iostream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using uint64 = unsigned long long;
using vi = std::vector<int>;
using vl = std::vector<int64>;
using pii = std::pair<int, int>;
using pii = std::pair<int, int>;
using pll = std::pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(_) (_).begin(), (_).end()
#define rall(_) (_).rbegin(), (_).rend()
#define print(_) std::cout << (_) << '\n'
#define debug(_) std::cerr << #_ << ": " << (_) << '\n'
#define dbg(vec) for (size_t _ = 0; _ < vec.size(); ++_){std::cerr << #vec << "[" << _ << "] : " << vec[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;  // 1.073741823e9
const int64 INF64 = (1LL<<62) - 1;  // 4.611686018427387903e18
const int MOD = 1000000007;

struct UnionFind {
  std::vector<int> par, rank;

  UnionFind(int n) : par(n , -1), rank(n, 0) {}

  void init(int n) {
    par.assign(n, -1); rank.assign(n, 0);
  }

  int root(int x) {
    if (par[x] == -1) return x;
    else return par[x] = root(par[x]);
  }

  bool issame(int x, int y) {return root(x) == root(y);}

  void unite(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return;
    if (rank[x] < rank[y]) std::swap(x, y);
    if (rank[x] == rank[y]) ++rank[x];
    par[y] = x;
    return;
  }
};


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

  int n, m; cin >> n >> m;
  vi x(m), y(m), z(m);
  rep(i, m) {
    cin >> x[i] >> y[i] >> z[i];
    --x[i]; --y[i];
  }

  UnionFind uf(n);

  for (int i = 0; i < m; ++i) {
    if (!uf.issame(x[i], y[i])){
      uf.unite(x[i], y[i]);
    }
  }

  set<int> st;

  for (int i = 0; i < n; ++i) {
    st.insert(uf.root(i));
  }

  cout << st.size() << endl;

  return 0;
}

Measured memory_bytes: 6912
N,K=map(int,input().split())
S=list(map(int,input()))
c1=[]
c0=[]
count=0
if S[0]==0:
    c1.append(0)
for i in range(N-1):
    count=count+1
    if S[i]!=S[i+1]:
        if S[i]==1:
            c1.append(count)
        else:
            c0.append(count)
        count=0
count=count+1
if S[N-1]==1:
    c1.append(count)
else:
    c0.append(count)
    c1.append(0)
if len(c0)<=K:
    print(N)
else:
    ans0=sum(c0[:K])
    ans1=sum(c1[:K+1])
    ans=ans0+ans1
    for i in range(len(c0)-K):
        ans0=ans0-c0[i]+c0[i+K]
        ans1=ans1-c1[i]+c1[i+K+1]
        ans=max(ans,ans0+ans1)
    print(ans)

Measured memory_bytes: 4964
import sys

class Node():
    def __init__(self, parent = -1, left = -1, right = -1):
        self.parent = parent
        self.left = left
        self.right = right
        
    def __eq__(self, other):
        if self.num == other.num:
            return True
        else:
            return False

def insert(node, z):
    global root
    p = -1
    x = root
    while x != -1:
        p = x
        if z < x:
            x = node[x].left
        else:
            x = node[x].right
    
    if p == -1:
        root = z
        node[z] = Node()
    elif z < p:
        node[p].left = z
        node[z] = Node(p)
    else:
        node[p].right = z
        node[z] = Node(p)
        
def preorder(node, i):
    print(" " + str(i), end ="")
    if node[i].left != -1:
        preorder(node, node[i].left)
    if node[i].right != -1:
        preorder(node, node[i].right)

def inorder(node, i):
    if node[i].left != -1:
        inorder(node, node[i].left)
    print(" " + str(i), end ="")
    if node[i].right != -1:
        inorder(node, node[i].right)
        
input()
node = {}
root = -1
for s in sys.stdin:
    if s[0] == "p":
        inorder(node, root)
        print()
        preorder(node, root)
        print()
    else:
        insert(node, int(s[7:]))



Measured memory_bytes: 125576
#include<iostream>
#include<cstring>

struct loc{
	int x, y;
};

bool map[5001][5001];
loc pillar[3000];

bool ju(int a)
{
	if (0 <= a && a <= 5000) return true;
	else return false;
}

int main()
{
	while (true){
		int n;
		std::cin >> n;
		if (!n) break;
		loc max = { 0, 0 };
		memset(map, false, sizeof map);
		for (int i = 0; i < n; i++){
			std::cin >> pillar[i].x >> pillar[i].y;
			map[pillar[i].x][pillar[i].y] = true;
		}
		
		for (int i = 0; i < n; i++){
			for (int j = i + 1; j < n; j++){
				loc vec = { pillar[i].x - pillar[j].x, pillar[i].y - pillar[j].y };

				loc p1 = { pillar[i].x - vec.y, pillar[i].y + vec.x };
				loc p2 = { pillar[j].x - vec.y, pillar[j].y + vec.x };
				loc p3 = { pillar[i].x + vec.y, pillar[i].y - vec.x };
				loc p4 = { pillar[j].x + vec.y, pillar[j].y - vec.x };

				if (ju(p1.x) && ju(p1.y) && ju(p2.x) && ju(p2.y) && map[p1.x][p1.y] && map[p2.x][p2.y]){
					if (max.x*max.x + max.y*max.y < vec.x*vec.x + vec.y*vec.y){
						max = { vec.x, vec.y };
					}
				
				}
				else if (ju(p3.x) && ju(p3.y) && ju(p4.x) && ju(p4.y) && map[p3.x][p3.y] && map[p4.x][p4.y]){
					if (max.x*max.x + max.y*max.y < vec.x*vec.x + vec.y*vec.y){
						max = { vec.x, vec.y };
					}
				}
			}
		}
		std::cout << (max.x + max.y)*(max.x + max.y) - 2 * max.x*max.y << std::endl;
	}
	return 0;
}

Measured memory_bytes: 25616
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "YES" << endl
#define pyes cout << "Yes" << endl
#define POK cout << "OK" << endl
#define PNO cout << "NO" << endl
#define pno cout << "No" << endl
#define PNG cout << "NG" << endl
#define ret return 0

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n;
  cin >> n;
  vector<ll> a(n + 1, 1);
  vector<bool> isvisit(n + 1, false);
  for (ll i = 2; i <= n; i++) {
    if (isvisit[i]) continue;
    ll d = 0;
    for (ll j = i; j <= n; j *= i) {
      d++;
      isvisit[j] = true;
      for (ll k = j; k <= n; k += j) {
        a[k]++;
      }
    }
  }
  ll res = 0;
  rep(i, n + 1) { debug(a[i]); }
  repz(i, 1, n + 1) { res += a[i] * i; }
  cout << res << endl;
  ret;
}


Measured memory_bytes: 82624
temp = input()
a = list(map(int, input().split()))
is_approved = True
for i in a:
  if i % 2 != 0:
    continue
  else:
    if i % 3 != 0 and i % 5 != 0:
      is_approved = False
if is_approved:
  print("APPROVED")
else:
  print("DENIED")

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

int main() {
	double a,b,x,tmp,ans;
	const double pi=acos(-1);
	cin >> a >> b >> x;
	tmp=a*a*b-x;
	if(tmp==0) ans=0;
	else if(a*a*b/2.0<=x){
		tmp=atan(2.0*tmp/(a*a*a));
 		ans=tmp/acos(-1)*180.0;
 	}
 	else{
	  tmp=x;
		tmp=atan(2.0*tmp/(b*b*a));
 		ans=90.0-tmp/acos(-1)*180.0;
  }
	cout << std::setprecision(9) << ans << endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), math.MaxInt32)
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

func main() {
	defer stdout.Flush()
	N := readInt()
	B := make([]int, N-1)
	for i := range B {
		B[i] = readInt()
	}
	B = append(B, 100000)
	ans := B[0]
	for i := 1; i < N; i++ {
		ans += min(B[i-1], B[i])
	}
	println(ans)
}

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


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

int main(){
  int numbers[3];
  for(int i = 0; i < 3; i++){
    cin >> numbers[i];
  }
  if(numbers[0]<=numbers[2] and numbers[2]<=numbers[1]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#define ll long long
#include <bits/stdc++.h>
using namespace std;
ll mod=1000000007;
main(){
	ll n,i;
	cin>>n;
	ll a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	ll t;
	ll first=INT_MIN,sec=INT_MIN;
	for(i=0;i<n;i++){
		if(first<a[i]){
			sec=first;
			first=a[i];
			t=i;	
		}
		else{
			if(a[i]>sec){
				sec=a[i];
			}
		}
	}
		for(i=0;i<n;i++){
		if(i==t){
			cout<<sec<<endl;
		}
		else{
			cout<<first<<endl;
		}
		}
}


Measured memory_bytes: 3200
#include <cstdio>
using namespace std;
char s[4], op[4]; int x[4];
int found = 0;
void rec(int sum, int p) {
  if(found || p > 3) return;
  sum += x[p]; op[p] = '+';
  if(p == 3 && sum == 7) found = 1;
  rec(sum, p+1);
  if(found) return;
  sum -= 2*x[p]; op[p] = '-';
  if(p == 3 && sum == 7) found = 1;
  rec(sum, p+1);
  sum += x[p];
}
int main() {
  scanf("%s", s);
  for(int i = 0; i < 4; i++) x[i] = s[i] - '0';
  rec(0, 0);
  printf("%d%c%d%c%d%c%d=7", x[0], op[1], x[1], op[2], x[2], op[3], x[3]);
}

Measured memory_bytes: 128