akhauriyash/Code-Regression huggingface dataset:
#include <unordered_set>
#include <cstdio>

int main(){
    int n;
    std::scanf("%d", &n);
    std::unordered_set<int> set;
    for(int i = 0; i < n; ++i){
        int v;
        std::scanf("%d", &v);
        set.insert(v);
    }

    int m;
    std::scanf("%d", &m);
    int count = 0;
    for(int i = 0; i < m; ++i){
        int v;
        std::scanf("%d", &v);
        if(set.find(v) != set.end()) ++count;
    }

    std::printf("%d\n", count);

    return 0;
}


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

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a % 2 == 0 || b % 2 == 0) {
		cout << "Even" << endl;
	}
	else {
		cout << "Odd" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(){
long long s,x,f=0;
scanf("%lld",&s);
x=s;
do{
f=f+x%10;
x=x/10;
}while(x>0);
if(s%f==0){printf("Yes");return 0;}else printf("No");
return 0;
}

Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int W = scanner.nextInt();

    long[] w = new long[N];
    long[] v = new long[N];

    for (int i = 0; i < N; i++) {
      w[i] = scanner.nextInt();
      v[i] = scanner.nextInt();
    }

    long[][] vw = new long[4][N + 1];
    int[] idx = new int[4];
    for (int i = 0; i < N; i++) {
      int d = (int) (w[i] - w[0]);
      vw[d][idx[d]++] = v[i];
    }
    for (int i = 0; i < 4; i++) {
      Arrays.sort(vw[i]);
      reverse(vw[i], 1, N);
      for (int j = 1; j < N + 1; j++) vw[i][j] += vw[i][j - 1];
    }

    long max = 0;
    for (int a = 0; a <= N; a++) {
      for (int b = 0; b <= N - a; b++) {
        for (int c = 0; c <= N - a - b; c++) {
          for (int d = 0; d <= N - a - b - c; d++) {
            long tw = w[0] * a + (w[0] + 1) * b + (w[0] + 2) * c + (w[0] + 3) * d;
            long tv = vw[0][a] + vw[1][b] + vw[2][c] + vw[3][d];
            if (tw > W) continue;
            max = Math.max(max, tv);
          }
        }
      }
    }
    System.out.println(max);
  }

  private static void swap(long[] a, int i, int j) {
    long tmp = a[i];
    a[i] = a[j];
    a[j] = tmp;
  }

  private static void reverse(long[] a, int i, int j) {
    if (i > j) throw new IllegalArgumentException("i must be less than j");
    while (i < j) {
      swap(a, i, j);
      i++;
      j--;
    }
  }
}


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

int main(){
    int n, m;
    cin >> n >> m;
    int o = 0;
    for (int i = n-1; i > 0; i--){
        o += i;
    }
    for (int i = m-1; i > 0; i--){
        o += i;
    }
    cout << o << endl;
    return 0;
}

Measured memory_bytes: 256
// 　　＿＿
// 　／　<＠ﾌ
//  ｜(ﾉﾉハ))
//  ﾉ从ﾟヮﾟ从
// 　ﾉ｜ｿﾉГ|つ author:hotarunx
// 〈_ﾉ^^^ヽ|
// 　~~tｧtｧ~
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    string s;
    cin >> s;

    if (s.back() != 's')
        s.push_back('s');
    else
        s += "es";

    cout << s << "\n";
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

// LazyAddSegmentTree
template<typename T>
class LazyAddSegTree{
public:
    int n;
    T defaultValue;
    vector<T> dat;
    vector<T> lazy;

    LazyAddSegTree(vector<T>& v, T value){
        n = 1;
        int vSize = (int)v.size();
        while(n < vSize){
            n *= 2;
        }
        dat.assign(2 * n - 1, value);
        lazy.assign(2 * n - 1, 0);
        defaultValue = value;

        for(int i = 0; i < vSize; i++){
            dat[i + n - 1] = v[i];
        }
        for(int i = n - 2; i >= 0; i--){
            dat[i] = ope(dat[2 * i + 1], dat[2 * i + 2]);
        }
    }

