akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>
 
using namespace std;
typedef long long int ll;

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

    vector<ll > A(N, 0);

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

    //Aの各桁を反転させたほうがお得か？そうではないかを上の桁から考える
    //Aの各桁をすべて見てみて1が多ければ反転させない，少なければ反転させる

    //すべてのAに対してd桁目で立っているbitの個数を数える
    //上から
    ll max_digit = 50;
    vector<vector<ll > > dp(max_digit * 2, vector< ll >(2, -1));
    //初期化
    dp[0][0] = 0;

    vector<ll > keta(max_digit, 0);
    for(ll i = 0; i < max_digit; i++){
        ll bit_mask = 1ll << (max_digit - i - 1);
        //cout << bit_mask << endl;
        for(ll j = 0; j < N; j++){
            if(A[j] & bit_mask){
                keta[i]++;
            }
        }
    }

    //桁DP
    for(ll i = 0; i < max_digit; i++){
        ll bit_mask = 1ll << (max_digit - i - 1);

        //反転させたときと反転させなかったときにどれだけ最大化できるか
        //0を採用するか1を採用するか
        //1が多数派：point0 > 多数派の1を勃たせておきたい気持ち：0を採用すれば1は勃ったままになる＞素直に得点計算
        //0が少数派：point1 > 少数はの1を萎えさせて多数派の0を勃たせたい：1を採用して得点計算
        ll point0 = bit_mask * keta[i];
        ll point1 = bit_mask * (N - keta[i]);
        

        if(dp[i][1] != -1){
            //ゆるゆるのまま行きたい気持ち・・・
            //0を勃たせても1を勃たせても良いのでとにかく大きな値になるように設定する
            //上位の桁で決定された(最大化された)値を引き継ぎ，
            //現在の桁で最大化できるのはpoint0かpoin1かを比較して決める
            if(dp[i + 1][1] < dp[i][1] + max(point0, point1)){
                dp[i + 1][1] = dp[i][1] + max(point0, point1);
            }
        }

    
        if(dp[i][0] != -1){
            //ガチガチからゆるゆるへ
            //つまり
            //ガチガチからゆるゆるへ移るにはXは0しか取らざるを得ない！
            //point0採用
            if(K & bit_mask){
                if( dp[i + 1][1] < dp[i][0] + point0){
                    dp[i + 1][1] = dp[i][0] + point0;
                }
                
            }
            //ガチガチのままガチガチへ
            if(K & bit_mask){
                if(dp[i + 1][0] < dp[i][0] + point1){
                    dp[i + 1][0] = dp[i][0] + point1;
                }
                
            }else{
                if(dp[i + 1][0] < dp[i][0] + point0){
                    dp[i + 1][0] = dp[i][0] + point0;
                }
            }
        }

        //cout << i << endl;
    }

    //ガチガチのほうがよかったのかゆるゆるのほうが良かったのか
    cout << max(dp[max_digit][0], dp[max_digit][1]) << endl;

    //確認
    /*
    for(ll i = 0; i < max_digit; i++){
        cout << keta[i] << " ";
    }
    cout << endl;
    */
 
} 

Measured memory_bytes: 1024
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make(map[int]int, 0)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		a[nextInt(sc)]++
	}
	ans := 0
	for _, v := range a {
		if v%2 != 0 {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 7168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return false;}
#define all(x) (x).begin(),(y).end()
#define debug(x)  cerr << #x << " = " << (x) << endl;

constexpr ll mod = 1e9+7;
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    
    friend ostream &operator<<(ostream& os,const mint& a){
        return os << a.x;
    }

    friend istream &operator>>(istream& is,mint& a){
        ll t;
        is >> t;
        a = mint(t);
        return (is);
    }

    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
    bool operator==(const mint a)const{
        return x==a.x;
    }
};

