akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, x);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

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

int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(void)
{
    int r, g, b;
    cin >> r >> g >> b;
    int num = r * 100 + g * 10 + b;
    ((num % 4 == 0) ? (cout << "YES" << endl) : (cout << "NO" << endl));
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Iterator;
import java.util.Scanner;

public class Main {
	int count = 0;
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			 A[i] = sc.nextInt();
		}
		mergeSort(A, 0, n);
		for (int i = 0; i < n; i++) {
			if(i != n-1) {				
				System.out.print(A[i] + " ");
			}else {
				System.out.println(A[i]);
			}
		}
		
		System.out.println(count);
		sc.close();
	}
	
	void merge(int[] A, int left, int mid, int right) {
		
		int n1 = mid - left;
		int n2 = right - mid;
		int[] L = new int[n1+1];
		int[] R = new int[n2+1];
		for(int i = 0; i < n1; i++) {
			L[i] = A[left + i];
		}
		for(int i = 0; i < n2; i++) {
			R[i] = A[mid + i];
		}
		L[n1] = Integer.MAX_VALUE;
		R[n2] = Integer.MAX_VALUE;
		int i = 0; int j = 0;
		for(int k = left; k < right; k++) {
			count++;
			if(L[i] <= R[j]) {
				A[k] = L[i];
				i = i + 1;
			}else {
				A[k] = R[j];
				j = j + 1;
			}
		}
	}
	
	void mergeSort(int[] A, int left, int right) {
		if(left + 1 < right) {
			int mid = (left + right) / 2;
			mergeSort(A, left,mid);
			mergeSort(A, mid, right);
			merge(A, left, mid, right);
		}
	}
	
	

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 168872
import java.util.*;
import java.io.*;

class Main {

  

  public static void main(String[] args) {
    Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    
    int N = in.nextInt();
    long[] a = new long[N];
    for (int i = 0; i < N; i++) {
      a[i] = in.nextInt();
    }

    

    long[] dp = new long[N];
    for (int i = 0; i < N; i++) {
      dp[i] = a[i];
    }

    for (int i = 1; i < N; i++) {
      a[i] += a[i - 1];
    }

    for (int len = 2; len <= N; len++) {
      for (int i = 0; i < N; i++) {
        int j = i + len - 1; 
        if (j >= N) {break;}
        dp[i] = a[j] - (i == 0 ? 0 : a[i - 1]) - Math.min(dp[i + 1], dp[i]);
      }
    }




    System.out.println(2 * dp[0] - a[N - 1]);
  }

}


Measured memory_bytes: 26472
open System
open System.Collections.Generic
open System.Linq
open System

// Following contents are my library. The Main processes are on the bottom of this code.

let puts = Console.WriteLine : 'a -> unit
let put = Console.Write : 'a -> unit
let read() = Console.ReadLine()
let reads () = Console.ReadLine().Split()
let read2 () = reads() |> (fun x -> x.[0], x.[1])
let read3 () = reads() |> (fun x -> x.[0], x.[1], x.[2])
let read4 () = reads() |> (fun x -> x.[0], x.[1], x.[2], x.[3])
let tmap2 f1 f2 (t1, t2) = (f1 t1, f2 t2)
let tmap3 f1 f2 f3 (t1, t2, t3) = (f1 t1, f2 t2, f3 t3)
let tmap4 f1 f2 f3 f4 (t1, t2, t3, t4) = (f1 t1, f2 t2, f3 t3, f4 t4)
let readAs f = read() |> f
let readAs2 f1 f2 = read2 () |> tmap2 f1 f2
let readAs3 f1 f2  f3 = read3 () |> tmap3 f1 f2 f3
let readAs4 f1 f2 f3 f4 = read4 () |> tmap4 f1 f2 f3 f4
let readInt () = readAs int
let readInt2 () = readAs2 int int
let readInt3 () = readAs3 int int int
let readInt4 () = readAs4 int int int int
let ensmallen l = l % 1000000007L
let manhattan x y = abs (fst x - fst y) + abs (snd x - snd y)
let sayYESNO b = if b then puts "YES" else puts "NO"


// The main contents of this submission are below this line.

let a, b = readInt2 ()
if a + b = 15 then puts "+"
else if a * b = 15 then puts "*"
else puts "x"


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A;
  cin >> A;
  
  cout << "Christmas";
  if (A != 25){
    cout << ' ' << "Eve";
  }
  if (A==23 || A==22){
    cout << ' ' << "Eve";
  }
  if (A==22){
    cout << ' ' << "Eve";
  }
  cout << endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
	int N;
	cin >>N;
	if( N == 1 )
	{	
		cout << "Hello World" << endl;
		return 0;
	}
	int A, B;
	cin >> A >> B;
	cout << A + B << endl;
	return 0;
}

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

using namespace std;

#define MOD 1000000007

int n;
long long fa[100005], fb[100005], fc[100005], la, ans;

