akhauriyash/Code-Regression huggingface dataset:
// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;
 
#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

ll dp[100005];
int h[100005];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    rep1(i, n) cin >> h[i];
    memset(dp, 0x3f, sizeof dp);
    dp[1] = 0;
    rep1(i, n) {
        if(i < n-1) dp[i+2] = min(dp[i+2], dp[i] + abs(h[i] - h[i+2]));
        if(i < n) dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i+1]));
    }
    cout << dp[n] << endl;
}



Measured memory_bytes: 1408
import java.util.Scanner;
public class Main{
	int x;
	
	public void solve(){
		Scanner sc = new Scanner(System.in);
		x = sc.nextInt();
		System.out.println(x*x*x);
	}
		
	public static void main(String[] args){
		Main obj =new Main();
		obj.solve();
	}
}

Measured memory_bytes: 17156
ans = float("inf")


def solve():

    d, g = map(int, input().split())
    pc = [list(map(int, input().split())) for i in range(d)]

    # まだ解いてない配点を nokori として持つ
    def dfs(i, sum, count, nokori):
        global ans
        if i == d:
            # G 点に満たなければ nokori のうち一番大きいものを解く
            if sum < g:
                use = max(nokori)
                # 解く問題が問題数を超えないように注意
                n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
                count += n
                sum += n * use * 100

            if sum >= g:
                ans = min(ans, count)
        else:
            # 総合スコア、解いた問題数、まだ解いてない問題を更新
            dfs(i + 1, sum, count, nokori)
            dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 +
                pc[i][1], count + pc[i][0], nokori - {i + 1})

    dfs(0, 0, 0, set(range(1, d + 1)))
    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 42096
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const ll INF = 1e9 + 7;
const ll inf = 1LL << 50;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
///////////////////////////////////////

int main() {
	string s; cin >> s;
	int gsum = 0;
	int psum = 0;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == 'g')gsum++;
		else psum++;
	}
	cout << (gsum - psum) / 2 << endl;
	return 0;
}

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

# define pb push_back
# define sz(x) ((int)(x).size())
# define whole(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
const int INF = (int)1e9 + 7;
const int N = (int)2e5 + 7;

