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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

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

ll dp[100100][13];
const ll MOD = 1e9+7;

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

    string S;
    cin >> S;
    dp[0][0] = 1;
    for(int i = 1; i < 13; i++){
      dp[0][i] = 0;
    }

    reverse(S.begin(), S.end());
    ll base_mod = 1;
    for(int i = 0; i < S.length(); i++){
      if(S[i] == '?'){
        for(int j = 0; j < 10; j++){
          ll tmp_mod = (base_mod * j) % 13;
          for(int k = 0; k < 13; k++){
            dp[i+1][(k+tmp_mod)%13] =  (dp[i+1][(k+tmp_mod)%13] + dp[i][k])%MOD;
          }
        }
      }else{
        ll char_val = int(S[i]-'0');
        ll tmp_mod = (base_mod * char_val) % 13;
        for(int k = 0; k < 13; k++){
          dp[i+1][(k+tmp_mod)%13] = (dp[i+1][(k+tmp_mod)%13] + dp[i][k])%MOD;
        }
      }
      base_mod = (base_mod * 10) % 13;
    }

    cout << dp[S.length()][5] << endl;


    return 0;
}



Measured memory_bytes: 10704
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
'''
l = []
for a in range(1,int(input())+1):
    for b in range(1, int(input())+1):
        for c in range(1,int(input())+1):
            l.append(gcd(a,b,c))
'''
N = input() 
N = int(N)+1
l = (gcd(a,b,c) for a in range(1,N) for b in range(1,N) for c in range(1,N))
print(sum(l))

Measured memory_bytes: 69608
// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

typedef long long LL;
typedef pair<int, int> Pii;

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

const int MAXN = 305;

int N, M;
int A[MAXN][MAXN];

void input()
{
    read(N); read(M);
    for (int i = 1; i <= N; ++i) {
        for (int j = 1; j <= M; ++j) {
            read(A[i][j]);
        }
    }
}

void solve()
{
    static bool flag[MAXN];
    int ans = +oo;

    std::fill(flag + 1, flag + M + 1, true);
    for (int k = 1; k <= M; ++k) {
        static int cnt[MAXN];
        std::fill(cnt + 1, cnt + M + 1, 0);
        for (int i = 1; i <= N; ++i) {
            for (int j = 1; j <= M; ++j) {
                if (flag[A[i][j]]) {
                    ++cnt[A[i][j]];
                    break;
                }
            }
        }
        int t = std::max_element(cnt + 1, cnt + M + 1) - cnt;
        chkmin(ans, cnt[t]);
        flag[t] = false;
    }

    printf("%d\n", ans);
}

int main()
{
#ifdef __DEBUG
    freopen("B.in", "r", stdin);
    freopen("B.out", "w", stdout);
#endif

    input();
    solve();
}

