akhauriyash/Code-Regression huggingface dataset:
/*

You've got the words to change a nation
But you're biting your tongue
You've spent a life time stuck in silence
Afraid you'll say something wrong
If no one ever hears it how we gonna learn your song?

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░▄▄▄▄▄▄▄░░░░░░░░░
░░░░░░░░░▄▀▀▀░░░░░░░▀▄░░░░░░░
░░░░░░░▄▀░░░░░░░░░░░░▀▄░░░░░░
░░░░░░▄▀░░░░░░░░░░▄▀▀▄▀▄░░░░░
░░░░▄▀░░░░░░░░░░▄▀░░██▄▀▄░░░░
░░░▄▀░░▄▀▀▀▄░░░░█░░░▀▀░█▀▄░░░
░░░█░░█▄▄░░░█░░░▀▄░░░░░▐░█░░░
░░▐▌░░█▀▀░░▄▀░░░░░▀▄▄▄▄▀░░█░░
░░▐▌░░█░░░▄▀░░░░░░░░░░░░░░█░░
░░▐▌░░░▀▀▀░░░░░░░░░░░░░░░░▐▌░
░░▐▌░░░░░░░░░░░░░░░▄░░░░░░▐▌░
░░▐▌░░░░░░░░░▄░░░░░█░░░░░░▐▌░
░░░█░░░░░░░░░▀█▄░░▄█░░░░░░▐▌░
░░░▐▌░░░░░░░░░░▀▀▀▀░░░░░░░▐▌░
░░░░█░░░░░░░░░░░░░░░░░░░░░█░░
░░░░▐▌▀▄░░░░░░░░░░░░░░░░░▐▌░░
░░░░░█░░▀░░░░░░░░░░░░░░░░▀░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

*/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 300010;

int n,a[N];

bool isBorder(int x , int y){
	if(x == 0)
		return true;
	if(a[x-1] < y + 1)
		return true;
	return false;
}
int main() {
//	freopen("input.txt","r",stdin);
	scanf("%d",&n);
	for (int i = 0; i < n; ++i){
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	int curRow = n,curCol = 0;

	while(!isBorder(curRow - 1 , curCol + 1)){
		curRow--;
		curCol++;
	}	
	int cnt = 0,org = curCol,first = a[curRow-1]-curCol;
	while(curRow && a[curRow - 1] > org){
		cnt++;
		curRow--;
	}
	if((cnt&1) && ((first)&1)){
		puts("Second");
	}else{
		puts("First");
	}
    return 0;
}

Measured memory_bytes: 640
#include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<climits>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<vector>
#include<cctype>
#include<cmath>
#include<stack>
#include<queue>
#include<list>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const int inf88 = 1482184792;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const double pi = acos(-1.0);
typedef pair<int, int> P;
#define N 1010
#define M 1000100

int sgn(double x){
    if(fabs(x) < eps)
        return 0;
    if(x < 0)
        return -1;
    return 1;
}

int n;

struct Point{
    double x, y;
    Point(){};
    Point(double _x, double _y){
        x = _x;
        y = _y;
    }
    bool operator < (const Point &A) const{
        if(x == A.x)
            return y < A.y;
        return x < A.x;
    }
    bool operator == (Point A) const{
        return sgn(x-A.x) == 0 && sgn(y-A.y) == 0;
    }
    Point operator - (const Point &A) const{
        return Point(x-A.x, y-A.y);
    }
    double operator * (const Point &A) const{
        return x*A.x + y*A.y;
    }
    double operator ^ (const Point &A) const{
        return x*A.y - y*A.x;
    }
    double distance(Point A){
        return sqrt((x-A.x)*(x-A.x) + (y-A.y)*(y-A.y));
    }
}p[N], sta[N];

int cnt;

double xmul(Point p0, Point p1, Point p2){
    return (p1-p0)^(p2-p0);
}

bool convex_hull(){
    map<int, int> dir;
    for(int i = 0; i < n; i++){
        int tmp = sgn(xmul(p[i+1], p[i], p[i+2]));
        dir[tmp]++;
        if(dir[1] && dir[-1])
            return false;
    }
    return true;
}

int main(){
    while(~scanf("%d", &n)){
        for(int i = 1; i <= n; i++)
            scanf("%lf%lf", &p[i].x, &p[i].y);
        p[0].x = p[n].x; p[0].y = p[n].y;
        p[n+1].x = p[1].x; p[n+1].y = p[1].y;
        if(convex_hull())
            printf("1\n");
        else
            printf("0\n");
    }
    return 0;
}



Measured memory_bytes: 3216
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a=0,b,c,d,e=0,f;
  cin >>a>>b>>c>>d;
  cout <<min(a,b)+min(c,d)<<'\n';
}


