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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(n);
    vector<int> data(n);
    for (int i = 0; i < n; i++) {
        cin >> data[i];
    }
    sort(all(data));

    map<int, int> mm;

    int ans = 0;
    rep(i, n) {
        for (auto j : mm) {
            //cout << i << " " << j.first << " " << j.second << endl;
            if (j.first <= data[i]) {
                continue;
            }
            ans += j.second;
        }
        rep(j, i) {
            mm[data[i] + data[j]]++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif

#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define rsz resize()
#define lb lower_bound
#define ub upper_bound
#define br cout << endl

typedef long long ll;
typedef long double f80;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); } 
int bit(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bit(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }

template<typename T>
void leftShift(vector<T> &v, ll k) { k %= sz(v); if(k < 0) k += sz(v); rotate(v.begin(), v.begin() + k, v.end()); }
template<typename T>
void rightShift(vector<T> &v, ll k) { leftShift(v, sz(v) - k); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll rand(ll l, ll r){
	uniform_int_distribution<ll> uid(l, r);
	return uid(rng);
}

inline int nxt() {
	int x;
	cin >> x;
	return x;
}

inline int nxtll() {
	ll x;
	cin >> x;
	return x;
}

void pr() {}
void sc() {}

template <typename Head, typename... Tail>
void pr(Head H, Tail... T) { cout << H << " "; pr(T...); }

template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#ifndef LOCAL
string to_string(__int128 x) {
	string s = "";
	bool neg = 0;
	if(x < 0) { s += "-"; neg = 1; }
	if(!x) s += '0';
	while(x) {
		int rem = x % 10;
		s += to_string(rem);
		x /= 10;
	}
	reverse(s.begin() + neg, s.end());
	return s;
}
#endif

const int mod = 1e9 + 7; // 998244353;

int pwr(int a,int b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

/*
	Lookout for overflows!!
	Check array sizes!!
	Clear before test cases!!
	Use the correct modulo!!
	Check for corner cases!!
	Are you forgetting something?!
*/

void solve() {
	int r;
	sc(r);
	cout << setprecision(10);
	cout << 2 * acos(-1) * r;
}

signed main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	// cin >> t;
	t = 1;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3844
#include<bits/stdc++.h>
using namespace std;
int m,d;
int main()
{
	cin>>m>>d;
	int ans=0;
	for(int i=1;i<=m;i++)
	{
		for(int j=10;j<=d;j++)
		{
			if((j/10)*(j%10)==i&&(j%10)>=2&&(j/10)>=2)
			{
				ans++;
			}
		}
	}
	cout<<ans<<"\n";
	return 0;
 } 

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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;

int main()
{
    ios::sync_with_stdio(false);

    string s, t;
    cin >>s >>t;

    vector<string> ok;

    REP(i, s.size() - t.size() + 1) {
        bool f = true;
        REP(j, t.size()) {
            if(!(s[i+j] == t[j] || s[i+j] == '?')) {
                f = false;
                break;
            }
        }
        if(f) {
            string temp = s;
            REP(j, t.size()) {
                temp[i+j] = t[j];
            }
            REP(j, temp.size()) {
                temp[j] = temp[j] == '?' ? 'a' : temp[j];
            }
            ok.push_back(temp);
        }
    }
    if(ok.size() == 0) ok.push_back("UNRESTORABLE");
    sort(ok.begin(), ok.end());
    cout << ok[0] << endl;

    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
count=0
for i in range(n):
    if b[i]<=a[i]:
        count+=b[i]
    else:
        if b[i]-a[i]<a[i+1]:
            count+=b[i]
            a[i+1]-=b[i]-a[i]
        else:
            count+=a[i]+a[i+1]
            a[i+1]=0
print(count)

Measured memory_bytes: 19156
N,K=map(int,input().split())
x = list(map(int,input().split()))
ans=10**10
for i in range(N+1-K):
 if x[i]>=0 and x[i-1+K]>=0 :
  ans=min(ans,max(x[i],x[i-1+K]))
 elif x[i]<=0 and x[i-1+K]<=0 :
  ans=min(ans,max(-x[i],-x[i-1+K]))
 else:
  ans=min(ans,x[i-1+K]-x[i]+min(x[i-1+K],-x[i]))
print(ans)


Measured memory_bytes: 85332
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i = s; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using graph = map<int,vector<int>>;

int dfs(graph &G, vector<bool> &seen, int v) {
  if (seen[v]) return 0;
  seen[v] = true;
  for (auto nv : G[v]) {
    if (seen[nv]) continue;
    dfs(G,seen,nv);
  }
  return 0;
}

int main() {
  int n,m;
  cin >> n >> m;
  graph G;
  rep(i,0,m) {
    int x,y,z;
    cin >> x >> y >> z;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  vector<bool> seen(n+1,false);
  int ans = 0;
  rep(v,1,n+1) {
    if (seen[v]) continue;
    ans++;
    dfs(G,seen,v);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 23848
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int A = sc.nextInt();
		int B = sc.nextInt();
      
		if (0<=A&&A<=5){
           B = 0;
          System.out.print(B);
        }else if (6<=A && A<=12){
           B = B/2;
          System.out.print(B);
        }else if (13<=A && A<=100){
          System.out.print(B);
        }
		// 出力
		
	}
}


Measured memory_bytes: 21844
#include <iostream>
 using namespace std;
 static const int WHITE = 0;
 static const int GRAY = 1;
 static const int BLACK =2;
 static const int MAX = 100;
 static const int INFTY = (1<<21);
 
 int n,M[MAX][MAX];
 
 void dijks(){
 	int minv;
 	int d[MAX];
 	int color[MAX];
 	for(int i=0;i<n;i++){
 		d[i] = INFTY;
 		color[i] = WHITE;
 	}
 	
 	d[0] = 0;
 	color[0] = GRAY;
 	while(1){
 		minv = INFTY;
 		int u=-1;
 		for(int i=0;i<n;i++){
 			if(color[i]!=BLACK&&d[i]<minv){
 				minv = d[i];
 				u=i;
 			}
 		}
 		
 		if(u==-1) break;
 		
 		color[u] = BLACK;
 		
 		for(int v=0;v<n;v++){
 			if(color[v]!=BLACK&&M[u][v]<INFTY){
 				if(d[v]>d[u]+M[u][v]){
 					d[v] = d[u]+M[u][v];
 					color[v] = GRAY;
 				}
 			}
 		}
 	}
 	
 	for(int i=0;i<n;i++){
 		cout<<i<<" "<<(d[i]==INFTY?-1:d[i])<<endl;
 	}
 }
 
 int main(){
 	cin>>n;
 	
 	for(int i=0;i<n;i++){
 		for(int j=0;j<n;j++){
 			M[i][j] = INFTY;
 		}
 	}
 	
 	int k,u,c,v;
 	for(int i=0;i<n;i++){
 		cin>>u>>k;
 		for(int j=0;j<k;j++){
 			cin>>c>>v;
 			M[u][c] = v;
 		}
 	}
 	dijks();
 	return 0;
 }

Measured memory_bytes: 3136
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();

        if (N == 1) {
            System.out.println(0);
            return;
        }

        int[] toWhite = new int[N+1];
        for (int i = 1; i < N+1; i++) {
            toWhite[i] = toWhite[i-1];
            if (S.charAt(i-1) == '#') {
                toWhite[i]++;
            }
        }

        int[] toBlack = new int[N+1];
        for (int i = N-1; i >= 0; i--) {
            toBlack[i] = toBlack[i+1];
            if (S.charAt(i) == '.') {
                toBlack[i]++;
            }
        }

        int min = N;
        for (int i = 0; i < N+1; i++) {
            min = Math.min(min, toWhite[i]+toBlack[i]);
        }

        System.out.println(min);
    }
}


Measured memory_bytes: 28948
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		int n=sc.I;
		var a=sc.La;
		long[] h=new long[n];
		for(int i = 1;i<n;i++) {h[i]=a[i-1]*2-h[i-1];}
		h[0]=(a[n-1]*2-h[n-1])/2;
		for(int i = 1;i<n;i++) {h[i]+=i%2==0?h[0]:-h[0];}
		Console.WriteLine("{0}",String.Join(" ",h));
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}


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

int main() {
  int time;
  cin >> time;
  int h = time/3600;
  int m = (time-h*3600)/60;
  int s = time-h*3600-m*60;
  cout << h << ":"<< m <<":"<< s << endl;
}


Measured memory_bytes: 3096
// IlyM

#include <bits/stdc++.h>
#define pb push_back
#define sp " "
#define sl "\n"
#define fi first
#define se second
#define mp make_pair
#define sz(a) ((int)a.size())
#define tra(a,b) for (auto a:b) 
#define fo(a,b,c) for (int a=b;a<=c;a++) 
#define ms(a,b) memset(a,b,sizeof(a)) 
#define all(a) a.begin(),a.end()
#define rev(a) reverse(a.begin(),a.end())
#define bit(i,j) (i&(1<<j))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;

const int N=2e5+5,mod=998244353;
int n,k,a[N];
bool b[11];
string trans(int u)
{
	string w;
	while (u) {
		w.pb(u%10+'0'); u/=10;
	}
	return w;
}
int main()
{
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	cin>>n>>k;
	fo(i,0,k-1) { cin>>a[i]; b[a[i]]=true; }
	fo(i,n,1000000) {
		string k=trans(i);
		bool t=true;
		for (int j=0;j<sz(k);j++) if (b[k[j]-'0']) t=false;
		if (t) {
			cout<<i;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
using std::cin; using std::cout;
using std::endl;
using std::bitset; using std::map;
using std::queue; using std::priority_queue;
using std::set; using std::string;
using std::stringstream; using std::vector;
using std::pair; using std::make_pair;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<ULL, ULL> puu;
#ifdef DEBUG
using std::cerr;
#define pass cerr << "[" << __FUNCTION__ << "] : line = " << __LINE__ << endl;
#define display(x) cerr << #x << " = " << x << endl;
#define displaya(a, st, n)                                                     \
  {                                                                            \
    cerr << #a << " = {";                                                      \
    for (int qwq = (st); qwq <= (n); ++qwq)                                    \
      if (qwq == (st))                                                         \
        cerr << a[qwq];                                                        \
      else                                                                     \
        cerr << ", " << a[qwq];                                                \
    cerr << "}" << endl;                                                       \
  }
#define displayv(a) displaya(a, 0, (int)(a.size() - 1))
#include <ctime>
class MyTimer {
    clock_t st;
public:
    MyTimer() { cerr << std::fixed << std::setprecision(0); reset(); }
    ~MyTimer() { report(); }
    void reset() { st = clock_t(); }
    void report() {  cerr << "Time consumed: " << (clock() - st) * 1e3 / CLOCKS_PER_SEC << "ms" << endl; }
} myTimer;
#else
#define cerr if(false) std::cout
#define pass ;
#define display(x) ;
#define displaya(a, st, n) ;
#define displayv(a) ;
class MyTimer {
public: void reset() {} void report() {}
} myTimer;
#endif

template<typename A, typename B>
std::ostream& operator << (std::ostream &cout, const pair<A, B> &x) {
    return cout << "(" << x.first << ", " << x.second << ")";
}
template<typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) { return a > b ? a = b, true : false; }
template<typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) { return a < b ? a = b, true : false; }

int main() {
    int n, k;
    cin >> n >> k;
    cout << (n >= 2 * k - 1 ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,m;
  cin>>N>>m;
  map<int,int>M;
  for(int i=0;i<2*m;i++){
  int a; cin>>a;
    if(M.count(a))
    M.at(a)++;
    else
      M[a]=1;
    }bool ans=true;
  for(auto p:M){
  auto k=p.first;
    auto v=p.second;
    if(v%2==1){
      ans=false; break;
    }
  }if(ans)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 4352
import sys
input = sys.stdin.readline


class UnionFindNode(object):
    """
    Union-Find構造
    ノードのグループ併合や、所属グループ判定を高速に処理する
    """

    def __init__(self, group_id, x, y, parent=None):
        self.group_id_ = group_id
        self.parent_ = parent
        self.size_ = 1
        self.rank_ = 1

    def __str__(self):
        template = "UnionFindNode(group_id: {}, \n\tparent: {}, size: {}, rank: {})"
        return template.format(self.group_id_, self.parent_, self.size_,
                               self.rank_)

    def is_root(self):
        return not self.parent_

    def root(self):
        parent = self
        while not parent.is_root():
            parent = parent.parent_
            self.parent_ = parent
        return parent

    def find(self):
        root = self.root()
        return root.group_id_

    def rank(self):
        root = self.root()
        return root.rank_

    def get_size(self):
        root = self.root()
        return root.size_

    def unite(self, unite_node):
        root = self.root()
        unite_root = unite_node.root()

        if root.group_id_ != unite_root.group_id_:
            if root.rank() > unite_root.rank():
                unite_root.parent_ = root
                root.rank_ = max(root.rank_, unite_root.rank_ + 1)
                root.size_ += unite_root.size_

            else:
                root.parent_ = unite_root
                unite_root.rank_ = max(root.rank_ + 1, unite_root.rank_)
                unite_root.size_ += root.size_


N = int(input())
xy_array = []
for i in range(N):
    x, y = map(int, input().split())
    xy_array.append([i, x, y])
# print(xy_array)
node_array = [UnionFindNode(xy[0], xy[1], xy[2]) for xy in xy_array]

xsort_array = sorted(xy_array, key=lambda x: x[1])

for i in range(N - 1):
    if xsort_array[i][1] == xsort_array[i + 1][1]:
        node_array[xsort_array[i][0]].unite(node_array[xsort_array[i + 1][0]])

ysort_array = sorted(xy_array, key=lambda x: x[2])

for i in range(N - 1):
    if ysort_array[i][2] == ysort_array[i + 1][2]:
        node_array[ysort_array[i][0]].unite(node_array[ysort_array[i + 1][0]])

# print("\n".join(list(map(str, node_array))))
# print("\n".join(list(map(lambda x: str(x.root()), node_array))))

ans = 0

xy_group = [[set(), set()] for i in range(N)]
for node, xy in zip(node_array, xy_array):
    group = node.find()
    xy_group[group][0].add(xy[1])
    xy_group[group][1].add(xy[2])

ans = 0
for i, xy in enumerate(xy_group):
    if len(xy[0]) <= 1 or len(xy[1]) <= 1:
        continue
    ans += len(xy[0]) * len(xy[1]) - node_array[i].get_size()

print(ans)


Measured memory_bytes: 113116
def main():
    N = int(input())
    ans = [0] * (N + 100)
    for x in range(1,101):
        for y in range(1,101):
            for z in range(1,101):
                tmp = x ** 2 + y ** 2 + z ** 2 + x*y + y*z + z*x
                if tmp > N:
                    continue
                ans[tmp] += 1

    for i in range(1,N+1):
        print(ans[i])



if __name__ == "__main__":
    main()

Measured memory_bytes: 68564
package main

import "fmt"

func solve(n int) (ans int) {
	ans = n / 11 * 2
	if n%11 > 6 {
		ans += 2
	} else if n%11 > 0 {
		ans++
	}
	return
}

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


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

using namespace std;


void atcoder_beginner_contest999()
{
  string n;
  cin >> n;

  for (int i = 0; i < n.size(); ++i)
  {
    if (n[i] == '1') n[i] = '9';
    else if (n[i] == '9') n[i] = '1';
  }
  cout << n << "\n";
}


void programming_education()
{
  int n;
  cin >> n;
  
  if (n == 1)
  {
    cout << "Hello World\n";
    return;
  }
  else
  {
    int a, b;
    cin >> a >> b;
    cout << a + b << "\n";
  }
}

void discount_fare()
{
  int x, y;
  cin >> x >> y;

  cout << x + y / 2 << "\n";
}


void A_114()
{
  int x;
  cin >> x;

  if (x == 3 || x == 5 || x == 7) cout << "YES\n";
  else cout << "NO\n";
}


void christmas_eve_eve_eve()
{
  int d;
  cin >> d;

  if (d == 25) cout << "Christmas\n";
  else if (d == 24) cout << "Christmas Eve\n";
  if (d == 23) cout << "Christmas Eve Eve\n";
  if (d == 22) cout << "Christmas Eve Eve Eve\n";
}


void right_triangle()
{
  int a, b, c;
  cin >> a >> b >> c;

  cout << a * b / 2 << "\n";
}


void entrance_examination()
{
  int t, x;
  cin >> t >> x;

  cout << (double)t / (double)x << "\n";
}


void A_118()
{
  int a, b;
  cin >> a >> b;

  if (b % a == 0) cout << a + b << "\n";
  else cout << b - a << "\n";
}


void still_TBD()
{
  string s;
  cin >> s;

  if (s[5] == '1' || s[6] >= '5') cout << "TBD\n";
  else cout << "Heisei\n";
}


void favorite_sound()
{
  int a, b, c;
  cin >> a >> b >> c;

  cout << min(b / a, c) << "\n";
}


void atcoder_beginner_contest111()
{
  int n;
  cin >> n;

  if (n % 111 == 0) cout << n << "\n";
  else
  {
    int a = n / 111;
    ++a;
    cout << a * 111 << "\n";
  }
}


void time_limit_exceeded()
{
  int N, T;
  cin >> N >> T;

  int ans = 1001;
  for (int i = 0; i < N; ++i)
  {
    int c, t;
    cin >> c >> t;

    if (t <= T && c < ans) ans = c;
  }
  if (ans == 1001) cout << "TLE\n";
  else cout << ans << "\n";
}


void palace()
{
  int n, t, a;
  cin >> n >> t >> a;

  double d_min = 1000;
  int ans;
  for (int i = 1; i <= n; ++i)
  {
    int h;
    cin >> h;
    double d = (t - h * 0.006) - a;
    if (d < 0) d *= -1;
    if (d < d_min)
    {
      d_min = d;
      ans = i;
    }
  }
  cout << ans << "\n";
}


int main()
{
  //atcoder_beginner_contest999();
  //programming_education();
  //discount_fare();
  //A_114();
  //christmas_eve_eve_eve();
  //right_triangle();
  //entrance_examination();
  //A_118();
  //still_TBD();
  //favorite_sound();

  //atcoder_beginner_contest111();
  //time_limit_exceeded();
  palace();
}

Measured memory_bytes: 256
#include <cstdio>

int main() {
	char S[4], T[4];
	scanf("%s %s", S, T);
	int count = 0;
	for (int i = 0; i < 3; ++i) {
		if (S[i] == T[i]) {
			++count;
		}
	}
	printf("%d", count);
}

Measured memory_bytes: 128
#include<stdio.h>
#define MAX 101
#define WHITE 0
#define GRAY 1
#define BLACK 2
void DFSVisit(int);
void DFS(void);
int G[MAX][MAX];
int D[MAX];
int F[MAX];
int color[MAX];
int n;
int time;
main(){
  int i, j, m, k, value;
  scanf("%d",&n);

  for(i = 1; i <= n; i++){
    for(j = 1; j <= n; j++){

      G[i][j] = 0;

    }
  }

  for(i = 1; i <= n; i++){

    scanf("%d %d", &k, &m);

    for(j = 1; j <= m; j++){

      scanf("%d",&value);

      G[i][value] = 1;
    }
  }
 
  DFS();

  for(i = 1; i <= n; i++)
    {
      printf("%d %d %d\n", i, D[i], F[i]);
    }

 return 0;

}




void DFS(void){
  int u;

  for( u = 1; u <= n; u++ ){
    color[u] = WHITE;
  }

  time = 0;

 for( u = 1; u <= n; u++ ){
   if( color[u] == WHITE )
     DFSVisit(u);

  }
}

void DFSVisit(int u){
  int v;

  color[u] = GRAY;

  time++;
 
  D[u] = time;

  for(v = 1; v <= n ; v++){

    if(G[u][v] == 1 && color[v] == WHITE)
      DFSVisit(v);
  }
  color[u] = BLACK;
  F[u] = ++time;
}

Measured memory_bytes: 636
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
 
using namespace std;
 
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
typedef vector<int> vi;

int main(void){
	int z,w,i,j;
	char s[5];
	int cnt=0;
	cin >> s;
	char y[4] = "Yes";
	char n[3]="No";
	if((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3]) || (s[0] == s[1] && s[1] == s[2] && s[3]==s[4] && s[2]==s[3])){
		cout << y << endl;
	}else{
		cout << n << endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC098A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, max;
            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            max = a + b;
            if (max < a - b) max = a - b;
            if (max < a * b) max = a * b;
            Console.WriteLine(max);
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>

using namespace std;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef pair<ll, ll> pll;

ll n = 0, m = 0, k = 0, ans = 0, sum = 0, cnt = 0, temp = 0;
string s;
bool flag;

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

#define MAX 220000

int main(void) {
  pll num[MAX];
  map<pll, ll> mp;
  ll s, t, r;
  vll f1[MAX], f2[MAX];
  queue<ll> que;
  ll group = 0;

  cin >> n >> k >> r;

  FOR(i, 0, k) {
	cin >> s;
	cin >> t;
	s--; t--;
	f1[s].push_back(t);
	f1[t].push_back(s);
  }

  FOR(i, 0, r) {
	cin >> s;
	cin >> t;
	s--; t--;
	f2[s].push_back(t);
	f2[t].push_back(s);
  }

  FOR(i, 0, n) {
	num[i].first = -1;
	num[i].second = -1;
  }


  FOR(i, 0, n) {
	if (num[i].first != -1) continue;
	que.push(i);
	num[que.front()].first = group;

	while (!que.empty()) {
	  temp = que.front();
	  que.pop();
	  FOR(j, 0, f1[temp].size()) {
		k = f1[temp][j];
		if (num[k].first == -1) {
		  que.push(k);
		  num[k].first = group;
		}
	  }
	}
	group++;
  }

  group = 0;

  FOR(i, 0, n) {
	if (num[i].second != -1) continue;
	que.push(i);
	num[que.front()].second = group;

	while (!que.empty()) {
	  temp = que.front();
	  que.pop();
	  FOR(j, 0, f2[temp].size()) {
		k = f2[temp][j];
		if (num[k].second == -1) {
		  que.push(k);
		  num[k].second = group;
		}
	  }
	}
	group++;
  }

  FOR(i, 0, n) {
	mp[num[i]]++;
  }

  FOR(i, 0, n) {
	cout << mp[num[i]] << " ";
  }

  return 0;
}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner reader=new Scanner(System.in);
	
		int a= reader.nextInt();
		int b= reader.nextInt();
		int h= reader.nextInt();
		int t=((a+b)*h)/2;
		System.out.print(t);
		
		
	}
	
	

}


Measured memory_bytes: 20948
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define all(a) a.begin(),a.end()
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define INT_INF 0x3f3f3f3f
#define LL_INF 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define MOD2 1494318097
#define SEED 131
#define mp make_pair
#define fastio cin.tie(0); cin.sync_with_stdio(0);

#define MAXN 100005

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef unordered_map<int,int> umii;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;

mt19937 g1(chrono::steady_clock::now().time_since_epoch().count());

int randint(int a, int b){return uniform_int_distribution<int>(a, b)(g1);}
ll randlong(ll a,ll b){return uniform_int_distribution<long long>(a, b)(g1);}

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

int len,M,psa[MAXN];
char s[MAXN];
vector<int> res;

int main(){
	scanf("%d %d %s",&len,&M,s+1); len++;
	for(int i=1; i<=len; i++)
		psa[i] = psa[i-1]+(s[i]=='1');
	for(int i=len; i>=1;){
		if(i <= M+1){
			res.pb(i-1);
			break;
		}else{
			int low = i-M, high = i-1, ans = -1;
			while(low <= high){
				int mid = (low+high)/2;
				if(psa[mid]-psa[i-M-1] < mid-(i-M)+1){
					ans = mid;
					high = mid-1;
				}else low = mid+1;
			}
			if(ans == -1) return 0*printf("-1\n");
			res.pb(i-ans);
			i = ans;
		}
	}
	reverse(all(res));
	for(int check:res)
		printf("%d ",check);
}

Measured memory_bytes: 1404
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int n;
    int t;
    cin>>n>>t;
    vector<int> C(n,0);
    vector<int> T(n,0);
    rep(i,n) cin>>C[i]>>T[i];
    int min=inf;
    int k=-1;
    rep(i,n){
        if(min>C[i] && t>=T[i]){
            min=C[i];
            k=i+1;
        }
    }
    if(k==-1) cout<<"TLE"<<endl;
    else{
        cout<<min<<endl;
    }
    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        private static bool Solve(int N, int[] A)
        {
            var dic = new Dictionary<int, int>();
            foreach (var a in A)
            {
                if (!dic.ContainsKey(a)) { dic[a] = 0; }
                ++dic[a];
            }
            switch (dic.Count)
            {
            case 1:
                return A[0] == N - 1 || A[0] <= N / 2;
            case 2:
                int min = dic.Keys.Min();
                int max = dic.Keys.Max();
                if (max - min > 1) { return false; }
                int n = max - dic[min];
                return 1 <= n && n <= dic[max] / 2;
            default:
                return false;
            }
        }
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] A = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            Console.WriteLine(Solve(N, A) ? "Yes" : "No");
        }
    }
}


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

