akhauriyash/Code-Regression huggingface dataset:
/*|In The Name Of Allah|*/
//This Month Will Be Expert ISA
#include <bits/stdc++.h>

using namespace std;

int n;
int k;
string s;
int mem[111][2][4][2];

int go(int idx , int les , int lft , int smS){
    if(idx == n)
        return lft == 0;
    if(~mem[idx][les][lft][smS])
        return mem[idx][les][lft][smS];
    int cnt = 0;
    for(int i = ((idx == 0) ? 1 : 0); i <= 9; i++){
        if( les && lft - (i != 0) >= 0 && smS ){
            cnt += go(idx + 1 , 1 , lft - (i != 0) , smS);
        } else if( !les && i <= s[idx] - '0' && lft - (i != 0) >= 0 && smS ){
            bool nwles = (i < s[idx]-'0');
            cnt += go(idx + 1 , nwles , lft - (i != 0) , smS);
        } else if(!smS && lft - (i != 0) >= 0) {
            cnt += go(idx + 1 , 1 , lft - (i != 0) , smS);
        }
    }
    return mem[idx][les][lft][smS] = cnt;
}

int main(){
    cin >> s >> k;
    memset(mem , -1 , sizeof mem);
    int ans = 0;
    for(int i = 1; i <= s.size(); i++){
        memset(mem , -1 , sizeof mem);
        n = i;
        ans += go(0 , 0 , k , i == s.size());
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

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

    vector<P> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i].first;
        A[i].second = i;
    }
    sort(A.begin(), A.end());

    vector<int> ans(N);
    for(int i=0;i<N;i++){
        ans[A[i].second] = i < N / 2 ? A[N / 2].first : A[N / 2 - 1].first;
    }

    for(int a : ans){
        cout << a << endl;
    }

    return 0;
}

Measured memory_bytes: 4480
using System;
using static System.Console;
using static System.Math;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = ReadLine();
            string[] l = line.Split(' ');
            long a = long.Parse(l[0]);
            long b = long.Parse(l[1]);
            long c = long.Parse(l[2]);

            if (a + b < c && (4 * a * b) < ((c - a - b) * (c - a - b)))
            {
                Write("Yes");
            }
            else
            {
                Write("No");
            }
        }
    }
}

Measured memory_bytes: 11092
N,A,B,C=[int(s) for s in input().split()]
ls=[int(input()) for i in range(N)]
def four(n):
  val_n=n
  val_ls=[0 for s in range(N)]
  for i in range(N):
    val_ls[i]=val_n%4
    val_n=val_n//4
  return val_ls
def mp(ls,n):
  if ls[0]==0:
    return 10000
  else:
    return 10*(ls[0]-1)+abs(ls[1]-n)
ans=30000
for i in range(4**N):
  take_ls=[[0,0],[0,0],[0,0],[0,0]] #A,B,C,None
  go_ls=four(i)
  for j in range(N):
    take_ls[go_ls[j]][0]+=1
    take_ls[go_ls[j]][1]+=ls[j]
  mp_use=mp(take_ls[0],A)+mp(take_ls[1],B)+mp(take_ls[2],C)
  if mp_use<ans:
    ans=mp_use
print(ans)
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  set<int> U;
  int n;
  cin >> n;
  set<int> A;
  for (int i = 0; i < n; i++){
    int a;
    cin >> a;
    A.insert(a);
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++){
    int b;
    cin >> b;
    if (A.count(b)){
      U.insert(b);
    }
  }
  for (auto itr = U.begin(); itr != U.end(); itr++){
    cout << *itr << endl;
  }
}


Measured memory_bytes: 14332
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


class SegTree:
    X_unit = 0
    X_f = max

    def __init__(self, N):
        self.N = N
        self.X = [self.X_unit] * (N + N)

    def build(self, seq):
        for i, x in enumerate(seq, self.N):
            self.X[i] = x
        for i in range(self.N - 1, 0, -1):
            self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1])

    def set_val(self, i, x):
        i += self.N
        self.X[i] = x
        while i > 1:
            i >>= 1
            self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1])

    def fold(self, L, R):
        L += self.N
        R += self.N
        vL = self.X_unit
        vR = self.X_unit
        while L < R:
            if L & 1:
                vL = self.X_f(vL, self.X[L])
                L += 1
            if R & 1:
                R -= 1
                vR = self.X_f(self.X[R], vR)
            L >>= 1
            R >>= 1
        return self.X_f(vL, vR)


def main():
    n, k = input_int_list()
    segtree = SegTree(300001)
    for _ in range(n):
        a = input_int()

        val = segtree.fold(max(0, a - k), min(300001, a + k + 1))
        segtree.set_val(a, val + 1)

    print(segtree.X[1])

    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 75732
#include <cstdio>
#include <cmath>
#define MAX 1002
using namespace std;