Measured memory_bytes: 256
// 
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int x;
    cin>>x;
    vector<int> a={0};
    a.e_b(599);
    a.e_b(799);
    a.e_b(999);
    a.e_b(1199);
    a.e_b(1399);
    a.e_b(1599);
    a.e_b(1799);
    a.e_b(1999);
    for(int i=1;i<=8;i++){
        if(x<=a[i]){
            cout<<9-i<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define rep(i, a, n) for(int i=a; i<n; ++i)
#define all(c) c.begin(), c.end()

int main() {
  cin.tie(0), ios::sync_with_stdio(false);
  int x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector<int> p(a), q(b);
  for (int &t : p) cin >> t;
  for (int &t : q) cin >> t;
  sort(all(p));
  sort(all(q));
  
  vector<int> apple(c + x + y);
  rep(i, 0, c) cin >> apple[i];
  rep(i, a-x, a) apple[c + i - a + x] = p[i];
  rep(i, b-y, b) apple[c + x + i - b + y] = q[i];
  sort(all(apple));
  ll ans = 0;
  rep(i, c, apple.size()) ans += apple[i];
  cout << ans << endl;
}

Measured memory_bytes: 2176
#include<stdio.h>
#include<string.h>

int main() {
	long long int a, b, c, k,ans=0;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
	if (k < a) {
		ans = k;
	}
	else {
		if (k <= a + b) {
			ans = a;
		}
		else {
			ans = a - (k - a - b);
		}
	}
	printf("%lld", ans);
}

Measured memory_bytes: 2152
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int X=sc.nextInt();
		int A=sc.nextInt();
		
		if(X<A) {
			System.out.println(0);
		}else {
			System.out.println(10);
		}
		
		
	}
}

Measured memory_bytes: 21716
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int w = sc1.nextInt();
		int h = sc1.nextInt();
		int x = sc1.nextInt();
		int y = sc1.nextInt();
		int r = sc1.nextInt();
		boolean flg = true;

		//横チェック
		if ( x - r < 0 | x + r > w) {
			flg = false;
		}

		//縦チェック
		if ( y - r < 0 | y + r > h) {
			flg = false;
		}

		if(flg) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

		sc1.close();

	}

}


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

using namespace std;
typedef long long ll;

int main(){
    
    ios_base::sync_with_stdio(0);
    double r;
    cin>>r;
    double pi = 3.141592653589;
    cout<<fixed<<setprecision(6)<<pi*r*r<<" "<<fixed<<setprecision(6)<<2*pi*r<<endl;

    return 0;
}




Measured memory_bytes: 3280
getSubString :: Int -> String -> [String] -> [String]
getSubString a b c
 | a > (length b) = c
 | otherwise      = getSubString a (tail b) ((take a b):c)

getDiffNum :: Int -> String -> String -> Int
getDiffNum a b c
 | b == []              = a
 | (head b) /= (head c) = getDiffNum (a + 1) (tail b) (tail c) 
 | otherwise            = getDiffNum a (tail b) (tail c) 

main = do
 s <- getLine
 t <- getLine
 print $ minimum $ map (getDiffNum 0 t) $ getSubString (length t) s []

Measured memory_bytes: 6724
#include <iostream>
#include <vector>
#include <algorithm>
#include <limits.h>

using namespace std;
int main()
{
	long long X, Y, Z, K;
	cin >> X >> Y >> Z >> K;
	vector<long long> A(X, 0);
	vector<long long> B(Y, 0);
	vector<long long> C(Z, 0);

	for(int i = 0; i < X; i += 1) cin >> A[i];
	for(int i = 0; i < Y; i += 1) cin >> B[i];
	for(int i = 0; i < Z; i += 1) cin >> C[i];

	sort(A.begin(), A.end(), greater<long long>());
	sort(B.begin(), B.end(), greater<long long>());
	sort(C.begin(), C.end(), greater<long long>());

	K = min(K, X * Y * Z);
	vector<long long> res;

	for(int i = 0; i < X; i += 1)
	{
		for(int j = 0; j < Y; j += 1)
		{
			for(int k = 0; k < Z; k += 1)
			{
				if((i + 1) * (j + 1) * (k + 1) <= K)
					res.emplace_back(A[i] + B[j] + C[k]);	
				else
					break;
			}
		}
	}
	sort(res.begin(), res.end(), greater<long long>());
	for(int i = 0; i < K; i += 1)
	{
		cout << res[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1532
#include <cstdio>
#include <cstring>

using namespace std;

char s[19];

int main() {
  scanf("%s", s);
  int n = (int)strlen(s);
  if (n % 2 == 1) {
    puts("No");
  } else {
    bool ans = true;
    for (int i = 0; i < n; i += 2) {
      if (s[i] != 'h' || s[i + 1] != 'i') {
        ans = false;
      }
    }
    puts(ans ? "Yes" : "No");
  }
}


Measured memory_bytes: 128
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
ful=0
for i in range(n):
  tempa=A[i]-1
  ful+=B[tempa]
  if A[i]-A[i-1]==1 and i>0:
    tempb=A[i-1]-1
    ful+=C[tempb]
print(ful)

Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long n,a,b;
  cin >> n >> a >> b;
  if ((b-a)%2==0){
    cout<<(b-a)/2<<endl;
  }else{
    cout << min(a+(b-a-1)/2,n-b+1+(b-1-a)/2) << endl;
  }
}

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

using namespace std;

int n, L[111], F[55][111][111], Lf[111], Ri[111], t = 0;

void add(int &x, int y) {
	x = (x + y) % P;
}

int main() {
	scanf("%d", &n);
	for(int i = 1; i < 2 * n; i++) scanf("%d", &L[i]);
	sort(L + 1, L + 2 * n);
	int l, r;
	for(int i = 1; i <= 2 * n; i++)
		if(L[i] != L[i - 1]) {
			Ri[t] = i - 1;
			Lf[++t] = i;
		}
	for(int i = 1; i <= t; i++)
		if(Lf[i] <= n && Ri[i] >= n) {
			l = (r = i);
			break;
		}
	F[0][1][1] = 1;
	for(int i = 0; i < n - 1; i++) {
		int tmpl = 0, tmpr = 0;
		if(Lf[l] >= n - i) l--, tmpl = 1;
		if(Ri[r] <= n + i) r++, tmpr = 1;
		for(int j = 1; j <= t; j++)
			for(int k = 1; k <= t; k++) {
				int v = F[i][j][k];
				add(F[i + 1][j + tmpl + tmpr][k + tmpl], v);
				for(int s = k + tmpl - 1; s >= 1; s--)
					add(F[i + 1][j + tmpl + tmpr - (k + tmpl - s - 1)][s], v);
				for(int s = k + tmpl + 1; s <= j + tmpl + tmpr; s++)
					add(F[i + 1][j + tmpl + tmpr - (s - (k + tmpl + 1))][k + tmpl + 1], v);
			}
	}
	int ans = 0;
	for(int i = 1; i <= t; i++)
		for(int j = 1; j <= t; j++)
			add(ans, F[n - 1][i][j]);
	printf("%d\n", (ans % P + P) % P);
	return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
static const long long INF = INT64_MAX;
static const long long MOD = (ll)1e9+7;

#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i, n) for(ll i=0;i<n;i++)
#define SZ(v) (ll)((v).size())
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).begin(), (v).end())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

void solve() {
    map<ll, ll> mp;
    ll N;
    cin >> N;
    vll a(N);
    for(auto &x:a) cin >> x;
    REP(i, N) {
        mp[a[i]]++;
    }
    ll ans = 0;
    for(auto &p:mp) {
        ll i, x;
        tie(i, x) = p;
        ans += (i > x ? x : x - i); 
    }
    out(ans);
}

int main() {
    fast_io;
    solve();
    return 0;
}


Measured memory_bytes: 7040
#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	a, b, c;
	cin >> a >> b >> c;
	cout << min({a, b, c}) << ' ' << max({a, b, c}) << endl;
}



