akhauriyash/Code-Regression huggingface dataset:
A=[None]*3
for i in range(3):
  A[i]=list(map(int,input().split()))
N=int(input())
check=[[False]*3 for i in range(3)]

for _ in range(N):
  p=int(input())
  for i in range(3):
    for j in range(3):
      if A[i][j]==p:
        check[i][j]=True
        
for i in range(3):
  ok=True
  for j in range(3):
    if check[i][j]==False:
      ok=False
  if ok:
    print("Yes")
    exit(0)
    
for j in range(3):
  ok=True
  for i in range(3):
    if check[i][j]==False:
      ok=False
  if ok:
    print("Yes")
    exit(0)
    
if check[0][0] and check[1][1] and check[2][2]:
  print("Yes")
  exit(0)
  
if check[2][0] and check[1][1] and check[0][2]:
  print("Yes")
  exit(0)
    
print("No")
    

Measured memory_bytes: 3064
from itertools import combinations_with_replacement

N, M, Q = [int(i) for i in input().split()]

q_list = []
for _ in range(Q):
    a, b, c, d = input().split()
    q_list.append([int(a), int(b), int(c), int(d)])

max_pts = 0
for A in combinations_with_replacement(range(1, M + 1), N):
    pts = 0
    for (a, b, c, d) in q_list:
        if A[b - 1] - A[a - 1] == c:
            pts += d
    max_pts = max(max_pts, pts)

print(max_pts)


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

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

  int h, m, s;
  s = S % 60;
  m = (S / 60) % 60;
  h = S / 3600;
  
  cout << h << ":" << m << ":" << s << endl;
  return 0;
}

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

int main(int argc, const char * argv[]) {
    
    int n;
    std::cin >> n;
    
    std::vector<int> data;
    for(int i = 0;i<n;i++)
    {
        int a;
        std::cin >> a;
        data.push_back(a);
    }
    
    int count = 0;
    for(int i = 0;i<n;i++)
    {
        if(data.at(i) != i+1) count++;
    }
    
    if(count==0 || count==2)
        std::cout << "YES" << std::endl;
    else
        std::cout << "NO" << std::endl;
    
    return 0;
}


Measured memory_bytes: 256
n=int(input())
p=[float(i) for i in input().split()]
dp=[[0 for j in range(n+1)] for i in range(n+1)]
dp[0][0]=1
for i in range(1,n+1):
    for j in range(i+1):
        dp[i][j]=dp[i-1][j-1]*p[i-1]+dp[i-1][j]*(1-p[i-1])
ans=0
for i in range(n//2+1,n+1):
    ans+=dp[n][i]
print(ans)


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

int main(){
    int n;
    cin>>n;
    
    ll res  = 0;
    for(int i = 1; i <= n ; i++){
        if(i%3 == 0 || i%5 == 0) continue;
        res+=i;
    }
    cout<<res;
}


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

using namespace std;

typedef long long  ll;

typedef int Weight;
const Weight INF = 1e8;

struct Edge {
    int src, dst;
    Weight cap, rev;
    Edge(int f, int t, Weight c, Weight r) :
        src(f), dst(t), cap(c), rev(r) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

void AddEdge(Graph &g, int src, int dst, int cap) {
    g[src].push_back(Edge(src, dst, cap, (int)g[dst].size()));
    g[dst].push_back(Edge(dst, src, 0, (int)g[src].size() - 1));
}

Weight Dfs(Graph &g, vector<bool> &used, int v, int t, Weight f) {
    if (v == t)
        return f;
    used[v] = true;
    for (auto &e : g[v]) {
        if (!used[e.dst] && e.cap > 0) {
            int d = Dfs(g, used, e.dst, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                g[e.dst][e.rev].cap += d;

                return d;
            }
        }
    }
    return 0;
}

Weight FordFulkerson(Graph g, int s, int t) {
    const int n = g.size();
    Weight flow = 0;
    while (true) {
        vector<bool> used(n, false);
        Weight f = Dfs(g, used, s, t, INF);
        if (f <= 0)
            break;
        flow += f;
    }
    return flow;
}

void WarshallFloyd(Matrix &dist) {
    int n = dist.size();
    for (int k = 0; k < n; ++k)
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
}

int main()
{
    int N, M, L, A, B, D, P, K;

    while (cin >> N >> M >> L) {
        Matrix dist(N, Array(N, INF));

        for (int i = 0; i < M; ++i) {
            cin >> A >> B >> D;
            dist[A - 1][B - 1] = dist[B - 1][A - 1] = D;
        }
        for (int i = 0; i < N; ++i)
            dist[i][i] = 0;

        WarshallFloyd(dist);

        Graph g(2 * N + 2);
        int s = 2 * N, t = 2 * N + 1;

        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < N; ++j) {
                if (i == j)
                    AddEdge(g, i, i + N, INF);
                else if (dist[i][j] < L)
                    AddEdge(g, i, j + N, INF);
            }
        }

        for (int i = 0; i < N; ++i) {
            cin >> P;
            AddEdge(g, s, i, P);
        }
        for (int i = 0; i < N; ++i) {
            cin >> K;
            AddEdge(g, i + N, t, K);
        }

        cout << FordFulkerson(g, s, t) << endl;
    }

    return 0;
}