int Lcc(const char *X, const char *Y) {
    int lcc = 0;
    int dp[MAX][MAX];
    for (int i=0; i<MAX; i++)
        for (int j=0; j<MAX; j++) dp[i][j] = 0;

    int x=1, y=1;
    for (int i=0;;i++) {
        if (X[i] == ',') {x = i;break;}
        for (int j=0;;j++) {
            if (Y[j] == ',') {
                y = j;
                break;
            }
            if (Y[j] == ',') {
                y = j;
                break;
            } else {
                if (X[i] == Y[j]) {
                    dp[i+1][j+1] = fmax(dp[i][j] + 1, dp[i+1][j]);
                } else {
                    dp[i+1][j+1] = fmax(dp[i+1][j], dp[i][j+1]);
                }
            }
        }
    }
    return dp[x-1][y-1];
}

int
main()
{
    int q;
    scanf("%d", &q);
    for (int i=0; i<(q); i++) {
        char X[MAX], Y[MAX];
        for (int i=0; i<MAX; i++) {
            X[i] = ','; Y[i] = ',';
        }
        scanf(" %s", X);scanf(" %s", Y);
        int LCC = Lcc(X, Y);
        printf("%d\n", LCC);
    }
    return 0;
}

Measured memory_bytes: 4952
import java.util.Scanner;

public class Main {
	static long []p;
	static long []l;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long X = sc.nextLong();
		sc.close();
		p = new long[N + 1];
		l = new long[N + 1];
		p[0] = 1;
		l[0] = 1;
		for(int i = 1; i <= N; i++) {
			p[i] = 2 * p[i - 1] + 1;
			l[i] = 2 * l[i - 1] + 3;
		}
		long ans = rec(N, X);
		System.out.println(ans);
	}
	static long rec(int n, long x) {
		if(n == 0) {
			return 1;
		}
		if(x <= 1) {
			return 0;
		}else if(x < l[n - 1] + 1) {
			return rec(n - 1, x - 1);
		}else if(x == l[n - 1] + 1) {
			return p[n - 1];
		}else if(x == l[n - 1] + 2){
			return p[n - 1] + 1;
		}else if(x < l[n]){
			return rec(n - 1, x - (l[n - 1] + 2)) + p[n - 1] + 1;
		}else {
			return 2 * p[n - 1] + 1;
		}
	}
}


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