Measured memory_bytes: 3088
package main

import (
	"fmt"
	"strconv"
)

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

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

func main() {
	var S string
	fmt.Scan(&S)
	ans := 10000
	for i := 0; i+2 < len(S); i++ {
		n, _ := strconv.Atoi(S[i : i+3])
		ans = min(ans, abs(753-n))
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def bs(f, mi, ma):
    mm = -1
    while ma > mi:
        mm = (ma+mi) // 2
        if f(mm):
            mi = mm + 1
        else:
            ma = mm
    if f(mm):
        return mm + 1
    return mm

def main():
    n,m = LI()
    a = sorted(LI(), reverse=True)
    t = a[0]
    r = [0] * (t*2+1)
    u = [0] * (t*2+1)
    for c in a:
        r[c] += 1
        u[c] += c

    for i in range(t-1,-1,-1):
        r[i] += r[i+1]
        u[i] += u[i+1]

    def f(i):
        t = 0
        for c in a:
            if c >= i:
                t += n
            else:
                t += r[i-c]
        return t >= m

    i1 = bs(f,0,t*2+1) - 1

    rr = 0
    k = 0
    for c in a:
        ci = max(i1-c,0)
        ac = r[ci]
        if ac == 0:
            continue
        rr += u[ci]
        rr += c * ac
        k += ac

    rr -= (k-m) * i1

    return rr


print(main())




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

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    if(n % 2){
        int i = n / 2;
        int low = a[i], high = b[i];
        cout << high - low + 1 << endl;
    }
    else{
        int i1 = n / 2 - 1, i2 = n / 2;
        int low = a[i1] + a[i2], high = b[i1] + b[i2];
        cout << high - low + 1 << endl;
    }
}

Measured memory_bytes: 4840
#include<stdio.h>
int main(){
    int n,x,l,b,a=0;
    scanf("%d %d",&n,&x);
    b=n+1;
    for(int i=0;i<n;i++){
        scanf("%d",&l);
        a+=l;
        if(a>x){
            b=i+1;
            break;
        }
    }
    printf("%d\n",b);
    return 0;
}


Measured memory_bytes: 128
N = input()
hN = str(N)[0:1]
dN = str(N)[1:2]
mN = str(N)[2:3]
#print(str(N)+hN+dN+mN)

bool = 0

if hN == '7':
    bool = bool + 1
elif dN == '7':
    bool = bool + 1
elif mN == '7':
    bool = bool + 1

if bool == 1:
    print('Yes')
elif bool == 0:
    print('No')

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

using namespace std;
typedef long long ll;
#define DBG(v) cerr << #v << " = " << (v) << endl;

int f(const vector<int> &v, const int i, const int n) {
    int l = 0, r =n + 1;
    auto it = lower_bound(v.begin(), v.end(), i);
    if(it != v.end())
        r=*it;
    if(it != v.begin())
        l = *prev(it);

    return r==i?0:r-l-1;

}
const int MxN = 2009;
char grid[MxN + 9][MxN + 9];
vector<int> rows[MxN + 9];
vector<int> cols[MxN + 9];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        string s;
        cin >> s;
        for (int j = 1; j <= m; ++j)
            if (s[j-1] == '#') {
                rows[i].push_back(j);
                cols[j].push_back(i);
            }
    }

    int ans = 0;
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j) {
            ans = max(ans, f(rows[i], j, m) + f(cols[j], i, n) - 1);
        }

    cout << ans;


    return 0;
}

