akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std;

class Data
{
public:
	int line,pos,cost,jump;
	Data(int l, int p, int c, int j)
	: line(l), pos(p), cost(c), jump(j) {}
	bool operator<(const Data& d) const
	{
		if(cost!=d.cost) return cost>d.cost;
		if(jump!=d.jump) return jump>d.jump;
		if(line!=d.line) return line>d.line;
		return pos>d.pos;
	}
};

int main()
{
	int size[150];
	int pos [150][10];
	int cost[150][10];
	bool visited[150][10][75];
	
	int N,M;
	while(cin>>N>>M, N||M)
	{
		for(int l=0; l<N; l++)
		{
			cin>>size[l];
			for(int p=0; p<size[l]; p++)
			{
				cin>>pos[l][p]>>cost[l][p];
			}
		}

		memset(visited, 0, sizeof(visited));
		priority_queue<Data> q;

		for(int l=0; l<2; l++)
		{
			if(M<l) break;
			for(int p=0; p<size[l]; p++)
			{
				q.push( Data(l, p, 0, l) );
			}
		}

		while(!q.empty())
		{
			Data t=q.top(); q.pop();

			if((t.line==N-1) || (t.line==N-2 && t.jump<M))
			{
				cout << t.cost << endl;
				break;
			}

			if(visited[t.line][t.pos][t.jump]) continue;
			visited[t.line][t.pos][t.jump]=true;

			for(int l=0; l<2; l++)
			{
				Data nw(t.line+l+1, -1, -1, t.jump+l);

				if(M<nw.jump) break;
				for(int p=0; p<size[nw.line]; p++)
				{
					nw.pos = p;
					if(visited[nw.line][nw.pos][nw.jump]) continue;

					int sumcost = cost[t.line][t.pos] + cost[nw.line][nw.pos];
					int difpos  = pos [t.line][t.pos] - pos [nw.line][nw.pos];
					nw.cost = t.cost + sumcost*(difpos<0 ? -difpos:difpos);
					q.push( nw );
				}
			}
		}
	}
}

