akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i)=0; (i) <= (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }

int N, M;
int S[2001];
int T[2001];

int dp[2001][2001];



//---------- 1000000007 ----------
const int MOD = 1000000007;
int m_add(int a, int b)
{
	return (a + b) % MOD;
}
int m_sub(int a, int b)
{
	return (a + MOD - b) % MOD;
}
int m_mul(int a, int b)
{
	return (a * b) % MOD;
}
int m_pow(int x, int n)
{
	if (n == 0) return 1;
	ll res = m_pow((x * x) % MOD, n / 2);
	if (n & 1) res = (res * x) % MOD;
	return res;
}
int m_div(int a, int b)
{
	return m_mul(a, m_pow(b, MOD - 2));
}
int m_comb(int n, int r)
{
	int i;
	int p = 1;
	for (i = 1; i <= r; i++)
	{
		p = m_mul(p, (n - i + 1));
		p = m_div(p, i);
	}
	return p;
}
int m_comb_with_rep(int n, int r)
{
	return m_comb(n + r - 1, r);
}
int m_perm(int n, int r)
{
	int a = 1;
	for (int i = n; i > n - r; i--)
	{
		a = m_mul(a, i);
	}
	return a;
}




signed main()
{
	cin >> N >> M;
	REP(i, N) cin >> S[i];
	REP(i, M) cin >> T[i];

	for (int m = 0; m < M; m++)
	{
		if (S[0] == T[m]) dp[0][m] = 1;
	}

	for (int n = 1; n < N; n++)
	{
		int sum = 0;
		for (int m = 0; m < M; m++)
		{
			if (S[n] == T[m])
			{
				dp[n][m] = m_add(dp[n][m], (sum + 1));
			}
			dp[n][m] = m_add(dp[n][m], dp[n - 1][m]);

			sum = m_add(sum, dp[n - 1][m]);
		}
	}

	int ans = 0;
	for (int m = 0; m < M; m++)
	{
		ans = m_add(ans, dp[N - 1][m]);
	}
	cout << (ans + 1) << endl;
}



Measured memory_bytes: 34864
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int N = 210;
char a[N],b[N];
int main()
{
    int t=0,q=0,ans;
    scanf("%s%s", a,b);
    for (int i = 0; i < strlen(a); i++)
    {
        t = t * 10 + a[i] - '0';
    }
    for (int i = 0; i < strlen(b);i++)
    {
        q = q * 10 + b[i] - '0';
    }
    int temp = pow(10, strlen(b));
    ans = (temp*t)+q;
    int sum = sqrt(ans);
    if(sum*sum==ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

// Math
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

signed main(){
    int N, T, A;
    cin >> N >> T >> A;
    vector<int> hs(N);
    vector<double> ts(N);
    rep(i, N) {
        cin >> hs[i];
        ts[i] = abs(A-(T-hs[i]*0.006));
    }
    cout << distance(begin(ts), min_element(be(ts)))+1 << nl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int N,R,T,p[1000],iti[1000]={0},y[1000]={0},ky[1000]={0};
    cin>>N>>R>>T;
    for(int i=0;i<N;i++)cin>>p[i];
    for(int i=0;i<T;i++){



        int iticou[1000]={0};
        for(int j=0;j<N;j++){
            iti[j]=(iti[j]+p[j])%R;
            iticou[iti[j]]++;
        }//?§????

        if(i){
            for(int j=0;j<N;j++)ky[iti[j]]++;
        }
        //i???0?????????????????°????????¨????????????(??????)

        //for(int j=0;j<R;j++)printf("[%d]",ky[j]);
        //puts("ky");

        for(int j=0;j<R;j++){
            y[j]=max(y[j],iticou[j]);
            y[j]-=iticou[j];
        }
        //?°´????£????
        for(int j=0;j<R;j++){
            y[j]+=ky[j];
            ky[j]=0;
        }//????????¨????°´??\????????¨????????´



        //for(int j=0;j<R;j++)printf("[%d]",y[j]);
        //puts("");
    }
    int ans=0;
    for(int i=0;i<R;i++)ans+=y[i];
    cout<<ans+N<<endl;
}

Measured memory_bytes: 1180
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(n,l,r):
        a = [I() for _ in range(n)]
        c = 0
        for t in range(l,r+1):
            k = -1
            for i in range(n):
                if t % a[i] == 0:
                    k = i
                    break
            if k < 0:
                k = n
            if k % 2 == 0:
                c += 1

        return c

    while 1:
        n,m,l = LI()
        if n == 0:
            break
        rr.append(f(n,m,l))

    return '\n'.join(map(str, rr))


print(main())



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

a=[0]*10**4

for x in range(1,100):
     for y in range(1,100):
         for z in range(1,100):
             n=(x+y+z)**2-(x*y+y*z+z*x)
             if n<=10000:
                 a[n-1]+=1

for n in range(N):
    print(a[n])







Measured memory_bytes: 9332
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf8");

let lines = [];
var reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on("line", line => {
  lines.push(line.split(/\s/).map(i => parseInt(i)));
});

reader.on("close", () => {
  let n = lines.shift()[0];
  let l = lines[0];
  let max = Math.max(...l);
  l.splice(l.indexOf(max), 1);
  let sum = l.reduce((a, i) => a + i);
  console.log(max < sum ? "Yes" : "No");
});


Measured memory_bytes: 21320
#include<stdio.h>

int main(void) {
	int n, i, a;
	int min, max;
	long sum = 0;
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++) {
		scanf("%d", &a);
		if(i==0) {
			min = a;
			max = a;
		} else if(a > max) {
			max = a;
		} else if(a < min) {
			min = a;
		}
		
		sum+=a;
	}
	
	printf("%d %d %ld\n", min, max, sum);
	
	return 0;
}

Measured memory_bytes: 600
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YY cout << "Yes" << endl;
#define NN cout << "No" << endl;
#define ve vector
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
void dfs(Graph_weighted &G,vector<ll> &dist,int now){
  for(auto i : G[now]){
    if(dist[i.first] != -1)continue;
    dist[i.first] = (dist[now] + i.second) % 2;
    dfs(G,dist,i.first);
  }
  return;
}
int solve(){
  int n;
  cin >> n;
  Graph_weighted G(n);
  rep(i,n - 1){
    int a,b,c;
    cin >> a >> b >> c;
    a--;
    b--;
    G[a].push_back({b,c});
    G[b].push_back({a,c});
  }
  vector<ll>dist(n,-1);
  dist[0] = 0;
  dfs(G,dist,0);
  rep(i,n)cout << dist[i] << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}


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

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

    vector<ll> arr(n);
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr.begin(), arr.end());

    ll sum = arr.back(), cnt = 0, pos = n-2;
    while (cnt < n-2) {
        sum += arr[pos];
        cnt++;
        if (cnt < n-2) {
            sum += arr[pos];
            pos--;
            cnt++;
        }
    }
    cout << sum << endl;
}

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

