akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
#include <iomanip>
//#include <windows.h>  //Should be deleted when using AtCoder&POJ
using namespace std;

#define ll long long
#define pii pair<int,int>
#define qi ios::sync_with_stdio(0)
/**==Info==
*Program:6
*Problem:guruguru
*Date:2019-5-11
*Algorithm:MK's sweep line
*Stats:Unknown*/

bool debug=false;

struct line{
	int st;
	int ed;
	int len;
};

line line[100005];

int n,k;
int a[100005];
int main(int argc,char* argv[]){
	qi;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
		a[i]--;
	}
	
	ll nw=0,pre=0;
	for(int i=0;i<n-1;i++){
		int grass=a[i],hopper=a[i+1];
		if(hopper<grass){
			hopper+=k;
		}
		
		nw+=hopper-grass;
		if(hopper-grass<=1){
			continue;
		}
		
		grass+=2;
		
		if(grass>=k && hopper>=k){
			grass-=k;
			hopper-=k;
		}else{
			if(grass<k && hopper>=k){
				hopper-=k;
				line[0].st++;
				line[grass].st++;
				line[hopper].len+=hopper+k-grass+1;
				line[hopper].ed++;
				pre+=k-grass;
				continue;
			}
		}
		
		
		line[grass].st++;
		line[hopper].ed++;
		line[hopper].len+=hopper-grass+1;
	}
	
	ll ans=nw;
	ll inr=0;
	ll sex=nw;
	sex-=pre;
	for(int i=0;i<=k;i++){
		inr+=line[i].st;
		sex-=inr;
		ans=min(ans,sex);
		inr-=line[i].ed;
		sex+=line[i].len;
	}
	
	cout<<ans;
	return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#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,k;
  cin >> n >> k;

  ll ans = 0;
  ll m = n/k;
  ans += m*m*m;
  if(k%2==0){
    m = n/(k/2) - m;
    ans += m*m*m;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long 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; }

//INT_MAX	2,147,483,647 = 2*1.0e9

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

  vector<int> V(N);
  for(int i = 0; i < N; i++) cin >> V[i];

  vector<int> C(N);
  for(int i = 0; i < N; i++) cin >> C[i];

  int ans = 0;
  for(int i = 0; i < N; i++){
    if(V[i]-C[i] > 0) ans += V[i]-C[i];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
N=input()
L=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print L[N-1]


Measured memory_bytes: 27884
#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
  int n;
  cin >> n;
  for(int i = n; ; i++)
  {
    bool ck = true;
    if( i != 2){
    for(int j = 2; j * j <= i; j++)
    {
       if(i % j == 0)
       {
        ck = false;
       break;
       }

    }
    }
    if(ck)
    {
      cout << i << '\n';
      return 0;
    }
  }
return 0;
}


Measured memory_bytes: 384
import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;

void main() {
	string[] input = split(readln());
	int n = to!int(input[0]);
	int m = to!int(input[1]);
	int r = to!int(input[2]);

	r -= n * m;
	if(r <= 0) {
		writeln(0);
	}
	else {
		BigInt ans = 1;
		for(int i = r + 1; i <= n + r - 1; ++i) {
			ans *= i;
		}
		
		for(int i = 2; i <= n - 1; ++i) {
			ans /= i;
		}
		
		writeln(ans);
	}
}

