akhauriyash/Code-Regression huggingface dataset:
/*
 Shahadat Hossain
 I.C.T Department
 Comilla University
 Session: 2013-2014
 */

#include<bits/stdc++.h>
using namespace std;

#define int long long
#define valid(x,y) x>=0 && y>=0 && x<n && y<n
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define ms(a,b) memset(a, b, sizeof(a))
#define eps 1e-5
#define input freopen("/Users/shahadat/Desktop/input.txt", "r", stdin)
#define output freopen("/Users/shahadat/Desktop/output.txt", "w", stdout)
#define d(x) cout << #x << " = " << x << endl
#define dd(x,y) cout << #x << " = " << x << "   " << #y << " = " << y << endl
#define ddd(x,y,z) cout << #x << " = " << x << "   " << #y << " = " << y << "   " << #z << " = " << z << endl
//fprintf(stdout,"\nTIME: %.3lf sec\n", (double)clock()/(CLOCKS_PER_SEC));
//int gcd(int n,int m){return m==0?n:gcd(m,n%m);}
#define bit(n,k) (((n)>>(k))&1)
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define pr(x) {cout << (x) << '\n';  }
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define mask(i) ((1LL<<(i)))
#define endl '\n'
double const PI = acos(-1);
int gcd(int n,int m){return m==0?n:gcd(m,n%m);}

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

struct Item{
    int a, b, c;
    Item(): a(), b(), c() {}
    
    void scan(){
        cin >> a >> b >> c;
    }
};

int const N = 1e5 + 5;

int32_t main(){
    int n;
    cin >> n;
    
    vector<int> dp(3);
    for(int days = 0; days < n; ++days){
        
        vector<int> c(3);
        for(int i = 0 ; i < 3; i++)
            cin >> c[i];
        
        vector<int> new_dp(3);
        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 3; j++){
                if(i == j) continue;
                new_dp[j] = max(new_dp[j], dp[i] + c[j]);
            }
        }
        dp = new_dp;
    }
    cout << max({dp[0], dp[1], dp[2]}) << endl;
}




Measured memory_bytes: 256
N,Y = map(int,input().split())
for x in range(N+1):
    if x*10000 > Y: break
    for y in range(N-x+1):
        if x*10000 + y*5000 > Y: break
        z = N-x-y
        if z < 0: break
        if z * 1000 == Y - x*10000 - y*5000:
            print(x,y,z)
            exit()
print('-1 -1 -1')

Measured memory_bytes: 40812
#include <cstdio>
using namespace std;

int main(int argc, char** argv)
{
	int n, m, lastc[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
	scanf("%d%d", &n, &m);
	char res[10] = {0}, temp_output = '\0';
	for(int i=0; i<n; i++) res[i] = '0';
	for(int i=0; i<m; i++)
	{
		int s, c;
		scanf("%d%d", &s, &c);
		if(lastc[--s] != -1)
		{
			if(lastc[s] == c) continue;
			puts("-1");
			return 0;
		}
		if(s == 0)
		{
			if(n == 1) temp_output = c + '0';
			else if(c == 0) {puts("-1"); return 0;}
		}
		lastc[s] = c;
		res[s] = c + '0';
	}
	if(temp_output) {putchar(temp_output); putchar('\n'); return 0;}
	if(n == 1) {puts("0"); return 0;} // n == 1 && m == 0: Result is 0
	if(res[0] == '0') res[0] = '1';
	puts(res);
	return 0;
}

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

int main()
{
    int n,k,count=0;
    cin>>n>>k;

    int a[n];

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]>=k)
            count++;
    }

    cout<<count<<endl;

    return 0;
}

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