Measured memory_bytes: 1876
#include <iostream>
#include <string>
#include <vector>
#include <set>

using namespace std;

vector<int> push_element(int bit, int N)
{
    vector<int> S;
    for (int i = 0; i < N; ++i)
    {
        if (bit & (1 << i))
            S.push_back(i);
    }
    return S;
}

int main(void)
{
    int N, M, X, min = 0, max;
    cin >> N >> M >> X;
    vector<vector<int>> vec(N, vector<int>(M));
    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j <= M; ++j)
            cin >> vec[i][j];
        min += vec[i][0];
    }
    min++;
    max = min;
    for (int i = 0; i < (1 << N); ++i)
    {
        vector<int> states(M + 1, 0);
        vector<int> v = push_element(i, N);
        int flug = 0;
        for (auto j : v)
        {
            for (int k = 0; k < M + 1; ++k)
                states[k] += vec[j][k];
        }
        if (states[0] <= min)
            flug++;
        for (int j = 1; j <= M; ++j)
        {
            if (states[j] >= X)
                flug++;
        }
        if (flug == M + 1)
            min = states[0];
    }
    if (max == min)
    {
        min = -1;
    }
    cout << min;
}


Measured memory_bytes: 3584
h,w=map(int,input().split())
wlist=[list(map(int,input().split()))for _ in range(10)]
for i in range(10):
    for j in range(10):
        for k in range(10):
            wlist[j][k]=min(wlist[j][k],wlist[j][i]+wlist[i][k])
ans=0
for _ in range(h):
    t=list(map(int,input().split()))
    for i in t:
        if i==-1 or i==1:
            continue
        else:
            ans+=wlist[i][1]
print(ans)

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

#define REP(i,n) for(int i = 0;i < n;i++)
#define REPR(i,n) for(int i = n-1;i >= 0;i--)
#define FOR(i,m,n) for(int i = m;i < n;i++)
#define INF 2e9
#define ALL(v) v.begin(),v.end()
#define ll long long
#define GREATER greater<int>()

using namespace std;

string pop_back(string s){
    string t = s.substr(0,s.size()-1);
    return t;
}

int gcd(int max,int min){
    
    if(max<min){
        int tmp=max;
        max=min;
        min=tmp;
    }

    if(max%min==0)return min;
    else return gcd(min,max%min);

}

int main(void){

    int x[2];
    int y[2];
    cin>>x[0]>>y[0]>>x[1]>>y[1];

    int X=x[1]-x[0];
    int Y=y[1]-y[0];

    printf("%d %d %d %d\n",x[1]-Y,y[1]+X,x[0]-Y,y[0]+X);

    return 0;
}




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

int main() {
    int N, M;
    int L[100000], R[100000];
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> L[i] >> R[i];
    }
    sort(L, L + M);
    sort(R, R + M);
    if (0 <= R[0] - L[M - 1]) {
        cout << R[0] -L[M - 1] + 1 << endl;
    }
    else {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <math.h>
#include <string>    // useful for reading and writing
#include <fstream>   // ifstream, ofstream
#include <sstream>   // istringstream

using namespace std;

int main()
{
    int n;
    cin >> n;
    int p[n];
    int min = 1000000, max = -1000000;
    long long sum = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> p[i];
        sum += p[i];
        if(p[i]>=max){max=p[i];}
        if(p[i]<=min){min=p[i];}
    }
    cout << min << " " << max << " " <<sum<< endl;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vi a(n+2);
    rep(i,n) cin>>a[i+1];
    vi sum1(n+2), sum2(n+2);
    rep(i,n+1) sum1[i+1]=sum1[i]+abs(a[i+1]-a[i]);
    RFOR(i,n,0) sum2[i]=sum2[i+1]+abs(a[i+1]-a[i]);
    FOR(i,1,n){
        cout<<sum1[i-1]+sum2[i+1]+abs(a[i-1]-a[i+1])<<endl;
    }
    return 0;
}


Measured memory_bytes: 2432
n = int(input())
a = [int(i) for i in input().split()]
b = [0 for _ in range(n)]
i = n-1
j = 0
while True:
    b[j] = a[i]
    if i-2 < 0:
        j += 1
        break
    j += 1
    i -= 2