int main(){
  int64_t a, b, x;
  cin >> a >> b >> x;
  
  if(a == 0){
    cout << b/x + 1 << endl;
  } else {
    cout << b/x - (a-1)/x << endl;
  }
} 

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <math.h>
int minimum(int a, int b) { return a < b ? a : b; }
int maximum(int a, int b) { return a > b ? a : b; }
const long long mod = 1000000007;
//const long long mod = 998244353;
std::vector<int> path;
int _path(std::vector<int>*v, int f, int t, int n = -1, int b = -1) {
	if (n == -1) {
		path.clear();
		n = t;
	}
	for (int i = 0; i < v[n].size(); i++) {
		if (v[n][i] == b)continue;
		if (v[n][i] == f) {
			path.push_back(f);
			path.push_back(n);
			return n;
		}
		if (_path(v, f, t, v[n][i], n) != -1) {
			path.push_back(n);
			return n;
		}
	}
	return -1;
}
int main() {
	int N;
	scanf("%d", &N);
	auto a = new int[N - 1];
	auto b = new int[N - 1];
	auto m = new int*[N];
	for (int i = 0; i < N; i++)m[i] = new int[N];
	auto v = new std::vector<int>[N];
	for (int i = 0; i < N - 1; i++) {
		scanf("%d %d", a + i, b + i);
		a[i]--;
		b[i]--;
		v[a[i]].push_back(b[i]);
		v[b[i]].push_back(a[i]);
		m[a[i]][b[i]] = i;
		m[b[i]][a[i]] = i;
	}
	int M;
	scanf("%d", &M);
	auto s = new int[M];
	auto t = new int[M];
	for (int i = 0; i < M; i++) {
		scanf("%d %d", s + i, t + i);
		s[i]--;
		t[i]--;
	}
	auto p = new std::vector<int>[M];
	for (int i = 0; i < M; i++) {
		_path(v, s[i], t[i]);
		for (int j = 0; j < path.size() - 1; j++) {
			p[i].push_back(m[path[j]][path[j + 1]]);
		}
	}
	//long long res = 1LL << (N - 1);
	long long res = 0;
	auto c = new bool[N] {};
	for (int z = 0; z < 1 << M; z++) {
		for (int i = 0; i < N; i++)c[i] = false;
		long long y = 0;
		for (int i = 0; i < M; i++) {
			if (z&(1 << i)) {
				y ^= 1;
				for (int j = 0; j < p[i].size(); j++) {
					c[p[i][j]] = true;
				}
			}
		}
		int cnt = 0;
		for (int i = 0; i < N; i++)if (c[i])cnt++;
		//printf("%lld\n", (1 - y * 2)*(1LL << (N - 1 - cnt)));
		res += (1 - y * 2)*(1LL << (N - 1 - cnt));

	}
	printf("%lld", res);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#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 <iterator>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {

	//入力
	int N, M, X;
	cin >> N >> M >> X;

	vector<int> A(M);
	for (int i = 0; i < M; i++) {
		cin >> A[i];
	}

	int cost_l = lower_bound(A.begin(), A.end(), X) - A.begin();
	int cost_r = M - cost_l;
	cout << min(cost_l, cost_r);
	return 0;
}

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