Measured memory_bytes: 5996
data = list(map(int,input().split()))
a = range(data[0],data[1]+1)
if data[2] > ((data[1] - data[0] + 1)//2):
  for i in range(data[1] - data[0] + 1):
  	print(a[i])
else:
  for i in range(data[2]):
  	print(a[i])
  for j in range(data[1] - data[0] - data[2]+1, data[1]- data[0]+1):
  	print(a[j])

Measured memory_bytes: 3064
from sys import stdin, stdout
from itertools import repeat
def main(ab=abs):
    n = int(stdin.readline())
    a = [0] + map(int, stdin.readline().split(), repeat(10, n)) + [0]
    d = [a[i+1] - a[i] for i in xrange(n + 1)]
    d = map(ab, d)
    s = sum(d)
    ans = [0] * n
    for i in xrange(1, n + 1):
        ans[i-1] = s - d[i] - d[i-1] + ab(a[i-1] - a[i+1])
    stdout.write('\n'.join(map(str, ans)))
main()


Measured memory_bytes: 18504
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

int cnt[600][600];
int main(){
   int n,m,q;
   cin>>n>>m>>q;
   rep(i,m){
        int l,r;
       scanf("%d%d",&l,&r);
       ++cnt[l][r];
   }
   rep(i,n+1)rep(j,n)cnt[i][j+1]+=cnt[i][j];
   rep(i,n)rep(j,n+1)cnt[i+1][j]+=cnt[i][j];
   rep(i,q){
        int l,r;
       scanf("%d%d",&l,&r);
       printf("%d\n",cnt[r][r]-cnt[l-1][r]);
   }
   return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <algorithm>


using namespace std;


using ll = long long;


class edge {
    public:
        ll src, dst, cost;
        edge(ll src, ll dst, ll cost)
            : src(src), dst(dst), cost(cost)
        {
        }

        bool operator < (const edge &e)
        {
            return cost < e.cost;
        }
};


class disjoint_set {
    vector<long long> parent, rank;

    public:
        disjoint_set();
        disjoint_set(long long size);

        void make_set(long long x);
        long long find_set(long long x);
        void unite(long long x, long long y);
        void resize(long long size);
};


disjoint_set::disjoint_set(long long size)
{
    parent.resize(size);
    rank.resize(size);

    for (long long i = 0; i < size; i++) {
        make_set(i);
    }
}


disjoint_set::disjoint_set()
    : disjoint_set(0)
{
}


void disjoint_set::resize(long long size)
{
    parent.resize(size);
    rank.resize(size);

    for (long long i = 0; i < size; i++) {
        make_set(i);
    }
}


void disjoint_set::make_set(long long x)
{
    parent[x] = x;
    rank[x] = 0;
}


long long disjoint_set::find_set(long long x)
{
    if (x != parent[x]) {
        parent[x] = find_set(parent[x]);
    }
    return parent[x];
}


void disjoint_set::unite(long long x, long long y)
{
    long long rx, ry;
    rx = find_set(x);
    ry = find_set(y);
    if (rank[rx] == rank[ry]) {
        parent[rx] = ry;
        // when the rank (height) of the trees are the same
        // uniting trees will increase the rank.
        rank[ry]++;
    } else if (rank[rx] < rank[ry]) {
        // uniting a shorter tree under a higher tree
        // won't change the rank (height) of the united tree.
        parent[rx] = ry;
    } else {
        parent[ry] = rx;
    }
}


void kruskal(vector<edge> &edges, disjoint_set &trees, vector<edge> &mst)
{
    sort(edges.begin(), edges.end());
    for (auto e : edges) {
        if (trees.find_set(e.src) == trees.find_set(e.dst))
            continue;
        trees.unite(e.src, e.dst);
        mst.push_back(e);
    }
}


int main()
{
    ll V, E;
    vector<edge> edges;
    cin >> V >> E;
    for (ll i = 0; i < E; i++) {
        ll s, t, w;
        cin >> s >> t >> w;
        edges.push_back(edge(s, t, w));
    }

    disjoint_set trees(V);
    vector<edge> mst;
    kruskal(edges, trees, mst);

    ll acc = 0;
    for (auto e : mst)
        acc += e.cost;
    cout << acc << endl;
}



Measured memory_bytes: 5892
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {
	os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T,class U> ostream& operator<<(ostream &os, const tuple<S,T,U> &t) { return os<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class S, class T,class U,class V> ostream& operator<<(ostream &os, const tuple<S,T,U,V> &t) { return os<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<","<<get<3>(t)<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
#else
#define out
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
	int a,b,t;
	cin>>a>>b>>t;
	vector<int> re;
	rep(i,t) re.pb(min(b,a+i)), re.pb(max(a,b-i));
	sort(all(re)); UNIQUE(re);
	for(int x:re) cout<<x<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
/*

*/
int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  
  ll N,ans=1; cin>>N;
  string S; cin>>S;
  for(ll i=0; i<N-1; i++){
    if (S[i] == S[i+1])
      continue;
    ans++;
  }
  cout<<ans<<endl;
}

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

int N, M, T;
std::vector<int> t(1e5, 1);
int main() {
    std::cin >> N >> M >> T;

    int a;
    for(int i = 0; i<N; ++i) {
        std::cin >> a;
        for(int j = a - M; j < a + M; ++j) {
            t[j] = 0;
        }
    }
    int ans = std::accumulate(t.begin(), t.begin() + T, 0);
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define int long long int
#define ld long double
#define pb push_back
#define pf push_front
#define ft first
#define sc second
#define all(v) v.begin(), v.end()
using namespace std;
const int maxn = 201001;
signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    vector<int> vec = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << vec[n - 1];
}


Measured memory_bytes: 256
import math
import itertools
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

K = int(input())

ans = 0
for x, y, z in itertools.product(range(1, K + 1), repeat=3):
    a = math.gcd(x, y)
    b = math.gcd(a, z)
    ans += b

print(ans)


Measured memory_bytes: 67724
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

// a^n mod を計算する
// O(logn)
ll modpow(ll a, ll n, ll mod=MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    ll n;
    cin>>n;
    ll ans=modpow(10,n);
    ans-=modpow(9,n);
    if(ans<0) ans+=MOD;
    ans-=modpow(9,n);
    if(ans<0) ans+=MOD;
    ans=(ans+modpow(8,n))%MOD;

    cout<<ans<<endl;
} 


Measured memory_bytes: 3604
//Never stop trying
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<str> vs;
typedef vector<ld> vd;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

const int MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const int MX = 2e4 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

#define dbg(x) cerr << " - " << #x << " : " << x << endl;
#define dbgs(x,y) cerr << " - " << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << " - " << #v << " : " << endl << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;

void IO() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int S;
int memo[MX];

int solve(int x){
	if(x==0) return 1;
	if(x<3) return 0;
	if(memo[x]!=-1) return memo[x];
	int ans=0;
	for(int i=3; i<=x; i++) ans+=solve(x-i),ans%=MOD;
	return memo[x]=ans;
}


int32_t main() {
	boost; IO();
	memset(memo,-1,sizeof(memo));
	cin>>S;
	cout << solve(S) << endl;



	return 0;
}

/* Careful!!!
	.Array bounds
	.Infinite loops
	.Uninitialized variables / empty containers
	.Order of input

   Some insights:
	.Binary search
	.Graph representation
	.Write brute force code
	.Change your approach
*/


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

N, T = map(int,input().split())
tt = list(map(int,input().split()))

ans = 0
for i in range(N-1):
	if(tt[i+1] - tt[i]>T):
		ans+=T
	else:
		ans+=tt[i+1] - tt[i]
print(ans+T)

Measured memory_bytes: 25748
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const ll mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    int pos = -1;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        if(a[i] == 1)   pos = i;
    }
    int now = 0;
    int res = 0;
    while(now < n){
        if(now == n - 1)    break;
        ++res;
        now += k - 1;
    }
    cout << res << endl;
}

Measured memory_bytes: 640
<?php
// Your code here!
$input = explode(" ",trim(fgets(STDIN)));

list($N,$H) = $input;

$array_H = array();
$count = array();
$array_H = explode(" ",trim(fgets(STDIN)));

foreach($array_H as $val){
    $val = (int)$val;
    if($val >= $H)$count[] = $val;
}


echo count($count).PHP_EOL;

?>


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

#define ll long long
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '?') s[i] = 'D';
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3744
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
int i,j,k,t[12][12];
string s[12],u;
map<int,int> p;
while(getline(cin,s[0])){
k=1;p.clear();
for(j=0;j<12;j++)t[0][j]=0;
for(i=1;i<12;i++){
getline(cin,s[i]);
for(j=0;j<12;j++)t[i][j]=0;
}
getline(cin,u);
for(i=0;i<12;i++){
for(j=0;j<12;j++){
if(s[i][j]=='1'){
if((i==0||i>0&&t[i-1][j]==0)&&(j==0||j>0&&t[i][j-1]==0))t[i][j]=k++;
else if((i==0||i>0&&t[i-1][j]==0)&&j>0&&t[i][j-1]!=0)t[i][j]=t[i][j-1];
else if(i>0&&t[i-1][j]!=0&&(j==0||j>0&&t[i][j-1]==0))t[i][j]=t[i-1][j];
else if(i>0&&t[i-1][j]!=0&&j>0&&t[i][j-1]!=0){
if(t[i-1][j]!=t[i][j-1])p.insert(make_pair(t[i-1][j],t[i][j-1]));
t[i][j]=t[i][j-1];
}
}
}
}
cout<<k-1-p.size()<<endl;
}
return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <cmath>

using namespace std;

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

    int total = 0;

    for(int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        total += 2 * min(k - x, x);
    }

    cout << total << '\n';
    

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<double,double> PAIR;
const int N = 5e5+5;
const int INF = 0x3f3f3f3f;

int main() {
	ll n;
	cin>>n;
	cout<<(n/500LL)*1000LL+(n%500LL)/5*5<<endl; 
    return 0;
}

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

struct Node{
  int key;
  int parent;
  int left;
  int right;
};

int h;

void print(Node t[]){
  for(int i=1;i<h+1;i++){
    cout << "node " << i << ": ";
    cout << "key = " << t[i].key << ", ";
    if(t[i].parent != 0) cout << "parent key = " << t[t[i].parent].key << ", ";
    if(t[i].left <= h) cout << "left key = " << t[t[i].left].key << ", ";
    if(t[i].right <= h) cout << "right key = " << t[t[i].right].key << ", ";
    cout << endl;
  }
}

int main(){
  cin >> h;
  Node tree[h+1];
  for(int i=1;i<h+1;i++){
    cin >> tree[i].key;
    tree[i].parent = i/2;
    tree[i].left = i*2;
    tree[i].right = i*2 + 1;
  }
  print(tree);
  return 0;
}



Measured memory_bytes: 3100
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iS = int.Parse(sS[0]);
            int iW = int.Parse(sS[1]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = "safe";
            if(iS <= iW) { sOut = "unsafe"; }

            // 出力
            System.Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 27372
import java.io.*;

public class Main{
    public static void main(String[] arg)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int p,b,f,r,v;
		int room[][]=new int[13][11];

		String str=br.readLine();
		if(str.equals("")) System.exit(0);
		int n=Integer.parseInt(str);
	
		String[] strArray;  
		//Arrays.fill(room,0); //room[][]に初期値0を設定
		
		for(int i=1;i<=n;i++){
			str=br.readLine();
			strArray=str.split(" ");
			b=Integer.parseInt(strArray[0]);
			f=Integer.parseInt(strArray[1]);
			r=Integer.parseInt(strArray[2]);
			v=Integer.parseInt(strArray[3]);
			
			
			room[(b-1)*3+f][r]+=v;
		}
        StringBuilder output = new StringBuilder();
		//出力
        boolean div =false;
 		for (int i=1;i<=12;i++){
			p=1;
			while (p<=10){
				output.append(" "+ room[i][p]);
				p++;
			}
			output.append("\n");
			switch (i){
				case 3:	
					div=true;
					break;
				case 6:
					div=true;
					break;
				case 9:
					div=true;
					break;
				default:div=false;
				break;
			}
			
			if(div==true){
				output.append("####################\n");
				div=false;}
			
		}
 		output.delete(output.length()-1,output.length());
		System.out.println(output);
	}

}

Measured memory_bytes: 19244
#include <iostream>

 

using namespace std;

 

int main()
{
    int a, b ;
    cin >> a >> b;
     if (a > b)
        cout <<"a > b"<< endl;
    else if ( a < b)
        cout <<"a < b"<< endl;
    else 
        cout <<"a == b"<< endl;
}


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

int main() {
	int a,b,c,d;
	cin>>a;
	cin>>b;
	cin>>c;
	cin>>d;
	while(true){
		c-=b;
		if(c<=0) {cout<<"Yes"; break;}
		a-=d;
		if(a<=0) {cout<<"No"; break;}
		
	}
	return 0;
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<int> c(3);
  int count=0;
  
  for(int i=0; i<1000; i++){
    c = {i/100, (i/10)%10, i%10};
    int f=0;
    for(int j=0; j<N; j++){
      if(S.at(j) == ('0' + c.at(f))) f++;
      if(f==3) break;
    }
    if(f==3) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math/big"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int64, n)
	for i := range a {
		fmt.Scan(&a[i])
		if a[i] == 0 {
			fmt.Println(0)
			return
		}
	}

	ans := big.NewInt(1)
	for _, num := range a {
		ans = ans.Mul(big.NewInt(num), ans)
		if ans.Cmp(big.NewInt(1e18)) == 1 {
			fmt.Println(-1)
			return
		}
	}

	fmt.Println(ans)
}


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

namespace Greatest_Common_Divisor
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int[] nums = new int[2];
            nums[0] = int.Parse(input[0]);
            nums[1] = int.Parse(input[1]);

            int temp = 0;
            int temp1 = 0;
            int temp2 = 0;

            if (nums[0] < nums[1])
            {
                int tempX = nums[0];
                nums[0] = nums[1];
                nums[1] = tempX;
            }


            temp = nums[0];
            temp1 = nums[1];
            while (true)
            {
                temp2 = temp % temp1;
                if (temp2 == 0)
                {
                    break;
                }
                temp = temp1;
                temp1 = temp2;
            }

            Console.WriteLine(temp1);

        }
    }
}



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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
    unordered_map<string, int> m;
    rep(i, N){
        string s; cin >> s;
        m[s]++;
    }
    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(void){
    int n,m;
    cin>>n>>m;
    int path[10][10]={};
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        path[a][b]++;
        path[b][a]++;
    }
    vector<int> v;
    for(int i=0;i<n;i++) v.push_back(i);
    int ans=0;
    int i;
    do{
        if(v[0]!=0) break;
        for(i=0;i<n-1;i++){
            if(path[v[i]][v[i+1]]==0) break;
        }
        if(i==n-1) ans++;
    }while(next_permutation(v.begin(),v.end()));
    cout<<ans<<endl;
}

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