Measured memory_bytes: 34432
#include <bits/stdc++.h>
#define fi first
#define se second
#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 srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

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






















Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define ll long long
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define abs(a,b) (a-b>0?a-b:b-a)

int main(){
    ll n;
    cin >> n;
    ll i=1,min=INT_MAX;
    while(i<=n/i){
        if(n%i==0){
            string a=to_string(i),b=to_string(n/i);
            ll sum=(a.size()>b.size()?a.size():b.size());
            min = (sum<min?sum:min);
        }
        i++;
    }
    cout << min << endl;

    return 0;
}


Measured memory_bytes: 256
MAX_N = 100000


def main():
    N, *B = map(int, open(0).read().split())
    B.insert(0, MAX_N)
    B.insert(N, MAX_N)
    print(sum(min(B[i - 1], B[i]) for i in range(1, N + 1)))
    return


main()


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

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(auto& i : a) cin >> i;
    multiset<ll, greater<ll>> s;
    for(auto& i : a){
        auto p = s.upper_bound(i);
        if(p != s.end()) s.erase(p);
        s.insert(i);
    }
    cout << s.size() << endl;
}


Measured memory_bytes: 5760
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int MOD = 1e9 + 7;
int f[2][5050];
int n , l;
string s;

int main(){
	cin >> n >> s;
	l = s.size();
	f[0][0] = 1;
	for(int i = 1 ; i <= n ; ++ i){
		memset(f[i & 1] , 0 , sizeof f[i & 1]);
		int last = 1 - (i & 1);
		for(int j = 1 ; j <= i ; ++ j){
			f[i & 1][j] = (f[i & 1][j] + 2ll * f[last][j - 1]) % MOD;
			f[i & 1][j] = (f[i & 1][j] + f[last][j + 1]) % MOD;
		}
		f[i & 1][0] = (f[last][1] + f[last][0]) % MOD;
	}
	int ans = f[n & 1][l];
	for(int i = 1 ; i <= l ; ++ i)
		ans = 1ll * ans * 500000004 % MOD;
	cout << ans << endl;
	return 0;
}

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

int main() {
	int A, B, C, D;

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

	if ((A*B) >= (C*D)) {
		cout << A*B << endl;
	}
	else {
		cout << C*D << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <cstring>

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using PP = pair<ll, pair<ll,ll>>;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define MOD 1000000007
//           123456789

ll s;
ll dp[2001];
int main() {
    cin >> s;
    rep(i,2) dp[i] = 0;
    for (ll i = 3; i < 2001; i++){
        dp[i] = 1;
        for (ll j = i-3; j > 2; j--){
            dp[i] += dp[j]%MOD;
            dp[i] %= MOD;
        }
    }
    cout << dp[s] << endl;
    return 0;
}

Measured memory_bytes: 3640
if __name__ == "__main__":
    a, b, m = map(int, input().split())

    refrigerator = list(map(int, input().split()))
    microwave = list(map(int, input().split()))
    tickets = list()
    for i in range(m):
        tickets.append(list(map(int, input().split())))

    ans = min(refrigerator) + min(microwave)

    for i in range(m):
        t = tickets[i]
        tmp = refrigerator[t[0]-1] + microwave[t[1]-1] - t[2]
        if tmp < ans:
            ans = tmp

    print(ans)


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

int main() {
  string s;
  cin >> s;
  int count = 0;

  if (s[0] == '1') count++;
  if (s[1] == '1') count++;
  if (s[2] == '1') count++;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define inf 1000000000000000000
#define ff first
#define ss second
void checkpoint1()
{
	/******think more code less******/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}
bool comp(pair< ll,ll > &a,pair< ll,ll > &b)
{
	if(a.ff!=b.ff)
		return a.ff<b.ff;
	else
	{
		if(a.ss>b.ss)
			return b.ss<a.ss;
		else if(a.ss<b.ss)
			return a.ss<b.ss;
	}
	return a.ff>b.ff;
}
int main()
{
	checkpoint1();
	ll n;
	cin>>n;
	if(n>=30)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e15;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
 
void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const ll MAXN = 1e6 + 10;
const ll N = 4000 + 10;
const int mod = 1e6;

ll a[N][N];
ll dp[N][N];

int main()
{
	faster();
	int n;
	cin >> n;
	for (int i = 0; i < 2; i++)
	{
		for (int j = 0; j < n; j++)
		{
			cin >> a[i][j];
		}
	}
	dp[0][0] = a[0][0];
	for (int i = 0; i < 2; i++)
	{
		for (int j = 0; j < n; j++)
		{
			dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]) + a[i][j];
		}
	}
	cout << dp[2][n] << endl;
}

Measured memory_bytes: 2304
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> ds(n); cin >> ds;
    sort(ds.begin(), ds.end());
    cout << ds[n / 2] - ds[n / 2 - 1] << '\n';
}


Measured memory_bytes: 640
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var n=Arr.shift()-0;
   if(n==0)break;
   var M=[];
   for(var i=0;i<n;i++){
      var m=(Arr.shift()).split(" ").map(Number);
      m.shift();
      M.push(m);
   }
   var K=(Arr.shift()).split(" ").map(Number);
   K.shift();
   var arr=[];
   M.forEach(function(m,i){
     var flag=K.every(function(k){return m.indexOf(k)!=-1;});
      if(flag)arr.push(i);
   });
   console.log((arr.length==1)?arr[0]+1:-1);
}

