akhauriyash/Code-Regression huggingface dataset:
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input, "index" : 0, "max" : input.length,
  "hasNext" : function(){return (this.index < this.max);},
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  }
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var A = one[0];
  var B = one[1];
  var M = one[2];
  var alist = nextIntArray();
  var blist = nextIntArray();
  var min = Math.min.apply(null,alist) + Math.min.apply(null,blist);
  for(var i = 0; i < M; i++){
    var tmp = nextIntArray();
    var tmpMin = alist[tmp[0] - 1] + blist[tmp[1] - 1] - tmp[2];
    min = Math.min(tmpMin,min);
  }
  myout(min);
}

Measured memory_bytes: 54888
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var inputs = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var A = inputs[0];
            var P = inputs[1];

            var answer = (A * 3 + P) / 2;
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>

using namespace std;

void solve(long long N, vector<long long> a){
    bool odd = true;
    long long odd_v = 0;
    long long even_v = 0;
    int r;
    int l;
    vector<int> ret;
    for (int i = 0; i < N; i+=2) {
        if (a[i] > 0) {
            even_v += a[i];
        }
    }
    for (int i = 1; i < N; i+=2) {
        if (a[i] > 0) {
            odd_v += a[i];
        }
    }
    if (even_v == 0 && odd_v == 0) {
        even_v = (long long)-1e11;
        odd_v = (long long)-1e11;
        int ret_num_e = 0;
        int ret_num_o = 0;
        for (int i = 0; i < N; i+=2) {
            if (a[i] > even_v) {
                even_v = a[i];
                ret_num_e = i;
            }
        }
        for (int i = 1; i < N; i+=2) {
            if (a[i] > odd_v) {
                odd_v = a[i];
                ret_num_o = i;
            }
        }
        long long ret_t, ret_num;
        if (even_v > odd_v) {
            ret_t = even_v;
            ret_num = ret_num_e;
        } else {
            ret_t = odd_v;
            ret_num = ret_num_o;
        }
        std::cout << ret_t << std::endl;
        std::cout << N-1 << std::endl;
        for (int i = N; i > ret_num+1; i--) {
            std::cout << i << std::endl;
        }
        for (int i = 0; i < ret_num; i++) {
            std::cout << 1 << std::endl;
        }
        return;
    }
    if (even_v > odd_v) {
        odd = false;
    }
    if (odd) {
        ret.push_back(1);
        r = 1;
        l = 3;
    } else {
        r = 0;
        l = 2;
    }
    bool flag = true;
    while (l < N-1) {
        if (a[r] < 0 && flag) {
            ret.push_back(1);
            ret.push_back(1);
            r += 2;
            l += 2;
        } else if(a[l] < 0) {
            ret.push_back(3);
            l += 2;
            flag = false;
        } else {
            ret.push_back(2);
            r += 2;
            l += 2;
            flag = false;
        }
    }
    if (l == N-1) {
        if (a[l] < 0) {
            ret.push_back(3);
            ret.push_back(2);
        } else {
            ret.push_back(2);
        }
    } else {
        ret.push_back(2);
    }
    if (odd) {
        std::cout << odd_v << std::endl;
    } else {
        std::cout << even_v << std::endl;
    }
    std::cout << ret.size() << std::endl;
    for (int i = 0; i < ret.size(); i++) {
        std::cout << ret[i] << std::endl;
    }
}