int main() {
	int x, y;
	cin >> x >> y;

	while (1) {
		int a, b;
		a = x / y;
		b = x % y;

		if (!b) {
			cout << y << endl;
			break;
		}
		else {
			x = y;
			y = b;
		}
	}
}


Measured memory_bytes: 3084
/* abc_171_c */

#include<stdio.h>
#include<math.h>

int main()
{
  long long N;
  int t,s,i;
  long long p[20],q[20],a[20],b[20],d[20];
  char c[20];
  b[0]=1;
  d[0]=1;
  for(i=0;i<=10;i++){
    b[i+1]=26*b[i];
    d[i+1]+=b[i+1];
  }
  t=1;
  scanf("%lld",&N);
  for(i=10;i>=0;i--){
    if(N>=d[i]){
      s=i;
      break;
    }
  }
  a[0]=N-1;
  p[0]=a[0]/26;
  q[0]=a[0]%26;
  if(p[0]>0){
    for(i=0;i<20;i++){
      if(p[i]>0){
        t++;
        a[i+1]=p[i]-1;
        p[i+1]=a[i+1]/26;
        q[i+1]=a[i+1]%26;
      } else break;
    }
  }
  for(i=t-1;i>=0;i--){
    c[i]='a'+q[i];
    printf("%c",c[i]);
  }
  printf("\n");
  /*a[s]=N-d[s];
  p[s]=a[s]/26;
  q[s]=a[s]%26;
  if(p[s]>0){
    for(i=s-1;i>=0;i--){
      p[i]=p[i+1]/26;
      q[i]=p[i+1]%26;
    }
  }
  for(i=s;i>=0;i--){
    c[i]='a'+q[i];
    printf("%c",c[i]);
  }
  printf("\n");*/
  return 0;
}


Measured memory_bytes: 1640
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}



signed main(){

    int N; cin >> N;
    vec A(N); readv(A);
    int f = 0, ans = 1;
    FOR(i, 1, N){
        if(A[i] > A[i - 1]){
            if(f == 0) f = 1;
            else if(f == -1){
                ans++;
                f = 0;
            }
        }else if(A[i] < A[i - 1]){
            if(f == 0) f = -1;
            else if(f == 1){
                ans++;
                f = 0;
            }
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1024
S = input()
A = [0] * (len(S)+1)

sstreak = 0
bstreak = 0
for i in range(len(S)):
  if S[i] == "<":
    if 0 < bstreak:
      A[i-bstreak] = max(bstreak, sstreak)
      bstreak -= 1
      while 0 < bstreak:
        A[i-bstreak] = bstreak
        bstreak -= 1
      sstreak = 0
    A[i] = sstreak
    sstreak += 1
  else:
    bstreak += 1
i+=1
if S[-1] == "<":
  A[i] = sstreak

if 0 < bstreak:
  A[i-bstreak] = max(bstreak, sstreak)
  bstreak -= 1
  while 0 < bstreak:
    A[i-bstreak] = bstreak
    bstreak -= 1

print(sum(A))

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

using namespace std;

#define INF 1e9
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

ll N,M;

void solve(){
    cout << (M-1)*(N-1) << endl;
}

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

    solve();
}


Measured memory_bytes: 256
import copy
n = int(input())
arr_ori = ["3", "5", "7"]
arr_tmp = ["3", "5", "7"]
arr_all = ["3", "5", "7"]
arr_753 = []
# arr_tmp = ["357", "375", "537", "573", "735", "753"]

for i in range(1, 9):
    for i in arr_ori:
        for j in arr_all:
            arr_tmp.append(i + j)
    arr_all = copy.deepcopy(arr_tmp)

arr_all = list(set(arr_all))

for i in range(len(arr_all)):
    if "3" in arr_all[i]:
        if "5" in arr_all[i]:
            if "7" in arr_all[i]:
                arr_753.append(arr_all[i])

arr_753 = [int(i) for i in arr_753]
arr_753 = sorted(arr_753)

for i in range(len(arr_753)):
    if int(arr_753[i]) > n:
        print(i)
        break
    elif i == len(arr_753)-1:
        print(i + 1)
        break

Measured memory_bytes: 20732
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int d, c;

int main(){
	cin >> d >> c;
	cout << d*c << endl;
}

Measured memory_bytes: 1160
import sys
sys.setrecursionlimit(2000000)
def func(c,x):
    c[x][0] = 1
    for i in c[x][1:]:
        if c[i][0] == 0:
            func(c,i)
    return c

# 入力
N,M = map(int,input().split())
XYZ = list(list(map(int,input().split()))for i in range(M))
############################################
card = [[0]for i in range(N)]
set = 0
############################################
# グラフを描く
for x,y,z in XYZ:
    card[x-1].append(y-1)
    card[y-1].append(x-1)
############################################
for i in range(N):
    if card[i][0] == 0:
        set += 1
        card = func(card,i)
############################################
print(set)

Measured memory_bytes: 138612
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int h,w,sum=0,result=10000000;
  cin>>h>>w;
  int a[h][w];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>a[i][j];
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      for(int k=0;k<h;k++){
	for(int l=0;l<w;l++){
	  if(abs(i-k)<=abs(j-l)) sum+=a[k][l]*abs(i-k);
	  else sum+=a[k][l]*abs(j-l);
	}
      }
      if(result>sum) {
	result=sum;
      }
      sum=0;
    }
  }
  cout<<result<<endl;
  return 0;
}
   
 
      
 
  
   
  
	
	  
	  
	  
	  
	  
	  
     
  
  
  
  
  

  

 
  


 

    
  



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

