akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt(); // A <= 10^9
    int B = sc.nextInt(); // B <= 10^9
    int K = sc.nextInt(); // K <= 100

    if(2 * K  <= B - A  ){
      for(int i = 0 ; i < K ; i ++ ){
        System.out.println(A + i);
      }
      for(int i = K - 1 ; i >= 0  ; i -- ){
        System.out.println(B - i);
      }
    } else {
      for(int i = 0 ; i < B - A + 1;i ++ ){
        System.out.println(A + i);
      }
    }
  }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define pi pair<int,int>
#define ff first
#define ss second

int32_t main(){
	boost;
	int n;
	cin>>n;
	pi a[n];
	for(int i=0;i<n;i++)
		cin>>a[i].ss>>a[i].ff;
	sort(a,a+n);
	int cur = 0;
	for(int i=0;i<n;i++){
		cur += a[i].ss;
		if(cur > a[i].ff){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
}



Measured memory_bytes: 5188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  double k;
  k =  (1.0 + N) / (2.0 * N);
  if (N % 2 == 0){
    cout << 1.0 / 2.0 << endl;
  }
  else if(N == 1){
    cout << 1 << endl;
  }
  else{
    cout << k << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
   int N;
   scanf("%d",&N);
   if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9){
      printf("hon");
   }
   if(N%10==0||N%10==1||N%10==6||N%10==8){
      printf("pon");
   }
   if(N%10==3){
      printf("bon");
   }
   return 0;
}


Measured memory_bytes: 1732
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
lint mo=1000000007;
lint kai[11451],rkai[11451],zyo[11451];
lint extgcd(lint a, lint b, lint &x, lint &y) {
  lint g = a; x = 1; y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}
lint invMod(lint a, lint m) {
  lint x, y;
  if (extgcd(a, m, x, y) == 1) return (x + m) % m;return 0;
}
lint co(int a,int b){
	if(a<0 || b<0) return 0;
	return ((kai[a+b]*rkai[b])%mo*rkai[a])%mo;
}
lint cal(int n,int m){
	lint ret=0;
	rep(i,n+1){
		int x=i,y=n-i;
		if(y-x>m) continue;
		if(y<=m){
			ret+=zyo[y]*co(x,y);ret%=mo;
		}
		else{
			ret+=(co(x,y)-co(y-m-1,x+m+1))*zyo[y];ret%=mo;
		}
	}
	ret%=mo;
	if(ret<0) ret+=mo;
	return ret;
}
int main()
{
	int n;string s;cin>>n;cin>>s;
	zyo[0]=kai[0]=rkai[0]=1;
	rep(i,11419){
		zyo[i+1]=zyo[i]*2;zyo[i+1]%=mo;
		kai[i+1]=kai[i]*(i+1);kai[i+1]%=mo;
		rkai[i+1]=rkai[i]*invMod(i+1,mo);rkai[i+1]%=mo;
	}
	lint out=cal(n,s.size())-cal(n,s.size()-1);
	out*=invMod(zyo[s.size()],mo);out%=mo;out+=mo;
	cout<<out%mo<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include<cmath>

using namespace std;

int N, K, h[100000+5], Cost[100000+5] = {0};

int select_k(int i, int K){
    int cost = 10000000000;
    for(int k = 1; k <= K; k++)
        cost = min(cost, abs(h[i]-h[i-k])+Cost[i-k]);
    return cost;
}

void solve(){
    Cost[1] = 0;
    Cost[2] = abs(h[2]-h[1]);

    for(int i = 3; i <= N; i++)
        Cost[i] = select_k(i, min(K, i-1));

    cout << Cost[N] << endl;
}

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

    for(int i = 1; i <= N; i++) cin >> h[i];

    solve();
}

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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if(ch == 'A')return 1;
  else if(ch=='C')return 2;
  else if(ch=='G')return 3;
  else if(ch=='T')return 4;
  else return 0;
}

long long getKey(char str[]){
  long long sum=0,p=1,i;
  for(i=0;i<strlen(str);i++){
    sum+=p*(getChar(str[i]));
    p*=5;
  }
  return sum;
}

int h1(int key){return key%M;}
int h2(int key){return 1+(key%(M-1));}

int find(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0)return 0;
  }return 0;
}

int insert(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
 }

	    

int main(){
  int n,i,h;
  char str[L],com[9];
  scanf("%d",&n);
  for(i=0;i<M;i++)H[i][0]='\0';
  for(i=0;i<n;i++){
    scanf("%s %s",com,str);
    if(com[0]=='i'){
      insert(str);
    }
    else{
      if(find(str)){
	printf("yes\n");
      }
      else{
	printf("no\n");
      }
    }
  }
  return 0;
}
		 



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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int A = in.nextInt();
        	int B = in.nextInt();
        	int C = in.nextInt();
        	int max = Math.max(A, B);
        	max = Math.max(max, C);
        	int ans = 0;
        	if(max == A) {
        		ans = A * 10 + B + C;
        	}else if(max == B) {
        		ans = B * 10 + A + C;
        	}else {
        		ans = C * 10 + A + B;
        	}
        	out.println(ans);
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



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