Measured memory_bytes: 13336
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> d(N);
	for (int i = 0; i < N; i++)
		cin >> d.at(i);

	int ans = N;
	sort(d.begin(), d.end());
	for (int i = 0; i < N - 1; i++)
		if (d.at(i) == d.at(i + 1))
			ans--;
	cout << ans << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

const int nax = 2e5+10;
const ll INF =1e18+10;
struct S
{
    ll small,lazy;

    void merge(const S& a,const S& b)
    {
        small=min(a.small,b.small);
    }

    void add (ll x)
    {
        small+=x;
        lazy+=x;
    }
};
vector <S> tree;

void rec(int id,int low, int high,int q_low,int q_high,int type,ll& x)
{
    if (high < q_low || low > q_high)
        return;

    if (high<=q_high && low>=q_low)
    {
        if (type==1)
            tree[id].add(x);
        if (type==2)
            x = min (x,tree[id].small);
        return;
    }

    for (int b: {2 * id,2*id + 1} )
        tree[b].add(tree[id].lazy);
    tree[id].lazy=0;

    int mid = (low+high)/2;
    rec(2 * id,low,mid,q_low,q_high,type,x);
    rec(2 * id + 1,mid + 1,high,q_low,q_high,type,x);

    tree[id].merge(tree[2*id],tree[2*id+1]);
}

vector <pair< int,int> > intervals[nax];
int main()
{
   // freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);

    int n,m;
    cin >> n >> m;;

    long long sum=0;
    for (int i=0;i<m;i++)
    {
        int a,b,x;
        cin >> a >> b >> x;
        intervals[b].emplace_back(a,x);
        sum+=x;
    }

    int base = 1;
    while (base<=n+1)
        base*=2;

    tree.resize(2 * base,{INF,0});

    ll whatever = 0-INF;
    rec(1,0,base-1,0,0,1,whatever);

    ll ans=0;
    for (int i=1;i<=n+1;i++)
    {
        for (pair <int,int> p:intervals[i-1])
        {
            whatever=p.second;
            rec(1,0,base-1,0,p.first-1,1,whatever);
        }

        ll best=INF;
        rec(1,0,base-1,0,base-1,2,best);

        if (i==n+1)
            ans=best;

        whatever=best-INF;
        rec(1,0,base-1,i,i,1,whatever);
    }

    cout << sum-ans;
}



Measured memory_bytes: 19456
#include <bits/stdc++.h>
using namespace std;
struct P
{
    //string r;
    int x,y,z;

    bool operator<(const P &a)const{
       // if(y!=a.y)
       // return y>a.y;
       return x>a.x;
//        return z>a.z;
    }
};

vector<int> v;
//bitset<4001000> b;
int a,c,i,b,k,d,n,m,e;//dy[15]={0,1,0,-1,-1,1,-1,1},dx[15]={1,0,-1,0,1,1,-1,-1};//
int l[310100];
int o[311100];
int dx[10]={0,1,0,-1},dy[10]={1,0,-1,0},dz[10]={0,0,0,0,1,-1};

long long x,y,z,mod=1000000007;
P u[1111222];
int j[1111][5552];

stack<int> s;
queue<P> q;
queue<int> q1;
bool qw[3333];
deque<int> de;
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
map<int,int > p,p1;
//list<int> l;
string r,r1,r2,r3,r4,r5;
//char r[333][333];

bool as(int a,int b)
{
    return a>b;
}

//queue<P> q;

int main()
{
    scanf("%d",&a);
    for(int t=1;t<=a;t++)
    {
        scanf("%d %d %d",&i,&c,&d);
        if(i-e>=max(n-c,c-n)+max(d-m,m-d)&&(max(n-c,c-n)+max(d-m,m-d))%2==(i-e)%2)
            goto asd;
        puts("No");
        return 0;
        asd:;
        n=c;
        m=d;
        e=i;
    }
    puts("Yes");
}


Measured memory_bytes: 256
from itertools import permutations

N, M = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    G[a].append(b)
    G[b].append(a)

res = 0
for P in permutations(range(N), N):
    if P[0] != 0:
        continue
    for i in range(N - 1):
        if P[i + 1] not in G[P[i]]:
            break
    else:
        res += 1

print(res)

Measured memory_bytes: 73584
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    while(true){
        int y=0,n;
        int a[31]={0};
        cin>>n;
        if(n==0) break;
        a[1]=1;
        a[2]=2;
        a[3]=4;
        for(int i=4; i<31; i++){
            a[i]=a[i-1]+a[i-2]+a[i-3];
        }
        y=(a[n]/10)/365+1;
        cout<<y<<endl;
    }
}



