akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws Exception {

        ModScanner ms = new ModScanner();
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        int n = ms.nextInt();
        int w = ms.nextInt();
        int[] wt = new int[n];
        int[] val = new int[n];
        for (int i = 0; i < n; i++) {
            wt[i] = ms.nextInt();
            val[i] = ms.nextInt();
        }

        long[] dp = new long[w + 1];

        for (int i = 1; i <= n; i++) {
            long[] temp = new long[w + 1];
            for (int j = 1; j <= w; j++) {
                temp[j] = Math.max(dp[j], temp[j - 1]);
                if (j >= wt[i - 1]) {
                    temp[j] = Math.max(temp[j], val[i - 1] + dp[j - wt[i - 1]]);
                }
            }
            dp = temp;
        }

        out.println(dp[w]);
        out.close();
    }


}

class ModScanner {

    BufferedReader br;
    StringTokenizer st;

    public ModScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String nextToken() throws Exception {
        while (st == null || !st.hasMoreElements()) {
            st = new StringTokenizer(br.readLine());

        }
        return st.nextToken();
    }

    String nextString() throws Exception {
        return br.readLine();
    }


    int nextInt() throws Exception, Exception {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }

}


Measured memory_bytes: 51996
/************************* In the name of Allah *************************/
#include <bits/stdc++.h>
using namespace std;

typedef long long       ll;
typedef long double     ld;
typedef string          str;
typedef pair<ll,ll>     pll;

#define F               first
#define S               second
#define pb              push_back
#define sep             ' '
#define endl            '\n'
#define fast_io         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const ll MOD = 1e9 + 7,
         INF = 1e18,
         MAXN = 1e5 + 10;

int main(){
    fast_io
    string s, t;
    cin >> s >> t;
    int ans = 0;
    ans += s[0] == t[0];
    ans += s[1] == t[1];
    ans += s[2] == t[2];
    cout << ans;
    return 0;
}

/*
 __  __       _         _ _  _____ _           _                __ _
|  \/  |     | |       | (_)/ ____| |         | |              / _(_)
| \  / | __ _| |__   __| |_| (___ | |__   ___ | | _____  _   _| |_ _
| |\/| |/ _` | '_ \ / _` | |\___ \| '_ \ / _ \| |/ / _ \| | | |  _| |
| |  | | (_| | | | | (_| | |____) | | | | (_) |   < (_) | |_| | | | |
|_|  |_|\__,_|_| |_|\__,_|_|_____/|_| |_|\___/|_|\_\___/ \__,_|_| |_|
*/


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t x,k,d; cin>>x>>k>>d; x=abs(x);
	int64_t mn=(x+d-1)/d;
	if(mn>k){
		cout<<x-k*d;
	}
	else{
		int64_t L=abs(x-d*mn),R=abs(x-d*(mn-1));
		if(L>R){
			if((mn-1+k)%2)cout<<L;
			else cout<<R;
		}
		else{
			if((mn+k)%2)cout<<R;
			else cout<<L;
		}
	}
	cout<<"\n"s;
}


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

int main()
{
  int N, A, T;
  cin >> N >> T >> A;
  vector<pair<float, int>> H(N);
  rep(i, N)
  {
    int h;
    cin >> h;
    float temperature = (float)T - (float)h * 0.006;
    temperature = abs(temperature - A);
    H[i] = make_pair(temperature, i + 1);
  }
  sort(H.begin(), H.end());

  cout << H[0].second << endl;

  return 0;
}

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

int main() {
	string b;
	cin >> b;
	if (b=="A")cout << "T" << endl;
	if (b == "T")cout << "A" << endl;
	if (b == "C")cout << "G" << endl;
	if (b == "G")cout << "C" << endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
R,d,f,s,x=sorted(list(map(int,input().split()))for i in range(N))+[(2e9,0)],[0]*N+[1],[0]*N,1,N
for i in range(N-1,-1,-1):
	while R[x][0]<sum(R[i]):x=f[x]
	d[i]=s=(s+d[x])%998244353;f[i],x=x,i
print(d[0])

Measured memory_bytes: 64044
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,x,y;
	cin >> a >> b >> c >> x >> y;
	if(a + b <= 2*c){
		printf("%d",x*a+y*b);
		return 0;
	}
	int cost = 0;
	int tmp = min(x,y);
	cost += 2*c*tmp;
	x -= tmp;y -= tmp;
	if(x){
		if(2*c < a){
			cost += 2*c*x;
		}
		else cost += a*x;
	}
	if(y){
		if(2*c < b)cost += 2*c*y;
		else cost += b*y;
	}
	printf("%d",cost);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n;
string s;
int main(void){
    cin>>n>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]+n>90){
            s[i]=s[i]+n-26;
        }else{
            s[i]=s[i]+n;
        }
    }
    cout<<s<<endl;

}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main()
{
     string s,t,u;
     int a,b;
     cin>>s>>t;
     cin>>a>>b;
     cin>>u;
     if(s==u)
          cout<<a-1<<' '<<b;
     else if(t==u)
          cout<<a<<' '<<b-1;
    return 0;

}


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