ll dp[3002][3002][4];

int main() {
    ll R, C, K;
    cin >> R >> C >> K;
    vector<vector<ll>> value(R, vector<ll>(C, 0));
    rep(i, K) {
        ll r, c, v;
        cin >> r >> c >> v;
        --r;
        --c;
        value[r][c] = v;
    }

    rep(i, 3) rep(j, R) rep(k, C) dp[j][k][i] = 0;
    dp[0][0][1] = value[0][0];

    rep(j, R) rep(i, 4) rep(k, C) {
        if (j > 0 && i == 0) {
            ll tmp = 0;
            rep (l, 4) tmp = max(tmp, dp[j - 1][k][l]);
            dp[j][k][i] = max(dp[j][k][i], tmp);
        }
        if (k > 0) dp[j][k][i] = max(dp[j][k][i], dp[j][k - 1][i]);

        if (i > 0 && value[j][k] != 0) {
            if (i == 1 && j > 0) {
                ll tmp = 0;
                rep (l, 4) tmp = max(tmp, dp[j - 1][k][l] + value[j][k]);
                dp[j][k][i] = max(dp[j][k][i], tmp);
            }
            if (k > 0) dp[j][k][i] = max(dp[j][k][i], dp[j][k - 1][i - 1] + value[j][k]);
        }
    }
    ll ans = 0;
    rep(i, 4) ans = max(ans, dp[R - 1][C - 1][i]);
    cout << ans << endl;
}



Measured memory_bytes: 354948
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359
/*
int main(){
    iostream::sync_with_stdio(false);
    
    int D;
    cin >> D;
    if(D == 22) cout << "Christmas Eve Eve Eve" << endl;
    if(D == 23) cout << "Christmas Eve Eve" << endl;
    if(D == 24) cout << "Christmas Eve" << endl;
    if(D == 25) cout << "Christmas" << endl;
    
    return 0;
}*/


int main(){
    iostream::sync_with_stdio(false);
    
    int N;
    cin >> N;
    int sum = 0;
    int m = 0;
    for(int i=0; i<N; i++){
        int tmp;
        cin >> tmp;
        sum += tmp;
        m = max(m, tmp);
    }
    cout << sum - m/2 << endl;
    
    return 0;
}

/*
int main(){
    iostream::sync_with_stdio(false);
    
    
    
    return 0;
}*/

