akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    int N, a;
    cin >> N;
    map<int, int> mp;
    rep(i,N) {
        cin >> a;
        ++mp[a];
    }
    int ans = 0;
    for (auto x : mp) {
        if (x.first <= x.second) {
            ans += x.second - x.first;
        } else {
            ans += x.second;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 7972
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }

int gcd (int a , int b) {
   if (b == 0) return a;
   return gcd(b, a % b);
}
vector<int> enum_div(int n) {
   vector<int> ret;
   for (int i=1 ; i*i<=n ; ++i) {
      if (n%i == 0) {
         ret.push_back(i);
         if (i!=1 && i*i!=n) {
            ret.push_back(n/i);
         }
      }
   }
   return ret;
}

int main() {
   int N;
   cin >> N;
   int A[N];
   for (int i = 0; i < N; i++) cin >> A[i];
   sort(A, A + N);
   int ans = 1;
   vector<int> tmp;
   tmp = enum_div(A[0]);
   tmp.push_back(A[0]);
   for (int i = 0; i < (int)tmp.size(); i++) {
      int cnt = 0;
      for (int j = 0; j < N; j++) {
         if (gcd(A[j], tmp[i]) != tmp[i]) cnt++;
         if (cnt >= 2) continue;
      }
      if (cnt < 2) ans = max(ans, tmp[i]);
   }
   tmp.clear();
   tmp = enum_div(A[1]);
   tmp.push_back(A[1]);
   for (int i = 0; i < (int)tmp.size(); i++) {
      int cnt = 0;
      for (int j = 0; j < N; j++) {
         if (gcd(A[j], tmp[i]) != tmp[i]) cnt++;
         if (cnt >= 2) continue;
      }
      if (cnt < 2) ans = max(ans, tmp[i]);
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void){
  ios::sync_with_stdio(false);cin.tie(0);
  ///
  int a,b;
  cin >> a >> b;
  if(a<=b*2){
    cout << 0 << endl;
  }else{
    cout << a-b*2 << endl;
  }
  ///
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;
using static System.Console;

class Program
{
    public static void Main()
    {
        string s = ReadLine();
        string re = "^A?KIHA?BA?RA?$";
        string ans = Regex.IsMatch(s, re) ? "YES" : "NO";
        WriteLine(ans);
    }
}


Measured memory_bytes: 16068
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define ll long long 
#define mod 1000000007 
void fast(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
}

int main() {
   fast();
   int n;
   cin>>n;
   long long int sum=0;
   for(int j=1;j<=n-1;j++){
    int c=n-j;
   for(int i=1;i<=sqrt(c);i++){
      if(c%i==0){
        if(c/i==i){
          sum+=1;
        }else{
          sum+=2;
        }
      }
   }

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


}


Measured memory_bytes: 3632
h, w = map(int, input().split())
INF = 100000000

#縦に3つ分ける場合
if w % 3 == 0:
    s_tate = 0
else:
    s_tate = (int(w/3)+1) * h - int(w/3) * h

#横に3つに分ける場合
if h % 3 == 0:
    s_yoko = 0
else:
    s_yoko = (int(h/3)+1) * w - int(h/3) * w

#上側に縦に2つ、下方に1つでわける場合
case3 = INF
if w%2 == 0:
    for i in range(1,h):
        buf = abs((int(w/2) * i) - (w * (h-i)))
        case3 = min(buf, case3)
else:
    for i in range(1,h):
        buf1 = int(w/2) * i
        buf2 = (int(w/2)+1) * i
        buf3 = w * (h - i)
        buf = [buf1, buf2, buf3]
        buf = sorted(buf)
        sa = buf[2] - buf[0]
        case3 = min(sa, case3)

#左側に１つ、右側に横に２つでわける場合
case4 =INF
if h%2 == 0:
    for i in range(1,w):
        buf = abs((int(h/2) * i) - (h * (w-i)))
        case4 = min(buf, case4)
else:
    for i in range(1,w):
        buf1 = int(h/2) * i
        buf2 = (int(h/2)+1) * i
        buf3 = h * (w - i)
        buf = [buf1, buf2, buf3]
        buf = sorted(buf)
        sa = buf[2] - buf[0]
        case4 = min(sa, case4)
ans1 = min(s_tate, s_yoko)
ans2 = min(case3, case4)

ans = min(ans1, ans2)

#print(s_tate, s_yoko, case3, case4)

print(ans)

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

const int NIL = -1;
struct Dice {
	vector<int> face;

	Dice () {}
	Dice (vector<int> face) : face(face) {}

	int operator [](int idx) { return face[idx]; }
	bool equal(const Dice other) const {
		return face == other.face;
	}
	void roll(int a, int b, int c, int d) {
		int tmp = face[a];
		face[a] = face[b];
		face[b] = face[c];
		face[c] = face[d];
		face[d] = tmp;
	}
	void roll(char ch) {
		switch (ch) {
			case 'N' : roll(0, 1, 3, 4); break;
      case 'S' : roll(0, 4, 3, 1); break;
      case 'E' : roll(0, 5, 3, 2); break;
      case 'W' : roll(0, 2, 3, 5); break;
      case 'R' : roll(1, 5, 4, 2); break;
      case 'L' : roll(1, 2, 4, 5); break;
		}
	}
	bool identical(Dice other) {
		Dice tmp(*this);
		for (int i = 0; i < 6; i++) {
			tmp.roll(i & 1 ? 'E' : 'N');
			for (int j = 0; j < 4; j++) {
				tmp.roll('R');
				if (tmp.equal(other)) return true;
			}
		}
		return false;
	}
	void set(Dice other) {
		for (int i = 0; i < 6; i++) {
			this->roll(i & 1 ? 'E' : 'N');
			for (int j = 0; j < 4; j++) {
				this->roll('R');
				for (int k = 0; k < 6; k++) {
					if (other[k] != NIL && other[k] != face[k]) break;
					if (k + 1 == 6) return;
				}
			}
		}
	}
};

const int dirs[4] = {1, 2, 4, 5};
const string ord = "SENW";
const int dy[4] = {-1, 0, 1, 0};
const int dx[4] = {0, 1, 0, -1};
int n;
int t[110], f[110];
using P = tuple<int, int, int>;
map<P, Dice> mp;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> n, n) {
    mp.clear();
    for (int i = 0; i < n; i++) {
      cin >> t[i] >> f[i];
      int y = 0, x = 0, z = 0;
      while (mp.find(P(y, x, z)) != mp.end()) z++;
      Dice D(vector<int>{1, 2, 3, 6, 5, 4});
      D.set(vector<int>{t[i], f[i], -1, -1, -1, -1});

      while (z > 0) {
        int idx = -1;
        for (int j = 0; j < 4; j++) {
          if (D[dirs[j]] < 4) continue;
          if (mp.find(P(y + dy[j], x + dx[j], z - 1)) != mp.end()) continue;
          if (idx >= 0 && D[dirs[j]] < D[dirs[idx]]) continue;
          idx = j;
        }
        if (idx < 0) break;
        D.roll(ord[idx]);
        y += dy[idx]; x += dx[idx];
        while (z >= 0 && mp.find(P(y, x, z)) == mp.end()) z--;
        z++;
      }
      mp[P(y, x, z)] = D;
    }

    int ans[6] = {};
    for (int i = -100; i <= 100; i++) {
      for (int j = -100; j <= 100; j++) {
        int k = 0;
        while (mp.find(P(i, j, k)) != mp.end()) k++;
        if (k == 0) continue;
        ans[mp[P(i, j, k - 1)][0] - 1]++;
      }
    }
    for (int i = 0; i < 6; i++) {
      cout << ans[i] << " \n"[i + 1 == 6];
    }
  }

  return 0;
}


Measured memory_bytes: 3216
while True:
	n = int(input())
	if n == 0: break
	A = B = 0
	for i in range(n):
		a, b = map(int, input().split())
		if a == b:
			A += a
			B += b
		elif a > b: A += a+b
		else:       B += a+b
	print(A, B)



Measured memory_bytes: 5612
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
my_min = 10 ** 10
A_rev = []
for i in range(N - 1):
    if A[i] < 0:
        A[i] *= -1
        if i < N - 1:
            A[i + 1] *= -1
    A_rev.append(A[i])
    my_min = min(my_min, abs(A[i]))
A_rev.append(A[-1] if A[-1] >= 0 else A[-1] * -1)
my_min = min(my_min, abs(A[-1]))
if np.count_nonzero(A >= 0) == N:
    print(sum(A))
else:
    print(sum(A_rev) - my_min * 2)

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

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    string S; cin >> S;
    cout << string(S.size(), 'x') << endl;
    return 0;
}

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

using namespace std;

vector<int> par,sze;

int find(int x){
	if(x==par[x])
		return x;
	return par[x]=find(par[x]);
}

void union_set(int a,int b){
	a=find(a),b=find(b);
	if(a==b)return;
	if(sze[a]<sze[b]){
		par[a]=b;
		sze[b]+=sze[a];
	}
	else{
		par[b]=a;
		sze[a]+=sze[b];
	}
}

int main(){
	int n,m,k;
	cin>>n>>m>>k;
	par.resize(n),sze.resize(n);
	vector<int> adj[n];
	for(int i=0;i<n;i++){
		par[i]=i;
		sze[i]=1;	
	}
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		--a,--b;
		union_set(a,b);
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	for(int i=0;i<k;i++){
		int a,b;
		cin>>a>>b;
		--a,--b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	vector<int> ans(n);
	for(int i=0;i<n;i++){
		int c=sze[find(i)];
		for(auto x:adj[i]){
			if(find(i)==find(x))
				c--;
		}
		ans[i]=--c;
	}
	for(int i=0;i<n;i++)cout<<ans[i]<<" ";
	
}


Measured memory_bytes: 8704
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var n, ans int
	fmt.Scan(&n)
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			ans = i + n/i
		}
	}
	fmt.Println(ans - 2)
}