if n%2==0:
    i = 0
else:
    i = 1
while i < n:
    b[j] = a[i]
    j += 1
    i += 2
        
print(*b)

Measured memory_bytes: 97748
#include <stdio.h>
int main()
{
  int n;
  while (1){
  scanf("%d",&n);
  if(!n) break;  
  int i;
  int a[10000]={0};
  int b[10000]={0};
  int s1;
  int s2;
  s1=0; s2=0; 
  for(i=0; i<n; i++)
  {
    scanf("%d %d",&a[i],&b[i]);
    if       (a[i] > b[i])  s1 += a[i]+b[i];
    else if(a[i]<b[i])     s2+= a[i]+b[i];
    else               {s1 +=a[i]; s2+=b[i];}
   }
  printf("%d %d\n",s1,s2);
 }
  return 0;
}

Measured memory_bytes: 684
#include<stdio.h>

typedef struct{
  int a;
  int b;
  int p;
  int s;
}P;
P T[25];
int C[25];
int H[25];
void print(int);
void rec(int,int);
int hei(int *,int);
int n;
int main(){
  int i,j,L,R,id,r,h;
  int c[25];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].a=T[i].b=T[i].p=T[i].s=-1;
  }
  for(i=0;i<n;i++){
    c[i]=-1;
  }
  for(i=0;i<n;i++){
    scanf("%d%d%d",&id,&L,&R);
    if(i==0){
      T[id].a=L;
      T[id].b=R;
      T[L].s=R;
      T[R].s=L;
      c[L]=id;
      c[R]=id;
      C[i]=0;
    }else{
      T[id].a=L;
      T[id].b=R;
      if(c[id]!=-1){
	T[id].p=c[id];
      }
      if(c[L]==-1){
	T[L].p=id;
      }
      if(c[R]==-1){
	T[R].p=id;
      }
      T[L].s=R;
      T[R].s=L;
      c[L]=id;
      c[R]=id;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p == -1){
      r = i;
    }
  }
  rec(r,0);
  for(i=0;i<n;i++){
    print(i);
  }
  return 0;
}

void rec(int a,int b){
  C[a] = b;
  if(T[a].a != -1)rec(T[a].a,b+1);
  if(T[a].b != -1)rec(T[a].b,b+1);
}

void print(int a){
  int i,c=0,h;
  
  for(i=0;i<n;i++){
    if(T[i].p==a){
      c++;
    }
  }
  h=hei(H,a);
  
  if(T[a].p == -1){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, root\n",a,T[a].p,T[a].s,c,C[a],H[a]);
  }else if(c == 0){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, leaf\n",a,T[a].p,T[a].s,c,C[a],H[a]);
  }else{
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, internal node\n",a,T[a].p,T[a].s,c,C[a],H[a]);
  }
}

int hei(int *H,int u){
  int h1,h2;
  h1=h2=0;
  if(T[u].b!=-1)h1=hei(H,T[u].b)+1;
  if(T[u].a!=-1)h2=hei(H,T[u].a)+1;
  if(h1<h2)h1=h2;
  return H[u]=h1;
}



Measured memory_bytes: 2144
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>

using namespace std;
using ll = long long;

ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g*b;
}
int main() {
	int n;
	cin >> n;
	ll ans = 1;
	for (int i = 0; i < n; i++) {
		ll t;
		cin >> t;
		ans = lcm(ans, t);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>	tree_set;
typedef long long ll;
typedef long double ld;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}


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

    ll arr[n];
    ll sum=0;
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
        sum+=arr[i];
    }

    sort(arr,arr+n);
    cout<<sum-arr[n-1]/2;
}



Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (int i=0;i<n;i++)
//#include <bits/stdc++.h>
using namespace std;
typedef pair<long int, long int> pl;

bool comp(pl x,pl y){
    if (x.second<y.second) return true;
    else return false;
}

