akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<utility>
#include<array>
#include<set>
#define EPS (1e-7)
using namespace std;






int main() {

	int N, L,ne=0,e=0;
	int ans=500;
	int preans = 500, ta;

	cin >> N >> L;


	for (auto i = 0; i < N; i++)
	{
		ne += L + (i + 1) -1;
	}

	for (auto i	= 0; i < N; i++)
	{
		e = ne - (L + (i + 1) - 1);
		ans = min(ans, abs(e - ne));
		if (preans == 500)ta = e;
		if (ans != preans) { ta = e; }
		preans = ans;
	}



	cout << ta << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f;
	a=0;
	b=-1;
	c=0;
	while(a+b!=0){
		c=0;
		scanf("%d%d",&a,&b);
		for(d=0;d<a;d++){
			for(f=0;f<b;f++){
				if(c%2==0){
					printf("#");
				}else{
					printf(".");
				}
				c++;
			}
			if(b%2==0){
				c++;
			}
			printf("\n");
		}
		if(a+b>0){
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 572
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using base = complex<double>;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define M 1000000007
#define M2 998244353
#define ll long long
#define pll pair<long, long>
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define ff first
#define ss second
#define pb push_back
#define db pop_back
#define mp make_pair
#define mt make_tuple
#define g(a, b) get<a>(b)
#define INF (ll)1e18 + 100
#define vl vector<ll>
#define vi vector<int>
#define vll vector<pair<ll, ll>>
#define vii vector<pair<int, int>>
#define all(v) v.begin(), v.end()
#define bset(a, p) ((a) | (1ll << (p)))
#define bchk(a, p) ((a) & (1ll << (p)))
#define bxor(a, p) ((a) ^ (1ll << (p)));
#define brem(a, p) (bchk(a, p) ? (bxor(a, p)) : (a))
#define INT_SIZE 32
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
ll powM(ll x, ll y, ll m)
{
    ll ans = 1, r = 1;
    x %= m;
    while (r > 0 && r <= y)
    {
        if (r & y)
        {
            ans *= x;
            ans %= m;
        }
        r <<= 1;
        x *= x;
        x %= m;
    }
    return ans;
}
ll modI(ll a, ll m)
{
    ll m0 = m, y = 0, x = 1;
    if (m == 1)
        return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m;
        a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
        x += m0;
    return x;
}

ll logint(ll x, ll y)
{
    ll ans = 0;
    ll a = 1;
    for (ll i = 0; i <= x; i++)
    {
        if (x < a)
        {
            return ans;
        }
        ans++;
        a *= y;
    }
    return -1;
}
ll extended(ll a, ll b, ll &x, ll &y)
{
    if (a == 0)
    {
        x = 0;
        y = 1;
        return b;
    }
    ll x1, y1;
    ll d = extended(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

void solve() {
    ll a;
    cin>>a;
    cout<<a+(a*a)+(a*a*a);

}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // freopen("b1.in", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ll ntc;
    // cin >> ntc;
    ntc = 1;
    REP(tc, 1, ntc + 1)
    {
        // cout << "Case #" << tc << ": ";
        solve();
    }
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<vector>
#include<set>
#include<bitset>
#include<queue>
#include<deque>
using namespace std;

#define ll long long
#define pi pair<int,int>
#define x first
#define y second

#define in ({ll x=0;int o=0,c=getchar();for(;!isdigit(c);c=getchar()) o=c=='-';for(;isdigit(c);c=getchar()) x=x*10+c-'0';o?-x:x;})
#define inchar ({char c=getchar();while(c==' '||c=='\n') c=getchar();c;})
#define instring ({string s;char c=getchar();for(;c==' '||c=='\n';c=getchar());for(;c!=' '&&c!='\n';c=getchar()) s+=c;s;})

#define FOR(i,a,b) for(int i=a,_=b;i<=_;i++)
#define ROF(i,a,b) for(int i=b,_=a;_<=i;i--)
#define RR(x,a,b) FOR(__,a,b) cout<<x[__]<<" \n"[__==b];
#define rr(x) " "<<#x<<'='<<x<<" "

#define bitnum(x) __builtin_popcountll(x)
#define bitl(x) (64-__builtin_clzll(x))
#define bit(x,i) ((x>>(i-1))&1ll)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1ll<<(i-1)))
#define pw2(x) (1ll<<x)

#define VEC(i,a) for(auto&i:a)
#define pb push_back
#define vall(a) a.begin(),a.end()
#define fiv(a) (int)a.size()-1

#define false(x) if(!(x))
#define middle(a,b) (a+(b-(a))/2)
#define Min(a,b) ({bool o=0;auto b2=b;if(a>b2) a=b2,o=1;o;})
#define Max(a,b) ({bool o=0;auto b2=b;if(a<b2) a=b2,o=1;o;})
////////////////////////////////////////// HUX
const int N=1e5+5;
int n,m;
int d[N],x,y;
vector<int> e[N],q[2];
void DFS(int x,int o)
{
    d[x]=1;q[o].pb(x);
    VEC(i,e[x]) false(d[i]) {DFS(i,o);break;}
}
main()
{
   // freopen("hx.inp","r",stdin);
    // freopen("hx.out","w",stdout);
    n=in,m=in;
    FOR(i,1,m)
    {
        x=in,y=in;

        e[x].pb(y);
        e[y].pb(x);
    }
    d[y]=1;DFS(x,0);
    d[y]=0;DFS(y,1);
    cout<<q[1].size()+q[0].size()<<"\n";
    ROF(i,0,fiv(q[0])) cout<<q[0][i]<<" ";
    VEC(i,q[1]) cout<<i<<" ";
}


Measured memory_bytes: 9720
#include <iostream>

using namespace std;

int main()
{
  int A, B;

  cin >> A >> B;
  if( (A > B) && (B!=1) ) {
    cout << "Alice";
  }
  else if( (B > A) && (A!=1) ) {
    cout << "Bob";
  }
  else if(A==1 && B > 1) {
    cout<< "Alice";
  }
  else if(B==1 && A > 1) {
    cout<<"Bob";
  }
  else if(A=B) {
    cout << "Draw";
  }
    return 0;
}


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

int main() {
    int x;
    cin >> x;
    for (int a = -118; a <= 119; ++a) {
        for (int b = -119; b <= 118; ++b) {
            if (a*a*a*a*a - b*b*b*b*b == x) {
                printf("%d %d", a, b);
                return 0;
            }
        }
    }
    return 0;
}

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

#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;


int main()
{
    string s;
    cin >> s;
    if (s == "Sunny") cout << "Cloudy" << endl;
    else if (s == "Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct pt { int u,v,k; };
pt b[201];
int x,i,n,vt,m,tt;
vector <int> vec;
int main()
{
    //freopen("ntu.inp","r",stdin);
    //freopen("ntu.out","w",stdout);
    cin>>x; 
    for(i=0;i<=20;i++)
        if((x>>i)&1) vec.push_back(i);
    n=vec.back()+1;
    for(i=1;i<n;i++)
    {
        b[++m]={ i,i+1,(1<<(i-1)) };
        b[++m]={ i,i+1,0 };
    }
    tt=(1<<(n-1));
    for(i=(int)vec.size()-2;i>=0;i--)
    {
        vt=vec[i]+1;
        b[++m]={ vt,n,tt };
        tt|=(1<<(vt-1));
    }
   // b[++m]={ 1,n,tt };
    cout<<n<<" "<<m<<'\n';
    for(i=1;i<=m;i++) cout<<b[i].u<<" "<<b[i].v<<" "<<b[i].k<<'\n';
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] a = sc.next().split("");
        String[] b = sc.next().split("");
        Arrays.sort(a);
        Arrays.sort(b, Comparator.reverseOrder());
        String one = "";
        String two = "";
        for (String tmp : a) {
            one += tmp;
        }
        for (String tmp : b) {
            two += tmp;
        }
        if (one.compareTo(two) < 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23764
// atcoder/abc131/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    vector<pair<int, int>> v(n);
    cin >> v;
    sort(v.begin(), v.end(), [] (auto i, auto j) {
      if (i.second != j.second) return i.second < j.second;
      return i.first < j.first;
    });
    // cout << v << endl;

    bool f = true;
    lli curr = 0;
    each (i, v) {
      if (i.second < curr + i.first) f = false;
      curr += i.first;
    }
    cout << (f ? "Yes" : "No") << endl;
  }

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

int main() {
    ll n;
    ll i = 0;
    while (cin >> n) {
        i++;
      if (n != 0) {
        cout << "Case" << ' ' << i << ": " << n << endl;
      }
    }
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

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

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 505;

int n, m, a, b;
int c[N][N];

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> n >> m >> a >> b;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			c[i][j] = 500;
		}
	}
	for (int i = a - 1; i < n; i += a) {
		for (int j = b - 1; j < m; j += b) {
			c[i][j] = -1 * ((a * b - 1) * 500 + 1);
		}
	}
	int sum = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			sum += c[i][j];
		}
	}
	if (sum <= 0) {
		cout << "No\n";
		return 0;
	}
	cout << "Yes\n";
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cout << c[i][j] << " \n"[j == m - 1];
		}
	}
	return 0;
}


Measured memory_bytes: 2304
from collections import Counter
n, m = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(m)]