// 轮台九月风夜吼，一川碎石大如斗，随风满地石乱走。
//     -- 岑参《走马川行奉送出师西征 / 走马川行奉送封大夫出师西征》


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,bef,a,ans=0;
	cin>>n>>bef;
	while(cin>>a){
		if(a==bef){
			ans++;
			bef=1e9;
		}
		else
			bef=a;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define M 100005
#define NL -1

typedef struct Node {
  int p;
  int l;
  int r;
}N;

N T[M];
int D[M],H[M];


int sH(int u){
  int h1=0,h2=0;
  if(T[u].l!=NL)h1=sH(T[u].l)+1;
  if(T[u].r!=NL)h2=sH(T[u].r)+1;
  return H[u]=(h1>h2?h1:h2);
}


void sD(int u,int p){
  if(u==NL)return;
  D[u]=p;
  sD(T[u].r,p+1);
  sD(T[u].l,p+1);
}

int gS(int u){
  if(T[u].p==NL)return NL;
  if(T[T[u].p].l!=u&&T[T[u].p].l!=NL)
    return T[T[u].p].l;
 if(T[T[u].p].r!=u&&T[T[u].p].r!=NL)
    return T[T[u].p].r;
  return NL;
}




int main(){
  int i,j,n,v,l,r,root=0,deg=0;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    T[i].p=NL;

  for(i=0;i<n;i++){
scanf("%d%d%d",&v,&l,&r);

    T[v].l=l;
    T[v].r=r;
    if(l!=NL)T[l].p=v;
    if(r!=NL)T[r].p=v;

  }
  for(i=0;i<n;i++)
    if(T[i].p==NL)root=i;

  sD(root,0);
  sH(root);

  for(i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, ",i,T[i].p,gS(i));
if(T[i].l!=NL)deg++;
    if(T[i].r!=NL)deg++;

    printf("degree = %d, depth = %d, height = %d, ",deg,D[i],H[i]);

    if(T[i].p==NL)printf("root");
    else if(T[i].l==NL&&T[i].r==NL)printf("leaf");
    else printf("internal node");

    printf("\n");
    deg=0;

  }
  return 0;
}



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

int main(){
  ll a,b,n;
  cin>>a>>b>>n;
  if(b-1<=n){
    ll ans = (a*b-a)/b;
    cout << ans << endl;
    return 0;
  }
  ll ans = a*n/b-a*(n/b);
  cout << ans << endl;
}

Measured memory_bytes: 3592
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;
constexpr int dy[4] = { 0,1,0,-1 }; constexpr int dx[4] = { 1,0,-1,0 };

template<typename T = int, class F = std::plus<T>, class F_INV = std::minus<T>, const T E = 0>
struct BinaryIndexedTree {
    const F op = F(); const F_INV op_inv = F_INV();
    int n; vector<T> dat;
    template<class U = vector<T>> void build(U&& v) {
        n = v.size(); dat.assign(n, E); for (int i = 0; i < n; ++i) add(i, v[i]);
    }
    void add(int k, T v) { for (int i = k; i < n; i |= i + 1) dat[i] = op(dat[i], v); }
    void update(int k, T v) { add(k, op_inv(v, query(k, k + 1))); }
    T query(int a, int b) {
        if (a == b) return E;
        T ret = E; for (int i = b - 1; i >= 0; i = (i & (i + 1)) - 1) ret = op(ret, dat[i]);
        return op_inv(ret, query(0, a));
    }
};

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    vector<ll> Asum(N), Asumsort;
    Asum[0] = A[0];
    rep(i, 1, N) Asum[i] = Asum[i - 1] + A[i];
    rep(i, N) Asum[i] -= (ll)K * (i + 1);
    Asumsort = Asum;
    sort(all(Asumsort));

    BinaryIndexedTree<int> bit;
    bit.build(vector<int>(N, 1));

    ll ans = 0;
    ll sum = 0;
    rep(i, N) {
        int k = lower_bound(all(Asumsort), sum) - Asumsort.begin();
        ans += bit.query(k, N);
        int l = lower_bound(all(Asumsort), Asum[i]) - Asumsort.begin();
        bit.add(l, -1);
        sum += A[i] - K;
    }

    write(ans);
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int ans[11][330],n,a,c;
bool b[10];
void dfs(int d,int x){
  if(d==n)ans[n][x]++;
  else{
    r(i,10)if(!b[i]){
      b[i]=1;
      dfs(d+1,x+(d+1)*i);
      b[i]=0;
    }
  }
}
main(){
  r(i,10)n=i+1,dfs(0,0);
  while(cin>>a>>c)
    if(c<331)cout<<ans[a][c]<<endl;
    else cout<<0<<endl;
}

Measured memory_bytes: 3004
#include<stdio.h>
#include<string.h>
int main(void){
  char s[1000],t[1000];
  scanf("%s",s);
  scanf("%s",t);
  int i,p,j,min,ns,nt,n;
  ns=strlen(s);
  nt=strlen(t);
  n=ns-nt;
  int count[1000];
  for(i=0;i<n+1;i++){
    count[i]=0;
    for(j=i,p=0;j<i+nt;j++,p++){
      if(s[j]!=t[p])count[i]++;
    }
  }
  for(i=1,min=count[0];i<n+1;i++){
    if(min>count[i])min=count[i];
  }
  printf("%d",min);
  return 0;
}

Measured memory_bytes: 1736
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        s: chars,
        t: chars
    }
    let n = s.len();
    let m = t.len();
    if n < m {
        println!("UNRESTORABLE");
        return;
    }
    'outer: for i in (0..n - m + 1).rev() {
        for j in 0..m {
            if s[i + j] != '?' && s[i + j] != t[j] {
                continue 'outer;
            }
        }
        for j in 0..i {
            print!("{}", if s[j] == '?' {'a'} else {s[j]});
        }
        print!("{}", t.iter().cloned().collect::<String>());
        for j in i + m..n {
            print!("{}", if s[j] == '?' {'a'} else {s[j]});
        }
        println!("");
        return;
    }
    println!("UNRESTORABLE");
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<stack>
using namespace std;
int main() {
	int R;	cin >> R;
	if (R < 1200) {
		cout << "ABC" << endl;
		cin >> R;
		return 0;
	}
	if (1200 <= R && R < 2800) {
		cout << "ARC" << endl;
		cin >> R;
		return 0;
	}
	cout << "AGC" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k;
  int a,b;
  cin>>k;
  cin>>a>>b;
  int flag=0;
  for(int i=a;i<=b;i++)
      {
			if(i%k==0)
            {
              flag=1;
              break;
            }
      }
      if(flag==1) cout<<"OK";
  		else cout<<"NG";
  return 0;
}

