akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

const double EPS = 1e-8;
struct P{
	double x, y;
	P(double x_, double y_){ x = x_; y = y_; }
	P(){}
	P operator-(const P& p){
		return P(x - p.x, y - p.y); 
	}
};
bool operator<(const P& a, const P& b){
	return ( a.x < b.x );
}

struct Segment{
	P a, b;
	Segment(P a_, P b_){
		if( b_ < a_ ) swap(a_, b_);
		a = a_; b = b_;
	}
	Segment(){}
};
bool operator<(const Segment& a, const Segment& b){
	return ( a.a < b.a );
}

double dot(P a, P b){
	return a.x * b.x + a.y * b.y;
}
double cross(P a, P b){
	return a.x * b.y - a.y * b.x;
}
double dist(P a){
	return sqrt(a.x * a.x + a.y * a.y);
}
double dist(P a, P b){
	return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
double dist(P a, P b, P x){
	if( dot(b-a, x-a) < EPS ) return dist(x-a);
	if( dot(a-b, x-b) < EPS ) return dist(x-b);
	return abs(cross(b-a, x-a)) / dist(b-a);
}
double dist(Segment a, Segment b){
	return min( min(dist(a.a, a.b, b.a), dist(a.a, a.b, b.b)), min(dist(b.a, b.b, a.a), dist(b.a, b.b, a.b)));
}
bool is_intersect(P a1, P a2, P b1, P b2) {
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}
bool is_parallel(P a1, P a2, P b1, P b2){
	return fabs(cross(a1-a2, b1-b2)) < EPS;
}


Segment v[5101];

int main(){
	int n, h[101][101] = {0};
	
	scanf("%d", &n);
	if( n > 5100 ){
		printf("%.8f\n", 0.0);
		return 0;
	}
	
	for(int i=0 ; i < n ; i++ ){
		int ax, ay, bx, by;
		scanf("%d %d %d %d", &ax, &ay, &bx, &by);
		h[ay][ax]++;
		h[by][bx]++;
		v[i] = Segment(P(ax,ay), P(bx,by));
	}
	
	bool flag = false;
	for(int y=0 ; y < 101 && !flag ; y++ ){
		for(int x=0 ; x < 101 && !flag ; x++ ){
			if( h[y][x] >= 2 ){
				printf("%.8f\n", 0.0);
				return 0;
			}
		}
	}
	
	double ans = 200;
	sort(v, v+n);
	for(int i=0 ; i < n ; i++ ){
		for(int j=i+1 ; j < n ; j++ ){
			double d = dist(v[i], v[j]);
			ans = min(ans, d);
			if( !is_parallel(v[i].a, v[i].b, v[j].a, v[j].b) && is_intersect(v[i].a, v[i].b, v[j].a, v[j].b) ){
				ans = 0.0;
				break;
			}
		}
	}
	printf("%.8f\n", ans);
}

Measured memory_bytes: 1272
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int D, N;

int main(){
	
	cin>>D>>N;
	
	if( N == 100 )	cout<<"101";
	else{		cout<<N;}
	REP( i, D ){
		cout<<"00";
	}
	puts("");
	
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(){

    int a []={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};

int n;
    if(scanf("%d", &n)!=1){ 
    };

    printf("%d",a[n-1]);


    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int xx[90001],yy[90001],dp[90001];
int main(void){
    int h,w,k;
    cin>>h>>w>>k;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int ss;
            cin>>ss;
            xx[ss]=i;
            yy[ss]=j;
        }
    }
    for(int i=1+k;i<=90000;i++){
        dp[i]=dp[i-k]+abs(xx[i-k]-xx[i])+abs(yy[i-k]-yy[i]);
    }
    int q;
    cin>>q;
    for(int i=0;i<q;i++){
        int a,b;
        cin>>a>>b;
        cout<<dp[b]-dp[a]<<endl;
    }
}

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

#define llint long long int
#define MOD 2019

using namespace std;

int main()
{
    int L, R;

    cin >> L >> R;

    if (R - L > 2 * MOD)
    {
        R = L + 2 * MOD;
    }
    int min = 2019;

    for (int i = L; i <= R; i++)
    {
        for (int j = i + 1; j <= R; j++)
        {
            int val = ((i % MOD) * (j % MOD)) % MOD;

            if (val < min)
            {
                min = val;
            }
        }
    }
    cout << min << endl;
}

Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

int main() {

	int N,A,B;

	scanf("%d %d %d", &N,&A,&B);

	printf("%d", min(N*A, B));

	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
import java.math.BigInteger;

class Main {
    public static void main(String[] argv){
        Scanner s = new Scanner(System.in);
        BigInteger a = null,
                   b = null,
                   c = null,
                   max = null;
        String maxs = "";
        for(int i=0;i<80;i++){
            maxs += "9";
        }
        max = new BigInteger(maxs);
        int m = s.nextInt();
        for(int i=0;i < m;i++){
            a = s.nextBigInteger();
            b = s.nextBigInteger();
            c = a.add(b);
            System.out.println((c.compareTo(max) > 0 ? "overflow" : c ).toString());
        }
    }
}

Measured memory_bytes: 12000
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String[] spl = s.split(" ");
		sc.close();

		int P = Integer.parseInt(spl[0]);
		int Q = Integer.parseInt(spl[1]);
		int R = Integer.parseInt(spl[2]);
		int A = P + Q;
		int sum1 = P + Q;
		int sum2= Q + R;
		int sum3 = R + P;
		int ans = 0;
		ans = Math.min(sum1, sum2);
		ans = Math.min(ans, sum3);
		System.out.println(ans);
	}
}

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