int n,num[110] = {};
cin >> n;
for (int i = 0; i < n; i++){
int nun;
cin >> nun;
num[nun]++;
}
  int ans = 0;
for (int i = 0; i <= 100; i++){
if(num[i] != 0){
ans++;
}
}
  
cout << ans << endl;

return 0;
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (
        a + b == c ||
        b + c == a ||
        c + a == b
       ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

int h,m;
char c;
string sta;

int main(){
    int n,t;cin>>n>>t;
    cin>>h>>c>>m;
    cin>>sta;

    vector<int> ans_t;
    vector<string> ans_sta;
    rep(i,n-1){
        int lh,lm;
        int ah,am;
        cin>>lh>>c>>lm;
        cin>>sta;
        cin>>ah>>c>>am;
        cin>>sta;
        int dt=60*(ah-lh)+(am-lm);
        //printf("%s %d:%d %d:%d %d\n",sta.c_str(), lh,lm,ah,am,dt);
        if(dt>=t) {
            ans_t.push_back(dt);
            ans_sta.push_back(sta);
        }
    }
    cout<<ans_t.size()<<endl;
    rep(i,ans_t.size()){
        cout<<ans_sta[i]<<" "<<ans_t[i]<<endl;
    }
}

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

int main()
{
	int n, x;
	vector<int> array;

	cin >> n;

	for (int i = 0; i < n; ++i)
	{
		cin >> x;
		array.push_back(x);
	}

	for (vector<int>::size_type i = array.size() - 1; i != 0; --i)
		cout << array[i] << " ";

	cout << array[0] << endl;

	return 0;
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C;
    cin >> A >> B >> C;
    int answer = 0;
    answer = max(answer, A * 10 + B + C);
    answer = max(answer, B * 10 + A + C);
    answer = max(answer, C * 10 + A + B);
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
function Main(input) {
    var longest = 0;
    var current = 0;
    for(var i = 0; i < input.length; i++) {
        if(input[i] == "A" || 
        input[i] == "T" || 
        input[i] == "C" || 
        input[i] == "G"){
            current++;
            continue;
        }
        if(current > longest) longest = current;
        current = 0;
    }
    if(current > longest) longest = current;
    console.log(longest);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 9420
#include <iostream>
#include <cmath>
#include <string>
using namespace std;

int main(){
    int A,B;
    int sum = 0;
    cin >> A >> B;
    for(int i=0; i<2;i++){
        if(A > B){
            sum += A;
            A -= 1;
        }else{
            sum += B;
            B -= 1;
        }
    }
    cout << sum << endl;
}


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

int main()
{
    int n;
    cin >> n;
    vector<vector<int>> tree(n);
    vector<vector<int>> cost(n);

    for(int i = 0; i < n-1; ++i)
    {
        int u,v,w;
        scanf("%d %d %d",&u,&v,&w);
        --u;
        --v;
        tree[u].push_back(v);
        cost[u].push_back(w);
        tree[v].push_back(u);
        cost[v].push_back(w);
    }

    vector<int> answer(n,-1);
    stack<int> st;
    vector<bool> len(n);
    answer[0] = 0;
    st.push(0);
    len[0] = false;
    while(!st.empty())
    {
        int current = st.top();
        st.pop();
        for(int i = 0; i < (int)tree[current].size(); ++i)
        {
            int to = tree[current][i];
            if(answer[to] != -1)
            {
                continue;
            }
            bool isOdd = len[current] ^ (cost[current][i]%2!=0);
            if(isOdd)
            {
                answer[to] = 1;
            }
            else
            {
                answer[to] = 0;
            }
            st.push(to);
            len[to] = isOdd;
        }
    }

    for(int num : answer)
    {
        printf("%d\n",num);
    }
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rrepn(i, n) for (int i = ((int)(n)); i > 0; --i)
#define SZ(x) ((int)(x).size())
template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
vector<pair<string, P>> vec;
// vector<vector<int>> data(3, vector<int>(4));

int main() {
    int D;
    cin >> D;
    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(D, vector<int>(26));
    rep(i, D) rep(j, 26) cin >> s[i][j];

    vector<int> t(D);
    // rep(i, D) {
    //     cin >> t[i];
    //     t[i]--;
    // }

    rep(i, D) {
        int now = 0;
        rep(j, 26) {
            if (now <= s[i][j]) {
                now = s[i][j];
                t[i] = j;
            }
        }
    }

    auto scoring = [&]() {
        vector<int> last(26);
        int score = 0;
        rep(i, D) {
            score += s[i][t[i]];
            last[t[i]] = i + 1;
            int m = 0;
            rep(j, 26) m += c[j] * (i + 1 - last[j]);
            score -= m;
            // cout << score << endl;
        }
        return score;
    };

    int score = scoring();
    srand((unsigned int)time(NULL));
    rep(i, 200000) {
        int d = rand() % D;
        int q = rand() % 26;
        int old = t[d];
        t[d] = q;
        int now = scoring();
        if (score > now) {
            t[d] = old;
        } else {
            score = now;
        }
    }

    rep(i, D) { cout << t[i] + 1 << endl; }
    return 0;
}


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

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


int main() {
    int N; cin >> N;
    if(N<=999) cout << "ABC" << endl;
    else cout << "ABD" << endl;
    return 0;
}

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

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;

    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            string s;
            cin >> s;
            if (s == "snuke") {
                auto c = (char) ('A' + j);
                cout << c << (i + 1) << endl;
                return 0;
            }
        }
    }
}


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

int main(){
    string s;
    cin >> s;
    if (s.size() % 2)
    {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < s.size(); i += 2)
    {
        if (s[i] != 'h' || s[i + 1] != 'i')
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


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

int main() {
	string O, E;
	cin >> O >> E;
	for (int i = 0;i < E.length();i ++) {
		cout << O[i] << E[i];
	}
	if (O.length() > E.length()) cout << O[O.length() - 1];
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

要するにOとEから交互に1文字ずつ持って来ればいい
ただ、気を付けなくてはいけないのは、最後にOの方が一文字多い時
コーナーケースはこれしかないので、最後にOが一文字多いならそれを表示して終わり

ところで、すぬけ君のかわりにパスワードを復元しているんですが、これすぬけ君パスワード盗まれていますよね？
*/

Measured memory_bytes: 256
from collections import Counter

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

c = Counter(A)

hen = []

for i,j in zip(c.keys(),c.values()):
    if 2 <= j <= 3:
        hen.append([i,2])
    elif j >= 4:
        hen.append([i,4])


hen.sort(reverse=True)

##print(hen)
ans = 0
finished = False
choosen = False

for i,j in hen:
    if j == 2:
        if choosen:
            ans *= i
            finished = True
            break
        else:
            ans = i
            choosen = True
    else:
        if choosen:
            ans *= i
            finished = True
            break
        else:
            ans = i**2
            finished = True
            break

print(ans if finished else 0)

Measured memory_bytes: 18600
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rt return 0
#define endln "\n"
#define for1(i, a, b) for (long long int i = a; i < b; i++)
#define for2(i, a, b) for (long long int i = a; i > b; i--)
//  cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;typedef long long int i;
typedef long long int lli;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli k, n;
    cin >> k >> n;
    // cin >> t;
    vector<lli> v;
    for1(i, 0, n)
    {
        lli o;
        cin >> o;
        v.pb(o);
    }
    lli ma = 0;
    for1(i, 1, n)
    {
        if (v[i] - v[i - 1] > ma)
        {
            ma = v[i] - v[i - 1];
        }
    }
    lli x = k - v[n - 1] + v[0];
    ma = max(ma, x);
    cout << k - ma << endl;
}

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

int main() {
    long long q, h, s, d, n, fmin, smin, ans;
    cin >> q >> h >> s >> d;
    cin >> n;
    fmin = min({q*4, h*2, s});
    smin = min(fmin*2, d);
    ans = (n / 2)*smin + (n % 2)*fmin;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string a, b;
  cin >> a >> b;
  reverse(all(a));
  if (a == b)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 3576
module Main where

import           Control.Monad

main :: IO ()
main = do
    [h, _] <- (map read . words) <$> getLine :: IO [Int]
    list   <- map (map read . words) <$> (replicateM h) getLine :: IO [[Int]]
    let res1    = (map goRight . enumerate2d) list
    let list2   = (map snd) res1
    let result1 = (concatMap fst) res1
    let res2    = (goRight . map last) list2
    let result2 = fst res2
    let result  = concat [result1, result2]

    putStr
        $ (unlines . (((show . length) result) :) . map
              (unwords . (\((a, b), (c, d)) -> (map show) [a, b, c, d]))
          )
              result

    return ()
goRight
    :: [((Int, Int), Int)] -> ([((Int, Int), (Int, Int))], [((Int, Int), Int)])
goRight []           = ([], [])
goRight [x         ] = ([], [x])
goRight (a : b : xs) = if (even . snd) a
    then mapSnd (a :) (goRight (b : xs))
    else
        let res = goRight (mapSnd (+ 1) b : xs)
        in  ((fst a, fst b) : (fst res), mapSnd (subtract 1) a : (snd res))

enumerate :: [a] -> [(Int, a)]
enumerate = zip [1 ..]

enumerate2d :: [[a]] -> [[((Int, Int), a)]]
enumerate2d =
    (map (\(y, a) -> (map (\(x, b) -> ((y, x), b)) . enumerate) a) . enumerate)

mapTuple :: (t1 -> a) -> (t2 -> b) -> (t1, t2) -> (a, b)
mapTuple f1 f2 (a, b) = (f1 a, f2 b)

mapFst :: (t1 -> a) -> (t1, b) -> (a, b)
mapFst = flip mapTuple id

mapSnd :: (t2 -> b) -> (a, t2) -> (a, b)
mapSnd = mapTuple id


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

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)


int main(int argc, char const *argv[])
{
	int a, b; cin >> a >> b;
	int d = b - a;
	int sum = 0;
	reps(i, 1, d) sum += i;
	
	printf("%d\n", sum - a);
	return 0;
}

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

long long combi(long long,long long);
long long modpow(long long,long long);

int main(){
    long long n,a,b,sum=1,i,mod=1000000007;scanf("%lld%lld%lld",&n,&a,&b);
    sum=modpow(2,n);//2^(10^9)=140625001
    sum--;
    
    sum=sum-combi(n,a);
    sum=sum-combi(n,b);
    
    sum=sum%mod;

    if(sum>=0){
        printf("%lld\n",sum);
    }else{
        printf("%lld\n",sum+mod);
    }
    return 0;
}

long long combi(long long n,long long r){
    long long ans,i,under=1,up=1,mod=1000000007;
    for(i=1;i<=r;i++){
        under=under*i;
        under=under%mod;
    }
    under=modpow(under,mod-2);
    
    for(i=1;i<=r;i++){
        up=up*(n-i+1);
        up=up%mod;
    }
    ans=up*(under%mod);
    return ans%mod;
}

long long modpow(long long a,long long n){ 
    long long mod=1000000007;
    if(n==1) return a%mod;
    if(n%2==1) return (a*modpow(a,n-1))%mod;
    long long t=modpow(a,n/2);
    return (t*t)%mod;
}

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair

int main() {
  int k;
  string s;
  cin>>k>>s;
  if(s.size()<=k) cout<<s<<endl;
  else cout<<s.substr(0,k)<<"..."<<endl;
}


Measured memory_bytes: 3584
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

bool check(ull n){
	bool exist[]={false, false, false};
	while(n>0){
		int k=n%10;
		exist[(k-3)/2]=true;
		n/=10;
	}
	return exist[0]&&exist[1]&&exist[2];
}

ull cnt(ull n, ull k){
	if(k>n) return 0;
	ull rtn=0;
	if(check(k)) rtn=1;
	for(int i=3; i<=7; i+=2){
		rtn+=cnt(n, 10*k+i);
	}
	return rtn;
}

int main(){
	ull n;
	cin >> n;
	cout << cnt(n, 0) << endl;
	return 0;
}

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

using namespace std;

#define MAX_N  101
#define MAX_W   100001
int N, W;
long long  Lookup[MAX_N][MAX_W];
int wei[MAX_N];
long long val[MAX_N];

long long Knapsack(int c,int  n){
	if(c==0|| n==0)return 0;
	if(Lookup[n][c]!=-1) return 	Lookup[n][c];
	if(c-wei[n]>=0)
		return Lookup[n][c] = max(Knapsack(c-wei[n],n-1)+val[n],Knapsack(c,n-1));
	return Knapsack(c,n-1);
	}
void fillDp(){
	for(int i =0;i<MAX_N;i++){
		for (int j=0;j<MAX_W;j++)
			Lookup[i][j]=-1;
	}	
}

int main(int argc, char** argv) 
{
	cin>>N>>W;
	for (int i =1;i<=N;i++){
		cin>>wei[i]>>val[i];
	}
	fillDp();
	cout<<Knapsack(W,N)<<endl;

	return 0;
}


Measured memory_bytes: 79104
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
int n;
inline int read(){
	int ans=0,k=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')k=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=(ans<<3)+(ans<<1)+(c-'0');c=getchar();}
	return ans*k;
}
int main(){
	n=read();
	if(!(n&(n-1))){
		printf("No");
		return 0;
	}
	printf("Yes\n");
	if(n%4==0){
		for(register int i=1;i<n-1;i++){
			printf("%d %d\n",i,i+1);
			printf("%d %d\n",i+n,i+n+1);
		}
		printf("%d %d\n",n-1,n+1);
		printf("%d %d\n",n,(n&(-n))+1);
		printf("%d %d\n",n+n,n+(n^(n&(-n))));
		return 0;
	}
	if(n%4==1){
		for(register int i=1;i<n-2;i++){
			printf("%d %d\n",i,i+1);
			printf("%d %d\n",i+n,i+n+1);
		}
		printf("%d %d\n",n-2,n+1);
		printf("%d %d\n",n-1,1);
		printf("%d %d\n",n,n-1);
		printf("%d %d\n",n+n,1);
		printf("%d %d\n",n+n-1,n+n);
		return 0;
	}
	if(n%4==2){
		for(register int i=1;i<n-3;i++){
			printf("%d %d\n",i,i+1);
			printf("%d %d\n",i+n,i+n+1);
		}
		printf("%d %d\n",n-3,n+1);
		printf("%d %d\n",n-2,1);
		printf("%d %d\n",n-1,n-2);
		printf("%d %d\n",n+n-1,1);
		printf("%d %d\n",n+n-2,n+n-1);
		printf("%d %d\n",n,n+n-1);
		printf("%d %d\n",n+n,2);
		return 0;
	}
	if(n%4==3){
		for(register int i=1;i<n+n;i++)printf("%d %d\n",i,i+1);
		return 0;
	}
	return 0;
} 

Measured memory_bytes: 2816
s = input().strip()
ans = [-1,-1]
if len(s)==2:
    if s[0]==s[1]:
        ans = [1,2]
else:
    for i in range(len(s)-2):
        if len(set(s[i:i+3]))==2:
            ans = [i+1,i+3]
            break
print(ans[0], ans[1])

Measured memory_bytes: 41196
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


show_flg = True
show_flg = False


def main():
    N = I()
    A = LI()
    a = [0] * N
    a[0] = A[0]

    for i in range(1, N):
        if i % 2 == 1:
            a[0] -= A[i]
        else:
            a[0] += A[i]

    for i in range(1, N):
        a[i] = 2 * A[i-1] - a[i-1]

    print(*a)


if __name__ == '__main__':
    main()


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

int main(){
	int a,b;
	while(true){
		cin >> a >> b;
		if(a == 0 && b == 0)break;
		if(a > b)cout << b <<" " << a << endl;
		else cout << a << " " << b << endl;
		
	}
}

Measured memory_bytes: 1160
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,K,S=map(int,input().split())
    l=[S]*K+[S+1 if S+1<=10**9 else S-1]*(N-K)
    print(*l)
              

if __name__ == '__main__':
    main()


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

const ll MOD = (ll)1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    ll ans = 0;
    for (ll k = K; k <= N + 1; ++k) {
        ll min_sum = (k - 1) * k / 2;
        ll max_sum = (N + N - k + 1) * k / 2;
        ans = (ans + max_sum - min_sum + 1) % MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3596
N, M = map(int, input().split())
H = list(map(int, input().split()))
A = []
B = []
result = [1]*N
for i in range(M):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

for a, b in zip(A, B):
    if H[a-1] <= H[b-1]:
        result[a-1] = 0

for a, b in zip(B, A):
    if H[a-1] <= H[b-1]:
        result[a-1] = 0

print(result.count(1))

Measured memory_bytes: 22852
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#define ll long long
#define inf 20021225
#define mxn 200100
using namespace std;

int h,w,n,cnt;
struct node{int x,y;}p[mxn];
set<int> st[mxn];int ans;
void dfs(int x,int y,int stp)
{
	if(x>h||y>w)	return;
	set<int>::iterator it=st[y].lower_bound(x);
	if(it!=st[y].end())	ans=min(ans,stp+(*it)-x);
	it=st[y+1].find(x+1);
	if(it==st[y+1].end())
	{
		if(st[y].find(x+1)==st[y].end())	dfs(x+1,y+1,stp+1);
	}
	else	dfs(x+1,y,stp+1);
}
int main()
{
	scanf("%d%d%d",&h,&w,&n);ans=h;
	for(int i=1;i<=n;i++)
		scanf("%d%d",&p[i].x,&p[i].y),st[p[i].y].insert(p[i].x);
	dfs(1,1,0);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 20608
n=int(input())
w=[[]for i in range(n)]
for i in range(n):
  a,b=map(int,input().split())
  w[i]=[a,b]
w.sort(key=lambda x: x[1])
dl=0
t=0
for a,b in w:
  t+=a
  dl=b
  if dl<t:
    print('No')
    exit()
print('Yes')

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// テーブルを作る前処理
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        ll num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

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

    vector<int> b(N);

    int max_a = 0;
    REP(i,N){
        int a;
        cin >> a >> b[i];
        chmax(max_a,a);
    }
    sort(all(b),greater<>());

    int ans = 0;
    REP(i,N){
        if(max_a < b[i]){
            H -= b[i];
            ans++;
        } else {
            break;
        }

        if(H <= 0) break;
    }

    if(H <= 0) {
        pl(ans)
    } else {
        pl(ans + (H+max_a-1)/max_a)
    }
    
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<
//        pair<long long, int>, // change type
//        null_type,
//        less<pair<long long, int> >, // change type
//        rb_tree_tag,
//        tree_order_statistics_node_update>
//        ordered_set;

//template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
#define rep(i, start, end) for(int i = start; i < end; ++i)
#define sz(x) (int)(x).size()
#define pb push_back
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define clr(d, v) memset(d, v, sizeof(d))
#define pii pair<int, int>
#define debug(x) cerr << #x << " : " << (x) << endl
const double PI = 3.14159265358979323846;
const double eps = (1e-5);
int isGreater(long double x, long double y)
{
    if (abs(x - y) < eps)
        return 0;
    if (x > y)
        return 1;
    return -1;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int ans = n/2 - !(n&1);
    cout << ans << '\n';
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int ans=0;
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    if(a.at(i)%2==1 && i%2==0)
    ans++;
  }
  cout << ans << endl;

}



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

int main() {
  int A, B; cin >> A >> B;
  int ans = 0;
  rep2(i, A, B+1) {
    string i_str = to_string(i);
    if (i_str[0] == i_str[4] && i_str[1] == i_str[3]) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

int main() {
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  int ans = 0;
  if (N <= K) {
    cout << N * X << endl;
  } else {
    cout << K * X + (N - K) * Y << endl;
  }
}


Measured memory_bytes: 256
using System;

public class Hello{
    public static void Main(){
        
        int line = int.Parse (Console.ReadLine());
        
        int count = 0;
        for (int i = 0; i < line; ++i){
            
            int num = int.Parse (Console.ReadLine());
            if (isPrime(num)){
                
                count++;
            }
        }
        
        Console.WriteLine (count);
    }
    
    public static bool isPrime (int num){
        
        	int k=0;
        	if (num < 2){return false;}
        	if (num == 2){return true;}
        	
        	 int squareroot = (int)Math.Sqrt(num);


    	for(int j=2;j<=squareroot;j++)
		{
			if(num%j==0)
			{
				k=1;
				break;
			}
		}

		if(k==0){
		  //   Console.WriteLine (num + "isPrime");
		    return true;
		}else{
		    return false;
		}
    }
}

Measured memory_bytes: 8988
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> PA;
typedef priority_queue<int> PQ;
typedef vector<int> VE;
#define int long long
#define INF 1000000009
#define mod 1000000007
#define pb push_back
#define MAXN 100005

int n, m, imos[MAXN], ans = 1;
PA c[MAXN];

signed main()
{
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        c[i] = PA(a, b);
    }
    sort(c, c + m);
    int r, l;
    l = c[0].first;
    r = c[0].second;
    for(int i = 1; i < m; i++){
        if(l <= c[i].first && c[i].second <= r){
            l = c[i].first;
            r = c[i].second;
        }
        else if(l <= c[i].first && c[i].first < r){
            l = c[i].first;
        }
        else if(l < c[i].second && c[i].second <= r){
            r = c[i].second;
        }
        else{
            ans++;
            l = c[i].first;
            r = c[i].second;
        }
        //printf("i:%lld l:%lld r:%lld\n", i, l, r);
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#define eol '\n';
using namespace std;

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

  int N,W;
  cin >> N >> W;
  int* v = new int[N];
  int* w = new int[N];

  for (int i = 0; i < N; i++) {
    cin >> v[i] >> w[i];
  }

  int** dp = new int*[N+1];
  for (int i = 0; i <= N; i++) {
    dp[i] = new int[W+1];
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= W; j++) {
      dp[i+1][j] = dp[i][j];
      if (j - w[i] >= 0) {
        dp[i+1][j] = max(dp[i+1][j], dp[i][j-w[i]] + v[i]);
      }
      if (i == N - 1) {
        ans = max(ans, dp[i+1][j]);
      }
    }
  }

  cout << ans << eol;

  return 0;
}

Measured memory_bytes: 5104
n = int(input())
w = [input() for _ in range(n)]

ans = "Yes"
for i in range(n-1):
    if w[i][-1] != w[i+1][0]:
        ans = "No"
        break
    elif w.count(w[i]) != 1:
        ans = "No"
        break
print(ans)

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

#define ll long long
#define LL long long
#define ULL unsigned long long 
#define ull unsigned long long 
#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--)


using namespace std;

int main()
{

	double a, b, tmp,ans;
	cin >> a >> b;
	ans = a*b;
	ans /= 3.305785;
	printf("%f\n", ans);
	return 0;
}

Measured memory_bytes: 1228
#include <stdio.h>

int main(){
  int A,B,C;
  int S=0;
  scanf("%d %d %d",&A,&B,&C);
  if(A==B) S++;
  if(B==C) S++;
  if(C==A) S++;
  if(S==1) printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s);i<(e);i++)
#define rep(i,n) REP(i,0,n)

int main(void) {
    int R, D, X;
    cin >> R >> D >> X;

    int i = 0;
    do {
        X = R * X - D;
        cout << X << endl;
        i++;
    } while (i < 10);
}


Measured memory_bytes: 256