/*
int main(){
    iostream::sync_with_stdio(false);
    
    
    
    return 0;
}*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << endl;
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << endl;
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

int main(){
  ll A, B, C;
  ll K;
  cin >> A >> B >> C;
  cin >> K;

  ll ans = A+B+C;
  ll multi = 1<<K;
  ans += max(A, max(B, C))*(multi-1);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
cnt_a = 0
cnt_b = 0
cnt_c = 0
cnt = 0
for i in range(n):
    s = input()
    for j in range(1, len(s)):
        if s[j - 1] == 'A' and s[j] == 'B':
            cnt += 1
    if s[0] == 'B' and s[-1] == 'A':
        cnt_c += 1
    elif s[0] == 'B':
        cnt_b += 1
    elif s[-1] == 'A':
        cnt_a += 1
ans = cnt
if cnt_c == 0:
    ans += min(cnt_a, cnt_b)
else:
    if cnt_a + cnt_b > 0:
        ans += cnt_c + min(cnt_a, cnt_b)
    else:
        ans += cnt_c - 1
print(ans)



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

// --------------------------------------------------------------------------------
#define FASTIO	ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define frepi(a,b) for(int i=a;i<=b;++i)
// --------------------------------------------------------------------------------

void solve_main()
{
    int x;cin>>x;
    if(x>=30)cout<<"Yes\n";
    else cout<<"No\n";
}

int main()
{
	#ifndef ONLINE_JUDGE
		freopen("/home/suryakant/input.txt","r",stdin);
		freopen("/home/suryakant/output.txt","w",stdout);
	#endif
	
    int t=1;
    // cin>>t;
    while(t--)
    {
    	solve_main();
    }    
}

Measured memory_bytes: 3632
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <map>

int main (){
	std::string S;
	std::cin >> S;
	int length = S.length();
	long long stack=0;
	long long ans=0;
	for (int bit=0; bit<(1<<(length-1)); bit++){ //bitが1は+の符号が入ることを意味する
		//printf("====\n");
		//printf("bit=%d\n",bit);
		for (int i=0; i<length; i++){
		  if ((bit & (1<<i))!=0){ // +の符号を見つけた時は、stackをansに足してstackをからにする
				//printf("+ found\n");
				//printf("S[i]-S[0]=%d\n",int(S[i])-int('0'));
				stack = 10*stack + int(S[i])-int('0');
				//printf("ans+=%lld\n",stack);
				ans += stack;
				//printf("ans=%lld\n",ans);
				stack = 0;
				continue;
			} else {
				//printf("not +\n");
				stack = 10*stack+(int(S[i])-int('0'));
				//printf("stack=%lld\n",stack);
			}
		}
		//最後の分をansに足す
		//printf("ans+=%lld\n",stack);
		ans += stack;
		stack=0;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
def solve(i, s):
    global A
    global M
 
    if i < len(A):
        M.add(s + A[i])
        solve(i + 1, s + A[i])
        solve(i + 1, s)
 
 
n = int(input())
A = [int(x) for x in input().split()]
M = set()
 
solve(0, 0)
 
q = int(input())
 
for m in [int(x) for x in input().split()]:
    if m in M:
        print('yes')
    else:
        print('no')


Measured memory_bytes: 5660
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

s = 0
prev = -1

for i in range(N):
    t = A[i] - 1
    s += B[t]
    if prev != -1 and prev + 1 == t:
        s += C[prev]
    prev = t

print(s)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define REP(i,c) for(int i=0;i<(c);i++)
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s.at(2)==s.at(3)&&s.at(4)==s.at(5)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

n = int(input())
a = [int(i) for i  in input().split()]
b = [int(i) for i  in input().split()]

pos = [a[i] - b[i] for i in range(n) if a[i] - b[i] >= 0]
neg = [a[i] - b[i] for i in range(n) if a[i] - b[i] < 0]
pos.sort()

pval = sum(pos)
nval = sum(neg)

#print(pos)
#print(neg)
if pval + nval < 0:
    print(-1)
else:
    ans = 0
    while(nval < 0):
        nval += pos.pop()
    
    print(n-len(pos))
    


Measured memory_bytes: 19068
#include <iostream>
#include <stdio.h>
#include <queue>
#include <algorithm>
#include <map>
#include <memory.h>

using namespace std;

int a[200002];

int main()
{
	int n;
	cin >> n;
	priority_queue<int> q;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		q.push(a[i]);
	}
	for (int i = 0; i < n; i++) {
		if (a[i] == q.top()) {
			q.pop();
			cout << q.top() << endl;
			q.push(a[i]);
		}
		else {
			cout << q.top() << endl;
 		}
	}
	return 0;
}


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int count=0;
  cin>>n;
  vector<int>d(n);
  for(int i=0;i<n;i++){
    cin>>d.at(i);
  }
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      count+=d[i]*d[j];
    }
  }
  cout<<count<<endl;
  
}

Measured memory_bytes: 256
#!/usr/bin/env python3

k = int(input())

now = 1
step = 1


def sunuke(n):
    r = 0
    while n:
        r += n % 10
        n //= 10
    return r


def ok(a, b):
    return a * sunuke(b) <= b*sunuke(a)


while k:
    if ok(now, now+step):
        print(now)
        k -= 1
        now += step
    else:
        nstep = step*10
        while now % nstep != nstep-1:
            now += step
        step = nstep


Measured memory_bytes: 9128
#include <iostream>

using namespace std;

void InsSort(int A[], int N) {
    int i, j, v;
    for (i = 1; i < N; i++) {
        v = A[i];
        j = i - 1;
        while ( j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        for (int k = 0; k < N; k++) {
            if (k > 0) cout << ' ';
            cout << A[k];
        }
        cout << endl;
    }
}

int main() {
    int N, i, j;
    int A[100];

    cin >> N;
    for (i = 0; i < N; i++) cin >> A[i];

    for (int k = 0; k < N; k++) {
        if (k > 0) cout << ' ';
            cout << A[k];        
    }
    cout << endl;

    InsSort(A, N);

    return 0;
}


Measured memory_bytes: 3076
#include<bits/stdc++.h>
#include<cmath>
#define SZ(x) ((int)x.size())
#include<vector>
#include<set>
#include<map>
#define ll long long
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#include<string>
#include<cctype>
#include<queue>
#define ii pair<int,int>
#include <sstream>
#define lli long long int
#define pairs pair<int,int>
#define mod 1000000007
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
ll pows(ll a,ll n,ll m)
{
	ll res=1;
	while(n)
	{
	if(n%2!=0)
	{
		res=(res*a)%m;
		n--;
		}
		else
		{
			a=(a*a)%m;
			n=n/2;
			}	
	}
	return res%m;
}
ll  gcd(ll a,ll b)
{
	if(b==0)
	return a;
	else 
	return gcd(b,a%b);
}
bool isprime(ll n)
{
	if(n==1)
	{
		return false;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}
bool istrue(string s)
{
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	if(s[i]==s[j])
	{
		i++;
		j--;
		}
		else
		{
			return false;
			}	
	}
	return true;
}
ll a[200001];
ll ar[200001];
int main()
{
   ios::sync_with_stdio(false);
	 cin.tie(0);
    cout.tie(0);
ll n;
cin>>n;
for(int i=0;i<n;i++)
{
	cin>>a[i];
}
ll x=0;
for(int i=0;i<n;i++)
{
	x=x^a[i];
}
for(int i=0;i<n;i++)
{
	ar[i]=x^a[i];
}
for(int i=0;i<n;i++)
{
	cout<<ar[i]<<" ";
}
cout<<endl;
}



Measured memory_bytes: 6708
#include<stdio.h>
int main(){
    int l,r,d,i;
    int cnt=0;
    scanf("%d %d %d",&l,&r,&d);
    for(i=l;i<=r;i++){
        if(i%d==0){
            cnt++;
        }
    }
    printf("%d\n",cnt);
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int h,w;cin>>h>>w;
	vector<vector<char>>s(h+2,vector<char>(w+2));
	for(int i=1;i<=h;++i){
		for(int j=1;j<=w;++j){
			cin>>s[i][j];
		}
	}
	bool a=true;
	for(int i=1;i<=h;++i){
		for(int j=1;j<=w;++j){
			if(s[i][j]=='#'){
				if(s[i-1][j]!='#'&&s[i+1][j]!='#'&&s[i][j-1]!='#'&&s[i][j+1]!='#')a=false;
			}
		}
	}
	if(a)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
	ll x,a;
	cin>>x>>a;
	if(x<a){
		cout << 0 << endl;
	}
	else{
		cout << 10 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
// Can U hack it?

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxn=1e5+10,mod=1e9+7;
const ll inf=1e18;

int main(){
    ll n,m;cin>>n>>m;
    string a,b;cin>>a>>b;
    ll g=__gcd(n,m),N=n/g,M=m/g;
    for(int s1=0,s2=0;s1<n && s2<m ;s1+=N,s2+=M){
	if(a[s1]!=b[s2]){
	    cout<<-1<<endl;
	    return 0;
	}
    }
    cout<<(n*m/g)<<endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long total =0;
        for(int i=1; i<=n; i++) {
            if(i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        }
        System.out.println(total);
    }
}

Measured memory_bytes: 27132
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

int main()
{
    int N,M,tmp;
    cin >> N >> M;
    int num[9];
    memset(num, 0, sizeof(num));

    for (int i=0; i<M; i++){
        cin >> tmp;
        num[tmp-1]++;
    }
    int match[9]={2,5,5,4,5,6,3,7,6};

    int dp[N+7];//dp[i]はi-6本のマッチ棒を使って作った最大桁数
    for (int i=0; i<6; i++){
        dp[i]=-1000000;
    }
    dp[6]=0;//0本使うときに当たる
    dp[7]=-1000000;//1本使うときに当たる

    for (int i=2; i<=N; i++){//iは本数
        int maxm=(-1000000);
        for (int j=0; j<9; j++){
            if(num[j]==1){
                if(dp[i-match[j]+6]+1>maxm){
                    maxm=dp[i-match[j]+6]+1;
                }
            }
        }
        if(maxm<0){
            dp[i+6]=-1000000;
        }else{
            dp[i+6]=maxm;
        }
    }
    int flag=0;
    int count=0;//count=使ったマッチの本数
    while(count<N && flag<100000){
        for (int i=8; i>=0; i--){
            if(num[i]==1){
                flag++;
                if(dp[N+6-match[i]-count]==dp[N+6-count]-1){
                    cout << i+1;
                    count+=match[i];
                    break;
                }
            }
        }
    }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a[3],ans,max,min;
  for(int i=0;i<3;i++){
      cin>>a[i];
  }
  max = a[0];
  min = a[0];
 for (int i=0; i<3; i++) {
			if (max < a[i]) {
				max = a[i];
			}
			if (min > a[i]) {
				min = a[i];
			}
		}
  ans = max - min;
  cout << ans << "\n";
  return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

#define x(p) real(p)
#define y(p) imag(p)

const double eps=1e-10;
const double inf=1e12;
typedef complex<double> P;

namespace std{
  bool operator<(const P& a,const P& b){
    return x(a)==x(b)?y(a)<y(b):x(a)<x(b);
  }
}
double cross(const P& a,const P& b){
  return y(conj(a)*b);
}
double dot(const P& a,const P& b){
  return x(conj(a)*b);
}
struct L : public vector<P> { // line and segment
  L(const P& a,const P &b){
    push_back(a);
    push_back(b);
  }
};

P projection(const L& l,const P& p){
  double t=dot(p-l[0],l[0]-l[1])/norm(l[0]-l[1]);
  return l[0]+t*(l[0]-l[1]);
}

int main(){
	cin.sync_with_stdio(false);
  int q;
  double x1,x2,x3,y1,y2,y3;
  cin>>x1>>y1>>x2>>y2;
  cin>>q;
  rep(i,q){
    cin>>x3>>y3;
    P res=projection(L(P(x1,y1),P(x2,y2)),P(x3,y3));
    printf("%.10f %.10f\n", x(res),y(res));
  }
	return 0;
}

Measured memory_bytes: 3368
import java.io.File;
import java.io.FileInputStream;
import java.util.Scanner;
import java.util.Map.Entry;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		int W = sc.nextInt();
		int H = sc.nextInt();
		int N = sc.nextInt();
		int x1 = 0, x2 = W, y1 = 0, y2 = H;
		for(int i = 0; i < N; i++){
			int x = sc.nextInt();
			int y = sc.nextInt();
			int a = sc.nextInt();
			if(a == 1) x1 = Math.max(x1, x);
			if(a == 2) x2 = Math.min(x2, x);
			if(a == 3) y1 = Math.max(y1, y);
			if(a == 4) y2 = Math.min(y2, y);
		}
		int w = Math.max(x2-x1, 0);
		int h = Math.max(y2-y1, 0);
		System.out.println(h * w);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}

Measured memory_bytes: 20948
#include <bits/stdc++.h>
long long r,n,a[500000],b[500000],c[500000],i;
using namespace std;
#define f for(i = 0; i < n; i++)
signed main()
{
cin >> n;
f cin >> a[i];
f cin >> b[i];
f cin >> c[i];
sort(a, a + n);
sort(b, b + n);
sort(c, c + n);
f r += (lower_bound(a, a + n, b[i]) - a) * (c + n - upper_bound(c, c + n, b[i]));
cout << r;
}


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

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

    if (n < 10)
    {
        cout << n << endl;
    }
    if (9 < n && n < 100)
    {
        cout << 9 << endl;
    }
    if (99 < n && n < 1000)
    {
        cout << 9 + (n % 100 + 1) + ((n / 100 - 1) * 100) << endl;
    }
    if (999 < n && n < 10000)
    {
        cout << 909 << endl;
    }
    if (9999 < n && n < 100000)
    {
        cout << 909 + (n % 10000 + 1) + ((n / 10000 - 1) * 10000) << endl;
    }
    
    if (n == 100000)
    {
        cout << 90909 << endl;
    }
    
}

Measured memory_bytes: 256
n=int(input())
a = [[] for _ in range(n)]
for i in range(n):
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        a[i].append((x - 1, y))
ans=0
for i in range(2**n):
    count=0
    flag=True
    for j in range(n):
        if (i>>j)&1:
            for k in range(len(a[j])):
                if a[j][k][1]!=(i>>a[j][k][0])&1:
                    flag=False
                    break
            count+=1
    if flag:
        ans=max(count,ans)

print(ans)


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

int main(){
  string S;
  cin >> S;

  if (S.at(0) == 'M'){
    cout << "6" << endl;
  }
  else if (S.at(0) == 'W'){
    cout << "4" << endl;
  }
  else if (S.at(0) == 'F'){
    cout << "2" << endl;
  }
  else if (S.at(0) == 'S'){
    if (S.at(1) == 'U'){
      cout << "7" << endl;
    }
    else{
      cout << "1" << endl;
    }
  }
  else if (S.at(0) == 'T'){
    if (S.at(1) == 'U'){
      cout << "5" << endl;
    }
    else{
      cout << "3" << endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
int main(){
	string A, B, C;
	cin >> A >> B >> C;
	if(A[A.size()-1] == B[0] && B[B.size()-1] == C[0]) cout << "YES"<< endl;
	else cout << "NO" << endl;
}


Measured memory_bytes: 256
// <   .cpp> // ::
// This file is created by Bandit.
// Copyright (C) 2019 S.F.L.S , Inc.
// I don't know what this program is.
#include<bits/stdc++.h>
#define N
using namespace std;

inline int read()
{
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

string s;
bool f;

int main()
{
	cin>>s;
	for (register int i=0;i<s.length();i++)
	  if (s[i]=='C')
	    for (register int j=i+1;j<s.length();j++)
	      if (s[j]=='F')
	      {
	      	 cout<<"Yes"<<endl;
	      	 return 0;
	      }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  int i, j, k, l;
  int cnt = 0;
  
  cin >> H >> W;
  
  string S;
  char area[W][H];
  int area_num[W][H];
  
  for (i = 0; i < H; i++) {
    cin >> S;
    for (j = 0; j < W; j++) {
       area[j][i] = S.at(j);
    }
  }
  
  for (i = 0; i < H; i++) {
    for (j = 0; j < W; j++) {
      if (area[j][i] == '.') {
        for (k = 0; k < 3; k++){
          for (l = 0; l < 3; l++){
            if ((i + k - 1 < 0) || (j + l - 1 < 0) || (i + k > H) || (j + l > W)) ;
            else if (area[j + l - 1][i + k - 1] == '#') cnt++;
          }
        }
        area_num[j][i] = cnt;
      }
      cnt = 0;
    }
  }
  
  for (i = 0; i < H; i++) {
    for (j = 0; j < W; j++) {
       if (area[j][i] == '#') cout << area[j][i];
       else cout << area_num[j][i];
       if(j == W - 1) cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define   ll          long long int
#define   sz          200010
#define   sc(a)       scanf("%lld",&a)
#define   sc2(a,b)    scanf("%lld %lld",&a,&b)
#define   py          printf("Yes\n")
#define   pn          printf("No\n")
using namespace std;


ll num[sz];



int main()
{

    ll n,i,j,a=0,b=0,c=1;

    cin>>n;

    for(i=1;i<=n;i++)
    {
        cin>>num[i];
    }

    sort(num+1,num+n+1);

    for(i=n;i>=1;i--)
    {
        if(c%2==1)a+=num[i];
        else
            b+=num[i];
        c++;
    }

    cout<<a-b<<endl;


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
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 Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
  int N,X,Y;
  cin>>N>>X>>Y;
  int x=X-1;
  int y=Y-1;
  vector<int>vec(N-1);
  rep(i,N-1){
    vec[i]=0;
  }
  for(int j=0;j<N-1;j++){
    for(int k=j+1;k<N;k++){
      int a=min(k-j,abs(j-x)+abs(k-y)+1);
      vec[a-1]++;
    }
  }
  for(int l=0;l<N-1;l++){
    cout<<vec[l]<<endl;
  }
}


Measured memory_bytes: 256
/* 

	 - If you fail to prepare, you are prepared to fail.	

	(C) Mark Spitz

*/