class UnionFind:
    # まずは最初の状態を作る
    def __init__(self, N):
        # 最初はみんなバラバラ
        self.parent = [i for i in range(N)]
        self.rank = [0] * N
        self.count = 0

    # そのノードの根を返す過程で,集合の要素を根に直接つなぎかえる(木の最適化)
    def root(self, a):
        if self.parent[a] == a:
            return a
        else:
            self.parent[a] = self.root(self.parent[a])
            return self.parent[a]

    # aとbの根が同じ,つまり同じ連結成分内かどうかを返す
    def is_same(self, a, b):
        return self.root(a) == self.root(b)

    # 連結成分同士を効率的に(rankが大きい方を動かさずにrankが小さい方をくっつける)
    def unite(self, a, b):
        ra = self.root(a)
        rb = self.root(b)
        # a, bが同じグループ内にいたから何もしない
        if ra == rb: return
        # 異なるグループにいた場合
        # 短い方をくっつける
        if self.rank[ra] < self.rank[rb]:
            self.parent[ra] = rb
        else:
            self.parent[rb] = ra
            if self.rank[ra] == self.rank[rb]: self.rank[ra] += 1
        self.count += 1

# friendsは友達の数を保持する
uf = UnionFind(n)
for a, b in ab:
    a, b = a-1, b-1
    # aとbが同連結成分内であれば何もする必要がない
    if uf.is_same(a, b): continue
    # 異なれば結合
    uf.unite(a, b)