class combination{
private:
    vector<mint> fact,inv,finv;
public:
    combination(int N){
        fact = inv = finv = vector<mint>(N+1);
        fact[0] = fact[1] = 1;
        inv[0] = inv[1] = 1;
        finv[0] = finv[1] = 1;
        for(ll i=2;i<=N;i++){
            fact[i] = fact[i-1]*i;
            inv[i] = (mint) mod - inv[mod%i]*(mod/i);
            finv[i] = finv[i-1]*inv[i];
        }
    }
    mint f(int i){
        return fact[i];
    }
    mint comb(int n,int k){
        if(n<k) return 0;
        if(n<0 || k<0) return 0;
        return fact[n]*finv[k]*finv[n-k];
    }
    mint hcomb(int n,int k){
        if(n==0 && k==0) return 1;
        return comb(n+k-1,k);
    }
};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int S;
    cin >> S;
    combination C(2000);
    mint ans = 0;
    for(int i=1;3*i<=S;i++){
        int s = S-3*i;
        ans += C.hcomb(i,s);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3696
// Copyright 2017 wu_qing
#include <cstdio>
#include <algorithm>
const int N = 1e5 + 10;
int n, a[N], ans, cur;
bool s, f1;
int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", a + i);
    n = std::unique(a, a + n) - a;
    while (cur < n) {
        ans++;
        if (cur == n - 1) break;
        s = a[cur] < a[cur + 1];
        for (int i = cur + 2; i <= n; i++) {
            if (i == n) {
                cur = n;
                break;
            }
            if (s ^ (a[i - 1] < a[i])) {
                cur = i;
                break;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}



Measured memory_bytes: 512
from itertools import product
import numpy as np

N,M,X=map(int,input().split())
CA=[]
for _ in range(N):
    CA.append(np.array(list(map(int,input().split()))))

select=[]

price_min=10**9
kaeru=0


for select in product(range(2),repeat=N):
    #print(select)
    noryoku=np.array([0]*(M+1))
    #print(noryoku)
    for i in range(N):
        if select[i]==1:
           # print("yes")
            noryoku+=CA[i]
    if (noryoku[1:]>=X).all():
        kaeru=1
        price_min=min(price_min,noryoku[0])

if kaeru:
    print(price_min)
else:
    print(-1)



        
        

Measured memory_bytes: 27352
#include<stdio.h>

int main(){
  int A[100];
  int j,temp,N,s,min;
  int i = 0,a = 0;

  scanf("%d",&N);

  for(i = 0; i <= N-1; i++) scanf("%d",&A[i]);

  for(i = 0; i <= N-1; i++){
    min = i;
    for(j = i; j <= N-1; j++){ 
      if(A[j] < A[min])
	min = j;
    }
      temp = A[i];
      A[i] = A[min];
      A[min] = temp;
      if(i != min) a++;
  }
    
  for(s = 0; s <= N-1; s++){
    if(s > 0) printf(" ");
    printf("%d",A[s]);
  }
  printf("\n");
  printf("%d\n",a);

  return 0;
   
}



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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Wolfgang Beyer
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AirportBus solver = new AirportBus();
        solver.solve(1, in, out);
        out.close();
    }

    static class AirportBus {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int cap = in.nextInt();
            int maxWait = in.nextInt();
            int[] a = in.readIntArray(n);
            Arrays.sort(a);

            int res = 0;
            int passengers = 0;
            int firstPassTime = a[0];

            for (int i = 0; i < n; i++) {
                if (a[i] - firstPassTime > maxWait) {
                    res++;
                    firstPassTime = a[i];
                    passengers = 1;
                } else {
                    passengers++;
                    if (passengers > cap) {
                        passengers = 1;
                        firstPassTime = a[i];
                        res++;
                    }
                }
            }
            if (passengers > 0) res++;
            out.println(res);
        }

    }

    static class InputReader {
        private static BufferedReader in;
        private static StringTokenizer tok;

        public InputReader(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

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

        public int[] readIntArray(int n) {
            int[] ar = new int[n];
            for (int i = 0; i < n; i++) {
                ar[i] = nextInt();
            }
            return ar;
        }

        public String next() {
            try {
                while (tok == null || !tok.hasMoreTokens()) {
                    tok = new StringTokenizer(in.readLine());
                }
            } catch (IOException ex) {
                System.err.println("An IOException was caught :" + ex.getMessage());
            }
            return tok.nextToken();
        }

    }
}



Measured memory_bytes: 34776
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

const int mod = 1e9 + 7;
const int maxn = 2e5 + 5;

P p[maxn];
int f[maxn << 2], lz[maxn * 4], m;

bool cmp(const P &a, const P &b) {
    if(a.fi == b.fi) return a.se > b.se;
    else return a.fi < b.fi;
}

void build(int t, int l, int r) {
    if(l == r) {
        f[t] = l - m - 1;
        return;
    }
    int mid = (l + r) >> 1;
    build(t << 1, l, mid);
    build(t << 1 | 1, mid + 1, r);
    f[t] = max(f[t << 1], f[t << 1 | 1]);
}

void push_down(int t) {
    if(lz[t]) {
        f[t << 1] += lz[t];
        lz[t << 1] += lz[t];
        f[t << 1 | 1] += lz[t];
        lz[t << 1 | 1] += lz[t];
        lz[t] = 0;
    }
}

void add(int t, int l, int r, int x) {
    if(r <= x) {
        f[t]++;
        lz[t]++;
        return;
    }
    push_down(t);
    int mid = (l + r) >> 1;
    add(t << 1, l, mid, x);
    if(x > mid) add(t << 1 | 1, mid + 1, r, x);
    f[t] = max(f[t << 1], f[t << 1 | 1]);
}

int query(int t, int l, int r, int x) {
    if(l >= x) return f[t];
    push_down(t);
    int mid = (l + r) >> 1;
    int res = query(t << 1 | 1, mid + 1, r, x);
    if(x <= mid) res = max(res, query(t << 1, l, mid, x));
    return res;
}

int main() {
#ifdef CX_TEST
    freopen("E:\\program--GG\\test_in.txt", "r", stdin);
#endif
    int n, i, res = 0;
    scanf("%d%d", &n, &m);
    for(i = 0; i < n; i++) scanf("%d%d", &p[i].fi, &p[i].se);
    sort(p, p + n, cmp);
    build(1, 1, m + 1);
    for(i = 0; i < n; i++) {
        add(1, 1, m + 1, p[i].se);
        res = max(res, query(1, 1, m + 1, p[i].fi + 1) - p[i].fi);
    }
    res = max(res, n - m);
    printf("%d\n", res);
    return 0;
}


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

int main() {
    int c[3][3];
    cin >> c[0][0] >> c[0][1] >> c[0][2];
    cin >> c[1][0] >> c[1][1] >> c[1][2];
    cin >> c[2][0] >> c[2][1] >> c[2][2];
    if (c[1][0] - c[0][0] == c[1][1] - c[0][1] && c[1][0] - c[0][0] == c[1][2] - c[0][2]) {
        if (c[1][0] - c[2][0] == c[1][1] - c[2][1] && c[1][0] - c[2][0] == c[1][2] - c[2][2]) {
            if (c[0][0] - c[0][1] == c[1][0] - c[1][1] && c[0][0] - c[0][1] == c[2][0] - c[2][1]) {
                if (c[0][2] - c[0][1] == c[1][2] - c[1][1] && c[0][2] - c[0][1] == c[2][2] - c[2][1]) {
                    cout << "Yes";
                } else cout << "No";
            } else cout << "No";
        } else cout << "No";
    } else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  char c1[12];
  char c2[12];
  scanf("%s%s",c1,c2);
  for(int i = 0; i < 12; ++i){
    if(c1[i] == '\0') break;
    if(c1[i] != c2[i]){
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
}

Measured memory_bytes: 1660
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define SIZE_OF_ARRAY(a) (sizeof(a)/sizeof(a[0]))

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll a[n] = {0};
    for(int i = 0;i < n;i++){
        cin >> a[i] ;
    }
    stable_sort(a,a + n);
    ll count = 0;
    for(int i = 0;i < n;i++){
        count += a[i];
    }
    cout << a[0] <<" " << a[n - 1]  << " " << count << endl;
}


Measured memory_bytes: 3356
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int change_to_i(string s){
   stringstream ss; int k;
   ss<<s; ss>>k;
   return k;
}

string change_to_s(int n){
   stringstream ss; ss<<n;
   return ss.str();
}

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

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k;
    cin >> k;
    vector<int> ans;
    vector<int> cand;    
    set<int> st;
    rep(i, 1, 1000){
        cand.push_back(i);
        st.insert(i);
    }
    rep(i, 4, 16){
        string s = "";
        rep(j, 0, i - 3) s += "9";
        rep(j, 1, 1000){
            string t = change_to_s(j);
            t += s;
            int tmp = change_to_i(t);
            if(!st.count(tmp)){
                cand.push_back(tmp);
                st.insert(tmp);
            }
        }
    }
    rep(i, 0, cand.size()){
        int now = getDigitSum(cand[i]);
        bool f = true;
        rep(j, i + 1, cand.size()){
            int tmp = getDigitSum(cand[j]);
            if(cand[i] * tmp > cand[j] * now){
                f = false;
                break;
            }
        }
        if(f){
            ans.push_back(cand[i]);    
        }
    }
    rep(i, 0, k){
        cout << ans[i] << endl;
    }
}

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

# define ll long long
# define mod 1000000007
# define MAX 100005
# define PI 3.141592653589793238                                                                                  //shortcut keys

# define pb push_back
# define mp make_pair
# define all(x) x.begin(),x.end()
# define fr(i,a,b) for(int i=a;i<=b;i++)

# define decimal(k) fixed<<setprecision(k)
# define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);        //---------------------------------------------------------------
using namespace std;

int main()
{
	string s;cin>>s;
	int n=s.size();
	ll sum=0;
	fr(i,0,n-1){
		sum+=s[i]-'0';
	}
	if(sum%9==0)cout<<"Yes"<<'\n';
	else cout<<"No"<<'\n';

	return 0;
}



Measured memory_bytes: 3712
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			final int K = sc.nextInt();
			
			int[] counts = new int[N];
			
			for(int i = 0; i < K; i++) {
				final int d = sc.nextInt();
				
				for(int j = 0; j < d; j++) {
					counts[sc.nextInt() - 1]++;
				}
			}
			
			int answer = 0;
			for(int i = 0; i < N; i++) {
				if(counts[i] == 0) { answer++; }
			}
			
			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}