int main() {
    char n[3];
    cin >> n;
    for (int i = 0; i < 3; i++) {
        if (n[i] == '7') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3036
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
ll n,m,q;
vll a,b,c,d;
ll ans=0;
void dfs(vll A){
  if(sz(A)==n+1){
    ll now=0;
    rep(i,q){
      if(A[b[i]]-A[a[i]]==c[i])now+=d[i];
    }
    ans=max(ans,now);
    return ;
  }
  A.pb(A.back());
  while(A.back()<=m){
    dfs(A);
    A.back()++;
  }
}
int main(){
  cin>>n>>m>>q;
  a=b=c=d=vll(q);
  rep(i,q){
    cin>>a[i]>>b[i]>>c[i]>>d[i];
  }
  dfs(vector<ll> (1,1));
  COUT(ans);
}


Measured memory_bytes: 3640
#include<stdio.h>

int main()
{
	char s[3];
	scanf("%s",s);
	int count=0;
	for(int i=0;i<3;i++)
	{
		if(s[i]=='1')
		{
			count++;
		}
	}
	printf("%d \n",count);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){
    int i;
    double n,sum,s[1000]={},m,alpha;

    cout << fixed << setprecision(8);
    while(cin >> n){
        if(n == 0) break;
        for(i=0;i<n;i++){
            cin >> s[i];
            sum += s[i];
        }
        m = sum / n;
        sum = 0;
        for(i=0;i<n;i++) sum += pow(s[i] - m, 2);
        alpha = sqrt(sum / n);
        cout << alpha << endl;

        sum = 0;
        for(i=0;i<n;i++) s[i] = 0;
    }
}



Measured memory_bytes: 3264
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#include <vector>
int partition(vector<int>& A,int p,int r){
    int x = A[r];
    int i = p-1;
    int t;
    for(int j=p;j<r;j++){
        if(A[j] <= x){
            i++;
            t = A[i];
            A[i] = A[j];
            A[j] = t;
            // i++;
        }
    }
    
    t = A[i+1];
    A[i+1] = A[r];
    A[r] = t;
    return i+1;
}
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N){
        cin >> A[i];
    }
    int pivot = partition(A,0,N-1);
    rep(i,N){
        if(i==pivot){
            cout << "[" << A[i] << "]";
        }else{
            cout << A[i];
        }
        if(i < N-1){
            cout << " ";
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;
using ll = long long;

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 dp[100005];

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    for(int i = 0; i < 100005; i++) dp[i] = 1001001001;

    dp[0] = 0;

    for(int i = 1; i < n; i++){
        for(int j = 1; j <= k; j++){
            if(i-j >= 0)
            chmin(dp[i], dp[i-j] + abs(h[i]-h[i-j]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 3992
n = int(input())
p = []
l = [0]*n
count = 0
for i in range(n):
    count = count + 1
    p1 = int(input())
    p.append(p1)
    l[p1-1] = count
count1 = 1
l2 = [1]
for i in range(n-1):
    if l[i] <  l[i+1]:
        count1 = count1 + 1
        l2.append(count1)
    else:
        count1 = 1
print(n-max(l2))

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

int main()
{
	char A[12], B[12], C[12];
	scanf("%s %s %s", A, B, C);

	int alen, blen, clen;
	alen = strlen(A);
	blen = strlen(B);
	clen = strlen(C);

	if (A[alen - 1] == B[0] && B[blen - 1] == C[0])printf("YES");
	else printf("NO");

	return 0;
}

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

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
//#define gcd __gcd
//#define lcm(a, b) ((a) * (b) / gcd((a), b))
#define all(x) x.begin(), x.end()
#define rep(i, x, n) for (ll i = x; i < n; i++)
#define fastio() ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0)
#define endl '\n'

typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> ii;
typedef vector<pair<int, int> > vii;

template <class T> inline T RD(T &a) {T x; cin >> x; return a = x;}

//OJ freopen Template

const float pi = acos(-1);

signed main()
{
	fastio();

	ll n, c; cin >> n >> c;
	ll cnt = 0, t;
	for (ll i = 0; i < c; i++) {
        cnt += RD(t);
	}
	cout << max(n - cnt, -1ll);
}


Measured memory_bytes: 3648
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long A, P;
    scan(A, P);
    writeln((3 * A + P) / 2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  int n; cin>>n;
  vector<ll> num(n);
  for(int i=0;i<n;i++){
    cin>>num[i];
  }
  ll sum=0,base=0,ans=0,count=0,log=0;
  for(int i=0;i<n;i++){
    sum+=num[i]; base^=num[i];
    if(sum==base){
      count++;
      ans+=count;
    }else{
      count++;
      while(sum!=base){
        count--;
        base^=num[log]; sum-=num[log];
        log++;
      }
      ans+=count;
    }
  }
  cout<<ans<<endl;
}   

Measured memory_bytes: 1792
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}



int main() {

	ll A, B,K;
	cin >> A >> B>>K;
	ll i = max(A,B);
	while (K > 0) {
		if (A % i == 0 && B % i == 0) {
			
			K--;
			i--;
		}
		else {
			i--;
		}
	}
	cout << i+1 << endl;
}


Measured memory_bytes: 256
# encoding: utf-8
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

x_max = max(x)
y_min = min(y)

ans = "War"
for z in range(X + 1, Y + 1):
    if x_max < z <= y_min:
        ans = "No War"
        break

print(ans)

Measured memory_bytes: 3064
import sys
import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to only numbers
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

K = ri()
A = np.ones(50, dtype=np.int64)
A *= 49
x, y = divmod(K, 50)
A += x
A[:y] += 50 - (y-1)
A[y:] -= y
print(50)
print(*A)
# 59

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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,N) for(int i=0; i<N; i++)
#define cinv(v,N) vector<int> v(N); for(int i=0; i<N; i++){ cin >> v[i]; }
#define mt make_tuple
const ll MOD2 = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int H, W, K; cin >> H >> W >> K;
  vector<string> s(H);
  vector<vector<int>> ans(H,vector<int>(W,0));
  
  for(int i=0; i<H; i++){
    cin >> s[i];
    //cout << s[i] << endl;
  }
  
  //vector<bool> isDivided(H,0);
  vector<int>  howMany(H,0);
  
  //main
  int first; 
  bool isFirst = true;
  
  for(int i=0; i<H; i++){
    if(s[i].find('#') >= W){
      continue;
    }else{
      if(isFirst){ first = i;}
      for(int j=0; j<W; j++){
        if(s[i][j] == '#'){ 
          //isDivided[i] = true;
          howMany[i] ++; 
        }
      }
      isFirst = false;
    }
  }
  
  int n = 1;
  for(int i=0; i<H; i++){
    int count = 0;
    if(howMany[i] == 0){ continue; }
    for(int j=0; j<W; j++){
      if(s[i][j] == '.'){
        ans[i][j] = n; 
      }else if(count+1 == howMany[i]){//最後
        ans[i][j] = n; 
        count ++;
      }else{
        ans[i][j] = n; 
        count ++;
        n ++;
      }
    }
    n++;
  }
  
  for(int i=first+1; i<H; i++){
    if(howMany[i] != 0){ continue; }
    FOR(j,W){ans[i][j] = ans[i-1][j];}
  }
  for(int i=first-1; i>=0; i--){
    FOR(j,W){ans[i][j] = ans[i+1][j];}
  }
    
  //}
  
  // output
  //if(){cout << ans << endl;}
  //else{cout << ans << endl;}
  //cout << first << endl;
  
  for(int i=0; i<H; i++){
    //cin >> s[i];
    FOR(j,W){ cout << ans[i][j] << " "; }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int x; scanf("%d", &x);
	if(x >= 30) printf("Yes\n");
	else printf("No\n");
}


Measured memory_bytes: 3628
n=int(input())
dp=[[0]*3 for _ in range(n)]
dp[0]=list(map(int,input().split()))
for i in range(1,n):
    a,b,c=map(int,input().split())
    dp[i][0]=a+max(dp[i-1][1],dp[i-1][2])
    dp[i][1]=b+max(dp[i-1][0],dp[i-1][2])
    dp[i][2]=c+max(dp[i-1][0],dp[i-1][1])
print(max(dp[n-1]))

Measured memory_bytes: 24820
import java.util.*;

public class Main {
    public static void main(String[] args) {	
	Main main = new Main();
    	main.solveC();
    }
    
    private void solveA() {
    	Scanner sc = new Scanner(System.in);
    	String s = sc.next();
	if (s.contains("a") && s.contains("b") && s.contains("c"))
	    {
		System.out.println("Yes");
	    }
	else {
	    System.out.println("No");
	}
    }

    private void solveB() {
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
    	int b = sc.nextInt();
	int k = sc.nextInt();

	for(int i=a; i <= b; i++){
	    if (i<a+k || i>b-k) System.out.println(i);
	}
    }
    private void solveC() {
	Scanner sc = new Scanner(System.in);
	int[] a = new int[3];
	a[0] = sc.nextInt();
	a[1] = sc.nextInt();
	a[2] = sc.nextInt();

	Arrays.sort(a);

	int ans1 = a[2] - a[1];
	int ans2 = a[2] - a[0] - ans1;
	int ans = ans1 + ans2/2 + ans2%2*2;

	System.out.println(ans);

    }
}


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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    string s;
    cin >> s;
    if(s[1] == 'B')
        s[1] = 'R';
    else
        s[1] = 'B';
    cout << s << endl;
    return 0;
}
// ===========================================

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

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


Measured memory_bytes: 3624
#include<stdio.h>

int main(void){
  int n,i,count,ans =0;
  int h[100] = {0};
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&h[i]);
  }
  while(1){
    if(h[0]!=0){
      count = 1;
      for(i=0;i<n-1;i++){
          if(h[i]==0 && h[i+1]!=0){
              count +=1;
          }
      }
    }else{
      count = 0;
      for(i=0;i<n-1;i++){
          if(h[i]==0 && h[i+1]!=0){
              count +=1; 
          }
      }
    }
    if(count == 0){
      break;
    }
    for(i=0;i<n;i++){
      if(h[i]!=0){
        h[i] -=1;
      }
    }
    ans += count;
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

template<typename T>
void cout_vec(vector<T> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

int main(){
    ll N, K;
    cin >> N >> K;

    vector<ll> vec(N+2,0LL);
    for(int i=0; i<N+1; i++){
        vec[i+1]=vec[i]+i;
    }
    //cout_vec(vec);

    ll ans=0;
    for(int i=K; i<=N+1; i++){
        ans+=vec[N+1]-vec[N+1-i]-(vec[i]-vec[0])+1;
        //cout << ans << endl;
        ans%=MOD;
    }
    cout << ans << endl;

}

Measured memory_bytes: 4788
// Replace ’A’ with ’1’ and ’B’ with ’2’. 
// We claim that we can convert a string s to another string t if and only if 
// the sum of digits of s and the sum of digits of t are equivalent in modulo 3

// the operations are revertable

#include<iostream>
using namespace std;

const int maxn = 1e5;
int pres[maxn+5];
int pret[maxn+5];

int main() {
    string s, t;
    cin>>s>>t;
    pres[0] = pret[0] = 0;
    for (int i = 0; i < s.size(); ++i)
        pres[i+1] = (pres[i] + s[i] - 'A' + 1) % 3;
    for (int i = 0; i < t.size(); ++i)
        pret[i+1] = (pret[i] + t[i] - 'A' + 1) % 3;
    
    int q;
    cin>>q;
    
    while (q--) {
        int a, b, c, d;
        cin>>a>>b>>c>>d;
        int temp1 = (pres[b]-pres[a-1]+3)%3;
        int temp2 = (pret[d]-pret[c-1]+3)%3;
        cout<<(temp1 == temp2 ? "YES" : "NO")<<endl;
    }
}

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define repa(X,A,Y) for (int (X) = A;(X) <= (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 100000;
int N;
int A[MAX_N];

//gcd(a, b)を求める。
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}


//整数a,bに対し、ax + by = gcd(a,b) を満たす整数x,y,gcd(a,b) を計算する
int extgcd(int a, int b, int& x, int& y) {
  int d = a;
  if (b != 0) {
    d = extgcd(b, a%b, y, x);
    y -= (a/b) * x;
  } else {
    x = 1; y = 0;
  }
  return d;
}

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

  cin >> N;
  rep(i, N) cin >> A[i];

  if (N == 1) {
      cout << A[0] << endl;
      return 0;
  }

  int g = gcd(A[0], A[1]);
  for (int i = 2; i < N; ++i) {
      g = gcd(g, A[i]);
  }

  cout << g << endl;

  return 0;
}



Measured memory_bytes: 1144
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        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 K = sc.nextInt();
        System.out.println(a[K-1]);
    }
}

Measured memory_bytes: 21972
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define pque(type) priority_queue<type,vector<type>,greater<type> >
 
int main(void){
	int n;
	cin >> n;
	vector<int> c(9, 0);
	rep(i, n){
		int t;
		cin >> t;
		c[((t/400)<=8)?(t/400):8]++;
	}
	int ans = 0;
	rep(i, 8) if(c[i] != 0) ans++;
	if(ans == 0) cout << 1 << " " << c[8] << endl; 
	else cout << ans << " " << ans + c[8] << endl;	
	return 0;
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
       PROGRAM-ID. test1.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 INP PIC X(100).
       01 A PIC 99999999.
       01 B PIC 99999999.
       01 C PIC 99999999.
       01 temp1 PIC 999999.
       01 temp2 PIC 999999.
       01 temp3 PIC 999999.
       01 temp4 PIC 999999.
       01 N PIC 999999.
       01 S PIC 999999.
       01 T PIC 999999.
       01 NOW1 PIC 999999.
       01 NOW2 PIC 999999.
       01 NOW3 PIC 999999.
       PROCEDURE DIVISION.
       MAIN.
      	ACCEPT S.
      	PERFORM VARYING T FROM 1 BY 1 UNTIL T > S
       		ACCEPT INP
      		PERFORM VARYING temp1 FROM 1 
      			BY 1 UNTIL INP(temp1:1)=SPACE
      		END-PERFORM
      		SUBTRACT 1 FROM temp1
      		MOVE INP(1:temp1) TO A
      		ADD 2 TO temp1
      		PERFORM VARYING temp2 FROM temp1 
      			BY 1 UNTIL INP(temp2:1)=SPACE
      		END-PERFORM
      		COMPUTE N=temp2 - temp1
      		MOVE INP(temp1:N) TO B
      		ADD 1 TO temp2
      		PERFORM VARYING temp1 FROM temp2 
      			BY 1 UNTIL INP(temp1:1)=SPACE
      		END-PERFORM
      		COMPUTE N=temp1 - temp2
      		MOVE INP(temp2:N) TO C
      		COMPUTE temp1 = A - NOW1
      		COMPUTE temp2 = B - NOW2
      		COMPUTE temp3 = C - NOW3
      		COMPUTE temp2 = temp2 + temp3
      		IF temp1 < temp2 THEN
      			DISPLAY "No"
      			STOP RUN
      		END-IF
      		COMPUTE temp2 = temp1 / 2
      		COMPUTE temp1 = temp1 - temp2 * 2
      		COMPUTE temp2 = B - NOW2
      		COMPUTE temp3 = temp2 / 2 
      		COMPUTE temp2 = temp2 - temp3 * 2
      		COMPUTE temp3 = C - NOW3
      		COMPUTE temp4 = temp3 / 2
      		COMPUTE temp3 = temp3 - temp4 * 2
      		COMPUTE temp2 = temp2 + temp3
      		COMPUTE temp2 = temp2 - 2
      		IF temp2 = 2 THEN
      			MOVE 0 TO temp2
      		END-if
      		IF temp1 NOT = temp2 THEN
      			DISPLAY "No"
      			STOP RUN
      		END-IF
      		MOVE A TO NOW1
      		MOVE B TO NOW2
      		MOVE C TO NOW3
      	END-PERFORM.
      	DISPLAY "Yes"
        STOP RUN.




Measured memory_bytes: 512
s = input()
A = [str(i) for i in range(10)]
B = [chr(i) for i in range(97, 97+26)]
C = [chr(i) for i in range(65, 65+26)]

ng = "INVALID"
ok = "VALID"

if len(s) < 6:
    print(ng)
    exit()

x = 0
y = 0
z = 0
for i in s:
    a = i in A
    b = i in B
    c = i in C

    x += a
    y += b
    z += c
    if a or b or c:
        pass
    else:
        print(ng)
        exit()
if x and y and z:
    print(ok)
else:
    print(ng)


Measured memory_bytes: 5568
#include <iostream>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<int> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define re(i,a,b) for(i=a;i<=b;i++)
 
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll ans;
ll a,b,c,d,e;
ll x[100005],y[100005],z[100005];
ll dp[100005];
char s[100005];

int main(){
    cin>>n;
	a=1;
	b=1;
	while(a<200000){
		x[num]=a;
		num++;
		a*=6;
	}
	while(b<200000){
		x[num]=b;
		num++;
		b*=9;
	}
	for(i=2;i<=100000;i++){
		dp[i]=INF;
	}
	sort(x,x+num);
	dp[0]=0;
	dp[1]=1;
	for(i=2;i<=100000;i++){
		for(j=0;j<num;j++){
			if(i-x[j]>=0)dp[i] = min(dp[i],dp[i-x[j]]+1);
		}
	}
	p(dp[n]);

	
			
 
	return 0;
}

Measured memory_bytes: 6912
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC057RemainingTime
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B;
            string[] vals = Console.ReadLine().Split(' ');
            A = int.Parse(vals[0]);
            B = int.Parse(vals[1]);

            Console.WriteLine((A + B) % 24);
        }
    }
}

Measured memory_bytes: 11092
#include "bits/stdc++.h"
#define ll long long
#define ALL(x) (x.begin(),x.end())
using namespace std;

int main(){
ll N,A,B;
cin>>N>>A>>B;
ll tmp,tmp1,tmp2,tmp3;
tmp2 =0;
for(ll i=1;i<N+1;i++){
tmp = i;tmp1=0;
while(1){
tmp1 += tmp%10;
tmp/=10;
if(tmp==0)
break;
}
if(A<=tmp1&&tmp1<=B)
tmp2+=i;
}
cout<<tmp2<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB(x) push_back(x)
#define MP make_pair
#define f first
//#define s second
#define ld long double
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<'Y'<<'e'<<'s'<<endl
#define coutn cout<<'N'<<'o'<<endl
#define coutY cout<<'Y'<<'E'<<'S'<<endl
#define coutN cout<<'N'<<'O'<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

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

    int a; cin >> a;
    string s; cin>> s;
    s.erase(1,1);
    //cout<<s<<endl;
    int b=atoll(s.c_str());
    cout<<(a*b/100)<<endl;


}

Measured memory_bytes: 3648
open System
let R T = stdin.ReadLine()|> T
let RS T = stdin.ReadLine().Split()|>Array.map T
let Mod = (1e9|>int64)+7L
[<EntryPoint>]
let main argv =
    let num = [|for i in [0..9] do yield Array.zeroCreate 10|]
    let N = R int
    for i in [1..N] do
        let st = (((i|>string).[0]|>int)-('0'|>int))
        let ed = i%10
        num.[st].[ed] <- num.[st].[ed] + 1L
    [0..9]
    |>Seq.sumBy(fun c -> ([0..9]|>Seq.sumBy(fun d -> num.[c].[d]*num.[d].[c])))
    |>stdout.WriteLine
    0

Measured memory_bytes: 21956
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const int MAX=1e5+10;
const int INF=1e9+10;


int N, M, Q;
vi G[MAX];
int dp[MAX][11];
int col[MAX];

void input(){
    cin>>N>>M;
    rep(i, M){
        int a, b;
        cin>>a>>b;
        a--;
        b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    rep(v, N){
        rep(d, 11){
            dp[v][d]=INF;
        }
    }
    cin>>Q;
    rep(q, Q){
        int v, d, c;
        cin>>v>>d>>c;
        v--;
        col[Q-1-q] = c;
        dp[v][d] = Q-1-q;

    }
}

void solve(){
    rrep1(d, 10){
        rep(v, N){
            dp[v][d-1] = min(dp[v][d-1], dp[v][d]);
            rep(i, sz(G[v])){
              	int u = G[v][i];
                dp[u][d-1]= min(dp[u][d-1], dp[v][d]);
            }
        }
    }
    rep(v, N){
        int id = dp[v][0];
        if(id == INF){
            cout<<0<<endl;
        }
        else{
            cout<<col[id]<<endl;
        }
    }
}

void output(){
  rep(d, 3){
    rep(v, N){
      cout<<dp[v][d]<<" ";
    }
    cout<<endl;
  }
  
}

int main(){
  input();
  solve();
  //output();
}

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

		int main(){
          int64_t L, R; 
          cin >> L >> R ; 
          int64_t answer = 3000 ; 
          if( R-L > 2017){
            cout << 0 << endl;
          }else{
            for(int64_t i=L; i< R; i++ ){
              for(int64_t j=i+1; j <= R; j++ ){
                answer = min( answer , (i*j) % 2019 );
                }// end for
            }// end for
          cout << answer << endl;   
          }// end else
        }

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include <set>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)


int main(void)
{
	int n;

	cin >> n;
	vector<int> b(n);
	vector<int> a(n);


	
	rep(i, n-1)
	{
		cin >> b[i];
	}

	a[0] = b[0];

	for (int i = 1; i < n; i++)
	{
		a[i] = min(b[i], b[i - 1]);

	}

	a[n - 1] = b[n - 2];

	int ans=0;
	rep(i, n)
	{
		ans += a[i];
	}


	cout << ans << endl;
}

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

const int V = 105;

/////algo credit : geeksforgeeks

bool bfs(ll rGraph[V][V], int s, int t, int parent[]) 
{ 
    // Create a visited array and mark all vertices as not visited 
    bool visited[V]; 
    memset(visited, 0, sizeof(visited)); 
  
    // Create a queue, enqueue source vertex and mark source vertex 
    // as visited 
    queue <int> q; 
    q.push(s); 
    visited[s] = true; 
    parent[s] = -1; 
  
    // Standard BFS Loop 
    while (!q.empty()) 
    { 
        int u = q.front(); 
        q.pop(); 
  
        for (int v=0; v<V; v++) 
        { 
            if (visited[v]==false && rGraph[u][v] > 0) 
            { 
                q.push(v); 
                parent[v] = u; 
                visited[v] = true; 
            } 
        } 
    } 
  
    // If we reached sink in BFS starting from source, then return 
    // true, else false 
    return (visited[t] == true); 
} 
  
// Returns the maximum flow from s to t in the given graph 
ll fordFulkerson(ll graph[V][V], int s, int t) 
{ 
    int u, v; 
  
    // Create a residual graph and fill the residual graph with 
    // given capacities in the original graph as residual capacities 
    // in residual graph 
    ll rGraph[V][V]; // Residual graph where rGraph[i][j] indicates  
                     // residual capacity of edge from i to j (if there 
                     // is an edge. If rGraph[i][j] is 0, then there is not)   
    for (u = 0; u < V; u++) 
        for (v = 0; v < V; v++) 
             rGraph[u][v] = graph[u][v]; 
  
    int parent[V];  // This array is filled by BFS and to store path 
  
    ll max_flow = 0;  // There is no flow initially 
  
    // Augment the flow while tere is path from source to sink 
    while (bfs(rGraph, s, t, parent)) 
    { 
        // Find minimum residual capacity of the edges along the 
        // path filled by BFS. Or we can say find the maximum flow 
        // through the path found. 
        ll path_flow = 1e18; 
        for (v=t; v!=s; v=parent[v]) 
        { 
            u = parent[v]; 
            path_flow = min(path_flow, rGraph[u][v]); 
        } 
  
        // update residual capacities of the edges and reverse edges 
        // along the path 
        for (v=t; v != s; v=parent[v]) 
        { 
            u = parent[v]; 
            rGraph[u][v] -= path_flow; 
            rGraph[v][u] += path_flow; 
        } 
  
        // Add path flow to overall flow 
        max_flow += path_flow; 
    } 
  
    // Return the overall flow 
    return max_flow; 
} 

int n;
ll a[105],graph[105][105],ans,MaxFlow;
int main(){
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);cout.tie(0);
	cin>>n;
	ans = 0;
	memset(graph,0,sizeof graph);
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]<=0){
			graph[0][i] = -a[i];
		}
		else{
			graph[i][n+1] = a[i];
			ans += a[i];
		}
		for(int j=1;j<i;j++){
			if(i%j == 0){
				graph[j][i] = 1e17;
				//cout<<i<<" "<<j<<endl;
			}
		}
	}
	MaxFlow = fordFulkerson(graph,0,n+1);
	cout << max(0ll,ans - MaxFlow) << endl;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <vector>