# 木の高さの最適化
for i in range(n):
    uf.root(i)
tmp = sorted(Counter(uf.parent).items(), key=lambda x:x[1])
print(tmp[-1][1])

Measured memory_bytes: 121508
package main

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

func main() {
	n := readInt()

	ans := 0
	for i := 1; i < n+1; i++ {
		if i%3 == 0 {
			continue
		}
		if i%5 == 0 {
			continue
		}
		ans += i
	}

	fmt.Println(ans)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


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

using namespace std;

int main(void) {
  int N; cin >> N;
  int a[N];
  int min = 0x7fffffff;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }

  
  for (int i = -100; i <= 100; i++) {
    int sum = 0;
    for (int j = 0; j < N; j++) {
      sum += (i - a[j]) * (i - a[j]);
    }
    if (sum < min) {
      min = sum;
    }
  }

  cout << min << endl;
  return 0;
}

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

public class ProCon
{
    public static void Main(){     
        string number =　Console.ReadLine();
        int k = int.Parse(number);
        int sum = 0;
        for(int a = 1; a <= k; a++)
        {
            for(int b = 1; b <= k; b++)
            {
                for(int c = 1; c <= k; c++)
                {
                    sum = sum + Gcd(Gcd(a,b),c);
                }
            }
        }
        Console.WriteLine(sum);
    }

    public static int Gcd(int a, int b) 
    {
        if (a < b) return Gcd(b, a);
        while (b != 0) 
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }
}

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

int main() {
  int D;
  cin>>D;
  vector<int> sage(26);
  for(int i=0;i<26;i++){
    cin>>sage.at(i);
  }
  vector<vector<int>> man(D,vector<int>(26));
  for(int i=0;i<D;i++){
    for(int j=0;j<26;j++){
      cin>>man.at(i).at(j);
    }
  }
  vector<int> hini(D);
  vector<vector<int>> rkai(D+1,vector<int>(26,1));
  for(int i=0;i<D;i++){
    int A=0,W=man.at(i).at(0)-2*rkai.at(i).at(0)*sage.at(0);
    for(int j=1;j<26;j++){
      int Y=man.at(i).at(j)-2*rkai.at(i).at(j)*sage.at(j);
      if(Y>W){
        W=Y,A=j;
      }
      rkai.at(i+1).at(j)=rkai.at(i).at(j)+1;
    }
    hini.at(i)=A;
    rkai.at(i).at(A)=0;
    rkai.at(i+1).at(A)=1;
  }
  /*for(int i=0;i<D;i++){
    Z+=man.at(i).at(hini.at(i));
    for(int j=0;j<26;j++){
      Z-=rkai.at(i).at(j)*sage.at(j);
    }
    cout<<Z<<endl;
  }*/
  int a=167,b=167;
  for(int i=0;i<1000000;i++){
    a=i%D;
      b=i%26;
      int Z=0;
    if(rkai.at(a).at(b)==0){
      continue;
    }
    int K=rkai.at(a).at(b),C=0;
    for(int j=a;j<D;j++){
      if(rkai.at(j).at(b)==0){
        break;
      }
      else{
        C++;
      }
    }
    Z+=K*C*sage.at(b);
    Z+=man.at(a).at(b);
    int e=hini.at(a);
    C=0;
      int G;
    if(a==0){
      G=1;
    }
    else{
      G=rkai.at(a-1).at(e)+1;
    }
    for(int j=a;j<D;j++){
      if(rkai.at(j).at(e)==0&&j!=a){
        break;
      }
      else{
        C++;
      }
    }
    Z-=G*C*sage.at(e);
    Z-=man.at(a).at(e);
      if(Z>0){
        for(int j=a;j<D;j++){
      if(rkai.at(j).at(b)==0){
        break;
      }
      else{
        rkai.at(j).at(b)-=K;
      }
    }
        for(int j=a;j<D;j++){
      if(rkai.at(j).at(e)==0&&j!=a){
        break;
      }
      else{
        rkai.at(j).at(e)+=G;
      }
    }
        hini.at(a)=b;
      }
    }
  
    
  for(int i=0;i<D;i++){
    cout<<hini.at(i)+1<<endl;
  }
}

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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<int, int> ii;
#define int long long
const int N = 1e5 + 5;

int n, a[N], mul = 1;

const int mod = 998244353;

signed main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    sort(a + 1, a + 1 + n);
    for(int i = 0; i < n; i++)
        mul = (1ll * mul * __gcd(i, a[i + 1])) % mod;
    cout << mul;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

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

  int N, x; cin >> N >> x;
  vec a(N); rep(i,N) cin >> a[i];
  sort(ALL(a));

  int res = 0, i = 0;
  while(x >= a[i]) {    // まだあげられる
    x-=a[i];
    res++;
    i++;
    if(i==N-1) break;   // 最後だけ別処理
  }
  if(x==a[N-1])res++;

  cout << res <<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const double PI = acos(-1);  