Measured memory_bytes: 3056
import java.util.*;
public class Main{
    public static void main(String[]args){
	Scanner sc = new Scanner(System.in);
	int n= sc.nextInt();
	int l=sc.nextInt();
	ArrayList<String> stateList = new ArrayList<String>();
	for(int i=0; i<n; i++){
	    stateList.add(sc.next());
	}
	Collections.sort(stateList);
	for(int i=0;i<n; i++){
	    System.out.print(stateList.get(i));
	}
    }
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
 
/*** Template Begins ***/
 
typedef unsigned long long    ll;
typedef pair<ll,ll>  pll;
typedef pair<ll, pair<int, int> > plll;
typedef vector<long long>  vll;
typedef vector<pll>  vp;
typedef long double ld;
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
// #define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007
// #define h 998244353
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p)
{
  ll res = 1;
  x = x % p;
  while (y > 0)
  { 
    if (y & 1) 
      res = (res*x) % p;
    y = y>>1;
    x = (x*x) % p;
  } 
  return res; 
} 
const int MAXN = 2e5+5;

// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
// #define trace6(a, n,i;b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

// Constants //
 
/*** Template Ends ***/

void solve()
{
  ll flag=1;
  ll n,i;
  cin>>n;
  set<ll> s;
  ll num;
  for(i=0;i<n;i++)
  {
    cin>>num;
    if(s.find(num)!=s.end())
      flag=0;
    else
      s.insert(num);
  }
  if(flag)
    cout<<"YES";
  else
    cout<<"NO";
}
int main()
{ 
  // ios;
  // fxreopen("inputt.txt", "w", stdout);
  ll t;
  // cin >> t;
  t=1;
  while(t--)
    solve();
  return 0;
}

Measured memory_bytes: 9600
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
//#include <unordered_map>
//#include <string>
//typedef long long LL;
//typedef long double LD;
using namespace std;

int main() {
    int m1;
    int d1;
    int m2;
    int d2;

    cin >> m1 >> d1;
    cin >> m2 >> d2;
    if(m1!=m2 && d2==1){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
}

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

template<typename NodeIdx,typename Cost>
bool bellman_ford(vector<tuple<NodeIdx,NodeIdx,Cost>> &graph, vector<Cost> &d,  NodeIdx start_idx){
    using Edge = tuple<NodeIdx,NodeIdx,Cost> ;
    const Cost INF = numeric_limits<Cost>::max();

    d[start_idx] = 0;
    for (int i=0;i<d.size();i++){
        for (const Edge &e : graph){
            if (d[get<0>(e)] != INF && d[get<1>(e)] > d[get<0>(e)] + get<2>(e) ){
                d[get<1>(e)] = d[get<0>(e)] + get<2>(e);
                if (i == d.size()-1) return true;
            }
        }
        
    }
    return false;
    
}


int main(){
    ll V,E,r ;
    cin >> V>> E >> r;
    vector<tuple<ll,ll,ll>> graph;
    for (ll i=0;i<E;i++){
        ll v1,v2,c;
        cin >> v1 >> v2 >> c;
        graph.push_back(make_tuple(v1,v2,c));
    }
    const ll INF = numeric_limits<ll>::max();

    vector<ll> d(V,INF);
    bool ret = bellman_ford<ll,ll>(graph,d,r);
    if (ret){
        printf("NEGATIVE CYCLE\n");
    }else{
        for (const auto &c:d){
            if (c == numeric_limits<ll>::max()) printf("INF\n");
            else printf("%lld\n",c);
        }
    }
    

}


Measured memory_bytes: 3312
#include<bits/stdc++.h>
    #define ll long long
    #define db double
    #define mod 1000000007
    #define pb push_back
    #define pp pair<ll,ll>
    #define rep(i,a,b) for(ll i=a;i<b;i++)
    #define repe(i,a,b) for(ll i=a;i<=b;i++)
    #define repr(i,a,b) for(ll i=b;i>=a;i--)
    #define maxn 200005
    #define ss second
    #define ff first
    #define lb lower_bound
    using namespace std;
    ll n;
    vector<ll> adj[maxn];
    vector<ll> sol;
    ll ans[maxn],temp[maxn];
    map<ll,pp> mp;
    void search(ll val)
    {
        ll x = temp[val];
        ll start=0,end=sol.size()-1,ind=0;
        while(start <= end)
        {
            ll mid=(start+end)/2;
            if(sol[mid] < x)
            {
                ind = mid+1;
                start = mid+1;
            }
            else end =mid-1;
        }
        if(ind == sol.size())
        {
            sol.pb(x);
            mp[val]={ind,-1};
        } 
        else{
            mp[val]={ind,sol[ind]};
            sol[ind]=x;
        }  
        ans[val]=sol.size();
    }
    void dfs(ll curr,ll par)
    {
        search(curr);
        for(auto x:adj[curr])
        {
            if(x!=par)
            dfs(x,curr);
        }
        if(mp[curr].ss == -1)
            sol.pop_back();
        else
            sol[mp[curr].ff] = mp[curr].ss;
    }
    void solve()
    {
        cin >> n;
        for(ll i=1;i<=n;i++)
        cin >> temp[i];
        for(ll i=0;i<n-1;i++)
        {
            ll x,y;
            cin >> x >> y;
            adj[x].pb(y);
            adj[y].pb(x);
        }
        dfs(1,-1);   
        for(ll i=1;i<=n;i++)
        cout << ans[i] <<"\n";
    }
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        ll t=1;
        //cin >> t;
        while(t--)
        solve();
        return 0;
    }

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