using namespace std;

#define MAX_N 30

int N, M, A, B, C, D, x1, x2, t1, y2;
int K[32][32];
const int inf = 100010010;

void init()
{
	for(int y=1; y<=N; ++y)
	{
		for(int x=1; x<=N; ++x)
		{
			K[x][y] = inf;
		}
	}
}

void show()
{
	for(int x=1; x<=N; ++x)
	{
		for(int y=1; y<=N; ++y)
		{
			if(K[x][y] == inf){cout << "inf ";}
			else{printf("%3d ",K[x][y]);}
		}
		cout << endl;
	}
}

void floyd_warshall()
{
	for(int k=1; k<=N; ++k)
	{
		for(int i=1; i<=N; ++i)
		{
			for(int j=1; j<=N; ++j)
			{
				if(K[i][j] > K[i][k]+K[k][j])
				{
					K[i][j] = K[i][k]+K[k][j];
				}
			}
		}
	}
}

int main()
{
	scanf("%d%d", &N, &M);
	//cout << N << " " << M << endl;
	
	init();
	
	for(int i=0; i<M; ++i)
	{
		scanf("%d,%d,%d,%d",&A, &B, &C, &D);
		//cout << " " << A << " " << B << " " << C << " " << D << endl;
		K[A][B] = C;
		K[B][A] = D;
	}
	
	scanf("%d,%d,%d,%d",&x1, &x2, &t1, &y2);
	//cout << " " << x1 << " " << x2 << " " << t1 << " " << y2 << endl;
	
	//show();
	floyd_warshall();
	//show();
	
	cout << t1 - y2 - K[x1][x2] - K[x2][x1] << endl;
}