Measured memory_bytes: 3112
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main(){
	int A, B;
	string op;
	cin >> A >> op >> B;
	if(op == "+"){
		cout << A+B << "\n";
	}
	else{
		cout << A-B << "\n";
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string.h>
#define ll long long
using namespace std;
string cc;
int main(){
	cin>>cc;
	int ans=0;
	for(int i=0;i<4;++i){
		if(cc[i]=='+')ans++;
		else ans--;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
import collections
l = list(input())
c = collections.Counter(l)
A = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
count = 0
for i in A:
    if c[i] == 2:
        count += 1
    else:
        count += 0
if count == 2:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3316
#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() {
    string s, t;
    cin >> s >> t;

    int ans = 1e9;
    int ns = s.size();
    int ts = t.size();
    rep(i, ns-ts+1) {
        string sub = s.substr(i,ts);
        int count = 0;
        rep(j,ts) {
            if (sub.at(j) != t.at(j)) count++;
        }
        ans = min(ans, count);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
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: 23764
#include<iostream>
#define ll long long
int main(){
	ll n,d,x,y,ans=0;
  	std::cin>>n>>d;
  	d=d*d;
  	while(n--){
    	std::cin>>x>>y;
      	if(x*x + y*y <=d)ans++;
    }
  	std::cout<<ans;
  
}

Measured memory_bytes: 3572
N, M = map(int, input().split())
ansl = 1
ansr = N
for _ in range(M):
    L, R = map(int, input().split())
    ansl = max(ansl, L)
    ansr = min(ansr, R)
ans = max(ansr - ansl + 1, 0)
print(ans)

Measured memory_bytes: 3060
def p_c():
    from collections import defaultdict
    from bisect import bisect
    n, m = map(int, input().split())
    py = [tuple(map(int, input().split())) for _ in range(m)]
    d = defaultdict(list)
    for p, y in py:
        d[p].append(y)
    for key in d.keys():
        d[key].sort()
    for p, y in py:
        print("{:06}{:06}".format(p, bisect(d[p], y)))
        
p_c()

Measured memory_bytes: 81504
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main()
{
  string s;
  cin >> s;
  if (s[s.size() - 1] == 's')
  {
    cout << s + "es" << endl;
  }
  else
  {
    cout << s + 's' << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
import java.util.*;
//多角形が凸であるか否か
public class Main{
    public static double area(Point p1, Point p2){
    	return (p1.x*p2.y - p1.y*p2.x)/2.0;
    }
    public static double solve(Point[] p){
	    double ans = 0;
	    for(int i = 0 ; i < p.length-1 ; i++)
            ans += area(p[i],p[i+1]);
	    return ans + area(p[p.length-1],p[0]);
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Point[] p = new Point[n];
	    Point[] work = new Point[n-1];
	    for(int i = 0 ; i < n ; i++)
		    p[i] = new Point(sc.nextDouble(),sc.nextDouble());
	    double ans = solve(p);
	    for(int i = 0 ; i < n ; i++){
		    int cnt = 0;
		        for(int j = 0 ; j < n ; j++){
			        if(j == i)
				        continue;
			        else
				        work[cnt++] = p[j];
		        }
		    if(solve(work) > ans){
			     System.out.println(0);
			     break;
		    }
		    else if(i == n-1)
			     System.out.println(1);
	    }
    }
}
class Point{
    double x;
    double y;
    Point(double x, double y){
        this.x = x;
        this.y = y;
    }
}



Measured memory_bytes: 28816
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        long l = 1;

        for (int i = 0; i < N; i++) {

            long inputLong = sc.nextLong();

            if (1000000000000000000L / l < inputLong) {
                l = -1;
                while (sc.hasNext()) {
                    if (sc.nextLong() == 0) {
                        l = 0;
                        break;
                    }
                }
                break;
            }

            l *= inputLong;

        }

        System.out.println(l);
        sc.close();

    }
}


Measured memory_bytes: 59720
# coding: utf-8

str = input()
table = list(str)
count = 0
if len(str) % 2 == 0:
    for i in range(len(str)):
        if table[i] == table[(len(str)-1)-i]:
            continue
        else:
            count += 1
elif len(str) % 2 == 1:
    for i in range(len(str)):
        if table[i] == table[(len(str)-1)-i]:
            continue
        else:
            count +=1
if count == 0:
    print(0)
else:
    print(int(count / 2))


Measured memory_bytes: 9132
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

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

void solve(){
	int n = rint;
	S[] ans = f(n);
	
	foreach(an; ans) an.word.writeln;
}

struct S{
	string word;
	int value;
}

S[] f(int n){
	if(n == 1) return [S("a", 1)];
	else{
		S[] us = f(n - 1);
		S[] res;
		foreach(u; us){
			foreach(i; 0 .. u.value) res ~= S(u.word ~ ('a' + i).to!char, u.value);
			res ~= S(u.word ~ ('a' + u.value).to!char, u.value + 1);
		}
		return res;
	}
}


/*
既出の文字か、既出でない最小の文字を使う。
再帰でやる。[ S(文字列, 文字の種類数) ] を返す。
*/


Measured memory_bytes: 7548
import std.stdio;
import std.algorithm;
import std.math;
import std.conv;
import std.string;
import std.numeric;

T readNum(T)(){
  return readStr.to!T;
}

T[] readNums(T)(){
  return readStr.split.to!(T[]);
}

string readStr(){
  return readln.chomp;
}

void main(){
  auto input = readNums!long;
  auto a = input[0], b = input[1], c = input[2], d = input[3];

  auto lcm = c * d / gcd(c, d);

  long first, last, num;
  foreach(j, k; [c, d, lcm]){
    first = a + k - a % k;
    if(a % k == 0) first -= k;

    last = b - b % k;

    num += (j == 2 ? -1 : 1) * ((last - first) / k + 1);
  }
  writeln(b - a + 1 - num);
}


Measured memory_bytes: 256
//HASHEMESHOON hastam ;)
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstdio>
#include <map>
#include <string>
#include <set>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <ctime>
#include <list>
#include <iterator>
#define ll long long
#define ss second
#define ff first
#define pb push_back
using namespace std;
ll n,m,x,y,a[100100],b[100100];
map <ll,ll> mp;
int main(){
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];b[i]=a[i];
    }
    sort(b,b+n);
    for(int i=0;i<n;i++){
        mp[b[i]]=i%2;
    }
    for(int i=0;i<n;i++){
        if(i%2!=mp[a[i]])x++;
    }
    cout<<x/2;
    return 0;
}


Measured memory_bytes: 8064
import java.util.ArrayList;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		// テキスト入力
		Scanner sc = new Scanner(System.in);
		ArrayList<StringBuilder> one_obj = new ArrayList<StringBuilder>();
		String str_one_word = "";

		//
		while (true) {
			StringBuilder one_word = new StringBuilder(str_one_word);

			int height = sc.nextInt();
			int width = sc.nextInt();

			if (height == 0 && width == 0) {
				break;
			}

			// 高さ分ループする
			for (int h = 0; h < height; h++) {

				// 幅分ループ
				for (int w = 0; w < width; w++) {

					// 奇数列
					if (h % 2 == 0) {
						// 奇数個目は#
						if (w % 2 == 0) {
							one_word.append("#");
						} else {// 偶数個目は.
							one_word.append(".");
						}

						// 偶数列
					} else {
						// 奇数個目は.
						if (w % 2 == 0) {
							one_word.append(".");
						} else {// 偶数個目は#
							one_word.append("#");
						}
					}
				}
				// 一列が終わったので改行を追加
				one_word.append("\n");
			}

			one_obj.add(one_word);

		}
		for (int index = 0; index < one_obj.size(); index++) {
			System.out.println(one_obj.get(index));
		}
	}

}

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

#define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for( int i = 0; i < (n); i++ )
#define Rrep(i, a, n) for( int i = (a); i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii;
typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

struct UnionFind{
    vector<int> r, p;
    UnionFind() {}
    UnionFind(int size) { init(size); }
    void init(int size) {
        r.resize(size, 0);
        p.resize(size, 0);
        for ( int i = 0; i < size; i++ ) r[i] = 1,p[i] = i;
    }
    int find(int x) {
        return (x == p[x] ? x : p[x] = find(p[x]));
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    void unite(int x, int y) {
        x = find(x); y = find(y);
        if ( x == y ) return;
        if( r[x] < r[y] ) swap(x, y);
        r[x] += r[y];
        p[y] = x;
    }
};

signed main() {
    int N, M;
    cin >> N >> M;

    UnionFind uf(N);
    Rep(i, M) {
        int a, b;
        cin >> a >> b;
        uf.unite(--a, --b);
    }

    bool used[1001] = {0};
    int v = 0, c = 0;
    Rep(i, N) {
        bool flag = false;
        if ( used[i] ) continue;
        Rep(j, N) {
            if ( i == j ) continue;
            if ( uf.same(i, j) ) {
                if ( !flag ) c++;
                flag = true;
                used[i] = used[j] = true;
            }
        }
    }

    Rep(i, N) if ( !used[i] ) v++;
    //cout << v << " " << c << endl;
    cout << abs(v - c) << endl;

    return 0;
}

Measured memory_bytes: 3104
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

ll gcd(ll a, ll b) {
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    ll A, B, N;
    in >> A >> B >> N;
    ll x = B-1;
    if (N < B-1) {
        x = N;
    }
    ll ans = (ll)floor(((long double)A)* x/B);
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > key;
    rep (i, m) {
        int a, b;
        cin >> a >> b;
        int s = 0;
        rep (j, b) {
            int c;
            cin >> c;
            c--;
            s |= 1 << c;
        }
        key.push_back(make_pair(s, a));
    }
    vector<int> dp(1 << n, Inf);
    dp[0] = 0;
    rep (s, 1 << n) {
        rep (i, m) {
            int t = s | key[i].first;
            int cost = dp[s] + key[i].second;
            dp[t] = min(dp[t], cost); 
        }
    }
    int ans = dp.back();
    if (ans == Inf) ans = -1;
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
import sys
from bisect import bisect_left
from itertools import accumulate

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *XY = map(int, read().split())

    X = set()
    Y = set()
    for i, (x, y) in enumerate(zip(*[iter(XY)] * 2)):
        X.add(x)
        Y.add(y)

    X = sorted(X)
    Y = sorted(Y)

    P, Q = len(X), len(Y)

    ans = -1
    for i, x1 in enumerate(X):
        for x2 in X[i + 1 :]:
            for j, y1 in enumerate(Y):
                for y2 in Y[j + 1 :]:
                    p = 0
                    for x, y in zip(*[iter(XY)] * 2):
                        if x1 <= x <= x2 and y1 <= y <= y2:
                            p += 1

                    if p >= K and (ans > (x2 - x1) * (y2 - y1) or ans == -1):
                        ans = (x2 - x1) * (y2 - y1)

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 74220
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

    vector < vector <char> > a = { {'N', 'S'}, {'W', 'E'} };
    vector <vector <bool> > h(2);
    for (int i = 0; i < 2; ++i)
        h[i].resize(2);
    string s;
    cin >> s;
    for (char c : s) {
        for (int i = 0; i < 2; ++i) {
            for (int j = 0; j < 2; ++j) {
                h[i][j] = h[i][j] | (c == a[i][j]);
            }   
        }   
    }   
    for (int i = 0; i < 2; ++i) {
        if (h[i][0] ^ h[i][1]) {
            cout << "No" << endl;
            exit(0);
        }   
    }
    cout << "Yes" << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int a[26];
int main(){
    string s;
    cin>>s;
    int n=s.size();
    rep(i,n) ++a[s[i]-'a'];
    rep(i,26){
        if(a[i]==0){
            s+=(char)(i+'a');
            cout<<s<<endl;
            return 0;
        }
    }
    for(int i=n-1;i>=0;--i){
        rep(j,26){
            if(a[j]==0&&(s[i]-'a')<j){
                s=s.substr(0,i);
                s+=(char)(j+'a');
                cout<<s<<endl;
                return 0;
            }
        }
        --a[s[i]-'a'];
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int main()
{
	IO_OP;
	
	int a, b, c;
	cin >> a >> b >> c;
	cout << max(0, c - (a - b)) << endl;
	
}



Measured memory_bytes: 256
import java.util.*;

public class Main{
	  public static void main(String[]args){
	  Scanner sc = new Scanner(System.in);
		  int point = 0;
		  int number = sc.nextInt();
		  int[][] a = new int[number][3];

		  for(int i=0; i<2; i++) {
			  for(int x=0; x<number; x++) {
				  a[x][i] = sc.nextInt();
			  }
		  }
		  for(int i=0; i<number-1; i++) {
			  a[i][2] = sc.nextInt();
		  }
		  for(int i=0; i<number; i++) {
			  point += a[a[i][0]-1][1];
			  if(i<number-1) {
				  if(a[i][0]+1 == a[i+1][0]) {
					  point += a[a[i][0]-1][2];
				  }
			  }
		  }
		  System.out.println(point);
  }
}

Measured memory_bytes: 23636
x = input()
x = int(x)
answer = ''

for i in range(9):
    i = i + 1
    if x % i == 0:
        shou = x // i
        if (1 <= i and i <= 9) and (1 <= shou and shou <= 9):
            answer = 'Yes'
            break
        else:
            answer = 'No'
    else:
        answer = 'No'
print(answer)
        
      


Measured memory_bytes: 2940
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if(W > V):
    print('NO')
else:
    distance = abs(B-A)
    velocity = V - W
    if(distance > velocity*T):
        print('NO')
    else:
        print('YES')


Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main() {
	int a,b,c,d,k; cin>>a>>b>>c>>d>>k;
	int h,m; h=c-a, m=d-b;
	cout<<max(0,h*60+m-k)<<endl;

	return 0;
}


Measured memory_bytes: 3572
import java.util.Scanner;

public class Main 
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n;
		n=sc.nextInt();
		int res,count;
		res=1;
		if(n<105)
			System.out.println(0);
		else if(n==105||n==106)
			System.out.println(1);
		else
		{
			for(int i=107;i<=n;i=i+2)
			{
				count=0;
				for(int j=1;j<=i/2;j=j+2)
				{
					if(i%j==0)
					{
						count++;
					}
				}
				if(count==7)
					res++;
			}
			System.out.println(res);
		}		
	}
}


Measured memory_bytes: 20820
import java.math.BigDecimal;
import java.io.*;

class Main {
    public static void main(String args[]) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s = new String(in.readLine());
        String[] field = s.split(" ", 0);
        
        BigDecimal vertical = new BigDecimal(field[0]);
        BigDecimal width = new BigDecimal(field[1]);
        
        vertical = vertical.add(BigDecimal.ONE.negate());
        width = width.add(BigDecimal.ONE.negate());
        
        BigDecimal area = vertical.multiply(width);
        
        System.out.println(area);
    }
}

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

INF = 10**9

def dfs(depth, a, b, c, A, B, C, N, ls):
    if depth == N:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) > 0 else INF
    ret0 = dfs(depth+1, a, b, c, A, B, C, N, ls)
    ret1 = dfs(depth+1, a+ls[depth], b, c, A, B, C, N, ls) + 10
    ret2 = dfs(depth+1, a, b+ls[depth], c, A, B, C, N, ls) + 10
    ret3 = dfs(depth+1, a, b, c+ls[depth], A, B, C, N, ls) + 10
    
    return min(ret0, ret1, ret2, ret3)


def solve():
    N, A, B, C = [int(x) for x in input().split(" ")]
    ls = []
    for _ in range(N):
        ls.append(int(input()))
    
    print(dfs(0,0,0,0, A, B, C, N, ls))
    
    


if __name__ == "__main__":
    solve()

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main() {
	for (double w; cin >> w; ) {
		string s = w <= 48 ? "light fly" : w <= 51 ? "fly" : w <= 54 ? "bantam" : w <= 57 ? "feather" : w <= 60 ? "light" : w <= 64 ? "light welter" : w <= 69 ? "welter" : w <= 75 ? "light middle" : w <= 81 ? "middle" : w <= 91 ? "light heavy" : "heavy";
		cout << s << endl;
	}
	
	return 0;
}

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

int main ()
{
	int i,N,a,j,count;
	count = 0;
	int bingo[9];
	for(i=0;i<9;i++)
	{
		cin >> bingo[i];
	}
	cin >> N;
	for(i=0;i<N;i++)
	{
		a = 0;
		cin >> a;
		for(j=0;j<9;j++)
		{
			if(bingo[j] == a) bingo[j] = 0;
		}
	}
	if(bingo[0]+bingo[3]+bingo[6]==0) count = 1;
	if(bingo[1]+bingo[4]+bingo[7]==0) count = 1;
	if(bingo[2]+bingo[5]+bingo[8]==0) count = 1;
	if(bingo[0]+bingo[1]+bingo[2]==0) count = 1;
	if(bingo[3]+bingo[4]+bingo[5]==0) count = 1;
	if(bingo[6]+bingo[7]+bingo[8]==0) count = 1;
	if(bingo[0]+bingo[4]+bingo[8]==0) count = 1;
	if(bingo[2]+bingo[4]+bingo[6]==0) count = 1;
	if(count == 1) {cout << "Yes" << endl;}
	else {cout << "No" << endl;}
}

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

int main()
{
	int r, g, b;

	cin >> r >> g >> b;

	int ans = r * 100 + g * 10 + b;

	if (ans % 4 == 0) {
		cout << "YES";
	} else {
		cout << "NO";
	}

	return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();

            out.println(Math.abs(x - a) < Math.abs(x - b) ? "A" : "B");
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 22740
#include <stdio.h>
int a, n;
int main()
{
    for (int i = 1; i <= 10000; i++)
    {
        scanf("%d", &a);
        if (a != 0)
        {
            printf("Case %d: %d\n", i, a);
        }
        else
        {
            printf(" ");
        }
    }
    return 0;
}



Measured memory_bytes: 2048
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

int now=0,maxi=0,nowcnt=0,N,H;

int main(){
    cin>>N;
    rep(i,N){
        cin>>H;
        if(now>=H){
            nowcnt++;
            now=H;
        }
        else{
            maxi=max(maxi,nowcnt);
            nowcnt=0;
            now=H;
        }
    }
    out(max(maxi,nowcnt));


    
    
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt(),m=sc.nextInt();
        int[] ary=new int[n];
        Arrays.fill(ary,-1);
        boolean flag=true;
        for(int i=0;i<m;i++){
            int s=sc.nextInt();
            int c=sc.nextInt();
            if(ary[s-1]>-1&&ary[s-1]!=c){
                flag=false;
            }else{
                ary[s-1]=c;
            }
        }
        if(!flag||(ary[0]==0&&n!=1)){
            System.out.println(-1);
        }else if(n==1){
            if(ary[0]==-1){
                System.out.println(0);
            }else{
                System.out.println(ary[0]);
            }
        }else{
            for(int i=0;i<n;i++){
                if(ary[i]==-1){
                    if(i==0){
                        System.out.print(1);
                    }else{
                        System.out.print(0);
                    }
                }else{
                    System.out.print(ary[i]);
                }
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 23764
#include<cstdio>  
#include<iostream>  
#include<algorithm>  
#include<cstdlib>  
#include<cstring>
#include<string>
#include<climits>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#define LL long long
#define pii pair<int,int>
#define mp make_pair
 
using namespace std;
 
inline char nc(){
	/*
  static char buf[100000],*p1=buf,*p2=buf;
  if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) return EOF; }
  return *p1++;
  	*/return getchar();
}
 
inline void read(int &x){
  char c=nc();int b=1;
  for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;
  for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;
}
 
inline void read(LL &x){
  char c=nc();LL b=1;
  for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;
  for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;
}
 
inline int read(char *s)
{
    char c=nc();int len=0;
    for(;!(c>='0' && c<='9');c=nc()) if (c==EOF) return 0;
    for(;(c>='0' && c<='9');s[len++]=c,c=nc());
    s[len++]='\0';
    return len;
}
 
inline void read(char &x){
  for (x=nc();!(x>='A' || x<='B');x=nc());
}
 
int wt,ss[19];
inline void print(int x){
    if (x<0) x=-x,putchar('-'); 
    if (!x) putchar(48); else {
    for (wt=0;x;ss[++wt]=x%10,x/=10);
    for (;wt;putchar(ss[wt]+48),wt--);}
}
inline void print(LL x){
    if (x<0) x=-x,putchar('-');
    if (!x) putchar(48); else {for (wt=0;x;ss[++wt]=x%10,x/=10);for (;wt;putchar(ss[wt]+48),wt--);}
}

char x[10000],y[10000];

int check(char *x,char *y)
{
	int n=strlen(x),m=strlen(y);
	if (n<m) return 1;
	else if (n>m) return 0;
	else
	{
		for (int i=0;i<n;i++)
			if (x[i]<y[i]) return 1;
			else if (x[i]>y[i]) return 0;
		return 2;
	}
}

int main()
{
	read(x);read(y);
	int t=check(x,y);
	if (t==0) puts("GREATER");
	else if (t==1) puts("LESS");
	else puts("EQUAL");
	return 0;
}

Measured memory_bytes: 256
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

string ans;
int n;

bool dfs(int i, const vector<P> &s, vector<int> &a) {
    if (i == n) return true;
    int x = s[i].fi, y = s[i].se;
    if (a[x] == 0 && a[y] == 0) return false;
    if (a[y] != 0) {
        a[x]++; a[y]--;
        ans.pb('A'+x);
        if (dfs(i+1, s, a)) return true;
        a[x]--; a[y]++;
        ans.pop_back();
    }
    if (a[x] != 0) {
        a[y]++; a[x]--;
        ans.pb('A'+y);
        if (dfs(i+1, s, a)) return true;
        a[y]--; a[x]++;
        ans.pop_back();
    }
    return false;
}

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

    cin >> n;
    vector<int> a(3);
    rep(i, 3) cin >> a[i];
    vector<P> s(n);
    rep(i, n) {
        string t;
        cin >> t;
        s[i].fi = t[0] - 'A';
        s[i].se = t[1] - 'A';
    }
    if (dfs(0, s, a)) {
        cout << "Yes" << endl;
        rep(i, n) cout << ans[i] << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 13468
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define taskname "A"
#define pb	push_back
#define mp 	make_pair

typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> ii;
const int maxn = 2e5  + 5;
const int mod = 1e9 + 7;
int n, m,  cnt[maxn];
int a[maxn] , b[maxn];
int res = 0;
void add(int x){
    if(x > 0){
        res += (b[x]++ == 0);
    }
}
void del(int x){
    if(x > 0){
        res -= (--b[x] == 0);
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
        freopen(taskname".INP", "r",stdin);
        freopen(taskname".OUT", "w",stdout);
    }
    cin >> n >> m;
    for(int i = 1 ; i <= n ; ++i){
        cin >> a[i];
        cnt[a[i]]++;
        add(a[i] - cnt[a[i]] + 1);
    }
    for(int i = 1 ; i <= m ; ++i){
        int x , y;cin >> x >> y;
        del(a[x] - cnt[a[x]] + 1);--cnt[a[x]];
        a[x] = y;++cnt[a[x]];
        add(a[x] - cnt[a[x]] +1 );
        cout << n - res << '\n';
    }
}


Measured memory_bytes: 3840
dp=[]
#iまでに要したminコスト
#dp[i] = dp[i-1]+abs(l[i]-l[i-1]) or dp[i-2]+abs(l[i+1]-l[i-1])

n = int(input())
l = list(map(int, input().split()))
dp.append(0) #dp[0]
dp.append(abs(l[1]-l[0])) #dp[1]

for i in range(2, n):
    new = min(dp[i-1]+abs(l[i]-l[i-1]), dp[i-2]+abs(l[i]-l[i-2]))
    dp.append(new) 


ans = min((dp[n-2]+abs(l[n-2]-l[n-1])), (dp[n-3] + abs(l[n-3]-l[n-1])))
print(ans)

Measured memory_bytes: 55400
#include <stdio.h>

int main(void){
    int num[3],sum,i,sign;
    for(;sign=0,scanf("%d %d %d",&num[0],&num[1],&num[2])!=EOF;){
        sum=20-num[0]-num[1];
        for(i=sum;i>0;i--)
            if(!(i==num[0]||i==num[1]||i==num[2]))
                sign++;
        if(sign>3)
            puts("YES");
        else
            puts("NO");
    }
    return 0;
}

Measured memory_bytes: 580
#include<stdio.h>
int main(){
  int N;
  int A[1000];
  int i,j;
  int v;
  int k;
  scanf("%d",&N);
for(i=0;i<N;i++){
    scanf("%d", &A[i]);
  }
  for(i=0;i<N-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[N-1]);
  for(i=1;i<=N-1;i++){
	v=A[i];
	j = i -1;
  while(j >= 0 && A[j] >v){
    A[j+1] = A[j];
    j--;
    A[j+1] = v;
  }
for(k=0;k<N-1;k++){
 printf("%d ",A[k]);
}
printf("%d\n",A[N-1]);
}
return 0;
}



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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define SORT(v) sort(ALL(v))
//#define scanf scanf_s
typedef pair<int, int> P;

int w, h;
char fld[30][30];

int di[] = { -1, 0, 0, 1 }; int dj[] = { 0, -1, 1, 0 };
int main()
{
	while (cin >> w >> h, w)
	{
		queue<P> que;
		REP(i, h)REP(j, w)
		{
			cin >> fld[i][j];
			if (fld[i][j] == '@') que.push(P(i, j));
		}
		int cnt = 1;
		while (que.size())
		{
			int x = que.front().first; int y = que.front().second;
			que.pop();
			REP(k, 4)
			{
				int nx = x + di[k]; int ny = y + dj[k];
				if (nx >= 0 && nx < h&&ny >= 0 && ny < w&&fld[nx][ny] == '.')
				{
					que.push(P(nx, ny));
					cnt++;
					fld[nx][ny] = '@';
				}
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

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


int main()
{
	int c,f;
	string s;
	bool flag=true,flag1=true;
	cin>>s;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='F')
		{
			f=i;
			flag1=false;
		}
		if(flag&&s[i]=='C')
		{
			c=i;
			flag=false;
		}
	}
	if(!flag&&!flag1&&c<f)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        scan.useDelimiter("\\s");
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int x;
        int y;
        int z;
        if(a>b){
        x = a;
        a = b;
        b = x;
        }
        if (b>c){
            y = b;
            b = c;
            c = y;
        }
        if (a>b){
            z = a;
            a = b;
            b = z;
        }
        System.out.println(a+" "+b+" "+c);
    }
}


Measured memory_bytes: 26244
n, m, l = map(int, input().split())

def acq_ab(n):
    a = []
    for i in range(n):
        if i == n:
            break
        ai = list(map(int, input().split()))
        a.append(ai)
    return a

def calc(a, b, n, m, l):
    ans = 0
    for i in range(n):
        for j in range(l):
            for k in range(m):
                ans = ans + a[i][k] * b[k][j]
            if j == l - 1:
                #print("j = {}".format(j))
                print(ans)
            else:
                #print("j = {}".format(j))
                print(ans, end=" ")
            ans = 0
    return 0

#a = [[1, 2], [0, 3], [4, 5]]
#b = [[1, 2, 1], [0, 3, 2]]
#c = calc(a, b, 3, 2, 3)
a = acq_ab(n)
b = acq_ab(m)
calc(a, b, n, m, l)


Measured memory_bytes: 6572
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define arrprint(v,n) rep(i,0,n-1)cout << v[i] << " ";cout << endl;
#define matprint(v,n,m) rep(i,0,n-1){rep(j,0,m-1){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
typedef long long ll;
typedef pair<int,int> P;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

int k;

ll dfs(int top, int keta, ll res = 0){
    ll ans = 0;
    if(keta == 1){
        k--;
        // cout << res+top << endl;

        if(k == 0){
            return res + top;
        }
        else return 0;
    }
    rep(i,0,9){
        if(abs(top - i) <= 1){
            ans = dfs(i,keta-1,res + (ll)top*pow(10,keta-1));
            if(ans > 0)return ans;
        }
    }
    return ans;
}

int main(){
    int k2;
    cin >> k2;
    int keta = 2;
    ll ans = 0;
    if(k2 <= 9) ans = k2;
    else{
        k2 -= 9;
        k = k2;
        while(ans == 0){
            // k = k2;
            rep(i,1,9){
                // cout << "k:" << k << endl;
                ans = dfs(i,keta);
                if(ans > 0)break;
            }
            keta++;
        }
    }

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let c: i32 = read();
    println!("{}", if b - a == c - b { "YES" } else { "NO" });
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

int n, m;
intt k;

int main() {

	FAST;

	cin >> n >> m >> k;
	vector <int> a(n + 1), b(m + 1);
	for (int i = 1; i <= n; i ++) cin >> a[i];
	for (int i = 1; i <= m; i ++) cin >> b[i];
	vector <intt> prefa(n + 1), prefb(m + 1);
	for (int i = 1; i <= n; i ++) {
		prefa[i] = prefa[i - 1] + a[i];
	}
	vector <intt> bag;
	for (int i = 1; i <= m; i ++) {
		prefb[i] = prefb[i - 1] + b[i];
		bag.push_back(prefb[i]);
	}
	int ans = 0;
	for (int i = 0; i <= n; i ++) {
		if (prefa[i] > k) break;
		vector <intt>::iterator itr;
		itr = upper_bound(bag.begin(), bag.end(), k - prefa[i]);
		int j = itr - bag.begin();
		ans = max(ans, i + j);
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 9996
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#define rep_zero(i, n) for(int i=0; i<n; i++)
#define rep(i, n) for(int i=1; i<n; i++)
using namespace std;
typedef long long ll;

int main(){
    string s; cin >> s;
    int l = s.length();
    int t[l+1], u[l];
    rep_zero(i, l){
        u[i] = int(s[l-i-1]-'0');
        //cout <<" " << u[i];
    }
    //　cout << endl;
    t[0] = 0;
    int x = 1;
    rep_zero(i, l){
        t[i+1] = t[i]+u[i]*x;
        t[i+1] %= 2019;
        x = x*10%2019;
    }
    rep_zero(i, l+1){
        // cout << "i="<<i<<", t[i]="<<t[i] << endl;
    }
    ll ans = 0;
    vector<int> count(2019,0);
    rep_zero(i, l+1){
        // cout << "i="<<i<<", t[i]="<<t[i] << endl;
        ans += count[t[i]];
        count[t[i]] += 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5312
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+1, mod = 1e9+7;

inline int add(int x, int y)        { return x += y, x %= mod; }
inline int mul(long long x, int y)  { return x *= y, x %= mod; }
inline int mac(int x, int y, int z) { return add(x,mul(y,z)); } 
inline int sub(int x, int y)        { return add(x,mod-y); }

int f[N], g[N], h[N], n;

int main() {
	cin >> n, f[0] = h[0] = 1;
	for (int u = 0, v = 1; u < n; u = v++)
		f[v] = mul(8,f[u]), 
		g[v] = mac(f[u],9,g[u]), 
		h[v] = mul(10,h[u]);
	cout << sub(h[n],mac(f[n],2,g[n])) << ' '; }
	

Measured memory_bytes: 15180
//[2, 1510] の約数全てをもつ整数factを探す
//[fact + 2, fact + 1510] は全て約数を持つことがわかる
//どんな値が入力されようと, fact + 2を出力しておけばいい

import java.util.*;
import java.math.BigInteger;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        BigInteger fact = BigInteger.ONE;
        BigInteger mul = BigInteger.ONE;

        for(int i = 1; i <= 1510; i++){
            fact = fact.multiply(mul);
            mul = mul.add(BigInteger.ONE);
        }
        fact = fact.add(new BigInteger("2"));

        while(sc.hasNextInt()){
            int n = sc.nextInt();
            System.out.println(fact);

            for(int i = 2; i < 2 + n; i++){
                System.out.println(i);
            }
        }
    }
}

Measured memory_bytes: 28304
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <iomanip>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(int i = 0;i < n;++i)
int main() {
	int n;
	cin >> n;
	vector<int> hogee;
	REP(i, n * 2) {
		int a;
		cin >> a;
		hogee.push_back(a);
	}
	sort(begin(hogee), end(hogee));
	long long ans = 0;
	for (int i = 0;i < n * 2;i += 2) {
		ans += hogee[i];
	}
	cout << ans << endl;
}

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


int main()
{
	int n, m, l;
	cin >> n >> m >> l;
	int A[100][100], B[100][100];
	
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			cin >> A[i][j];

	for (int i = 0; i < m; i++)
		for (int j = 0; j < l; j++)
			cin >> B[i][j];

	long long C[100][100],sum;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			sum = 0;
			for (int k = 0; k < m; k++) {
				sum += A[i][k] * B[k][j];
			}
			C[i][j] = sum;
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l;j++) {
			if (j == 0) {
				cout << C[i][j];
			}
			else {
				cout << " " << C[i][j];
			}
		}
		cout << endl;
	}
	


	return 0;
}


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

int main() {
  int N,C,K;
  cin >> N >> C >> K;
  vector<int> T(N);
  rep(i,N) cin >> T[i];
  sort(T.begin(),T.end());
  int ans=0;
  for(int i=0; i<N;) {
    ans++;
    int start = i;
    while(i < N && T[i] - T[start] <= K && i - start < C) i++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3676