int main() {
	scanf("%d", &n);
	fa[0] = 1;
	for (int i = 1; i < n; i++)
		fa[i] = fa[i - 1] * i % MOD;
	fb[n - 1] = 1;
	for (int i = n - 1; i; i--)
		fb[i - 1] = fb[i] * i % MOD;
	for (int i = 1; i < n; i++)
		fc[i] = (fc[i - 1] + fa[i - 1] * fb[i]) % MOD;
	scanf("%lld", &la);
	for (int i = 1; i < n; i++) {
		long long tmp;
		scanf("%lld", &tmp);
		// printf("%lld %lld\n", tmp - la, fc[i]);
		ans = (ans + (tmp - la) * fc[i]) % MOD;
		la = tmp;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 2560
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

ll d[100100];
ll dp[100100][12];
 
int main(){
	ll n,m;
	cin>>n>>m;
	vector<vector<ll> > vv(n,vector<ll>());
	rep(i,0,m){
		ll a,b;
		cin>>a>>b;
		a--;b--;
		vv[a].pb(b);
		vv[b].pb(a);
	}
	ll q;
	cin>>q;
	vector<ll> va;
	vector<ll> vb;
	vector<ll> vc;
	rep(i,0,q){
		ll a,b,c;
		cin>>a>>b>>c;
		a--;
		va.pb(a);
		vb.pb(b);
		vc.pb(c);
	}
	reverse(all(va));
	reverse(all(vb));
	reverse(all(vc));
	clr(d,0);
	clr(dp,0);
	rep(i,0,va.sz){
		queue<ll> q1;
		queue<ll> q2;
		q1.push(va[i]);
		q2.push(vb[i]);
		while(!q1.empty()){
			ll a1 = q1.front();
			ll a2 = q2.front();
			q1.pop();
			q2.pop();
			if(dp[a1][a2]==1)continue;
			dp[a1][a2] = 1;
			if(d[a1]==0)d[a1] = vc[i];
			rep(j,0,vv[a1].sz){
				if(a2-1>=0){
					q1.push(vv[a1][j]);
					q2.push(a2-1);
				}
			}
		}
	}
	rep(i,0,n){
		cout << d[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 22352
/* ***********************************************
Author        :axp
Created Time  :2017/1/22 20:18:48
TASK		  :B.cpp
LANG          :C++
************************************************ */

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;

typedef long long ll;
const int inf = 1<<30;
const int md = 1e9+7;
const int N = 1e5+10;
int n,m;
int T;
int dp[N];
bool vis[N];
vector<int> ve[N];
vector<int> c[N];

int f(int x)
{
	int &re=dp[x];
	if(vis[x])return re;
	vis[x]=1;

	re=0;
	if(ve[x].size()==0)return re=0;
	for(int i=0;i<ve[x].size();i++)
		c[x].push_back(f(ve[x][i]));
	sort(c[x].begin(),c[x].end());
	for(int i=c[x].size()-1;i>=0;i--)
		re=max(re,c[x][i]+((int)c[x].size()-i));
	//cout<<x<<' '<<re<<endl;
	return re;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d",&n);
	int x;
	for(int i=2;i<=n;i++)
	{
		scanf("%d",&x);
		ve[x].push_back(i);
	}
	int ans=0;
	for(int i=1;i<=n;i++)
		ans=max(ans,f(i));
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 20992
// AOJ 2753: Lie with Mean Value
// 2017.10.9 bal4u@uu

#include <stdio.h>

int main()
{
	int n, m, i, k;

	scanf("%d%d", &n, &m);
	for (k = n/2+1, i = 0; i < k; i++) {
		if (i > 0) putchar(' ');
		putchar('0');
	}
	for (; i < n; i++) printf(" %d", m);
	putchar('\n');
	return 0;
}

Measured memory_bytes: 1824
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i < i##_len; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

int main(){
    int n; cin >> n;
    map<int, int> emp, omp;

    REP(i, n){
        if(i%2){
            int e; cin >> e;
            ++emp[e];
        }
        else{
            int o; cin >> o;
            ++omp[o];
        }
    }
    vector<pair<int, int>> e, o;
    for(auto itr = emp.begin(); itr != emp.end(); ++itr){
        e.push_back(make_pair(itr->second, itr->first));
    }
    for(auto itr = omp.begin(); itr != omp.end(); ++itr){
        o.push_back(make_pair(itr->second, itr->first));
    }
    sort(ALL(e), greater<pair<int, int>>());
    sort(ALL(o), greater<pair<int, int>>());
    if(e[0].second != o[0].second){
        cout << n - e[0].first - o[0].first << "\n";
        return 0;
    }
    if(e.size() == 1 && o.size() == 1){
        cout << n/2 << "\n"; return 0;
    }
    int ans = 100000000;
    if(e.size() != 1)
        ans = min(ans, n-e[1].first-o[0].first);
    if(o.size() != 1)
        ans = min(ans, n-e[0].first-o[1].first);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6136
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e10;
const ll MOD = 1e9 + 7;
const ll MAX_N = 3e3 + 10;
ll dp[MAX_N][MAX_N];

// 整数を2進法表記した文字列（0埋めしてk桁にする）を返す
string tobin(ll n, ll k) {
	string out = "";
	ll len = 1;
	ll div = 1;
	while (1) {
		if (n / div < 2) {
			break;
		}
		len++;
		div *= 2;
	}
	for (ll i = 0; i < len; i++) {
		if (n / div >= 1) {
			out = out + "1";
			n -= div;
		}
		else {
			out = out + "0";
		}
		div /= 2;
	}
	if (out.length() <= k) {
		out = string(k - out.length(), '0') + out;
	}

	return out;
}

int main(){
    ll i, j;
    ll N;
    cin>>N;
    vll A(N);
    for(auto &e: A)cin>>e;
    ll a = -1, b = -1, c = -1;
    a = A[0];
    ll nt = 1;
    bool ok = true;

    for(i=1; i<N;i++){
        if(A[i] != a){
            if(nt == 1){
                b = A[i];
                nt++;
            }
            else if(A[i] != b){
                if(nt == 2){
                    c = A[i];
                    nt++;
                }
                else if(A[i] != c){
                    ok = false;
                    break;
                }
            }

        }
    }

    if(nt == 1 && A[0] == 0){
        cout<<"Yes"<<endl;
        return 0;
    }

    if(N%3 != 0){
        cout<<"No"<<endl;
        return 0;
    }

    if (!ok){
        cout<<"No"<<endl;
        return 0;
    }

    ll na = 0, nb = 0, nc = 0;
    for(auto e: A){
        if(e==a){
            na++;
        }
        else if(e==b){
            nb++;
        }
        else if(e==c){
            nc++;
        }
    }
    if(na != nb || nb != nc){
        if(na != nb * 2 && nb != na * 2){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(na == nb * 2){
        c = a;
    }
    if(nb == na * 2){
        c = b;
    }

    string sa = tobin(a, 50);
    string sb = tobin(b, 50);
    string sc = tobin(c, 50);
    // for(i = 0; i<50; i++){
    //     if(sa[i] == sb[i]){
    //         if(sc[i] != '0'){
    //             ok = false;
    //         }
    //     }
    //     if(sa[i] != sb[i]){
    //         if(sc[i] != '1'){
    //             ok = false;
    //         }
    //     }
    // }
    if ((a ^ b) != c){
        ok = false;
    }

    if(!ok){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iomanip>

using namespace std;

const double PI=3.14159265358979323846;

int main()
{
    int R;
    cin >> R;
    cout << fixed << setprecision(4) << 2.0 * R * PI << endl;
    return 0;
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

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

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n;
	cin >> n;
	int ans = 0, sum = 0;
	int a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		ans += sum * a[i] % mod;
		ans %= mod;
		sum += a[i];
		sum %= mod;
	}
	cout << ans;

	return 0;
}

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

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REP1(i,n) for(int i = 1; i <= (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
#define MP(a,b) make_pair((a), (b))
#define ROUNDUP(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second
#define DEBUG(a) cout << #a << ": " << a << "\n"
// #define DEBUG(a) {}

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 4 * 1e18 + 1;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

template<typename T>
T debug(T x) {
	DEBUG(x);
	return x;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll x, y;
	cin >> x >> y;
	int ans = 0;
	while(x <= y){
		x *= 2;
		ans++;
	}
	cout << ans << "\n";
	return 0;
}


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

#define MAX 1024

int main(){
    char s[MAX], t[MAX];
    int n, m, h;
    int i;
    
    while(scanf("%s", s), strcmp(s, "-") != 0){
 n = strlen(s);
        
        scanf("%d", &m);
        
        for(i = 0; i < m; ++i){
            scanf("%d", &h);
            
            memcpy(t + n - h, s,     h);
            memcpy(t,         s + h, n - h);
            memcpy(s,         t,     n);
        }
        
        printf("%s\n", s);
    }
    
    return 0;
}


Measured memory_bytes: 2724
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
#define mkpr make_pair
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


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


  int N; cin>>N;
  vi X(N); REP(i,N) cin>>X[i];

  int  ans = INF;
  FOR(p,1,101) {
    int sum = 0;
    REP(i,N) sum += (X[i]-p)*(X[i]-p);
    ans = min(ans,sum);
  }

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N, K; cin >> N >> K;
    vector<int> a(N);
    for(int i=0; i<N; i++) cin >> a[i];

    ll ans = (1LL<<60);

    for(int i=0; i<N-K+1; i++){
        ll left = a[i];
        ll right = a[i+K-1];

        if(right <= 0){
            ll tmp = abs(left);
            ans = min(ans, tmp);
        }
        else if(left <= 0){
            ll tmp = 2*min(abs(left), abs(right)) + max(abs(left), abs(right));
            ans = min(tmp, ans);
        }
        else{
            ll tmp = right;
            ans = min(ans, tmp);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
//* vamsicool007    You are never wrong to do the right thing    vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
const int N=200005;
vector<int>vis(N);
vector<vector<int>>adj(N);
void dfs(int v){vis[v]=1;for(auto i:adj[v]){if(!vis[i]){dfs(i);}}return;}
bool isPrime(ll n){if(n<2)return false;for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}
int root(int a[],int i){while(a[i]!=i){a[i]=a[a[i]];i=a[i];}return i;}
void unionn(int a[],int i,int j){int root_i=root(a,i);int root_j=root(a,j);a[root_i]=root_j;return;}
void fun()
{
    #ifndef ONLINE_JUDGE
    freopen("infile.txt", "r", stdin);
    freopen("oufile.txt", "w", stdout);
    #endif
}

signed main()
{
    flash;
    //fun();
    int t=1;
    //cin>>t;
    while(t--)
    {
        string s;
        cin>>s;
        int n=s.size();
        int f=0;
        for(int i=0;i<n/2;i++)
        {
        	if(s[i]!=s[n-i-1])
        		{f=1;break;}
        }
        if(!f)
        {
        	int m=(n-1)/2;
        	int f1=0;
        	for(int i=0;i<(n-1)/4;i++)
        	{
        		if(s[i]!=s[m-1-i])
        			{f1=1;break;}
        	}
        	int j=(n+3)/2;
        	int k=(2*n+3)/4;
        	int f2=0;
        	for(int i=j;i<k;i++)
        	{
        		if(s[i]!=s[k-i-1])
        			{f2=1;break;}
        	}
        	if(!f1&&!f2)
        		cout<<"Yes";
        	else
        		cout<<"No";
        }
        else
        	cout<<"No";
    }
    return 0;
}

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

#define int long long
typedef pair <int, int> pii;

const int N = 1e5 + 10;
int n, m, s, t, mark[3][N], dis[N];
vector <int> adj[N];
queue <pii> que;

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int v, u;
		cin >> v >> u;
		v--; u--;
		adj[v].push_back(u);
	}
	cin >> s >> t;
	s--; t--;
	
	fill(dis, dis + N, (int)1e9 + 10);
	dis[s] = 0;
	que.push({s, 0});
	while (que.size()) {
		int v = que.front().first, d = que.front().second;
		que.pop();
		if (dis[v] < d)
			continue;
		dis[v] = d;
		
		if (mark[0][v])
			continue;
			
		mark[0][v] = 1;
		for (int u : adj[v]) {
			if (mark[1][u])
				continue;
			mark[1][u] = 1;
		
			for (int w : adj[u]) {
				if (mark[2][w])
					continue;
				mark[2][w] = 1;
				
				for (int ed : adj[w]) {
					if (d + 1 < dis[ed]) {
						dis[ed] = d + 1;
						que.push({ed, d + 1});
					}
				}
			}
		}
	}
	cout << (dis[t] == (int)1e9 + 10? -1: dis[t]) << endl;
}

Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define REP(i, n) for (LL i = 0; i < (LL)(n); i++)
#define REP2(i, n) for (LL i = 1; i <= (LL)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0)
#define vLL(v,n) vector<LL> v(n); REP(i,n)cin>>v[i];
#define vstr(v,n) vector<string> v(n); REP(i,n)REP(i,n)cin>>v[i];
LL INF = 1e9 + 1;
LL MOD = 1e9+7;
  LL a,b,c,d,e,n,m,l,k,r,x,y,z,t,ans=INF,ans2=0,p;
  bool flag=false;
string s,S;
int main() {
ios_base::sync_with_stdio(false);
char str [222];
scanf ("%s", str ) ;
int n= strlen (str ) ;
for (int i=n -2; i; i -=2) {
  if( strncmp (str , str +i/2 , i/2) ==0) {
     printf ("%d\n" ,i) ;
     return 0;
  }
}
return 0;
}

Measured memory_bytes: 3820
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
long long a,s,d,f;
int main()
{
	cin>>a>>s>>d>>f;
	if(a*s>d*f)
	{
		cout<<a*s<<endl;
	}
	else cout<<d*f<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
char *P[]={"WA","AC"};
char f;

char c;
char C;
char n;
int main(){
  if(getchar()=='A'){f=1;}
  else{f=0;}
  while(f && (c=getchar())!=10){
    n++;
    if(c=='C' && C==0){
      C=n;
    }else if(c<'a' || 'z'<c){
      f=0;
    }
  }
  f = f && 2<=C && C<=n-1;
  puts(P[f]);
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

ll mod_pow(ll x, ll n, ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    ll N;
    cin >> N;
    vector<ll> C(N);
    REP(i,N){
        cin >> C[i];
    }

    sort(C.begin(), C.end());

    ll ans = 0;
    for(int i = 1; i <= N; i++){
        ll c = C[i-1];
        ll add = c;
        add %= MOD;
        add *= mod_pow(2, N+i-1, MOD);
        add %= MOD;
        add *= ((N-i)*mod_pow(2, N-i-1, MOD) % MOD + mod_pow(2, N-i, MOD));
        add %= MOD;

        ans += add;
        ans %= MOD;
    }

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


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

int main() {
  int N, T[100], M, P, X, sum = 0;
  cin >> N;
  rep(i, N) {
    cin >> T[i];
    sum += T[i];
  }
  cin >> M;
  rep(i, M) {
    cin >> P >> X;
    cout << sum + X - T[P - 1] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

int main() {
	int N, M;
	while(cin >> N >> M, N) {
		vvi data(M, vi(3));
		REP(i, M) {
			REP(j, 3) {
				cin >> data[i][j];
			}
		}
		sort(ALL(data));

		vi infected(N);
		infected[0] = 1;
		REP(i, M) {
			if(infected[data[i][1]-1]) {
				infected[data[i][2]-1] = 1;
			}
		}

		int ans = 0;
		REP(i, N) {
			ans += infected[i];
		}


		cout << ans << endl;
	}

	return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

const int N = 10;

int main()
{
	vector<int> A(N);
	FOR(i,0,N){
		cin >> A [i];
	}
	sort(ALL(A),greater<int>());

	FOR(i,0,3){
		cout << A [i] << endl;
	}

	return 0;
}

Measured memory_bytes: 3024
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a,b,c,d;
    a=n/1000;
    b=n/100-a*10;
    c=n/10-a*100-b*10;
    d=n%10;
    if(a+b+c+d==7)
        cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
    else if(a+b+c-d==7)
        cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
    else if(a+b-c+d==7)
        cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
    else if(a+b-c-d==7)
        cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
    else if(a-b+c+d==7)
        cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
    else if(a-b+c-d==7)
        cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
    else if(a-b-c+d==7)
        cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
    else if(a-b-c-d==7)
        cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]
typedef vector< int > vi;
typedef vector< ll > lvi;
typedef vector< vi > vvi;
typedef vector< lvi > lvvi;
typedef pair< int,int > ii;
typedef pair< ll,ll > lii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define mp make_pair
#define ld long double
#define ull unsigned long long int
#define mod 1000000007
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
	ll x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	vector<lii> v;
	for (int i = 0; i < a; ++i)
	{
		ll x;
		cin>>x;
		v.pb({x,1});
	}
	for (int i = 0; i < b; ++i)
	{
		ll x;
		cin>>x;
		v.pb({x,2});
	}
	for (int i = 0; i < c; ++i)
	{
		ll x;
		cin>>x;
		v.pb({x,3});
	}
	sort(all(v),greater<lii>());
	ll x_count=0,y_count=0,tot_count=0,ans=0;
	for (int i = 0; i < v.size(); ++i)
	{
		if(tot_count==(x+y)) break;
		ll val=v[i].ff,type=v[i].ss;
		if(type==1)
		{
			if(x_count>=x) continue;
			x_count++;
			tot_count++;
			ans+=val;
		}
		else if(type==2)
		{
			if(y_count>=y) continue;
			y_count++;
			tot_count++;
			ans+=val;	
		}
		else
		{
			ans+=val;
			tot_count++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 10604
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <stdlib.h>
#include <stdio.h>

using namespace std;

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

int abs_A(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

int abs_B(long long num, long long numb) {
    if (num - numb >= 0)
        return num - numb;
    else
        return -1 * (num - numb);
}

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

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

bool permutation(vector<int>& vec,vector<int>& P) {
    bool ok = true;
    for (int i = 0; i < vec.size(); i++) {
        //cout << vec.at(i);
        if (vec.at(i) != P.at(i)) {
            ok = false;
        }
    }
    return ok;
}

/*bool nibu(vector<int>& retu,int key) {
    
}*/

const long long MOD = 1000000007;
const int INF = 1001001001;

int main() {
    int N;
    cin >> N;
    if (N % 2 == 0) {
        cout << N / 2 << endl;
    }
    else cout << N / 2 + 1 << endl;
}



Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();

    long[] a = new long[n];

    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    long[] lgcds = new long[n];
    long[] rgcds = new long[n];

    long gcd;
    gcd = 0;
    for (int i = 0; i < n; i++) {
      gcd = gcd(gcd, a[i]);
      lgcds[i] = gcd;
    }
    gcd = 0;
    for (int i = n - 1; 0 <= i; i--) {
      gcd = gcd(gcd, a[i]);
      rgcds[i] = gcd;
    }

    long maxGcd = Long.MIN_VALUE;

    for (int i = 0; i < n; i++) {
      long lgcd = 0;
      long rgcd = 0;
      if (0 < i) {
        lgcd = lgcds[i - 1];
      }
      if (i < n - 1) {
        rgcd = rgcds[i + 1];
      }
      maxGcd = Math.max(gcd(lgcd, rgcd), maxGcd);
    }

    os.println(maxGcd);

  }

  private static long gcd(long m, long n) {
    if (m < n) {
      return gcd(n, m);
    }
    if (n == 0) {
      return m;
    }
    return gcd(n, m % n);
  }

}

Measured memory_bytes: 62656
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<utility>
#include<array>
#include<set>
#include <numeric>
#include <stdio.h>
#include <map>
//#include <boost/math/common_factor_rt.hpp>
#include<fstream>
#define EPS (1e-7)
using namespace std;
#define ll long long




int main() {

	int N;
	cin >> N;


	int temp;
	long double sum = 0;
	for (auto i = 0; i < N;i++) {
		cin >> temp;
		sum += (long double)1.0/(long double)temp;
	}
	long double ans = (long double)1.0 / sum;
	cout << std::fixed << ans << endl;



	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define len(x) ((int)(x).size())
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;

const ll LINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9+7;

/// command for char arrays with spaces -> scanf(" %[^\n]", text);
 
////////////////////////// Solution starts below. //////////////////////////////

int main(){
	fastio;
	ll a, b;
	cin >> a >> b;
	set<ll> divA;
	for(ll i = 1; i*i <= a; i++){
		if(a%i == 0){
			divA.insert(a/i);
			divA.insert(i);
		}
	}	
	set<ll> divB;
	for(ll i = 1; i*i <= b; i++){
		if(b%i == 0){
			divB.insert(b/i);
			divB.insert(i);
		}
	}
	vector<ll> common;
	for(auto it = divA.begin(); it != divA.end(); it++){
		if(divB.find(*it) != divB.end()){
			common.emplace_back(*it);
		}
	}
	int ans = 0;
	int tam = len(common);
	vector<ll> aux;
	aux.emplace_back(1);
	for(int i = 0; i < tam; i++){
		bool flag = true;
		for(ll j : aux){
			if(__gcd(common[i], j) != 1) flag = false;
		}
		if(flag){
			ans++;
			aux.emplace_back(common[i]);
		}
	}
	cout << ans << '\n';
	return 0;
}

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

namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            Console.ReadLine();
            var s = Console.ReadLine().Split();
            Console.ReadLine();
            Console.WriteLine(Console.ReadLine().Split().Intersect(s).Count());
        }
    }
}

Measured memory_bytes: 18144
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
#define MOD 1e9 + 7
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
bool cmp(ll a,ll b)
{
	return (a>b);
}
int main()
{
	IOS
	ll n,a,b;
	cin>>n>>a>>b;
	ll i,x,p=0,q=0,r=0;
	for(i=0;i<n;i++)
	{
		cin>>x;
		if(x<=a)
			p++;
		if(x>a and x<=b)
			q++;
		if(x>b)
			r++;
	}
	cout<<min(p,min(q,r));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LONGLONGMAX 9223372036854775807
#define LONGLONGMIN -9223372036854775807
#define INTMAX 32767
#define INTMIN -32767
#define ROUNDUP(divisor,dividend) (divisor + (dividend - 1)) / dividend
string s;bool c=false,f=false;
int main(){
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if(s[i] == 'C') c=true;
    if(c && s[i] == 'F') f=true;
  }
  cout << (c&&f ? "Yes" : "No") << endl;
}


Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
using namespace std;
int road[201][201],d[8];
int n,m,r,i,i2,i3,a,b,c;
bool f(int a,int b){return a<b;}
int main()
{
	cin>>n>>m>>r;
	for(i=0;i<r;i++)cin>>d[i];
	for(i=0;i<=n;i++)for(i2=0;i2<=n;i2++)road[i][i2]=1000000000;
	for(i=0;i<m;i++)
	{	
		cin>>a>>b>>c;
		road[a][b]=road[b][a]=c;
	}
	for(i3=1;i3<=n;i3++)
		for(i=1;i<=n;i++)
			for(i2=1;i2<=n;i2++)
				road[i][i2]=min(road[i][i2],road[i][i3]+road[i3][i2]);
	sort(d,d+r,f);
	b=2147483647;
	while(next_permutation(d,d+r))
	{
		a=0;
		for(i2=0;i2<r-1;i2++)a+=road[d[i2]][d[i2+1]];
		b=min(a,b);
	}
	cout << b<<"\n";
}

Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
int main(){
  int h,i,j,k;
  int o,p,m,n,r,s[78500];
  s[0]=-1000001;
  s[1]=2;
  j=2;
  for(i=3;i<1000000;i+=2){
    r=(int)sqrt(i)+1;
    for(k=3;k<r;k+=2){
      if(i%k==0)
	r=0;
    }
    if(r){
      s[j]=i;
      j++;
    }
  }
  s[j]=2000001;
  for(;;){
    scanf("%d",&n);
    if(n==0)
      break;
    o=0;
    for(h=0;h<n;h++){
      scanf("%d%d",&p,&m);
      for(i=0;i<78499;i++){
	if(s[i]<p-m&&p-m<s[i+1]){
	  i++;
	  break;
	}else if(s[i]==p-m)
	  break;
      }
      for(j=78499;j>0;j--){
	if(s[j-1]<p+m&&p+m<s[j]){
	  j--;
	  break;
	}else if(s[j]==p+m)
	  break;
      }
      if(j-i+1)
	o+=j-i;
      else
	o--;
    }
    printf("%d\n",o);
  }
  return 0;
}

Measured memory_bytes: 716
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, T = map(int, input().split())
L = [int(v) for v in input().split()]

ans = 0
pos = 0
for i in range(N):
    v = L[i]
    if pos > v:
        ans += v + T - pos
    else:
        ans += T

    pos = v + T

print(ans)

Measured memory_bytes: 25744
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <ctime>

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define v edge[i].to
#define mp(a, b) make_pair(a, b)

using namespace std;

typedef long long LL;
const int N = 510000;

pair<int, int> x[N];
int st[N], top, ans[N], q[N], l, r;

int main()
{
	int n;
	scanf("%d", &n);
	Rep(i, n){
		scanf("%d", &x[i].first);
		x[i].second = i;
	}
	sort(x + 1, x + 1 + n);
	Rep(i, n){
		for (int j = x[i - 1].first + 1; j < x[i].first; j ++) q[++ r] = j;
		ans[x[i].first] = x[i].second;
		Rep(j, x[i].second - 1) {
			if (l == r) { printf("No\n"); return 0;}
			ans[q[++ l]] = x[i].second;
		}
	}

	x[n + 1].first = n * n + 1;
	Rep(i, n + 1){
		for (int j = x[i - 1].first + 1; j < x[i].first; j ++)
			if (!ans[j]) {
				if (!top) { printf("No\n"); return 0;}
				else ans[j] = st[top --];
			}
		Rep(j, n - x[i].second) st[++ top] = x[i].second;
	}
	printf("Yes\n");
	Rep(i, n * n) printf("%d ", ans[i]);
	printf("\n");
	
	return 0;
}
/*
5
1 11 9 17 20
*/

Measured memory_bytes: 6144
n,x = gets.chomp.split(' ').map(&:to_i)
l = gets.chomp.split(' ').map(&:to_i)
ans = [0]
count = 1
i = 0
while i < n
  d = ans[i] + l[i]
  count += 1 if d <= x
  ans << d
  i += 1
end
p count

Measured memory_bytes: 14352
#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(){
	int n, x;
    cin >> n >> x;
    int ka;
    int min = 2000;
    rep(i, n){
      cin >> ka;
      if(min > ka) min = ka;
      x -= ka;
    }
	cout << n+x/min << endl;
    return 0;
}

Measured memory_bytes: 256
//
//  AC_or_WA.cpp
//  NYU Progteam
//
//  Created by Xinyu Qu on 2/21/20.
//  Copyright © 2020 Xinyu Qu. All rights reserved.
//

#include <stdio.h>
#include <iostream>
using namespace std;

int main(){
    int N,M;
    cin >> N >> M;
    
    if(M < N) cout << "No";
    else cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define W(x) cout<<x<<endl;
#define Debug(x) cout<<"#DEBUG "<<x<<endl;
#define INF (1<<29)
//a...z==97...122
using namespace std;
int min(int x,int y){if(y<x)return y;else return x;}
int max(int x,int y){return x+y-min(x,y);}
int fact(int x){int i=1;rep(j,x){i*=(j+1);} return i;}
//ARC098
int main()
{
    int n;
    cin>>n;
    char s[n+1];
    rep(i,n)
    {
        cin>>s[i];
    }
    struct ar{
        bool f,l;
    };
    int m=0,cnt;
    struct ar x;
    rep(i,n-1)
    {
        cnt=0;
        Rep(rr,97,123)
        {
            x.f=false;
            x.l=false;
            rep(j,i+1)
            {
                if(!x.f)x.f=((int)s[j]==rr);
            }
            Rep(j,i+1,n)
            {
                if(!x.l)x.l=((int)s[j]==rr);
            }
            if(x.f&&x.l)cnt++;
        }
        m=max(cnt,m);
    }
    W(m)
    return 0;
}


Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n,x,ans=0,a,b;
  cin >> n >> x;
  ans = n;
  a = max(x,n-x);
  b = min(x,n-x);
  while(true){
    ll add = a/b;
    ll r = a%b;
    ans += (2*b) * add;
    if(r == 0) ans -= b;
    a = b;
    b = r;
    if(b == 0) break;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#入力
n, W = map(int, input().split())
s = []
for i in range(n):#h:高さ
    s.append([int(m) for m in input().split()])
s.sort(key=lambda x:(x[0], x[1]))
s0 = []
s1 = []
s2 = []
s3 = []
for i in range(n):
    if i == 0:
        w0 = s[i][0]
        s0.append(s[i])
    elif s[i][0] == w0:
        s0.append(s[i])
    elif s[i][0] == w0 + 1:
        s1.append(s[i])
    elif s[i][0] == w0 + 2:
        s2.append(s[i])
    elif s[i][0] == w0 + 3:
        s3.append(s[i])
s0.sort(key=lambda x: x[1], reverse=True)
s1.sort(key=lambda x: x[1], reverse=True)
s2.sort(key=lambda x: x[1], reverse=True)
s3.sort(key=lambda x: x[1], reverse=True)
w = []
v = []
t0 = 0
t1 = 0
t2 = 0
t3 = 0
u0 = 0
u1 = 0
u2 = 0
u3 = 0
u = []
for h in range(-1, len(s0)):
    if h == -1:
        t0 = 0
        u0 = 0
    else:
        t0 += s0[h][0]
        u0 += s0[h][1]
    for i in range(-1, len(s1)):
        if i == -1:
            t1 = 0
            u1 = 0
        else:
            t1 += s1[i][0]
            u1 += s1[i][1]
        for j in range(-1, len(s2)):
            if j == -1:
                t2 = 0
                u2 = 0
            else:
                t2 += s2[j][0]
                u2 += s2[j][1]
            for k in range(-1, len(s3)):
                if k == -1:
                    t3 = 0
                    u3 = 0
                else:
                    t3 += s3[k][0]
                    u3 += s3[k][1]
                if t0 + t1 + t2 + t3 <= W:
                    u.append(u0 + u1 + u2 + u3)
print(max(u))

Measured memory_bytes: 9796
#include <iostream>
#include <cstring>
using namespace std;
int N, M, R;
int d[201][201];
int r[9];
int INF = 1 << 29;
int res = INF;
bool used[9];
void dfs(int c, int las, int dist) {
	if (c == R + 1) {
		if (res > dist) res = dist;
		return;
	}
	else {
		for (int i = 1; i <= R; ++i) {
			if (!used[i]) {
				used[i] = true;
				if (las == -1) dfs(c + 1, i, 0);
				else dfs(c + 1, i, dist + d[r[las]][r[i]]);
				used[i] = false;
			}
		}
	}
}
int main(void) {
	cin >> N >> M >> R;
	memset(used, false, 9);
	for (int i = 1; i <= R; ++i) {
		cin >> r[i];
	}
	for (int i = 1; i <= N; ++i) {
		for (int j = 1; j <= N; ++j) {
			if (i == j) {
				d[i][j] = 0;
			}
			else {
				d[i][j] = INF;
			}
		}
	}
	for (int i = 1; i <= M; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		if (d[a][b] > c) {
			d[a][b] = d[b][a] = c;
		}
	}
	for (int k = 1; k <= N; ++k) {
		for (int i = 1; i <= N; ++i) {
			for (int j = 1; j <= N; ++j) {
				if (d[i][j] > d[i][k] + d[k][j]) {
					d[i][j] = d[i][k] + d[k][j];
				}
			}
		}
	}
	dfs(1, -1, 0);
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {

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

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            boolean first=true;
            int[] N=null,M=null;
            int[] vote=null;
            int n=0,m=0,i=0;
            while ((line = br.readLine()) != null) {
            	if(first){
            		String[] tokens=line.split(" ");
            		n=Integer.parseInt(tokens[0]);
            		m=Integer.parseInt(tokens[1]);
            		N=new int[n];
            		vote=new int[n];
            		M=new int[m];
            		first=false;
            	}else{
            		if(n>i){
            			N[i]=Integer.parseInt(line);
            		}else{
            			M[i-n]=Integer.parseInt(line);
            		}
            		i++;
            		if(n+m==i){
            			break;
            		}
            	}
            }
            for(int j=0;j<m;j++){
            	for(int k=0;k<n;k++){
                	if(M[j]>=N[k]){
                		vote[k]++;
                		break;
                	}
                }
            }
            int max=0,store=0;
            for(int k=0;k<n;k++){
            	if(max<vote[k]){
            		max=vote[k];
            		store=k;
            	}
            }
            System.out.println(store+1);
        }
    }

}

Measured memory_bytes: 25212
#include <iostream>

using namespace std;

int linerSearch( const int *S, const int n,  int key ) {
    for ( int i = 0; i < n; ++i ) {
        if ( S[i] == key ) {
            return 1;
        }
    }
    return 0;
}

int main() {
    int n;
    int q;

    int S[10000];
    int T[500];

    int cnt = 0;

    cin >> n;
    for ( int i = 0; i < n; ++i ) {
        cin >> S[i];
    }

    cin >> q;
    for ( int i = 0; i < q; ++i ) {
        cin >> T[i];
    }

    for ( int i = 0; i < q; ++i ) {
        cnt += linerSearch(S,n,T[i]);
    }

    cout << cnt << endl;
    return 0;

}


Measured memory_bytes: 3100
n = int(input())
total = 0

#a > b
def gcd(a,b):
	if b == 0:
		return a

	return gcd(b, a % b)

total = total + n * (n+1) / 2

for i in range(n):
	for j in range(i+1,n):
		total = total + 6 * gcd(j+1,i+1)

for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			l = gcd(j+1,k+1)
			if i < l:
				total = total + 6 * gcd(l,i+1)
			else:
				total = total + 6 * gcd(i+1,l)

print(int(total))


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

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

    int a, b;
    cin >> a >> b;
    if (a == b) {
        cout << "a == b" << endl;
    } else if (a < b) {
        cout << "a < b" << endl;
    } else {
        cout << "a > b" << endl;
    }
}


Measured memory_bytes: 3148
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int n;
    cin >> n;
    vector<int> positive, negative;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        if (a >= 0) {
            positive.push_back(a);
        }
        else {
            negative.push_back(a);
        }
    }

    sort(positive.begin(), positive.end(), greater<int>());
    sort(negative.begin(), negative.end());

    if (positive.size() == 0) {
        positive.push_back(negative.back());
        negative.pop_back();
    }
    else if (negative.size() == 0) {
        negative.push_back(positive.back());
        positive.pop_back();
    }

    vector<pair<int, int>> ans;
    for (int i = 1; i < positive.size(); ++i) {
        ans.push_back({negative[0], positive[i]});
        negative[0] -= positive[i];
    }

    for (int i = 0; i < negative.size(); ++i) {
        ans.push_back({positive[0], negative[i]});
        positive[0] -= negative[i];
    }

    cout << positive[0] << endl;
    for (auto x : ans) {
        cout << x.first << " " << x.second<< endl;
    }

    return 0;
}

Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

vector<int> divisor(int n){
	vector<int> res;
	for(int i = 1; i * i <= n; i++){
		if(n % i == 0){
			res.emplace_back(i);
			if(i != n / i) res.emplace_back(n / i);
		}
	}
	return res;
}

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

	int ans = 0;
	for(int i = 1; i <= n; i += 2){
		ans += divisor(i).size()  == 8;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256