int main() {
    int a, b, c;
    int x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = 0;
    int xyMin = min(x, y);
    if (a + b > 2 * c) {
        ans += xyMin * 2 * c;
    } else {
        ans += xyMin * a + xyMin * b;
    }
    if (x > y) {
        if (a > 2 * c) {
            ans += (x - y) * 2 * c;
        } else {
            ans += (x - y) * a;
        }
    } else {
        if (b > 2 * c) {
            ans += (y - x) * 2 * c;
        } else {
            ans += (y - x) * b;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import numpy as np
N = int(input())
W_list = [int(i) for i in input().split(" ")]
sum_list = np.sum(W_list)
ans = np.abs(sum_list - 2 * W_list[0])
sum_front = W_list[0]
for j in range(1, N):
  sum_front += W_list[j]
  difference = np.abs(sum_list - 2 * sum_front)
  if difference < ans:
    ans = difference
  else:
    break
 
print(ans)

Measured memory_bytes: 12448
N = int(input())
S = input()

count_E = S[1:].count("E")
ans = count_E
for i in range(1,N):
    if S[i-1] == "W":
        count_E += 1
    if S[i] == "E":
        count_E -= 1
    if ans >count_E:
        ans = count_E
print(ans)

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int a, b, x;

int main() {
	cin >> a >> b >> x;
	
	cout << (inII(x, a, a + b) ? "YES" : "NO") << endl;
	
	return 0;
}


Measured memory_bytes: 256
f = lambda:map(int,input().split())
a,b,m = f()
la = list(f())
lb = list(f())
lx,ly,lc = [],[],[]
a = min(la)+min(lb)
for _ in range(m):
  x,y,c = f()
  a = min(a,la[x-1]+lb[y-1]-c)
print(a)

Measured memory_bytes: 18612
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define srep(i) for(int i = 0; i < s.size(); i++)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 1e9
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int N;
int a[100005], b[100005], c[100005];
ll dp[100005][3];

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

ll all_search(int i, int j) {
    ll res = 0;
    if(i == N) {
        return 0;
    } else if(j == 0) {
        return max(all_search(i + 1, 1) + b[i], all_search(i + 1, 2) + c[i]);
    } else if(j == 1) {
        return max(all_search(i + 1, 0) + a[i], all_search(i + 1, 2) + c[i]);
    } else if(j == 2) {
        return max(all_search(i + 1, 0) + a[i], all_search(i + 1, 1) + b[i]);
    }

    res = max(all_search(i + 1, 0) + a[i],
              max(all_search(i + 1, 1) + b[i], all_search(i + 1, 2) + c[i]));

    return res;
}

ll dp_recursive(int i, int j) {
    if(dp[i][j] != -1) {
        return dp[i][j];
    }

    ll res = 0, v1 = 0, v2 = 0;
    if(i - 1 == N) {
        return 0;
    } else if(j == 0) {
        v1 = dp_recursive(i + 1, 1) + b[i];
        v2 = dp_recursive(i + 1, 2) + c[i];
    } else if(j == 1) {
        v1 = dp_recursive(i + 1, 0) + a[i];
        v2 = dp_recursive(i + 1, 2) + c[i];
    } else if(j == 2) {
        v1 = dp_recursive(i + 1, 0) + a[i];
        v2 = dp_recursive(i + 1, 1) + b[i];
    }

    return dp[i][j] = max(v1, v2);
}

// ll dp_for(int n) {
//     for(int i = 0; i < N; i++)
//         dp[i] = INF;
//     dp[0] = 0;
//     for(int i = 1; i < n; i++) {
//         dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
//         if(i > 1) {
//             dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
//         }
//     }
//     return dp[n - 1];
// }

int main() {
    cin >> N;
    rep(i, N) cin >> a[i] >> b[i] >> c[i];
    memset(dp, -1, sizeof(dp));
    cout << max(dp_recursive(0, 0), max(dp_recursive(0, 1), dp_recursive(0, 2)))
         << endl;
}


Measured memory_bytes: 8448
N = int(input())
As = list(map(int, input().split()))
from itertools import accumulate

cAs = list(accumulate(As[::-1]))[::-1][1:] + [0]

ans = 0
now_nodes = 1
for i, (cum, a) in enumerate(zip(cAs, As)):
    if i==N:
        if now_nodes==a:
            print(ans+a)
        else:
            print(-1)
    if now_nodes<=a and i!=N:
        print(-1)
        break
    num = min(cum, (now_nodes-a)*2)
    ans += now_nodes
    now_nodes = num

Measured memory_bytes: 87404
import java.util.Scanner;

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

        String s = sc.nextLine();
        String[] str = new String[3];
        int value = 700;
        str = s.split("");
        for (int i = 0; i < str.length; i++) {
            if (str[i].equals("o"))
                value += 100;
        }
        System.out.println(value);
    }
}

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

int main(){
    int n;
    cin>>n;
    ll sum=0;
    for(ll i=1;i<=n;i++){
        if(i%3==0 || i%5==0) continue;
        else sum+=i;
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int p,q,r;
	cin>>p>>q>>r;
	int m=p+q;
	int n=p+r;
	int k=q+r;
	int d=m<n?m:n;
	int dd=n<k?n:k;
	int ddd=d<dd?d:dd;
	cout<<ddd;
	return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N, x;
    cin >> N >> x;
    vector<ll> a(N);
    REP(i, N) cin >> a[i];

    const ll INF = (1ll << 60);
    vector<ll> mi(N, INF);

    ll res = INF;
    REP(k, N){
    	ll tmp = 0;
    	tmp += k*x;
    	REP(i, N) mi[i] = min(mi[i], a[(i-k+N)%N]);
    	REP(i, N) tmp += mi[i];
    	res = min(res, tmp);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>

using namespace std;
int main()
{
    float sum,a =0,n;
    cin>>n;
    for(int i =1; i<= n; i++){
        if((i+1)%2 == 0){
            a++;
        }
    }
    sum = a/n;
    cout<<sum;

    return 0;
}


Measured memory_bytes: 3768
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;

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

int main() {

    ll x,y,X,Y;
    cin >> x >> y >> X >> Y;
    ll H = Y-y;
    bool isUp = true;
    if(H<0) isUp = false;
    ll W = X-x;
    bool isRight = true;
    if(W<0) isRight = false;
    string out = "";
    rep(i,H){
        if(isUp) out += "U";
        else out += "D";
    }
    rep(i,W){
        if(isRight) out += "R";
        else out += "L";
    }
    rep(i,H){
        if(isUp) out += "D";
        else out += "U";
    }
    rep(i,W){
        if(isRight) out += "L";
        else out += "R";
    }
    if(isRight) out += "L";
    else out += "R";
    rep(i,H+1){
        if(isUp) out += "U";
        else out += "D";
    }
    rep(i,W+1){
        if(isRight) out += "R";
        else out += "L";
    }
    if(isUp) out += "D";
    else out += "U";
    if(isRight) out += "R";
    else out += "L";
    rep(i,H+1){
        if(isUp) out += "D";
        else out += "U";
    }
    rep(i,W+1){
        if(isRight) out += "L";
        else out += "R";
    }
    if(isUp) out += "U";
    else out += "D";
    cout << out << endl;
    return 0;
}


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


#define L 1000000007

int main(){
	int m, n, dig;
	long dp[32], p = 1;
	scanf("%d%d", &m, &n);
	dp[0] = m;
	if (n % 2 != 0) {
		p = m;
	}
	for (int i = 1; i < 32; i++) {
		if (n < (1 << i)) {
			dig = i;
			break;
		}
		dp[i] = (dp[i - 1] * dp[i - 1]) % L;
		if (n & (1 << i)) {
			p = (p*dp[i]) % L;
		}
	}
	printf("%ld\n", p);

	return 0;
}

Measured memory_bytes: 2740
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
Int mod = 1e9+7;

int main() {
    Int m, k;
    cin >> m >> k;
    if (k == 0) {
        for (Int i = 0; i < (1LL<<m); i++) cout << i << " " << i << " ";
        cout << endl;
    }
    else if (m == 1) {
      dump(-1);
    }
    else if ((1LL<<m) - 1LL >= k) {
       for (Int i = 0; i < (1LL<<m); i++) {
         if (i == k) continue;
         cout << i << " ";
       }
      cout << k << " ";
      for (Int i = (1LL<<m) - 1LL; i >= 0; i--) {
        if (i == k) continue;
        cout << i << " ";
      }
      cout << k << endl;
    }
    else {
      dump(-1);
    }
    return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;

std::vector<ll> a( 3, 0 );

int main()
{
  std::cin >> a[0] >> a[1] >> a[2];

  std::sort(all(a));
  a.erase(std::unique(all(a)), a.end());

  std::cout << a.size() << std::endl;

  return 0;
}

Measured memory_bytes: 256
N = int(input())
P = list(map(int,input().split()))
A = []
B = []
s = N // 2
if N % 2 == 0:
    for i in range(N-1, 0, -2):
        A.append(P[i])
    for j in range(0, N-1, 2):
        B.append(P[j])
else:
    for i in range(N-1, -1, -2):
        A.append(P[i])
    for j in range(1, N, 2):
        B.append(P[j])
for i in range(len(A)):
    print(A[i], end=" ")
for j in range(len(B)):
    print(B[j], end=" ")
print()

Measured memory_bytes: 26020
#include "iostream"
#include "vector"
#include "array"
#include "string"
#include "algorithm"

using namespace std;
#define rep(p,q) for(int i = p;i < q;i++)

//3

int main(void) {
	vector<vector<int>> c = vector<vector<int>>();
	for (int i = 0; i < 3; i++) {
		c.push_back(vector<int>());
		for (int j = 0; j < 3; j++) {
			int ab = 0;
			cin >> ab;
			c[i].push_back(ab);
		}
	}
	vector<vector<int>> a = vector<vector<int>>();
	vector<vector<int>> b = vector<vector<int>>();
	for (int i = 0; i < 3; i++) {
		a.push_back(vector<int>());
		b.push_back(vector<int>());
		a[i].push_back(c[0][i] - c[1][i]);
		a[i].push_back(c[0][i] - c[2][i]);
		a[i].push_back(c[1][i] - c[2][i]);
		b[i].push_back(c[i][0] - c[i][1]);
		b[i].push_back(c[i][0] - c[i][2]);
		b[i].push_back(c[i][1] - c[i][2]);
	}
	string answer = "Yes";
	rep(0, 3) {
		if (a[0][i] == a[1][i] && a[0][i] == a[2][i] && a[1][i] == a[2][i] && b[0][i] == b[1][i] && b[0][i] == b[2][i] && b[1][i] == b[2][i]) {

		}
		else {
			
			answer = "No";
			break;
		}
	}
	cout << answer << endl;
}


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


public class Main {
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		a=a-b;
		for(;;) {
			a-=c;
			if(a<c) {
				break;
			}
				
		}
		System.out.println(a);
	}
}


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

using namespace std;

void solve()
{
	double a;
	vector<double> Vec;
	while(cin >> a)
	{
		Vec.push_back(a);
	}
	sort(Vec.begin(), Vec.end());
	int size = Vec.size();
	cout << Vec[size - 1] - Vec[0] << endl;
}

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

Measured memory_bytes: 0
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>

int main()
{
  int N, K;
  std::cin >> N >> K;
  std::vector<int> D(N);
  for(int i=0; i<N; i++) {
    std::cin >> D[i];
  }

  int ret = 0;

  // number of dequeue
  for(int k=0; k<=K; k++) {
    // number of right
    for(int r=0; r<=k; r++) {
      // std::cout << "k: " << k
      //           << " r: " << r
      //           << " k-r:" << k-r
      //           << std::endl;
      int tmp = 0;
      std::multiset<int> neg;
      // get from right
      for(int i=0; i<std::min(r, N); i++) {
        int d = D[N - 1 - i];
        if(d >= 0) {
          // std::cout << "d " << d << std::endl;
          tmp += d;
        } else {
          neg.insert(d);
        }
      }
      // get from left
      for(int i=0; i<std::min(k-r, N - std::min(r, N)); i++) {
        int d = D[i];
        if(d >= 0) {
          // std::cout << "d " << d << std::endl;
          tmp += d;
        } else {
          neg.insert(d);
        }
      }
      // remove neg
      int n_remove = K - k;
      auto it = neg.begin();
      for(int i=0; i<(int)neg.size(); i++, it++) {
        // std::cout << "neg" << i << ": " << *it << std::endl;
        if(n_remove <= i) {
          // std::cout << "boo" << std::endl;
          tmp += *it;
        }
      }
      if(ret < tmp) {
        ret = tmp;
      }
    }
  }


  std::cout << ret << std::endl;

  return 0;
}


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

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::f64::consts::PI;

fn main() {
    input!{
        r: f64,
    };
    
    println!("{}", 2.0 * r * PI);
}


Measured memory_bytes: 2224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include <set>
int main(){
  int n;
  cin>>n;
  set<string> word;
  rep(i,n){
    string s;
    cin>>s;
    word.insert(s);
    }
  
  cout<<word.size()<<endl;
}


Measured memory_bytes: 19124
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	string s;
  	cin >> s;
  	rep(i,s.size()) cout << "x";
  	cout << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 256
# coding: utf-8
import sys
input = sys.stdin.readline

def f(n, wlimit):
    dp = [-1] * (wlimit + 1)
    dp[0] = 0
    for i in range(1, n + 1):
        wi, vi = map(int, input().rstrip().split())
        dp_ = list(dp)
        for w in range(wlimit + 1):
            if dp[w] >= 0:
                w_ = w + wi
                v_ = dp[w] + vi
                if w_ <= wlimit and dp[w_] < v_:
                    dp_[w_] = v_
        dp = dp_
    return(max(dp))

n, w = map(int, input().rstrip().split()) # 1 <= n <= 100, 1 <= w <= 10^5

print(f(n, w))


Measured memory_bytes: 13388
#include<stdio.h>

int main()
{
    int a,b,c,rem;
    
    scanf("%d%d",&a,&b);
    
    if(a<b) {
        c = a;
        a = b;
        b = c;
    }
    
    rem = a % b;
    while(rem != 0) {
        a = b;
        b = rem;
        rem = a % b;
    }
    
    printf("%d\n",b);
    
    return 0;
}



Measured memory_bytes: 2048
while 1:
	W,Q = map(int,raw_input().split())
	if W == 0: break
	cat = [map(str,raw_input().split()) for i in range(Q)]
	dic = {cat[i][1]:[int(cat[i][2]),0] for i in range(Q) if cat[i][0] == "s"}
	wall = [-1]*W
	for i in range(Q):
		if cat[i][0] == "s":
			id,w = cat[i][1],int(cat[i][2])
			for j in range(W-w+1):
				if wall[j:j+w] == [-1]*w:
					wall[j:j+w] = [id]*w
					dic[id][1] = j
					print j
					break
			else:
				print "impossible"
		else:
			w,sp = dic[cat[i][1]]
			wall[sp:sp+w] = [-1]*w
	print "END"

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

signed main() {
	int a, b;
	cin >> a >> b;
	for (int i = 0; i < a; ++i) {
		char c;
		cin >> c;
		if (i == b - 1) c += 32;
		cout << c;
	}
	cout << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;



int main(){
    string s,t;cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < 3; i++) {
        if(s[i]==t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,f[100][10],p[100][11],ans=-1e9;
	cin>>n;
	for(int i=0;i<n;i++)
		for(int j=0;j<10;j++)
			cin>>f[i][j];
	for(int i=0;i<n;i++)
		for(int j=0;j<11;j++)
			cin>>p[i][j];
	for(int i=1;i<(1<<10);i++){
		int prof=0;
		for(int j=0;j<n;j++){
			int c=0;
			for(int k=0;k<10;k++)
				if(i&1<<k&&f[j][k])
					c++;
			prof+=p[j][c];
		}
		ans=max(prof,ans);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
long long Max(long long a,long long b){return a>b?a:b;}
int n,k;
long long a[100005],sum[200005],ans,ksum[200005];
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++){scanf("%lld",&a[i]);if(a[i]>0) sum[i]+=a[i];sum[i]+=sum[i-1];ksum[i]=ksum[i-1]+a[i];}
	for(int i=0;i<=n;i++)
	{
		if(i+k>n) break;
		else ans=Max(ans,sum[i]+sum[n]-sum[i+k]+Max(0,1ll*ksum[i+k]-ksum[i]));
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 1e9+7, INF = 1e18;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}


struct UnionFind{
int uf[100010];
int rank1[100010];

//n要素で初期化
void init(int n){
  for(int i=0;i<n;i++){
    uf[i]=i;
    rank1[i]=0;
  }
}

//木の根を求める
int find(int x){
  if(uf[x]==x){
    return x;
  } else {
    return uf[x]=find(uf[x]);
  }
}

//xとyの属する集合を併合
void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y) return;

  if(rank1[x]<rank1[y]){
    uf[x]=y;
  }else{
    uf[y]=x;
    if(rank1[x]==rank1[y])rank1[x]++;
  }
}

//xとyが同じ集合に属するか否か
bool same(int x,int y){
return find(x)==find(y);
}
};
//arc-d65 連結　latteさん
//UF uf;
//uf.init(n)をわすれない
struct UF{
    vector<int>par,sz;
    void init(int n){
        par.resize(n);
        sz.resize(n);
        for(int i=0;i<n;i++){
            par[i]=i;
            sz[i]=1;
        }
    }
    int find(int x){
        return x==par[x]?x:par[x]=find(par[x]);
    }
    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return;
        sz[x]+=sz[y];
        par[y]=x;
    }
    bool same(int x,int y){
        return find(x)==find(y);
    }
    int size(int x){
        return sz[find(x)];
    }
};

signed main(){
	int N,R;
	cin>>N>>R;
	vector<int>p(N);
	UF uf;
	uf.init(N);
	REP(i,N){
		cin>>p[i];
		p[i]--;
		if(p[i]!=i)uf.unite(i,p[i]);
	}
	vector<int>cnt(300030,0);
	vector<int>used(300030,0);
	REP(i,N){
		if(used[uf.find(i)])continue;
		cnt[uf.size(i)]++;
		used[uf.find(i)] = true;
	}
	vector<pair<int,int>>v;
	REP(i,300030){
		if(cnt[i])v.push_back({i,cnt[i]});
	}
	vector<int>dp(300030,-1);
	dp[0] = 1;
	REP(i,v.size()){
		REP(j,R+1){
			if(dp[j] >= 0){
				dp[j] = v[i].second;
			}else if(j < v[i].first || dp[j - v[i].first] <= 0){
				dp[j] = -1;
			}else {
				dp[j] = dp[j - v[i].first] - 1;
			}
		}
	}
	if(dp[R] >= 0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 16804
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        N=int(input())
        for h in range(1,3501):
            for n in range(h,3501):
                if 4*h*n-N*n-N*h==0:
                    continue
                else:
                    temp=(N*h*n)/(4*h*n-N*n-N*h)
                    if temp>0 and temp.is_integer():
                        return [h,n,int(temp)]
    for i in main():
        print(i,end=' ')


resolve()

Measured memory_bytes: 39024
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

const ll MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    map<int, int> counts;
    for (int i = 0; i < N; i++) cin >> a[i];
    for(int i = 0; i < N; i++) counts[a[i]]++;
 
    vector<int> keys;
    for (auto it = counts.begin(); it != counts.end(); it++)
    {
        keys.push_back(it->first);
    }
    sort(keys.begin(), keys.end());
 
    int entries = keys.size();
    if(entries == 1){
        if(keys[0] == 0){
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else if(entries == 2){
        if(keys[0] == 0){
            if(counts[keys[0]] * 3 == N){
                cout << "Yes" <<endl;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;
        }
    } else if(entries == 3){
        if(counts[keys[0]] == counts[keys[1]] && counts[keys[1]]== counts[keys[2]]){
            if((keys[0] ^ keys[1]) == keys[2]){
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;
        }
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 7672
/**
*    author:  yuya1234
*    created: 09.07.2020 17:04:17
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define ALL(v) (s).begin(), (s).end()
#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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

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

  int n,x;
  cin>>n>>x;

  vector<int> v;
  int tmp;
  REP(i,n)
  {
    cin>>tmp;
    v.emplace_back(tmp);
  }
  v.emplace_back(x);

  SORTD(v);
  ll ans=INT_MAX,diff=0,pre;
  pre=v[0]-v[1];
  REP(i,n)
  {
    diff=gcd(pre,v[i]-v[i+1]);
    if(ans>diff)
    {
      ans=diff;
      pre=diff;
    }
  }

  cout<<ans<<endl;



  return 0;
}

Measured memory_bytes: 3876
#include<stdio.h>

int main(void){
  int i,pi;
  int a[100000]={0},b[100000]={0};
  int x,y;

  for(i=0;scanf("%d%d",&a[i],&b[i])==2;i++){}
  pi=i;
  for(i=0;i<pi;i++){
    x=a[i];
    y=b[i];
    for(;;){
      if(a[i]>b[i])       a[i]-=b[i];
      else if(a[i]<b[i])  b[i]-=a[i];
      else{
        printf("%d ",a[i]);
        break;
      }
    }
    x/=a[i];
    printf("%d\n",x*y);
  }
  return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    map<string, ll> cnt;
    ll ans = 0;
    rep(i,n){
        cin >> s;
        sort(s.begin(), s.end());
        ans += cnt[s]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11264
#include <stdio.h>
#include <stdlib.h>
int main () {
  int x,y,v=1,tmp;
  scanf("%d%d",&x,&y);
  if(x<1 || x>1000000000) exit(8);
  if(y<1 || y>1000000000) exit(8);
  if(y>x)
    {
      tmp = y;
      y = x;
      x = tmp;
    }  
  while(v!=0)
    {
      v = x%y;
      x = y;
      y = v;
    }
  printf("%d\n",x);
  return 0;
}



Measured memory_bytes: 2124
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<numeric>
#include<set>
#include<map>
#include<deque>
#include<list>
#include<forward_list>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define ll long long
#define v vector<ll>
const ll w = (1e9 + 7);
using namespace std;
void fireman()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
struct great {
	//descending order
	bool operator()(int x, int y)
	{
		return (x < y);
	}
};


struct small {
	//asecending order
	bool operator()(int x, int y)
	{
		return x > y;
	}
};

bool prime(int x)
{
	bool b = true;
	if (x == 2)
	{
		return true;
	}
	else if (x == 1 || x % 2 == 0)
	{
		return false;
	}
	for (int i = 3; i * i <= x; i += 2)
	{
		if (x % i == 0)
		{
			b = false;
			return false;
			break;
		}
	}
	return true;
}
bool great1(int a, int b)
{
	//descending order 
	return a > b;
}
bool small1(int a, int b)
{
	//asecending order 
	return a < b;
}
/*int sum_range(ll i, ll j, ll k, ll l, vector<vector<ll>>& S) {
	return S[k][l] - S[k][j - 1] - S[i - 1][l] + S[i - 1][j - 1];
}*/

int gcd(int a, int b)
{
	return b ? gcd(b, a % b) : a;
}

int lcm(int a, int b)
{
	return a / gcd(a, b) * b;
}
int modpow(ll a, ll b, ll c)//fast_power log(n)
{
	if (b == 0)
		return 1 % c;
	ll u = modpow(a,b/2,c);
	u = (u * u) % c;
	if(b&1)
		u = (u * a) % c;
	return u;
}



int main()
{
	fireman();
	int t;
	cin >> t;
	int a = 0, b = 0, c = 0, d = 0;
	while (t--)
	{
		string x;
		cin >> x;
		if (x == "AC")
			a++;
		else if (x == "WA")
			b++;
		else if (x == "TLE")
			c++;
		else
			d++;
	}
	cout << "AC " << "x " << a << endl;
	cout << "WA " << "x " << b << endl;
	cout << "TLE " << "x " << c << endl;
	cout << "RE " << "x " << d << endl;
}




Measured memory_bytes: 3648
import sys

def main():
    lines = sys.stdin.readlines()

    n_max = 0
    sum_var = 0
    min_var = 0
    max_var = 0
    for index, line in enumerate(lines):
        if index == 0:
            line = line.strip('\n')
            n_max = int(line)
            # print(n_max)
        elif index == 1:
            line = line.strip('\n')
            elems = line.split(" ")
            min_var = int(elems[0]) # put a value of first elem as minimum num.
            max_var = int(elems[0])
            for elem in elems:
                elem = int(elem)
                if elem < min_var:
                    min_var = elem
                if elem > max_var:
                    max_var = elem
                sum_var += elem

    print min_var, max_var, sum_var

if __name__ == "__main__":
    main()

Measured memory_bytes: 6960
n,m,x,y=map(int,input().split())
x_i=list(map(int,input().split()))
y_i=list(map(int,input().split()))
x_i.append(x)
y_i.append(y)
if max(x_i)<min(y_i):
  print("No War")
else:
  print("War")

Measured memory_bytes: 3060
n, m = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]
ab = sorted(ab, key=lambda x: x[0])
ans = 0
for a, b in ab:
    if m - b > 0:
        ans += a*b
        m -= b
    elif m == b:
        ans += a*b
        m -= b
        break
    else:
        ans += a*m
        break
print(ans)

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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int T = 2e5 + 2;
ll l[T];
ll r[T];

int main() {
    ios_base::sync_with_stdio(false);
    int n; cin >> n;
    for(int i = 1; i <= n; i++) {
        int x; cin >> x;
        if(i-x >= 1) l[i-x]++;
        if(i+x <= n) r[i+x]++;
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++) ans += l[i]*r[i];
    cout << ans << endl;
    return 0;
}



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

using namespace std;

/***template***/
#define ll                   long long
#define dd                   double
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define pi                   pair<ll,ll>
#define pb                   push_back
#define mp                   make_pair
#define uu                   first
#define vv                   second
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define FOOR(i,a,b)          for(ll i=a;i<=b;i++)
#define LOP(i,a,b)           for(ll i=a;i<b;i++)
#define sorted(s)            sort(s.begin(),s.end())
#define reversed(s)          reverse(s.begin(),s.end())
#define contains(a,b)        (find((a).begin(), (a).end(), (b)) != (a).end())
#define MAXN                 10004
#define pii                  3.1415926536
#define mod                  1000000007
#define eps                  0.0000000001
#define inf                  9000000000000000
#define mstt(a,b)            memset((a),(b),sizeof (a))

int main()
{
    ll a,b;
    scl(a);
    scl(b);
    ll x=a+b;
    if((a%3) == 0 || (b%3) == 0 || (x%3) == 0)
        printf("Possible\n");
    else
        printf("Impossible\n");
    return 0;
}





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

int main()
{
    string ans = "NO";
    int A,B,C;
    cin >> A >> B >> C;
    
    for(int i = 1; i <= B; i++)
    {
       if( (A * i) % B == C)
       {
           ans = "YES";
           break;
       } 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
"use strict";

function main(input) {
    input = input.split(/\n|\s/)
    const a = ~~input[0]
    const b = ~~input[1]
    const s = input[2].split('-')

    let ans = 'No'
    if (s[0].length === a && s[1].length === b && s[0].match(/^[0-9]+$/) && s[1].match(/^[0-9]+$/)) {
        ans = 'Yes'
    }
    console.log(ans)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;

typedef long long ll;

const int NM_MAX = 14;

int n, m, x;

int c[NM_MAX];
int ma[NM_MAX][NM_MAX];

int s[NM_MAX];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> x;
    for(int i = 1; i <= n; i++)
    {
        cin >> c[i];
        for(int j = 1; j <= m; j++)
            cin >> ma[i][j];
    }
    int ans = INT_MAX;
    for(int mask = 0; mask <= (1 << n) - 1; mask++)
    {
        int cost = 0;
        for(int i = 1; i <= m; i++)
            s[i] = 0;
        for(int i = 1; i <= n; i++)
            if((mask >> (i - 1)) & 1)
            {
                cost += c[i];
                for(int j = 1; j <= m; j++)
                    s[j] += ma[i][j];
            }
        bool ok = true;
        for(int i = 1; i <= m; i++)
            if(s[i] < x)
                ok = false;
        if(ok == true)
            ans = min(ans, cost);
    }
    if(ans == INT_MAX)
        cout << "-1\n";
    else
        cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3660
S = input()
cnt,ans=0,0
for i in S:
    #print(i)
    if i in "ACGT":
        cnt += 1
        #print(cnt)
    else:
        #print(cnt,c)
        ans = max(ans,cnt)
        #print(ans)
        cnt = 0
ans = max(ans,cnt)
print(ans)


Measured memory_bytes: 9096
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <queue>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;
//typedef long long int;

char s[2005][2005];
int dw[2005][2005];
int nx[2005], pr[2005];
int h, w;

void rem(int j) {
  if (nx[j] < w-1) pr[nx[j]] = pr[j];
  if (pr[j] >= 0) nx[pr[j]] = nx[j];
}

int main() {
//  std::ios::sync_with_stdio(false); std::cin.tie(0);
  scanf("%d%d", &h, &w);
  for (int i = 0; i < h; ++i) {
    scanf("%s", s[i]);
    for (int j = 0; j < w; ++j) {
      s[i][j] = s[i][j] == '#' ? 1 : 0;
    }
  }
  for (int j = 0; j < w; ++j) dw[h-1][j] = 1;
  for (int i = h-2; i >= 0; --i) {
    for (int j = 0; j + 1 < w; ++j) {
      if ((s[i][j] ^ s[i][j+1]) != (s[i+1][j] ^ s[i+1][j+1])) dw[i][j] = 1;
      else dw[i][j] = dw[i+1][j] + 1;
    }
  }
//  for (int j = 0; j < w-1; ++j) cerr << dw[0][j] << endl;
  int res = max(h, w);
  vii q(w-1);
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w-1; ++j) {
      q[j] = pii(dw[i][j], j);
      nx[j] = j + 1;
      pr[j] = j - 1;
    }
    sort(q.rbegin(), q.rend());
    for (pii p : q) {
      int j = p.second;
      res = max(res, p.first * (nx[j] - pr[j]));
      rem(j);
    }
  }
  printf("%d\n", res);
  return 0;
}

Measured memory_bytes: 19968
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        String[] inputs = input.split(" ");
        int notes =  Integer.valueOf(inputs[0]);
        int value = Integer.valueOf(inputs[1]);
        int maxOnes = value/1000;
        if(notes>maxOnes) {
            System.out.println("-1 -1 -1");
            return;
        }

        if(notes==maxOnes) {
            System.out.println("0 0 "+maxOnes);
            return;
        }

        int reduceNotes = maxOnes-notes;
        int maxTens = reduceNotes/9;
        int maxFives = reduceNotes/4;
        for(int i = 0 ; i<=maxTens ; i++ )
            for( int j = 0 ; j<=maxFives ;j++) {
                if ( i*9 + j*4 == reduceNotes) {
                    int onesLeft = maxOnes-(i*10)-(j*5);
                    if(onesLeft<0) {
                        continue;
                    }
                    System.out.println(i+" "+j+" "+onesLeft);
                    return;
                }
            }
        System.out.println("-1 -1 -1");
    }

}




Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n, k, q;
int a[N];

int main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n >> k >> q;
	for(int i=0; i<q; i++){
		int pos; cin >> pos;
		a[pos]++;
	}
	for(int i=1; i<=n; i++){
		if (a[i]+k-q > 0) cout << "Yes\n";
		else cout << "No\n";
	}
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
    char *s = "keyence";
    string st;
    cin >> st;
    bool ans = false;
    for(int i=0;i<8;i++){
        string str1(s,s+i);
        string str2(s+i,s+7);
        
        string sub1 = st.substr(0,i);
        string sub2 = st.substr(st.size()-(7-i),7-i);

        if(sub1 == str1 && sub2 == str2){
            ans = true;
            break;
        }
    }

    if(ans){
        cout << "YES";
    }else{
        cout << "NO";
    }


    cout << endl;
}

Measured memory_bytes: 256
import java.util.*;

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

    int n = sc.nextInt();
    int[] p = new int[n];
    int ans = 0;

    for(int i = 0; i < n; i++){
      p[i] = sc.nextInt();
    }

    for(int i = 1; i < n - 1; i++){
      if(((p[i - 1] > p[i]) && (p[i] > p[i + 1])) || ((p[i - 1] < p[i]) && (p[i] < p[i + 1]))){
        ans += 1;
      }
    }

    System.out.println(ans);
  }
}


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

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//配列の受け取り

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗する

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) の絶対値

main(){
  int a=in(),b=in(),k=in(),i2=0;
  for (int i=min(a,b);i>0;i--){
    if (a%i==0 && b%i==0) {
      i2++;
    }
    if (i2==k) {
      cout << i << endl;
      return 0;
    }
  }
}

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

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

    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    rep(i, n) {
        cin >> v[i];
    }
    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(v[i] >= k)
            ans++;
    }
    cout << ans << "\n";
    return 0;
}


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

vector<int> edge[200001];
int a[200001];

void dfs(int x,int p){
	for(int it:edge[x]){
		if(p==it)	continue;
		a[it]+=a[x];
		dfs(it,x);
	}
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,q;
	cin>>n>>q;
	for(int i=1,x,y;i<n;i++){
		cin>>x>>y;
		edge[x].emplace_back(y);
		edge[y].emplace_back(x);
	}
	for(int i=1,p,x;i<=q;i++){
		cin>>p>>x;
		a[p]+=x;
	}
	dfs(1,0);
	for(int i=1;i<=n;i++)
		cout<<a[i]<<' ';
	cout<<endl;
}


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

int main() {
    uint64_t h; cin >> h;

    uint64_t ret = 1, n = 1;
    while (1 < h) {
        h /= 2;
        ret += n * 2;
        n *= 2;
    }

    cout << ret << endl;
}

Measured memory_bytes: 256