typedef complex<double> P;

const double eps = 1e-8;

struct C {
  P p;
  double r;
  C() : p(P(0,0)), r(0) {}
  C(P p, double r) : p(p), r(r) {}
};

double cross(P a, P b) {
  return a.real()*b.imag() - a.imag()*b.real();
}

double dot(P a, P b) {
  return a.real()*b.real() + a.imag()*b.imag();
}

int ccw(P p, P a, P b) {
  a -= p;
  b -= p;
  if(cross(a,b) > eps) return 1;
  if(cross(a,b) < -eps) return -1;
  if(dot(a,b) < -eps) return 2;
  if(norm(b)-norm(a) > eps) return -2;
  return 0;
}

double getDistanceLP(P s1, P s2, P p) {
  return abs(cross(s2-s1,p-s1))/abs(s2-s1);
}

double getDistanceSP(P s1, P s2, P p) {
  if(dot(s2-s1, p-s1) < 0.0) return abs(p-s1);
  if(dot(s1-s2, p-s2) < 0.0) return abs(p-s2);
  return getDistanceLP(s1, s2, p);
}

bool involve(const C &c, const P &s1, const P &s2) {
  double dist = max(abs(c.p - s1), abs(c.p - s2));
  return c.r - dist > -eps;
}

bool involve(const vector<P> &g, const C &c) {
  int n = g.size();
  for(int i = 0; i < n; ++i) {
    P a = g[i], b = g[(i+1)%n];
    double dist = getDistanceLP(a,b,c.p);
    if(cross(b-a, c.p-a) > -eps && dist - c.r > -eps) {
    } else {
      return false;
    }
  }
  return true;
}