namespace ABC159
{
    class B
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var s = S.Substring(0, (S.Length - 1) / 2);

            //Console.WriteLine(s);

            // check
            bool kaibun = true;
            for (int i = 0; i < s.Length / 2; i++)
            {
                if (s[i] != s[s.Length - 1 - i]) kaibun = false;
            }

            var s2 = S.Substring((S.Length + 2) / 2, S.Length / 2);
            //Console.WriteLine(s2);
            //Console.WriteLine(kaibun);
            if (kaibun && s == s2) Console.WriteLine("Yes");
            else Console.WriteLine("No");

        }
    }
}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct Point {
  double x, y;
  Point(double x = 0, double y = 0):x(x), y(y){}
};

int n;
Point seg[2][14];
double dp[2][14][1<<14];

double sq(double x) {
  return x*x;
}

double dist(Point p, Point q) {
  return sqrt(sq(p.x-q.x)+sq(p.y-q.y));
}

double solve(int idx, int ep, int bit) {
  if(bit == (1<<n)-1) return 0.0;
  double &res = dp[ep][idx][bit];
  if(res != -1.0) return res;
  res = 1e9;
  rep(i, n) {
    if((bit>>i)&1) continue;
    rep(j, 2) res = min(res, solve(i, j, bit|1<<i) + dist(seg[ep][idx], seg[!j][i]));
  }
  return res;
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  for(int t = 1; cin >> n, n; t++) {
    double sum = 0.0;
    rep(i, n) {
      rep(j, 2) cin >> seg[j][i].x >> seg[j][i].y;
      sum += dist(seg[0][i], seg[1][i]);
    }

    double ans = 1e9;
    rep(i, 2) rep(j, 14) rep(k, 1<<14) dp[i][j][k] = -1.0;
    rep(i, n) {
      ans = min(ans, solve(i, 0, 1<<i), solve(i, 1, 1<<i));
    }
    cout << "Case " << t << ": " << ans+sum << endl;
  }

  return 0;
}

Measured memory_bytes: 6836
N,T = map(int,input().split())
t = input().split()
t = [int(i) for i in t]
t_len = len(t)
t_diff = [t[i+1] - t[i] for i in range(t_len-1)]
for i in range(t_len-1):
    if t_diff[i] > T:
        t_diff[i] = T
print(sum(t_diff)+T)


Measured memory_bytes: 25172
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;

ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}


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


int n, r, arr[3005], DP[3005][3005], cnt[3005][2];
char str[3005];


ll dp(int i, int ones){

	if(i == r)	return 1;
	if(DP[i][ones] != -1)	return DP[i][ones];

	int zeroes = (arr[i]-i+1) - ones;
	ll ans = 0;
	if(ones > 0){
		ans += dp(i+1, (ones-1)+(cnt[arr[i+1]][1]-cnt[arr[i]][1]));
		ans %= MOD;
	}
	if(zeroes > 0){
		ans += dp(i+1, ones+(cnt[arr[i+1]][1]-cnt[arr[i]][1]));
		ans %= MOD;
	}
// cout<<"dp "<<i<<" "<<ones<<" returns "<<ans<<endl;
	return DP[i][ones] = ans;
}



int main(){

    ios_base::sync_with_stdio(0);

    int m;
    cin>>n>>m;
    cin>>(str+1);

    for(int i=1;i<=n;i++){
    	cnt[i][0] = cnt[i-1][0];
    	cnt[i][1] = cnt[i-1][1];
    	cnt[i][str[i]-'0']++;
    	arr[i] = i;
    }

    while(m--){
    	int a, b;
    	cin>>a>>b;
    	for(int i=a;i<=b;i++)
    		arr[i] = max(arr[i], b);
    }

// for(int i=1;i<=n;i++)	cout<<arr[i]<<" ";cout<<endl;

    memset(DP, -1, sizeof(DP));
    ll ans = 1;
    int i = 1;
    while(i <= n){

    	if(arr[i] == i){
    		i++;
    		continue;
    	}

    	r = arr[i];
    	int j = i;
    	while(j <= r){
    		r = max(r, arr[j]);
    		j++;
    	}

    	ans = (ans * dp(i, cnt[arr[i]][1]-cnt[i-1][1])) % MOD;
    	i = j;
    }

    cout<<ans;
    return 0;
}