int main(){	
    struct timeval start,end;
    long long span;
    gettimeofday(&start,NULL);

    long long N;
    scanf("%lld",&N);
    vector<long long> a(N-1+1);
    for(int i = 0 ; i <= N-1 ; i++){
    	scanf("%lld",&a[i]);
    }
    solve(N, a);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  ll n, d;
  cin >> n >> d;
  d *= d;
  ll ans = 0LL;
  rep(i,n) {
    ll x, y;
    cin >> x >> y;
    if(x*x+y*y<=d) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(n*a,b) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}

//combination(Nが小さい時はこれを使う)
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int k;
signed main() {
	cin >> k;
	int ans = 0;
	for (int i = 1; i <= k; i++) {
		for (int j = 1; j <= k; j++) {
			for (int l = 1; l <= k; l++) {
				ans += gcd(gcd(i, j), l);
			}
		}
	}
	cout << ans << endl;
	ggr
}


Measured memory_bytes: 3652
#include <stdio.h>

int main(void){

  int n;
  scanf("%d", &n);
  int a[n+1];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }

  int light = 1;
  int check[n+1];
  check[1] = 1;
  for (int i = 2; i <= n; i++) {
    check[i] = 0;
  }

  int count = 0;

  while (count < n) {
    count++;
    light = a[light];
    check[light]++;
    if (check[light] > 1) {
      printf("-1\n");
      break;
    }
    if (check[2] == 1) {
      printf("%d\n", count);
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 896
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define readint ({int t;cin >> t;t;})
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


#define int ll
int N, A[101010];
ll S1[101010], S2[101010];
class DRainFlowsIntoDams {
public:

void solve(std::istream& cin, std::ostream& cout) {
    Fill(S1,0), Fill(S2,0);
    cin >> N;
    _for(i,N)cin >> A[i];
    int sum = 0;
    for (int i = 0; i < N; i+=2) {
        S1[i+2] = S1[i] + A[i], sum += A[i];
    }
    for (int i = 1; i < N; i+=2) {
        S2[i+2] = S2[i] + A[i], sum += A[i];
    }
    _for(j,N) {
        int i = j +1;
    if(i&1){
        cout <<  sum - (S1[i-1] + S2[N] - S2[i])*2 << " ";
    }
    else {
        cout << sum - (S1[N+1] - S1[i] + S2[i-1])*2 << " ";
    }

}


}
};


#undef int
int main() {
	DRainFlowsIntoDams solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(0); ios::sync_with_stdio(0); out<<fixed<<setprecision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3712
import sys
N, Y = map(int,input().split())
Y = Y / 1000
for i in range(N+1):
    for j in range(N-i+1):
        if Y == 10*i + 5*j + (N-j-i):
            print(i,j,N-j-i,end=" ")
            print()
            sys.exit()
print('-1 -1 -1')


Measured memory_bytes: 2940
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AButtons solver = new AButtons();
        solver.solve(1, in, out);
        out.close();
    }

    static class AButtons {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            out.println(Math.max(A + B, Math.max(A + A - 1, B + B - 1)));
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = pread();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



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

int main() {
  int N,K,x,Ans=0;
  cin>>N>>K;
  
  rep(i,N){cin>>x;
           if(x>=K){Ans++;}
          }
  cout<<Ans<<endl;
}

Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
struct edge { int to, cap, rev; };//ikisaki youryou gyakuhen
#define MAX 110
typedef vector<edge> ve;
typedef vector<ve> vve;
vve G(MAX);//[MAX];
vector<bool>used(MAX);//[MAX];
void add_edge(int from, int to, int cap){
	edge q={to,cap,int(G[to].size())};
    G[from].push_back(q);
	q={from,0,int(G[from].size()-1)};
    G[to].push_back(q);
}

int dfs(int v, int t, int f) {
    if(v == t) return f;
    used[v] = 1;
    for(int i = 0 ; i < G[v].size(); i++){
        edge &e = G[v][i];
        if(used[e.to] || e.cap <= 0) continue;
        int d = dfs(e.to, t, min(f, e.cap));
        if(d > 0){
            e.cap -= d;
            G[e.to][e.rev].cap += d;
            return d;
        }
    }
    return 0;
}
int ford_fulkerson(int s, int t) {//from s to t
    int flow = 0, f;
    while(1){
		used=vector<bool>(MAX,false);
        f = dfs(s, t, inf);
        if(f == 0) return flow;
        flow += f;
    }
}
int main(){
	int v,e;
	cin>>v>>e;
	while(e--){
		int a,b,c;
		cin>>a>>b>>c;
		add_edge(a,b,c);
	}
	cout<<ford_fulkerson(0,v-1)<<endl;
}

Measured memory_bytes: 1272
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <set>
#include <map>
#include <tuple>
#include <string>

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
// constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

int main() {
  size_t m, n;
  scanf("%zu %zu", &m, &n);

  std::vector<int> a(n);
  for (auto& ai: a) scanf("%d", &ai);

  if (m == 2) {
    std::vector<int> a21(n, 2);
    std::vector<int> a12(n, 1);
    for (size_t i = 1; i < n; i += 2) {
      a21[i] = 1;
      a12[i] = 2;
    }
    int res = n;
    {
      int cur = 0;
      for (size_t i = 0; i < n; ++i)
        if (a[i] != a21[i]) ++cur;
      res = std::min(res, cur);
    }
    {
      int cur = 0;
      for (size_t i = 0; i < n; ++i)
        if (a[i] != a12[i]) ++cur;
      res = std::min(res, cur);
    }
    return !printf("%d\n", res);
  }

  a.push_back(0);
  ++n;

  int res = 0;
  for (size_t i = 1; i < n; ++i) {
    if (a[i] == a[i-1]) {
      a[i] = -1;
      ++res;
    }
  }
  printf("%d\n", res);
}



Measured memory_bytes: 3364
#include <stdio.h>
int main(void){
int a[3],i;
for(i=0;i<3;i++)
scanf("%d",&a[i]);
if(a[0]==a[1]&&a[1]==a[2])
puts("1");
else if(a[0]==a[1]||a[1]==a[2]||a[0]==a[2])
puts("2");
else
puts("3");
return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>
double f(int a,double b){
  double s=(a+b+b)/2;
  return sqrt(s*(s-a)*(s-b)*(s-b));
}
int main(){
  int a,l,x;
  double s;
  while(scanf("%d %d %d",&a,&l,&x)!=EOF){
    s =f(a,(double)l);
    s+=f(l,(l+x)/2.0)*2;
    printf("%lf\n",s);
  }
  return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
int main(){
	int n;
	int a[100];
	cin>>n;
	double s=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		s+=(double)a[i];
	}
	s/=(double)n;
	double mi=1e9+7;
	int idx;
	for(int i=0;i<n;i++){
		if(mi>abs(a[i]-s)){
			mi=abs(a[i]-s);
			idx=i;
		}
	}
	cout<<idx<<endl;
	return 0;
}

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

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

int main(){
  int r,g,b;
  cin >> r >> g >> b;
  if ((r * 100 + g * 10 + b) % 4 == 0){
    cout << "YES\n";
  }
  else{
    cout << "NO\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  long int n,m,s1=0,s2=0;
  scanf("%ld %ld",&n,&m);
  if(n==0||n==1)
    s1=0;
  else
    s1=n*(n-1)/2;
  
  if(m==0||m==1)
    s2=0;
  else
    s2=m*(m-1)/2;
  
  printf("%ld",s1+s2);
  
  return 0;
}
  
  

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  ll x;
  cin >> x;

  ll a = x / 500;
  x -= a*500;
  ll b = x / 5;

  cout << a*1000 + b*5 << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  	int x;
  cin >> x;
  int k = 1;
  for(int i=1;i<=360;i++){
  	if((i * x )%360 == 0){
    	cout << i;
      return 0;
    }
  }
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;


int main(){

	vector<int> zeronum;
	zeronum.push_back(0);
	int count = 0;
	for(int i = 1; i <= 500000; i++){
		int tmp = i;
		while(tmp % 5 == 0){
			count++;
			tmp /= 5;
		}
		zeronum.push_back(count);
	}

	int n = 0;
	while(cin >> n && n != 0){
		cout << zeronum[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 3276
n = int(input())
a = list(map(int,input().split()))
box = [[0,0] for i in range(n)]

for i in range(n):
    num = i + 1
    if 0 < num - a[i] < n:
        box[num - a[i]][0] += 1
    if 0 < a[i]+num < n:
        box[a[i]+num][1] += 1
ans = 0
for i in range(n):
    ans += box[i][0] * box[i][1]
print(ans)


Measured memory_bytes: 34376
//
// C - Bridge
//

#include <iostream>
#include <vector>

using namespace std;

int main() {

    int N, M;
    cin >> N >> M;

    vector<int> G[51];

    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    int count = 0;
    bool changed = true;

    while (changed) {
        changed = false;
        for (int i = 1; i <= N; i++) {
            if (G[i].size() == 1) {
                G[i].clear();
                count++;
                changed = true;
                for (int j = 1; j <= N; j++) {
                    G[j].erase(remove(G[j].begin(), G[j].end(), i), G[j].end());
                }
            }
        }
    }

    cout << count << endl;
}

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

int main() {
    string s, t, ret = "No", ss;
    cin >>s >>t;
    for (int i = 0; i < s.size(); i++) {
        ss = "";
        for (int j = 0; j < s.size(); j++) {ss.push_back(s.at((i+j)%s.size()));}
        if (ss==t) {ret = "Yes"; break;}
    }
    cout << ret << endl;
    return 0;
}

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

class Dice {
	
	int[] dice = new int[6];
	int tmp;
	String[] num;
	
	public Dice(String s){
		num = s.split(" ");
		for(int i = 0 ; i < dice.length ; i++){
			dice[i] = Integer.parseInt(num[i]) ;
		}
	}
	
	int e(){
		tmp = dice[0];
		dice[0] = dice[3] ;
		dice[3] = dice[5] ;
		dice[5] = dice[2];
		dice[2] = tmp;
		return dice[0];
	}
	
	int n(){
		tmp = dice[0];
		dice[0] = dice[1] ;
		dice[1] = dice[5] ;
		dice[5] = dice[4];
		dice[4] = tmp;
		return dice[0];
	}
	
	int s(){
		tmp = dice[0];
		dice[0] = dice[4] ;
		dice[4] = dice[5] ;
		dice[5] = dice[1];
		dice[1] = tmp;
		return dice[0];
	}
	
	int w(){
		tmp = dice[0];
		dice[0] = dice[2] ;
		dice[2] = dice[5] ;
		dice[5] = dice[3];
		dice[3] = tmp;
		return dice[0];
	}

}

class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		int n = 0 ;
		String num = input.readLine();
		Dice dice = new Dice(num);
		String com = input.readLine();
		for(int i = 0 ; i < com.length() ; i ++){
		if(com.charAt(i) == 'E') n = dice.e();
		if(com.charAt(i) == 'N') n = dice.n();
		if(com.charAt(i) == 'S') n = dice.s();
		if(com.charAt(i) == 'W') n = dice.w();
		}
		
		System.out.println(n);
		
	}
}

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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;

int n;
string s, t;

void init ();
void input ();
void work ();



int main()
{
	init();
	input();
	work();
}



void init ()
{
	// Init Everything Here
	
	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method
	
	cin >> n >> s >> t;
}

void work ()
{
	// main work
	
	string ans;
	lpi ( i, 0, n ){
		ans = s + t.substr ( n - i );
		if ( ans.substr ( i ) == t ){
			cout << ans.size () << endl;
			return;
		}
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <stack>
#include <vector>

#define FOR(i,k,n) for(int (i) = (k); (i) < (n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x,y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
template<class T> using vv=vector<vector<T>>;
typedef deque<int> di;
typedef deque<deque<int>> ddi;


int main() {
    int n;
    cin >> n;
    rep(i,n) {
        int gx,gy;
        int dp[20][20] = {};
        int r[20][20][2] = {}; // r,u
        cin >> gx >> gy;
        rep(i,gx) {
            rep(j,gy) {
                r[i][j][0] = 1; 
                r[i][j][1] = 1;
            }
            r[i][gy][0] = 1;
        }
        rep(i,gy){
            r[gx][i][1] = 1;
            dp[0][i] = 1;
        }
        dp[gx][0] = 1;

        int mn;
        cin >> mn;
        rep(i,mn) {
            int x1,y1,x2,y2;
            cin >> x1 >> y1 >> x2 >> y2;    
            if(x1 > x2) {
                r[x2][y2][0] = 0;         
            } else if (x2 > x1) {
                r[x1][y1][0] = 0;
            } else if (y2 > y1) {
                r[x1][y1][1] = 0;
            } else if (y1 > y2) {
                r[x2][y2][1] = 0;
            }
        }
        
        rep(i,gx+1) {
            rep(j,gy+1) {
                if(i > 0 && j > 0) {
                    dp[i][j] = dp[i-1][j] * r[i-1][j][0] + dp[i][j-1] * r[i][j-1][1];
                } else if (i == 0 && j > 0) {
                    dp[i][j] = dp[i][j-1] * r[i][j-1][1];
                } else if (i > 0 && j == 0) {
                    dp[i][j] = dp[i-1][j] * r[i-1][j][0];
                }
            }
        }
        
        if(dp[gx][gy]) {
            cout << dp[gx][gy] << endl;  
        } else {
            cout << "Miserable Hokusai!" << endl;
        }
        
    }
	return 0;
}

Measured memory_bytes: 3004
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long int64;
int64 solve(int64 N,int64 A,int64 B){
	if((B-A)%2 == 0)	return (B-A)/2;
	int64 ret = min(B-1,N-A);
	ret = min(ret,solve(N,1,B-A)+A);
	ret = min(ret,solve(N,A+(N-B)+1,N)+(N-B)+1);
	return ret;
}
int main(){
	int64 N,A,B;
	scanf("%lld%lld%lld",&N,&A,&B);
	int64 ans = solve(N,A,B);
	printf("%lld\n",ans);
}


Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(ll i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

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

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

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

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

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

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

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


int main(){
	string s;
	cin >> s;
	int n = s.size();
	hei(int) a(n),b(n+1,0);
	reverse(s);
	map<int, int> Z;
	rep(i, 0, n) {
		int x = s[i] - '0';
		a[i] = modpow(10, i, 2019) * x % 2019;
	}
	Z[0] = 1;
	llint ans = 0;
	rep(i, 1, n + 1) {
		b[i] = (b[i - 1] + a[i - 1])%2019;
		ans += Z[b[i]];
		Z[b[i]]++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5168
def main():
  N = int(input())
  L_lst = list(map(int, input().split()))
  count = 0
  if N > 2:
    for i in range(N):
      for j in range(N-i-1):
        for k in range(N-i-j-2):
          A = L_lst[i]
          B = L_lst[j+i+1]
          C = L_lst[k+j+i+2]
          if A != B and B != C and C != A:
            if A+B>C and A+C>B and B+C>A:
              count +=1
    print(count)
  else:
    print(0)
          

main()

Measured memory_bytes: 68052
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#while True:
b, c = map(int, input().split())
#	if(b < 10 and c < 10):
#		break
# 文字列の入力
#s = input()
#連結
#aaa = str(b) + str(c)
#print(aaa)
aaa = ''
bbb = ''
for num in range(c):
	aaa += str(b)
	
for num in range(b):
	bbb += str(c)


#一桁取得
testa = aaa[0]
testb = bbb[0]

# 出力
if(testa < testb):
	print(aaa)
else:
	print(bbb)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=200001 ;
int main()
{
   fast ;
   ll x  ;  cin>>x ;
   vector<ll>v ;
   for(ll i=0;i<=1000;i++)
   {
       v.push_back(i*i*i*i*i) ;
   }
   for(ll i=0;i<=1000;i++)
   {
       for(ll j=0;j<=1000;j++)
       {
           //cout<<v[i]<<" "<<v[j]<<endl ;
           if(v[i]+v[j]==x)
           {
              ll ansa=i ,ansb=j ;
              if(ansb!=0) ansb=-ansb ;

              cout<<ansa<<" "<<ansb ;
              exit(0) ;
           }
           if(v[i]-v[j]==x){
               cout<<i<<" "<<j ;
               exit(0) ;
            }
       }
   }
}



Measured memory_bytes: 3616
import Control.Monad
import Control.Monad.Writer

main :: IO ()
main = do
    [n, s] <- replicateM 2 getLine
    print . maximum . (0:) . snd . runWriter $ foldM calc 0 s

calc :: Int -> Char -> Writer [Int] Int
calc y x = tell [res] >> return res
    where
        res | x == 'I' = y + 1
            | otherwise = y - 1

Measured memory_bytes: 508
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<math.h>

using namespace std;

using ll = long long;

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

const ll INF = 1LL << 60;

typedef pair<ll, double> P;

bool pairCompare(const P & firstElof, const P & secondElof)
{
	return firstElof.second < secondElof.second;
}


signed main() {

	string s;
	cin >> s;
	rep(i, s.size())cout << "x";
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

using ll = long long;
using P = std::tuple<int,int>;

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

int main(){
    //*
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    /*/
      /*/

    string S = "CODEFESTIVAL2016";

    string T;
    std::cin >> T;

    int res = 0;
    for(int i=0;i<S.size();i++){
        if(S[i] != T[i]){res++;}
    }

    std::cout << res << std::endl;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let xy = get!(isize, isize; n);

    let mut map = BTreeMap::new();
    for i in 0..n {
        for j in (i+1)..n {
            let dx = xy[i].0 - xy[j].0;
            let dy = xy[i].1 - xy[j].1;
            *map.entry((dx, dy)).or_insert(0) += 1usize;
            *map.entry((-dx, -dy)).or_insert(0) += 1usize;
        }
    }
    println!("{}", n-map.into_iter().map(|(_,v)| v).max().unwrap_or(0));
}


Measured memory_bytes: 8572
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i64,
    }
    let n = n.abs();
    let p: usize = (1..n+1).scan(0, |acc, x| {
        *acc += x;
        Some(*acc)
    }).position(|x| x >= n).unwrap();
    println!("{}", p+1);
}


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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "YES"
#define FALSE__ "NO"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007
#define PI 3.141592653589793238462643383

signed main()
{
	init();
	solve();
}

int N, A, B;

void init()
{
	cin >> N >> A >> B;
}


void solve()
{
	if (abs(A - B) % 2) {
		cout << "Borys" << endl;
	} else {
		cout << "Alice" << endl;
	}
}


Measured memory_bytes: 256
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const ll INF = 10000000000;//INFinity
using namespace std;//namespace

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}//transform
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//#define int long long // yabai

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    string s,t;
    cin>>s>>t;
    string ans="____";
    REP(i,s.size()){
        bool flag=true;
        string ss=s;
        REP(j,t.size()){
            if(i+j>ss.size()-1){flag=false;break;}
            if(ss[i+j]!='?'&&t[j]!=ss[i+j]){flag=false;break;}
            ss[i+j]=t[j];
        }
        if(!flag)continue;
        REP(i,ss.size())if(ss[i]=='?')ss[i]='a';
        if(ans=="____"||ans>ss)ans=ss;
    }
    cout<<(ans=="____"?"UNRESTORABLE":ans)<<endl;

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	
	values := make([]int,n)
	costs := make([]int,n)
	
	for i := 0; i < n; i++ {
		fmt.Scan(&values[i])
	}
	
	gain := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&costs[i])
		diff := values[i] - costs[i]
		if diff > 0 {
			gain += diff
		}
	}
	fmt.Println(gain)
}

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

int main(){
	int y,m,d;
	
	while(cin>>y){
		cin>>m;
		cin>>d;
		if(y>1989||(y==1989&&((m>1)||(d>7)))){
			cout<<"heisei "<<y-1988<<" "<<m<<" "<<d<<endl;
		}else if(y>1926||(y==1926&&(m==12&&d>24))){
			cout<<"showa "<<y-1925<<" "<<m<<" "<<d<<endl;
		}else if(y>1912||(y==1912&&(m>7||d>29))){
			cout<<"taisho "<<y-1911<<" "<<m<<" "<<d<<endl;
		}else if(y>1868||(y==1868&&(m>9||d>7))){
			cout<<"meiji "<<y-1867<<" "<<m<<" "<<d<<endl;
		}else{
			cout<<"pre-meiji"<<endl;
		}
	}
	return 0;
	
}

Measured memory_bytes: 1160
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	int N;
	int d[120];
	int ans = 0;

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> d[i];
	}

	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			ans += d[i] * d[j];
		}
	}

	cout << ans << endl;

	return 0;
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	double eps = 1e-7;
	public void Solve(){
		
		double x = 0, y = 0, theta = 0;
		double d = Math.PI * 2 / 360.0 * X;
		
		int cnt = 0;
		while(true){
			x += Math.Cos(theta);
			y += Math.Sin(theta);
			theta += d;
			cnt++;
			
			if(Math.Abs((x * x + y * y)) < eps){
				Console.WriteLine(cnt);
				return;
			}
			
		}
		
		
		
		
	}
	int X;
	public Sol(){
		X = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 17652
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    int k,x;
    cin >> k >> x;

		if (500 * k >= x){
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
typedef pair<ll,ll>pll;
const  ll MAX=100000000;
int main()
{

   vector<string>v;


   ll n,m;

   cin>>n>>m;


   while(n--)
   {

       string str;

       cin>>str;

       v.push_back(str);



   }

   sort(v.begin(),v.end());


   for(auto x:v)cout<<x;cout<<endl;


}



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

using namespace std;

bool IncludeImage(const vector<string> &a, const vector<string> &b) {
    const int n = a.size();
    const int m = b.size();

    for (int i = 0; i + m <= n; ++i) {
        for (int j = 0; j + m <= n; ++j) {
            bool in_image = true;

            for (int k = 0; k < m; ++k) {
                if (a[i + k].substr(j, m) != b[k]) {
                    in_image = false;
                    break;
                }
            }

            if (in_image) return true;
        }
    }

    return false;
}

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

    int n, m;

    cin >> n >> m;

    vector<string> a(n), b(m);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = 0; i < m; ++i)
        cin >> b[i];

    if (IncludeImage(a, b))
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define ff first
#define ss second
 
#ifndef ONLINE_JUDGE
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif
 
const int inf = 2e18;
const int mod = 1e9 + 7;
int n;
double dp[301][301][301];

double dfs(int a, int b, int c){
	// cout<<a<<b<<c<<endl;
	if(dp[a][b][c]!=-1) return dp[a][b][c];

	dp[a][b][c] = 0;
	if(c>0) dp[a][b][c]+=(dfs(a,b+1,c-1)+(double)n/(a+b+c))*((double)c/(a+b+c));
	if(b>0) dp[a][b][c]+=(dfs(a+1,b-1,c)+(double)n/(a+b+c))*((double)b/(a+b+c));
	if(a>0) dp[a][b][c]+=(dfs(a-1,b,c)+(double)n/(a+b+c))*((double)a/(a+b+c));

	return dp[a][b][c];

}

signed main(){
 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif
 
	cin>>n;
	vector<int> arr = {0, 0, 0};
	for(int i=0; i<n; i++){
		int x; cin>>x;
		arr[x-1]++;
	}
	for(int i=0; i<=n; i++){
		for(int j=0; j<=n; j++){
			for(int k=0; k<=n; k++){
				dp[i][j][k] = -1;
			}
		}
	}
	dp[0][0][0] = 0;

	cout<<setprecision(11)<<dfs(arr[0], arr[1], arr[2])<<endl;

	return 0;
}

Measured memory_bytes: 216852
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (ll)(n); i++)

int main() {
  ll a; cin >> a;
  cout << a + a*a + a*a*a << endl;
}

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

using namespace std;
using ll =long long;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
using P = pair<int,int>;
//Write From this Line


const int mod = 1e9+7;
int main()
{
	ll n;
	cin >> n;
	vector<ll> a(n);
	map<ll, ll> m, m2;
	rep(i,n) cin >> a[i];
	a.erase(unique(a.begin(),a.end()),a.end());
	n = a.size();
	rep(i,n) m[a[i]] ++;
	vector<ll> dp(n+1,1);
	For(i,1,n+1){
		dp[i] = m2[a[i-1]]+dp[i-1];
		dp[i] %= mod;
		m2[a[i-1]]=dp[i];
	}
	cout << dp[n] << endl;

}


Measured memory_bytes: 28416