bool involve(const C &c, const vector<P> &g) {
  int n = g.size();
  for(int i = 0; i < n; ++i) {
    P a = g[i], b = g[(i+1)%n];
    if(!involve(c, a, b)) return false;
  }
  return true;
}

bool isIntersect(const P &s1, const P &s2, const C &c) {
  if(involve(c, s1, s2)) return false;
  double dist = getDistanceSP(s1, s2, c.p);
  return c.r - dist > -eps;
}

bool isIntersect(const vector<P> &g, const C &c) {
  int n = g.size();
  for(int i = 0; i < n; ++i) {
    P a = g[i], b = g[(i+1)%n];
    if(isIntersect(a,b,c)) return true;
  }
  return false;
}

int main() {
  vector<P> g(3);
  C c;
  while(1) {
    for(int i = 0; i < g.size(); ++i) {
      cin >> g[i].real() >> g[i].imag();
      if(g[0].real() == 0 && g[0].imag() == 0) return 0;
    }
    if(cross(g[1]-g[0], g[2]-g[0]) < 0) swap(g[0], g[1]);
    cin >> c.p.real() >> c.p.imag();
    cin >> c.r;
    if(involve(g,c)) cout << "a" << endl;
    else if(involve(c,g)) cout << "b" << endl;
    else if(isIntersect(g,c)) cout << "c" << endl;
    else cout << "d" << endl;
  }
  return 0;
}