Measured memory_bytes: 35712
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i,n){
        cin >> a[i];
    }
    SORT(a);
    put(a.back()-a.front());
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



using pint = pair<int,int>;


int main() {
    int N;
    while (cin >> N) {
        vector<pint> res(N);
        for (int i = 0; i < N; ++i) cin >> res[i].first, res[i].second = i;
        sort(res.begin(), res.end());

        for (int i = 0; i < N; ++i) cout << res[i].second + 1 << " ";
    }
}
        


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

class Program
{
  static void Main(string[] args)
  {
    var a = Console.ReadLine().Split(' ');
    long A = long.Parse(a[0]);
    long B = long.Parse(a[1]);
    long C = long.Parse(a[2]);
    long K = long.Parse(a[3]);

    long S = A+B+C;


    long plusA=0;
    long plusB=0;

    if (K%2==0){
      plusA=A;
      plusB=B;
    }else{
      plusA=B+C;
      plusB=A+C;
    }

    // long LA = S*Math.Pow(4, K/2)*(-3) + plusA;
    // long LB = S*Math.Pow(4, K/2)*(-3) + plusB;

    long Res =  plusA-plusB;

    if (Res >= 100000000000000000 || Res  <= -100000000000000000){
      Console.WriteLine("Unfair");
    }else{
      Console.WriteLine(Res);
    }
    
    


  }
}


Measured memory_bytes: 11092
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]

dp = [1]*(N+1)
mod = 10**9+7

for A in a:
    dp[A] = 0

for i in range(N+1):
    if i>=2 and dp[i]:
        dp[i] = (dp[i-1]+dp[i-2])%mod

print(dp[N])