int main(){
    long int N;
    cin>>N;
    vector<long int> X(N), L(N);
    vector<pl> v(N);
    for (int i=0;i<N;i++){
        cin>>X[i]>>L[i];
        v[i].first=X[i]-L[i];
        v[i].second=X[i]+L[i];
    }
    sort(v.begin(),v.end(),comp);
    long int ans=1,rr=v[0].second;
    for (int i=1;i<N;i++){
        if (rr<=v[i].first){
            ans++;
            rr=v[i].second;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3328
#include<stdio.h>
int main()
{
  int x,y,z;

  scanf("%d %d %d",&x,&y,&z);

  if(x <= y && y <= z)
    {
      printf("%d %d %d\n",x,y,z);
    }
  else if(x <= z && z <= y)
    {
      printf("%d %d %d\n",x,z,y);
    }
  else if(y <= x && x <= z)
    {
      printf("%d %d %d\n",y,x,z);
    }
  else if(y <= z && z <= x)
    {
      printf("%d %d %d\n",y,z,x);
    }
  else if (z <= x && x <= y)
    {
      printf("%d %d %d\n",z,x,y);
    }
  else 
    {
      printf("%d %d %d\n",z,y,x);
    }
  return 0;
}

Measured memory_bytes: 1812
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
    int A, B;
    cin >> A >> B;
    if(A + B >= 24) {
        cout << A + B - 24 << endl;
    } else {
        cout << A + B << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> A(n); rep(i, n) cin >> A[i];
  map<ll, int> cnt;
  ll ans = 1;
  cnt[-1] = 3;
  rep(i, n) {
    cnt[A[i]]++;
    (ans *= cnt[A[i]-1]) %= mod;
    cnt[A[i]-1]--;
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 10272
class SegT():
    def __init__(self, size, origin):
        self.size = 1
        while self.size < size: self.size *= 2
        self.data = [set() for _ in range(self.size * 2 - 1)]
        for i in range(size):
            self.data[i+self.size-1] = origin[i]
        for i in range(self.size-2,-1,-1):
            self.data[i] = self.data[i*2+1] | self.data[i*2+2]

    
    def update(self, i, x):
        i += (self.size - 1)
        self.data[i] = {x}
        while i > 0:
            i = (i - 1) // 2
            self.data[i] = self.data[i*2+1] | self.data[i*2+2]
        
    def get(self, a, b, node=0, l=0, r=-1):
        if r < 0: r = self.size
        if r <= a or b <= l: return set()
        if a <= l and r <= b: return self.data[node]
        vl = self.get(a, b, node*2+1, l, (l+r)//2)
        vr = self.get(a, b, node*2+2, (l+r)//2, r)
        return vl | vr

N = int(input())
S = input()
Q = int(input())
origin = [{i} for i in S]

segt = SegT(N, origin)

for i in range(Q):
    t, l, r = input().split()
    if t == "1":
        segt.update(int(l)-1, r)
    else:
        x = segt.get(int(l)-1,int(r))
        print(len(x))


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

int main() {
  int n,k;
  cin>>n>>k;
  vector<int>d(k);
  for(int i=0;i<k;i++) cin>>d[i];
  vector<bool>c(10);
  for(int i=0;i<10;i++){
    for(int j=0;j<k;j++){
      if(i==d[j]) {
        c[i]=false;
        break;
      }
      else if(j==k-1) c[i]=true;
    }
  }
  while(1){
    string s=to_string(n);
    bool x=false;
    for(int i=0;i<s.size();i++){
      int p=s[i]-'0';
      if(c[p]){
        if(i==s.size()-1) x=true;
      }
      else break;
    }
    if(x) break;
    else n++;
  }
  cout<<n<<endl;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
stock =0
money = 1000
for i in range(n-1):
    if A[i]<A[i+1]:
        stock += money//A[i]
        money -= (money//A[i])*A[i]
        #買う
    elif A[i]>A[i+1]:
        money += stock*A[i]
        stock =0
        #うる
    else:
        continue
if stock >0:
    money += stock*A[-1]
print(money)


Measured memory_bytes: 61756
# -*- coding: utf-8 -*-


def main():
    a, b, k = map(int, input().split())

    if k - a < 0:
        print(a - k, b)
    else:
        if (k - a) - b < 0:
            print(0, b - (k - a))
        else:
            print(0, 0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
N = int(input())
n = 55555
primes = set(range(3, n+1, 2))|set([2])
for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*3, n+1, i*2))
primes=list(primes)
a = []
for i in primes:
  if i%10==1:
    a.append(i)
    if len(a)==N:
      break
print(*a)

Measured memory_bytes: 6892
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll side[3] = {0LL};
	rep (i, 3) cin >> side[i];
	sort(side, side + 3);
	if (side[0] % 2 == 0 || side[1] % 2 == 0 || side[2] % 2 == 0){
		cout << 0 << endl;
	}else{
		ll a = side[0];
		ll b = side[1];
		ll c = side[2];
		cout << a * b << endl;
	} // end if

	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

const INF = int64(100000000000)

func main() {
	var h, w int64
	fmt.Scanf("%d %d", &h, &w)
	ans := min(case1(h, w), min(case1(w, h), min(case2(h, w), case2(w, h))))
	fmt.Println(ans)
}

func case1(a, b int64) int64 {
	small := (a / 3) * b
	big := (a - (2 * a / 3)) * b
	return big - small
}

func case2(a, b int64) int64 {
	ans := INF
	for i := int64(1); i < a; i++ {
		num1 := i * b
		num2 := (a - i) * (b / 2)
		num3 := (a - i) * (b - (b / 2))
		maxNum := max(num1, max(num2, num3))
		minNum := min(num1, min(num2, num3))
		if minNum == 0 {
			continue
		}
		diff := maxNum - minNum
		if ans > diff {
			ans = diff
		}
	}
	return ans
}

func max(a, b int64) int64 {
	return int64(math.Max(float64(a), float64(b)))
}
func min(a, b int64) int64 {
	return int64(math.Min(float64(a), float64(b)))
}


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

int main()
{
    ll k,a,b;
    cin>>k>>a>>b;

    if( b - a <= 2)
    {
        cout<<1+k;
    } else
    {
        if( k <= a)
        {
            cout<<1+k;
        } else
        {
            ll ans = a;
            k = k - a + 1;
            ll temp = k/2;
            ans += temp*(b-a);
            if( k%2)
                ans++;
            cout<<ans;
        }
    }

}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

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

/*（๑•﹏•๑｀) */

int main() {
    int X, Y, Z, K;
    SCD2(X,Y);
    SCD2(Z,K);
    vector<ll> A, B, C;
    REP(i, X) {
        ll x;
        SCLLD(x);
        A.PB(x);
    }

    REP(i, Y) {
        ll x;
        SCLLD(x);
        B.PB(x);
    }

    REP(i, Z) {
        ll x;
        SCLLD(x);
        C.PB(x);
    }

    sort(ALL(A));
    reverse(ALL(A));
    sort(ALL(B));
    reverse(ALL(B));
    sort(ALL(C));
    reverse(ALL(C));

    int index = 0;
    vector<ll> ans;


    vector<ll> AB;
    REP(i, X) {
        REP(j, Y) {
            AB.PB(A[i] + B[j]);
        }
    }

    sort(ALL(AB));
    reverse(ALL(AB));

    vector<ll> ABC;

    REP(i, min(K, X * Y)) {
        REP(j, min(Z,K)){
            ABC.PB(AB[i] + C[j]);
        }
    }

    sort(ALL(ABC));
    reverse(ALL(ABC));

    REP(i, K) {
        PRINTLLD(ABC[i]);
    }

}


Measured memory_bytes: 43256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
//combination(Nが小さい時はこれを使う
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

// 二項係数計算
long long COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight(int n) {
	int ans = 1;
	while (n >= 10) {
		n /= 10;
		ans++;
	}
	return ans;
}
int dight_sum(int n) {
	int sum = 0;
	rep(i, 20)sum += (n % (int)pow(10, i + 1)) / (pow(10, i));
	return sum;
}
int dight_min(int n) {
	int ans = 9;
	while (n >= 10) {
		ans = min(ans, n % 10);
		n /= 10;
	}
	ans = min(ans, n);
	return ans;
}
int dight_max(int n) {
	int ans = 0;
	while (n >= 10) {
		ans = max(ans, n % 10);
		n /= 10;
	}
	ans = max(ans, n);
	return ans;
}
signed main() {
	int a, b;
	cin >> a >> b;
	cout << a * b << endl;
	ggr
}


Measured memory_bytes: 3628
N = int(input())
A = [int(i) for i in input().split()]
for i in range(N):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(" ".join(map(str, A)))


Measured memory_bytes: 5604
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

int matrix_size;
int matrix[32][32];

void rotate(int r,int c,int size,int angle){
  int tmp[32][32];

  for(int y=r;y<r+size;y++){
    for(int x=c;x<c+size;x++){
      tmp[y-r][x-c] = matrix[y][x];
    }
  }
  
  int next[32][32];
  while(angle > 0){
    int y=0;
    int x=0;
    for(int dx=size-1;dx>=0;dx--){
      for(int dy=0;dy<size;dy++){
	next[dy][dx] = tmp[y][x];
	x++;
	if(x >= size){
	  y++;
	  x=0;
	}
      }
    }
    memcpy(tmp,next,sizeof(int)*32*32);
    for(int y=r;y<r+size;y++){
      for(int x=c;x<c+size;x++){
	matrix[y][x] = next[y-r][x-c];
      }
    }
    angle -= 90;
  }
}

void reversal(int r,int c,int size){
  for(int y=r;y<r+size;y++){
    for(int x=c;x<c+size;x++){
      matrix[y][x] = (matrix[y][x] ? 0 : 1);
    }
  }
}

void left_shift(int r){
  int tmp[32];
  for(int i=matrix_size - 1;i-1>=0;i--){
    tmp[i-1] = matrix[r][i];
  }
  tmp[matrix_size - 1] = matrix[r][0];
  for(int i=0;i<matrix_size;i++){
    matrix[r][i] = tmp[i];
  }
}

void right_shift(int r){
  int tmp[32];
  for(int i=0;i+1<matrix_size;i++){
    tmp[i+1] = matrix[r][i];
  }
  tmp[0] = matrix[r][matrix_size - 1];
  for(int i=0;i<matrix_size;i++){
    matrix[r][i] = tmp[i];
  }
}

void dfs(int base,int r,int c){
  matrix[r][c] = (base ? 0 : 1);
  for(int i=0;i<4;i++){
    int dr = r + ty[i];
    int dc = c + tx[i];
    if(dr < 0 || dc < 0
       || dr >= matrix_size || dc >= matrix_size) continue;
    if(matrix[dr][dc] == base){
      dfs(base,dr,dc);
    }
  }
}

void island_reversal(int r,int c){
  int base = matrix[r][c];

  dfs(base,r,c);
}

int main(){
  int total_operations;
  while(~scanf("%d %d",&matrix_size,&total_operations)){
    for(int y=0;y<matrix_size;y++){
      for(int x=0;x<matrix_size;x++){
	scanf("%d",&matrix[y][x]);
      }
    }
    for(int operation_idx = 0; operation_idx < total_operations; operation_idx++){
      int type;
      scanf("%d",&type);
      int r,c,angle,size;
      switch(type){
      case 0:
	scanf("%d %d %d %d",&r,&c,&size,&angle);
	rotate(r-1,c-1,size,angle);
	break;
      case 1:
	scanf("%d %d %d",&r,&c,&size);
	reversal(r-1,c-1,size);
	break;
      case 2:
	scanf("%d",&r);
	left_shift(r-1);
	break;
      case 3:
	scanf("%d",&r);
	right_shift(r-1);
	break;
      case 4:
	scanf("%d %d",&r,&c);
	island_reversal(r-1,c-1);
	break;
      default:
	break;
      }
    }

    for(int y=0;y<matrix_size;y++){
      for(int x=0;x<matrix_size;x++){
	printf("%s%d",x == 0 ? "" : " ",matrix[y][x]);
      }
      printf("\n");
    }
  }
}

Measured memory_bytes: 1204
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <stack>

using namespace std;

#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

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

ll MOD = 1000000007;
const ll INF = (1ll<<60);
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

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

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

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(int arr[], int n) {
    int result = arr[0];
    for (int i = 1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
int main() {
    string S; cin >> S;
    int ans=0;

    for(int i=0; i<S.size(); i++){
        if(i< (S.size()+1)/2){
            if(S[i]=='p')
                ans--;
        }else{
            if(S[i]=='g'){
                ans++;
            }
        }
    }

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

Measured memory_bytes: 888
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

void solve();

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

void solve(){
    ll n;cin>>n;
    vl a(n);rep(i,n)cin>>a[i];

    ll g=a[0];
    rep(i,1,n)g=__gcd(g,a[i]);
    cout<<g<<endl;
}

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

using namespace std;

//int N,M,K,L,R,H,W;
long long int N,M,K,L,R,H,W;

constexpr long long int MOD=1000000007;
//constexpr  int MOD=1000000007;
//constexpr int MOD=998244353;
//constexpr long long int MOD=998244353;

constexpr long double EPS=1e-8;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N;
	string s;
	cin>>s;
	auto t=s;
	while(t.size()!=s.size()/2)t.pop_back();
	t+=t;
	if(t==s)cout<<"Yes\n";
	else cout<<"No\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<vector>
#include<cstring>
#include<sstream>
#include<algorithm>
//#include<bits/stdc++.h>
//#include <bitset>
#include<cstdio>
using namespace std;

long long val[200001];
int dp[200001];
int mod = 0;

long long power(long long x, int t) {
    if (mod == 0) return 0;

    if (t == 0) return 1ll;
    else if (t == 1) return x;

    long long p = power(x, t/2)%mod;
    p *= p;
    p %= mod;

    if (t%2 == 0) return p;
    else return (p*x)%mod;
}

int f(int x) {
    if (x == 0) return 1;
    else if (dp[x] != -1) return dp[x];

    int cnt = 0;
    int tmp = x;

    while (tmp) {
        if (tmp&1) cnt ++;
        tmp >>= 1;
    }

    return (dp[x] = 1+f(x%cnt));
}

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

    int n;
    cin >> n;
    string x;
    cin >> x;

    for (int i = 0; i < n; i++) {
        if (x[i] == '1') mod ++;
    }

    long long tmp2 = 0, tmp3 = 0;
    for (int i = n-1; i >= 0; i--) {
        if (x[i] == '1') {
            mod --;
            tmp2 += power(2, n-i-1);
            mod ++;
            mod ++;
            tmp3 += power(2, n-i-1);
            mod --;
        }

        if (mod > 1) tmp2 %= (mod-1);
        tmp3 %= (mod+1);
    }

    for (int i = n-1; i >= 0; i--) {
        if (x[i] == '0') {
            mod ++;
            val[i] = (tmp3+power(2, n-i-1))%mod;
            mod --;
        } else if (mod == 1 && x[i] == '1') {
            val[i] = 0;
        } else {
            mod --;
            long long tmp = power(2, n-i-1)*-1;
            while (tmp < 0) tmp += mod;

            val[i] = (tmp2+tmp)%mod;
            mod ++;
        }
    }

    memset(dp, -1, sizeof dp);

    for (int i = 0; i < n; i++) {
        if (x[i] == '1' && mod == 1) cout << 0 << endl;
        else cout << f(val[i]) << endl;
    }

    return 0;
}



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

int cnt = 0;

void SelectionSort(int S[], int N){
	for(int i = 0; i < N; i++){
		int minj = i;
		for(int j = i; j < N; j++){
			if( S[j] < S[minj]){
				minj = j;
			}
		}
		if(i != minj){
			int tmp = S[i];
			S[i] = S[minj];
			S[minj] = tmp;
			cnt++;
		}
	}
}

int main(){
	int n;
	cin >> n;
	int s[n];
	for(int i = 0; i < n; i++){
		cin >> s[i];
	}
	SelectionSort(s,n);
	for(int i = 0; i < n-1; i++){
		cout << s[i] << ' ';
	}
	cout <<s[n-1]<< endl << cnt << endl;
	return 0;
}


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

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

Measured memory_bytes: 256
A,B = map(int,input().split())
if A == 1 or B == 1:
    if A==1 and B==1:
        print("Draw")
    elif A==1:
        print("Alice")
    else:
        print("Bob")
else:
    if A>B:
        print("Alice")
    elif B>A:
        print("Bob")
    else:
        print("Draw")

Measured memory_bytes: 3060
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0

using namespace std;
using ll = long long;

void testcase() {
    int a, b, c; cin >> a >> b >> c;
    cout << c << " " << a << " " << b;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"

int main()
{
    ll a, b, x = 0;

    cin >> a >> b >> x;
    ll ct = 0;

    if (a == 0)
    {
        ct = b / x + 1;
    }
    else
    {
        ct = (b / x) - ((a - 1) / x);
    }

    COUT(ct);

    return 0;
}

Measured memory_bytes: 256
def main():
	a,b = map(int,input().split())
	import math
	ans = 0
	i = 2
	while i <= 1250:
		if math.floor(i * 0.08) == a and  math.floor(i *0.1) == b:
			print(i)
			ans = 1
			break
		else:
			i += 1
	if ans == 0:
		print(-1)

if __name__ == '__main__':
	main()

Measured memory_bytes: 39024
n, m = map(int,input().split())

boolins =[]
for i in range(n):
    boolins.append(0)
    
for i in range(m):
    xxx = list(map(int,input().split()))
    if xxx[0] == 1:
        boolins[xxx[1]] = boolins[xxx[1]] + 1
    elif xxx[1] == n :
        boolins[xxx[0]]=boolins[xxx[0]]+ 1
    else:
        None


if 2 in boolins:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 4656
INF=float('inf')
from collections import deque
def mbfs(G,sh,sw,H,W):
    dist=[[INF]*W for i in range(H)]
    dist[sh][sw]=0
    d=deque()
    d.append([sh,sw])
    dx=[1,0,-1,0]
    dy=[0,1,0,-1]
    while(len(d)!=0):
        h=d[0][0]
        w=d[0][1]
        d.popleft()
        for dir in range(4):
            for k in range(1,K+1):
                nh=h+dx[dir]*k
                nw=w+dy[dir]*k
                if(nh>H-1 or nh<0 or nw>W-1 or nw<0):
                    break
                if(G[nh][nw]=='@'):
                    break
                if(dist[nh][nw]<=dist[h][w]):
                    break
                if dist[nh][nw]==dist[h][w]+1:
                    continue
                else:
                    dist[nh][nw]=dist[h][w]+1
                    d.append([nh,nw])
    return dist
H,W,K=map(int,input().split())
sx,sy,gx,gy=map(lambda x:int(x)-1,input().split())
c=[list(input()) for i in range(H)]
dist=mbfs(c,sx,sy,H,W)
ans=dist[gx][gy]
print(ans if ans!=INF else -1)

Measured memory_bytes: 177468
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys


def main():
    n = int(input())
    arrx = list(map(int,input().split()))
    m = input()
    arra = list(map(int,input().split()))
    for i in arra:
        if(i == n ):
            if(arrx[i-1] < 2019):
                arrx[i-1] += 1
        else:
            if(arrx[i-1] + 1 < arrx[i] and arrx[i-1] < 2019):
                arrx[i-1] += 1
    for i in arrx:
        print(i)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5620
#include<stdio.h>

class dice{
    private:
        int curface;
        int faces[6] = {};
    
    public: int GetCurface(){return curface;}
    public: int GetFace(int n){return faces[n-1];}
    public: int GetRight(){return GetFace(3);}
    public: int GetLeft(){return GetFace(4);}
    public: int GetFront(){return GetFace(2);}
    public: int GetBack(){return GetFace(5);}
    
    dice(){
        for(int i = 0;i < 6;i++) scanf("%d",&faces[i]);
        curface = faces[0];
    }
    
    public: bool Move(char toward){
        switch(toward){
            case 'N':
                faces[0] = faces[1];
                faces[1] = faces[5];
                faces[5] = faces[4];
                faces[4] = curface;
                break;
            case 'E':
                faces[0] = faces[3];
                faces[3] = faces[5];
                faces[5] = faces[2];
                faces[2] = curface;
                break;
            case 'S':
                faces[0] = faces[4];
                faces[4] = faces[5];
                faces[5] = faces[1];
                faces[1] = curface;
                break;
            case 'W':
                faces[0] = faces[2];
                faces[2] = faces[5];
                faces[5] = faces[3];
                faces[3] = curface;
                break;
        }
        curface = faces[0];
        return 1;
    }
    public: bool Rotate(){
        this -> Move('W');this -> Move('S');this -> Move('E');
        return 1;
    }
    
    public: bool isEqual(dice *d){
        char orders[25] = "NNNNWNNNWNNNENNNENNNWNNN";
        for(int j = 0;j < 25;j++){
            this -> Move(orders[j]);
            for(int i = 1;i <= 6;i++){
                if(this -> GetFace(i) != d -> GetFace(i)){
                    break;
                }
                if(i == 6){
                    return true;
                }
            }
        }
        return false;
    }
};


int main(){
    int n;
    scanf("%d",&n);
    dice d[n];
    for(int i = 1;i < n;i++){
        if(d[0].isEqual(&d[i])){
            printf("No\n");
            break;
        }
        if(i == n-1){
            printf("Yes\n");
        }
    }
  
}






Measured memory_bytes: 2692
#include <iostream>
using namespace std;
int main(){

  int H,W;

  while(1){

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

    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	if(i==0 || j==0 || i==H-1 || j==W-1){
	  cout <<"#";
	}
	else{
	  cout <<".";
	}
      }
      cout <<endl;
    }
    cout <<"\n";
	}
   
  return 0;
}
 

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll N;
  cin>>N;
  vector<ll> A(N);
  vector<vector<ll>> a(N,vector<ll>(N));
  for(ll i=0;i<N;i++){
    for(ll j=0;j<N;j++){
      a.at(i).at(j)=-1;
    }
  }
  for(ll i=0;i<N;i++){
    cin>>A.at(i);
    for(ll j=0;j<A.at(i);j++){
      ll m,n;
      cin>>m>>n;
      a.at(i).at(m-1)=n;
    }
  }
  ll ans=0;
  for(ll bit=1;bit<(ll)(1<<N);bit++){
    ll count=0;
    bool tf=true;
    for(ll i=0;i<N;i++){
      if((1<<i)&bit){
        count++;
        for(ll j=0;j<N;j++){
          if(a.at(i).at(j)!=-1){
            if(((bit>>j)&1)^a.at(i).at(j)){tf=false;}
          }
        }
      }
    }
    if(tf){ans=max(ans,count);}
  }
  cout<<ans<<endl;
}

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

signed main(void)
{
	string s;
	cin >> s;
	cout << s.substr(0, 4) << " " << s.substr(4, 12) << endl;
	return 0;
}


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

typedef long long ll;


int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL);
	
	// WR -> 재앙
	int n; cin >> n;
	string s; cin >> s;
	int x = 0, y = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R') {
			x += 1;
		}
		else y += 1;
	}
	int ans = min(x, y);
	int cnt = 0;
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == 'R') {
			cnt += 1;
		}
		y -= 1;
		if (y == 0)break;
	}
	ans = min(ans, cnt);
	cout << ans << '\n';
}

Measured memory_bytes: 3420
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

// conversion
//------------------------------------------
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }

// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c)                                                             \
  for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                                               \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"                       \
       << " " << __FILE__ << endl;

const string NO = "IMPOSSIBLE";

void solve(long long A, long long B) {
  if((A+B)%2==0){
    cout << (A+B)/2<<endl;
  }
  else cout<<"IMPOSSIBLE"<<endl;
}

int main() {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(A, B);
  return 0;
}


Measured memory_bytes: 256