Measured memory_bytes: 3576
import itertools
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    num=0
    lst=[i for i in range(1,n+1)]
    com_lst=list(itertools.combinations(lst,3))
    for i in com_lst:
        if i[0]+i[1]+i[2]==x:
            num+=1
    print(num)
    
    


Measured memory_bytes: 31424
#include <cstdio>
#include <cmath>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;

ll N, A, B;
ll v[60];
ll dp[60][60], dp2[60][60];

int main()
{
  scanf( "%lld%lld%lld", &N, &A, &B );

  rep( i, N )
    scanf( "%lld", v+i );

  dp2[0][0] = 1;

  rep( i, N ) rep( j, i+1 )
  {
    if( chmax( dp[i+1][j+1], dp[i][j]+v[i] ) )
      dp2[i+1][j+1] = dp2[i][j];
    else if( dp[i+1][j+1] == dp[i][j]+v[i] )
      dp2[i+1][j+1] += dp2[i][j];

    if( chmax( dp[i+1][j], dp[i][j] ) )
      dp2[i+1][j] = dp2[i][j];
    else if( dp[i+1][j] == dp[i][j] )
      dp2[i+1][j] += dp2[i][j];
  }

  double ma = 0;
  ll maJ = -1;

  rep( j, N+1 ) if( j >= A && j <= B && chmax( ma, (double)dp[N][j]/j ) )
    maJ = j;

  ll ans = 0;
  rep( j, N+1 ) if( j >= A && j <= B && dp[N][j]*maJ == dp[N][maJ]*j )
    ans += dp2[N][j];

  printf( "%.10f\n", ma );
  printf( "%lld\n", ans );

  return 0;
}

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

//Do not get frustrated over WA. Check for edge cases and runtime errors :)
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll q, type, f, rev = 0;
    string s;
    char c;
    cin >> s >> q;
    deque<char> dq;
    for(char c : s) {
        dq.push_back(c);
    }
    while (q--) {
        cin >> type;
        if (type == 1) {
            rev ^= 1;
        }
        else {
            cin >> f >> c;
            if (f == 1) {
                if (rev) {
                    dq.push_back(c);
                }
                else {
                    dq.push_front(c);
                }
            }
            else {
                if (!rev) {
                    dq.push_back(c);
                }
                else {
                    dq.push_front(c);
                }
            }
        }
    }
    string res;
    while (!dq.empty()) {
        res.push_back(dq.front());
        dq.pop_front();
    }
    if (rev) {
        reverse(res.begin(), res.end());
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 1368
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
struct StronglyConnectedComponent{
  int n, comp_size;
  vector<vector<int>> g, revg;
  vector<int> comp, order, used;

  StronglyConnectedComponent (int sz) {
    n = sz;
    g.resize(n); revg.resize(n);
    comp.assign(n, -1);
    used.assign(n, 0);
  }

  int operator[] (int u) {
    return comp[u];
  }

  void add_edge (int u, int v){
    g[u].emplace_back(v);
    revg[v].emplace_back(u);
  }

  void dfs (int u){
    if (used[u]) return ;
    used[u] = 1;
    for (auto v : g[u]) dfs(v);
    order.emplace_back(u);
    return ;
  }

  void rdfs (int u, int k){
    if (comp[u] != -1) return ;
    comp[u] = k;
    for (auto v : revg[u]) rdfs(v, k);
    return ;
  }

  void build (vector<vector<int>> &ref){
    for (int i = 0; i < n; i++) dfs(i);
    reverse(order.begin(), order.end());
    int cur = 0;
    for (auto i : order) {
      if (comp[i] == -1) {
        rdfs(i, cur);
        cur++;
      }
    }
    ref.resize(cur);
    for (int i = 0; i < g.size(); i++) {
      for (auto j : g[i]) {
        int u = comp[i], v = comp[j];
        if (u == v) continue;
        ref[u].emplace_back(v);
      }
    }
  }

};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  StronglyConnectedComponent scc(n);
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    scc.add_edge(a, b);
  }

  vector<vector<int>> g;
  scc.build(g);
  vector<vector<int>> res(g.size());
  for (int i = 0; i < n; i++) res[scc[i]].emplace_back(i);

  cout << g.size() << "\n";
  for (int i = 0; i < (int)g.size(); i++) {
    cout << res[i].size() << " ";
    for (auto e : res[i]) cout << e << " ";
    cout << "\n";
  }
  return 0; 
}


Measured memory_bytes: 103648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  int i = 0;
  
  cin >> s;
  
  if(s == "111")
    i = 3;
  if((s == "110") || (s == "011") || (s == "101"))
    i = 2;
  if((s == "100") || (s == "010") || (s == "001"))
    i = 1;
  if(s == "000")
    i = 0;
  
  cout << i <<endl;
  
}


Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# 初項s, 交差dのn個の数列の和
def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    A, B, T = map(int, input().split())
    ans = 0
    for i in range(1, T + 1):
        if i % A == 0:
            ans += B
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3948
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