Measured memory_bytes: 7848
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
struct Counters {
    int N, all;
    vector<int> vals;
    Counters(int n) : N(n), all(0), vals(n) {}
    int get(int idx) {
        return vals[idx] + all;
    }
    void add(int idx, int val) {
        vals[idx] += val;
    }
    void addall(int val) {
        all += val;
    }
};
int main() {
    Int N; cin >> N;
    vector<int> C(N); for (auto &c : C) cin >> c, c--;
    vector<vector<int>> G(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b; cin >> a >> b; a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<Int> ans(N, N + N * (N - 1) / 2);
    Counters cnt(N);
    auto recur = [&](auto &recur, int node, int prev) -> void {
        int color = C[node];
        cnt.addall(1);
        cnt.add(color, -1);
        for (auto next : G[node]) if (next != prev) {
            Int tmp = cnt.get(color);
            cnt.add(color, -tmp);
            recur(recur, next, node);
            Int t = cnt.get(color);
            ans[color] -= t + t * (t - 1) / 2;
            cnt.add(color, -t + tmp);
        }
    };
    recur(recur, 0, -1);
    for (int color = 0; color < N; color++) {
        Int t = cnt.get(color);
        ans[color] -= t + t * (t - 1) / 2;
        cout << ans[color] << '\n';
    }
    return 0;
}


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

int main()
{
	int D,B,C;
	cin >> D >> B >> C;
	vector<int> A;
	A.push_back(D);
	A.push_back(B);
	A.push_back(C);
	sort(A.begin(),A.end());
	if ((A[0] == A[1] && A[1] != A[2]) || (A[0] != A[1] && A[1] == A[2]))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

#include<bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

#define int         long long
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
//#define hell          1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
// mp::cpp_int
//#define pp pair<pii,pii>
const int hell =1000000007;



int power(int a,int b)
{
  if(b==0)return 1;
  if(b==1)return a;
  int t=power(a,b/2);
  t%=hell;
  t*=t;
  t%=hell;
  if(b%2)return (t*a)%hell;
  else
     return t;
}

int gcd(int a,int b)
{
  if(b==0)return a;
  return gcd(b-a%b,a%b);
}

int digitsum(int x)
{
  while(x>9)
    {  int ans=0;
       while(x!=0)
       {
        ans+=x%10;
        x/=10;
       }
       x=ans;
    }
    return x;
}

int pw(int a,int b)
{
  int x=a;
  rep(i,1,b){a=a*x;}
  return a;
}




int solve( ){


int n;
cin>>n;
vi a(n),b(n);
int su=0;
rep(i,0,n)cin>>a[i];
rep(i,0,n)cin>>b[i];
rep(i,0,n)
{
  if(a[i]>b[i])su+=a[i]-b[i];
}
cout<<su;

return 0;
}

signed main()
{  int t=1;
 ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   cin.exceptions(cin.failbit);



 //sieve();
  clock_t time_req;

    // Without using pow function
    time_req = clock();
    
//cin>>t;

    int k=1;
   while(t--)
     {
       //cout<<"case #"<<k<<":"<<" ";k++;
      solve();
     }

         time_req = clock() - time_req;
 // cout << "Processor time taken is "
   // << (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;


    return 0;
}

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

namespace AtCoder
{
    static class Program_D
    {
        private class Solver
        {

            private long baseNum = 26;
            // 149-C - One Quadrillion and One Dalmatians
            public void Solve()
            {
                var n = long.Parse(Console.ReadLine())-1;
                var keta = CalcKeta(n);

                var a = CreateArray(keta.Item1, keta.Item2);
                var str = new string(a.Select(tmp => (char)('a' + tmp)).ToArray());

                Console.WriteLine(str);

                //TestKeta();
                //TestBaseArray();
            }

            private void TestBaseArray()
            {
                var vals = new int[] {0, 26 - 1, 26, 27, 28, 26*26 - 1, 26*26, 26*26 + 1, 26*26*26 - 1, 26*26*26};
                foreach (var val in vals)
                {
                    var a = CreateArray(4, val);
                    var str = new string(a.Select(tmp => (char) ('a' + tmp)).ToArray());
                    Console.WriteLine($"{val} : {str}");

                }
            }

            private void TestKeta()
            {
                var vals = new int[] {0, 25, 26, 702-1, 703-1, 18278-1, 18279-1};
                foreach (var val in vals)
                {
                    var keta = CalcKeta(val);
                    Console.WriteLine($"{val} => {keta.Item1}, {keta.Item2}");
                }
            }

            private Tuple<long, long> CalcKeta(long n)
            {
                long test = 0;
                for (long i = 1; i < 100; ++i)
                {
                    long nextTest = test + Pow(baseNum, i);
                    if (n < nextTest)
                    {
                        return Tuple.Create(i, n - test);
                    }
                    test = nextTest;
                }
                return Tuple.Create(-1L, -1L);
            }

            // nthは0オフセット.
            private int[] CreateArray(long keta, long val)
            {
                var result = new int[keta];
                for (int i = 0; i < keta; ++i)
                {
                    result[i] = (int) (val%baseNum);
                    val /= baseNum;
                }
                Array.Reverse(result);
                return result;
            }
            
            private static long Pow(long a, long b)
            {
                long result = 1;
                for (int i = 0; i < b; ++i)
                {
                    result *= a;
                }
                return result;
            }

            private static void Main(string[] args)
            {
                new Solver().Solve();
            }

        }
    }

}

Measured memory_bytes: 28140
# -*- coding: utf-8 -*-
N = int(input())
A = list(map(int, input().split()))
f = list(set(A))
s = N - len(f) #重複枚数検出

if s%2 == 0:
    print(len(f)) #fが奇数 sが偶数。2枚ずつ取り出すから。
else:
    print(len(f) - 1)

Measured memory_bytes: 14204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    ll in = 0, out = 0;
    rep(i, n) {
        if (s[i] == 'a') {
            if ((a + b) > (in + out)) {
                in++;
                cout << "Yes\n";
            }
            else {
                cout << "No\n";
            }
        }
        else if (s[i] == 'b') {
            if (((a + b) > (in + out)) && (b > out)) {
                out++;
                cout << "Yes\n";
            }
            else {
                cout << "No\n";
            }
        }
        else {
            cout << "No\n";
        }
    }
    return 0;
}


Measured memory_bytes: 848
/* ex5_4
   moka223711*/

#include <stdio.h>
#define SIZE 11

int main(void){
    char c;
    int i = 0, count = 0, ans = 0;
    while((c = getchar()) != EOF){
        if(c=='A'||c=='C'||c=='G'||c=='T')count++;
        else{
            if(count > ans)ans = count;
            count = 0;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1596
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class DCaracalVsMonster {
public:
    void solve(std::istream &in, std::ostream &out) {
        ll h;
        in >> h;
        ll res = (1ll << (__lg(h) + 1)) - 1;
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    DCaracalVsMonster solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3652
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N, W = map(int, readline().split())
    dp = [0]*(W+1)
    for _ in range(N):
        v, w = map(int, readline().split())
        if W-w>=0:
            for i in range(W,w-1,-1):
                dp[i] = max(dp[i], dp[i-w]+v)
    print(dp[W])

if __name__ == '__main__':
    main()




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

#define pb push_back
#define mk make_pair
#define fi first
#define sec second

typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);

const long long N = 1e5 + 10;
long long n, w; 
long long dp[110][N];
vector<pair<ll, ll> > item;

ll pog(ll at, ll size){
	if(size < 0) return -INF;
	else if(at >= n) return 0;

	ll &r = dp[at][size];
	if(r != -1) return r;

	return r = max(pog(at+1, size), pog(at+1, size-item[at].fi) + item[at].sec);
}

int main(){
	ios_base::sync_with_stdio(false);
	
	memset(dp, -1, sizeof dp);
	cin >>n >>w;

	for(int i = 0; i < n; i++){
		ll size, price;
		cin >>size >>price;
		item.pb(mk(size, price));
	}

	cout <<pog(0, w) <<endl;
	return 0;
}



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

int main() {
    string S;
    cin >> S;
    for (int i = 0; S[i];i++){
        S[i] = 'x';
    }
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double

#define pll pair<ll,ll>
#define ff first
#define ss second

#define pb push_back
#define all(x) x.begin(),x.end()

#define MOD  1000000007
const int N = 100005; 

#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));

void solve()
{   
    ll n;
    cin >>n;
    ll a[n];
    ll sum = 0;
    for(ll i=0;i<n;i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    ll last = sum;
    for(ll i=0;i<n-1;i+=2)   last -= 2*a[i];
    ll ans[n];
    ans[n-1] = last;
    ans[0] = 2*a[n-1] - ans[n-1];
    for(ll i=0;i<n-1;i++)
    {
        ans[i+1] = 2*a[i] - ans[i];
    }
    for(ll i=0;i<n;i++)   cout<<ans[i]<<" ";
}

int main()
{
    FAST;
    int t = 1;
 // cin >> t;
    for(int i=1;i<=t;i++)
    {
        solve();
    }
}

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

const int MD = 2 * TEN(6) + 100;
//const int MD = 30;
using P = pair<int, int>; // time, value

int K;
int d[MD];

V<P> res;
V<int> st;
void dfs(int l, int r, int p, P nw) {
    while (st.size() && st.back() <= p) st.pop_back();
    if (p == r) {
        res.push_back(nw);
        return;
    }
    int nx = d[p] & nw.second;
    d[p] ^= nw.second;
    if (nx) {
        dfs(l, r, p+1, P(nw.first, nx));
    }
    if (d[p] == 3 && nw.first != K-1) {
        int np = (st.size() ? st.back() : r) - p;
        int nt = K - nw.first - 1;
        int mi = min(np, nt);
//        cout << "MI: " << np << " " << nt << " " << mi << endl;
        assert(mi > 0);
//        int mi = 1;
        d[p] = 0;
        dfs(l, r, p+mi, P(nw.first+mi, 3));

        // d[p] = 0;
        // dfs(l, r, p+1, P(nw.first+1, 3));
    }
    if (d[p]) st.push_back(p);
}

V<P> single(int l, int r, const V<P> &v) {
    for (int i = r-1; i >= l; i--) {
        if (d[i]) st.push_back(i);
    }
    res.clear();
    for (P nw: v) {
        dfs(l, r, l, nw);
    }
    return res;
}

V<P> solve(int l, int r) {
    if (r - l == 1) {
        if (d[l] == 3) {
            d[l] = 0;
            return {P(0, 3)};
        }
        return {};
    }
    int md = (r+l)/2;
    auto v1 = solve(l, md);
    auto v2 = solve(md, r);
    auto v3 = single(md, r, v1);
    for (auto p: v3) v2.push_back(p);

/*    cout << l << " " << r << " DEBUG: ";
    for (auto p: v2) {
        cout << "(" << p.first << ", " << p.second << "), ";
    } cout << endl;*/

    return v2;
}

string norm(string s) {
    while (s.back() == '0') s.pop_back();
    reverse(begin(s), end(s));
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m >> K;
    string s;
    cin >> s;
    for (int i = 0; i < n; i++) {
        if (s[i] == '0') continue;
        d[n-1-i] |= 1;
    }
    cin >> s;
    for (int i = 0; i < m; i++) {
        if (s[i] == '0') continue;
        d[m-1-i] |= 2;
    }
    solve(0, MD);
    {
        string s, t;
        for (int i = 0; i < MD; i++) {
            if (d[i] & 1) s += "1";
            else s += "0";
        }
        for (int i = 0; i < MD; i++) {
            if (d[i] & 2) t += "1";
            else t += "0";
        }
        cout << norm(s) << endl << norm(t) << endl;
    }
    return 0;
}


Measured memory_bytes: 21008
#include<iostream>

using namespace std;

int main() {

    int H, W;
    bool H_gu;
    bool W_gu;

    do {
        cin >> H >> W;
        
        if (H == 0 && W == 0) {
            break;
        }

        if (H % 2 == 0) {
            H_gu = true;
        }
        else {
            H_gu = false;
        }
        if (W % 2 == 0) {
            W_gu = true;
        }
        else {
            W_gu = false;
        }

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W / 2; j++) {
                if (i % 2 == 0) {
                    cout << "#.";
                }
                else {
                    cout << ".#";
                }
            }
            if (W_gu == false && i % 2 == 0) {
                cout << "#" << endl;
            }
            else if (W_gu == false && i % 2 == 1) {
                cout << "." << endl;
            }
            else {
                cout << endl;
            }
       }
                   cout << endl;

    } while (1);
}


Measured memory_bytes: 3084
#include <iostream>
#include <cctype>
#include <string>

using namespace std;




int main(){
    int i=0;
    string s;
    getline(cin,s);
    
    while(i < s.size()){
        if(isupper(s[i])){s[i] = tolower(s[i]);}
        else if(islower(s[i])){s[i] = toupper(s[i]);}
        i++;
    }
    cout << s << endl;
   return 0;
}


Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
}
const int N = 2e5 + 50;
ll mod = 998244353;
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937_64 mt(seed);
int fac[N],invf[N];
inline int add(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
inline int sub(int x, int y) { return x - y >= 0 ? x - y : x - y + mod; }
inline int power(int x, int y, int res = 1) {
    for (; y; y >>= 1, x = 1ll * x * x % mod) {
        if (y & 1) { res = 1ll * res * x % mod; }
    } return res;
}
void initcombi(int n) {
    for (int i = fac[0] = 1; i <= n; i++) { fac[i] = 1ll * fac[i - 1] * i % mod; }
    invf[n] = power(fac[n], mod - 2);
    for (int i = n; i; i--) { invf[i - 1] = 1ll * invf[i] * i % mod; }
}
 
inline int NCR(int n, int m) {
    if (n < m) { return 0; }
    return 1ll * fac[n] * invf[m] % mod * invf[n - m] % mod;
}
bool ispal(string k) {
    cout << k << " ";
    for(int i = 0; i < k.size(); i++) {
        if(k[i] == k[k.size() - i - 1])
            continue;
        return false;
    }
    return true;
}
int main() {
    io();
    initcombi(200005);
    int n;
    cin >> n;   
    int a[n];
    map<ll, ll> m;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        m[a[i]]++;
    }
    ll sum = 0;
    for(auto it : m) {
        sum += (it.second * (it.second - 1)) / 2;
    }
    for(int i = 0; i < n; i++) {
        cout << sum - m[a[i]] + 1 << "\n";
    }

}


Measured memory_bytes: 11904
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int L, R, d;
  cin>>L>>R>>d;
  int ans = 0;
  for(int i=L;i<=R;++i){
    if(i%d==0) ans++;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3524
n=int(input())
s1=input()
s2=input()
l=[]
old="hoge"
for i in range(n):
    if s1[i]==s2[i]:
        l.append(0)
    elif s1[i]!=old:
        l.append(1)
    old=s1[i]
ans=1
flag=2
INF=10**9+7
for i in l:
    if flag==1:
        if i==1:ans=ans*3%INF
    elif flag==0:ans=ans*2%INF
    else:
        if i==0:ans*=3
        else:ans*=6
    flag=i
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>

auto main() -> int
{
    int_fast32_t n;
    std::cin >> n;

    std::vector<int_fast32_t> sticks;
    sticks.reserve(n);

    for(int_fast32_t i = 0; i < n; ++i)
    {
        int_fast32_t t;
        std::cin >> t;
        sticks.emplace_back(t);
    }

    int_fast32_t ans = 0;

    for(int_fast32_t i = 0; i < n - 2; ++i)
        for(int_fast32_t j = i + 1; j < n - 1; ++j)
            for(int_fast32_t k = j + 1; k < n; ++k)
            {
                if(sticks[i] == sticks[j] || sticks[i] == sticks[k] || sticks[j] == sticks[k]) continue;

                if(((sticks[i] + sticks[j]) > sticks[k]) && 
                   ((sticks[i] + sticks[k]) > sticks[j]) && 
                   ((sticks[j] + sticks[k]) > sticks[i]))
                   {
                       ++ans;
                   }
            }


    std::cout << ans << std::flush;
    
    return 0;
}

Measured memory_bytes: 3632
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;

typedef
tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
}

void solve() {
    int n, k;
    cin >> n >> k;
    vi a(n);
    forn(i, n) cin >> a[i];
    for1(i, k, n){
        cout << (a[i] > a[i - k] ? "Yes" : "No") << '\n';
    }
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 3984
import sys
sys.setrecursionlimit(1000000)

n = int(input())
#ab = [input().split() for l in range(n)]

ab = [[int(i) for i in input().split()] for _ in range(n)]

#ab = list(map(int, ab))

ab = sorted(ab, key=lambda x:x[1])

time = 0

for i in range(n):
    if time + ab[i][0] > ab[i][1]:
        print("No")
        exit()
    else:
        time += ab[i][0]

print("Yes")

Measured memory_bytes: 42712
use std::io::*;
use std::str::FromStr;

fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn main() {
    let n: usize = read();
    let a: Vec<i64> = (0..n).map(|_| read()).collect();

    let mut ans: i64 = a[0];
    for i in 1..n {
        ans = gcd(ans, a[i]);
    }
    println!("{}", ans);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

typedef long long ll;
ll n, m, num;
int main()
{
//    freopen ("input.txt", "r", stdin);
    cin >> n >> m;
    num = (2 * n + m) / 4;
    num = min(num, m / 2);
    cout << num << endl;
    return 0;
}


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

int n, a, b;
vector <int> res;

void Solve(int lvl, int a, int b, int got)
{
    for (int i = 0; i < n; i++) if ((a & 1 << i) != (b & 1 << i) && !(got & 1 << i)) {
        got |= 1 << i;
        int lst = a;
        for (int j = 1; j < 1 << lvl; j++) {
            int my = (j ^ (j >> 1));
            int pnt = 0;
            lst = a;
            for (int k = 0; k < n; k++) if (!(got & 1 << k)) {
                if ((my & 1 << pnt)) lst ^= (1 << k);
                pnt++;
            }
            res.push_back(lst);
        }
        a = lst;
        a ^= 1 << i;
        res.push_back(a);
        Solve(lvl - 1, a, b, got);
        return;
    }
}

int main()
{
    cin >> n >> a >> b;
    if (__builtin_popcount(a) % 2 == __builtin_popcount(b) % 2) {
        printf("NO\n");
        return 0;
    }
    printf("YES\n");
    res.push_back(a);
    Solve(n - 1, a, b, 0);
    for (int i = 0; i < res.size(); i++)
        printf("%d\n", res[i]);
    return 0;
}


Measured memory_bytes: 1656
#include<stdio.h>
int main()
{
        long long int a,b,k,dif;
        scanf("%lld %lld %lld",&a,&b,&k);
        if(k>=a)
        {
                k=k-a;
                a=0;
        }
        else
        {
                a=a-k;
                k=0;
        }
        if(k>=b)
        {
                b=0;
        }
        else
        {
                b=b-k;
        }
        printf("%lld %lld\n",a,b);
}

Measured memory_bytes: 128
fun main(args: Array<String>) {
    val x = readLine()!!.toInt()

    fun gcd(a: Int, b: Int): Int {
        return if (a==1 || b== 1) 1
        else if (b == 0) a
        else if (a < b) gcd(a, b % a)
        else gcd(b, a % b)
    }
    val gcd = gcd(x,360)
    println(360/gcd)
}


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


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

    int n,w;
    cin>>n>>w;
    int a[n];
    int ans = 0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i] -= w;
        if(a[i] > 0) ans += a[i];
    }
    if(ans <= 0) {
        cout << "kusoge\n";
        return 0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3224
#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	cin>>s;
	int len=s.length();
	if(s[len-1]=='s'){
		s=s+"es";
	}else{
		s=s+"s";
	}
	cout<<s<<endl;
	return 0;
} 

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

int main(){
	int a,b,c,k,x=1;
	cin >> a >> b >> c >> k;
	for(int i=0;i<k;i++){
		x*=2;
	}
	
	cout << max(a*x+b+c,max(a+b*x+c,a+b+c*x)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,diff,ca,cb,d,sa=0,sb=0;
    cin>>n;
    vector<int> a(n),b(n);
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    for(auto i:a)sa+=i;
    for(auto i:b)sb+=i;
    diff=sb-sa;
    ca=0,cb=0;
    for(int i=0;i<n;i++){
        d=b[i]-a[i];
        if(d>0) ca+=(d+1)/2;
        else cb-=d;
    }
    if(diff>=ca&&diff>=cb)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 384
def solve():
    N = int(input())
    A = []
    m_A = [0, 0]
    for i in range(N):
        a = int(input())
        A.append(a)
        if m_A[1] < a:
            m_A[0] = m_A[1]
            m_A[1] = a
        elif m_A[0] < a:
            m_A[0] = a
    for i in range(N):
        if A[i] == m_A[1]:
            print(m_A[0])
        else:
            print(m_A[1])


solve()


Measured memory_bytes: 69080
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
using namespace std;

#define INF 1e9
#define vi vector<int>
#define vf vector<float>
#define vc vector<char>
#define vs vector<string>
#define vb vector<bool>
#define ll long long
#define lint long int
#define llint long long int
#define atoz abcdefghijklmnopqrstuvwxyz
#define atoZ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
#define AtoZ ABCDEFGHIJKLMNOPQRSTUVWXYZ
#define mapSI map<string, int>
#define mapII map<int, int>
#define mapSS map<string, string>
#define pb push_back

#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep2(i, n) for(int i = 0; i < (n); i += 2)
#define repv(i, n, v) for(int i = 0; i < (n); i += v)
#define rrep(i, n) for(int i = n; i >= 0; i--)
#define sortN(a, b, c) c == 0 ? sort(a, a + b) : sort(a, a + b, greater<int>())
#define sortI(i, a) a == 0 ? sort(s.begin(), s.end()) : sort(s.begin(), end(), greater<int>)
#define sortS(s, a) a == 0 ? sort(s.begin(), s.end()) : sort(s.begin(), end(), greater<char>)
#define all(a) a.begin(), a.end()

int digitSum(int n){
  int res = 0;
  while(n > 0){
    res += n%10;
    n /= 10;
  }
 
  return res;
}

int main(void){

  //入力
  int N;
  cin >> N;
  
  //1からNまで
  double even = 0;
  for(int i = 1; i <= N; i++){
    if(i%2 != 0){
      even++;
    }
  }
  
  double ans = even / N;
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int x,a,b;
  scanf("%d",&x);
  a=1000*(int)(x/500);
  /*printf("%d\n",a);*/
  b=5*(int)((x-500*a/1000)/5);
  printf("%d\n",a+b);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    int N,X;
    cin >> N >> X;
    vector<int> m;
    for(int i=0; i<N; i++)
    {
    	int a;
    	cin >> a;
    	m.push_back(a);
    }
    int min = *min_element(m.begin(),m.end());
    for(int i=0; i<N; i++)
    {
    	X -= m[i];
    } 
    cout << N + X/min << endl;

	return 0;
}

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

using namespace std;

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

int main() {
  array<int, 200000> count;
  fill(count.begin(), count.end(), 0);

  int n;
  cin >> n;
  Rep(i, n - 1) {
    int a;
    cin >> a;
    count[a - 1]++;
  }

  Rep(i, n) {
    cout << count[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 4420
#include <bits/stdc++.h>
using namespace std;
int64_t GCD(int64_t a,int64_t b){if(b==0)return a;else return GCD(b,a%b);}
int64_t LCM(int64_t a,int64_t b){return a*b/GCD(a,b);}
int main()
{
  int A,N,M;
  int64_t x=1;
  cin>>N>>M;
  while(cin>>A){x=LCM(x,(A+1)/2);if(x>M||fmod(2*x/A,2)==0)return cout<<0<<endl,0;}
  return cout<<(M/x+1)/2<<endl,0;
}

Measured memory_bytes: 256
def gcd(a,b):
	while b:
		a,b = b,a%b
	return abs(a)

K=int(input())

#余裕でTLE?

ans=0
for a in range(1, K+1):
	for b in range(1, K+1):
		for c in range(1, K+1):
			temp=a
			temp=gcd(temp, b)
			temp=gcd(temp, c)
			ans+=temp
print(ans)

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

int main(){
	string s;
	while(getline(cin,s) and s!="."){
		string ans="yes";
		int n=s.size();
		stack<bool> last;
		rep(i,n){
			if(s[i]=='(') last.push(0);
			if(s[i]=='[') last.push(1);
			if(s[i]==')'){
				if(last.empty()) ans="no";
				else if(!last.top()) last.pop();
				else ans="no";
			}
			if(s[i]==']'){
				if(last.empty()) ans="no";
				else if(last.top()) last.pop();
				else ans="no";
			}
		}
		if(!last.empty()) ans="no";
		cout<<ans<<endl;
	}
    return 0;
}



Measured memory_bytes: 3116