int main(){
  int N,M;
  cin >> N;
  vector<string> s(N);
  for(int i=0;i<N;++i) cin >> s.at(i);
  cin >> M;
  vector<string> t(M);
  for(int i=0;i<M;++i) cin >> t.at(i);
  int ans=0;
  for(int i=0;i<N;++i){
    int count=1;
    for(int j=i+1;j<N;++j){
      if(s.at(i)==s.at(j)) count++;
    }
    for(int j=0;j<M;++j){
      if(s.at(i)==t.at(j)) count--;
    }
    ans=max(ans,count);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
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;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    ll n;
    cin>>n;
    ll k;
    cin>>k;
    vi a(n);
    rep(i,0,n)cin>>a[i],a[i]--;
    vi visit;
    vi check(n,-1);
    ll bound=0;
    ll cnt=0;
    while(check[bound]==-1){
        visit.push_back(bound+1);
        check[bound]=cnt++;
        bound=a[bound];
    }
    ll epi=check[bound];
    if(k<visit.size())cout<<visit[k]<<endl;
    else{
        k-=epi;
        ll loop=visit.size()-epi;
        k%=loop;
        cout<<visit[k+epi]<<endl;
    }
    return 0;
}




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

using namespace std;

int dirs[4][2]={{-1, 0}, {0, 1}, {1, 0}, {0, -1}};

vector<long long> v;
int main()
{
    //freopen("inp.in", "r", stdin);
    //freopen("outp.out", "w", stdout);
    //ios::sync_with_stdio(false);
    int n;
    scanf("%d", &n);
    v.assign(n, -1);
    for(int i=0; i<n; i++) scanf("%lld", &v[i]);
    long long ans=0;
    vector<long long> op(n, 0);
    long long h=v[n-1];
    if(v[n-1]!=0) ans=1;
    for(int i=n-2; i>=0; i--)
    {
        if(v[i]!=0) ans++;
        if(h>0) h=h-1;
        if(v[i]>h) ans+=h;
        h=max(h, v[i]);
        if(v[i+1]>v[i]+1)
        {
            printf("-1\n");
            return 0;
        }
        else if(v[i+1]==v[i]+1 && v[i]!=0)
        {
            op[i]=op[i+1]+1;
        }
    }
    if(h != 0)
    {
        printf("-1\n");
        return 0;
    }
    /*
    for(int i=0; i<n; i++)
    {
        ans+=v[i];
        ans-=op[i];
    }*/
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
 
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define int long long int
#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define pow10(n) stoll("1"+string(n,'0'))
//fill(all(arr),1)
//if(map.count(key)){}
//bitset<20>(n);
//int mini=min({a,b,c,d,e});
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

int32_t main(){
	FIO
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(s.size()<=k)cout<<s;
	else
	{
		forn(i,k)
		{
			cout<<s[i];
		}
		cout<<"...";
	}

	
	return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>

int main(void)
{
	int a,b,N, M, sum = 0;
	long long int h[100001];
	int w[100001] = {0};
	scanf("%d %d", &N, &M);

	for (int i = 1;i<=N;i++) {
		scanf("%lld",&h[i]);
	}
	for (int i = 0;i < M;i++) {
		scanf("%d %d",&a,&b);
		if (h[a] <= h[b])
			w[a]++;
		if(h[a]>=h[b])
			w[b]++;
	}


	for (int i = 1;i <= N;i++) {
		if (w[i] == 0)sum++;
	}

	printf("%d", sum);

	return 0;
}

Measured memory_bytes: 2856
#include <iostream>
using namespace std;
int main(void){
    string s,t;
    cin >> s;
    cin >> t;
    
    s += s;
    for(int i = 0;i < t.size();i++){
          if(s.substr(i,t.size()) == t){
                cout << "Yes" << endl;
                return 0;
          }
    }
    cout << "No" << endl;
}


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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

int main(void){
    int n;
    cin >> n;
    int c = 0;
    for(int i = 1; i <= n; i++){
        int j = n-i;
        if(i >= j) break;
        else c++;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 256
"""
python3 main.py < input.txt
"""
import math
import itertools as it
import heapq
"""
A,B,T=map(int, input().split())
print(int(math.floor((T+0.5)/(A))*B))
"""

N=int(input())
V=list(map(int, input().split()))
C=list(map(int, input().split()))
print(sum([V[i] - C[i] for i in range(N) if V[i] - C[i] > 0]))

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>

int kou(int n){
	if(n%2){
		return 3*n+1;
	}else{
		return n/2;
	}
}

int check(int nkou,int suretu[]){
	int loop;
	for(loop=0;loop<nkou;loop++){
		if(suretu[loop]==suretu[nkou]){
			return 1;
		}
	}
	return 0;
}

int main(void) {
	int nkou=0,suretu[300];
	scanf("%d",&suretu[nkou++]);

	while(1){
		suretu[nkou]=kou(suretu[nkou-1]);
		if(check(nkou++,suretu)){
			break;
		}
	}
	printf("%d",nkou);
	return 0;
}

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

using namespace std;

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

    string s;
    cin >> s;

    if(s == "ABC")
        cout << "ARC";
    else
        cout << "ABC";

    return 0;
}


Measured memory_bytes: 3668
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let sec: u32 = s.trim().parse().unwrap();

    let hour: u32 = sec / 3600;
    let minutes: u32 = sec % 3600 / 60;
    let seconds: u32 = sec % 3600 % 60;

    println!("{}:{}:{}", hour, minutes, seconds);
}



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

int main() {
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << endl;

    return 0;
}

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

#define testcases ll t;cin>>t;while(t--)
#define queries ll q;cin>>q;while(q--)
#define ll long long 
#define loop(i,x,n) for(ll i=x;i<n;i++)
#define ff first
#define ss second
#define elif else if
#define flush cout<<endl;
#define pb push_back;
#define mod 1000000007




int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//testcases{
		long long int n,x,y,z,k,p,q,r,ct=0,sum=0,e=0;;
		cin>>n>>x;
		if(n>=1&&n<=9&&x<=9&&x>=1)
			cout<<n*x;
		else
			cout<<-1;
		flush;
				
	//}
	
}

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


# 整数の入力
n = int(input())
# スペース区切りの整数の入力
zzz = list(map(int, input().split()))
b=sum(zzz)**2
a=0
for i in range(n):
  # print(i)
  x=zzz[i]**2
  # print(x)
  a +=x
# print(b)
# for a in zzz:
#   print(a)

# print(b)
# print(a)

ans = (b-a)//2%(10**9+7)
print(ans)


Measured memory_bytes: 31388
import java.io.*;

class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str = br.readLine();
		String strArr[] = str.split(" ");

		int a, b, c;

		a = Integer.parseInt(strArr[0]);
		b = Integer.parseInt(strArr[1]);
		c = Integer.parseInt(strArr[2]);

		if(a<b && b<c){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 17084
#include<bits/stdc++.h>
using namespace std;
inline int Get() {int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}while('0'<=ch&&ch<='9') {x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}return x*f;}

const int N=1e5+1000;
int n;
struct Node{
	int sum,Id;
	bool operator <(const Node &a)const {
		return sum>a.sum;
	}
}ou[N],ji[N];
int main(){
	n=Get();
	for(int i=1;i<=n;++i){
		int x;
		x=Get();
		if(i&1){
			ji[x].sum++;
			ji[x].Id=x;
		}
		else{
			ou[x].sum++;
			ou[x].Id=x;
		}
	}	
	sort(ji+1,ji+1+100000);
	sort(ou+1,ou+1+100000);
	if(ji[1].Id!=ou[1].Id){
		cout<<n-ji[1].sum-ou[1].sum;
	}
	else{
		cout<<min(n-ji[1].sum-ou[2].sum,n-ji[2].sum-ou[1].sum);
	}
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define NIL -1
using namespace std;

int count(const string& X, int i, const string Y, int j,
          vector<vector<int> >& MEMO){
    if (i >= X.size() || j >= Y.size()) return 0;
    if (MEMO[i][j] != NIL) return MEMO[i][j];
    int j_tmp = j;
    int saiyou = 0;
    while (j_tmp < Y.size()) {
        if (X[i] == Y[j_tmp]) {
            saiyou = count(X, i + 1, Y, j_tmp + 1, MEMO) + 1;
            break;
        };
        j_tmp++;
    }
    int next_X = count(X, i + 1, Y, j    , MEMO);
    // int next_Y = count(X, i    , Y, j + 1, MEMO);
    return MEMO[i][j] = max(saiyou, next_X);
}

int main(){
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        string X, Y;
        cin >> X >> Y;
        vector<vector<int> > MEMO(X.size(), vector<int>(Y.size(), NIL));
        cout << count(X, 0, Y, 0, MEMO) << endl;
    }
    return 0;
}

Measured memory_bytes: 7032
#include <iostream>
#include <string>
using namespace std;
 
int main(){
    int a;
    int b;
    cin >> a >> b;
    if (a>b){
        for (int i=0;i<a;i++){
            cout << b;
        }
        cout << endl;
    }else{
        for (int i=0;i<b;i++){
            cout << a;
        }
        cout << endl;
    }
}

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

int main() {
  int n;
  cin >> n;
  std::vector<int> p(n), q(n);
  rep(i,n) cin >> p.at(i);
  rep(i,n) cin >> q.at(i);
  std::vector<int> a(n);
  // n以下の数で順列を作るため
  rep(i,n) a.at(i) = i+1;

  map<std::vector<int>, int> mp;
  // 自動で辞書順になるためsize()=何番目を表せる
  do {
    mp[a] = mp.size();
  } while (next_permutation(a.begin(), a.end()));

  int ans = abs(mp[p] - mp[q]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 8624
import bisect
N=int(input())
s=[list(sorted(map(int,input().split()))) for i in range(3)]
t=[]
q=0
for i in s[1]:
    t.append(N-bisect.bisect_right(s[2],i))
for i in range(N):
    q+=bisect.bisect_left(s[0],s[1][i])*t[i]
print(q)

Measured memory_bytes: 23244
N = int(input())
S = input()
ans = 0
for i in range(100):
    n = str(i).zfill(2)
    f = [False]*10
    ff = False
    fs = False
    for s in S:
        if ff:
            if fs:
                if not f[int(s)]:
                    ans += 1
                    f[int(s)] = True
            elif n[1] == s:
                fs = True
        elif n[0] == s:
            ff = True
print(ans)


Measured memory_bytes: 41580