int main(void){
    string s;   cin >> s;
    int n= s.size();
    vector<ll> sum(n, 1);
    
    int cnt=1;
    for(int i=0; i<n-1; i++){
        if(s[i]=='R' && s[i]==s[i+1]){
            sum[i+2] += sum[i];
            sum[i] = 0;
        }
    }
    //for(auto x: sum) cout << x << endl;
    for(int i=n-1; 0<i; i--){
        if(s[i]=='L' && s[i]==s[i-1]) {
            sum[i-2] += sum[i];
            sum[i] = 0;
        }
    }
    for(auto x: sum) cout << x << ' ';

}

Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ccs
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split(' ');
            UInt64 x = UInt64.Parse(ss[0]);
            UInt64 y = UInt64.Parse(ss[1]);

            var count = 0;
            for (UInt64 i = x; i <= y; i *= 2)
                count += 1;

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cstring>
#define rep(i,n) for(int i=0;i<(n);i++)
#define UP 0
#define RIGHT 1
#define DOWN 2
#define LIFT 3

using namespace std;

bool p[100][100];

void dfs (int len, int dir, int r, int c, int cnt )
{
	if (len <= 1 )
		return;

	dir = (dir + 1) % 4;
	if (cnt != 0 && cnt % 2 == 0 ){
		len -= 2;
	} // end if 

	int cr = r, cc = c;
	switch (dir ){
		case UP:
			for (int i = 0; i < len; i++, cr-- )
				p[cr][cc] = true;
			cr++;
			break;
		case DOWN:
			for (int i = 0; i < len; i++, cr++ )
				p[cr][cc] = true;
			cr--;
			break;	
		case RIGHT:
			for (int j = 0; j < len; j++, cc++ )
				p[cr][cc] = true;
			cc--;
			break;
		case LIFT:
			for (int j = 0; j < len; j++, cc-- )
				p[cr][cc] = true;
			cc++;
			break;
	} // end switch

	if (len == 2 )
		return;

	dfs (len, dir, cr, cc, cnt + 1 );
}

void disp_p (int m )
{
	rep (i, m ){
		rep (j, m ){
			if (p[i][j] )
				cout << '#';
			else
				cout << ' ';
		}// end rep
		cout << endl;
	} // end rep
}

int main()
{
	int n;

	while (cin >> n && n ){
		for (int i = 0; i < n; i++ ){
			int m;
			cin >> m;
			if (m == 1 ){
				cout << "#" << endl;
			}else if (m == 2 ){
				cout << "##" << endl;
				cout << "# " << endl;
			}else{
				memset (p, false, sizeof (p ) );
				for (int r = m - 1; r >= 0; r-- )
					p[r][0] = true;
				for (int c = 0; c < m; c++ )
					p[0][c] = true;
				for (int r = 0; r < m; r++ )
					p[r][m-1] = true;
				dfs (m-2, DOWN, m-1, m-1, 0 );
				disp_p (m );
			} // end if
			if (i != n - 1 ){
				cout << endl;
			} // end if
		} // end if
	} // end whlie

	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>

using namespace std;

int main(void)
{
    int n;
    string s;
    cin >>n;
    cin >>s;

    vector<int> esum(n+1, 0);
    vector<int> wsum(n+1, 0);

    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'W'){
            wsum[i+1] = wsum[i] + 1;
        }else{
            wsum[i+1] = wsum[i];
        }

        if(s[s.size()-1-i] == 'E'){
            esum[s.size()-1-i] = esum[s.size()-i] + 1;
        }else{
            esum[s.size()-1-i] = esum[s.size()-i];
        }
    }
    int ans = INT_MAX;
    for(int i = 0; i < esum.size(); i++){
        ans = min(ans, esum[i]+wsum[i]);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 2948
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,a,b) for(i=a;i<=b;i++)
using namespace std;
const int N=500010,maxn=500000;
const int mod=998244353;
int inv[N],cj[N];int ans;

int power(int x,int y){
	int ret=1;
	for(;y;y>>=1,x=1ll*x*x%mod){
		if(y&1)	ret=1ll*ret*x%mod;
	}
	return ret;
}

void init(){
	int i;
	cj[0]=1;rep(i,1,maxn)	cj[i]=1ll*cj[i-1]*i%mod;
	inv[maxn]=power(cj[maxn],mod-2);inv[0]=1;
	for(i=maxn-1;i;i--)	inv[i]=1ll*inv[i+1]*(i+1)%mod;
}

int C(int n,int m){
	//printf("%d %d\n",n,m);
	if(m<0||n<m)	return 0;
	return 1ll*cj[n]*inv[m]%mod*inv[n-m]%mod;
}

