akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

int main(){
  int n,k;
  cin >> n >> k;
  int ans = 0;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    ans += 2*min(abs(k-x),x);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
s=input()

l=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

ans=""

for a in s:
  index = l.index(a)
  index=(index+n)%26
  ans += l[index]

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n=0;
    int ans[100000];
    while(1){
        cin >> x;
        ans[n]=0;
        if(x=="0"){
            break;
        }
        
        for(int i=0;i<x.length();i++){
            int num=x[i]-'0';
            ans[n]+=num;;
        }
        ++n;
    }
    
    for(int j=0;j<n;j++) cout << ans[j] << endl;
    return 0;

}


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

int main(void){
    char a[5];
    int ans;

    scanf("%s",a);

    if(strcmp(a,"RRR")==0){
        ans=3;
    }else if(strcmp(a,"RRS")==0 || strcmp(a,"SRR")==0){
        ans=2;
    }else if(strcmp(a,"RSS")==0 || strcmp(a,"SRS")==0 || strcmp(a,"SSR")==0 || strcmp(a,"RSR")==0){
        ans=1;
    }else{
        ans=0;
    }

    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 2152
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}



int main(){
   
   int d;
   cin>>d;
   vector<int> c(27,0);
   rep(i,26){
      cin>>c[i+1];
   }
   int s[d+1][27]={0};
   rep(i,d){
      rep(j,26){
         cin>>s[i+1][j+1];
      }
   }
   vector<int> t(d+1,0);
   rep(i,d){
      cin>>t[i+1];
   }

   vector<int> last(27,0);
   vector<int> ans(d+1,0);
   int tmp=0;

   rep(i,d+1){
      tmp+=s[i][t[i]];
      last[t[i]]=i;
      //加算
      rep(j,27){
         int x=c[j]*(i-last[j]);
         tmp-=x;
      }
      //減算
      ans[i]=tmp;
   }
   rep(i,d){
      cout<<ans[i+1]<<endl;
   }

   

return 0;
}


Measured memory_bytes: 3592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    static int N, Y;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        Y = sc.nextInt();
        System.out.println(solve());
    }

    static String solve() {
        Y /= 1000;

        // 10a + 5b + c = Y
        // a + b + c = N
        // =>
        // 5b + c = Y - 10a
        // b + c = N - a
        // =>
        // 4b = (Y - 10a) - (N - a) = Y - 9a - N
        // c = N - a - b
        for (int a = 0; a <= N; a++) {
            int b4 = Y - 9*a - N;
            if( b4 % 4 != 0 ) continue;
            int b = b4 / 4;
            int c = N - a - b;

            if( b >= 0 && c >= 0 ) {
                return a + " " + b + " " + c;
            }
        }
        return "-1 -1 -1";
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

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

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

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

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a < b){
        if(b < c){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3076
#include<cstdio>
#include<iostream>
#include<cstring>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using namespace std;

int main() {
int line[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5,1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int k;
cin >> k;
cout << line[k - 1] << endl;

return 0;
}

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

int main(){
    int N;
    int tri[200];
    static int ansA[1000000], ansB[1000000];
    /* ??£?????¢?????°?¨???? */
    for(int i=0;i<200;i++) tri[i] = i*(i+1)*(i+2)/6;
    
    /* ??????1,000,000?????§?????????????¨???????????????? */
    ansA[0] = ansB[0] = 0;
    for(int i=1;i<1000000;i++){
        ansA[i] = ansB[i] = i;  /* ????????????i???????????? */
        for(int j=1;i-tri[j]>=0;j++){
            /* ???????¨?????????§???????????£?????¢????????°????????????????¢???????????????? */
            ansA[i] = min(ansA[i], ansA[i-tri[j]]+1);
            /* ?\???°???????????´??? */
            if(tri[j]%2==1)
                ansB[i] = min(ansB[i], ansB[i-tri[j]]+1);
        }
    }
    
    /* input?????????????????????????????? */
    while(cin >> N, N)
        cout << ansA[N] << " " << ansB[N] << endl;
}

Measured memory_bytes: 8972
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using lint = long long;
using namespace std;

const int MOD = 1000000007;
const lint INF = 1LL << 60;

const double PI = acos(-1);
const double Rad2Deg = 180.0 / PI;
const double Deg2Rad = PI / 180.0;

int main() {
    int N;
    int d[60];
    cin >> N;
    rep(i, N) cin >> d[i];

    int sum = 0;

    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            sum += d[i] * d[j];
        }
    }
    cout << sum << endl;

    return 0;
}


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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll a, b;
    cin >> a >> b;
    string sa = "", sb = "";
    REP(i,0,b) sa += (char)a + '0';
    REP(i,0,a) sb += (char)(b) + '0';
    _PR(MIN(sa,sb));

    return 0;
}