int main(){
    int h, w, k;
    cin >> h >> w >> k;

    int sx, sy;
    vector<vector<char>> a(h, vector<char>(w));
    vector<vector<bool>> visited(h, vector<bool>(w, false));

    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> a[i][j];

            if(a[i][j] == 'S'){ sx = i; sy = j; }
        }
    }

    queue<pair<pair<int, int>,int>> q;
    q.push({{sx, sy}, k});
    visited[sx][sy] = true;

    vector<int> dx = {1, 0, -1, 0};
    vector<int> dy = {0, 1, 0, -1};

    int ans = 10000;
    while(q.empty() == false){
        int x = q.front().first.first;
        int y = q.front().first.second;
        int t = q.front().second;
        q.pop();

        ans = min(ans, (min({x, y, (h-1-x), (w-1-y)}) + (k-1)) / k);

        for(int i=0; i<4; i++){
            if(0 <= x+dx[i] && x+dx[i] < h
            && 0 <= y+dy[i] && y+dy[i] < w
            && visited[x+dx[i]][y+dy[i]] == false
            && a[x+dx[i]][y+dy[i]] != '#'
            && t-1 >= 0){
                visited[x+dx[i]][y+dy[i]] = true;
                q.push({{x+dx[i], y+dy[i]}, t-1});
            }
        }
    }    
    cout << ans + 1 << endl;
    return 0;
}