Measured memory_bytes: 1232
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		int z = sc.nextInt();
		int w = sc.nextInt();

		// 文字列の入力
		//String s = sc.next();

		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt();
		}
		int s1 = 0;
		if(n>=2){
			s1 = Math.abs(a[n-2]-a[n-1]);
		}
		int s2 = Math.abs(w-a[n-1]);

		int ans;
		if(s1>=s2 ){
			ans = s1;
		}else{
			ans = s2;
		}

		// 出力
		System.out.println(ans);
	}
}


Measured memory_bytes: 24788
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

mat mat_mul(const mat &A, const mat &B) {//if invalid, assert. taking mod.
	assert((int)A[0].size() == (int)B.size());
	mat C(A.size(), vl(B[0].size()));
	rep(i, 0, (int)A.size()) {
		rep(k, 0, (int)B.size()) {
			rep(j, 0, (int)B[0].size()) {
				C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % mod;
			}
		}
	}
	return C;
}

mat mat_pow(mat A, ll n) {
	mat B((int)A.size(), vl((int)A.size()));
	rep(i, 0, (int)A.size()) {
		B[i][i] = 1;
	}
	while(n > 0) {
		if(n & 1) B = mat_mul(B, A);
		A = mat_mul(A, A);
		n >>= 1;
	}
	return B;
}

int N;
ll K;