Measured memory_bytes: 1212
//AT2156
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>

using namespace std;
char ch;
int main() 
{
    cin>>ch;
    if(int(ch)==97||int(ch)==101||int(ch)==105||int(ch)==111||int(ch)==117){cout<<"vowel";}
    else{cout<<"consonant";}
    
	    
    return 0;
}

Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    students = [tuple(map(int, input().split())) for i in range(n)]
    check_points = [tuple(map(int, input().split())) for i in range(m)]

    for a, b in students:
        dist = [abs(a - c) + abs(b - d) for c, d in check_points]
        print(dist.index(min(dist)) + 1)

    # for st in students:
    #     min_pt = check_points[0]
    #     for pt in check_points:
    #         if abs(pt[0] - st[0]) + abs(pt[1] - st[1]) < \
    #            abs(min_pt[0] - st[0]) + abs(min_pt[1] - st[1]):
    #             min_pt = pt
    #     print(check_points.index(min_pt) + 1)


if __name__ == "__main__":

    main()


Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int A,B;
    string S;
    cin >> A >> B;
    cin >> S;
    int i;
    int flag = -1;
    for( i = 0; i < S.size(); i++){
        if(S[i] == '-'){
            if(flag == -1){
                flag = i;
            }else{
                cout << "No" << endl;
                return 0;
            }
        }
    }
    //cout << flag << ":"<<  S.size() - (flag+1) << endl;
    if(flag == A && B == S.size() - (flag+1)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 256
n,m=gets.chomp.split.map(&:to_i)
s=gets.chomp.split.map(&:to_i)
t=gets.chomp.split.map(&:to_i)
MOD=10**9+7

dp=Array.new(n+1).map{Array.new(m+1,0)}
sum=Array.new(n+1).map{Array.new(m+1,0)}


1.upto(n) do |i|
  1.upto(m) do |j|
    if s[i-1] == t[j-1]
      dp[i][j]=(sum[i-1][j-1] + 1)%MOD
    else
      dp[i][j]=0
    end
    sum[i][j] = (sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1] + dp[i][j])%MOD
  end