Measured memory_bytes: 33420
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll n;
        cin >> n;
        vector<ll> v(3 * n);
        for(i = 0; i < 3 * n; i++){
            cin >> v[i];
        }
        multiset<ll> left, right;
        vector<ll> suffmin(3 * n + 1);
        ll sum = 0;
        for(i = 3 * n - 1; i >= n; i--){
            if(i >= 2 * n){
                sum += v[i];
                right.insert(v[i]);
                //continue;
            }
            else{
                auto maxi = prev(right.end());
                if(*maxi > v[i]){
                    sum -= *maxi;
                    right.erase(maxi);
                    right.insert(v[i]);
                    sum += v[i];
                }
            }
            suffmin[i] = sum;
        }
        sum = 0;
        ll ans = -INF;
        //for(i = 3 * n - 1; i >= n; i--){
        //    cout << suffmin[i] << " ";
        //}
        for(i = 0 ;i <= 2 * n - 1; i++){
            if(i <= n - 1){
                left.insert(v[i]);
                sum += v[i];
                //continue;
            }
            else{
                auto mini = left.begin();
                if(*mini < v[i]){
                    sum -= *mini;
                    left.erase(mini);
                    left.insert(v[i]);
                    sum += v[i];
                }
            }
            if(i >= n - 1){
                //cout << "##" << sum << " " << suffmin[i + 1] << " "<<i + 1 <<  endl;
                ans = max(ans, sum - suffmin[i + 1]);
            }
        }
        cout << ans;
    }
    return 0;
}

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