int main(){
//	freopen("a.in","r",stdin);
//	freopen("a.out","w",stdout);
	int i,n,m;
	init();
	scanf("%d%d",&n,&m);
	rep(i,0,min(m/2-(m+1&1),m-n)){
		ans=(1ll*ans+C(m,i)-C(m,i-(m-i-n+1)))%mod;
		//if(2*i==m)	ans=(1ll*ans-(C(m-1,i-(m-i-n))-C(m-1,i-(m-i-n+1))))%mod;
		//printf("%d\n",ans);
	}
	i=m/2;
	if(2*i==m&&i<=m-n)	ans=(1ll*ans+C(m-1,i-1)-C(m-1,i-1-(m-i-n+1)))%mod;
	ans=(ans%mod+mod)%mod;
	printf("%d",ans);
}
	

Measured memory_bytes: 4096
a,b = map(int, input().split())
if (b - 2 * a) % 2 == 0 and (4 * a - b) % 2 == 0 and (b - 2 * a) / 2 >= 0 and (4 * a - b) / 2 >= 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61832
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl;
typedef double D;
typedef complex<D> P;
typedef pair<P,P> L;
D eps=1e-9,pi=3.14159265358979,inf=1e100;
P rot(int rad){
	double rd=(double)rad*pi/180;
	return P(cos(rd),sin(rd));
}
D dot(P a,P b){
	return real(conj(a)*b);
}
D cro(P a,P b){
	return imag(conj(a)*b);
}
int ccw(P a,P b,P c){
	if(cro(b-a,c-a)>eps) return 1;
	if(cro(b-a,c-a)<-eps) return -1;
	if(abs(abs(a-c)+abs(c-b)-abs(a-b))<eps) return 0;
	if(abs(abs(a-b)+abs(c-b)-abs(a-c))<eps) return -2;
	if(abs(abs(a-c)+abs(a-b)-abs(c-b))<eps) return 2;
}
P perp(L l,P p){
	D t=dot(p-l.fs,l.fs-l.sc)/norm(l.fs-l.sc);
	return l.fs+t*(l.fs-l.sc);
}
bool iSS(L a,L b){
	return ccw(a.fs,a.sc,b.fs)*ccw(a.fs,a.sc,b.sc)<=0 && ccw(b.fs,b.sc,a.fs)*ccw(b.fs,b.sc,a.sc)<=0;
}
bool iSP(L s,P p){
	return ccw(s.fs,s.sc,p)==0;
}
D dSP(L s,P p){
	P q=perp(s,p);
	return iSP(s,q) ? abs(p-q) : min(abs(p-s.fs),abs(p-s.sc));
}
D dSS(L a,L b){
	if(iSS(a,b)) return 0;
	return min(min(dSP(a,b.fs),dSP(a,b.sc)),min(dSP(b,a.fs),dSP(b,a.sc)));
}
vector<L> lines[100];
D d[100][100];
int main(){
	while(true){
		int n,m,l;
		cin>>n>>m>>l;
		if(n==0) break;
		rep(i,n){
			int x,y,a,r;
			cin>>x>>y>>a>>r;
			P p=P(0,r),o=P(x,y);
			P v=p*rot(a),nv;
			lines[i].clear();
			rep(j,5){
				nv=v*rot(144);
				lines[i].pb(L(o+v,o+nv));
				v=nv;
			}
		}
		rep(i,n) rep(j,n) if(i!=j){
			d[i][j]=inf;
			rep(k,5) rep(h,5) d[i][j]=min(d[i][j],dSS(lines[i][k],lines[j][h]));
		}
		rep(i,n) rep(j,n) rep(k,n) d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
		printf("%.9f\n",d[m-1][l-1]);
	}
}

Measured memory_bytes: 1336
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define cerr if(1)cerr
#define size(x) (int)x.size()
#define all(x) x.begin(), x.end()

const int N = 1e6 + 1, mod = 1e9 + 7, inf = 2e9;

int n, a[N], cnto[N], cnte[N];

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		if (i & 1) {
			cnto[a[i]]++;
		} else {
			cnte[a[i]]++;
		}
	}
	vector<pair<int, int>> odd, even;
	for (int i = 1e5; i >= 1; i--) {
		odd.push_back({cnto[i], i});
		even.push_back({cnte[i], i});
	}
	sort(all(odd));
	sort(all(even));
	int ans = inf;
	int so = size(odd), se = size(even);
	for (int i = 1; i <= 2; i++) {
		for (int j = 1; j <= 2; j++) {
			if (odd[so - i].second != even[se - j].second) {
				ans = min(ans, n - odd[so - i].first - even[se - j].first);
			}
		}
	}
	cout << ans;
}


Measured memory_bytes: 10612
#include<bits/stdc++.h>
using namespace std;
int main()
{
      int n,m,i;
      scanf("%d%d",&n,&m);
      for(i=m-(n-1);i<m+(n-1);i++){
             printf("%d ",i);
      }
      printf("%d",i);
      return 0;
}


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