    T add(int a, int b, T value, int k = 0, int l = 0, int r = -1){
        if(r < 0){
            r = n;
        }
        propagate(k);

        if(r <= a || b <= l){
            return dat[k];
        }

        if(a <= l && r <= b){
            lazy[k] += lazyPlus(value, l, r);
            propagate(k);
            return dat[k];
        }
        else{
            T vl = add(a, b, value, 2 * k + 1, l, (l + r) / 2);
            T vr = add(a, b, value, 2 * k + 2, (l + r) / 2, r);
            dat[k] = ope(vl, vr);
            return dat[k];
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = -1){
        if(r < 0){
            r = n;
        }

        if(r <= a || b <= l){
            return defaultValue;
        }
        propagate(k);

        if(a <= l && r <= b){
            return dat[k];
        }
        else{
            T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
            T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return ope(vl, vr);
        }
    }

private:

    void propagate(int k){
        if(lazy[k] != 0){
            dat[k] += lazy[k];
            if(k <= n - 2){
                T value = lazyPropPlus(lazy[k]);
                lazy[2 * k + 1] += value;
                lazy[2 * k + 2] += value;
            }

            lazy[k] = defaultValue;
        }
    }

    T ope(T a, T b){
        return a + b;
    }

    T lazyPlus(T value, int l, int r){
        return (r - l) * value;
    }

    T lazyPropPlus(T value){
        return value / 2;
    }
};

int main(){

    int n, q;
    cin >> n >> q;

    vector<long long> v(n, 0);
    LazyAddSegTree<long long> lazySegTree(v, 0);

    for(int loop = 0; loop < q; loop++){
        int com;
        cin >> com;
        if(com == 0){
            int s, t, x;
            cin >> s >> t >> x;
            lazySegTree.add(s - 1, t, x);
        }
        else{
            int i;
            cin >> i;
            cout << lazySegTree.query(i - 1, i) << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 7848
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
#define ld long double
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
ll mod2=998244353;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactive problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main(){ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

    string s;
    cin>>s;
    ll n = s.length();
    if(s[n-1]=='s'){
        s+="es";
    }
    else{
        s+="s";
    }
    cout<<s;

    return 0;
}


Measured memory_bytes: 3664
import itertools

n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
if n == 1:
    print(xyh[0])
    pass
else:
    for cx, cy in itertools.product(range(0, 101), range(0, 101)):
        flag = False
        tmp_h = 0
        for x, y, h in xyh:
            if h != 0:
                tmp_h_tmp = h + abs(cx-x) + abs(cy-y)
                if tmp_h == 0:
                    tmp_h = tmp_h_tmp
                else:
                    if tmp_h != tmp_h_tmp:
                        flag = True
                        break
        if flag:
            continue
        for x, y, h in xyh:
            if h == 0:
                if not max(tmp_h - abs(cx-x) - abs(cy-y), 0) == 0:
                    flag = True
                    break
        if flag:
            continue
        print(cx, cy, tmp_h)
        break


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        boolean[] dict = new boolean[33554432];
        
        for(int i = 0; i < n; i++) {
            String[] commands = br.readLine().split(" ");
            int key = makeKey(commands[1]);

            if(commands[0].equals("insert")) {
                //System.out.println("insert:" + commands[1] + ":" + key);
                dict[key] = true;
            } else {
                if(dict[key]) {
                    System.out.println("yes");
                } else {
                    System.out.println("no");
                }
            }
        }
    }

    public static int makeKey(String s) {
        int key = 1;
        for(int i = 0; i < s.length(); i++) {
            int c = 0;
            switch(s.charAt(i)) {
            case 'A':
                c = 0;
                break;
            case 'C':
                c = 1;
                break;
            case 'G':
                c = 2;
                break;
            case 'T':
                c = 3;
                break;
            }
            key <<= 2;
            key |= c;
        }
        return key;
    }
}

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

int main()
{
  int a,b;
  
  cin >> a >> b;
  
  if(a>b)
    cout << "a > b\n";
  else if(a<b)
    cout << "a < b\n";
  else if(a==b)
    cout << "a == b\n";
  
  return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	string a,b,c;
	cin>>a>>b>>c;
	cout<<a[0]<<b[1]<<c[2]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const ll mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n;
    string s;
    cin >> n >> s;
    vector<int> wsum(n+1, 0), esum(n+1, 0);
    for(int i = 0; i < n; ++i){
        if(s[i] == 'W'){
            wsum[i+1] = wsum[i] + 1;
            esum[i+1] = esum[i];
        }
        else{
            esum[i+1] = esum[i] + 1;
            wsum[i+1] = wsum[i];
        }
    }
    int res = INF;
    for(int i = 0; i < n; ++i){
        int hoge = wsum[i] + (esum[n] - esum[i+1]);
        chmin(res, hoge);
    }
    cout << res << endl;
}

Measured memory_bytes: 2964
if __name__ == '__main__':

	ans = dict()
	while True:
		try:
			n = int(input())

			if n not in ans:
				ans[n] = 1
			else:
				ans[n] += 1

		except EOFError:
			break


	a = max(ans.values())

	A = []
	for d in ans:
		if ans[d] == a:
			A.append(d)

	B = sorted(A)
	for i in B:
		print(i)



Measured memory_bytes: 5600
#include <stdio.h>

int main(void){
	int a,b[3],i;
	a=0;
	for(i=0;i<3;i++){
		b[i]=0;
	}
	for(i=0;i<10;i++){
		scanf("%d",&a);
		if( b[0] < a ){
			b[2] = b[1];
			b[1] = b[0];
			b[0] = a;
		}
		else if( b[1] < a ){
			b[2] = b[1];
			b[1] = a;
		}
		else if( b[2] < a ){
			b[2] = a;
		}
	}
	printf("%d\n%d\n%d\n",b[0],b[1],b[2]);
}

Measured memory_bytes: 1028
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>

#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007

using namespace std;

struct UnionFind{
  vector<int> par,num;

  UnionFind(int N) : par(N),num(N){
    for(int i=0;i<N;i++){
      par[i] = i;
      num[i] = 1;
    }
  }

  int root(int x){
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    par[rx] = ry;
    num[ry] = num[ry]+num[rx]; 
  }

  int get_num(int x){
    int rx = root(x);
    return num[rx];
  }

  bool same(int x, int y){
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

ll modpow(ll a, ll n, ll p){
  if(n == 0){
    return 1;
  }
  if(n%2 == 0){
    ll root = modpow(a,n/2,p);
    return root * root %p;
  }
  else{
    return a*modpow(a,n-1,p)%p;
  }
}


int main(void){
  ll n,k;
  cin >> n >> k;
  int a[n+1];
  rep(i,n) cin >> a[i+1];

  int cnt[n+1];

  rep(i,n){
    cnt[i+1] = -1;
  }
  cnt[1] = 0;
  int roop_s,roop_e,cur = 1;
  for(int i=1;i<n;i++){
    if(cnt[a[cur]] != -1){
      roop_e = cur;
      roop_s = a[cur];
      break;
    }
    cnt[a[cur]] = i;
    cur = a[cur];
  }
  //for(int i=0;i<n;i++)cout << cnt[i+1] << endl;
  int range = cnt[roop_e]+1-cnt[roop_s];
  int ans;
  if(cnt[roop_e] < k){
    k -= cnt[roop_s];
    ans = roop_s;
    for(int i=0;i<k%(range);i++){
      ans = a[ans];
    }
  }
  else{
    ans = 1;
    for(int i=0;i<k;i++){
      ans = a[ans];
    }
  }

  cout << ans << endl;
  return 0;
}


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

int main() {
  ll X;
  cin >> X;

  for(ll i = 1;; i += 1) {
    if(i * (i + 1) / 2 >= X) {
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

char a,b,c,d;

int main(){
	cin>>a>>b>>c>>d;
	if(a==b||b==c||c==d) cout<<"Bad"<<endl;
	else cout<<"Good"<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define reg register
using namespace std;
typedef long long ll;
const int MN=1e5+5;
int n,x[MN],y[MN];
char ch[MN];
int main(){
	scanf("%s",ch+1);n=strlen(ch+1);
	if((ch[n]^48)||!(ch[1]^48))return 0*puts("-1");
	for(reg int i=1;i<=(n>>1);i++)if(ch[i]^ch[n-i])return 0*puts("-1");
	reg int pre=1;
	for(reg int i=2;i<=n;i++)if(ch[i]^48)for(;pre<i;pre++)printf("%d %d\n",pre,i);
	printf("%d %d\n",n-1,n);
	return 0;
}
//I love adv

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

import sys
from collections import deque
from math import hypot
from operator import itemgetter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()
A=[]
for i in range(N):
    x,y=MAP()
    A.append((x, y))

# yでソート済を準備しておく
Ay=sorted(A, key=itemgetter(0))
Ay.sort(key=itemgetter(1))

# ベクトルの外積
def cross(a, b):
    x1,y1=a
    x2,y2=b
    return x1*y2-y1*x2

def sub(a, b):
    return (a[0]-b[0], a[1]-b[1])

def calc(a, b, c):
    # aから見たb,cへ向かうベクトルにする
    v1=sub(b, a)
    v2=sub(c, a)
    return cross(v1, v2)

# 2点間の距離
def get_dist(v1, v2):
    return hypot(v1[0]-v2[0], v1[1]-v2[1])

# アンドリューのアルゴリズム(Monotone Chain)
def monotone_chain(li):
    # 左半分
    # 使う座標を保持
    stack=deque()
    stack.append(li[0])
    stack.append(li[1])
    for i in range(2, N):
        # 1つ前->次 と 1つ前->2つ前 のベクトルで外積をチェックして向きを判定する
        while len(stack)>=2 and calc(stack[-1], li[i], stack[-2])<0:
            # 次が時計回り側にある時は1つ前を外す
            stack.pop()
        # 次が反時計回り側にあればOKなので進める
        stack.append(li[i])
    res=list(stack)[:-1]

    # 右半分(やることは同じ)
    stack=deque()
    stack.append(li[-1])
    stack.append(li[-2])
    for i in range(N-3, -1, -1):
        while len(stack)>=2 and calc(stack[-1], li[i], stack[-2])<0:
            stack.pop()
        stack.append(li[i])
    res+=list(stack)[:-1]

    return res

ans=monotone_chain(Ay)
print(len(ans))
[print(x, y) for x, y in ans]



Measured memory_bytes: 21680
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int n,a,b;
    cin >> n >> a >> b;
    if(a + 2 >= b || a-1 > n){
        cout << n+1 << endl;
    }else{
        int ans = a;
        n -= a-1;
        //2回たたくごとにb-a増える
        ans += (b-a)*(n/2);
        cout << max(ans+n%2, n+1) << endl;;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
    string line;
    cin >> line;
    int k;
    cin >> k;

    int index = 0;
    while (index < min<size_t>(k, line.size()) && (line[index] == '1')){
        index++;
    } 
    if (index == min<size_t>(k, line.size())) {
        index--;
    }

    cout << line[index] << endl;
}

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

int main()
{
	int K, X, Y;
	cin >> K >> X >> Y;

	if( abs(X) + abs(Y) == K ) {
		cout << 1 << endl;
		cout << X << " " << Y << endl;
		return 0;
	}
	int xsign = 1;
	int ysign = 1;
	int sw = 0;
	if( X < 0 ) {
		xsign = -1;
		X *= -1;
	}
	if( Y < 0 ) {
		ysign = -1;
		Y *= -1;
	}
	if( X < Y ) {
		sw = 1;
		swap( X, Y );
	}
	int D = X + Y;
	int n = max( 2, (D + K - 1) / K );
	if( ( n * K - D ) % 2 ) {
		if( K % 2 ) {
			n++;
		}
		else {
			cout << -1 << endl;
			return 0;
		}
	}
	vector<pair<int, int>> ans;
	int R = (n * K - D) / 2;
	if( n == 3 ) {
		int b = R / 2;
		int a = R - b;
		for( int i = 1; i <= n; i++ ) {
			int l = i * K;
			if( l <= a ) {
				ans.push_back( make_pair( 0, -l ) );
			}
			else if( l <= a + Y + b ) {
				l -= a;
				ans.push_back( make_pair( -a, l ) );
			}
			else if( l <= a + Y + b + a + X ) {
				l -= a + Y + b;
				ans.push_back( make_pair( l - a, b + Y ) );
			}
			else {
				l -= a + Y + b + a + X;
				ans.push_back( make_pair( X, b + Y - l ) );
			}
		}
	}
	else {
		int a = R;
		for( int i = 1; i <= n; i++ ) {
			int l = i * K;
			if( l <= Y + a ) {
				ans.push_back( make_pair( 0, l ) );
			}
			else if( l <= Y + a + X ) {
				l -= Y + a;
				ans.push_back( make_pair( l, Y + a ) );
			}
			else {
				l -= Y + a + X;
				ans.push_back( make_pair( X, Y + a - l ) );
			}
		}
	}
	if( sw ) {
		for( int i = 0; i < n; i++ ) {
			swap( ans[i].first, ans[i].second );
		}
	}

	cout << n << endl;
	for( int i = 0; i < n; i++ ) {
		cout << ans[i].first * xsign << " " << ans[i].second * ysign << endl;
	}
}

Measured memory_bytes: 3952
mod = 10**9+7
n = int(input())
C = []
prev = None
for i in range(n):
	tmp = int(input())
	if tmp==prev:
		n -= 1
		continue
	else:
		C.append(tmp)
		prev = tmp
dp = [0]*n
dp[0] = 1
table = {C[0]:1}

for i in range(n-1):
	if C[i+1] not in table:
		table[C[i+1]]= 0 
	dp[i+1] = dp[i] + table[C[i+1]]  
	table[C[i+1]] += dp[i]
	dp[i+1] %= mod
	table[C[i+1]] %= mod

print(dp[n-1])


Measured memory_bytes: 31008
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
 
using namespace std;
using namespace atcoder;
using ll = long long;
 
int main() {
	int n, q;
	cin >> n >> q;
	dsu d(n);
	rep(i, q) {
		bool t;
		int a, b;
		cin >> t >> a >> b;
		if (t) {
			bool s;
			s = d.same(a, b);
			cout << (s ? 1 : 0) << endl;
		}
		else {
			d.merge(a, b);
		}
	}
	return 0;
}

Measured memory_bytes: 3880
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		double ans=0;
		double rev_sum=0;
		double a =0;
		
		for(int i=0;i<n;i++) {
			a = sc.nextInt();
			rev_sum += 1/a;
		}
		ans = 1/rev_sum;
		
		System.out.println(ans);
		
		
		
		
		
	}
}


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

void solve(long long A, long long B) {
  if (A <= 8 && B <= 8) {
    cout << "Yay!";
  } else {
    cout << ":(";
  }
  cout << endl;
}

int main() {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(A, B);
  return 0;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N; cin >> N;
    vector<string> s(N); vector<int> t(N);
    for(int i=0; i<N; i++) cin >> s[i] >> t[i];

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>

int main()
{
    int N;
    std::cin >> N;
    std::vector<int> A(N), B(N), C(N-1);
    for(int i=0; i<N; i++){scanf(" %d", &A[i]); A[i]--;}
    for(int i=0; i<N; i++) scanf(" %d", &B[i]);
    for(int i=0; i<N-1; i++) scanf(" %d", &C[i]);

    int sum = 0;
    for(int i=0; i<N; i++){
        sum += B[A[i]];
        if(i!=0 && A[i-1] == A[i]-1) sum += C[A[i-1]];
    }

    std::cout << sum << std::endl;
}

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

int main() {
  
  int n;
  cin >> n;
  
  vector<int> w(n);
  int a = 0;
  REP(i,n) {
    cin >> w[i];
    a += w[i];
  }
  
  int b = 0;
  int c = 10000;
  REP(i,n) {
    a -= w[i];
    b += w[i];
    if (c > abs(a-b)) c = abs(a-b);
    else break;
  }
    
  cout << c << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) << endl ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int solve(){
	ll n ; cin >> n ;
	vll a(n),b(n) ;
	for(int i=0;i<n;i++) cin >> a.at(i) >> b.at(i) ;
	sort(all(a)) ;
	sort(all(b)) ;
	if(n&1) cout << b.at(n/2)-a.at(n/2)+1 << endl ;
	else cout << b.at(n/2)-a.at(n/2)+b.at(n/2-1)-a.at(n/2-1)+1 << endl ;
	return 0 ;
}

int main(){
	solve() ;
}

Measured memory_bytes: 6440
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define endl "\n"
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fb(i, a, b) for(ll i=a; i>=b; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector <int>
#define vl vector <long long>
#define pi pair <int, int>
#define sz(x) (int) x.size()
#define M 100005
#define mod 1000000007
using namespace std;

bool comp(tuple <int, int, int, int>& a, tuple <int, int, int, int>& b)
{
	return get<3>(a) > get<3>(b);
}

void solve()
{
	double a, b, n, x;
	cin>>a>>b>>n;
	if(n >= b-1) x = b-1;
	else x = n;
	cout<<floor((a*x)/b) - a*floor(x/b);
}

int main()
{
    IOS
    int t = 1;
    //cin>>t;
    f(tno, 1, t+1)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3792
import sys
from itertools import permutations

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


def main():
    N, M, *AB = map(int, read().split())
    G = [[False] * N for _ in range(N)]
    for a, b in zip(*[iter(AB)] * 2):
        G[a - 1][b - 1] = G[b - 1][a - 1] = True

    ans = 0
    for perm in permutations(range(1, N)):
        if not G[0][perm[0]]:
            continue
        ok = True
        for i in range(N - 2):
            if not G[perm[i]][perm[i + 1]]:
                ok = False
                break
        if ok:
            ans += 1

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9044
#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>

using namespace std;

int main() {
	int i, j, a, b;

	cin >> a >> b;

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



	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,X;
    cin >> N >> X;
    vector<int> V(N);
    rep(i,0,N)cin >> V[i];

    int d = 0;
    int cnt = 1;
    rep(i,0,N){
        d += V[i];
        if(d <= X)cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
using System;

namespace ABC092_a
{
    class Program
    {
        static void Main(string[] args)
        {
           
            int[] array = new int[4];
            for(int i = 0; i < array.Length; i++)
            {
                array[i] = int.Parse(Console.ReadLine());
            }
            
                int  a = array[0];
                int b = array[1];
                int c = array[2];
                int d = array[3];
            
            
            int train = 0;
            int bus = 0;
            if(a >= b)
            {
                train = b;
            }
            else
            {
                train = a;
            }
            if(c >= d)
            {
                bus = d;
            }
            else
            {
                bus = c;
            }
            Console.WriteLine(train + bus);
            

        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int a[1010];
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+1+n);
	long long ans=0;
	for(int i=1;i<=k;i++)ans+=a[i];
	cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main()
{
  int n,t;
  cin>>n>>t;
  vector<vecint> dp(n+1, vecint(t+3001, 0));
  vector<tuple<int,int>> vt;
  for(int i:irange(0,n)) {
    int a,b;
    cin>>a>>b;
    vt.emplace_back(a,b);
  }
  boost::sort(vt);
  for(int i:irange(0,n)) {
    int a,b;
    tie(a,b) = vt[i];
    for(int j:irange(0,t+3001)) {
      dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
      if (j < t) {
        dp[i+1][j+a] = max(dp[i+1][j+a], dp[i][j] + b);
      }
    }
  }
  cout<<*boost::max_element(dp[n])<<endl;
  return 0;
}


Measured memory_bytes: 70784
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}

int n,w[5000],sum;

signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
        cin >> n;
        for(int i=1;i<=n;i++){
                cin >> w[i];
                sum+=w[i];
        }
        int ans = 10000000000;
        int cur = 0;
        for(int i=1;i<n;i++){
                cur+=w[i];
                int k =
                ans = min( ans,  abs( sum-cur - cur ) );
        }
        cout << ans << endl;


return 0;
}
///....


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

int main(){
  int n, a;
  cin >> n >> a;
  
  int n_div= n % 500;
  if (n_div <= a){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,t;
    cin>>n>>x>>t;
    if(n<=x)
    {
        cout<<t;
    }
    else
    {
        if(n%x==0)
        {
            n/=x;
        }
        else
        {
            n/=x;
            n+=1;
        }
        t*=n;
        cout<<t;
    }
}

Measured memory_bytes: 3616
/*
  Contest 081
  A - Placing Marbles
  Rakesh Kumar --> 13/09/2020
 */

#include <bits/stdc++.h>

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

    std::string s;
    std::getline(std::cin, s);
    int count = 0;
    for (char c : s)
        if (c == '1')
            ++count;
    std::cout << count << std::endl;

    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  vector<int> b(N,0);
  for (int i = 0;i< N;i++){
  cin >> a.at(i);
  
  b.at(a.at(i)-1) = i+1;
    
    }
  for(int k = 0;k<N;k++){
  cout << b.at(k) << ' ';
  }
}

Measured memory_bytes: 1536
#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 all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
int main(){
	ll x,y;
	cin>>x>>y;
	if(abs(x-y)<=1) puts("Brown");
	else puts("Alice");
}


Measured memory_bytes: 384
#include <stdio.h>

int main(){

  int	K,A,B,i;
  int	ans=0;
  
  scanf("%d", &K);
  scanf("%d %d", &A, &B);
  
  for(i=A; i<=B; i++){
    if(i%K == 0){ ans=1; }
  }

  if( ans==1 ){ printf("OK"); }
  else		  { printf("NG"); }

  return 0;
}

Measured memory_bytes: 1704
#include<iostream>
#include<algorithm>
using namespace std;
int n,k;
int a[100000+5];
int main(){
    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    int mins=2099999999;
    for(int i=0;i+k-1<n;i++){
        mins=min(mins,a[i+k-1]-a[i]);
    }
    printf("%d\n",mins);

}


Measured memory_bytes: 888
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <numeric>
#include <math.h>

using namespace std;

typedef long long ll;

int main(void){
    ll n,k;
    cin >> n >> k;
    ll ans = 0;
    ll i;
    for(i = 1;i <= n;i++){
        ans += max(0LL,(n / i) * (i - k));
        if(n % i){
            ans += max(0LL, (n % i) - max(0LL, k - 1LL));
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/
const int MOD = 1e9 + 7;
int main()
{
    //freopen("input.txt", "r", stdin);
    SPEED
    ll n;
    cin >> n;
    string s;
    cin >> s;
    map<char, int> cnt;
    for (auto c : s) {
        cnt[c]++;
    }
    ll ans = 1;
    for (auto p : cnt) {
        ll _cnt = p.second;
        ans *= (_cnt + 1);
        ans %= MOD;
    }
    cout << (ans + MOD - 1) % MOD;
}
/************************************** END OF PROGRAM ******************************************/
/** Stuff you should look for:
 * int overflow, array bounds, over-counting
 * special cases (n=1?), set/unordered_set TLE, multi-set/set error
 * do something instead of nothing and stay organized
 */


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

using namespace std;

typedef unsigned long long ll;

int main()
{
    int   n ,k;
    cin >> n >>k;
    ll a[n] ;

    for(int i=0;i<n;i++)
        cin >> a[i];

    sort(a,a+n);
    ll r=0;
    if (n>k)
    {for(int i=0;i<(n-k);i++)
            r+=a[i];
    }
    cout<<r;
    return 0;
}



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

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

	int H,N;
	int i,k;
	int ans=0;
	int ctr=0;

	cin >> H >> N;

	 
	vector<int> gv(N);
	rep(i,N) cin >> gv[i];

	if(H<=accumulate(gv.begin(),gv.end(),0)) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;

ll dp[1010][1010];

int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    int H,W;
    string grid[1010];
    cin >> H >> W;
    for(int i = 0; i < H; ++i) cin >> grid[i];
    dp[0][0] = 1;
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
            if(dp[i][j]=='#') continue;
            if(j > 0 && grid[i][j-1]!='#') dp[i][j] += dp[i][j-1];
            if(i > 0 && grid[i-1][j]!='#') dp[i][j] += dp[i-1][j];
            dp[i][j] %= MOD;
        }
    }
    cout << dp[H-1][W-1] << endl;
    return 0;
}

Measured memory_bytes: 9216
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String line[] = line = bf.readLine().split("\\s");
        int n = Integer.parseInt(line[0]);
        int w = Integer.parseInt(line[1]);
        int wt[] = new int[n];
        int val[] = new int[n];

        for (int i = 0; i < n; ++i) {
            line = bf.readLine().split("\\s");
            wt[i] = Integer.parseInt(line[0]);
            val[i] = Integer.parseInt(line[1]);
        }
        int total_value = 0;
        for (int value : val) total_value += value;
        long[] dp = new long[total_value + 1];
        dp[0] = 0;
        long INF = Long.MAX_VALUE - Integer.MAX_VALUE;
        for (int i = 1; i < total_value + 1; i++) {
            dp[i] = INF;
        }

        for (int i = 0; i < n; i++) {
            for (int v = total_value - val[i]; v >= 0; v--) {
                dp[v + val[i]] = Math.min(dp[v + val[i]], dp[v] + wt[i]);
            }
        }
        long ans = 0;
        for (int i = 0; i <= total_value; i++) {
            if (dp[i] <= w) {
                ans = Math.max(ans, i);
            }
        }

        System.out.println(ans);


    }
}


Measured memory_bytes: 22868
#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() {
  string s;
  cin >> s;
  vector<bool> app(26);
  rep(i, 26) app[i] = false;
  rep(i, s.size()) app[s[i] - 'a'] = true;
  rep(i, 26) if(!app[i]) {
    cout << string(1, i + 'a') << "\n";
    return 0;
  }
  
  cout << "None" << "\n";
  return 0;
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define rep(i,n)        for(int i=0;i<n;i++)
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define Sort(v)         sort(v.begin(), v.end(), sortbysec)
#define setbits(x)      __builtin_popcountll(x)
#define rightmostbit(x) __builtin_ffsll(x)
#define leftzeros(x)    __builtin_clzll(x)
#define rightzeros(x)   __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         cout << fixed; cout << setprecision(x); cout << y;
#define pi              3.141592653589793238
#define mk(a,n)         int n;cin>>n;vi a(n);for(int i=0;i<n;i++) cin>>a[i]
#define w(x)            int x; cin>>x; while(x--)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{	return (a.second < b.second);
	// sorted by 2nd element in ascending order
}
void g_b()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
}
int32_t main()
{
	mk(a, n);
	sort(a.begin(), a.end());
	int ans = a[n - 1];
	for (int i = n - 2; i >= n / 2; i--)
	{
		ans += (a[i] * 2);
	}
	if (n & 1)ans = ans - a[n / 2];
	cout << ans;
	return 0;

}

Measured memory_bytes: 4820
n = int(input())
D = list(map(int, input().split()))
from collections import Counter
dic = Counter(D)
max_D = max(D)
 
num = 1
import sys
if D[0] != 0 or dic[0] != 1:
  print(0)
  sys.exit()
else:
  for i in range(1, max_D + 1):
    num *= (dic[i-1]) ** dic[i]
    num %= 998244353
print(num)

Measured memory_bytes: 63540
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
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; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    ll N;
    cin >> N;
    VLL a(N);
    ll count=0;
    rep(i,N){
        cin >> a[i];
        if((i+1)%2==1 && a[i]%2==1){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3592
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    char c[] = str.toCharArray();

    if (c[2] == c[3] && c[4] == c[5]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }


  }
}


Measured memory_bytes: 23764