func nextSlice() []string {
	sc.Scan()
	return strings.Split(sc.Text(), " ")
}

func atoi(a []string) (b []int) {
	b = make([]int, len(a))
	for i := range a {
		b[i], _ = strconv.Atoi(a[i])
	}
	return
}

func atof(a []string) (b []float64) {
	b = make([]float64, len(a))
	for i := range a {
		b[i], _ = strconv.ParseFloat(a[i], 64)
	}
	return
}

func scanSlice2(n int) (a []int, b []int) {
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func scanFloatSlice2(n int) (a []float64, b []float64) {
	a = make([]float64, n)
	b = make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

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

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

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

func larger(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func largest(a, b, c int) (lgst int) {
	if a > b {
		lgst = a
	} else {
		lgst = b
	}
	if c > lgst {
		lgst = c
	}
	return
}

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

func smallest(a, b, c int) (slst int) {
	if a < b {
		slst = a
	} else {
		slst = b
	}
	if c < slst {
		slst = c
	}
	return
}

func sum(a []int) (ans int) {
	for i := range a {
		ans += a[i]
	}
	return
}

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

func yesOrNo(b bool) string {
	if b {
		return "Yes"
	}
	return "No"
}

func yesorNO(b bool) string {
	if b {
		return "YES"
	}
	return "NO"
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

const string YES = "";
const string NO  = "";

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

    int a, b;

    cin >> a >> b;

    cout << (a % b == 0 ? -1 : a) << endl;

    return 0;
}



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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX

typedef long long ll;
typedef pair<int, int> ii;

int main(){

  int n;
  cin >> n;
  ll anst = 1, ansa = 1;
  rep(i, n){
    int t, a;
    cin >> t >> a;
    ll pt = (anst + t - 1) / t, pa = (ansa + a - 1) / a;
    anst = t * max(pt, pa);
    ansa = a * max(pt, pa);
    //t * k >= anst, a * k >= ansa
  }

  cout << anst + ansa << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int h, n;
  	cin >> h >> n;
  	
  	int m[n][2];
  	for(int i=0;i<n;i++){
  		cin >> m[i][0] >> m[i][1];
  	}
  	
  	int dp[n][h+1];
  	for(int i=0;i<n;i++){
  		dp[i][0] = 0;
  	}
  	
  	for(int i=0;i<=h;i++){
  		if(i%m[0][0]==0){
  			dp[0][i] = (i/m[0][0])*m[0][1];
  		}else{
  			dp[0][i] = ((i/m[0][0])+1)*m[0][1];
  		}
  	}
  	
  	for(int i=1;i<n;i++){
  		for(int j=1;j<=h;j++){
  			if(m[i][0]<=j){
  				dp[i][j] = min(dp[i-1][j], dp[i][j-m[i][0]]+m[i][1]);
  			}else{
  				dp[i][j] = min(dp[i-1][j], m[i][1]);
  			}
  		}
  	}
  	
  	cout<<dp[n-1][h]<<endl;
}



Measured memory_bytes: 39296
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

from heapq import heappop, heappush

N,M,S = LI()
U,V,A,B = LIR(M,4)
C,D = LIR(N,2)

max_ = (N-1)*max(A)
E = [dict() for _ in range(N*(max_+1))]

def number(i,j):
    return i*(max_+1)+j

def dijkstra(E,s,n):
    d = [10**9*(max_+1)*N]*n
    d[s] = 0
    q = []
    heappush(q,(0,s))
    while q:
        du,u = heappop(q)
        if d[u] < du:
            continue
        for v,weight in E[u].items():
            dnew = du + weight
            if d[v] > dnew:
                d[v] = dnew
                heappush(q,(dnew,v))
    return d

for i in range(N):
    for j in range(max_-C[i]+1):
        E[number(i,j)][number(i,j+C[i])] = D[i]

for i in range(M):
    for j in range(A[i],max_+1):
        E[number(U[i]-1,j)][number(V[i]-1,j-A[i])] = B[i]
        E[number(V[i]-1,j)][number(U[i]-1,j-A[i])] = B[i]

d = dijkstra(E,min(S,max_),N*(max_+1))

for i in range(1,N):
    ans = float('inf')
    for j in range(max_+1):
        if d[number(i,j)] < ans:
            ans = d[number(i,j)]
    print(ans)

Measured memory_bytes: 123580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(n); i++)
#define precision(x) fixed << setprecision(x)
#define all(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(all(x))
#define SUM(x) accumulate(all(x),0LL)
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000

int gcd(int a,int b){return b?gcd(b,a%b):a;}
const double PI = acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
    int h, w;
    while(1){
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        rep(i,h){
            rep(j,w) cout << "#";
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;

int main(void){
  string s,t;
  cin>>s>>t;
  ll n=s.size(),m=t.size();
  ll ans=INF;
  for(ll i=0;i<n-m+1;i++){
    ll now=0;
    for(ll j=i;j<i+m;j++){
      if(s[j]!=t[j-i]) now++;
    }
    ans=min(ans,now);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  
  string S, pre, post;
  getline(cin, S);

  bool flip = false;
  i64 Q, q;
  cin >> Q;
  REP(0, Q, q) {
    i64 T;
    cin >> T;
    if(T == 1) {
      flip = !flip;
    }
    else {
      i64 F;
      string C;
      cin >> F >> C;
      if(F == 1) {
	if(!flip)
	  pre += C;
	else
	  post += C;
      }
      else {
	if(!flip)
	  post += C;
	else
	  pre += C; 
      }
    }
  }

  reverse(all(pre));
  string ans = pre + S + post;
  if(flip)
    reverse(all(ans));
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1348
#include<bits/stdc++.h>
#define int long long
using namespace std;
int mx(int x){int ret=0;while(x)++ret,x>>=1;return ret;}
signed main(){
	int n,m;cin>>n>>m;
	int p=60;
	while(p>=0&&(n>>p&1ll)==(m>>p&1ll))--p;
	int ans=0;
	if(p>=0){
		m=(m&((1ll<<p)-1)),n=(n&((1ll<<p+1)-1));
		ans+=(1ll<<p)-n;
		int x=mx(m);
		ans+=(1ll<<x);
		n=max(n,1ll<<x);
		ans+=(1ll<<p)-n;
	}
	else ans=1;
	cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int x = x2 - x1;
    int y = y2 - y1;
    cout << x2 - y << " " << y2 + x << " " << x1 - y << " " << y1 + x << endl;
    return 0;
}


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

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

Measured memory_bytes: 256
#include <stdio.h>

main(void)
{
  char abc[4];
  
  scanf("%s",abc);
  
 if(abc[0]!=abc[1])
 {
   if(abc[1]!=abc[2])
   {
     if(abc[0]!=abc[2])
     {
       printf("Yes");
     }
     else
       printf("No");
   }
   else
     printf("No");
 }
  else
    printf("No");
  
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(void)
{
	long n,m,i,j;
	long cnt=0;
	long sum=0;
	scanf("%ld %ld",&n,&m);

	long a[n];
	for(i=0;i<n;i++){
		scanf("%ld",&a[i]);
		sum+=a[i];
		for(j=0;j<i;j++){
			if(a[j]==a[i]){
				puts("No");
				return 0;
			}
		}
	}

	for(i=0;i<n;i++){
		if(a[i]>=((double)sum/(4*m))){
			cnt++;
		}
	}
	if(cnt>=m){
		puts("Yes");
	}
	else puts("No");

	return 0;
}


Measured memory_bytes: 1636
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 1e5 + 5;

int32_t main()
{
	IOS;
	int a, b;
	cin >> a >> b;
	if(a <= 5)
		cout << 0;
	else if(a <= 12)
		cout << b / 2;
	else
		cout << b;
	return 0;
}

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

#pragma region Macros
using ll = long long;
#define int ll
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
#define IOS\
    ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SORT(name) sort(name.begin(), name.end())
#define RSORT(name)\
    SORT(name);\
    reverse(all(name));
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
template <class T> inline void print(T x){ cout << x << '\n';}
template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
#pragma endregion

#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const int MOD = 1000000007;
const int MAX_N = 100010;

int RMaxQ(int a, int b) {
    return max(a, b);
}
int MaxE() { return 0; }

signed main() {
    IOS;

    int N, Q;
    cin >> N >> Q;
    V<> A(N);
    REP(i, N) {
        cin >> A[i];
    }

    segtree<int, RMaxQ, MaxE> segmax(A);

    REP(i, Q) {
        int q;
        cin >> q;
        if(q == 1) {
            int x, v;
            cin >> x >> v;
            x--;
            segmax.set(x, v);
        }
        else if(q == 2) {
            int l, r;
            cin >> l >> r;
            l--;
            print(segmax.prod(l, r));
        }
        else {
            int x, v;
            cin >> x >> v;
            x--;

            if(v > segmax.prod(x, N)) {
                print(N + 1);
                continue;
            }

            int lb = x, ub = N - 1;
            while(ub - lb > 1) {
                int mid = (lb + ub) / 2;
                int val = segmax.prod(x, mid + 1);
                if(v <= val) { ub = mid; }
                else { lb = mid; }
            }
            if(v <= segmax.prod(x, lb + 1)) {
                print(lb + 1);
            }
            else {
                print(ub + 1);
            }
        }
    }

    return 0;
}


Measured memory_bytes: 8916
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <vector>
#include <string>

//Some constants don't work
#ifndef INT_MAX
#define INT_MAX 2147483647
#endif
#ifndef INT_MIN
#define INT_MIN -2147483648
#endif
//short hand tricks
typedef long long ll;

using namespace std;

int main(int argc, char * argv[]) {
    ios_base::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for(int i=0; i<n; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    int ans = 0;
    for(int i=0; i<k; i++) {
        ans+=v[i];
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main()
{
    long long N, M;
    long long card;


    cin >> N >> M;

    if( N == 1 && M == 1 ) //どちらも1なら裏
        card = 1;
    else if( N == 1 || M == 1 ) //どちらかが1なら端の2枚以外裏
        card = N*M - 2;
//    else if( N == 2 || M == 2 ) //どちらかが2なら裏のカードはない
//        card = 0;
    else //周囲は必ず表、中は必ず裏
        card = (N-2)*(M-2);

    cout << card << endl;

    return 0;
}

Measured memory_bytes: 256
/*
* be kind, work hard
*/
/******************************************************************************/
/**///#include <boost/multiprecision/cpp_int.hpp>
/**/#include <bits/stdc++.h>                                                
/**/
/**/#define endl            "\n"
/**/#define pb              push_back
/**/#define X               first
/**/#define Y               second
/**/#define setZero(array)  memset((array), 0, sizeof (array))
/**/#define setOne(array)   memset((array), 1, sizeof (array))
/**/#define setTrue(array)  memset((array), true, sizeof (array))
/**/#define setFalse(array) memset((array), false, sizeof (array))
/**/#define HAYAKU          ios_base::sync_with_stdio(false);cin.tie(NULL);
/**/#define int             long long
/**/#define LIVE            return
/**/#define FREE            1
/**/#define OR              and
/**/#define DIE             0
/******************************************************************************/
/*
using boost::multiprecision::cpp_int;
*/

typedef long long ll;

using namespace std;

const int MOD = 1e9 + 7;
const int N   = 1e5;

void preprocess(){
    return;
}

int inline solve(){
    int n, i, j, sum = 1;
    
    cin >> n;
    
    int facCount[n+9] = {0};
    
    for(i=2; i<=n; ++i){
        for(j=i; j<=n; j+=i){
            ++facCount[j];
        }
    }
    
    for(i=2; i<=n; ++i){
        sum += i * (facCount[i]+1);
    }
    
    cout << sum ;
    return 0;
}

signed main(){
    HAYAKU
    
    preprocess();
    
    int t = 1;
    
//    cin >> t;
    
    for(int i=1; i<=t; ++i){
//        cout << "Case #" << i << ": ";
//        cout << 
            solve();
//        cout << endl;
    }
    
    LIVE FREE OR DIE;
}

Measured memory_bytes: 81788
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
int a[114514],b[114514]={};
signed main(){
	int n,cnt=0,sum=0;
	cin>>n;
	rep(i,n){
		cin>>a[i];
	}
	sort(a,a+n);
	rep(i,n){
		b[a[i]]++;
	}
	rep(i,a[n-1]+1){
		if(b[i]>1){
			cnt+=b[i]-1;
		}
		if(b[i]>0){
			sum++;
		}
	}
	if(cnt%2==1){
		cout<<sum-1<<endl;
	}
	else{
		cout<<sum<<endl;
	}
}


Measured memory_bytes: 1792
input_string = input()
array = list(map(int, input_string.split() ))
W = array[0]
H = array[1]
x = array[2]
y = array[3]
r = array[4]

if x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 5596
#include<iostream>
#include<vector>
using namespace std;
int main(void) {
	int N;
	cin >> N;
	vector<string>S(N);
	for (int i = 0; i < N; i++) {
		cin >> S[i];
	}
	int C0 = 0;
	int C1 = 0;
	int C2 = 0;
	int C3 = 0;
	for (int i = 0; i < N; i++) {
		if (S[i] == "AC") {
			C0 += 1;
		}
		else if (S[i] == "WA") {
			C1 += 1;
		}
		else if (S[i] == "TLE") {
			C2 += 1;
		}
		else if (S[i] == "RE") {
			C3 += 1;
		}
	}
		cout << "AC x " << C0 << endl;
		cout << "WA x " << C1 << endl;
		cout << "TLE x " << C2 << endl;
		cout << "RE x " << C3 << endl;
	
}

Measured memory_bytes: 6420
let rec select acc trace = function
  | [] -> acc
  | x :: xs -> select ((trace, x, xs) :: acc) (x :: trace) xs
let select xs = select [] [] xs

let memoize n f =
  let dp = Hashtbl.create n in
  let rec get x =
    try Hashtbl.find dp x with
    | Not_found ->
        let result = f get x in
        Hashtbl.add dp x result;
        result in
  get

let () =
  let n, z, w = Scanf.scanf "%d %d %d\n" (fun n z w -> n, z, w) in
  let as_ = Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in
  let solve = memoize n (fun self (x, ys) ->
    select ys
    |> List.map (function
        | (_, y, []) -> (abs (x - y), abs (x - y))
        | (_, y, xs) -> let (fst, snd) = self (y, xs) in (snd, fst))
    |> List.fold_left (fun (z, w) (x, y) -> (max z x, min w y)) (min_int, max_int)) in
  Printf.printf "%d\n" @@ fst @@ solve (w, Array.to_list as_)

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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a + b > c + d)
    {
        cout << "Left" << endl;
    }
    else if (a + b == c + d)
    {
        cout << "Balanced" << endl;
    }
    else
    {
        cout << "Right" << endl;
    }
}


Measured memory_bytes: 256
from itertools import accumulate
N = int( input())
A = list( map( int, input().split()))
A.sort()
l = -1
r = N-1
B = list( accumulate(A))
while r - l > 1:
    m = (l+r)//2
    # now = sum(A[:m+1])
    check = 1
    for i in range(m+1,N):
        if A[i] <= B[i-1]*2:
            pass
        else:
            check = 0
            break
    if check == 1:
        r = m
    else:
        l = m
print(N-r)

Measured memory_bytes: 14428
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    int N; cin >> N;
    vector<Int> A(N); for (auto& a : A) cin >> a;
    Int cnt = 0;
    Int minimum = *min_element(begin(A), end(A));
    for (auto& a : A) {
        a -= minimum;
        cnt += a / (N+1);
        a %= N+1;
    }
    for (auto& a : A) a += minimum + cnt;
    sort(rbegin(A), rend(A));
    vector<Int> B(N);
    for (int i = 0; i < N; i++) {
        B[i] = A[i]+i;
        if (B[i] <= N-1) {
            cout << cnt + i << endl;
            return 0;
        }
    }
    int t = min_element(begin(B), end(B)) - begin(B);
    while (t--) {
        *max_element(begin(A), end(A)) -= N + 1;
        for (auto& a : A) a += 1;
        cnt++;
    }
    Int maximum = *max_element(begin(A), end(A));
    cout << cnt + (maximum - N + 1) * N << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1E6+7;
const ll mod=1e9+7;
ll arr[N];
ll mp[N];
ll ksm(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1) res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res%mod;
}
int main()
{
    ios::sync_with_stdio(false );
    ll n;
    cin>>n;
    ll mx=0;
    for(ll i=1;i<=n;i++){
        cin>>arr[i];
        mx=max(mx,arr[i]);
    }
    ll pos=0;
    for(ll i=1;i<=n;i++){
        ll x=arr[i];
        ll y=sqrt(x);
        for(ll j=2;j<=y;j++){
            ll cnt=0;
            while(x%j==0){
                x/=j;
                cnt++;
            }
            mp[j]=max(mp[j],cnt);
        }
        if(x!=1) mp[x]=max(mp[x],(ll)1);
    }
    ll sum=1;
    for(ll i=1;i<=mx;i++)
        sum=(sum%mod*ksm(i,mp[i])%mod)%mod;
    ll ans=0;
    for(ll i=1;i<=n;i++){
        ans+=sum*ksm(arr[i],mod-2)%mod;
    }
    cout<<ans%mod<<endl;
    return 0;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;

    ll N_tmp = N;
    ll a = 0;
    while (N_tmp > 0) {
        a += N_tmp % 10;
        N_tmp /= 10;
    }

    cout << ((N % a == 0) ? "Yes\n" : "No\n");
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

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

using namespace std;

int main(){
  vector<int> a(6);
  for(int i =0; i < 6; ++i){
    cin >> a[i];
  }
  vector<int> count(4, 0);
  for(int i = 0; i < 6; ++i){
    for(int j = 1; j <= 4; ++j){
      if(a[i] == j){
        count[j - 1] += 1;
      }
    }
  }
  sort(count.begin(), count.end());


  if(count[0] == 1 && count[1] == 1 && count[2] == 2 && count[3] == 2){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  
  int D;

  cin >> D;

  if(D == 25){
    cout << "Christmas" << endl;
  }
  else if(D == 24){
    cout << "Christmas Eve" << endl;
  }
  else if(D == 23){
    cout << "Christmas Eve Eve" << endl;
  }
  else if(D == 22){
    cout << "Christmas Eve Eve Eve" << endl;
  }

  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b); for(ll i=(a); i<=ll(b); i++) 
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
const ll MOD = 1e9+7;
int gcd(int a, int b){ //a>=0,b>=0,￢(a=b=0)
  while(min(a,b)>0){if(a<b)swap(a,b);a=a%b;}return max(a,b);
}
//int:~2e9   小数:double



int main(){
  int n;
  cin >>n;
  vector<vector<int>> c(100,vector<int>(100))
  FOR(i,1,9){
    FOR(j,1,9){
      int count=0;
      FOR(k,1,n){
        int tmp=k;
        while(tmp>=10) tmp /=10;
        if(k%10==j&&tmp==i) count++;
      }
      c[i][j]=count;

    }
  }
  int ans=0;
  FOR(i,1,9){
    FOR(j,1,9){
      ans+=c[i][j]*c[j][i];
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream> 
#include <algorithm>
#include <map>
 
using namespace std;
 
static const int N = 10;
 
int n, data[N][N], v_size, rem, f[157];
pair<int, int> vis[15];
int size[3] = {5, 9, 13};
int cen[3] = {N, N+1, 2*N};
int dx[3][13] = {
  {0, -1, 0, 1, 0},
  {0, 1, 2, 0, 1, 2, 0, 1, 2},
  {0, -1, 0, 1, -2, -1, 0, 1, 2, -1, 0, 1, 0}
};
int dy[3][13] = {
  {0, 1, 1, 1, 2},
  {0, 0, 0, 1, 1, 1, 2, 2, 2},
  {0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4}
};
 
bool check(int p, int s){
  int x = p % N, y = p / N;
  for(int i=0;i<size[s];i++){
    int ny = y + dy[s][i];
    int nx = x + dx[s][i];
    if(ny >= N) return false;
    if(nx < 0 || nx >= N) return false;
    if(data[ny][nx] <= 0) return false;
  }
  return true;
}
 
void put(int p, int s, int t){
  int x = p % N, y = p / N;
  for(int i=0;i<size[s];i++){
    int ny = y + dy[s][i];
    int nx = x + dx[s][i];
    data[ny][nx] += t;
  }
}
 
bool solve(int p){
  if(rem < 0 || rem > 156 || !f[rem]) return false;
  if(v_size == n){
    if(rem == 0){
      for(int i=0;i<v_size;i++){
        cout << vis[i].first % N << ' ' << vis[i].first / N << ' ' << vis[i].second + 1 << endl;
      }
    }
    return rem == 0;
  }
  for(;p<N*N;p++){
    if(data[p/N][p%N] > 0){
      for(int i=0;i<3;i++){
        if(rem - size[i] < 0 || rem - size[i] > 156 || !f[rem-size[i]]) continue;
        if(check(p, i)){
          put(p, i, -1);
          rem -= size[i];
          vis[v_size++] = make_pair(p+cen[i], i);
          
          if(solve(p)) return true;
          v_size--;
          rem += size[i];
          put(p, i, 1);
        }
      }
      return false;
    }
  }
  return false;
}
 
int main(){
  for(int i=0;i<=12;i++){
    for(int j=0;j<=12;j++){
      for(int k=0;k<=12;k++){
        if(i + j + k <= 12){
          int sum = 0;
          for(int l=0;l<i;l++) sum += 5;
          for(int l=0;l<j;l++) sum += 9;
          for(int l=0;l<k;l++) sum += 13;
          if(sum <= 156) f[sum] = true;
        }
      }
    }
  }
  cin >> n;
  rem = 0;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      cin >> data[i][j];
      rem += data[i][j];
    }
  }
  solve(0);
  return 0;
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

struct UnionFind {
    vector<ll> parent;

    UnionFind(ll N) {
        parent.resize(N, -1);
    }

    ll find(ll x) {
        // 自身が根っこの場合
        if (parent[x] < 0) {
            return x;
        }
        return parent[x] = find(parent[x]);
    }

    ll size(ll x) {
        return -parent[find(x)];
    }

    void unite(ll x, ll y) {
        ll root_x = find(x);
        ll root_y = find(y);
        // 同じ素集合にいたら何もしない
        if (root_x == root_y) return;
        if (size(root_x) < size(root_y))
            swap(root_x, root_y);
        parent[root_x] += parent[root_y];
        parent[root_y] = root_x;
    }
};

int main() {
    ll n, m; cin >> n >> m;
    ll a, b;
    UnionFind uf(n);
    for (int i = 0; i < m; ++i) {
        cin >> a >> b;
        a--; b--;
        uf.unite(a, b);
    }
    
    ll ans = 0;
    for (int i = 1; i < n; ++i) {
        ll x = uf.find(0);
        ll y = uf.find(i);
        if (x != y) {
            uf.unite(0, i);
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4000
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+1,X[4]={-1,0,0,1},Y[4]={0,-1,1,0};
bool v[N][N];
int n,m,p[N*N],q[N*N],s,t,P,Q,f[N][N],A;
string S[N];
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>S[i];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(S[i][j-1]=='#')
				p[++t]=i,q[t]=j,v[i][j]=true;
	while(s<t)
	{
		P=p[++s],Q=q[s];
		for(int i=0;i<4;i++)
			if(1<=P+X[i]&&P+X[i]<=n&&1<=Q+Y[i]&&Q+Y[i]<=m&&!v[P+X[i]][Q+Y[i]])
				p[++t]=P+X[i],q[t]=Q+Y[i],f[P+X[i]][Q+Y[i]]=f[P][Q]+1,v[P+X[i]][Q+Y[i]]=true;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			A=max(A,f[i][j]);
	cout<<A;
	return 0;
}

Measured memory_bytes: 14080
n,T=map(int,input().split())
t=list(map(int,input().split()))
ans=0
num1=0
num2=0
for i in range(n):
    if num2>t[i]:
        num2=t[i]+T
    else:
        ans+=num2-num1
        num1=t[i]
        num2=t[i]+T
ans+=num2-num1
print(ans)


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

int main(){
  int N,ans = 0;
  cin >> N;
  vector<int>L(N);
  for(int i=0; i<N; i++){
    cin >> L[i];
  }
  sort(L.begin(),L.end());
  for(int i=0; i<N-2; i++){
    for(int j=i+1;j<N-1; j++){
      for(int k=j+1; k<N; k++){
        if(L[i]+L[j]>L[k]){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}


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


bool f[4];
int main(){
    int n[4];
    for(int i=0;i<4;i++){
        cin>>n[i];
        if(n[i]==1) f[0]=1;
        if(n[i]==9) f[1]=1;
        if(n[i]==7) f[2]=1;
        if(n[i]==4) f[3]=1;
    }
    if(f[0]&&f[1]&&f[2]&&f[3])
    cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll MOD=1e9+7 ;
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; }

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){

    int n;
    cin >> n;
    int bary[n-1];
    rep(i,n-1) cin >> bary[i];

    int aary[n];
    aary[0] = bary[0];
    rep(i,n-2)
    {
        aary[i+1] = min(bary[i], bary[i+1]);
    }
    aary[n-1] = bary[n-2];

    int ans = 0;
    rep(i,n) ans += aary[i];

    cout << ans << endl;
}


Measured memory_bytes: 256
def fibon(n):
    a, b = 0, 1
    while n>=0:
        if n==0:return a
        b += a
        n -= 1
        if n==0: return b
        a += b
        n -= 1

n, m = map(int, input().split())
a = [-1] + [int(input()) for i in range(m)] + [n+1]
ans = 1
for i in range(m+1):
    ans *= fibon(a[i+1]-a[i]-1)
print(ans%1000000007)

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

using namespace std;
using ll = long long;
using vec = vector<int>;

#define rep(i, n)  for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define Sort(a)    sort(a.begin(), a.end())
#define gSort(a)   sort(a.begin(), a.end(), greater<int>())
#define pout(n, a) cout << fixed << setprecision(n) << (a)
#define Cast(dig, n) static_cast<std::bitset<(dig)>>(n)

const int INF = 2147483647;
const ll  MOD = 1000000007;

// 最大公約数を求める
int gcd(int a, int b) {
    return b ? gcd(b, a%b) : a;
}

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

    vector<int> num = {1, 1, 1};

    ll ans = 0;

    while((num[0] < k) || (num[1] < k) || (num[2] <= k+1)) {
        // cout << " : " << num[0] << num[1] << num[2] << endl;

        ans += gcd(gcd(num[0], num[1]), num[2]);

        // 配列numの数を増やす．
        // ２桁目と３桁目がｋと等しいなら１桁目を増やす
        // ３桁目がｋと等しいなら２桁目を増やす
        // それ以外なら３桁目を増やす
        if(num[0] == num[1] && num[1] == num[2] && num[2] == k) break;
        else if(num[1] == num[2] && num[2] == k) {
            num[0]++;
            num[1] = 1;
            num[2] = 1;
        }else if(num[2] == k) {
            num[1]++;
            num[2] = 1;
        }else {
            num[2]++;
        }
    }

    cout << ans;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define _GLIBCXX_DEBUG
#define INF 100000010
using namespace std;
const int mod = 1000000007;


int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  //vector<int> A(N);
  //for(int i=0; i<N; i++){cin>>A[i];}
  //vector<vector<int>> A(N,vector<int>(M));
  //for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>A[i][j];}}
  //sort(A.begin(),A.end());
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
  while(true){
    c-=b;
    if(c<=0){cout<<"Yes"<<endl;break;}
    a-=d;
     if(a<=0){cout<<"No"<<endl;break;}
 }
}

Measured memory_bytes: 3636
#include <stdio.h>
#define MAX 100
#define N 10000000
#define W 0
#define B 1

int n,C[MAX],X[MAX][MAX],Y[MAX],Z[MAX];

void pfarm(){

  int min,i,j;

  for(i=0;i<n;i++){
    Y[i]=N;
    Z[i]=-1;
    C[i]=W;
  }

  Y[0]=0;

  while(1){
    min = N;
    for(i=0;i<n;i++){
      if(C[i]!=B&&Y[i]<min){
	min=Y[i];
	j=i;
      }
    }

    if(min==N)
      break;
    C[j]=B;

    for(i=0;i<n;i++){
      if(C[i]!=B&X[j][i]<Y[i]&&X[j][i]>=0){
	Z[i]=j;
	Y[i]=X[j][i];
      }
    }
  }
}

int main(){

  int i,j,count=0;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&X[i][j]);
    }
  }
  pfarm();
  for(i=0;i<n;i++){
    count+=Y[i];
  }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;

int main(){
  
  int n,w;
  cin >> n >> w;
  vector<ll> v(n);
  vector<ll> m(n);
  rep(i,n) cin >> m.at(i) >> v.at(i);
  
  vector<vector<ll>> dp(110, vector<ll>(100010));
  for(int i = 0; i < n; i++){
    for(int j = 1; j <= w; j++){
      
    if(j-m.at(i) >= 0){
      dp.at(i+1).at(j) = max(dp.at(i+1).at(j), dp.at(i).at(j-m.at(i))+v.at(i));
    }
      dp.at(i+1).at(j) = max(dp.at(i+1).at(j),dp.at(i).at(j));      
    }
  }
  
  cout << dp.at(n).at(w) << endl;
}

Measured memory_bytes: 87296
#include <bits/stdc++.h>
using namespace std;
vector<int> a;
int main(){
    int N;
    cin>>N;
    int a1;
    for(int i=0;i<N;i++){
        cin>>a1; a.push_back(a1);
    }

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

    cout<<a[N-1]-a[0]<<"\n";
    return 0;
}



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

lli dp[100001][3];

main()
{
    lli n,i,a,b,c;
    cin>>n;
    lli arr[n],brr[n],crr[n];

    for(i=0;i<n;i++)
    {
        cin>>arr[i]>>brr[i]>>crr[i];
    }

    dp[0][0] = arr[0];
    dp[0][1] = brr[0];
    dp[0][2] = crr[0];

    for(i=1;i<n;i++)
    {
        dp[i][0] = arr[i] + max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = brr[i] + max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = crr[i] + max(dp[i-1][0],dp[i-1][1]);
    }

    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));

}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
ifstream f("A.ni");

int main()
{
    string S;
    cin>>S;
    for(int i=0;i<S.size();i++)
    if(S[i]=='?') S[i]='D';
    cout<<S;

    return 0;
}


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

using namespace std;
//using namespace __gnu_pbds;

#define ll       long long
#define DS       pair<int, int>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 1e3 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int n, h, a[N], b[N], dp[N][10005];

int fun(int pos, int baki) {
    if (baki <= 0) {
        return 0;
    }
    if (pos == n) {
        return baki <= 0 ? 0 : 1e9;
    }
    int &tmp = dp[pos][baki];
    if (tmp != -1) {
        return tmp;
    }
    tmp = min(b[pos] + fun(pos, baki - a[pos]), fun(pos + 1, baki));
    return tmp;
}

int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    scanf("%d %d", &h, &n);
    for (int i = 0; i < n; i++) {
        scanf("%d %d", a + i, b + i);
    }
    memset(dp, -1, sizeof dp);
    printf("%d\n", fun(0, h));
    return 0;
}


Measured memory_bytes: 40192
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define sd(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define pl(n) printf("%lld",n)
#define sf(n) scanf("%f",&n)
#define pf(n) printf("%.12f",n)
#define psp printf(" ")
#define endc printf("\n")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const int maxn = 340;
//const int md = 1e9 + 7;

ll a[maxn][maxn];
bool del[maxn][maxn];

int main() {
	int n; sd(n); ll sum = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			sl(a[i][j]); sum += a[i][j]; del[i][j] = false;
		}
	}

	for (int k = 1; k <= n; k++) {
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				if (a[i][k] + a[k][j] < a[i][j]) {
					pd(-1); endc; return 0;
				} else if (a[i][k] + a[k][j] == a[i][j] && !del[i][j] && i != k && k != j && i != j) {
					sum -= a[i][j]; del[i][j] = true;
				}
			}
		}
	}

	pl(sum/2); endc;

}


Measured memory_bytes: 1152
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
	public static void main(String... args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int x[] = new int[n];
		int y[] = new int[n];
		for (int i=0; i<n; i++){
			String numbers[] = br.readLine().split(" ");
			x[i] = Integer.parseInt(numbers[0])-x[0];
			y[i] = Integer.parseInt(numbers[1])-y[0];	
		}
		double area = 0;
		for (int k = 1; k<n-1; k++){
			area += x[k]*y[k+1]-x[k+1]*y[k];
		}
		System.out.printf("%.1f\n", Math.abs(area*0.5));
	}
}

Measured memory_bytes: 24760