#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define S second
#define F first
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

void setIO(string name = "") {
	ios_base::sync_with_stdio(NULL);
	cin.tie(NULL);
	cout.tie(NULL);

	if (sz(name)) {
		freopen((name + ".in").c_str(), "r", stdin);
		freopen((name + ".out").c_str(), "w", stdout);
	}
}

const int inf = 1e9;
const ll INF = 1e18;
const int mod = 1e9 + 7;
const int MAXN = 1e6 + 5;


#define int ll

int n;
int ct[MAXN];

void solve() {
	cin >> n;
	
	int res = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j += i) {
			ct[j]++;
		}
	}
	
	for (int i = 1; i < n; i++) {
		res += ct[i];
	}
	
	cout << res;
}

main() {
	setIO();
	
	int tt = 1;
	//~ cin >> tt;
	while (tt--) {
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 11464
n = int(input())
index=0
listA=[]
hashMap={}
while index < n:
    s, p = map(str, input().split())
    listA.append([s, p])
    if s in hashMap:
        hashMap[s].append(int(p))
    else:
        hashMap[s] = [int(p)]
    index+=1

answerL=[]
newHashMap={}
index=0
num = 1
keyL = list(hashMap.keys())
keyL.sort()
while index < len(keyL):
    index2=0
    listV = hashMap[keyL[index]]
    listV.sort(reverse = True)
    while index2 < len(listV):
        newHashMap[keyL[index]+str(listV[index2])]=num
        num+=1
        index2+=1
    index+=1

index=0
while index < len(listA):
    answerL.append(newHashMap[listA[index][0]+listA[index][1]])
    index+=1
newAnsL=[0]*n
index=0
while index < len(answerL):
    newAnsL[answerL[index]-1] = index+1
    index+=1
for ans in newAnsL:
    print(ans)

Measured memory_bytes: 3064
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 2e5 + 5;
int n;
char tmp[maxn];
string s;

bool read() {
  if (scanf("%s", tmp) < 1) {
    return false;
  }
  s = tmp;
  n = sz(s);
  return true;
}

void solve() {
  int cnt = 0;
  long long res = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'B') {
      cnt++;
    } else {
      res += cnt;
    }
  }
  printf("%lld\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 640
import java.util.*;  
import java.lang.*;  
import java.math.*;  
import java.io.*;  
  
import static java.lang.Math.*;  
import static java.util.Arrays.*;  
  
public class Main{  
  
 Scanner sc=new Scanner(System.in);  
  
 int INF=1<<28;  
 double EPS=1e-9;  
  
 void run(){  
  int[] a=new int[51];  
  Arrays.fill(a, INF);  
  for(int k=0; toGramme(0, 0, k)<=50; k++){  
   for(int j=0; toGramme(0, j, k)<=50; j++){  
    for(int i=0; toGramme(i, j, k)<=50; i++){  
     int g=toGramme(i, j, k);  
     a[g]=Math.min(a[g], toMoney(i, j, k));  
    }  
   }  
  }  
  for(;;){  
   int g=sc.nextInt()/100;  
   if(g==0){  
    break;  
   }  
   println(a[g]+"");  
  }  
 }  
  
 int toGramme(int i, int j, int k){  
  return i*2+j*3+k*5;  
 }  
  
 int toMoney(int i, int j, int k){  
  int sum=0;  
  sum+=380*(i-i%5)*80/100+380*(i%5);  
  sum+=550*(j-j%4)*85/100+550*(j%4);  
  sum+=850*(k-k%3)*88/100+850*(k%3);  
  return sum;  
 }  
  
 void debug(Object... os){  
  System.err.println(Arrays.deepToString(os));  
 }  
  
 void print(String s){  
  System.out.print(s);  
 }  
  
 void println(String s){  
  System.out.println(s);  
 }  
  
 public static void main(String[] args){  
  // System.setOut(new PrintStream(new BufferedOutputStream(System.out)));  
  new Main().run();  
 }  
} 

Measured memory_bytes: 25948
#include <iostream>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <vector>
#define ll long long
const int N=1e6+10;
using namespace std;
int n;
int b[N];
int ans=0;

int main() {
   cin>>n;
   b[0]=b[n]=N;
   for(int i=1;i<n;i++){
       cin>>b[i];
   }
   for(int i=1;i<=n;i++){
       ans+=min(b[i-1],b[i]);
   }
  cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())
if x == - y:
  print(1)
elif x * y < 0:
  print(abs(abs(x) - abs(y)) + 1)
elif x < y:
  print(y - x)
elif x * y:
  print(abs(abs(x) - abs(y)) + 2)
else:
  print(abs(abs(x) - abs(y)) + 1)



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

using namespace std;
typedef long long ll;
const int N=1e5+10;

int main()
{
    ll a,b,n;
    cin>>a>>b>>n;
    if(n>=b){
        cout<<a*(b-1)/b;
    }
    else{
        cout<<a*n/b;
    }

}



Measured memory_bytes: 3632
/*そーなのかー
　　　＿
　 '´　　 ヽ
 ./ ﾉﾉ））)）〉
〈《.! ﾟ ヮﾟﾉ》
　⊂!::V::!つ
　 く::::::::〉
　　 し'ﾉ*/
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n,k;
  int64_t e=0;
  cin >> n >> k;
  vector<int64_t>h(n);
  for(int i=0;i<n;i++){
  cin >> h.at(i);
  }
  sort(h.begin(),h.end());
  if(k<=n){
    for(int i=0;i<n-k;i++){
    e+=h.at(i);
    }
  cout << e << endl;  
  }
  else{
  cout << 0 << endl;
  }
}

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

namespace ABC087 {
	class ABC087_A {
		static void Main(string[] args) {
			// Aを引いた値のBの剰余
			var X = int.Parse(Console.ReadLine());
			var A = int.Parse(Console.ReadLine());
			var B = int.Parse(Console.ReadLine());
			Console.WriteLine((X-A)%B);
		}
	}
}


Measured memory_bytes: 11092
/*
    By Prabal Aggarwal
*/
#include <bits/stdc++.h>
#define fastIo                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
using namespace std;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
#define ll long long
#define MOD 1000000007
const int N = 100005;

int main()
{
    fastIo;
    int x;
    cin>>x;
    cout<<(!x)<<endl;
    return 0;
}

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

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

    vector<int> score(4);
    rep(i, n) {
        string s;
        cin >> s;
        if(s == "AC") score[0]++;
        if(s == "WA") score[1]++;
        if(s == "TLE") score[2]++;
        if(s == "RE") score[3]++;
    }

    cout << "AC x " << score[0] << endl;
    cout << "WA x " << score[1] << endl;
    cout << "TLE x " << score[2] << endl;
    cout << "RE x " << score[3] << endl; 
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<cmath>
#include<string>
#include<map>
#include <cmath>
#include <set>
#include <complex>
#include <queue>
#include <functional>

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define all(a) a.begin(), a.end()
#define N 5000000

const long long int  inf = 1e15 ;
const int M = 1e9+7;

typedef long long int LL;
typedef pair<LL,LL>pii;


int n;
LL arr[N][3],dp[N][3];
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for (int i = 1; i <= n; ++i)
	{
		cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
	}
	for (int i = 1; i <= n; ++i)
	{
		dp[i][0]=max(dp[i-1][1],dp[i-1][2]) + arr[i][0];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2]) + arr[i][1];
		dp[i][2]=max(dp[i-1][1],dp[i-1][0]) + arr[i][2];
	}
	cout << max(max(dp[n][0],dp[n][1]),dp[n][2])<<endl;
	return 0;
}

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