int n;
int main(){
    scanf ("%d", &n);
    if (n % 1000 == 0)
        return !printf ("0\n");
    printf ("%d\n", 1000 - (n % 1000));
    return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

void compute() {

}

int main() {
  int n;
  cin >> n;
  deque<ll> deq(3*n);
  rep(i,3*n) cin >> deq[i];
  sort(ALL(deq));
  ll ans = 0;
  while( !deq.empty() ) {
    deq.pop_front();
    deq.pop_back();
    ans += deq.back();
    deq.pop_back();
  }
  cout << ans << endl;
  compute();
  return 0;
}


Measured memory_bytes: 2688
// ConsoleApplication1.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <iostream>
#include <string>

using namespace std;


int main()
{
	string s;
	int sum = 0;
	cin >> s;
	int k = s.size();
	
	for (int i = 1; i < k - 1; i++) {
	
			sum++;
	
	}
	cout << s[0] << sum << s[s.size()-1] << endl;
}
// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこの,プロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


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


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

Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
using pl = pair<ll,ll>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  mp(a,b)  make_pair(a,b)
#define  yn(a)    cout << ( (a)?"War\n":"No War\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;


int main(int argc,char* argv[])
{
    int n;
    double a=0,q;
    string s;
    cin>>n;
    rep(i,n){
        cin>>q>>s;
        if(s=="JPY")a+=q;
        else a+=q*380000;
    }
    cout<<setprecision(8)<<a<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(a!=b&&b!=c&&c!=a) printf("3\n");
  else if(a==b&&b!=c&&c!=a) printf("2\n");
  else if(a!=b&&b==c&&c!=a) printf("2\n");
  else if(a!=b&&b!=c&&c==a) printf("2\n");
  else printf("1\n");
  return 0;
}

Measured memory_bytes: 128
package main

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

func main() {
	N := ReadInt()
	H := ReadInts(N)
	ans := 1
	max := H[0]
	for _, h := range H[1:] {
		if h >= max {
			max = h
			ans++
		}
	}
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
int main() {
    ll n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    sort(v.begin(), v.end());
    double ans = (v[0] + v[1])*0.5;
    for (int i = 2;  i < n; i++) {
        ans = (ans + v[i])*0.5;
    }
    cout << setprecision(15) << ans << endl;
    return 0;
}


Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,k,i,a[N],b[N];
int main(){
	scanf("%d%d",&n,&k);
	if(k>n+1>>1){puts("-1");return 0;}
	for(i=0;i<n;++i)a[i]=i,b[i]=k+i+k+n+(i+(n-1>>1))%n;
	sort(a,a+n,[&](int x,int y){return b[x]<b[y];});
	for(i=0;i<n;++i){
		assert(k+a[i]+k+n+(a[i]+(n-1>>1))%n<=k+n*2+i);
		printf("%d %d %d\n",k+a[i],k+n+(a[i]+(n-1>>1))%n,k+n*2+i);
	}
}

Measured memory_bytes: 3072
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <numeric>
using namespace std;
#define MAX_N 400
#define MAX_S 100010

// input
int A, B;

int main() {
  cin >> A >> B;
  if ((A + B) % 2 == 0) {
    int K = (A + B) / 2;
    cout << K << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string &s)
{
    return '"' + s + '"';
}

string to_string(const char *s)
{
    return to_string((string)s);
}

string to_string(bool b)
{
    return (b ? "true" : "false");
}

string to_string(vector<bool> v)
{
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v)
{
    string res = "";
    for (size_t i = 0; i < N; i++)
    {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v)
{
    bool first = true;
    string res = "{";
    for (const auto &x : v)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p)
{
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << " " << to_string(H);
    debug_out(T...);
}

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair
#define fst first
#define snd second
#define fr(i, a, b) for(int i=a; i<b; i++)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    ll n; cin >> n; ll n2 = n;
    vector<pair<ll, ll> > vs;
    for(ll i=2; i*i <=n2; i++) {
        int cnt = 0;
        while(n % i == 0) {
            n/=i;
            cnt++;
        }
        if(cnt) {
            vs.push_back({i, cnt});
        }
    }
    if(n != 1) {
        vs.push_back({n, 1});
    }
    ll res = 0;
    // debug_out(vs);
    for(int i=0; i<vs.size(); i++) {
        if(vs[i].first != 1) {
            ll t = 1;
            while(t * (t+1) <= 2 * vs[i].second) t++;
            t--;
            res += t;
        }
    }
    cout << res << endl;
}


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

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

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

vector<int> sieve(int n) {
	vector<int> res(1, 2);
	vector<bool> prime(n, true);
	for(int i = 3; i < n; i += 2) {
		if(prime[i]) {
			res.push_back(i);
			for(int j = i * 3; j < n; j += i * 2)
				prime[j] = false;
		}
	}

	return res;
}

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

	const int MAX = 120000;
	const vector<int> primes = sieve(MAX);
	for(int n, p; cin >> n >> p, n != -1;) {
		const int start = upper_bound(primes.begin(), primes.end(), n) - primes.begin();
		vector<int> nums;
		nums.reserve(6000);
		for(int i = start; i < start + 100; ++i)
			for(int j = i; j < start + 100; ++j)
				nums.push_back(primes[i] + primes[j]);

		sort(nums.begin(), nums.end());
		cout << nums[p - 1] << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1348
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;

template<typename T>
struct BIT{
  int n;
  vector<T> d;
  BIT(int n = 0):n(n),d(n+1){}
  void add(int i,T x=1){
    for(i++;i<=n;i += i&-i){
      d[i] += x;
    }
  }
  T sum(int i){
    T x = 0;
    for(i++;i>0;i -= i&-i){
      x += d[i];
    }
    return x;
  }
};
 
int main(){
  int n,d,a;cin >> n >> d >> a;
  vector<pair<ll,ll>> enemy(n);
  rep(i,n) cin >> enemy[i].first >> enemy[i].second;
  sort(enemy.begin(),enemy.end());
  vector<ll> bpos,damage;
  BIT<ll> tree(200005);
  bpos.push_back(enemy[0].first+2*d);
  tree.add(0,(enemy[0].second+a-1)/a*a);
  ll ans = (enemy[0].second+a-1)/a;
  for(int i = 1;i < n;i++){
    int ind = lower_bound(bpos.begin(),bpos.end(),enemy[i].first) - bpos.begin();
    ll sum = tree.sum(bpos.size()-1) - ((ind > 0) ? tree.sum(ind-1) : 0);
    // for(int j = ind;j < bpos.size();j++){
    //   sum += damage[j];
    // }
    if(sum >= enemy[i].second) continue;
    sum = enemy[i].second - sum;
    bpos.push_back(enemy[i].first + 2*d);
    tree.add(bpos.size()-1,(sum+a-1)/a*a);
    ans += (sum+a-1)/a;
  }
  cout << ans << endl;

  
}

Measured memory_bytes: 9916
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define md 998244353
#define trace(...)
#define ll long long int
#define ld long double
#define fi first
#define se second
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define mem(a) memset(a, 0, sizeof(a))
#define vpi std::vector<pair<int,int>>
#define pii pair<int,int>
#define pb push_back
#define sall(v) sort(v.begin(),v.end())
#define all(v) (v.begin(),v.end())
#define minf -10000000
#define vi vector<int>
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
ll power(ll x, ll y,ll p) { 
    ll res = 1;      
    x = x % p;  
    while (y > 0) {  
        if (y & 1){  
            res = (res*x) % p;  
        }
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
}
ll power(ll x, ll y) { 
    ll res = 1;       
    while (y > 0) {    
        if (y & 1) 
            res = (res*x) ;  
        y = y>>1; 
        x = (x*x);   
    } 
    return res; 
}
 
ll max3(ll a,ll b,ll c){
    return max(a,max(b,c));
}
ll min3(ll a,ll b,ll c){
    return min(a,min(b,c));
}
bool isPrime(ll n) { // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}
const int nax=2e5+5;

void solve(){
    int n;cin>>n;
    string s;cin>>s;
    int cntr=0,cntw=0;
    fr(i,0,n-1){
        if(s[i]=='R')cntr++;
        else cntw++;
    }
    int ans=min(cntr,cntw);
    if(ans==0){
        cout<<"0\n";return;
    }
    //find the number of reds that liew after a white
    int cnt=0;
    int pos=-1;
    fr(i,0,n-1){
        if(s[i]=='W'){
            pos=i;break;
        }
    }
    fr(i,pos+1,n-1){ 
       if(s[i]=='R')cnt++;
    }
    fr(i,pos+1,cntr-1){
        if(s[i]=='R')cnt--;
    }
    ans=min(ans,cnt);
    cout<<ans<<endl;
    return;
}

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout<<fixed<<setprecision(8);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
    #ifndef ONLINE_JUDGE
    cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
    #endif
    return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#include <vector>
#include <stdio.h>

#include <set>
#include <queue>
#include <algorithm>
#include <string>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
	}
	if((n-k)%(k-1)==0){
		cout<<((n-k)/(k-1))+1<<endl;
	}
	else{
		cout<<((n-k)/(k-1))+2<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

monster = 0
addPower = 0

for i in range(N):
    #print(A[i],'+', A[i+1], ' vs ', B[i], end = ' => ')
    AA = A[i] + A[i+1]
    BA = B[i] - A[i]
    BAA= B[i] - AA
    if BAA >= 0:
        #print(':', end='')
        monster += AA
        A[i+1] -= min(A[i+1], BA)
    elif BA > 0:
        #print('%', end='')
        monster += B[i]
        A[i+1] -= min(A[i+1], BA)
    else:
        #print('@', end='')
        monster += B[i]
print(monster)

Measured memory_bytes: 18624
import sys
#from collections import defaultdict, deque, Counter
#from bisect import bisect_left
#import heapq
#import math
#from itertools import groupby as gb
#from itertools import permutations as perm
#from itertools import combinations as comb
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
#n,m = map(int, stdin.readline().rstrip().split())
#AB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]
ans = 800*n - (n//15)*200
print(ans)


Measured memory_bytes: 2940
import sys
input = sys.stdin.readline

N,M = map(int, input().split())
Lm = 0
Rm = N+1
for i in range(M):
    L,R = map(int, input().split())
    Lm = max(Lm, L)
    Rm = min(Rm, R)
if Rm >= Lm:
    print(Rm - Lm + 1)
else:
    print(0)

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    ll N;
    cin >> N;
    vector<ll> D(N);
    REP(i, N) {
        cin >> D[i];
    }
    sort(D.begin(), D.end());
    D.erase(unique(D.begin(), D.end()), D.end());
    cout << D.size() << endl;
    return 0;
}

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

using namespace std;

#define int long long
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

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

int N, A[100001];

int gcd(int x, int y) {
	return y == 0 ? x : gcd(y, x % y);
}

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

	cin >> N;
    int res;
    for(int i = 0; i < N; ++i) {
        cin >> A[i];
        if(i >= 1) res = gcd(res, A[i]);
        else res = A[i];
    }
    cout << res << endl;
    return 0;
}

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

int main()
{
    int k, s;
    int x, y, z;
    int cnt = 0;
    cin >> k >> s;
    for (x = 0; x <= k; x++)
    {
        for (y = 0; y <= k; y++)
        {
            if (0 <= s - x - y && s - x - y <= k)
                cnt++;
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
int a[105][105]={0};


int main()
{
  for(int i=0;i<105;i++)
  {
  	 for(int j=0;j<105;j++)
  	  {
  	  	 if(i!=j)
  	  	 a[i][j]=1e9;
		}
  }
  for(int i=0;i<3;i++)
  {
  	 int x,y;
  	 cin>>x>>y;
  	 a[x][y]=a[y][x]=1;
  }
  for(int k=1;k<=4;k++)
  {
  	 for(int i=1;i<=4;i++)
  	 { 
  	 if(i==k)continue;
  	 	 for(int j=1;j<=4;j++)
  	 	  {
  	 	  	if(i!=j&&j!=k&&a[i][j]>a[i][k]+a[k][j])
  	 	  	{
  	 	  		a[i][j]=a[i][k]+a[k][j];
				 }
			 }
	   }
  }
  for(int i=1;i<=4;i++)
  {
  	int sum=0;
  	 for(int j=1;j<=4;j++)
  	 {
  	 	 if(i!=j)
  	 	 sum+=(a[i][j]);
	   }
	   if(sum==6)
	   {
	   	printf("YES\n");
	   	return 0;
	   }
	  //cout<<sum<<endl;
  }
  printf("NO\n");

}



Measured memory_bytes: 256
a, b, c, d = list(input().strip())

for i in range(2 ** 3):
    eq = a + ("+" if i % 2 else "-") + b + ("+" if (i >> 1) % 2 else "-") + c + ("+" if (i >> 2) % 2 else "-") + d
    if eval(eq) == 7:
        print(eq + "=7")
        break


Measured memory_bytes: 3060
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <ctype.h>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int x, a, b;
    cin >> x >> a >> b;
    if(a - b >= 0){
        cout << "delicious" << endl;
    }
    else if(a + x < b){
        cout << "dangerous" << endl;
    }
    else {
        cout << "safe" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int dp[110][100010], N, K;
signed main() {
    cin >> N >> K;

    for(int i=0; i<=K; i++) dp[0][i] = 1;
    for(int i=0; i<N; i++) {
        int A; cin >> A;
        for(int j=0; j<=K; j++) {
            int l = max(-1LL, j-A-1);
            int r = j;

            int sumr = dp[i][r];
            int suml = (l < 0 ? 0 : dp[i][l]);

            (dp[i+1][j] += (sumr - suml + MOD)) %= MOD;
            if(j > 0) dp[i+1][j] += dp[i+1][j-1];
        }
    }

    cout << dp[N][K] - (K > 0 ? dp[N][K-1] : 0) << endl;
    return 0;
}


Measured memory_bytes: 80128
S = input()

if S.count("R") == 0:
    print(0)
    exit()
if S.count("R") == 3:
    print(3)
elif S.count("R") == 2 and (S[0] == S[1] or S[1] == S[2]):
    print(2)
else:
    print(1)


Measured memory_bytes: 9036
class UnionFind:
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rank = [0]*(n+1)

    # ノードxのrootノードを見つける
    def findRoot(self, x):
        if(self.root[x] < 0): # 根
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.findRoot(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.findRoot(x)
        y = self.findRoot(y)
        # すでに同じ木に属していた場合
        if x == y:
            return 
        # 違う木に属していた場合rankを見てくっつける方を決める
        if self.rank[x] > self.rank[y]:
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.findRoot(x) == self.findRoot(y)

    # ノードxが属する木のサイズを返す
    def count(self, x):
        return -self.root[self.findRoot(x)]

n,m = map(int,input().split())
union = UnionFind(n)

for i in range(m):
    x, y = map(int,input().split())
    union.unite(x, y)

ans = 0

for i in range(n):
    ans = max(union.count(i), ans)

print(ans)


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

int main(){
  int N;
  cin >> N;
  vector<vector<int>> F(N, vector<int>(10));
  for(int i=0; i<N; i++){
    for(int j=0; j<10; j++){
      cin >> F.at(i).at(j);
    }
  }
  vector<vector<int>> P(N, vector<int>(11));
  for(int i=0; i<N; i++){
    for(int j=0; j<=10; j++){
      cin >> P.at(i).at(j);
    }
  }
  int64_t Ans=-1000000000000;
  for(int i=1; i<1024; i++){
    int64_t subAns=0;
    int j=i;
    vector<int> G(10, 0);
    for(int k=0; k<10; k++){
      if(j%2==1){
        G.at(k)=1;
      }
      j/=2;
    }
    for(int k=0; k<N; k++){
      int c=0;
      for(int u=0; u<10; u++){
        c+=F.at(k).at(u)*G.at(u);
      }
      subAns+=P.at(k).at(c);
    }
    Ans=max(Ans, subAns);
  }
  cout << Ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
const int N = 1e3 + 1 ;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;
const int inf = 1e15 + 7;

int32_t main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n , w;
    cin >> n >> w;

    int wt[n + 1] , val[n + 1];
    int V(0);
    wt[0] = val[0] = 0;
    for(int i = 1 ; i <= n ; i++){
        cin >> wt[i] >> val[i];
        V += val[i];
    }

    std::vector<std::vector<int> > dp(n + 1 , std::vector<int> (V + 2, inf));

   // dp(i , j) --> represents minimum weight required to get value j if i items are availiable 
    dp[0][0] = 0;
    for(int item = 1 ; item <= n ; item++){
        dp[item][0] = 0;
    } 
    for(int item = 1 ; item <= n ; item++){
        for(int value = 0 ; value <= V ; value++){
            if(value == 0) dp[item][value] = 0;
            else if(value >= val[item]){
                dp[item][value] = min( wt[item]  + dp[item - 1][value - val[item]] , dp[item - 1][value]);
            }else dp[item][value] = dp[item - 1][value];
        }
    }

    for(int i = V ; i >= 0 ; i--){
        if(dp[n][i] <= w){
            cout << i << ' ';
            return 0;
        }
    }
  
    return 0;   
}


Measured memory_bytes: 80256
(let* ((n (read))
       (ac (make-hash-table :size n))
       (wa (make-hash-table :size n))
       (m (read))
       (ac-num 0)
       (wa-num 0))
  (loop :for i :from 1 :to m
        :for p := (read)
        :for s := (read-line)
        :unless (gethash p ac)
        :do (if (string= s "AC")
                (setf (gethash p ac) 1)
                (if (gethash p wa)
                    (incf (gethash p wa))
                    (setf (gethash p wa) 1))))
  (maphash (lambda (key val)
             (incf ac-num val)
             (incf wa-num (if (gethash key wa) (gethash key wa) 0)))
           ac)
  (format t "~A ~A~%" ac-num wa-num))


Measured memory_bytes: 77044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

	int a, b; cin >> a >> b;
	ves v(2,"");
	rep(i,b) v[0] += to_string(a);
	rep(i,a) v[1] += to_string(b);
	sort(all(v));
	cout << v[0] << endl;
}

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

#define forn(i, a, b) for (int i = a; i <= b; ++i)
#define forr(i, a, b) for (int i = a; i >= b; --i)

using namespace std;

const int N = (int)2e5 + 7;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef long double ld;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

int n, a, b, x[N];
int main (){
  scanf ("%d %d %d", &n, &a, &b);
  forn (i, 1, n){
    scanf ("%d", x + i);
  }
  int cur = x[1];
  ll ans = 0;
  forn (i, 2, n){
    ans += min((abs(cur - x[i]) * 1ll * a), 1ll * b);
    ll cur1 = abs(cur - x[i]) * a, cur2 = b;
    cur = x[i];
  }
  printf ("%lld\n", ans);
  return 0;
}/*
1 2 3 4 5 6 7
_ _     _   _*/


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

int main(){
	string s;
	cin>>s;
	bool flag=false;
	if(s[0]==s[1]&&s[1]==s[2])flag=true;
	if(s[1]==s[2]&&s[2]==s[3])flag=true;
	if(flag)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int i,sum=0,ans=0;
  string s;
  cin >> s;
  for(i=0; i<s.size();i++){
    if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' ||s[i] == 'T'){
      sum++;
    }else{
      sum = 0;
    }
      ans = max(sum,ans);
  }
  cout << ans << endl;
 }

Measured memory_bytes: 256
using System;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            string op;
            if (a < b)
            {
                op = "<";
            }
            else if (a > b)
            {
                op = ">";
            }
            else
            {
                op = "==";
            }
            Console.WriteLine("a " + op + " b");
        }
    }
}

Measured memory_bytes: 8856
#include <iostream>

using namespace std;

int main() 
{
	int x,y,temp;
	cin >> x >> y;

	while (x != 0 ||  y != 0) 
	{
		if ( x > y )
		{
			temp = y;
			y = x;
			x = temp;
		}	
			
		cout << x << " " << y << endl;
		cin >> x >> y;
	}
}


Measured memory_bytes: 3040
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  ll n,k;cin>>n>>k;
  ll com[n+1][n+1];

  REP(i,n+1){
    REP(j,i+1){
      if(i==0||j==0||i==j){
        com[i][j] = 1;
       }else{
        com[i][j] = (com[i-1][j] + com[i-1][j-1])%MOD;
      }
      //cout<<i<<"  "<<j<<"  "<<com[i][j]<<endl;
    }
  }

  for(int i=1;i<=k;i++){
    if(i<=n-k+1){
      ll l = (com[k-1][i-1] * com[n-k+1][i]) % MOD;
      cout<<l<<endl;
    }else{
      cout<<0<<endl;
    }
  }
 

  return 0;
}

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

public class Main {

    private static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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

    public static void main(String[] args) {    //throws FileNotFoundException {
        InputStream inputStream = System.in;    //new FileInputStream("input.txt");
        OutputStream outputStream = System.out; //new FileOutputStream("output.txt");
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task newTask = new Task();
        newTask.solve(in, out);

        out.close();
    }

    private static class Task {
        //.constant
        private final int INF = Integer.MAX_VALUE;
        private final int MOD = (int)1e9 + 7;

        //.data

        //.code
        public void solve(InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String first = in.next();
            String second = in.next();

            int prev = 1;
            long ans = 6;
            int start = 2;
            if (first.charAt(0) == second.charAt(0)) {
                prev = 0;
                ans = 3;
                start = 1;
            }

            for (int i = start; i < n; ++i) {
                if (first.charAt(i) == second.charAt(i)) {
                    if (prev == 0) {
                        ans = (ans * 2) % MOD;
                    }
                    prev = 0;
                } else {
                    ans = (prev == 0) ? ans * 2 % MOD : ans * 3 % MOD;
                    prev = 1;
                    ++i;
                }
            }

            out.println(ans);

        }//end

    }

}

Measured memory_bytes: 23380
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

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

    ll x = 0;
    for (ll i = 0; i < N; i++) {
        (i % 2 == 1 ? x -= A[i] : x += A[i]);
    }

    x /= 2;

    for (ll i = 0; i < N; i++) {
        cout << 2 * x << " \n"[i == N - 1];
        x = A[i] - x;
    }
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
const int N = 300005;

int dpL[N], dpR[N];
int R[20][N], L[20][N];
int d[N];
int S[20];
int a[N];
int sum[N];
int n,v;
int p;
int id[N];
int main(){
    scanf("%d%d",&n,&v);
    for (int i = 1; i <= n; i++) scanf("%d",&a[i]);
    for (int i = 1; i < n; i++){
        d[i] = a[i+1]-a[i];
        if (d[i] > v) id[i]++;
    }
    for (int i = 1; i < n; i++){
        id[i] += id[i-1];
    }
    /*for (int i = 1; i < n; i++){
        printf("%d ",d[i]);
    }
    printf("\n");
    for (int i = 1; i < n; i++){
        printf("%d ",id[i]);
    }
    printf("\n");*/
    S[0] = v;
    for (int i = 1; i <= 18; i++){
        S[i] = S[i-1]/2;
        if (S[i] == 0) { p= i+1; break;}
    }
    //printf("%d ",p);
    reverse(S,S+p);
    for (int i = 0; i < p; i++){
        //printf("%d ",S[i]);
    }
    for (int i = 0; i < p; i++){
        R[i][n] = n;
        for (int j = n-1; j >= 1; j--){
            R[i][j] = a[j+1]-a[j] <= S[i] ? R[i][j+1] : j;
        }

        L[i][1] = 1;
        for (int j = 2; j <= n; j++ ){
            L[i][j] = a[j]-a[j-1] <= S[i] ? L[i][j-1] : j;
        }
        /*printf("cur step %d = %d:\n",i,S[i]);
        for (int j = 1; j <= n; j++){
            printf("%d ",R[i][j]);
        }
        printf("\n");
        for (int j = 1; j <= n; j++){
            printf("%d ",L[i][j]);
        }
        printf("\n");*/
    }
    int LIM = (1<<(p-1))-1;
    for (int i = 0; i <= LIM; i++){
        dpR[i] = n+1;
        for (int j = 0; j < p; j++){
            if (i>>j&1){
                dpL[i] = max(dpL[i],R[j][dpL[i^(1<<j)]+1]);
                dpR[i] = min(dpR[i],L[j][dpR[i^(1<<j)]-1]);
            }
        }
        //printf("dp of %d : %d %d\n",i,dpL[i],dpR[i]);
    }

    for (int i = 0; i <= LIM; i++){
        int LL = dpL[i];
        int RR = dpR[LIM^i];
        if (RR <= LL+1){
            for (int i = 1; i <= n; i++) printf("Possible\n");
            return 0;
        }
        //printf("mask %d: left (%d) %d, right (%d) %d\n",i,i,LL,LIM^i,RR);
        //printf("ids = %d %d\n",id[LL+1],id[RR-2]);
        if (id[RR-2] == id[LL]) {
            //printf("%d - %d can\n",LL+1,RR-1);
            sum[LL+1]++;
            sum[RR]--;
        }
    }
    for (int i = 1; i <= n; i++){
        sum[i] += sum[i-1];
        //printf("%d ",sum[i]);
        if (sum[i] > 0){
            printf("Possible\n");
        }
        else{
            printf("Impossible\n");
        }
    }

}


Measured memory_bytes: 38644
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int count=0;
		// 文字列の入力
		int first = sc.nextInt();
		if(first==1){
			int ppp = sc.nextInt();
			System.out.println("YES");
			return;
		}
		for(int k=0;k<first;k++){
			int ttt = sc.nextInt();
			//奇数→countに1足す
			if(ttt%2==1){
				count++;
			}
		}
		if(count%2==1){
			System.out.println("NO");
		}else{
		// 出力
		System.out.println("YES");
		}
	}
}


Measured memory_bytes: 30528
#include <bits/stdc++.h>
#define filein(t) freopen(t, "r", stdin)
#define fileout(t) freopen(t, "w", stdout)
#define f first
#define s second
#define cs 137
#define ll long long
#define mp make_pair
#define N 300025
#define ln 1e16
#define oo 111539786
#define Pa pair < int, int >
#define Pi pair < int, Pa >

using namespace std;

Pa a[N];
priority_queue < int > que;
int n;

bool Check(int X)
{
    while(!que.empty())  que.pop();
    ll S = 0;
    for(int i=n; i>n-X; i--)
    {
        que.push(a[i].s);
        S += a[i].s;
    }
    if(S <= (ll)X * a[n-X+1].f)   return true;
    for(int i=n-X; i>=1; i--)
    {
        int Max = que.top();
        if(Max > a[i].s)
        {
            S = S - Max + a[i].s;
            que.pop();
            que.push(a[i].s);
        }
        if(S <= (ll)X * a[i].f) return true;
    }
    return false;
}

int main()
{
//    filein("MICROORGANISM.inp");    fileout("MICROORGANISM.out");
    cin >> n;
    for(int i=1; i<=n; i++)
        cin >> a[i].s >> a[i].f;
    sort(a+1, a+n+1);
    int L = 0;
    int R = n + 1;
    while(R - L > 1)
    {
        int X = (L + R) / 2;
        if(Check(X))    L = X;
        else
            R = X;
    }
    cout << L << endl;
}

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

int main(){
    ll n,k;
    scanf("%lld %lld",&n, &k);

    if(n>k){
        ll ans=n-k;
        ll ans1=ans/k;
        n=n-(ans1*k);
        for(int i=0; i<100000; i++){
            n=min(n,abs(n-k));
        }
    }
    else{
        for(int i=0; i<100000; i++){
            n=min(n,abs(n-k));
        }
    }


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


Measured memory_bytes: 764
n = int(input())
l = list(map(int,input().split()))
ans = 1
mod = 10**9+7
ch = [0]*(n+1)
ch[0] = 3
for i in l:
  ans = ans * ch[i] % mod
  ch[i+1] += 1
  ch[i] -= 1
print(ans)
  

Measured memory_bytes: 14020
package main

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

func main() {
	io, flush := NewIO()
	defer flush()
	n, m := io.ScanInt(), io.ScanInt()
	votes := io.ScanInts(n)
	sort.Sort(sort.Reverse(sort.IntSlice(votes)))
	var totalVote int
	for _, v := range votes {
		totalVote += v
	}
	var count int
	for _, v := range votes {
		if float64(v) < float64(totalVote)/(float64(m)*4) {
			break
		}
		count++
	}
	if count >= m {
		io.Println("Yes")
	} else {
		io.Println("No")
	}
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 10000000), 10000000)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int X;
  cin >> X;
  ll ans = 0;
  ll time = X / 500;
  ans += time * 1000;
  X -= time * 500;
  time = X / 5;
  ans += time * 5;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    int num=n%10;
    if(num==3)
        printf("bon");
    else if(num==0||num==1||num==6||num==8)
        printf("pon");
    else
        printf("hon");
    return 0;
}


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

int main(){
    
    int n;
    
    std::cin >> n;
    
    const int N = n;
    int a[n];
    
    for(int i = 0; i < N; i++){
        std::cin >> a[i];
    }
    
    for(int i =  n-1 ; i >= 0; i--){
        std::cout << a[i];
        if(i == 0)break;
        std::cout << " ";
    }
    
    std::cout << "\n";
    
    return 0;
}


Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <stack>

using namespace std;

using vi = vector<int>;

struct node {
  int v;
  int p;
};


vi color(100000 + 7, -1);
vector<vector<node> > tree(100000 + 7);

void coloring(int vertex, int parity)
{
  stack<node> s;

  node n = { vertex, parity };
  s.push(n);

  while (!s.empty()) {
    node p = s.top();
    s.pop();

    if (color[p.v] != -1) {
      continue;
    }

    color[p.v] = p.p;

    for (node c : tree[p.v]) {
      node hoge = { c.v, (p.p + c.p) % 2 };
      s.push(hoge);
    }
  }
}

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

  for (int i = 0; i < n; i++) {
    int u, v, w;
    cin >> u >> v >> w;

    node nd = { v, w % 2 };
    tree[u].push_back(nd);

    node nd2 = { u, w % 2 };
    tree[v].push_back(nd2);
  }

  coloring(1, 0);

  for (int i = 1; i <= n; i++) {
    cout << color[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 6784
module.exports=function(r){var e={};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var o in r)t.d(n,o,function(e){return r[e]}.bind(null,o));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=0)}([function(r,e,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(r,e){function t(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=[],n=!0,o=!1,u=void 0;try{for(var i,f=r[Symbol.iterator]();!(n=(i=f.next()).done)&&(t.push(i.value),!e||t.length!==e);n=!0);}catch(r){o=!0,u=r}finally{try{n||null==f.return||f.return()}finally{if(o)throw u}}return t}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.exports=function(r){for(var e=r.split("\n"),n=t(e[0].split(" ").map(function(r){return Number(r)}),2),o=n[0],u=n[1],i=[],f=0;f<o;f++){var a=t(e[f+1].split(" ").map(function(r){return Number(r)}),2),l=a[0],c=a[1];i.push({a:l,b:c})}i.sort(function(r,e){return r.a-e.a});for(var p=0,s=u,d=0;d<o;d++){if(!(s>i[d].b)){p+=s*i[d].a,s=0;break}p+=i[d].b*i[d].a,s-=i[d].b}console.log(p)}},function(r,e){r.exports=require("fs")}]);

Measured memory_bytes: 55700