/*



*/

Measured memory_bytes: 256
from itertools import accumulate
N, *A = map(int, open(0).read().split())

INF = 1 << 60
dp = [[-INF]*2 for _ in [0]*N]
dp[0][0] = 0

if N & 1:
    for i, a in enumerate(A):
        for j in range(i//2+1, i//2-1, -1):
            dp[j][0] = max(dp[j][0], dp[j][1])
            if j > 0:
                dp[j][1] = dp[j-1][0] + a
else:
    for i, a in enumerate(A):
        for j in range(i//2+1, (i+1)//2-1, -1):
            dp[j][0] = max(dp[j][0], dp[j][1])
            dp[j][1] = dp[j-1][0] + a

print(max(dp[N//2]))


Measured memory_bytes: 125600
#include<bits/stdc++.h>
int main(void)
{
  using namespace std;
  vector<int> p(3);
  
  cin >> p[0] >> p[1] >> p[2];
  
  sort(p.begin(),p.end());
  
  cout << p[0]+p[1] << endl;
  
  return 0;
}
   

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
signed main(){
  int a,b,n;
  cin>>n>>a>>b;
  a=a-n;
  b=b-n;
  if(a<0){
    a=a*-1;
  }
  if(b<0){
    b=b*-1;
  }
  if(a>b){
    cout<<"B\n";
  }
  else{
    cout<<"A\n";
  }
  return(0);
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = map(int, input().split())

    def make_divisors(n):
        divisors = []
        for i in range(1, int(pow(n, 0.5)) + 1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n // i)
        divisors.sort()
        return divisors

    max_num = m // n
    divisors = make_divisors(m)
    res = 1
    for div in divisors:
        if div <= max_num:
            res = div
        else:
            break

    print(res)




if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
string s;
int a[45],ans;
int main(){
	cin>>s;
	for(int i=0;i<4;i++){
		a[s[i]-'0']++;
	}
	for(int i=17;i<=44;i++){
		if(a[i]==2) ans++;
	}
	if(ans==2) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
// Problem : B - Easy Linear Programming
// Contest : AtCoder - AtCoder Beginner Contest 167
// URL : https://atcoder.jp/contests/abc167/tasks/abc167_b
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
#define ll                    long long int
#define pb                    push_back
#define F                     first
#define S                     second
#define mp                    make_pair
#define MOD                   1000000007
#define vi                    vector<int>
#define vll                   vector<ll>
#define pll                   pair<ll,ll>
#define pii                   pair<int,int>
#define all(p)                p.begin(),p.end()
#define mid(s,e)              (s+(e-s)/2)
#define eb                    emplace_back
#define ull                   unsigned long long
#define bug(x)				  cout<<"  [ "#x<<" = "<<x<<" ]"<<endl;
#define KAMEHAMEHA            ios_base::sync_with_stdio(0);
#define RASENGAN              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
    KAMEHAMEHA
//    #ifdef _soumik
//        freopen("input.txt", "r", stdin);
//    #endif
	ll a,b,c,k,sum=0;
	cin>>a>>b>>c>>k;
	sum+=min(a,k);
	k=max(0LL,k-a-b);
	sum-=k;
	cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a<b&&b<c){
        cout<<"Yes"<<endl;
        return 0;
    }
    else{
        cout<<"No"<<endl;
        return 0;
    }
}


Measured memory_bytes: 3092
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007
#define MAX 3000



signed main(){
     static int rcv[MAX+1][MAX+1]={{0}};
    static int ans[4][MAX+1][MAX+1];
    int R,C,K;
    cin>>R>>C>>K;


    for(int i=0;i<K;i++){
        int r,c,v;
        cin>>r>>c>>v;
        rcv[r][c]=v;
    }

    queue<int> qx,qy;

    qx.push(1);
    qy.push(1);

    for(int i=1;i<=R;i++){
        for(int j=1;j<=C;j++){
            for(int k=0;k<4;k++){
                ans[k][i][j]=-1;
            }
        }
    }

    ans[0][1][1]=0;
    while(!qx.empty()){
        int nx=qx.front();
        qx.pop();
        int ny=qy.front();
        qy.pop();
        for(int i=0;i<4;i++){
            if(ans[i][ny][nx]==-1) continue;
            if(i<=2){
                if(nx!=C&&(ans[i+1][ny][nx+1]<ans[i][ny][nx]+rcv[ny][nx])){
                    ans[i+1][ny][nx+1]=ans[i][ny][nx]+rcv[ny][nx];
                    qx.push(nx+1);
                    qy.push(ny);
                }
                if(ny!=R&&(ans[0][ny+1][nx]<ans[i][ny][nx]+rcv[ny][nx])){
                    ans[0][ny+1][nx]=ans[i][ny][nx]+rcv[ny][nx];
                    qx.push(nx);
                    qy.push(ny+1);
                }
            }
            if(nx!=C&&(ans[i][ny][nx+1]<ans[i][ny][nx])){
                ans[i][ny][nx+1]=ans[i][ny][nx];
                qx.push(nx+1);
                qy.push(ny);
            }
            if(ny!=R&&(ans[0][ny+1][nx]<ans[i][ny][nx])){
                ans[0][ny+1][nx]=ans[i][ny][nx];
                qx.push(nx);
                qy.push(ny+1);
            }

        }
    }
    cout<<max(ans[0][R][C]+rcv[R][C],max(ans[1][R][C]+rcv[R][C],max(ans[2][R][C]+rcv[R][C],ans[3][R][C])))<<endl;
}


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

int main() {
    
    int N, A, pennies_left;
    
    cin >> N;
    cin >> A;
    
    pennies_left = N % 500;
    
    if (pennies_left <= A){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s;
  cin >> s;
  const long long m = 1e9;
  cout << "0 0 " << m << " ";
  long long x = s / m;
  long long y = x * m - s;
  if (y < 0) {
	  x++;
	  y += m;
	}
  cout << y << " " << 1 << " " << x << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		UnionFindTree uft = new UnionFindTree(n);
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < q; i++) {
		    int type = sc.nextInt();
		    if (type == 0) {
		        int x = sc.nextInt();
		        int y = sc.nextInt();
		        int z = sc.nextInt();
		        uft.unite(x, y, z);
		    } else {
		        int x = sc.nextInt();
		        int y = sc.nextInt();
		        sb.append(uft.diff(x, y)).append("\n");
		    }
		}
		System.out.print(sb);
	}
	
	static class UnionFindTree {
	    int[] parents;
	    int[] weight;
	    int[] rank;
	    
	    public UnionFindTree(int size) {
	        parents = new int[size];
	        weight = new int[size];
	        rank = new int[size];
	        for (int i = 0; i < size; i++) {
	            parents[i] = i;
	        }
	    }
	    
	    public int find(int x) {
	        if (parents[x] == x) {
	            return x;
	        } else {
	            int p = find(parents[x]);
	            weight[x] += weight[parents[x]];
	            return parents[x] = p;
	        }
	    }
	    
	    public boolean same(int x, int y) {
	        return find(x) == find(y);
	    }
	    
	    public void unite(int x, int y, int w) {
	        int xx = find(x);
	        int yy = find(y);
	        if (xx == yy) {
	            return;
	        }
	        if (rank[xx] < rank[yy]) {
	            weight[xx] = - weight[x] + weight[y] + w;
	            parents[xx] = yy;
	            rank[yy] = Math.max(rank[yy], rank[xx] + 1);
	        } else {
	            weight[yy] = weight[x] - weight[y] - w;
	            parents[yy] = xx;
	            rank[xx] = Math.max(rank[xx], rank[yy] + 1);
	        }
	    }
	    
	    public String diff(int x, int y) {
	        if (same(x, y)) {
	            return String.valueOf(weight[x] - weight[y]);
	        } else {
	            return "?";
	        }
	    }
	}
}



Measured memory_bytes: 172904
#include "bits/stdc++.h"
using namespace std;

int main() {
    
	int h, w;
	cin >> h >> w;
	char arr[h+2][w+2];
	for (int i=0; i<h+2; i++) {
		for (int j=0; j<w+2; j++) {
			arr[i][j] = '#';
		}
	}
	for (int i=0; i<h; i++) {
		string s;
		cin >> s;
		for (int j=0; j<w; j++) {
			arr[i+1][j+1] = s[j];
		}
	}
	for (int i=0; i<h+2; i++) {
		for (int j=0; j<w+2; j++) {
			cout << arr[i][j];
		}
		cout << endl;
	}
	
    
}


Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

a,b,c,d,e,f = map(int, input().split())

#まず容器fグラムに入る分の砂糖の組み合わせを考える。
suger = []
for i in range(0, f+1):
    for j in range(0, f+1):
        tmp = c*i + d*j
        if (tmp <= f):
            suger.append(tmp)
suger = list(set(suger))

#次に容器fグラムに入る分の水の組み合わせを考える
watter = []
for i in range(0, f+1, 100):
    for j in range(0, f+1, 100):
        tmp = (a*i + b*j)
        if (tmp <= f):
            watter.append(tmp)

watter = list(set(watter))

#sugerとwatterの組み合わせを列挙して、条件を満たすもので濃度を列挙する
max_conset = -1.0
ans_watter = 0
ans_sugger = 0

#print(watter)
#print(suger)

for i in range(len(watter)):
    for j in range(len(suger)):

        if (0 < suger[j] + watter[i] <= f):
            if (watter[i] // 100 * e >= suger[j]):
                consent = 100 * suger[j] / (watter[i] + suger[j])
                if (max_conset < consent):
                    ans_watter = watter[i] + suger[j]
                    ans_sugger = suger[j]
                    max_conset = consent

print(ans_watter, ans_sugger)




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

int main(void){
    ll n, t;
    cin >> n >> t;

    ll mi = 100000;

    rep(i, n){
        ll c, t_m;
        cin >> c >> t_m;
        if(t_m <= t){
            if(c < mi){
                mi = c;
            }
        }
    }

    if(mi == 100000){
        cout << "TLE" << endl;
    }else{
        cout << mi << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int a=0,b=0,c=0,d,n=0,x=0;
    VI m(3);
    string s,s1,s2;
    cin >> n; 
    a=n/2;
    b=n-a; 
    cout << a*b <<endl;
    return 0;
} 

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

int main() {
	int t,y,i,j;
	cin >> t >> y ;
	char a[t][y];
	
	for(i=0;i<t;i++){
		for(j=0;j<y;j++){
			cin >> a[i][j];
		}
	}
	for(i=0;i<t;i++){
		for(j=0;j<y;j++) cout << a[i][j] ;
		cout << endl;
		for(j=0;j<y;j++) cout << a[i][j] ;
		cout << endl;
	}
	return 0;
}

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

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

    double p = 0;
    if(N % 2 == 0)p = 0.5;
    else p = ((N+1.0)/2.0)/N;

    cout << p << endl; 
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
bool prime[1000000];
void sieve() {
    fill_n(prime, 1000000, true);
    for (int i=2; i<=1000; ++i) {
        if (prime[i]) {
            for (int j=i; i*j<1000000; ++j) {
                prime[i*j] = false;
            }
        }
    }
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    sieve();
    int n;
    while (cin >> n) {
        int cnt = 0;
        for (int i=2; i<=n; ++i) {
            if (prime[i]) {
                cnt ++;
            }
        }
        cout << cnt << "\n";
    }
    return 0;
}

Measured memory_bytes: 2172
n,x = map(int,input().split())
def meet(n,x):
    total = 2**(n+2)-3
    if n == 1:
        bur = 'BPPPB'
        return bur[:x].count('P')
    else:
        if x < total//2+1:
            return meet(n-1,x-1)
        if x == total//2+1:
            return 2**n
        else:
            if x != total:
                return 2**n+meet(n-1,x-total//2-1)
            else:
                return 2**n+meet(n-1,2**(n+1)-3)

print(meet(n,x))


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

using namespace std;

const int MAXN = 1E5;
int ans[2 * MAXN - 1];
bool reserved[2 * MAXN];

int main()
{
    int n, x;
    cin >> n >> x;
    if (x == 1 || x == 2 * n - 1)
    {
        cout << "No" << endl;
    }
    else if (n == 2)
    {
        cout << "Yes" << endl;
        cout << 1 << endl;
        cout << 2 << endl;
        cout << 3 << endl;
    }
    else
    {
        int mid = (2 * n - 1) / 2;
        ans[mid] = x;
        if (x == 2)
        {
            ans[mid + 1] = 1;
            ans[mid + 2] = 3;
            ans[mid - 1] = 4;
            reserved[1] = reserved[2] = reserved[3] = reserved[4] = true;
        }
        else
        {
            ans[mid + 1] = x + 1;
            ans[mid + 2] = x - 1;
            ans[mid - 1] = x - 2;
            reserved[x - 2] = reserved[x - 1] = reserved[x] = reserved[x + 1] = true;
        }
        int cnt = 1;
        for (int i = 0; i < 2 * n - 1; i++)
        {
            if (ans[i] != 0)
                continue;
            while (reserved[cnt])
                cnt++;
            ans[i] = cnt++;
        }
        cout << "Yes" << endl;
        for (int i = 0; i < 2 * n - 1; i++)
            cout << ans[i] << endl;
    }
    return 0;
}


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

int a, b;

int main() {
    scanf("%d %d", &a, &b);
    if(a <= 0 && 0 <= b)
        printf("Zero\n");
    else if(a > 0)
        printf("Positive\n");
    else
        printf("%s\n", (b - a + 1) % 2 ? "Negative": "Positive");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 0) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  const ll MAX_T = 100;
  ll N = 2;
  std::vector< std::pair<ll, ll> > vp(N);
  std::vector< ll > ontime(MAX_T+1, 0LL);
  for (ll i = 0; i < N; i++) {
    std::cin >> vp[i].first >> vp[i].second;
    ontime[vp[i].first]++;
    ontime[vp[i].second]--;
  }

  ll ans = 0LL;
  if (ontime[0] == N) ans++;
  for (ll i = 1; i < MAX_T; i++) {
    ontime[i] += ontime[i-1];
    if (ontime[i] == N) ans++;
  }

  print(ans);

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;
typedef long long i64;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 5e1+5;
int n, a[N], b[N], vis[N]; i64 ans, lim; vector<i64> s[N];
void dfs(int p, int k, int q, i64 s, vector<i64> &v)
{
    s |= 1ll<<k, p %= k; if(p < q) return; if(p == q) return v.push_back(s);
    for(int i = q+1; i <= p; ++i) dfs(p, i, q, s, v);
}
int main()
{
    n = read();
    for(int i = 1; i <= n; ++i) a[i] = read();
    for(int i = 1; i <= n; ++i) 
    {
        b[i] = read(); 
        if(a[i] != b[i])
        {
            for(int k = b[i]+1; k <= a[i]; ++k) dfs(a[i], k, b[i], 0, s[i]);
            if(s[i].empty()) return puts("-1"), 0;
            if(b[i] == 0)
            {
                vector<i64> t; t.push_back(2);
                for(int j = 0; j < s[i].size(); ++j)
                {
                    if(~s[i][j]>>1&1) t.push_back(s[i][j]);
                }
                s[i] = t; 
            } 
        }
        else s[i].push_back(0);
    }
    for(int i = 1; i <= n; ++i)
    {
        int k = 0;
        for(int j = 1; j <= n; ++j)
            if(!vis[j]&&(!k||s[j][0]>s[k][0])) k = j;
        vis[k] = 1, ans |= s[k][0];
        for(int j = 1; j <= n; ++j)
            if(!vis[j])
            {
                for(int l = 0; l < s[j].size(); ++l) s[j][l] |= s[k][0];
                sort(s[j].begin(), s[j].end());
            }
    }
    printf("%lld\n", ans);
    return 0;
}

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

int main(){
    int N, C, K;
    cin >> N >> C >> K;
    vector<int> time(N);
    for (int i = 0; i < N; i++) cin >> time[i];
    sort(time.begin(), time.end());
    int f = time[0];
    int g = 0;
    int ans = 0;
    for (int i = 1; i < N; i++) {
        if (time[i] > f+K || i >= g+C) {
            ans++;
            f = time[i];
            g = i;
        }
    }
    cout << ans+1 << endl;
    return 0;
}


Measured memory_bytes: 768
import os

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
# MOD = 10 ** 9 + 7
MOD = 998244353


def get_factorials(max, mod=None):
    """
    階乗 0!, 1!, 2!, ..., max!
    :param int max:
    :param int mod:
    """
    ret = [1]
    n = 1
    if mod:
        for i in range(1, max + 1):
            n *= i
            n %= mod
            ret.append(n)
    else:
        for i in range(1, max + 1):
            n *= i
            ret.append(n)
    return ret


def mod_invs(max, mod):
    """
    逆元 0, 1/1, 1/2, 1/3, ..., 1/max
    :param int max:
    :param int mod:
    """
    invs = [1] * (max + 1)
    invs[0] = 0
    for x in range(2, max + 1):
        invs[x] = (-(mod // x) * invs[mod % x]) % mod
    return invs


def factorial_invs(max, mod):
    """
    階乗 0!, 1!, 2!, ..., max! の逆元
    :param int max:
    :param int mod:
    """
    ret = [1]
    r = 1
    for inv in mod_invs(max, mod)[1:]:
        r = r * inv % mod
        ret.append(r)
    return ret


class Combination:
    def __init__(self, max, mod):
        """
        :param int max:
        :param int mod: 3 以上の素数であること
        """
        self._factorials = get_factorials(max, mod)
        self._finvs = factorial_invs(max, mod)
        self._mod = mod

    def ncr(self, n, r):
        """
        :param int n:
        :param int r:
        :rtype: int
        """
        if n < r:
            return 0
        return self._factorials[n] * self._finvs[r] % self._mod * self._finvs[n - r] % self._mod


N, M, K = list(map(int, sys.stdin.buffer.readline().split()))

# dp[i][k]: i までみて、k 回同じ色になった
# dp = [[0] * (K + 2) for _ in range(N)]
# dp[0][0] = 1
# for i in range(N - 1):
#     for k in reversed(range(K + 1)):
#         # 同じ色
#         dp[i + 1][k + 1] += dp[i][k]
#         # 違う色
#         dp[i + 1][k] += dp[i][k] * (M - 1)
# print(np.array(dp))
# li = dp[-1][:K + 1]
# ans = sum(li) * M % MOD
# print(ans)
# print()

comb = Combination(max=max(N, M, K) + 100, mod=MOD)
ans = 0
for k in range(K + 1):
    ans += pow(M - 1, N - 1 - k, MOD) * comb.ncr(N - 1, k)
    ans %= MOD
print(ans * M % MOD)


Measured memory_bytes: 103232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128_t LL;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define F first
#define S second
#define pb push_back
mt19937 rnd;

const ll inf = 1e18 + 10;

ll f(ll b, ll n) {
    ll res = 0;
    while (n) {
        res += n % b;
        n /= b;
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    ll n, s;
    cin >> n >> s;
    ll ans = inf;
    for (ll b = 2; b * b <= n || b <= 100; b++) {
        if (f(b, n) == s) {
            ans = min(ans, b);
        }
    }
    if (n == s) {
        ans = min(ans, n + 1);
    }
    for (ll k = 1; k * k <= n && n > s; k++) {
        if ((n - s) % k == 0) {
            ll b = (n - s) / k + 1;
            if (f(b, n) == s) {
                ans = min(ans, b);
            }
        }
    }
    cout << (ans == inf ? -1 : ans) << "\n";

#ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


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

const unsigned long long int inf=1e18;



void solve()
{


 ll a;
 
 long double b;
 cin>>a>>b;
 
 
ll ans=1;
ans=(a*b*100)/100;


cout<<ans;


}


int main()
{


ios::sync_with_stdio(0); 
	cin.tie(0);


		solve();
	
return 0;

		
	}
	
	
	


Measured memory_bytes: 3768
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

K = ini()
N = 50


def solve():
    a = K // N
    h = (N - 1) + a
    r = K % N
    hs = [h + N - (r - 1)] * r + [h - r] * (N - r)
    return hs


ans = solve()
print(len(ans))
print(*ans)



Measured memory_bytes: 9148
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

/*
願はくは花の下にて春死なんそのきさらぎの望月のころ（西行 1118-1190）
--This is old Japanese poem expressing the desire to die under tree on the full moon night.(written by Saigyo)
In my research, there is possibility that the tree may be seg-tree.
*/

/*Coding Space*/
int main(){
  int a,b; cin >> a >> b;
  int ans = 0;
  if(a <= b){
    ans = a;
  }else{
    ans = a-1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define INF 1000000000
using namespace std;

int code[18];
int num[20001];
int N,M;
int minn;
int count = 0;
int nm[20001][256];
void saiki(int y,int sum,int kai){
  count++;
  //  cout <<"count=" << count << endl;
  //cout <<"y="<< y <<" sum=" << sum << " kai="<< kai<< endl;

  if(kai == N && y != -1) nm[N][y] = 0;//,printf("N,nm[%d][%d] = %d\n",kai,y,nm[kai][y]);
  
   if(kai < N && sum < minn && nm[kai][y] == INF) {
     for(int i=0;i<M;i++) {
       int yn = y+code[i];
       if(yn < 0) yn = 0;
       if(yn > 255) yn = 255;
      saiki(yn,sum+(num[kai]-yn)*(num[kai]-yn),kai+1);
      if(nm[kai+1][yn] + (num[kai]-yn)*(num[kai]-yn) < nm[kai][y]) nm[kai][y] = nm[kai+1][yn] + (num[kai]-yn)*(num[kai]-yn);
      //  printf("nm[%d][%d] = %d\n",kai,y,nm[kai][y]);
     }

   } else if(kai < N)saiki(-1,nm[kai][y]+sum,N);
   
  
}

int main() {

  while(1) {
    cin >> N >> M;
   
  if(N == 0 && M == 0) break;
  for(int i=0;i<M;i++) cin >> code[i];
  for(int i=0;i<N;i++) cin >> num[i] ;
  
  minn = INF;
  for(int i=0;i<=N;i++)
    for(int j=0;j<=255;j++)
      nm[i][j] = INF;
  
  saiki(128,0,0);

  cout << nm[0][128] << endl;
  
  //cout << minn << endl;
  //cout << count << endl;
  }
  return 0;
  
}

Measured memory_bytes: 22800
#include <bits/stdc++.h>
 
using namespace std;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"
 
#define sz(a) ((int)(a).size())
#define all(v) (v).begin(), (v).end()
#define tr(c, it) for (auto(it) = (c).begin(); (it) != (c).end(); it++)
#define pres(c, val) ((c).find(val) != (c).end())      //
#define cpres(c, val) (find(all(c), val) != (c).end()) //
 
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define forf(i, a, b) for (int i = (a); i < (b); i++)
#define forb(i, a, b) for (int i = (b); i >= (a); i--)
#define fo(i, n) forf(i, 0, n)
#define fob(i, n) forb(i, 0, n - 1)
 
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
 
const int INF = 9e18;
// const int N = 1e9 + 7;
const int N = 998244353;
 
const auto start_time = std::chrono::high_resolution_clock::now();
 
void zark() {
  #ifdef ZARK
  auto end_time = std::chrono::high_resolution_clock::now();
  std::chrono::duration<double> diff = end_time - start_time;
  cerr << "Time Taken : " << diff.count() << "s\n";
  #endif
}
 
#ifdef ZARK
#include "/home/aranjan/Desktop/CP/header.h"
#else
#define dbg(args...)
#endif
 
/* ------------------ Actual Coding Starts ------------------ */

void solve() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  double tt = (1.0*c)/b;
  int t = ceil(tt);
  double aa = (1.0*a)/d;
  int x = ceil(aa);
  if(t <= x) cout << "Yes\n";
  else cout << "No\n";
}
 
int32_t main() {
  fastio;
  #ifdef ZARK
  freopen("input.in", "r", stdin);
  #endif
 
  // freopen("txt.in", "r", stdin);
  // freopen("txt.out", "w", stdout);
  // cout << fixed << setprecision(35);
 
  solve();
  zark();
  return 0;
}

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


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define clear(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


int parse(const string& f)
{
	if (f.size() == 1)
		return f[0] - '0';
	else if (f[0] == '-')
	{
		int r = parse(f.substr(1));
		if (r == 0 || r == 2)
			 r ^= 2;
		return r;
	}
	else
	{
		char op;
		int pos;
		for (int i = 1, paren = 0; ; ++i)
		{
			if (f[i] == '(')
				++paren;
			else if (f[i] == ')')
				--paren;
			else if (paren == 0 && (f[i] == '+' || f[i] == '*'))
			{
				pos = i;
				op = f[i];
				break;
			}
		}

		int left = parse(f.substr(1, pos - 1));
		int right = parse(f.substr(pos + 1, f.size() - (pos + 2)));
		if (op == '*')
			return min(left, right);
		else
			return max(left, right);
	}
}
string set_value(const string& f, int p, int q, int r)
{
	string res = f;
	for (int i = 0; i < f.size(); ++i)
	{
		if (res[i] == 'P')
			res[i] = p + '0';
		else if (res[i] == 'Q')
			res[i] = q + '0';
		else if (res[i] == 'R')
			res[i] = r + '0';
	}
	return res;
}
int main()
{
	string f;
	while (cin >> f, f[0] != '.')
	{
		int res = 0;
		for (int p = 0; p < 3; ++p)
			for (int q = 0; q < 3; ++q)
				for (int r = 0; r < 3; ++r)
					if (parse(set_value(f, p, q, r)) == 2)
						++res;
		cout << res << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	ll k;
	cin>>k>>s;
	cout<<s.substr(0,k)+(s.size()>k?"...":"")<<endl;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n;
  R n;
  ll a[n];
  ll c[111111];
  mem(c);
  rep(i,n) {
    R a[i];
    c[a[i]]++;
  }
  ll x=0;
  rep(i,111111) x+=max(0LL,c[i]-1);
  pr(n-(x+x%2));
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 1920
{-# OPTIONS_GHC -O #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}

import Control.Monad
import Data.List
import Data.Char

main = do
    [n,m] <- map read.words<$>getLine
    let k = n-m
    print $ ((k*100) + (m*1900)) * 2^m


Measured memory_bytes: 508
#include<stdio.h>
int s[100000];
int binarySearch(int,int);

int main(){
  int n,q,i,t,kazu=0;
  
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&s[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&t);
    if(binarySearch(t,n)) kazu++;
  }
  printf("%d\n",kazu);
  
  return 0;
}
int binarySearch(int key,int n){
  int mid,left=0,right=n;

  while(left<right){
    mid=(left+right)/2;
    if(s[mid]==key) return 1;
    else if(key<s[mid]) right=mid;
    else left =mid+1;
  }
  return 0;
}



Measured memory_bytes: 2132
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll INF= 1e18L+5;

int main() {
	int n;
	cin >>n;
	ll a[n];
	for(int i=0; i<n; i++)
		cin >> a[i];
	ll dp[n+1][n+1];

	for(int r=0; r<n;r++){
		for(int l=r;l>=0;l--){
			if(l==r)
				dp[l][r] = a[l];
			else{
				dp[l][r] = max(a[l]-dp[l+1][r],a[r]-dp[l][r-1]);
			}
		}
	}
	cout<<dp[0][n-1]<<endl;
}

Measured memory_bytes: 70528
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int n = S.length();
    rep(i, n - 1) {
        if (S[i] == 'A' && S[i + 1] == 'C') {cout << "Yes" << endl; return 0;}
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc106/tasks/abc106_d
#include <bits/stdc++.h>
using namespace std;
using P = pair<double, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

template <class T> struct CumulativeSum2D {
    vector<vector<T>> data;

    CumulativeSum2D(int W, int H) : data(W + 1, vector<T>(H + 1, 0)) {}

    void add(int x, int y, T z) {
        ++x, ++y;
        if (x >= data.size() || y >= data[0].size())
            return;
        data[x][y] += z;
    }

    void build() {
        for (int i = 1; i < data.size(); i++) {
            for (int j = 1; j < data[i].size(); j++) {
                data[i][j] +=
                    data[i][j - 1] + data[i - 1][j] - data[i - 1][j - 1];
            }
        }
    }

    T query(int sx, int sy, int gx, int gy) {
        return (data[gx][gy] - data[sx][gy] - data[gx][sy] + data[sx][sy]);
    }
};

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M, Q;
    cin >> N >> M >> Q;
    CumulativeSum2D<int> sum(N + 1, N + 1);
    REP(i, M) {
        int l, r;
        cin >> l >> r;
        sum.add(l, r, 1);
    }
    sum.build();
    REP(i, Q) {
        int p, q;
        cin >> p >> q;
        cout << sum.query(p, p, q + 1, q + 1) << "\n";
    }

    return 0;
}


Measured memory_bytes: 1920
abcde = [int(input()) for _ in range(5)]

s = 0
t = 125
for i in range(5):
  if abcde[i]%10 != 0:
    if int(str(abcde[i])[-1]) < t:
      s = i
      t = int(str(abcde[i])[-1])

ans = 0
for i in range(5):
  if s == i: continue
  if abcde[i] % 10 == 0: ans += abcde[i]
  else:
    while abcde[i]%10 != 0:
      abcde[i] += 1
    ans += abcde[i]
print(ans+abcde[s])

Measured memory_bytes: 9212
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


X, Y = LI()
print(int(X + Y/2))


Measured memory_bytes: 5580
#include<stdio.h>
#include<vector>

using namespace std;

int main()
{
	int n,k;
	vector<int> veca;

	scanf("%d %d",&n,&k);

	veca.resize(n);

	for(int a=0;a<n;a++)
	{
		scanf("%d",&veca[a]);
	}

	printf("%d\n",((n-2)/(k-1))+1);	

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
const long long INF = 114514;
int v[110], w[110];
long long dp[110][100010]={0};
int main() {
  int n, W;
  cin >> n >> W;
  for(int i=0; i<n; ++i) {
    cin >> w[i] >> v[i];
  }
  for(int i=0; i<n; ++i) for(int j=0; j<=W; ++j) {
    if (w[i]<=j) dp[i+1][j]=dp[i][j-w[i]]+v[i];
    dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
  }
  cout << dp[n][W] << endl;
}

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

//整数nの各桁を足すやつ
int sum(int n){
    int sum=0;
	while(n>0){
        sum+=n%10;
        n/=10;
	}
return sum;
}

int main() {
	int N,A,B;
    cin >> N >> A >> B;
    int count=0;
	for(int i=1;i<=N;i++){
      int c=sum(i);
         if(A<=c&&c<=B) count+=i;
    }
	cout << count << endl;
}

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

using namespace std;

#define PB(x)	push_back(x)
#define ALL(x)	(x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define MP(x)	make_pair(x);

#define debug(x)        cerr << #x << '=' << x << endl;
#define debug2(x, y)    cerr << #x << '=' << x << ' ' << #y << '=' << y << endl;
#define debugn(_a)      cerr << #_a << ": "; for (const auto _x: _a) cerr << _x << ' '; cerr << endl;
#define debugm(a)       cerr << #a << ":\n"; \
                        for (auto v: a) { for(const auto x: v) cerr << x << ' '; cerr << "\n"; }
 
#define FAST_IO ios::sync_with_stdio(false); cin.tie(0)

#define int long long int

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vii;
typedef vector<string> vs;
typedef unsigned long long ull;
 
const int INF  = LONG_LONG_MAX;
const int NINF = LONG_LONG_MIN;
const int mmod = 1000000007;

int32_t main()
{
	FAST_IO;
	
	int a, b, k;
	cin >> a >> b >> k;
	
	if (k >= a) {
		k -= a;
		a = 0;
	} else {
		a -= k;
		k = 0;
	}
	if (k > 0) b -= k;
	if (b < 0) b = 0;
	cout << a << ' ' << b << endl;
}
// g++ -Wall -Wextra -Wshadow -fsanitize=undefined 


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	D, T, S := nextInt(), nextInt(), nextInt()

	if D > T*S {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}


Measured memory_bytes: 1804