Measured memory_bytes: 4412
n, m = list(map(int, input().split(' ')))

def divisors(n):
    div = []
    i = 1
    while(i * i <= n):
        if n % i == 0:
            div.append(i)
            if i * i != n:
                div.append(n // i)
        i += 1
    return div


cand = sorted(divisors(m), reverse=True)

result = 1
i = 0
for i in range(len(cand)):
    if m // cand[i] >= n:
        result = cand[i]
        break

print(result)



Measured memory_bytes: 38640
def main():
    h,w,a,b = map(int,input().split()) 
    x=[["0" for _ in range(w)] for _ in range(h)]
    for i in range(a):
        for j in range(b):
            x[j][i]="1"
    for i in range(w-a):
        for j in range(h-b):
            x[b+j][a+i]="1"
    for i in range(len(x)):
        print(''.join(x[i]))
if __name__ == "__main__":
    main()

Measured memory_bytes: 50780
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main(void){
    int X,Y;
    cin >> X >> Y;

    for(int a=0;a<=Y/10000;a++){
        for(int b=0;b<=Y/5000;b++){
            int c = X -(a + b);
            if(c>=0 && 10000*a+5000*b+1000*c == Y){
                cout << a << ' ' << b << ' ' << c << endl;
                return 0;
            }
        }
    }
    cout << -1 << ' ' << -1 << ' ' << -1 << endl;
    return 0;
    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

// ABC161B

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M; cin >> N >> M;
  vector<int> A(N);
  int sumA = 0;
  REP(i, N){
    cin >> A[i];
    sumA += A[i];
  }
  int res = 0;
  REP(i, N){
    if(A[i] * 4 * M >= sumA) res++;
  }
  if(res >= M){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3656
#include <stdio.h>
#include <math.h>
#include <string.h>
int main(void) {
	int N;
	int max = 0;
	scanf("%d", &N);
	int B[100];
	for (int i = 0; i < N - 1; i++) {
		scanf("%d", &B[i]);
	}
	max = B[0];
	for (int i = 0; i < N; i++) {
		if (i == N - 2) {
			max += B[i];
			break;
		}

		if (B[i] <= B[i + 1]) {
			max += B[i];
		}
		else if (B[i] > B[i + 1]) {
			max += B[i + 1];
		}


	}

	printf("%d", max);


	return 0;

}

Measured memory_bytes: 128
#include <stdio.h>

int cmp(char[],char[]);

int main() {
  int n,i,j,k,m;
  char a[101][2],b[101][2],tmp[2];
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    scanf("%s",a[i]);
    for(k=0; k<2; k++) b[i][k]=a[i][k];
  }
  for(i=0; i<n; i++) {
    for(j=n-1; j>i; j--) {
      if(a[j][1]<a[j-1][1]) {
	for(k=0; k<2; k++) tmp[k]=a[j][k];
	for(k=0; k<2; k++) a[j][k]=a[j-1][k];
	for(k=0; k<2; k++) a[j-1][k]=tmp[k];
      }
    }
  }
  for(i=0; i<n; i++) {
    m=i;
    for(j=i+1; j<n; j++) {
      if(b[j][1]<b[m][1]) m=j;
    }
    if(b[m][1]<b[i][1]) {
      for(k=0; k<2; k++) tmp[k]=b[i][k];
      for(k=0; k<2; k++) b[i][k]=b[m][k];
      for(k=0; k<2; k++) b[m][k]=tmp[k];
    }
  }
  int ck=1;
  for(i=0; i<n; i++) {
    if(a[i][0]!=b[i][0]) ck=0;
  }    
  for(i=0; i<n; i++) {
    if(i) printf(" ");
    printf("%c%c",a[i][0],a[i][1]);
  }
  printf("\nStable\n");
  for(i=0; i<n; i++) {
    if(i) printf(" ");
    printf("%c%c",b[i][0],b[i][1]);
  }
  if(ck) printf("\nStable\n");
  else printf("\nNot stable\n");
  return 0;
}



Measured memory_bytes: 2096
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
typedef long double ld;
typedef vector<int> vt;
typedef vector<vt> vtt;
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mk(a,b) make_pair(a,b)
bool isrange(int y,int x,int n,int m){
	 if(0<=y&&y<n&&0<=x&&x<m) return true;
	 return false;
}
int dy[4] = {1,0,-1,0},dx[4]={0,1,0,-1},ddy[8] = {1,0,-1,0,1,1,-1,-1},ddx[8] = {0,1,0,-1,1,-1,1,-1};

int main(void){
	int n;
	scanf("%d",&n);
	lld f1 = 1e18,f2 = -1e18;
	lld s1 = 1e18,s2 = -1e18;
	for(int e=0;e<n;e++){
		lld x,y;
		scanf("%lld%lld",&x,&y);
		f1 = min(f1,x+y);
		f2 = max(f2,x+y);
		s1 = min(s1,x-y);
		s2 = max(s2,x-y);
	}	
	printf("%lld\n",max(abs(f2-f1),abs(s2-s1)));
	return 0;
}


Measured memory_bytes: 3820
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(intl i=0;i<(intl)(n);i++)
#define Rep1(i,n) for(intl i=1;i<(intl)(n)+1;i++)
#define vec vector
#define fi first
#define se second
#define pushb push_back
#define popb pop_back
#define SortA(v) sort(v.begin(), v.end())
#define SortD(v) sort(v.rbegin(), v.rend())
using intl = int64_t;
using vi = vec<intl>;
using vvi = vec<vi>;
vec<intl> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<intl> dy = {1, 0, -1, 0, 1, -1, 1, -1};

int main(){
  intl N,A,B;
  cin >>N>>A>>B;
  if( (A-B)%2==0 ) { cout<<(B-A)/2;return 0;}
  
  intl ifmax;
  intl ifmin;
  
  ifmax = A + (B-A -1)/2;
  ifmin = N-B+1 + (N -( A+(N-B+1) ) )/2;
  cout << min(ifmax,ifmin);
}
  

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N;
	cin >> N;
	vector<vector<ll>> A(N, vector<ll>(N));
	for (auto i = 0; i < N; ++i)
	{
		for (auto j = 0; j < N; ++j)
		{
			cin >> A[i][j];
		}
	}

	auto ans = 0ll;
	auto valid = true;
	for (auto i = 0; i < N; ++i)
	{
		for (auto j = 0; j < N; ++j)
		{
			auto temp = A[i][j];
			for (auto k = 0; k < N; ++k)
			{
				auto sum = A[i][k] + A[k][j];
				if (temp > sum)
				{
					valid = false;
					break;
				}
				if (temp == sum)
				{
					if (k != i && k != j)
					{
						temp = 0;
					}
				}
			}
			ans += temp;
		}
	}

	if (valid)
	{
		cout << ans / 2 << endl;
	}
	else
	{
		cout << -1 << endl;
	}

	return 0;
}

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

int32_t main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  
  int n, d, ans = 0;
  cin >> n >> d;

  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;

    if (x * x + y * y <= d * d) ++ans;
  }
  cout << ans << '\n';
  
}