int main(void){
    int n;
    cin >> n;
    
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    
    
    sort(l.begin(), l.end());
    
    int ans = 0;
    
    rep(b, n) rep(a, b){
        int ab = l[a] + l[b];
        
        int r = lower_bound(l.begin(), l.end(), ab) - l.begin();
        int l = b + 1;
        
        //c = [l, r);
        
        ans += max(0, r - l);
        
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
typedef long long int ll;
using namespace std;
#define REP(i,n) for (ll i=0;i<signed(n);i++)
const int MOD = 1000000007;
const ll INF = 20000000000;
    ll N,A[1001];
    ll ans=INF;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>N;
    REP(i,N)cin>>A[i];
    for(int i=-100;i<=100;i++){
        ll temp=0;
        REP(j,N)temp+=((A[j]-i)*(A[j]-i));
        ans=min(ans,temp);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;
const double PI = acos(-1);

int main() {
    string a, b, c; cin >> a >> b >> c;
    if (a.back() == b.front() && b.back() == c.front()) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    string S;
    cin >> S;
    int N;
    cin >> N;
    REP( i, (int)S.size() )
    {
        if( i % N == 0 ) cout << S[ i ];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9+7;
vector<int> adj[200010];
pair<int,int> dfs(int loc, int par)
{
    pair<int,int> ans(1,1);
    for(auto i:adj[loc])
    {
        if(i!=par)
        {
            pair<int,int> curr = dfs(i,loc);
            ans.first = (ans.first*(curr.first+curr.second))%mod;
            ans.second = (ans.second*curr.first)%mod;
        }
    }
    return ans;
}
int32_t main() {
    ios::sync_with_stdio(false);cin.tie(0);
    int n,x,y;
    cin>>n;
    for(int i=1;i<n;i++)
    {
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    pair<int,int> ans = dfs(1,0);
    cout<<(ans.first+ans.second)%mod;
    return 0;
}

Measured memory_bytes: 14976
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>

typedef long long ll;
using namespace std;

int main()
{
	int days[] = {31,29,31,30,31,30,31,31,30,31,30,31};
	string week[] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};

	int a,b;
	while(~scanf("%d %d",&a,&b)){
		if(a==0 && b==0) break;

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

		passed += b;
		cout << week[(passed - 1) % 7] << endl;
	}
}

Measured memory_bytes: 3212
package main

import "fmt"

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

var memo []int
var list [][]int

func f(i int) int {
	if memo[i] != -1 {
		return memo[i]
	}
	for _, j := range list[i] {
		memo[i] = max(memo[i], f(j)+1)
	}
	return memo[i]
}

func main() {
	var v, e int
	fmt.Scan(&v, &e)

	list = make([][]int, v+1)
	var x, y int
	for i := 0; i < e; i++ {
		fmt.Scan(&x, &y)
		list[x] = append(list[x], y)
	}

	memo = make([]int, v+1)
	for i := 1; i < v+1; i++ {
		memo[i] = -1
		if len(list[i]) == 0 {
			memo[i] = 0
		}
	}

	var result int
	for i := 1; i < v+1; i++ {
		result = max(result, f(i))
	}
	fmt.Println(result)
}

Measured memory_bytes: 14976
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n;
  ll k;
  cin>>n;
  cin>>k;
  ll a[n];
  for(int i=0;i<n;i++)
   cin>>a[i];
  ll dp[n];
  memset(dp,0,sizeof(dp));
 dp[0]=0;
 for(ll i=1;i<n;i++)
 {
 	if(i<=k)
 	{
 	ll mn=1e15+7;
 	for(ll j=0;j<i;j++)
 	mn=min(mn,abs(a[i]-a[j])+dp[j]);
 	dp[i]=mn;
 	}
 	else
 	{
 	ll mn=1e15+7;
 	for(ll j=i-1;j>=(i-k);j--)
 	mn=min(mn,abs(a[i]-a[j])+dp[j]);
 	dp[i]=mn;	
	}
 }
 cout<<dp[n-1];
}



Measured memory_bytes: 1792
# include <bits/stdc++.h>
# define rr register
# define int long long

signed main(void){
	int a,b,c;
	scanf("%lld%lld%lld",&a,&b,&c);
	if(c-b-a<0||(a*b*4>=(c-a-b)*(c-a-b))){
		printf("No");
		return 0;
	}else{
		printf("Yes");
	}
	return 0;
}

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

#define INF 1e+9;

int E, V;
int cost[50][50];
int d[100];

int main(){

    while(cin >> E, E){
        V = 0;
        fill(d, d+100, 0);
        for(int i=0; i < 50; i++){
            for(int j=0; j < 50; j++){
                cost[i][j] = (i==j)? 0:INF
            }
        }

        for(int i=0; i < E; i++){
            int a, b, c;
            cin >> a >> b >> c;
            cost[a][b] = c;
            cost[b][a] = c;
            V = max(V, max(a, b));
        }

        for(int k=0; k <= V; k++){
            for(int i=0; i <= V; i++){
                for(int j=0; j <= V; j++){
                    cost[i][j] = min(cost[i][j], cost[i][k]+cost[k][j]);
                }
            }
        }

        int minCost = INF;
        for(int i=0; i <= V; i++){
            for(int j=0; j <= V; j++){
                d[i] += cost[i][j];
            }
            minCost = min(minCost, d[i]);
        }

        for(int i=0; i <= V; i++){
            if(minCost == d[i]){
                cout << i << " " << d[i] << endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 1172
/*
 *  Lang    : C++
 *  Author  : little_angel
 */

#include <bits/stdc++.h>

using namespace std;
#define int long long

const int mod = 1e9L + 7;

int power(int x, int y) {
    int res = 1;
    while (y) {
        if (y & 1)res = res * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return res;
}

inline int inv(int x) {
    return power(x, mod - 2);
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    struct L {
        int a, b;

        int val(int x) const {
            return a * x + b;
        }

        pair<int, int> inter(L &l2) const {
            int num = l2.b - b;
            int den = a - l2.a;
            if (den < 0) {
                den *= -1ll;
                num *= -1ll;
            }
            return {num, den};
        }
    };

    int n, c;
    cin >> n >> c;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) cin >> h[i];

    vector<L> lines;

    auto remove = [&](int x) {
        while (lines.size() >= 2) {
            if (lines[0].val(x) >= lines[1].val(x))lines.erase(lines.begin());
            else break;
        }
    };

    auto add = [&](int a, int b) -> void {
        if (lines.empty()) {
            lines.push_back(L{a, b});
            return;
        }
        L C{a, b};
        while (lines.size() >= 2) {
            L A = lines.end()[-2];
            L B = lines.end()[-1];
            auto p1 = A.inter(B);
            auto p2 = B.inter(C);

            if (p1.first * p2.second >= p2.first * p1.second)lines.pop_back();
            else break;
        }
        lines.push_back(C);
    };

    auto get = [&](int x) -> int {
        remove(x);
        return lines[0].val(x);
    };

    vector<int> dp(n);
    add(-2 * h[0], h[0] * h[0]);
    for (int i = 1; i < n; ++i) {
        dp[i] = get(h[i]) + (c + h[i] * h[i]);
        add(-2 * h[i], h[i] * h[i] + dp[i]);
    }
    cout << dp[n - 1] << endl;
}


Measured memory_bytes: 9584
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let h: usize = s.next().unwrap().parse().unwrap();
	let w: usize = s.next().unwrap().parse().unwrap();
	let m: usize = s.next().unwrap().parse().unwrap();

	let mut horz = vec![0; h];
	let mut vert = vec![0; w];
	let mut set = std::collections::HashSet::new();

	for _ in 0..m {
		let y: usize = s.next().unwrap().parse::<usize>().unwrap() - 1;
		let x: usize = s.next().unwrap().parse::<usize>().unwrap() - 1;
		horz[y] += 1;
		vert[x] += 1;
		set.insert(y << 32 | x);
	}

	let horzmax = *horz.iter().max().unwrap();
	let vertmax = *vert.iter().max().unwrap();
	let ys: Vec<_> = horz
		.iter()
		.enumerate()
		.filter(|(_, &c)| c == horzmax)
		.map(|(i, _)| i)
		.collect();
	let xs: Vec<_> = vert
		.iter()
		.enumerate()
		.filter(|(_, &c)| c == vertmax)
		.map(|(i, _)| i)
		.collect();
	let mut crossed = true;
	'a: for y in ys.iter() {
		for x in xs.iter() {
			if set.contains(&(y << 32 | x)) {
				continue;
			}
			crossed = false;
			break 'a;
		}
	}
	println!("{}", horzmax + vertmax + if crossed { -1 } else { 0 });
}


Measured memory_bytes: 19664
#include<stdio.h>
main(){
  long a=100000;
  int b=0;
  int  c=0;
  int  d=0;
  long e=0;
  long f=0;
  scanf("%d",&b);
  for(c=0;c<b;c++){
    e=a/20;
    a=a+e;
    if(a%1000!=0){
      a=a/1000*1000+1000;
    }
  }
  printf("%d\n",a);
  return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
#define MOD 1e9+7

ll gcd(ll a, ll b){
    if(a<b) swap(a,b);
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

map<int,int> prime(ll n){
    map<int,int> ret;
    ret[1]++;;
    ll temp=n;
    for(ll i=2;i*i<=n;i++){
        while(temp%i==0){
            temp/=i;
            ret[i]++;
        }
    }
    if(temp!=1) ret[temp]++;
    return ret;
}

int main(){
    ll a,b;
    cin >> a >> b;
    ll r=gcd(a,b);
    map<int,int> mp=prime(r);
    int ans=0;
    for(auto x:mp) ans++;
    cout << ans << endl;  
}


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

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

   int N; cin>>N;
   map<string,int> mp;
   for(int i=0;i<N;i++){
      string s; cin>>s;
      mp[s]++;
   }
   int max_cnt=0;
   for(auto I:mp) max_cnt=max(max_cnt,I.second);
   for(auto I:mp) if(I.second==max_cnt) cout<<I.first<<endl;
   return 0;
}


Measured memory_bytes: 23808
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(blues, reds):
    blue_counts = {}
    red_counts = {}

    for b in blues:
        if b not in blue_counts:
            blue_counts[b] = 1
        else:
            blue_counts[b] += 1

    for r in reds:
        if r not in red_counts:
            red_counts[r] = 1
        else:
            red_counts[r] += 1

    max_count = 0
    for name, c in blue_counts.items():
        if name in red_counts:
            max_count = max(max_count, c - red_counts[name])
        else:
            max_count = max(max_count, c)
    return max_count


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [N] = string_to_int(input())
    blues = inputs(N)
    [M] = string_to_int(input())
    reds = inputs(M)
    ret = solve(blues, reds)
    print(ret)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>
#include <queue>
#include <bitset>
#include <sstream>
using namespace std;

typedef long long ll;

int main(){
        ll N, M, K, x;
        cin >> N >> M;
        vector<ll> P(M);
        vector<vector<ll>> A(M);
        for(int i=0; i<M; i++){
                cin >> K;
                for(int k=0; k<K; k++){
                        cin >> x;
                        x--;
                        A[i].push_back(x);
                }
        }
        for(int i=0; i<M; i++){
                cin >> P[i];
        }
        int Count=0;
        for(int i=0; i < (1 << N); i++){
                int m_count=0;
                for(int m=0; m<M; m++){
                        int l_count=0;
                        for(int l=0; l<N;l++){
                                if((i >> l) & 1)
                                        for(int k=0; k<A[m].size(); k++){
                                                if(A[m][k] == l) l_count++;
                                        }

                        }
                        if(l_count%2==P[m]) m_count++;
                }
                if(m_count == M) Count++;
        }
        cout << Count;
}

Measured memory_bytes: 256
def main():
    n, k, s = map(int, input().split())
    ans = []
    for i in range(k):
        ans.append(str(s))
    for i in range(n-k):
        if s < 10**9:
            ans.append(str(s+1))
        else:
            ans.append('1')

    print(' '.join(ans))


main()


Measured memory_bytes: 13464
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string A, B;
    cin >> A >> B;
    if(A.size() > B.size()) {
        cout << "GREATER" << endl;
    } else if(A.size() < B.size())  {
        cout << "LESS" << endl;
    } else if(A == B) {
        cout << "EQUAL" << endl;
    } else {
        rep(i, A.size()) {
            if(A[i] == B[i]) continue;
            if(A[i] > B[i]) {
                cout << "GREATER" << endl;
                return 0;
            } else if(A[i] < B[i]) {
                cout << "LESS" << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;
using pll = pair<ll, ll>;

bool cmp(pll &a, pll &b){
	return a.first + a.second < b.first + b.second;
}

ll dp[5500][5500];

int main(){
  int n;
  cin >> n;
  vector<pll> part;
  for(int i = 0; i < n; ++i){
  	ll h, p;
  	cin >> h >> p;
  	part.push_back({h, p});
  }

  sort(part.begin(), part.end(), cmp);

  fill((ll*)dp, (ll*)dp + sizeof(dp) / sizeof(ll), LINF);
  dp[0][0] = 0;
  for(int i = 0; i < n; ++i){
  	for(int j = 0; j <= i + 1; ++j){
  		if(j >= 1 && part[i].first >= dp[i][j - 1])dp[i + 1][j] = min(dp[i][j], dp[i][j - 1] + part[i].second);
  		else dp[i + 1][j] = dp[i][j];
  	}
  }
  cout << lower_bound(dp[n], dp[n] + n + 1, LINF) - dp[n] - 1 << endl;
  return 0;
}


Measured memory_bytes: 236800
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

const int P = 1000000007;

int norm(int x) { return x >= P ? (x - P) : x; }

void add(int& x, int y) { if ((x += y) >= P) x -= P; }

void sub(int& x, int y) { if ((x -= y) < 0) x += P; }

void exGcd(int a, int b, int& x, int& y) {
  if (!b) {
    x = 1;
    y = 0;
    return;
  }
  exGcd(b, a % b, y, x);
  y -= a / b * x;
}

int inv(int a) {
  int x, y;
  exGcd(a, P, x, y);
  return norm(x + P);
}

const int N = 5010;

int dp[N], tmp[N];

int main() {
#ifdef ELEGIA
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, m;
  cin >> n >> m;/*
  for (int i = 0; i <= m; ++i) dp[0][i] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= m; ++j) {
      dp[i][j] = dp[i - 1][j] * (j + 1);
      for (int k = 2; k <= j; ++k)
        dp[i][j] += dp[i - 1][j - k + 1] * (j - k + 1) * pow(2, k - 2);
    }
  }*/
  fill(dp, dp + m + 1, 1);
  for (int rep = 0; rep < n; ++rep) {
    for (int i = 0; i <= m; ++i)
      tmp[i] = dp[i] * (i + 1LL) % P;
    int sum = 0;
    for (int i = 2; i <= m; ++i) {
      sum = (sum * 2LL + dp[i - 1] * (i - 1LL) % P) % P;
      add(tmp[i], sum);
    }
    memcpy(dp, tmp, sizeof(dp));
  }
  cout << dp[m] << '\n';

#ifdef ELEGIA
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


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

int main() {
  int H, W;
  for (;;) {
    cin >> H >> W;
    if (H == 0 && W == 0) {
      break;
    }
    for (int h = 0; h < H; ++h) {
      for (int w = 0; w < W; ++w) {
        if (h % 2 == 0) {
          if (w % 2 == 0) {
            cout << "#";
          } else {
            cout << ".";
          }
        } else {
          if (w % 2 == 0) {
            cout << ".";
          } else {
            cout << "#";
          }
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define greeting cerr << "R U OK?"

using namespace std;

// #define local
int main()
{
#ifdef local
    freopen("data.in", "r", stdin);
    freopen("ans.out", "w", stdout);
#endif
    int k;
    string s;
    cin >> k;
    cin >> s;
    for(auto i: s)
    {
        int c = i-'A' + k;
        c %= 26;
        printf("%c", ('A'+c));
    }
    printf("\n");
    return 0;
}


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

#define x first
#define y second
#define pii pair<int,int>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long LL;
const int maxn = 5e3+35;
map<LL,int> mp;
int main(){
    for(int i = -maxn;i <= maxn; ++i) mp[1ll*i*i*i*i*i] = i;
    LL x; cin >> x;
    for(int i = -maxn;i <= maxn; ++i){
        if(mp.count(x+1ll*i*i*i*i*i)){
            cout << mp[x+1ll*i*i*i*i*i] << " " << i << '\n';
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 4260
#define _USE_MATH_DEFINES

#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int main(){
	
	string str;
	cin >> str;
	
	int ans = str.size() / 2;
	
	if(str.size() % 2 == 0){
		for(int i = 0; i < str.size() / 2; i++){
			if(str[str.size() / 2 - i - 1] != str[str.size() / 2 - i] || str[str.size() / 2 + i - 1] != str[str.size() / 2 + i]){
				break;
			}
			ans++;
		}
	}else{
		ans++;
		for(int i = 0; i < str.size() / 2; i++){
			if(str[str.size() / 2 - i - 1] != str[str.size() / 2 - i] || str[str.size() / 2 + i + 1] != str[str.size() / 2 + i]){
				break;
			}
			ans++;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	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;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

signed main() {
	int a, b;
	cin >> a >> b;
	cout << max({ a + b,a - b,a * b }) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
        cin >> a[i];
    int counter = 1, crossed = 0, sum = 0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==counter)
        {
            counter++;
            sum = sum + i - crossed;
            crossed = i + 1;
        }
    }
    if(sum==0)
    {
        if(counter==1)
        {
            cout << -1 << endl;
            return 0;
        }
        else
        {
            cout << n - (counter-1) << endl;
            return 0;
        }
        
    }
    cout << n - (counter-1) << endl;
}

Measured memory_bytes: 1024
n=int(input())

ex=[]
for i in range(n):
    x=int(input())
    ex.append(x)

maxv=(-1)*10**10
minv=ex[0]

for i in range(1,n):
    maxv=max([maxv,ex[i]-minv])    
    minv=min([minv,ex[i]])

print(maxv)


Measured memory_bytes: 13588
#include <array>
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

int main() {
  int D, G;
  cin >> D >> G;
  vector<int> p; // 問題数
  vector<int> c; // ボーナス点
  for (int i = 0; i < D; i++) {
    int p_i, c_i;
    cin >> p_i >> c_i;
    p.push_back(p_i);
    c.push_back(c_i);
  }
  int result = __INT_MAX__;
  for (int bits = 0; bits < (1 << D); bits++) {
    // 完全に解いてボーナスまでもらう問題は1 ((bits>>i)&1)==1
    int total_score = 0;
    int total_solved = 0;
    int max_i_rest = 0;
    for (int i = 0; i < D; i++) {
      if (((bits >> i) & 1) == 1) {
        total_score += c[i] + p[i] * (i + 1) * 100;
        total_solved += p[i];
      } else {
        max_i_rest = i;
      }
    }
    if (total_score < G) {
      int required_solved =
          (G - total_score - 1) / ((max_i_rest + 1) * 100) + 1;
      if (required_solved >= p[max_i_rest])
        continue;
      total_solved += required_solved;
    }
    result = min(result, total_solved);
  }
  cout << result << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

int main() {
  int n; // a number of scores
  scanf("%d", &n);

  int arr[100];
  for (size_t i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    printf("%d%c",arr[i],(i==n-1)? '\n':' ');
  }

  for (size_t i = 1; i < n; i++) {
    int j = i - 1;
    int v = arr[i];
    while (arr[j] > v && j > -1) {
      arr[j+1] = arr[j];
      j--;
    }
    arr[j+1] = v;
    for (size_t k = 0; k < n; k++) {
      printf("%d%c",arr[k],(k==n-1)? '\n':' ');
    }

  }
  return 0;
}

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

using namespace std;
using i64 = long long int;
using ui64 = unsigned long long int;

////////////////////////////////

int main()
{
  string s;
  int ans;
  cin >> s >> ans;
  char prev = '+';
  vector<int> m_terms;
  int l_val = 0;
  for(int i=0;i<s.length();i++){
    if(i&1){
      prev = s[i];
    }else{
      int val = s[i] - '0';
      if(prev == '+'){
        l_val += val;
        m_terms.push_back(val);
      }else{
        l_val *= val;
        m_terms[m_terms.size()-1] *= val;
      }
    }
  }
  int m_val = 0;
  for(auto&& x:m_terms)m_val += x;
  char res;
  if(ans == m_val && ans == l_val) res = 'U';
  else if(ans == m_val) res = 'M';
  else if(ans == l_val) res = 'L';
  else res = 'I';
  cout << res << endl;
}




Measured memory_bytes: 3220
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int n,a,i,mx=-INF,mn=INF;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a;
		mx = max(mx,a);
		mn = min(mn,a);
	}
	cout << (mx-mn) << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int ans2 = sc.nextInt();
        Set<String> set = new HashSet<>();

        for (int i = 0; i < str.length(); i++) {
            set.add(String.valueOf(str.charAt(i)));

            if(set.size() == 26){
                break;
            }
        }

        List<String> list = new ArrayList<>(set);
        Collections.sort(list);

        Set<String> ans = new HashSet<>();
        int pos = 0;
        for (int i = 0; i < set.size(); i++) {
            while(true){
                pos = str.indexOf(list.get(i), pos);
                if(pos == -1){
                    break;
                }

                int count = 0;
                for (int k = pos; k < str.length(); k++) {
                    ans.add(str.substring(pos, k + 1));

                    if(count++ == 10){
                        break;
                    }
                }
                pos++;
            }

            if(ans.size() > ans2){
                break;
            }
        }

        list = new ArrayList<>(ans);
        Collections.sort(list);
        System.out.println(list.get(ans2 - 1));
    }

}


Measured memory_bytes: 24656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <utility>

using namespace std;
struct propose
{
    int t, x, y;
};
int main(void)
{
    int N, a, b, c, time = 0, x = 0, y = 0, next = 0;
    cin >> N;
    vector<propose> vec(N);
    for (int i = 0; i < N; ++i)
    {
        cin >> a >> b >> c;
        vec[i].t = a;
        vec[i].x = b;
        vec[i].y = c;
    }
    // for (int i = 0; i < N; ++i)
    //     cout << vec[i].t << " " << vec[i].x << " " << vec[i].y << "\n";
    while (true)
    {
        if (time == vec[next].t)
        {
            if (x == vec[next].x && y == vec[next].y)
            {
                if (time == vec.back().t)
                    break;
                next++;
            }
            else
            {
                cout << "No\n";
                return 0;
            }
        }
        if (x < vec[next].x)
            x++;
        else if (x > vec[next].x)
            x--;
        else if (y < vec[next].y)
            y++;
        else if (y > vec[next].y)
            y--;
        else
            x++;
        time++;
    }
    cout << "Yes\n";
}

Measured memory_bytes: 1408
#include<stdio.h>

int main(void){
	int n,m,l,i,j,k=0;
	int a[100][100],b[100][100]={{0}};
	long c[100][100]={{0}};
	
	scanf("%d %d %d",&n,&m,&l);
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%d",&a[i][j]);
		}
	}
	for(i=0;i<m;i++){
		for(j=0;j<l;j++){
			scanf("%d",&b[i][j]);
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			for(k=0;k<m;k++){
				c[i][j]=c[i][j]+(a[i][k]*b[k][j]);
			}
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			if(j!=(l-1))printf("%ld ",c[i][j]);
			else printf("%ld",c[i][j]);
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2100
cardNumAll = int(input())

cardNumbers = [i for i in range(1, 13+1)]

cards = {
    "S": cardNumbers.copy(),
    "H": cardNumbers.copy(),
    "C": cardNumbers.copy(),
    "D": cardNumbers.copy()
}

for _ in range(cardNumAll):
    p, num = input().split()
    num = int(num)
    cards[p].remove(num)

for k in cards:
    for n in cards[k]:
        print(k, n)



Measured memory_bytes: 5596
import java.util.Scanner;

class Main {

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

  private static Scanner sc;

  private void run() {
    sc = new Scanner(System.in);
    int r = Integer.parseInt(sc.next());
    System.out.println(3 * (r * r));
  }
}


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

void trace(int a[],int n){
    string c="";
    for(int i=0;i<n;i++){
        cout<<c<<a[i];
        c=" ";
    }
    cout<<"\n";
}

void insertionSort(int a[],int n){
    for(int i=1;i<n;i++){
        int v=a[i];
        int j=i-1;
        while(j>=0 && a[j]>v){
         a[j+1]=a[j];
         j--;
        }
        a[j+1]=v;
        trace(a,n);
    }
}

int main(void){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    trace(a,n);
    insertionSort(a,n);
}


Measured memory_bytes: 3140
import java.util.Scanner;
import java.lang.Math;
public class Main {
	public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i=0; i<n; i++) {
        	a[i] = sc.nextInt();
        }
        int M = a[0];
        int m = a[0];
        long sum = a[0];
        for (int i=1; i<n; i++) {
        	M = Math.max(M, a[i]);
        	m = Math.min(m, a[i]);
        	sum += a[i];
        }
        System.out.println(m + " " + M + " " + sum);
    }
}



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

long long euclidean_gcd(long long a, long long b) {
    if(a < b) return euclidean_gcd(b, a);;
    long long r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
};

int main() {
    long long a, b;
    cin >> a >> b;
    cout << (a*b)/euclidean_gcd(a, b) << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main(void){
    int A,B;
    scanf("%d%d",&A,&B);
    if(A*2-1>=B*2-1){
        if(A+B >= A*2-1){
            printf("%d",A+B);
        }else{
            printf("%d",A*2-1);
        }
    
        
    }else if(A+B >= B*2-1){
        printf("%d",A+B);
        
    }else{
        printf("%d",B*2-1);    
        }
    
    
   
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main()
{
  int n, m;

  cin >> n;
  string blue_cards[n];

  for (int i = 0; i < n; i++) cin >> blue_cards[i];

  cin >> m;
  string red_cards[m];

  for (int i = 0; i < m; i++) cin >> red_cards[i];

  map<string,int> ans;

  for (string x : blue_cards) {
    ans[x] += 1;
  }

  for (string x : red_cards) {
    ans[x] -= 1;
  }

  int max = 0;
  for (auto &x : ans) {
    if (x.second > max) max = x.second;
  }

  cout << max << endl;

  return 0;
}


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

int main(){
	int a,b,c,k; cin >> a >> b >> c >> k;
	if(a>b){
		int temp;
		temp=a;
		a=b;
		b=temp;
	}
	if(b>c){
		int temp;
		temp=b;
		b=c;
		c=temp;
	}
	for(int i=0;i<k;i++) c*=2;
	cout << a+b+c << endl;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define ld long double
using namespace std;
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;
int main(){
    fast;
    for(int i = 0; i < 5; i++){
        int x;
        cin >> x;
        if(x == 0){
            return cout << i + 1, 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int comp(const void* a, const void* b) {
	return *(int*)a - *(int*)b;
}

int comp_inv(const void* a, const void* b) {
	return *(int*)b - *(int*)a;
}

int min(int a, int b) {
	return a < b ? a : b;
}

int main() {
	int n, m, x[100000], i, d[100000], cnt;
	scanf("%d%d", &n, &m);
	for (i = 0; i < m; i++) scanf("%d", &x[i]);
	qsort(x, m, sizeof(int), comp);
	d[0] = 0;
	for (i = 1; i < m; i++) d[i] = x[i] - x[i - 1];
	qsort(d, m, sizeof(int), comp_inv);
	cnt = x[m - 1] - x[0];
	for (i = 0; i < min(n - 1, m); i++) cnt -= d[i];
	printf("%d", cnt);
	return 0;
}

Measured memory_bytes: 1396
N = gets .to_i
As = gets.split.map(&:to_i)

require 'prime'

ls = As.take(N - 1).each_with_object([0]){|a, x| x << x.last.gcd(a)}
rs = As.drop(1).reverse.each_with_object([0]){|a, x| x << x.last.gcd(a)}.reverse
puts ls.zip(rs).map{|l, r| l.gcd(r)}.max

Measured memory_bytes: 16880
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> B(N);
    vector<ll> C(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N) cin >> C[i];
    sort(all(A));
    sort(all(B));
    sort(all(C));
    ll cnt = 0;
    vector<ll> cnts(N);
    rep(i, N) {
        while(cnt < N && A[cnt] < B[i]) {
            cnt++;
        }
        cnts[i] = cnt;
    }
    cnt = 0;
    ll ans = 0;
    ll sum = 0;
    rep(i, N) {
        while(cnt < N && B[cnt] < C[i]) {
            sum += cnts[cnt];
            cnt++;
        }
        ans += sum;
    }
    print(ans);
    return 0;
}

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

int main(){
	int a,b;
	cin>>a>>b;
	if(a>9||a<1)cout<<"-1"<<endl;
	else if(b<1||b>9)cout<<"-1"<<endl;
	else cout<<a*b<<endl; 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool check(string a,string b);
int main()
{	
	string a,b;
	cin >> a >> b;
	

	int n1 = a.size(),n2 = b.size();

	for(int i=0; i<=n1 - n2; i++){
		if(check(a.substr(i,n2),b)) cout << i << endl;
	}

	


	return 0;
}

bool check(string a,string b){
	return a == b;
}



Measured memory_bytes: 3228
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long ans = 0;
		String s = sc.next(); 
        long l = 1;
        long r = 0;
        for(int i=1;i<s.length();i++){if(s.charAt(i-1)==s.charAt(i)){l++;}
                                      else{ans+=l*(l+1)/2-Math.min(l,r);if(s.charAt(i-1)=='<'){r=l;}
                                           else{r=0;}
                                           l=1;}
                                     }
         ans+=l*(l+1)/2-Math.min(l,r);       
		System.out.println(ans);
	}
}

Measured memory_bytes: 28720
/**********************************************************/
/**            Bismillahir-rahmanir-rahim                **/
/**  In the name of Allah, the Beneficent, the Merciful. **/
/**********************************************************/
/****@author: Sayed Sohan, CSE 13th batch(2016), MBSTU*****/
/**********************************************************/

#include <bits/stdc++.h>
using namespace std;
//              Typedefs
typedef long long               ll;
typedef unsigned long long      ull;

//              Templates
template<class T>               using min_heap = \
                                priority_queue<T, \
                                std::vector<T>, std::greater<T>>;

//              Basic-Defs
#define PB                      push_back
#define MP                      make_pair
#define SP                      " "
#define NL                      "\n"
#define all(v)                  v.begin(), v.end()

//              DEBUG--SECTION
#define DE                      cout<<"HERE\n";
#define DE1(x)                  cout<<x<<"###\n";
#define DE2(x,y)                cout<<x<<"####"<<y<<"\n";
#define Pause                   system("pause");

//              Functions
#define clr(arr,value)          memset(arr,value,sizeof(arr))
#define __FAST_IO               ios_base::sync_with_stdio(0);\
                                cin.tie(0);cout.tie(0);
#define NUM1(x)                 __builtin_popcount(x)
#define LCM(x,y)                (x*y)/__gcd(x,y)

//              Sizes--Math     0123456789
#define MOD                     1000000007   //1e9+7 
#define MAX                     100050      
#define INF                     1e18
#define PI                      acos(-1)
#define eps                     1e-6

//** your code goes from here


int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    __FAST_IO;
    
    ll i,j,k,n,m,T; //basic variables
    cin>>m>>n;

    if(n==0){
    	cout<<m<<NL;
    }
    else{
    	ll arr[n+1];
    	map<ll,ll> mp;
    	for(i=0;i<n;i++){
    		ll x;
    		cin>>x;
    		mp[x] = 1;
    	}
    	ll pos = 0;
    	ll x = m;
    	while(true){
    		if(mp[x-pos]==0){
    			cout<<x-pos<<NL;
    			break;
    		}
    		else if(mp[x+pos]==0){
    			cout<<x+pos<<NL;
    			break;
    		}
    		pos++;
    	}

    }


    /// Don't forget to set array size....
    return 0;
}




Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

int main() {

    vector<int> cards(5);
    char comma;

    while(cin >> cards[0] >> comma >> cards[1] >> comma >> cards[2] >> comma >> cards[3] >> comma >> cards[4]) {
        sort(cards.begin(), cards.end());

        if(cards[0] == cards[3] || cards[1] == cards[4]) {
            cout << "four card" << endl;
        } else if ( (cards[0] == cards[2] && cards[3] == cards[4]) || (cards[0] == cards[1] && cards[2] == cards[4]) ) {
            cout << "full house" << endl;
        } else if ( cards[1] == cards[2] - 1 && cards[2] == cards[3] - 1 && cards[3] == cards[4] - 1) {
            if (cards[0] == cards[1] - 1 || ( cards[0] == 1 && cards[4] == 13 )) {
                cout << "straight" << endl;
            } else if (cards[0] == cards[1]) {
                cout << "one pair" << endl;
            } else {
                cout << "null" << endl;
            }
        } else if ( cards[0] == cards[2] || cards[1] == cards[3] || cards[2] == cards[4] ) {
            cout << "three card" << endl;
        } else if ( cards[0] == cards[1] ) {
            if (cards[2] == cards[3] || cards[3] == cards[4]) {
                cout << "two pair" << endl;
            } else {
                cout << "one pair" << endl;
            }
        } else if ( cards[1] == cards[2] ) {
            if (cards[3] == cards[4]) {
                cout << "two pair" << endl;
            } else {
                cout << "one pair" << endl;
            }
        } else if ( cards[2] == cards[3] || cards[3] == cards[4] ) {
            cout << "one pair" << endl;
        } else {
            cout << "null" << endl;
        }

    }


     
    return 0;
}

Measured memory_bytes: 0
// Author: Amey Bhavsar
// IDE: Geany/Ubuntu
// Platform: CODE HUNTERS
#pragma GCC optimize("trapv")
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i,a,b) for(auto i=a;i<b;i++)
#define repD(i,a,b) for(auto i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal
// traversal function to avoid long template definition
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)
//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())
// ll fe (ll x, ll y) {
	// ll ans = 1;
	// while (y>0) {
		// if (y&1) {
			// ans = (x*ans) % MOD;
		// }
		// y /= 2;
		// x = (x*x) % MOD;
	// }
	// return (ans % MOD);
// }

// ll modmul(ll a, ll b) {
    // return ((a%MOD) * (b%MOD)) % MOD;
// }

// ll modadd(ll a , ll b){
    // return((a%MOD)+(b%MOD)+MOD)%MOD;
// }

// ll modsub(ll a , ll b){
    // return((a%MOD) - (b%MOD) + MOD)%MOD;
// }
#define MOD 1000000007
// int n;
// vector<int> a;
// void solution() {
	// cin >> n;
	// a.resize(n);
	// for (auto& e:a) {
		// cin >> e;
	// }
// }




int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	// int t;
	// cin >> t;	
	// while(t--) {
		// solution();
	// }
	
	ull a,b,x;
	cin >> a >> b >> x;
	ull d1 = b/x;
	ull d2 = (a)/x;
	ull ans = d1 - d2;
	if (a%x == 0) ans++;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3540
N, M = list(map(int, input().split()))
top = []
for i in range(N):
	top.append(0)
for i in range(M):
	a, b = list(map(int, input().split()))
	top[a - 1] += 1
	top[b - 1] += 1
judge = "YES"
for i in range(N):
	if top[i] % 2 == 1:
		judge = "NO"
		break
	else:
		pass
print(judge)

Measured memory_bytes: 3888
#include<bits/stdc++.h>
#define REP(i,a,b) for(register int i=a;i<=b;++i)
#define DREP(i,a,b) for(register int i=a;i>=b;--i)
using namespace std;
int n,a[1000],ans;
int main(){
/*#ifndef ONLINE_JUDGE
	freopen("A.in","r",stdin);
	freopen("A.out","w",stdout);
#endif*/
	scanf("%d",&n);
	REP(i,1,n){
		int tmp;
		scanf("%d",&tmp);
		a[tmp]=1;
	}
	REP(i,0,999)
		if(a[i])ans++;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 

#define PI 3.14159265

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
//const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
 
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};

const int mod = 998244353;

struct dsu{
	int parent[N];
	int cont;
	void make_set(int n){
		for(int i = 1; i <= n; i++)
			parent[i] = i;
		cont = n;
	}
	
	int find_set(int v){
		if(v == parent[v])
			return v;
		return find_set(parent[v]);
	}
	
	void union_sets(int a, int b){
		a = find_set(a);
		b = find_set(b);
		if(a != b){
			parent[b] = a;
			cont--;
		}
	}
};

int m[13] ={0, 31,28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

int main(){
	int n; cin >> n;
	bool ok = false;
	for(int i = 1; i <= n; i++){
		int x = i * (1.08);
		if( x == n){
			cout<< i;
			ok = true;
			break;
		}
	}
	if(!ok)
		cout<<":(";
	return 0;
}


Measured memory_bytes: 256
//Matrix Chain Multiplication

#include<stdio.h>
#define N 100
#define INF -1

int arr[N],imp[N][N];

int min(int x,int y)
{
  //compare a minimum number 
  if(x<0) return y;
  else if( y < 0 ) return x;
  else if( x < y ) return x;
  else return y;
  
}

int main()
{
  int i,j,k,l,n,res;

  //input data
  scanf("%d",&n);
  for(i = 0; i <= n; i++) scanf("%d %d",&arr[i],&arr[i+1]);

  //initialize number of first stage
  for(i = 1; i <= n; i++) imp[i][i] = 0;

  for(l = 1; l <= n; l++)
    {
      for(i = 1; i <= n - l; i++)
	{
	  j = i + l;
	  imp[i][j] = INF;

	  //calculate minimum nunber
	  for(k = i; k < j; k++)
	    {
	      imp[i][j] = min(imp[i][j],imp[i][k] + imp[k+1][j] + arr[i-1]*arr[k]*arr[j]);
	      
	    }
	}
    }

  //output data
  printf("%d\n",imp[1][n]);
  
  return 0;
}



Measured memory_bytes: 2112
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>
#include <set>
#include <tuple>
#include<map>

using namespace std;
int main() {
	int a, b, c;

	cin >> a >> b >> c;

	bool ans = false;

	if (a + b == c) ans = true;
	else if (a + c == b) ans = true;
	else if (b + c == a) ans = true;

	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
}

Measured memory_bytes: 3596