int main() {
    ll N; cin>>N;
    VL A(N+1); VL B(N);
    rep(i,0,N+1)cin>>A[i];
    rep(i,0,N)cin>>B[i];
    ll ans=0;
    rep(i,0,N){

        if(A[i]>=B[i]){
        
            ans += B[i];
            A[i] = A[i]-B[i];
          	B[i] = 0;
        
        }else if(A[i]<B[i]){
            
            ans += A[i];
          	B[i] = B[i]-A[i]; 
          	A[i] = 0;
            if(A[i+1]>=B[i]){
                ans += B[i];
                A[i+1] = A[i+1]-B[i];
              	B[i] = 0;
            }else if(A[i+1]<B[i]){
            	ans += A[i+1];
               	B[i] = B[i]-A[i+1]; 
				A[i+1] = 0;
            }
          
        }

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long a,b,k,flag=0;
	cin>>a>>b;
	if(a>b){
	    k=a;
	}
	else{
	    k=b;
	}
	for(long long i=0;i<k;i++){
	    if(abs(a-i)==abs(b-i)){
	        cout<<i<<'\n';
	        flag++;
	        break;
	    }
	}
	if(flag==0)
	    cout<<"IMPOSSIBLE"<<'\n';
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main(){
    long H,W;
    cin >> H >> W;
    if(H==1 || W==1){
        cout <<1;
    }else if(H%2==0){
        cout << (H/2)*W;
    }else if(W%2==0){
        cout << (W/2)*H;
    }else{
        cout << ((H/2)+1)*(W/2+1)+(H/2)*(W/2);
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
long long ans=66666666666666LL,a[500001];
long long getabs(long long x)
{
	return x>0?x:-x;
}
int main()
{
	long long i,n,k;
	a[0]=0;
	scanf("%lld",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%lld",&k);
		a[i]=k+a[i-1];
	}
	for(i=1;i<n;i++)
		ans=min(ans,getabs(a[n]-2*a[i]));
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>

int main (void){

        int i,j,N;
        long  total = 0;

        scanf("%d",&N);
        
        int array[1000000] = {}; //配列
        
        for(i = 1; i<=N; i++){
                if(i % 3 != 0 && i % 5 != 0){
                        array[i-1] = i;
                }
                else{
                        array[i-1] = 0;
                }
        }

        for(j = 0; j < N; j++){
                //printf("%d\n",array[j]);
                total = total +array[j];
        }

        printf("%ld\n",total);


        return 0;
}


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

#define ll long long
#define pii pair<int, int>
#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define FORD(i, a, b) for (int i=a; i>=b; i--)
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

using namespace std;

void solve() {
    int A, B;
    cin >> A >> B;
    int ans = max(A+B, A-B);
    ans = max(ans, A*B);
    print(ans);
}

signed main() {
    solve();
}


Measured memory_bytes: 256
/******************************************
* AUTHOR : DHRUV GUPTA *
* NICK : COSMOGOD *
* INSTITUTION : LNMIIT *
******************************************/

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1000000007

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

	ll n;
	cin >> n;
	ll a[n];
	for(ll i=0;i<n;i++)
		cin >> a[i];

	ll dp[n][n] = {0};

	for(ll l=n-1;l>=0;l--){
		for(ll r=l;r<n;r++){
			if(l==r)
				dp[l][r] = a[l];
			else
				dp[l][r] = max(a[l]-dp[l+1][r], a[r]-dp[l][r-1]);
		}
	}	

	cout << dp[0][n-1];

	return 0;
}

Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
long long int n,a,b,c,ans;

int j(int x){
    if(x<10)return x;
    int l=j(x/10)+l;
    return l;
}

int digitsum(int x){
    int ds=0;
    while(x){
        ds+=x%10;
        x/=10;
    }
    return ds;
}

int main(){
    cin>>n>>a>>b;
    for(int i=1;i<n+1;i++){
        if(digitsum(i)>=a&&digitsum(i)<=b)ans+=i;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int x, ans;

int main() {
	fastio; cin >> x;
	ans += (x/500) * 1000;
	x %= 500;
	ans += (x/5) * 5;
	cout << ans;
}


Measured memory_bytes: 256
require 'pp'
# IS_DEBUG = true
IS_DEBUG = false
def dputs str
	if(IS_DEBUG)
		puts str
	end
end
def dpp str
	if(IS_DEBUG)
		pp str
	end
end


def fill(rbase,cbase,d,h,w,color,arr)
	for i in 0..(d-1)
		for j in (i < d/2 ? (-i)..(i) : (-d+i+1)..(d-i-1))
			x = rbase+i
			y = cbase+j
			if(0 <= x && x < H && 0 <= y && y < W)
				arr[x][y] = color
			end
		end
	end
end
H,W,d=gets.chomp.split(' ').map{|n| n.to_i}
arr = Array.new(H){Array.new(W)}
r=0
# 0,0 d,0
# fill(0*d,0*d,d,H,W,"R",arr)
# puts arr.map{|l| l.join("")}.join("\n")
while(r*d<H+d)
	c=0
	while(c*d<W+d)
		color = r%2 ^ c%2 == 0 ? "R" : "Y"
		fill(r*d,c*d,d,H,W,color,arr)
		# dputs "rbase, cbase,color = #{r*d},#{c*d},#{color}"
		# dputs arr.map{|l| l.map{|a| a.nil? ? " " : a }.join("")}.join("\n")
		c+=1
	end
	r+=1
end
# start from -d/2, d/2 when (r,c)=(0,0)
r=0
while(r*d<H+d)
	c=0
	while(c*d<W+d)
		color = r%2 ^ c%2 == 0 ? "G" : "B"
		rbase = r*d-(d/2+d%2)
		cbase = c*d-(d/2)
		if(d%2==0)
			fill(rbase,cbase,d,H,W,color,arr)
		else
			fill(rbase+1,cbase-1,d-1,H,W,color,arr)
			fill(rbase+1,cbase,d-1,H,W,color,arr)
		end
		# dputs "rbase, cbase,color = #{rbase},#{cbase},#{color}"
		# dputs arr.map{|l| l.map{|a| a.nil? ? " " : a }.join("")}.join("\n")
		c+=1
	end
	r+=1
end
puts arr.map{|l| l.join("")}.join("\n")


Measured memory_bytes: 26876
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <time.h>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <string.h>

#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
using namespace std;
ll c[1000];
bool cmp(ll a,ll b) {
    return a > b;
}
ll d[66][66];
void C() {
    memset(d,0,sizeof(c));
    for(ll i = 0; i <= 60; i ++) {
        d[i][0] = 1;
        for(ll j = 1; j <= i; j ++) {
            d[i][j] = d[i-1][j-1] + d[i-1][j];
        }
    }
}
int main() {
    re(d,0);
    //pld(C)
    C();
    ll n;
    sld(n)
    ll a,b;
    sld(a) sld(b)
    for(ll i = 0; i < n; i ++) {
        sld(c[i])
    }
    ll sum = 0;
    sort(c,c+n,cmp);
    ll x = c[a-1];
    ll count0 = 0;
    ll count1 = 0;
    for(ll i = 0; i < n; i ++) {
        if(i <= a-1) {
            if(c[i] == x) {
                count0 ++;
            }
            sum += c[i];
        } else {
            if(c[i] == x) {
                count1 ++;
            }
        }
    }
    pf("%.6lf",((lf)sum/(lf)a));
    pn

    if(c[0] == x) {
        ll sum0 = 0;
        for(ll i = a; i <= b; i ++) {
            sum0 += d[count0+count1][count0-a+i];
        }
        pld(sum0) pn
    } else {
        pld(d[count0+count1][count0]);
        pn
    }


    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
dic = defaultdict(lambda: 0)
K,S=[int(a) for a in input().split(" ")]
for x in range(0,K+1):
    for y in range(0,K+1):
        dic[S-x-y] += 1
ans = 0
for z in range(0, K+1):
    ans += dic[z]
print(ans)

Measured memory_bytes: 42972
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
int N;
  cin>>N;
  int A[N],i,sum=0,mean=0;
  for(i=0;i<N;++i)
  {cin>>A[i];
   mean+=A[i];
  }
  
  if(mean%N!=0)
  {
      if(mean%N>(N/2))
      {
          mean/=N;
          mean+=1;
      }
      else
      {
          mean/=N;
      }
      
  }
  else
  {
      mean/=N;
  }
  int temp;
  for(i=0;i<N;++i)
  { temp=abs(A[i]-mean);
    sum+=temp*temp;
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

string a[50],b[50];
int main(){
    int n,m;
    cin>>n>>m;
    rep(i,n) cin>>a[i];
    rep(i,m) cin>>b[i];
    rep(i,n-m+1){
        rep(j,n-m+1){
            if(a[i][j]==b[0][0]){
                bool flag=true;
                rep(k,m){
                    rep(l,m){
                        if(a[i+k][j+l]!=b[k][l]) flag=false;
                    }
                }
                if(flag){
                    cout<<"Yes"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >>N>>K;
     vector<int> H(N);
   for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  
  int count=0;
  for (int i = 0; i < N; i++) {
  if(H[i]>=K){
    count++;
}
  }
  cout <<count<<endl;
 
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
int a[maxn], b[maxn];
int main(){
	int n; cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i] >> b[i], b[i]++;
	int mb = b[0];
	for(int i = 0; i < n; i++) mb = min(mb, b[i]);
	int ch = -1;
	for(int i = 0; i < n; i++){
		if(b[i] == mb){
			if(ch == -1 || a[i] > a[ch]) ch = i;
		}
	}
	assert(ch != -1);
	map<int, vector<int> > in_l, in_r;
	for(int i = 0; i < n; i++){
		in_l[a[i]].push_back(i);
		in_r[b[i]].push_back(i);
	}
	multiset<int> ls, rs;
	multiset<int> covered;
	vector<int> to_a;
	for(int i = 0; i < n; i++){
		if(a[ch] <= a[i] && a[i] < b[ch]){
			to_a.push_back(a[i]);
		}
	}
	for(int i = 0; i < n; i++){
		ls.insert(a[i]);
		rs.insert(b[i]);
	}
	vector<int> up(n, 0);
	auto check = [&](int id){
		if(up[id] == 3){
			rs.erase(rs.find(b[id]));
			ls.erase(ls.find(a[id]));
			if(id != ch) covered.insert(b[id] - a[id]);
		}
	};
	auto get = [&](){
		if(ls.empty()){
			assert(!covered.empty());
			return *prev(covered.end());
		}
		int ml = *prev(ls.end());
		int mr = *rs.begin();
		return max(0, mr - ml);
	};
	sort(to_a.begin(), to_a.end());
	int ans = 0;
	for(int i = 0; i < n; i++) ans = max(ans, b[i] - a[i]);
	for(int ca : to_a){
		while(!in_l.empty() && (*in_l.begin()).first <= ca){
			auto it = in_l.begin();
			for(int p : it->second){
				up[p] |= 1;
				check(p);
			}
			in_l.erase(it);
		}
		while(!in_r.empty() && (*prev(in_r.end())).first >= b[ch]){
			auto it = prev(in_r.end());
			for(int p : it->second){
				up[p] |= 2;
				check(p);
			}
			in_r.erase(it);
		}
		ans = max(ans, b[ch] - ca + get());
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 33020
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
//
struct UnionFind{
	//
	vector<int> par,ran;
	//
	UnionFind(int n){
		for(int i=0;i<n;i++){
			par.push_back(i);
			ran.push_back(0);
		}
	}
	//
	int find(int x){
		return (x==par[x]?x:par[x]=find(par[x]));
	}
	//
	bool same(int x,int y){
		return find(x)==find(y);
	}
	//
	void unite(int x,int y){
		x=find(x);
		y=find(y);
		if(x==y){
			return;
		}else{
			if(ran[x]<ran[y]){
				par[x]=y;
			}else{
				par[y]=x;
				if(ran[x]==ran[y]){
					ran[x]++;
				}
			}
		}
	}
	//
};
//
int main(){
	int N,Q;
	cin>>N>>Q;
	UnionFind UF(N);
	for(int i=0;i<Q;i++){
		int C,X,Y;
		cin>>C>>X>>Y;
		if(C==1){
			cout<<(UF.same(X,Y)?1:0)<<endl;
		}else{
			UF.unite(X,Y);
		}
	}
	return 0;
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template <size_t I, class H, class... T> struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template <class H, class... T> struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
template <class... T> istream& operator>>(istream&i,tuple<T...>& t) { t = TupleReaderWriter<sizeof...(T), T...>::r(i); return i; }
template <class... T> ostream& operator<<(ostream& o, tuple<T...>& t) { string delim = " "; TupleReaderWriter<sizeof...(T) - 1, T...>::w(o, t, delim); return o; }
template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using vector2d = vector<vector<T>>;
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
// 再帰的に塗ると考える
int main() {
    const int MAX_D = 10;
    int N, M, Q;
    cin >> N >> M;
    vector2d<int> edge(N);
    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    cin >> Q;
    // 操作に対応する色
    vector<int> C(Q + 1, 0);
    // (u, d) -> q : 頂点uと操作q(頂点v)について、u,v間距離がd以下となる最新のq
    vector2d<int> dp(N, vector<int>(MAX_D + 1, 0));
    for(int q = 1; q <= Q; q++) {
        int v, d, c;
        cin >> v >> d >> c;
        v--;
        C[q] = c;
        dp[v][d] = q;
    }
    // O(MD)
    for(int d = MAX_D - 1; d >= 0; d--) {
        // O(M)
        for(int v = 0; v < N; v++) {
            dp[v][d] = max(dp[v][d], dp[v][d + 1]);
            for(int w : edge[v]) {
                dp[v][d] = max(dp[v][d], dp[w][d + 1]);
            }
        }
    }
    for(int v = 0; v < N; v++) {
        cout << C[dp[v][0]] << endl;
    }
    return 0;
}

Measured memory_bytes: 15480
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};

fn main() {
  let n = read::<i32>();
  if n % 2 == 1 {
    println!("{}", n * 2);
  } else {
    println!("{}", n);
  }
}



Measured memory_bytes: 4352
#include<iostream>
#define int_INF 2147483647
using namespace std;

int main() {
	int N;
	cin >> N;
	int S = 0;
	int K = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		S += a * a;
		K += a;
	}
	int ans = int_INF;
	int u = K / N;

	for (int i = -1; i < 2; i++) {
		int x = (u + i) * (u + i) * N - 2 * (u+ i) * K + S;

		x < ans ? ans = x : 1;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s
 
typedef long long ll;
 
using namespace std;

ll modd = 1000*1000*1000+7;


int main()   {

    ios_base::sync_with_stdio(false);

    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
 
//    auto start = chrono::steady_clock::now();
  
//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readstring(s1);
        readstring(s2);

        int ct=0;
        forr(i,0,s1.size()) {
            ct += (s1[i]!=s2[i]);
        }

        cout << ct << endl;
    }
 
//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;
 
    return 0;
}

Measured memory_bytes: 3948
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            long[] s = ReadLine().Split(' ').Select(long.Parse).ToArray();
            long n = s[0];
            long m = s[1];
            long ans = Min(n, m / 2);
            long tmp = m - (Min(n, m / 2)*2);
            ans += tmp / 4;
            WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define mp std::make_pair
#define pb push_back
typedef long long ll;
int arr[100005];
int main()
{
	// freopen("ARC101-C.in", "r", stdin);
	int n, k, ans = 1e9;
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++)
		scanf("%d", arr + i);
	for (int i = 0; i + k <= n; i++)
	{
		int j = i + k - 1, x = arr[i], y = arr[j];
		if (x < 0 && y > 0)
			ans = std::min(ans, std::min(-x, y) - x + y);
		else if (x >= 0)
			ans = std::min(ans, y);
		else
			ans = std::min(ans, -x);
	}
	printf("%d\n", ans);
	return 0;
}


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

#define itos(x) to_string(x)
#define stoi(x) stoi(x)
#define ctoi(x) (x-'0')

#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)(x).size()

#define ll long long
#define ld long double
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ld pi = acos((ld)-1);
const ld e = exp(1);

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 1; i <= 5; i++) {
    int x; cin >> x;
    if (x == 0) {
      cout << i << "\n";
      return 0;
    }
  }
}


Measured memory_bytes: 3576
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');

        var n = long.Parse(input[0]);
        var blue = long.Parse(input[1]);
        var red = n - blue;
        var list = new List<long>();

        for (long i = 1; i < blue + 1; i++)
        {

            long ans = 0;
            if (i < red + 2)
            {
                ans = ModCombination(red + 1, i) * ModCombination(blue - 1, i - 1) % 1000000007;

            }
            list.Add(ans);
            
        }

        foreach(var num in list)
        {
            Console.WriteLine(num);
        }

        Console.ReadLine();

    }

    public static long ModFactorial(long n, long mod)
    {
        var result = n;

        if (n > 0)
        {

            while (n > 1)
            {
                n--;
                result *= n;
                result %= mod;
            }

            return result;
        }
        else
        {
            //マイナス時も1でいいのか？
            return 1;
        }
    }

    public static long ModPow(long b, long pow, long mod)
    {
        if (pow == 1)
        {
            return b % mod;
        }

        long n = ModPow(b, pow / 2, mod) % mod;

        if (pow % 2 == 0)
        {
            return (n * n) % mod;
        }
        else
        {
            return (b * ((n * n) % mod)) % mod;
        }
    }

    public static long ModCombination(long sum, long num)
    {
        long x = 1;
        for (var i = 0; i < num; i++)
        {
            x *= (sum - i);
            x %= 1000000007;
        }

        var result = (x * (ModPow(ModFactorial(num, 1000000007), 1000000005, 1000000007))) % 1000000007;

        return result;
    }
}


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

using namespace std;
int main()
{
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;

    if(b-a<=k && c-a<=k && d-a<=k && e-a<=k)
    {
        cout<<"Yay!"<<endl;
    }
    else
    {
        cout<<":("<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
# E - Rotation Matching

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

l, r = 1, n - (n % 2)
for i in range(m):
    if n % 2 == 0 and i == (m + 1) // 2:
        l += 1
    print(l, r)
    l, r = l + 1, r - 1


Measured memory_bytes: 9256
# -*- coding: utf-8 -*-
K=int(input())
A,B=map(int,input().split())
i=1
ans=0
while B>=K*i:
    if A<=K*i:
        ans=1
        break
    i=i+1
if ans==1:
    print("OK")
else:
    print("NG")

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

// Shrotening
#define fst first
#define snd second
#define pb push_back
#define mp std::make_pair

// Loop
#define FOR(i,a,b) for(auto i=(a);i<(b);++i)
#define RFOR(i,a,b) for(auto i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

#define fcout(n) std::cout << std::fixed << std::setprecision((n))

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::pair<int,int> PII;

typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;
typedef std::vector<PII> VPII;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

int N;
std::map<int, bool> map;
int main() {
    std::cin >> N;

    int A;
    REP(i, N) {
        std::cin >> A;
        if(map.count(A) == 0) {
            map.insert(mp(A, true));
        } else {
            map[A] = !map[A];
        }
    }

    int cnt = 0;
    for(auto x: map) {
        cnt += (x.snd ? 1 : 0);
    }
    std::cout << cnt << std::endl;
}

Measured memory_bytes: 4864
N = int(input())
A = list(map(int, input().split()))
A.sort()
dp = [True] * (A[-1]+1)

for i,num in enumerate(A):
    if i < N-1 and A[i+1] == num:
        dp[num] = False
    else:
        for j in range(2*num, A[-1]+1, num):
            dp[j] = False

print(len([i for i in A if dp[i]]))

Measured memory_bytes: 117044
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
Mod = 1000000007



def main(): #startline--------------------------------------------
    K,X = map(int,input().split())
    ans = []
    for i in range(X-K+1,X+K):
        ans.append(i)
    print(*ans,sep = " ")
if __name__ == "__main__":
    main() #endline===============================================




def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Measured memory_bytes: 5680
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.next();
		int count =0;
		char some ='1';
		
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i) == some) {
				count++;
			}
		}
		System.out.println(count);
		

	}

}


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

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

  vector<string> s(n);
  vector<int> t(n);
  rep(i, n) cin >> s[i] >> t[i];

  string x;
  cin >> x;

  bool flag = false;
  int ans=0;
  rep(i, n) {
    if (flag) ans += t[i];
    if(s[i]==x) {
      flag = true;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;


using Graph = vector<vector<int>>;//グラフ型
void dfs(const Graph& G, int v/*根*/, vector<bool>& seen) {
	seen[v] = true;  //vを訪問済にする
	for (auto next_v : G[v]) { //訪問済にしたvとつながっている場所を順番に探す
		if (seen[next_v]) continue; //もし探索済みならスルー
		dfs(G, next_v, seen); //再帰的に探索
	}
}

void bfs(const Graph& G, queue<int>& que/*発見したが訪問はしていない*/, vector<int>& dist/*開始地点からの距離*/) {

	while (!que.empty()) {
		int v = que.front();//queのうち先頭のものからスタート
		que.pop();//先頭を削除

		for (int nv : G[v]) {//vとつながっている点を列挙
			if (dist[nv] != -1) continue;//発見済(=距離が格納されている)であればスルー
			dist[nv] = dist[v] + 1;//vとつながっている点に距離の情報を追加
			que.push(nv);//vとつながっている点を発見済にする
		}
	}
}

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

template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}


template<typename T>
bool same(T x_b, T x_e, T y_b, T y_e) {
	for (auto i = x_b, j = y_b; i != x_e && j != y_e; ++i, ++j) {
		if (*i != *j) {
			return false;
		}
	}
	return true;
}

int main(void) {
	ll n, k;
	cin >> n >> k;
	if (n < k) {
		cout << min(n, k - n);
		return 0;
	}
	n = n % k;
	cout << min(n, k - n);

}

/*
*/


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

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

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  string s;
  cin >> s;

  int k = s.length();

  int count = 0;
  for(int i = 0; i < k; i++) if(s[i] == 'o') ++count;

  if(count + (15 - k) >= 8) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main()
{
	int A1, A2, A3;
	cin >> A1 >> A2 >> A3;
	cout << max(max(A1, A2), A3) - min(min(A1, A2), A3) << endl;
}

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

int N;
int flag[101];

int main() {
  cin>>N;
  int d;
  for(int i=0;i<N;i++){
    cin>>d;
    flag[d]=1;
  }
  int ans=0;
  for(int i=1;i<=100;i++){
    ans+=flag[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
def gcd(x, y)
  r = x % y
  return y if r.zero?

  gcd(y, r)
end

def lcm(a, l)
  return a if l.size.zero?

  b = l[0]
  n = (a * b) / gcd(a, b)
  lcm(n, l[1, l.size - 1])
end

n = gets.to_i
# ts = n.times.map { gets.to_i }
ts = $stdin.read.split.map(&:to_i)

puts lcm(ts[0], ts[1, ts.size - 1])


Measured memory_bytes: 1788