using ll = long long;
using namespace std;
constexpr ll inf = (1ll<<60);
constexpr ll mod = 1e9+7;

ll dp[211][211] = {0};

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

    int N, M, R;
    cin>>N>>M>>R;
    vector<int> r(R);
    for (int n = 0; n < R; n++) cin>>r[n];
    for (int i = 0; i <= 210; i++) {
        for (int j = 0; j <= 210; j++) dp[i][j] = inf;
        dp[i][i] = 0;
    }

    for (int m = 0; m < M; m++) {
        ll a, b, c;
        cin>>a>>b>>c;
        dp[a][b] = dp[b][a] = c;
    }

    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            for (int k = 1; k <= N; k++) {
                dp[j][k] = min(dp[j][k], dp[j][i] + dp[i][k]);
            }
        }
    }

    sort(begin(r), end(r));
    ll ans = inf;
    do {
        ll rs = 0;
        for (int i = 0; i < R-1; i++) rs += dp[r[i]][r[i+1]];
        ans = min(ans, rs);
    } while (next_permutation(begin(r), end(r)));
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;
typedef long long int64;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    set<string> st;
    for (int i = 0; i < n; ++ i) {
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size();
    
}

Measured memory_bytes: 19244
package main

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

func main() {
	var n, k int
	_, _ = fmt.Scan(&n, &k)
	
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	
	answer := 0
	
	for i := 0; i < n; i++ {
		scanner.Scan()
		l, _ := strconv.Atoi(scanner.Text())
		if l >= k {
			answer++
		}
	}
	
	fmt.Println(answer)
}