end
puts (sum[n][m] + 1)%MOD


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

int main() {
  int N,K;
  cin >> N >> K;
  int A = 0;
  
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if (x>=K-x) {
      A += 2*(K-x);
    }
    else {
      A += 2*x;
    }
  } 
  cout << A << endl;
}


Measured memory_bytes: 384
import java.util.*;
import java.text.*;

class Main {
    public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        int [] cnt = new int[26];
        while(sc.hasNext()) {
            char [] cs = sc.nextLine().toCharArray();
            for(int i = 0; i < cs.length; i++) {
                if(cs[i] >= 'A' && cs[i] <= 'Z') {
                    cnt[cs[i]-'A']++;
                }
                if(cs[i] >= 'a' && cs[i] <= 'z') {
                    cnt[cs[i]-'a']++;
                }
            }
        }
        for(int i = 0; i < 26; i++) {
            System.out.println("" + ((char)(i+'a')) + " : " + cnt[i]);
        }
    }
}

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

#define MAX 300000



int main(){

  bool is_prime[MAX]={false};
  int sum_prime[MAX]={};
  for(int i=0; i<MAX; i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;

  for(int i=2; i<MAX; i++){
    if(is_prime[i])
      for(int j=2; i*j<MAX; j++){
	is_prime[i*j] = false;
      }
  }
  for(int i=2; i<MAX; i++) 
    sum_prime[i] = (is_prime[i] ? 1 : 0) + sum_prime[i-1];
  
  int n;
  while(1){
    cin >> n;
    if(!n) break;
    cout << sum_prime[2*n] - sum_prime[n] << endl;
  }
}

Measured memory_bytes: 2632
#include <bits/stdc++.h>
#define i_love_u_Phuong ios_base::sync_with_stdio(0); cin.tie(0);

using ll = long long;
using namespace std;
using ld = long double;
int mod = 1e9+7;
const int MAXSUM = 40005;
int d[0][2*MAXSUM];




int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    i_love_u_Phuong;
    int n,d;
    cin >> n >> d;
    vector<vector<int> > a(n, vector<int> (d));
    for(int i=0; i<n; ++i)
        for(int j=0; j<d; ++j)
        cin >> a[i][j];
    int ans=0;
    for(int i=0; i<n; ++i)
    {
        for(int j=i+1; j<n; ++j)
        {
            int sum=0;
            for(int k=0; k<d; ++k)
                sum+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
            int tmp = trunc(sqrt(sum));
            if (tmp*tmp == sum) ans++;
        }
    }
    cout << ans;
    return 0;
}



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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = array[0];
            var K = array[1];

            var count = Console.ReadLine().Split().Select(int.Parse).Count(r => r >= K);

            Console.WriteLine(count);
        }
    }

}