void solve() {
	cin >> N >> K;
	mat A(N, vl(N, 0));
	rep(i, 0, N) {
		rep(j, 0, N) {
			cin >> A[i][j];
		}
	}
	auto B = mat_pow(A, K);
	ll res = 0;
	rep(i, 0, N) {
		rep(j, 0, N) {
			ADD(res, B[i][j]);
		}
	}
	cout << res << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



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

int main(){

int a[3][3];
int b = 0;  
  
  for(int i = 0;i < 3;i++)
    for(int j = 0;j < 3;j++){
    cin >> a[i][j];    
    }

{if(((a[1][0] - a[0][0]) == (a[1][1] - a[0][1])) && ((a[1][1] - a[0][1]) == (a[1][2] - a[0][2]))) b++;}
{if(((a[2][0] - a[0][0]) == (a[2][1] - a[0][1])) && ((a[2][1] - a[0][1]) == (a[2][2] - a[0][2]))) b++;} 
{if(((a[0][1] - a[0][0]) == (a[1][1] - a[1][0])) && ((a[1][1] - a[1][0]) == (a[2][1] - a[2][0]))) b++;}
{if(((a[0][2] - a[0][0]) == (a[1][2] - a[1][0])) && ((a[1][2] - a[1][0]) == (a[2][2] - a[2][0]))) b++;}
  
  if(b == 4) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N,M;
int a[21101];
int b[21101];
int c[21101];
vector<int>G[101];//行先
vector<int>cost[101];//辺のコスト
int d[101][101];
int main(){
        REP(i,101){
            REP(j,101){
                d[i][j]=100000000;
            }
            d[i][i]=0;
        }
	cin>>N>>M;
	REP(i,M){
	    cin>>a[i]>>b[i]>>c[i];
	    a[i]--;b[i]--;
	    d[a[i]][b[i]]=c[i];
	    d[b[i]][a[i]]=c[i];
	}
	REP(k,N){
	    REP(i,N){
	        REP(j,N){
	            d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	        }
	    }
	}
	/*REP(i,N){
	    REP(j,N){
	        cout<<d[i][j]<<" ";
	    }
	    cout<<endl;
	}*/
	long long ans=0;
	REP(i,M){
	    if(d[a[i]][b[i]]<c[i])ans++;
	}
	
        cout<<ans<<endl;
	return(0);
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define MIN(c) (*min_element(ALL(c))) 
#define MAX(c) (*max_element(ALL(c)))
#define ACC(c) (accumulate(ALL(c), 0))
#define MP(a, b) (make_pair((a), (b)))
#define ENDL "\n"
#define PRINT(x) cout << (x) << ENDL

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
inline void out(int n) {printf("%d\n", n);}
template<typename T> inline void swap(T& a, T& b) {T tmp = a; a = b; b = tmp;}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    int N, X;
    int L[100];
    cin >> N >> X;
    REP(i, N) cin >> L[i];
    int cnt = 1, D = 0;
    REP(i, N){
        D += L[i];
        if(D > X) break;
        cnt++;
    }
    PRINT(cnt);
    return 0;
}

Measured memory_bytes: 256
<?php
$bunsetus = trim(fgets(STDIN));
$bunsetu = explode(" ", $bunsetus);
$check = 0;
$number = 0;
foreach($bunsetu as $value){
  if($value != $check){
    $number += 1;
    $check = $value;
  }else{
    $check = $value;
  }
}
if($number==3 && $bunsetu[0]==$bunsetu[2]){
  $number = 2;
}
echo $number;
?>

Measured memory_bytes: 3700
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string& s, char c) { vector<string> v; stringstream ss(s); string x; while(getline(ss,x,c)) v.emplace_back(x); return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  string s;
  cin>>s;
  for(char &c:s) if(c==',') c=' ';
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = Integer.parseInt(scan.next());
        int b = Integer.parseInt(scan.next());

        if (a % 2 != 0 && b % 2 != 0) {
            System.out.println("Odd");
        } else {
            System.out.println("Even");
        }
    }
}

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

using namespace std;

int func(int t,int d,int l){
	int res = 0;
	int rem = -1;
	for(int i=0;i<t;++i){
		if(rem>=0){
			++res;
		}
		int x;
		cin >> x;
		if(l<=x){
			rem = d;
		}
		--rem;
	}
	return res;
}

int main(){
	int t,d,l;
	while(cin>>t>>d>>l){
		if(t==0)break;
		cout << func(t,d,l) << endl;
	}
	return 0;
}




Measured memory_bytes: 2996
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
//scanf("%d", &a); '\n'; cout << fixed << setprecision(10);
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int r;
	cin >> r;
	cout << fixed << setprecision(10);
	cout << r*2 * PI;
}

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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

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