int main()
{
	int H,W;
	cin>>H>>W;
	vector<vector<int>> score(H,vector<int>(W));
	rep(h,H)rep(w,W)cin>>score[h][w];
	rep(h,H)rep(w,W){
		int tmp;
		cin>>tmp;
		score[h][w]=abs(score[h][w]-tmp);
	}

	vector<vector<bitset<6400>>> way(H,vector<bitset<6400>>(W));
	way[0][0][score[0][0]]=true;
	rep(h,H)rep(w,W){
		const int tscore=score[h][w];
		vector<int> cands;
		if(h){
			rep(i,6400)if(way[h-1][w][i]){
				cands.push_back(i+tscore);
				cands.push_back(abs(i-tscore));
			}
		}	
		if(w){
			rep(i,6400)if(way[h][w-1][i]){
				cands.push_back(i+tscore);
				cands.push_back(abs(i-tscore));
			}
		}	
		for(auto cand:cands){
			if(cand<6400){
				way[h][w][cand]=true;
			}
		}
	}
	rep(i,6400){
		if(way[H-1][W-1][i]){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 5584
def getIntList():
    return list(map(int, input().split()))    
 
N, K = getIntList()
 
res = 0
c1 =0
c2 =0
if K %2 ==0:
    t = K//2
else:
    t= -1
 
if True:
    for i in range(1,N+1):
        if i%K == t:
            c1+=1
        if i%K ==0:
            c2+=1
res =  c1 **3 + c2** 3
print(res)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int  main(){
    int n,H,W;
    cin>>n>>H>>W;
    int cnt=0;
    for(int i=0;  i<n; i++){
        int a,b;
        cin>>a>>b;
        if(a>=H&&b>=W)cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<long double,long double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<61;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;

int main(){
	cin>>n;
	int res=inf;
	for(int i=0;i<n;i++){
		int A,t=0;
		cin>>A;
		while(A%2==0){
			A/=2;
			t++;
		}
		res=min(res,t);
	}
	cout<<res<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> as(n);
  for(Int i=0;i<n;i++) cin>>as[i];
  sort(as.begin(),as.end());

  if(as[0]>0){
    Int sum=-as[0];
    for(Int i=1;i<n;i++) sum+=as[i];
    cout<<sum<<endl;
    Int t=as[0];
    for(Int i=1;i+1<n;i++){
      cout<<t<<" "<<as[i]<<endl;
      t-=as[i];
    }
    cout<<as[n-1]<<" "<<t<<endl;
    t=as[n-1]-t;
    assert(t==sum);
    return 0;
  }

  if(as[n-1]<0){
    Int sum=as[n-1];
    for(Int i=0;i+1<n;i++) sum-=as[i];
    cout<<sum<<endl;
    Int t=as[n-1];
    for(Int i=0;i+1<n;i++){
      cout<<t<<" "<<as[i]<<endl;
      t-=as[i];
    }
    assert(t==sum);
    return 0;
  }

  Int sum=0;
  for(Int i=0;i<n;i++) sum+=abs(as[i]);
  cout<<sum<<endl;

  Int p=as[n-1],q=as[0];
  for(Int i=1;i+1<n;i++){
    if(as[i]<=0){
      cout<<p<<" "<<as[i]<<endl;
      p-=as[i];
    }else{
      cout<<q<<" "<<as[i]<<endl;
      q-=as[i];
    }
  }
  cout<<p<<" "<<q<<endl;
  p-=q;
  assert(p==sum);
  return 0;
}


Measured memory_bytes: 2688
N,M,X=map(int,input().split())
cost=[0]*N
A=[]
for i in range(N):
    CA=list(map(int,input().split()))
    cost[i]=CA[0]
    A.append(CA[1:])

ans=float("inf")
for i in range(2**N):
    a=[0]*M
    checked=[0]*M
    money=0
    cnt=0
    for j in range(N):
        if i%2==1:
            for k in range(M):
                a[k]+=A[j][k]
                if a[k]>=X and checked[k]==0:
                    cnt+=1
                    checked[k]+=1
            money+=cost[j]
        i//=2
    if cnt==M:
        ans=min(ans,money)

if ans==float("inf"):
    print("-1")
else:
    print(ans)

Measured memory_bytes: 9232
N, M = map(int, input().split())
H = list(map(int,input().split()))

tmp = [1]*N

for m in range(M):
    a, b = map(int, input().split())

    if H[a-1] > H[b-1]:
        tmp[b-1] = 0
    elif H[a-1] < H[b-1]:
        tmp[a-1] = 0
    else:
        tmp[a-1] = 0
        tmp[b-1] = 0

print(sum(tmp))


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  ll a, b;
  cin >> a >> b;
  if(a <= 8 && b <= 8)
    cout << "Yay!" << endl;
  else
    cout << ":(" << endl;

  return 0;
}

Measured memory_bytes: 384
import math

N = input()
a = list(map(int, input().split()))

#リストから重複を取り除く
def f7(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

d = 0

a_unique = {}

for i in range(0,len(a)):
    if a[i] in a_unique:
        a_unique[a[i]] += 1
    else:
        a_unique[a[i]] = 1

for ai in a_unique.keys():
    if a_unique[ai] >= ai:
        d += a_unique[ai] - ai
    else:
        d += a_unique[ai]

print(d)
        
    

Measured memory_bytes: 17908
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {

    long long int n;
    cin >> n;

    vector< pair< long long int, long long int > > v;

    for ( long long int i = 0; i < n; i++ ) {
        long long int in;
        cin >> in;
        v.push_back( make_pair( in, i+1 ) );
    }

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

    for ( long long int i = 0; i < n; i++ ) {
        if ( i > 0 ) cout << " ";
        cout << v[i].second;
    }
    cout << endl;

    return 0;

}


Measured memory_bytes: 2544
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int[] h = new int[n];
		int cnt = 0;
		int sum = 1;
		for (int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}
		for (int i = 1; i < n; i++) {
			for (int j = 0; j < i; j++) {
				if (h[i] >= h[j]) {
					cnt++;
				}
			}
			if (cnt == i) {
				sum++;
			}
			cnt = 0;
		}
		System.out.println(sum);
		sc.close();
	}
}

Measured memory_bytes: 22996
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ld INF = (ld)10000000000000;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

int main() {
	int a, b; cin >> a >> b;
	int h, w; cin >> h >> w;
	cout << (a - h)*(b -w) << endl;
	//stop
	return 0;
}

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

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define REP2(i,n) for(int i=0;i<(int)(n);i++)
#define REP3(i,m,n) for(int i=m;i<(int)(n);i++)
#define REP4(i,m,n,s) for(int i=m;(s>0 and i<(int)(n)) or (s<0 and i>(int)(n));i+=s)
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REPIT(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define PIS(x) printf("%d ",x)
#define PN() putchar('\n')
#define MP make_pair
#define PB push_back
#define EB emplace_back

typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ULL;

void RI() {}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
void print() {putchar('\n');}
template<typename T, typename... U>
void print(T head, U... tail) {
    cout << head << " ";
    print(tail...);
}

const int MOD = 1000000007;
#define MAX_N 100005


int main()
{
    int n, k, d;
    RI(n, k);
    RI(d);
    int M = d;
    REP(i, 1, n) {
        int a;
        RI(a);
        d = __gcd(a, d);
        M = max(M, a);
    }
    if(k <= M and k % d == 0) {
        printf("POSSIBLE\n");
    } else {
        printf("IMPOSSIBLE\n");
    }

    return 0;
}


Measured memory_bytes: 764
from bisect import bisect, bisect_left
from collections import Counter
from functools import reduce
from itertools import accumulate
from operator import itemgetter, xor, mul

import sys
#input = sys.stdin.readline

def inpl(): return list(map(int, input().split()))
A, B, C, D, E, F = inpl()
waters = [100*A*a + 100*B*b for a in range(30//A + 1) for b in range((30-A*a)//B + 1)]
sugars = [C*c + D*d for c in range(3000//C + 1) for d in range((3000-C*c)//D + 1)]

waters = sorted(set(waters))[1:]
sugars = sorted(set(sugars))


def check(m):
    if m > E:
        return False, None, None
    for water in waters:
        sugar_ix = bisect_left(sugars, m*water/(100-m))
        if (sugar_ix == len(sugars)):
            continue
        sugar = sugars[sugar_ix]
        if sugar + water <= F and sugar <= water*E//100:
            return True, sugar, water
    else:
        return False, None, None

OK = 0
NG = E + 1

for _ in range(1000):
    mid = (OK+NG)/2
    if check(mid)[0]:
        OK = mid
    else:
        NG = mid

_, sugar, water = check(OK)
print(sugar+water, sugar)


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

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

using namespace std;

int main()
{
	int n;

	cin >> n;

	int ans;
	if ( n % 2 == 0 )
	{
		ans = n;
	}
	else
	{
		ans = n * 2;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
S = int(input())
p = 10 ** 9
if S > p:
    r = S % p
    r = 0 if r == 0 else p - r 
    print(p, 1, r, (S + r) // p,  0, 0)
else:
    print(1, 0, 0, S, 0, 0)

    print()

Measured memory_bytes: 3060
//FIRST THINK THEN CODE.

  #include <bits/stdc++.h>


  using namespace std;

  typedef long long ll;

  #define rep(i,a,b) for(ll i=a;i<b;++i)
  #define rrep(i,a,b) for(ll i=a;i>b;--i)
  #define FOR(i,n)  for(ll i=0;i<n;i++)
  #define vi vector<int>
  #define vl vector<ll>
  #define ld long double
  #define vld vector<ld>
  #define vvi vector<vector<int>>
  #define vvl vector<vector<long long>>
  #define vvld vector<vector<ld>>
  #define pii pair<int,int>
  #define pll pair<long,long>
  #define vpii vector<pii>
  #define vpll vector<pll>
  #define ff first
  #define ss second
  #define pb push_back
  #define pf push_front
  #define mp make_pair
  #define lb lower_bound
  #define ub upper_bound
  #define bs binary_search
  #define d1(x) cout<<(x)<<endl
  #define d2(x,y) cout<<(x)<<" "<<(y)<<endl
  #define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
  #define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
  #define PI 3.1415926535897932384626433832795
  #define fix(f,n) fixed<<setprecision(n)<<f
  #define all(x) x.begin(),x.end()
  #define rev(p) reverse(p.begin(),p.end());
  #define endl "\n"
  #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  #define popcount(x) __builtin_popcountll(x)
  #define sz(x) ((ll)x.size())
  const ll M=1000000007;
  const ll MM=998244353;
  ll begtime = clock();
  #define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
  //#define _Find_next 
  //#define _Find_first 



  ll newmod(ll a,ll b)
  {
  return ((a%b)+b)%b;
  }


  ll powM(ll a,ll b,ll m )
  { 
  if(a<=0)return 0;
  a%=m;
  if(!b)return 1;
  ll ans=1LL;
  while(b)
  {
  if(b&1)ans=ans*a%m;
  a=a*a%m;
  b>>=1;
  }

  return ans;
  }



  ll poww(ll a,ll b)
  { 

  ll ans=1;
  while(b)
  {
  if(b&1)ans=ans*a;
  a=a*a;
  b>>=1;
  }

  return ans;

  }

  template<typename T,typename F>
  void chmax( T &a,F b){
  if(b>a)a=b;
  }

  template<typename T,typename F>
  void chmin( T &a,F b){
  if(b<a)a=b;
  }

string tostring(ll x){
  stringstream sss;
  sss<<x;
  string ans=sss.str();
  return ans;
}


  const ll N=1e6+5;


  int main()
  { 

    IOS;


ll n;cin>>n;
vl a(n+1);
for(ll i=1;i<=n;i++){
  ll x;cin>>x;
  a[i]=x+a[i-1];
  a[i]%=M;
}

ll s=0;

for(ll i=1;i<n;i++){
  ll x=(a[i]-a[i-1]+M)%M;
  ll y=(a[n]-a[i]+M)%M;
  s=(s+x*y%M)%M;
}

s=(s+M)%M;

cout<<s;

//end_routine();

  return 0;

  }

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;


int main(){

    string s;
    cin>>s;
    int cnt[2]={};
    rep(i,3){
        cnt[s[i]-'A']++;
    }
    string ans="Yes";
    rep(i,2)if(!cnt[i])ans="No";

    cout<<ans<<endl;

    return 0;

}
/*


*/


Measured memory_bytes: 256
//Walk on Multiplication Table

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<int,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    ll n,ans=INF;cin>>n;
    rep(i,1,sqrt(n)+1){
        if(n%i==0){
            ans=min(ans,n/i+i);
        }
    }
    cout<<ans-2<<nnn;
    return 0;
}

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

int main() {
  int n, m, x, value;
  int counter_less;
  int counter_more;

  counter_less = 0;
  counter_more = 0;

  cin >> n >> m >> x;


  for(int i = 0; i < m; i++){
    cin >> value;

    if (value < x) {
      counter_less++;
    }

    if (value > x){
      counter_more++;
    }

  }

  if (counter_less < counter_more)
    cout << counter_less << endl;

  else
    cout << counter_more << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string a,b,c;
    cin>>n>>a>>b>>c;
    //cout<<min(a,b)<<" "<<max(0,a+b-n)<<endl;
    int cnt=0;
    for (int i=0;i<n;++i) {
        if (a[i]==b[i]&&b[i]==c[i]) continue;
        if (a[i]==b[i]||a[i]==c[i]||b[i]==c[i]) {
            ++cnt;
            continue;
        }
        ++cnt;
        ++cnt;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=0
for i in range(n):
  if a[i]>=b[i]:
    cnt+=b[i]
    a[i]-=b[i]
    b[i]=0
  elif a[i]<b[i]:
    cnt+=a[i]
    b[i]-=a[i]
    a[i]=0
    temp=b[i]
    cnt+=min(b[i], a[i+1])
    b[i]=max(b[i]-a[i+1], 0)
    a[i+1]=max(a[i+1]-temp, 0)
print(cnt)

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

int main(){
	int a,b;
	cin>>a>>b;
	if((a<0 && 0<b) || a==0 || b==0){
		cout<<"Zero"<<endl;
	}
	else{
		if(a>0){
			cout<<"Positive"<<endl;
		}
		else{
			int c=b-a+1;
			if(c%2){
				cout<<"Negative"<<endl;
			}
			else{
				cout<<"Positive"<<endl;
			}

		}

	
	}
	return 0;
}


Measured memory_bytes: 256
import collections as col

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

def gcd(a,b): return gcd(b,a%b) if a%b else b

a,b = map(int,input().split())
primes = prime(gcd(a,b))
cnt = col.Counter(primes)
ans = len(cnt) + 1
print(ans)
        


Measured memory_bytes: 38688
#include<stdio.h>
int main(void)
{
  char s[2];
  scanf("%s",s);
  switch(s[0]){
    case 'A':puts("T");return 0;
    case 'T':puts("A");return 0;
    case 'C':puts("G");return 0;
    case 'G':puts("C");return 0;
  }
}


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

typedef long long ll;
const ll INF = 1e18;

// Greatest Common Divisor
ll gcd(ll a, ll b)
{
  while (b != 0) {
    a = a % b;
    std::swap(a, b);
  }
  return a;
}

int main(int argc, char* argv[])
{
  std::string N;
  std::cin >> N;

  std::cout << "ABC" << N << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
n,x = map(int,input().split())
a = list(map(int,input().split()))

res = 0
if a[0]>x:
    res += a[0] - x
    a[0] = x
if a[-1]>x:
    res += a[-1] - x
    a[-1] = x
for i in range(n-1):
    if a[i]+a[i+1]>x:
        res += a[i] + a[i+1] - x
        a[i+1] -= a[i] + a[i+1] - x
print(res)


Measured memory_bytes: 14252