Measured memory_bytes: 15840
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  long long a,b,k;
  cin>>a>>b>>k;
  if(a>=k)
    cout<<a-k<<" "<<b;
  else
    cout<<0<<" "<<max(a+b-k,0LL);
}

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int tmp = 0;
    for(int i = 0; i < b; i++){
        tmp = (tmp+a) % b;
        if(tmp == c){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 1 ; i <= 9 ; i++) {
            if (n % i == 0 && n / i <= 9) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }

}


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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    queue<int> q;
    for (int i = 1; i <= k; ++i) {
        q.push(a[i]);
    }
    for (int i = k + 1; i <= n; ++i) {
        int x = q.front();
        q.pop();
        if (a[i] > x) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
        q.push(a[i]);
    }
    
}


Measured memory_bytes: 4800
import java.util.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args){
    Scanner sc = new Scanner(in);
    int n = sc.nextInt();
		int x = n;
		int y = 0;
		while (x > 0) {
			y += x - (x / 10 * 10);
			x /= 10;
		}

		if (n % y == 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 22740
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		// 入力
		Scanner sc = new Scanner(System.in);
		int inputFirst = sc.nextInt();
		int inputSecond = sc.nextInt();
		sc.close();
		
		int total = 1;
		for (int i=0; i < inputFirst; i++) {
			total = total * 100;
		}
		
		System.out.println(inputSecond != 100 ? total * inputSecond: total * (inputSecond +1));
	}
}


Measured memory_bytes: 22868