Measured memory_bytes: 896
#include<iostream>
#include<vector>
#define rep(i,n) for(int i = 0; i < n; i++)
#include<algorithm>

using namespace std;

int main(){
  int N; cin >> N;
  vector<int> vec(N);
  rep(i,N){
    cin >> vec[i];
    vec[i] -= i+1;
  }
  sort(vec.begin(),vec.end());
  int index = N/2;
  int b = vec[index];
  long long ans = 0;
  rep(i,N){
    ans += abs(vec[i]-b);
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>

int main(){
	double w,h,x,y;
	scanf("%lf%lf%lf%lf", &w, &h, &x, &y);

	if(w/2 == x && h/2 == y) printf("%.6lf 1\n", w*h/2);
	else printf("%.6lf 0\n", w*h/2);
	return 0;
}
/*
Sample Input 1 
2 3 1 2
Sample Output 1
3.000000 0

2 2 1 1
Sample Output 2 
2.000000 1
*/

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	if((a==5&&b==5&&c==7)||
	   (a==5&&b==7&&c==5)||
	   (a==7&&b==5&&c==5))
	   {
	   		printf("YES\n");
	   }
	else{
		printf("NO\n");
	}
	return 0;
}


Measured memory_bytes: 3152
s = input()

flag = True

# print(flag)
# print(s[0])

if s[0] != 'A':
    # print('1st condition is not fulfill.')
    flag = False

# print(flag)
# print(s[2:-1],s[2:-1].count('C'))
if s[2:-1].count('C') != 1:
    # print('2nd condition is not fulfill.')
    flag = False

# print(flag)
t = s[1:2 + s[2:-1].find('C')]+s[3 + s[2:-1].find('C'):]
# print(t)
# print(t,t.islower())
if t.islower() != True:
    # print('3rd condition is not fulfill.')
    flag = False

if flag:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

	static int n,m,sumt,sumh;
	static int[] taro,hanako;
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		label:while(true){
			n=cin.nextInt();
			m=cin.nextInt();

			if(n+m==0)break;
			sumt=sumh=0;
			taro=new int[n];
			hanako=new int[m];
			for(int i=0;i<n;i++){
				taro[i]=cin.nextInt();
				sumt+=taro[i];
			}
			for(int i=0;i<m;i++){
				hanako[i]=cin.nextInt();
				sumh+=hanako[i];
			}
			List<int[]> list=new ArrayList<int[]>();
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					if(sumt-taro[i]+hanako[j]==sumh-hanako[j]+taro[i]){
//						System.out.println(taro[i]+" "+hanako[j]);
						list.add(new int[]{taro[i],hanako[j],taro[i]+hanako[j]});
//						continue label;
					}
				}
			}
			if(list.size()==0){
				System.out.println(-1);	
			}
			else{
				Collections.sort(list,new Comparator<int[]>(){
					public int compare(int[] a,int[] b){
						return a[2]-b[2];
					}
				});
				System.out.println(list.get(0)[0]+" "+list.get(0)[1]);
			}

			
		}

	}

}

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

int main() {
  string s;
  cin >> s;
  bool ans = true;
  if(s.size() % 2 == 0) {
    for(int i = 0; i < s.size(); i += 2) {
      if (s.at (i) == 'L' || s.at(i + 1) == 'R') ans = false;
    }
  }
  else {
    for(int i = 0; i < s.size() - 1; i += 2) {
      if (s.at (i) == 'L' || s.at(i + 1) == 'R') ans = false;
    }
    if(s.at(s.size() - 1) == 'L') ans = false;
  }
  if (ans == true) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main()
{
    int a,b;
    cin>>a>>b;
    if(a == 1 && b != 1)
    {
        cout<<"Alice"<<endl;

    }else if (b == 1 && a!= 1)
    {
        cout<<"Bob"<<endl;
    }
    else if(a>b)
    {
        cout<<"Alice"<<endl;
    }else if ( a < b)
    {
        cout<<"Bob"<<endl;
    }
    else
    {
        cout<<"Draw"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256