int main() {
  string S,T;
  cin >> S >> T;
  int ans = 0;
  for (int i = 0; i < 3; i++) {
    if (S.at(i) == T.at(i)) {
      ans++;
    }
  }
  cout << ans << endl;
}


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

#define prtd(d) printf("%d\n", d)
#define prts(s) printf("%s\n", s.c_str())
#define cout(s) cout << s << endl
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int main(void) {

	int N;
	string S;

	cin >> N >> S;
	//prtd(N);
	//prts(S);

	size_t size = S.length();
	
	if(N & 2 != 0) {
		cout("No");
		return 0;
	}else{
		
		rep(i,N/2){
			//printf("(s[%d], S[%d]) = (%c, %c)\n", i, (i+N/2), S[i], S[i+N/2]);
			if(S[i] != S[i+N/2]) {
				cout("No");
				return 0;
			}

		}
		cout("Yes");

	}

    return 0;
}

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

using namespace std;

int main() {
	vector<int> dd(100);
	for (int i = 0; i < 100; i++) {
		dd[i] = (i+1)*(i+2)/2;
	}
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		vector<int> data(n);
		int sum = 0;
		int a;
		for (int i = 0; i < n; i++) {
			cin >> data[i];
			sum += data[i];
		}
		bool hantei = false;
		for (int i = 0; i < 100; i++) {
			if (sum == dd[i]) {
				hantei = true;
				break;
			} else if (sum < dd[i]) {
				break;
			}
		}
		if (!hantei) {
			cout << -1 << endl;
			continue;
		}
		hantei = true;
		if (data[0] != 1) {
			hantei = false;
		}
		if (hantei) {
			for (int i = 1; i < n; i++) {
				if (data[i] != data[i-1]+1) {
					hantei = false;
					break;
				}
			}
		}
		if (!hantei) {
			int counter = 0;
			vector<int> data2;
			for (int j = 1; j < 10002; j++) {
				if (j == 10001) {
					cout << -1 << endl;
				}
				counter = 0;
				for (int i = 0; i < data.size(); i++) {
					data[i]--;
					if (data[i] > 0) {
						data2.push_back(data[i]);
					}
					counter++;
				}
				data2.push_back(counter);
				bool hantei2 = true;
				if (data2[0] != 1) {
					hantei2 = false;
				}
				if (hantei2) {
					for (int i = 1; i < data2.size(); i++) {
						if (data2[i] != data2[i-1]+1) {
							hantei2 = false;
							break;
						}
					}
					if (hantei2) {
						cout << j << endl;
						break;
					}
				}
				data = data2;
				data2.clear();
			}
		} else {
			cout << 0 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
using namespace std;
int search(int x)
{
	char ch[10];
	int k=0;
	while (x!=0)
	{
		ch[++k]=x%10+'0';
		x/=10;
	}
	if(ch[1]==ch[5]&&ch[2]==ch[4]) return 1;
	return 0;
}
int main()
{
	int a,b;
	int ans=0;
	cin>>a>>b;
	for(int i=a;i<=b;i++)
	{
		ans+=search(i);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
from heapq import heappop,heappush
n,k=map(int,input().split())
s=[]
h=set()#種類
l=[0]*n #個数について
for _ in range(n):
    t,d=map(int,input().split())
    s.append((d,t-1))
s=sorted(s,reverse=True)
a=[]#heapq
num=0#美味しさのわ
for i in range(k):
    d,t=s[i]
    l[t]+=1
    h.add(t)
    num+=d
    if l[t]>1:
        heappush(a,(d,t))#２種類以上ならheapqにたす
ans=len(h)**2+num
for j in range(k,n):
    d,t=s[j]#次に小さいのを引いてくる
    l[t]+=1
    if  l[t]>=2:
        continue #2以上ならむし
    if len(a)==0:
        break
    d1,t1=heappop(a) #いらないのを引く
    h.add(t)
    num=num-d1+d
    ans=max(ans,len(h)**2+num)
print(ans)

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

using namespace std;

const int MaxN = 2e5 + 25;

int n, X;
int a[MaxN];

long long f(int k)
{
    long long res = 0;
    for(int i = n - k + 1; i <= n; ++i)
        res += a[i];

    for(int i = 1; i <= (n - 1) / k + 1; ++i)
    {
        int r = n - (i - 1) * k;
        int l = r - k + 1;
        if(l < 1)
            l = 1;

        for(int j = l; j <= r; ++j)
        {
            int len = a[j];
            if(j - k > 0)
                len -= a[j - k];
            res += (long long) (1 + i) * (1 + i) * len;
        }
    }
    return res + (long long) X * (n + k);
}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);

    cin >> n >> X;

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

    int l = 1;
    int r = n;

    long long ans = 1e18;

    while(r - l > 2)
    {
        int t = (r - l) / 3;

        int p1 = l + t;
        int p2 = r - t;

        long long k1 = f(p1);
        long long k2 = f(p2);

        if(f(p1) < f(p2))
            r = p2 - 1;
        else
            l = p1 + 1;

        ans = min(ans, min(k1, k2));
    }

    while(l <= r)
        ans = min(ans, f(l++));

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int x=0;
  while(n!=0)
  {
    int r=n%10;
    if(r==7)
    {
      x=1;
    }
    n/=10;
  }
  if(x==1)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3620
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

A,B = II()

if 1<=A<=9 and 1<=B<=9:
    print(A*B)
else:
    print(-1)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
//#include <atcoder/all>

typedef long long ll;
using namespace std;
//using namespace atcoder;

#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define _reps(i, s, n) for(ll i = (ll)(s); i < (ll)n; i++)
#define REP(...) _overload(__VA_ARGS__, _reps, _rep,)(__VA_ARGS__)
#define all(v) (v).begin(),(v).end()
#define UNIQUE(v) (v).erase( unique( all(v) ), (v).end() );
#define MOD 1000000007

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

	if(x)	cout << 0 << endl;
	else	cout << 1 << endl;

	return 0;
}


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

using namespace std;
typedef long long ll;
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)

int main(){
	string s; cin>>s;
	ll K; cin>>K;
	rep(i,sz(s)){
		ll tmp=s[i]-'a';
		if(tmp!=0) tmp=26-tmp;

		//tmpはaにするのに必要な回数
		if(tmp<=K){
			s[i]='a';
			K-=tmp;
		}
	}
	K%=26;

	//残りK回は最後の文字をいじる
	ll tmp='z'-s[sz(s)-1];

	if(K<=tmp) s[sz(s)-1]+=K;
	else s[sz(s)-1]='a'+K-tmp-1;

	cout<<s;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Integer[] arr = new Integer[N];

    for (int i = 0; i < N; i++) {
      arr[i] = sc.nextInt();
    }
    // 2 人とも自分の得点を最大化するように最適な戦略
    // ソートして、うしろからカードを取る
    Arrays.sort(arr, Comparator.reverseOrder());
    int alice = 0;
    int bob = 0;
    for (int i = 0; i < N; i++) {
      if (i % 2 == 0) {
        alice += arr[i];
      } else {
        bob += arr[i];
      }
    }

    System.out.println(alice - bob);
  }
}


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