long long stoi(string str) {
	long long ret;
	stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

void solve() {
	int n;
	cin >> n;
	vector<int> v,w;
	rep(i, n) {
		int a;
		cin >> a;
		v.push_back(a);
		w.push_back(a);
	}
	sort(v.begin(), v.end());
	int l = v[v.size()/2 - 1], r = v[v.size()/2];
	rep(i, n) {
		if (w[i] <= l) {
			P(r);
		}
		else if (w[i] >= r) {
			P(l);
		}
	}
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 3948
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    N,D=pin()
    cnt=0
    for i in range(N):
        x,y=pin()
        if x**2+y**2<=D**2:
            cnt+=1
    print(cnt)
    
#%%submit!
resolve()


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

int main() {
  int N, M;
  cin >> N >> M;

  int A[50] = {0};

  for (int i = 0; i < N; ++i) {
    int K;
    cin >> K;
    for (int j = 0; j < K; ++j) {
      int a;
      cin >> a;
      ++A[a];
    }
  }

  int ans = 0;
  for (int i = 1; i <= M; ++i) {
    if (A[i] == N) {
      ++ans;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(){

    int N, M, C, i, j, inf=100, breakf=0, ans=0, tmp;
    scanf("%d %d %d", &N, &M, &C);


    int B[M], A[N][M];
    for (i=0; i<M; i++){
        scanf("%d", &B[i]);
    }

    for (i=0; i<N; i++){
        for (j=0; j<M; j++){
            scanf("%d", &A[i][j]);
        }
    }

    for (i=0; i<N; i++){
        tmp = 0;
        for(j=0; j<M; j++){
            tmp += A[i][j] * B[j];
        }
        if ((tmp + C) > 0) ans++;
    }

    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main(){
	int i,j,k,n,m,x;
	long long aa,bb;
	int a[15],b[15],c[15],f[15];
	char s[15],t[15],u;
	for(i=0;i<15;i++)b[i]=0,f[i]=0;
	scanf("%lld%lld%d",&aa,&bb,&n);
	x=0;while(aa>0)a[x]=aa%10,aa=aa/10,x++;
	m=x;
	x=0;while(bb>0)b[x]=bb%10,bb=bb/10,x++;
	x=0;
	for(i=0;i<m;i++){
		if(a[i]-x>=b[i])x=0;
		else{
			x=1;
			f[i+1]=1;
		}
	}
	aa=bb=0;
	for(i=m-1;i>=0;i--){
		if(n>0 && f[i]==1 && (f[i+1]==0 || a[i]-b[i]>=1 || (a[i]-b[i]<0) ) )n--,a[i]++;
		aa=aa*10;aa+=a[i];
		bb=bb*10;bb+=b[i];
	}
	//printf("%lld %lld\n",aa,bb);
	printf("%lld\n",aa-bb);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  bool ans = false;
  rep(i,k+1){
    ll A = a;
    ll B = b;
    ll C = c;
    rep(j,i){
      B *= 2;
    }
    rep(j,k-i){
      C *= 2;
    }
    if(A<B&&B<C){
      ans = true;
    }
  }
  if(ans){
    print("Yes");
  }
  else{
    print("No");
  }
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main(){
    int m,n;
    cin>>m>>n;
    int a[364364]={};
    int b[364364]={};
    bool s1[364364]={false};
    bool s2[364364]={false};
    for(int i = 0;i<n;i++){
        cin>>a[i]>>b[i];
        if(a[i]==1){
            s1[b[i]-1]=true;
        }else if(b[i]==m){
            s2[a[i]-1]=true;
        }
    }
    for(int i = 0;i<n;i++){
        if(s1[i]&&s2[i]){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;
}



Measured memory_bytes: 3840
N = int(input())

ans = {}
L = []
for _ in range(N):
	L.append(input())

for l in L:
	if l in ans:
		ans[l] +=1
	else:
		ans[l] = 1
print("AC x " + str(ans["AC"])) if "AC" in ans else print("AC x 0")
print("WA x " + str(ans["WA"])) if "WA" in ans else print("WA x 0")
print("TLE x " + str(ans["TLE"])) if "TLE" in ans else print("TLE x 0")
print("RE x " + str(ans["RE"])) if "RE" in ans else print("RE x 0")

Measured memory_bytes: 16292
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <iostream>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	Info(){
		value = sche = 0;
	}
	int value,sche;
};

//6:00???0 21:00???15

ll* dp;

void func(int N){
	Info info[N];

	int M,L,start,end;
	bool check[16];

	for(int i = 0; i < N; i++){
		scanf("%d %d",&M,&L);
		info[i].value = L;

		for(int k = 0; k <= 15; k++)check[k] = false;

		for(int k = 0; k < M; k++){
			scanf("%d %d",&start,&end);
			for(int p = start-6; p <= end-7; p++){
				check[p] = true;
			}
		}

		for(int k = 0; k <= 15; k++){
			if(check[k]){
				info[i].sche += pow(2,k);
			}
		}
	}

	dp[0] = 0;

	for(int i = 0; i < N; i++){
		for(int k = 0; k < 65536; k++){
			if(dp[k] != -1 && (k&info[i].sche) == 0){
				dp[k|info[i].sche] = max(dp[k|info[i].sche],dp[k]+info[i].value);
			}
		}
	}

	ll maximum = 0;
	for(int i = 0; i < 65536; i++){
		maximum = max(maximum,dp[i]);
	}

	printf("%lld\n",maximum);

}


int main(){

	dp = new ll[65536];

	int N;
	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		for(int i = 0; i < 65536; i++)dp[i] = -1;

		func(N);
	}

	return 0;
}

Measured memory_bytes: 3896
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef vector<int> vint;
typedef vector<float> vfloat;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vstr> vvstr;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int m, d;
    cin >> m >> d;
    int ans = 0;
    srep(i, m+1, 1) {
        srep(j, d+1, 1) {
            int d1 = j % 10;
            int d10 = (j - d1) / 10;
            if (d1 >= 2 && d10 >= 2 && d1 * d10 == i) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <queue>

typedef long double ld;
typedef long long ll;

using namespace std;

#define MAXN 100010

vector<int> a[MAXN];
int v[MAXN];
int p[MAXN];
queue<int> q;
int n, m;

int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int v1, v2;
		cin >> v1 >> v2;
		a[v1].push_back(v2);
		a[v2].push_back(v1);
	}

	memset(v, 0, sizeof(v));
	memset(p, -1, sizeof(p));
	q.push(1);
	while (!q.empty()) {
		int cur = q.front();
		q.pop();
		for (int i = 0; i < a[cur].size(); i++) {
			int next = a[cur][i];
			if (!v[next]) {
				v[next] = 1;
				q.push(next);
				p[next] = cur;
			}
		}
	}
	cout << "Yes" << endl;
	for (int i = 2; i <= n; i++) {
		cout << p[i] << endl;
	}
	

	return 0;
}


Measured memory_bytes: 10840
#include <iostream>
using namespace std;
int main(){
    string a,b,temp;
    int n;
    cin>>a>>b;
    n=(int)a.size();
    while(a!=b){
        temp=a.back();
        a.pop_back();
        a=temp+a;
        n--;
        if(n<0)break;
    }
    if(a==b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}

Measured memory_bytes: 256
import numpy as np
import copy

if __name__=="__main__":
    inputs_number  = lambda : [int(x) for x in input().split()]
    N, Ma, Mb = inputs_number()
    drugs = [inputs_number() for i in range(N)]
    inf = 100*N + 1
    dp = np.ones((2,N*10+1,N*10+1)).astype(np.int32) * inf
    dp = dp.tolist()
    dp[0][0][0] = 0.0

    for i in range(N):
        for ca in range(10*i+1):
            for cb in range(10*i+1):
                if(dp[0][ca][cb]==inf):
                    continue
                dp[1][ca][cb]=min([dp[1][ca][cb], dp[0][ca][cb]])
                dp[1][ca+drugs[i][0]][cb+drugs[i][1]]=min([dp[1][ca+drugs[i][0]][cb+drugs[i][1]], dp[0][ca][cb]+drugs[i][2]])
        dp[0] = copy.copy(dp[1])
        dp[1] = (np.ones((N*10+1,N*10+1)).astype(np.int32) * inf).tolist()
    ans = inf
    for ca in range(1, N*10+1):
        for cb in range(1, N*10+1):
            if(Ma*cb==Mb*ca and dp[0][ca][cb]<ans):
                ans = dp[0][ca][cb]
    if(ans==inf):
        ans = -1
    print(int(ans))

Measured memory_bytes: 27776
#include<iostream>
using namespace std;
const int N=1e5+9;
int n,a[N];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<n;i++){
        if(a[i]>a[i-1])a[i]--;
        if(a[i]>a[i+1]){
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 640