Measured memory_bytes: 3652
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    string S, T;
    cin >> S >> T;
    ll L = S.size();

    map<char, char> mp0;
    map<char, char> mp1;

    FOR(i, 0, L){
        char c = S[i];
        char d = T[i];

        if(mp0.count(c)==0){
            mp0[c] = d;
        }
        else{
            if(mp0[c] != d){
                p_no();
                return 0;
            }
        }

        if(mp1.count(d)==0){
            mp1[d] = c;
        }else{
            if(mp1[d] != c){
                p_no();
                return 0;
            }
        }
    }

    p_yes();
    
    return 0;
}

Measured memory_bytes: 916
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) begin(x), end(x)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair <int,int> P;

int main(){
  int n;
  cin>>n;
  ll a[200005];
  rep(i,n) cin>>a[i];

  ll ma;
  ll ans=0;
  rep(i,n){
    if(i==0||ma<=a[i]){
      ma=a[i];
    }
    else{
      ans+=ma-a[i];
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 5140
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    intmax_t N, M, Q, a[50], b[50], c[50], d[50];
    intmax_t A[10];
    intmax_t ans = 0;

    scanf("%jd%jd%jd", &N, &M, &Q);
    for (size_t i = 0; i < Q; i++) {
        scanf("%jd%jd%jd%jd", &a[i], &b[i], &c[i], &d[i]);
    }

    for (A[0] = 1; A[0] <= M; A[0]++) {
        for (A[1] = A[0]; A[1] <= M; A[1]++) {
            for (A[2] = A[1]; A[2] <= M; A[2]++) {
                for (A[3] = A[2]; A[3] <= M; A[3]++) {
                    for (A[4] = A[3]; A[4] <= M; A[4]++) {
                        for (A[5] = A[4]; A[5] <= M; A[5]++) {
                            for (A[6] = A[5]; A[6] <= M; A[6]++) {
                                for (A[7] = A[6]; A[7] <= M; A[7]++) {
                                    for (A[8] = A[7]; A[8] <= M; A[8]++) {
                                        for (A[9] = A[8]; A[9] <= M; A[9]++) {
                                            intmax_t tmp = 0;
                                            for (size_t i = 0; i < Q; i++) {
                                                if (A[b[i] - 1] - A[a[i] - 1] == c[i]) {
                                                    tmp += d[i];
                                                }
                                            }
                                            if (tmp > ans)
                                                ans = tmp;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    printf("%jd\n", ans);

    return 0;
}


Measured memory_bytes: 2144
#include <stdio.h>

int main(void){
    int i,dice[7];
    char order[101];
    
    for(i=1;i<7;i++)
        scanf("%d", &dice[i]);
    
    scanf("%s", order);
    
    for(i=0;order[i]!='\0';i++){
        
        dice[0] = dice[1];
        
        switch(order[i]){
                
            case 'E':
                dice[1] = dice[4];
                dice[4] = dice[6];
                dice[6] = dice[3];
                dice[3] = dice[0]; 
                break;
            
            case 'N':
                dice[1] = dice[2];
                dice[2] = dice[6];
                dice[6] = dice[5];
                dice[5] = dice[0]; 
                break;
            
            case 'S':
                dice[1] = dice[5];
                dice[5] = dice[6];
                dice[6] = dice[2];
                dice[2] = dice[0]; 
                break;
                
            case 'W':
                dice[1] = dice[3];
                dice[3] = dice[6];
                dice[6] = dice[4];
                dice[4] = dice[0]; 
                break;

        }
    }
    
    printf("%d\n", dice[1]);
    
    return 0;
}




Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
int main() {
	char str;
	int n[3]={},ans=0;
	while(cin>>str){
		if(str=='J'&&n[1]==0&&n[2]==0)n[0]++;
		else if(str=='O'&&n[1]<n[0]&&n[2]==0)n[1]++;
		else if(str=='I'&&n[2]<n[1]&&n[0]!=0){if((++n[2])==n[1])ans=max(ans,n[1]);}
		else{
			for(int i=0;i<3;i++)n[i]=0;
			if(str=='J')n[0]=1;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1144
#include <stdio.h>

int main(void){
	
	int a,b;
	int ans;
	int i;
	
	for(i=0;i<7;i++){
		
		scanf("%d %d",&a,&b);
		ans=a-b;
	
		printf("%d\n",ans);
	}
	
	return 0;
}

Measured memory_bytes: 1028
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

// 入出力
void print() { std::cout << '\n'; }
template <class T>void print(const T &x) {std::cout << x <<'\n';}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}

void solve(long long N, long long M, std::vector<long long> a, std::vector<long long> b){
    map<ll, ll> city;
    REP(i, N + 1)
        city.insert(make_pair(i, 0));
    REP(i, M) {
        city[a[i]]++;
        city[b[i]]++;
    }
    REP(i, N + 1) {
        if (i == 0) continue ;
        print(city.at(i));
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> a(M);
    std::vector<long long> b(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    solve(N, M, std::move(a), std::move(b));
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
A - Garden
https://atcoder.jp/contests/abc106/tasks/abc106_a

"""
import sys


def solve(A, B):
    return (A*B) - A - B + 1


def main(args):
    A, B = map(int, input().split())
    ans = solve(A, B)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main() {
	int A, B;//高橋君
	int C, D;//青木君

	cin >> A >> B >> C >> D;

	bool flagTurn = true;//trueのとき高橋君のターン
	while (1) {
		if (flagTurn) {
			//高橋君のターン
			C = C - B;
			if (C <= 0) {
				break;
			}
		}
		else {
			//青木君のターン
			A = A - D;
			if (A <= 0) {
				break;
			}
		}
		flagTurn = !flagTurn;
	}

	if (flagTurn) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {
    
    new Main().run();
  }

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[][] graph = new int[n][n];
      String[] vInfo;
      int degree;

      for(int i=0,v=0; i<n; i++) {
        vInfo = br.readLine().split(" ");
        degree = Integer.parseInt(vInfo[1]);
        for(int j=0,k=2; j<degree; j++) {
          v = Integer.parseInt(vInfo[k++]);
          graph[i][v-1] = 1;
        }
      }

      StringBuilder buf = new StringBuilder(n*n);
      for (int[] vertex : graph) {
        for (int v : vertex) {
          buf.append(v).append(" ");
        }
        buf.setLength(buf.length()-1);
        buf.append("\n");
      }

      System.out.print(buf);
    }
    catch (IOException e) {
      System.err.println(e);
    }
  }
}


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

using namespace std;

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

const int inf = 1e9;
const ll inf64 = 1e18;

int main() {

#ifdef debug
    freopen("input.txt", "r", stdin);
#endif

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

    int n, k;

    cin >> n >> k;

    cout << n - k + 1 << "\n";

    return 0;
}

Measured memory_bytes: 256
import sys
N = int(input())
D = [list(map(int, input().split())) for i in range(N)]

ans = 0

for i in range(N):
  if D[i][0] == D[i][1]:
    ans += 1
  else:
    ans = 0
  if ans == 3:
    print("Yes")
    sys.exit()
print("No")


Measured memory_bytes: 9172
import scala.io.StdIn
object Main extends App {
  
  val n = StdIn.readLine().toInt
  val linse = (0 until n).map(_ => StdIn.readLine())
  
  val combis = List('M','A','R','C','H').combinations(3)

  val members = linse.filter{p =>
    p.charAt(0) == 'M' || p.charAt(0) == 'A' || p.charAt(0) == 'R' || p.charAt(0) == 'C' || p.charAt(0) == 'H'
  }.groupBy(name => name.charAt(0)).map(a => a._1 -> a._2.size)

  //val combi = members.keys.toList.combinations(3)
  //println(combi.mkString(" "))

  val result = combis.foldLeft(0L){ (acc, l) =>
    acc + (members.get(l(0)).getOrElse(0).toLong * 
      members.get(l(1)).getOrElse(0).toLong * members.get(l(2)).getOrElse(0).toLong)
  }

  println(result)

}

Measured memory_bytes: 41756