int main() {
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> b(m);
	for (int i = 0; i < m; i++) {
		cin >> b.at(i);
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int x = 0;
		for (int j = 0; j < m; j++) {
			int a;
			cin >> a;
			x += a * b.at(j);
		}
		x += c;
		if (x > 0) {
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;

void main()
{
    auto n = readln().chomp().to!int;

    int cnt4, cnt2, cnt1;
    foreach(e; readln().chomp().splitter(' ').map!(to!int)){
        if(e % 4 == 0){
            ++cnt4;
        }else if(e % 2 != 0){
            ++cnt1;
        }else
            ++cnt2;
    }

    if(cnt2 != 0)
        writeln(cnt4 >= cnt1 ? "Yes" : "No");
    else
        writeln(cnt4+1 >= cnt1 ? "Yes" : "No");
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) : src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;


// INF は大丈夫か？
bool BellmanFord(const Graph g, int s, vector<Weight> &dist)
{
  int n = g.size();
  dist.assign(n, INF+INF); dist[s] = 0;
  bool negative_cycle = false;
  rep(k, n) rep(i, n) vrep(e,g[i]) {
    if (dist[e->dst] > dist[e->src] + e->weight) {
      dist[e->dst] = dist[e->src] + e->weight;
      if (k == n-1 && dist[e->dst] < INF) {
        dist[e->dst] = -INF;
        negative_cycle = true;
      }
    }
  }
  return negative_cycle;   // 始点から辿り着けるかにかかわらず，負の閉路があるとき true
}

int V, E, r;
int s, t;
Weight d;

int main()
{
  cin >> V >> E >> r;
  Graph g(V);
  vector<Weight> dist;
  rep(i, E){
    cin >> s >> t >> d;
    g[s].pb(Edge(s, t, d));
  }

  if(BellmanFord(g, r, dist)){
    cout << "NEGATIVE CYCLE" << endl;
    return 0;
  }

  rep(i, V) if(dist[i] >= INF) puts("INF"); else cout << dist[i] << endl;

  return 0;
}

Measured memory_bytes: 1328
#include <bits/stdc++.h>
using namespace std;
int main(){
  int k,n;
  cin>>k>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  vector<int>d(n);
  for(int i=0;i<n-1;i++){
	d[i]=a[i+1]-a[i];
  }
  d[n-1]=k-a[n-1]+a[0];
  //for(int i=0;i<n;i++)cout<<d[i]<<endl;
  sort(d.begin(),d.end());
  cout<<k-d[n-1]<<endl;
}
 

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

using ll = long long;

vector<int> a;
int n, M;
int Q(int k){
	int f = -1;
	for(int i = 0; i < k; i++){
		f = max(f, (a[i] + a[2*k-1-i]) % M);
	}
	for(int i = 0; i < (n - k); i++){
		int r = a[2*k + i] + a[2*n-1-i];
		if(r < M) return -1;
		f = max(f, r - M);
	}
	assert(f < M);
	return f;
}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> M;
	a.resize(2*n);
	for(int i = 0; i < 2*n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	int s = -1; // not
	int e = n; // fine
	while(s + 1 < e){
		int m = (s + e) / 2;
		if(Q(m) == -1){
			s = m;
		} else {
			e = m;
		}
	}
	s++;
	e = n;
	int ans = M;
	ans = min(ans, Q(s));
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,k,r,s,p;
long long ans=0;
char ch[400005];
int a[400005],b[400005];	//a:机器人，b:我 
int boring(int x)
{
	if(a[x]==1) return r;
    else if(a[x]==2) return s;
    else return p;
}
int main()
{
	cin>>n>>k>>r>>s>>p;
	for(int i=1;i<=n;i++)
		cin>>ch[i];
	for(int i=1;i<=n;i++)
		if(ch[i]=='r')a[i]=3;
			else if(ch[i]=='p')a[i]=2;
				else a[i]=1;
	for(int i=1;i<=n;i++)
	    if(i-k<=0)
	    {
			b[i]=a[i];
			ans+=boring(i);
		}
			else if(b[i-k]==a[i])b[i]=0;
			    else
			    {
			    	b[i]=a[i];
					ans+=boring(i);
				}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1152
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep0(n) for (int i = 0; i < (int)(n); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define from1(obj) obj.begin() + 1, obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbp(p) cerr << #p << ":(" << p.first << ", " << p.second << ") "
#define dbpl(p) cerr << #p << ":(" << p.first << ", " << p.second << ")\n"
#define dbt3(t3) cerr << #t3 << ":(" << get<0>(t3) << ", " << get<1>(t3) << ", " << get<2>(t3) << ") "
#define dbt3l(t3) cerr << #t3 << ":(" << get<0>(t3) << ", " << get<1>(t3) << ", " << get<2>(t3) << ")\n"
#define dbt4(t4) cerr << #t4 << ":(" << get<0>(t4) << ", " << get<1>(t4) << ", " << get<2>(t4) << ", " << get<3>(t4) << ") "
#define dbt4l(t4) cerr << #t4 << ":(" << get<0>(t4) << ", " << get<1>(t4) << ", " << get<2>(t4) << ", " << get<3>(t4) << ")\n"
#define dbv(vec) cerr << #vec << ":{ "; for (auto e : vec) cerr << e << ", "; cerr << "}\n"
#define dbvp(vec) cerr << #vec << ":{ "; for (auto p : vec) cerr << "(" << p.first << ", " << p.second << "), "; cerr << "}\n"
#define dbvv(vv) cerr << #vv << ":{\n"; for (auto vec : vv) { cerr << "{ "; for (auto e : vec) cerr << e << ", "; cerr << "}\n"; } cerr << "}\n"
#define dbm(map) cerr << #map << ":{ "; for (auto p : map) cerr << "(" << p.first << ", " << p.second << "), "; cerr << "}\n"
#define YN(f) cout << (f ? "YES" : "NO") << "\n"
#define Yn(f) cout << (f ? "Yes" : "No") << "\n"
#define yn(f) cout << (f ? "yes" : "no") << "\n"
using ll = long long;
using vi = vector<int>; using vl = vector<ll>; using vs = vector<string>; using vb = vector<bool>;
using vvi = vector<vi>; using vvl = vector<vl>; using vvb = vector<vb>;
using pii = pair<int, int>; using pil = pair<int, ll> ; using pll = pair<ll, ll>; using pli = pair<ll, int>;
using vpii = vector<pii>; using vpll = vector<pll>;
using ti3 = tuple<int, int, int>; using tl3 = tuple<ll, ll, ll>;
using ti4 = tuple<int, int, int, int>; using tl4 = tuple<ll, ll, ll, ll>;
using mii = map<int, int>; using mil = map<int, ll>; using mll = map<ll, ll>; using mli = map<ll, int>;

int main() {
	int K; cin >> K;	
	vvi g(10, vi());
	g[0] = { 0, 1 };
	rep2(i, 1, 9) g[i] = { i - 1, i, i + 1 };
	g[9] = { 8, 9 };
	// dbvv(g);
	queue<ll> q;	
	rep2(i, 1, 10) q.push((ll)i);
	int cnt = 0;
	while (true) {
		cnt++;
		ll x = q.front(); q.pop();
		// db(cnt); dbl(u);
		if (cnt == K) {
			cout << x << endl;
			break;
		}
		for (int v : g[x % 10]) {
			q.push(10 * x + v);
		}		
	}
}

Measured memory_bytes: 1792
x,y = map(int,input().split())
ans = 0
if x==1: 
  ans+=300000
if x == 2:
  ans+=200000
if x==3:
  ans += 100000
if y==1: 
  ans+=300000
if y == 2:
  ans+=200000
if y==3:
  ans += 100000
if x == 1 and y==1:
  ans += 400000
print(ans)

 

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

int main(){
	string S;
	cin>>S;
	rep(i,S.size()/2){
		if(S.at(i)==S.at(S.size()-i-1)){

		}else{
			cout<<"No"<<endl;
			return 0;
		}
	}
	for(int i=0;i<=(S.size()-1)/4;i++){
		if(S.at(i)==S.at(((S.size()-1)/2)-i-1)){

		}else{
			cout<<"No"<<endl;
			return 0;
		}
	}
	for(int i=0;i<=(S.size()-1)/4;i++){
		if(S.at(((S.size()+3)/2)-1+i)==S.at(S.size()-i-1)){

		}else{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
return 0;}

/*compile
g++ code.cpp
./a.out
run*/

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int n;

int main() {
    fastio();

    cin >> n;
    map<int, int> s;
    forn(i, n) {
        int a;
        cin >> a;
        s[a - 1]++;
        s[a]++;
        s[a + 1]++;
    }

    int ans = 0;
    for (auto p : s) {
        chmax(ans, p.snd);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s;
	cin >> s;
	int a[4];
	for (int i = 0; i < 4; i++) {
		a[i] = s[i] - '0';
	}
	
	char op[3];
	int t;
	for (int i = 0; i < (1 << 3); i++) {
		for (int j = 0; j < 3; j++) {
			op[j] = (((i >> j) & 1) == 0) ? '-' : '+';
		}
		t = a[0];
		for (int j = 0; j < 3; j++) {
			if (op[j] == '-') {
				t -= a[j + 1];
			}
			else {
				t += a[j + 1];
			}
		}
		
		if (t == 7) {
			for (int j = 0; j < 7; j++) {
				if (j % 2 == 0) {
					cout << a[j / 2];
				}
				else {
					cout << op[j / 2];
				}
			}
			cout << "=7" << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)


def main(input, print):
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    for i in range(K, N):
        if A[i-K] < A[i]:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    main(sys.stdin.readline, print)


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

long long gcd(long long B, long long D) {
    long long b = max(B, D);
    long long d = min(B, D);
    if (d == 0) {
        return b;
    } else {
        return gcd(b % d, d);
    }
}

long long is_yes(long long A, long long B, long long C, long long D) {
    
    if (B > D || B > A) {
        return false;
    }

    long long g = gcd(B, D);
    return A - ((A - (C + 1)) / g) * g - B >= 0;

}

int main() {
    int T;
    long long A, B, C, D;
    cin >> T;
    for (int i = 0; i < T; i++) {
        cin >> A >> B >> C >> D;

        if (is_yes(A, B, C, D)) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

long long gcd(long long a, long long b) {
    return b == 0 ? a : gcd(b, a % b);
}

int main()
{
    int T;
    long long A, B, C, D;
    cin >> T;
    while (T--) {
        cin >> A >> B >> C >> D;
        if (A < B || D < B) cout << "No\n";
        else {
            long long g = gcd(B, D);
            if (B - (g - A % g) > C) cout << "No\n";
            else cout << "Yes\n";
        }
    }

    return 0;
}


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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll a;
  string s;
  cin >> a;
  if(a < 1200) s = "ABC";
  else if(a < 2800) s = "ARC";
  else s = "AGC";
  cout << s << endl;
	return 0;
}

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

using namespace std;

#define ll long long
#define ld long double
#define P pair<ll, ll>

#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

#define all(v) v.begin(), v.end()

#define sortAl(v) sort(all(v))
#define sortAlr(v)                                                             \
  sort(v.begin(), v.end());                                                    \
  reverse(v.begin(), v.end())

#define cout(n) cout << fixed << setprecision(n)

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

template <class T> inline void chmax(T &a, T b) { a = std::max(a, b); }
template <class T> inline void chmin(T &a, T b) { a = std::min(a, b); }

#define mod (int)(1e9 + 7)
#define INF LLONG_MAX

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

  ll k;
  cin >> k;

  ll num_odd, num_even;
  num_odd = (k + 1) / 2;
  num_even = k / 2;

  cout << (num_odd * num_even) << endl;

  return 0;
}


Measured memory_bytes: 256
print((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(input()) - 1])

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

#define PI 4*atan(1)
#define INF 1e8

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

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  string S;
  cin >> S;
  for(int i = 0; i < S.size(); i++){
    if(S[i] == 'a'){
      if(A + B != 0){
        cout << "Yes" << endl;
        A--;
      }else cout << "No" << endl;
    }else if(S[i] == 'b'){
      if(A + B != 0 && B != 0){
        cout << "Yes" << endl;
        B--;
      }else cout << "No" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 896
#include <iostream>

int main(int argc, const char * argv[]) {
    // insert code here...
    int N;
    std::cin >> N;
    int l[N], r[N];
    int sum = 0;
    
    for(int i = 0; i < N; i++) {
        std::cin >> l[i];
        std::cin >> r[i];
    }
    
    for(int i = 0; i < N; i++) {
        sum += r[i] - l[i] + 1;
    }
    
    
    
    std::cout << sum << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
using namespace std;

int main(){
    long long int n,f=0;
    cin>>n;
    vector<int>a(200000);
    vector<int>b(200000);
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[a[i]]++;
    }
    for(int i=0;i<200000;i++){
        f+=max(b[i]-1,0);
    }
    cout<<n-((f+1)/2)*2<<endl;
    return 0;
}


Measured memory_bytes: 4784
ABCD = list(i for i in input())

for i in range(2**3):
    box = []
    for k in range(3):
        if ((i>>k) & 1):
            box.append("+")
        else:
            box.append("-")
    if eval("{0}{4}{1}{5}{2}{6}{3}".format(*ABCD,*box)) == 7:
        print("{0}{4}{1}{5}{2}{6}{3}=7".format(*ABCD,*box))
        break

Measured memory_bytes: 9024
def check_tri(a, b, c):
  if a == b or a == c or b == c:
    return False
  return a + b > c and b + c > a and c + a > b

n = int(input())
l = list(map(int, input().split()))

count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    for k in range(j + 1, n):
      if check_tri(l[i], l[j], l[k]):
        count += 1
print(count)

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  int current = 1;
  for (int i = 0; i < n; i++) {
    if (a.at(i) == current) current++;
  }
  if (current == 1) {
    cout << -1 << endl;
  } else {
    cout << n + 1 - current << endl;
  }
}


Measured memory_bytes: 1024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sparsh Sanchorawala
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CRectangleCutting solver = new CRectangleCutting();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRectangleCutting {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            long h = s.nextLong(), v = s.nextLong(), x = s.nextLong(), y = s.nextLong();
            w.print((double) h * v / 2 + " ");
            if (2 * x == h && 2 * y == v)
                w.println(1);
            else
                w.println(0);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21588