akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <fstream>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
#include <cassert>
#pragma warning (disable: 4996)
using namespace std;

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

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

struct UnionFind {
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

ll merge_cnt(vector<ll>& a) {
    int n = a.size();
    if (n <= 1) { return 0; }

    ll cnt = 0;
    vector<ll> b(a.begin(), a.begin() + n / 2);
    vector<ll> c(a.begin() + n / 2, a.end());

    cnt += merge_cnt(b);
    cnt += merge_cnt(c);

    int ai = 0, bi = 0, ci = 0;
    while (ai < n) {
        if (bi < b.size() && (ci == c.size() || b[bi] <= c[ci])) {
            a[ai++] = b[bi++];
        }
        else {
            cnt += n / 2 - bi;
            a[ai++] = c[ci++];
        }
    }
    return cnt;
}

int main() {
    ll n;
    cin >> n;
    vector<ll> z(n);
    vector<ll> x(n);
    for (int i = 0; i < n; i++) {
        cin >> z[i];
        cin >> x[i];
    }
    ll a = 0;
    ll b = 123456789012;
    ll c = -123456789012;
    ll d = 123456789012;
    for (int i = 0; i < n; i++) {
        a = max(z[i] + x[i], a);
        b= min(z[i] + x[i], b);
        c = max(z[i] - x[i], c);
        d= min(z[i] - x[i], d);
    }
    cout << max(a - b, c - d) << endl;
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> w(3);
  for(int i=0;i<3;i++){
    cin >> w.at(i);
  }
  bool answer = 0;
    if(w.at(0)==5 && w.at(1)==5&& w.at(2)==7)
      {
      answer = 1; }
  if(w.at(0)==5 && w.at(1)==7 && w.at(2)==5){
    answer =1;}
  if(w.at(0)==7 && w.at(1)==5 && w.at(2)==5)answer=1;
  
  if(answer){
    cout << "YES"<< endl;}
  else{
    cout << "NO" <<endl;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;

int dp[N][3];
int a[N], b[N], c[N];

int main()
{
	ios_base::sync_with_stdio(0);
	int n; cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i] >> b[i] >> c[i];
	dp[1][0] = a[1]; dp[1][1] = b[1]; dp[1][2] = c[1];
	for (int i = 2; i <= n; i++)
	{
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i];
		dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i];
	}
	cout << max(max(dp[n][0], dp[n][1]), dp[n][2]) << endl;
	return 0;
}

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

int main() 
{
	int v[3] = {-1, -1, -1};
	
	int N, M;
	cin >> N >> M;
	N--;
   
	for(int i = 0; i < M; i++){
		int s, c;
		cin >> s >> c;
		s--;
		if(v[s] != -1 && v[s] != c) {cout << -1 << endl; return 0;}
		v[s] = c;
		
	}
	
	if(N == 0 && v[0] <= 0){
		cout << 0 << endl;
		return 0;
	}
	
	// 上位は1パディング
	if(v[0] == -1) v[0] = 1;

	// 下位は0パディング
	for(int i = 1;i <= N; i++){
		if(v[i] == -1) v[i] = 0;
	}
//	cout << v[0] << v[1] << v[2] << endl;

	if(v[0] == 0) {cout << -1 << endl; return 0;}

	int a = 0;
	int m = 1;
	for(int i = 0; i <= N; i++){
		a += v[N - i] * m;
		m *= 10;
	}
	cout << a << endl;

	return 0;
}


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

int main() {
char a, b;
  cin >> a >> b;
  if(a=='H' && b=='H') cout << "H" << endl;
  else if(a=='D' && b == 'D') cout << "H" << endl;
  else cout << "D" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N;
    cin >> N;
    string S;
    cin >> S;
    set<string> sim;
    set<string> com;
    set<string> las;
    REP(i,N){
        for(auto itr = com.begin();itr != com.end();itr++){
            las.insert(*itr + S[i]);
        }
        for(auto itr = sim.begin();itr != sim.end();itr++){
            com.insert(*itr + S[i]);
        }
        sim.insert(S[i] + string());
    }
    cout << las.size() << "\n";
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int x = scan.nextInt();

        int s = x-k+1;
        int e = x+k-1;

        for (int i = s; i <= e; i++) {
            System.out.print(i + " ");
        }

        System.out.println();

    }
}

Measured memory_bytes: 23892
# https://atcoder.jp/contests/arc071/submissions/6325840

from itertools import accumulate

S = tuple(map(lambda x: 1 if x == 'A' else 2, input()))
T = tuple(map(lambda x: 1 if x == 'A' else 2, input()))
# A=1,B=2


acc_s = (0,) + tuple(accumulate(S))
acc_t = (0,) + tuple(accumulate(T))

ans = []
Q = int(input())
for _ in range(Q):
    sl, sr, tl, tr = map(int, input().split())
    diff = (acc_t[tr] - acc_t[tl - 1]) - (acc_s[sr] - acc_s[sl - 1])
    # 添え字-1は変数再代入しない方が20ms速い
    ans.append('YES' if diff % 3 == 0 else 'NO')

print(*ans, sep='\n')
# 逐次printだと1000ms
# 一括だと500ms


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

A=input()
A1=list(A) #文字列Aを一文字ごとにリストに格納
B=input()
B1=list(B)
C=input()
C1=list(C)
x=0
for i in range(0,N):#前から順に文字を調べていく
    if A1[i]==B1[i]==C1[i]:#文字を変えなくてよい時
        continue
    if A1[i]==B1[i] or B1[i]==C1[i] or C1[i]==A1[i]:#3つのうち1つだけ異なるとき(操作は1回)
        x=x+1
    else:#3文字バラバラの時(操作は2回)
        x=x+2
print(x)


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

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ReadInt();
            var x = n % 111;
            if (x == 0)
            {
                WriteLine(n);
            }
            else
            {
                WriteLine(111-x+n);
            }
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11092
import math
n = int(input())
count = 0
for i in range(n):
    a = int(input())
    h = math.trunc(math.sqrt(a))+1
    b = 0
    if a == 1:
        b = 1
    if a == 2:
        b = 0
    elif a % 2 == 0:
        b = 1
    else:
        i = 3
        while i <= h:
            if a % i == 0:
                b = 1
            i += 2
    if b == 0:
        count += 1
print count

Measured memory_bytes: 6668
#include<bits/stdc++.h>
using namespace std;
#define N 111116
#define M 11111116
#define next nxt

int n,m,k,t,dx[N],dy[N],x[M],y[M],next[M],p[N],dfn[N],low[N],h[N],f[N],ans;
stack<int> q;

struct flag{int x,y,z;}a[N];
bool cmp_x(flag a,flag b){return a.x<b.x;}
bool cmp_y(flag a,flag b){return a.y<b.y;}
bool cmp_z(flag a,flag b){return a.z<b.z;}

void add(int a,int b){
	x[++k]=a;y[k]=b;next[k]=p[x[k]];p[x[k]]=k;
	x[++k]=b^1;y[++k]=a^1;next[k]=p[x[k]];p[x[k]]=k;
}

void build(int l,int r){
	int t=(l+r)|(l<r);
	if (l==r) add(2*(n+t),2*dx[l]+1),add(2*(3*n+t),2*dy[l]);
	else {
		int mid=(l+r)/2,
			lc=(l+mid)|(l<mid),
			rc=(mid+1+r)|(mid+1<r);
		add(2*(n+t),2*(n+lc));
		add(2*(n+t),2*(n+rc));
		add(2*(3*n+t),2*(3*n+lc));
		add(2*(3*n+t),2*(3*n+rc));
		build(l,mid);build(mid+1,r);
	}
}

void insert(int k,int l,int r,int x,int y,int z){
	int t=(l+r)|(l<r);
	if (x<=l&&y>=r) add(z,2*(k+t));
	else {
		int mid=(l+r)/2;
		if (x<=mid) insert(k,l,mid,x,y,z);
		if (y>=mid+1) insert(k,mid+1,r,x,y,z);
	}
}

void travel(int x){
	dfn[x]=low[x]=++t;q.push(x);h[x]=1;
	for (int t=p[x];t;t=next[t])
		if (!dfn[y[t]]){
			f[y[t]]=x;travel(y[t]);
			low[x]=min(low[x],low[y[t]]);
		}
		else if (h[y[t]]) low[x]=min(low[x],dfn[y[t]]);
	if (low[x]==dfn[x]){
		int t=q.top();q.pop();
		h[t]=0;f[t]=++m;
		while (t!=x){
			t=q.top();q.pop();
			h[t]=0;f[t]=m;
		}
	}
}

bool check(int d){
	fill(p+2,p+10*n+2,0);
	fill(dfn+2,dfn+10*n+2,0);
	fill(low+2,low+10*n+2,0);
	fill(h+2,h+10*n+2,0);
	fill(f+2,f+10*n+2,0);
	k=0;t=0;build(1,n);
	for (int i=1,l=1,r=0;i<=n;i++){
		while (l<=n&&a[dx[l]].x<=a[dx[i]].x-d) l++;
		while (r<n&&a[dx[r+1]].x<a[dx[i]].x+d) r++;
		if (l>r) continue;
		if (i<l||i>r) insert(n,1,n,l,r,2*dx[i]);
		else {
			if (l<i) insert(n,1,n,l,i-1,2*dx[i]);
			if (i<r) insert(n,1,n,i+1,r,2*dx[i]);
		}
	}
	for (int i=1,l=1,r=0;i<=n;i++){
		while (l<=n&&a[dy[l]].y<=a[dx[i]].x-d) l++;
		while (r<n&&a[dy[r+1]].y<a[dx[i]].x+d) r++;
		if (l>r) continue;
		insert(3*n,1,n,l,r,2*dx[i]);
	}
	for (int i=1,l=1,r=0;i<=n;i++){
		while (l<=n&&a[dx[l]].x<=a[dy[i]].y-d) l++;
		while (r<n&&a[dx[r+1]].x<a[dy[i]].y+d) r++;
		if (l>r) continue;
		insert(n,1,n,l,r,2*dy[i]+1);
	}
	for (int i=1,l=1,r=0;i<=n;i++){
		while (l<=n&&a[dy[l]].y<=a[dy[i]].y-d) l++;
		while (r<n&&a[dy[r+1]].y<a[dy[i]].y+d) r++;
		if (l>r) continue;
		if (i<l||i>r) insert(3*n,1,n,l,r,2*dy[i]+1);
		else {
			if (l<i) insert(3*n,1,n,l,i-1,2*dy[i]+1);
			if (i<r) insert(3*n,1,n,i+1,r,2*dy[i]+1);
		}
	}
	for (int i=2;i<=10*n+1;i++)
		if (!dfn[i]) travel(i);
	for (int i=1;i<=5*n;i++)
		if (f[2*i]==f[2*i+1]) return false;
	return true;
}

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	n=read();
	for (int i=1;i<=n;i++){
		a[i].x=read();
		a[i].y=read();
		a[i].z=i;
	}
	sort(a+1,a+n+1,cmp_x);
	for (int i=1;i<=n;i++) dx[i]=a[i].z;
	sort(a+1,a+n+1,cmp_y);
	for (int i=1;i<=n;i++) dy[i]=a[i].z;
	sort(a+1,a+n+1,cmp_z);
	for (int k=1<<29;k;k/=2)
		if (check(ans+k)) ans+=k;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 37632
N,Q = map(int,input().split())

adj = [list() for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    adj[a-1].append(b-1)
    adj[b-1].append(a-1)

memo = [0]*N
for _ in range(Q):
    p,x = map(int,input().split())
    memo[p-1] += x

stack = [(None,0)]
while stack:
    p,v = stack.pop()
    for u in adj[v]:
        if u != p:
            memo[u] += memo[v]
            stack.append((v,u))

print(*memo)

Measured memory_bytes: 59468
s=str(input())
k=int(input())

l=len(s)
chars=set()
chars1=set()
sub1=['']*l

for j in range(l):
    chars1.add(s[j])
    min_c=sorted(chars1)[0]

def subset(st,m):
    substring=set()
    if m==0:
        lst=len(st)
    else:
        lst=m
    for i in range(lst):
        n=i+1 #length = n
        for j in range(lst-i):
            substring.add(st[j:j+n])
    return substring
    
chars=chars|subset(s[max(l-10,0):],0)
for i in range(l):
    if s[i]==min_c:
        chars=chars|subset(s[i:i+5],0)

#print(min_c,chars)

'''
for i in range(l):
    n=i+1 #length = n
    for j in range(l-i):
        chars.add(s[j:j+n])
        #print('i,j,sub',i,j,s[j:j+n])
'''

print(sorted(chars)[k-1])

Measured memory_bytes: 3316
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

from operator import itemgetter
def index_sort(A):
    x = []
    for i,a in enumerate(A):
        x.append((a,i))
    return sorted(x, key=itemgetter(0),reverse=True)

n = I()
a = III()

A = index_sort(a)
amax = A[0][0]
index = A[0][1]

temp = float('inf')
for i in range(n):
    if i==index:
        continue
    if abs(amax/2 - a[i])<abs(amax/2 - temp):
        temp = a[i]

print(amax,temp)

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

#define ALL(a)  (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
typedef long long ll;
const ll INF = 1LL<<60;
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; }
using pint = pair<int, int>;
using pstring = pair<int, string>;

int main() {
    ll R, G, B, K;
    cin >> R >> G >> B >> K;

    bool flg = false;
    REP(i, K) 
    {
        if( G <= R) { G *= 2; }
        else if ( G >= B) { B *= 2; }
    }
    if( R < G and G < B ) {
        flg = true;
    }

    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main()
{
    int n[4];
    int cnt[11] = {};
    rep(i, 0, 4) {
        cin >> n[i];
        cnt[n[i]]++;
    }
    if (cnt[1] == 1 && cnt[9] == 1 && cnt[7] == 1 && cnt[4] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
using namespace std;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> vp;
typedef vector<tuple<ll, ll, ll>> vt;

//vector<vector<ll>> vv(n, vector<ll>(n));

typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

ll extgcd(ll a, ll b)
{
	ll x = 1, y = 0, u = 0, v = 1;
	while (b > 0) {
		ll q = a / b;
		ll tmp = u; u = x - q * u; x = tmp;
		tmp = v; v = y - q * v; y = tmp;
		tmp = b; b = a - q * b; a = tmp;
	}
	return a;
}

ll lcm(ll m, ll n)
{
	if (!m || !n)
		return 0;
	return ((m / extgcd(m, n)) * n);
}

Graph g;

int main()
{
	ll n, k;
	cin >> n >> k;
	vp va;
	REP(i, n)
	{
		ll a, b;
		cin >> a >> b;
		va.emplace_back(a, b);
	}
	sort(ALL(va));
	ll pos = 0;
	for (auto i : va)
	{
		pos += i.second;
		if (pos >= k)
		{
			cout << i.first << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 2420
#include <iostream>
using namespace std;
long long N, A[87],Money = 1000;
int main() {
	cin >> N;
	for (int i = 1; i <= N; i++)
  		cin >> A[i];
	for (int i = 1; i <= N - 1; i++) {
	long long Stocks = 0;
	if (A[i] < A[i + 1]) Stocks =Money / A[i];
	Money += (A[i + 1] - A[i]) * Stocks;
	}
	cout << Money << endl;
}

Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
unsigned long long ar[101];
int n,count =0;
cin>>n;
for(int i=0;i<n;i++)
cin>>ar[i];

for(int i=0;i<n-2;i++)
{
    for(int j=i+1;j<n-1;j++)
    {
        for(int k=j+1;k<n;k++)
        {   

        bool temp = (((ar[i]!=ar[j]) && (ar[i] != ar[k]) && (ar[k] != ar[j]))&&(ar[i] + ar[j] > ar[k]) && (ar[i] + ar[k] > ar[j]) && (ar[j] + ar[k] > ar[i]));

            if(temp)
             count++;
        //  cout<<ar[i]<<" : "<<ar[j]<<" : "<<ar[k]<<endl;
        }
    }
}
cout<<count<<endl;

return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define fastio() ios_base::sync_with_stdio(false);
using namespace std;
typedef long long ll;
typedef long double ld;


int main(){
	fastio();
	int n; cin >> n;
	int mn = 1e9;
	int ans = 0;
	for(int i = 0; i<n; i++){
		int x; cin >> x;
		mn = min(mn, x);
		if (x == mn) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std; 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define ll long long 
ll gcd(ll a,ll b)
{
	return b==0?a:gcd(b,a%b);
}
int main(int argc, char** argv) {
	int T;
	cin>>T;
	while(T--)
	{
		ll a,b,c,d;
		cin>>a>>b>>c>>d;	if(b>a||b>d)
		{
			printf("No\n");
			continue;
		}
		if(c>=b)
		{
			printf("Yes\n");
			continue;
		}
		ll p=gcd(b,d);
		a=a%b;
	
		ll e=((c-a)/p)*p+a;
	//	cout<<e<<endl; 
		if(e<=c)e+=p;//第一个大于c的 
	//	cout<<e<<endl;
		if(e<b)printf("No\n");
		else printf("Yes\n");
	} 
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#include <set>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>

#define mod 1e9+7
#define mp make_pair
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,x;
    cin >> n >> x;
    ll ans = 0;
    ll c = 0;
    vector<ll> l(n);
    rep(i, n) cin >> l[i];
    rep(j, n){
        ans++;
        c += l[j];
        if(x<c) break;
    }
    if(x>=c) ans++;
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class c
{
    static void Main()
    {
        {
            int n = int.Parse(Console.ReadLine());
            var a = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
            var x = 0l;
            var sum = a.Sum();
            for (int i = 0; i < n; i++)
            {
                x += a[i];
                if (x >= sum / 2)
                {
                    Console.WriteLine(Math.Min(2 * x - sum, sum - 2 * x + 2 * a[i]));
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 35408
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
LL n,array1[2*N];
LL solve(LL num){
    LL sum=num,counter=0;
for(LL i=1;i<n;++i){
     LL temp_sum=sum+array1[i];
     if(sum>0){
        if(temp_sum>=0){
            counter+=temp_sum+1;
            temp_sum=-1;
        }
     }
     else if(sum<0){
        if(temp_sum<=0){
            counter+=abs(temp_sum)+1;
            temp_sum=1;
        }
     }
     sum=temp_sum;
}
   return counter;
}
int main()
{
LL i,sum=0;
scanf("%lld",&n);
for(i=0;i<n;++i){
    scanf("%lld",&array1[i]);
}
LL mini;
if(array1[0]==0){
        mini=min(solve(1),solve(-1))+1;
}
else{
    LL choice1=solve(array1[0]);
    LL choice2=(array1[0]>0)?solve(-1)+array1[0]+1:solve(1)+abs(array1[0])+1;
    mini=min(choice1,choice2);
}
printf("%lld",mini);



    return 0;
}


Measured memory_bytes: 4576
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        StringBuilder sb = new StringBuilder();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        double a,b,c;
        for(int i=0;i<n;i++){
            String[] str = (br.readLine()).split(" ");
            a = Math.pow(Integer.parseInt(str[0]),2);
            b = Math.pow(Integer.parseInt(str[1]),2);
            c = Math.pow(Integer.parseInt(str[2]),2);
            if(a+b==c || a+c==b || b+c==a){
                sb.append("YES\n");
            }
            else{
                sb.append("NO\n");
            }
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 25104
using System;

public class Hello
{
    public static void Main()
    {
        Console.ReadLine();
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var q = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < q; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var b = int.Parse(line[0]);
            var e = int.Parse(line[1]);
            var t = int.Parse(line[2]);
            for (int j = 0; j < e -b; j++)
                swap(a, b + j, t + j);
        }
        print(a);
    }
    public static void print (int [] a)
    {
        var aL = a.Length;
        for (int i = 0; i < aL; i++)
            if (i == aL - 1) Console.WriteLine(a[i]);
            else Console.Write("{0} ", a[i]);
    }
    public static void swap (int [] a, int i  , int j)
    {
        var w = a[i];
        a[i] = a[j];
        a[j] = w;
    }
}


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

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


Measured memory_bytes: 3636
#include <stdio.h>
int main(void){
char s[10];
  scanf("%s",&s);
  if(s[0]=='A'){printf("T");}
    if(s[0]=='C'){printf("G");}
    if(s[0]=='G'){printf("C");}
    if(s[0]=='T'){printf("A");}
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<long>h(n);
  for(int i=0;i<n;i++)cin>>h[i];
  vector<long>a(m);
  vector<long>b(m);
  for(int i=0;i<m;i++)cin>>a[i]>>b[i];
  vector<bool>go(n,true);
  for(int i=0;i<m;i++){
    if(go[a[i]-1]==true||go[b[i]-1]==true){
      long k=h[a[i]-1];
      long l=h[b[i]-1];
      if(k<=l)go[a[i]-1]=false;
      if(l<=k)go[b[i]-1]=false;
    }
  }
  long co=0;
  for(int i=0;i<n;i++){
    if(go[i]==true)co++;
    
  }
  cout<<co<<endl;
}
      

Measured memory_bytes: 5572
#include <stdio.h>
#define N 100

int main(){
  int M[N][N];
  int n,i,j,u,k,v;

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

  for(i = 0;i < n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j = 0;j < k;j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }

  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      if(j) printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 640
MOD = 10 ** 9 + 7

S = int(input())
dp = [0] * (S + 1)
dp[0] = 1
for i in range(3, S + 1):
    if i >= 1:
        dp[i] += dp[i - 1]
    if i >= 3:
        dp[i] += dp[i - 3]
    dp[i] %= MOD
print(dp[S])


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

int main() {
	string s; cin >> s;
	string check[16] = { "AKIHABARA","AKIHABAR","AKIHABRA",
		"AKIHBARA","KIHABARA","AKIHABR","AKIHBAR","AKIHBRA",		
		"KIHABAR","KIHABRA","KIHBARA","AKIHBR","KIHABR",
		"KIHBAR","KIHBRA","KIHBR" };
	
	for (int i = 0; i < 16; i++) {
		if (check[i] == s) { cout << "YES" << endl; return 0; }		
	}
	cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define vl          vector<ll>
#define vi          vector<int>
#define pi          pair<int,int>
#define pl          pair<ll,ll>
#define all(a)      a.begin(),a.end()
#define mem(a,x)    memset(a,x,sizeof(a))
#define pb          push_back
#define mp          make_pair
#define F           first
#define S           second
#define endl 		"\n"
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define fast_io     std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define trace(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1) {std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " : " << arg1;
	ZZ(comma, args...);
}

void solve() {
	int n;
	cin >> n;
	vi a(n + 1), s(n + 1, 0), x(n + 1, 0);
	rep(i, 1, n + 1) {
		cin >> a[i];
	}
	rep(i, 1, n + 1) {
		s[i] = a[i] + s[i - 1];
		x[i] = x[i - 1] ^ a[i];
	}
	int l = 1;
	ll ans = 0;
	rep(i, 1, n + 1) {
		while ((s[i] - s[l - 1]) != (x[i]^x[l - 1]))l++;
		ans += (i - l + 1);
	}
	cout << ans;
}
int main() {
	fast_io;
	int t = 1;
	// cin>>t;
	while (t--) {
		solve();
	}
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 5544
#!/usr/bin/env python3
import sys
def multiple_sum(x, n):
    # x + 2x + ... + kx(<= n)
    k = n // x
    return x * (k + 1) * k // 2


def solve(N: int):
    ans = 0
    for i in range(1, N + 1):
        ans += multiple_sum(i, N)
    print(ans)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == "__main__":
    main()


Measured memory_bytes: 63464
v, e = map(int, input().split())

adjacency_list = [[] for i in range(v)]

queue = []
deg = [0] * v

for _ in range(e):
    s, t = map(int, input().split())
    adjacency_list[s].append(t)
    deg[t] += 1
    
for i in range(v):
    if deg[i] == 0:
        queue.append(i)
        print(i)
        
while queue:
    vertex = queue.pop(0)
    for v in adjacency_list[vertex]:
        deg[v] -= 1
        if deg[v] == 0:
            queue.append(v)
            print(v)


Measured memory_bytes: 8660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



double sum = 0;
int n;
vector<pair<double, double> > v;

double calc(int a, int b) {
    return sqrt((v[a].F - v[b].F) * (v[a].F - v[b].F) + (v[a].S - v[b].S) * (v[a].S - v[b].S));
}

void dfs(int d, vector<int> used, int now, double s) {
    // cout << d << " " << now << " " << s << endl;
    if (d == n) {
        sum += s;
        // cout << s << endl;
    }
    rep(i, n) {
        if (used[i]) continue;
        if (d != 0 && i == now) continue;
        used[i] = 1;
        dfs(d + 1, used, i, s + (d == 0 ? 0 : calc(now, i)));
        used[i] = 0;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    
    /*
    int a, b, c;
    cin >> a >> b >> c;
    */
    
    /*
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    */
    
   
    
    cin >> n;
    v.resize(n);
    rep(i, n) cin >> v[i].F >> v[i].S;
    vector<int> used(n);
    dfs(0, used, 0, 0);
    double kai = 1;
    rep3(i, 1, n + 1) kai *= i;
    cout << fixed << setprecision(7) << sum / kai << endl;
}


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

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug { 
    ($($a: expr),*) => { 
        println!(concat!($(stringify!($a)," = {:?}, "),*), $($a),*);
    } 
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

fn solve() {
    let (n, m, c) = get!(usize, usize, i64);
    let b = read::<i64>();
    let mut count = 0;
    for _i in 0..n {
        let a = read::<i64>();
        let mut sum = 0;
        for j in 0..m {
            sum += a[j]*b[j];
        }
        if sum + c > 0 {
            count += 1;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 8572
#include<stdio.h>
int search( int A[],  int n, int key){
   int i=0;
   A[n]=key;
   while( A[i]!=key)
  i++;
   return i != n;
}
int main(){
  int i,n,A[10000+1],q,key,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
    }
  scanf("%d",&q);
  for(i=0;i<q;i++)
    {
      scanf("%d",&key);
      if( search(A,n,key))
	sum++;
    }
 printf("%d\n",sum);
  return 0;
}



Measured memory_bytes: 2048
#include <stdio.h>

int main(void)
{
  int a, b, d, r;
  double f;

  scanf("%d %d", &a, &b);

  d=a/b;
  r=a%b;
  f=1.0*a/b;

  printf("%d %d %f\n", d, r, f);

  return 0;
}

Measured memory_bytes: 636
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int i,p=2001,ps,js,j=2001,g;
	for(i=0;i<3;i++)
	{
		cin>>ps;
		if(p>ps)
			p=ps;
	}
	for(i=0;i<2;i++)
	{
		cin>>js;
		if(j>js)
			j=js;
	}
	g=p+j-50;
	cout<<g<<endl;	
	return 0;
}

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

int main()
{
  string s;
  cin >> s;
  int i, j;
  int ch = 0;
  int ans = 0;
  for(i = 1; i <= s.size()/2-1; i++)
  {
    ch = 0;
    for(j = 0; j < i; j++)
    {
      if(s.at(j) != s.at(j+i))
      {
        ch = 1;
        break;
      }
    }
    if(ch == 0)
    {
      ans = i * 2;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

string s;
int i;

int main (){

    cin >> s;

    while(i < s.size()){
        if(s[i] == 'T' && s[i - 1] == 'S'){
            s.erase(s.begin() + i - 1);
            s.erase(s.begin() + i - 1);
            --i;
        }
        else if(s[i] == 'S' && s[i + 1] == 'T'){
            s.erase(s.begin() + i);
            s.erase(s.begin() + i);
        }
        else i++;
    }

    cout << s.size();

    return 0;
}



Measured memory_bytes: 640
function Main(input) {
  var line = input.split(' ');
  var A = Number(line[0]);
  var B = Number(line[1]);
  var C = Number(line[2]);

  var swap = A;
  A = B;
  B = swap;
  swap = A;
  A = C;
  C = swap;
  console.log(`${A} ${B} ${C}`);
}

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


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

using namespace std;
typedef long long ll;
int main(void) {
  ll N, ans = 0;
  cin >> N;
  for (ll a = 1; a < N; a++) {
    ll bcnt = (N - 1) / a;
    ans += bcnt;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 1000005
#define SAFE_FREE(ptr) if( ptr != NULL ){ free(ptr); ptr = NULL; }
typedef unsigned int UINT;
#define ll long long
typedef pair<int, int> P;

bool prime[MAX_N];

void solve()
{
	memset(prime, true, sizeof(prime));
	prime[0] = prime[1] = false;
	FOR(i, 2,(int)sqrt(MAX_N))
	{
		if (prime[i] == true)
		{
			for (int j = 2; j*i <= 1000000; j++){
				if (prime[i*j] == true)prime[i*j] = false;
			}
		}
	}
}

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

		int ans = 0;

		solve();
		REP(i, n + 1){
			if (prime[i] == true){
				ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2144
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#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(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

template <typename T>
long long gcd(T x, T y){
	return y==0 ? x : gcd(y, x%y);
}


template <typename T>
long long lcm(T x, T y){
	return x/gcd(x,y)*y;
}

int main()
{
	ios_init();
	LL a, b, c, d;
	while(cin >> a >> b >> c >> d) {
		LL l = lcm(c, d);
		auto cnt = [&](LL x) -> LL {
			return (b) / x  - (a-1) / x;
		};
		DEBUG(cnt(c)); DEBUG(cnt(d));
		DEBUG(cnt(l));
		cout << (b - a + 1) - (cnt(c) + cnt(d) - cnt(l)) << endl;
	}
	return 0;
}


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

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            //ここから

            int X = IO.ReadLineToInt();

            int ans=0;

            if (X >= 2100)
            {
                ans = 1;
            }
            else
            {
                for(int i = 1; i < 21; i++)
                {
                    if(100*i <=X && X<= 105 * i)
                    {
                        ans = 1;
                    }
                }
            }

            //ここまで

            Console.WriteLine(ans);
            Console.ReadKey();
        }

    }

    static class Func
    {
        static public long mod = 1000000007;
        static public void Swap<T>(ref T a, ref T b) { T temp = a; a = b; b = temp; }
        static public long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }
        static public long LCM(long a, long b) { return (long)a * b / GCD(a, b); }
        static public long Factorial(long a) { return a == 1 ? a : a * Factorial(a - 1); }


        public static double ToAngle(this double radian)
        {
            return (double)(radian * 180 / Math.PI);
        }

        public static double ToRadian(this double angle)
        {
            return (double)(angle * Math.PI / 180);
        }

        static public long Conbination(long n,long m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * Conbination(n - 1, m - 1) / m;
        }

        static public void Factoring(long num, ref long[] vs)
        {
            if (num == 1)
            {
                vs[1]++;
            }
            for (long i = 2; i < Math.Sqrt(num); i++)
            {
                if (num % i == 0)
                {
                    vs[i]++;
                    Factoring(num / i, ref vs);
                }
            }
            vs[1]++;
        }
    }

    static class IO
    {
        static public string ReadLineToString() { return Console.ReadLine(); }

        static public int ReadLineToInt() { return int.Parse(Console.ReadLine()); }
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> ReadLineToStringList() { return Console.ReadLine().Split(' ').ToList(); }

        static public List<int> ReadLineToIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }

        static public List<double> ReadLineToDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }

        static public void WriteStrings(object[] strings) { foreach (var o in strings) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 11092
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = Integer.parseInt(sc.next());
    int y = Integer.parseInt(sc.next());
    if(flagJudge(x) == flagJudge(y)){
      if(flagJudge(x) != 0){
        System.out.println("Yes");
      }
    }else{
      System.out.println("No");
    }
  }
   
  private static int flagJudge(int a){
    int flag = 0;
    if(a == 2){
  	}else if(a == 1 || a == 3 || a == 5 || a == 7 || a == 8 || a == 10 || a == 12){
      flag = 1;
    }else{
      flag = 2;
    }
    return flag;
  }
}  
      
      

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

using namespace std;

int main()
{
	int n = 3;
	vector<int> arr(n);
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}

	sort(arr.begin(), arr.end());

	cout << (arr[1] * arr[0]) / 2 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int net[15][15],n,m;
int main(){
	int i,j,k,x,sum=0;;
	scanf("%d %d",&n,&m);
	for(i=0;i<10;i++){
		for(j=0;j<10;j++)	scanf("%d",&net[i][j]);
	}
	for(k=0;k<10;k++){
		for(i=0;i<10;i++){
			if(k==i)	continue;
			for(j=0;j<10;j++){
				if(i==j || k==j)	continue;
				if(net[i][k]+net[k][j]<net[i][j]){
					net[i][j]=net[i][k]+net[k][j];
				}
			}
		}
	}
	for(i=0;i<n*m;i++){
		scanf("%d",&x);
		sum+=net[x][1];
	}
	printf("%d\n",sum);
	return 0;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll x, y, z;
	ll ans = 1;
	ll sum = 0;

	cin >> x >> y >> z;

	sum = y + 2 * z;

	ans += (x - sum) / (y + z);

	cout << ans << endl;
}

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

#define BUF_SIZE 40

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

void setbit(int *bits, int idx) {
    *bits |= (1<<idx);
}

char getbit(int *bits, int idx) {
    return (*bits) & (1<<idx);
}

#define MAX_NUM 15

int main(void) {
    int num = get_int();
    int i, j;
    int check[MAX_NUM] = {0};
    int opinion[MAX_NUM] = {0};
    for(i = 0; i < num; i++) {
        int es = get_int();
        for(j = 0; j < es; j++) {
            int idx, yn;
            // idx: 1-indexed number
            get_int2(&idx, &yn);
            setbit(&check[i], idx-1);
            if(yn) setbit(&opinion[i], idx-1);
        }
    }
#ifdef DEBUG
    for(i = 0; i < num; i++) {
        printf("check: %d; op: %d\n", check[i], opinion[i]);
    }
#endif

    int pattern;
    int max = 0;
    for(pattern = 0; pattern < (1<<num); pattern++) {
        int cnt = __builtin_popcount(pattern);
        if(cnt <= max) continue;
        // assume that cnt > max
        // do check
        for(i = 0; i < num; i++) {
            // if person i is dishonest, skip
            if(!(pattern & (1<<i))) continue;
            // if contradiction, set flag to be 0
            if(((check[i] & pattern) ^ opinion[i]) != 0) {
                cnt = 0;
                break;
            }
        }
        // update max
        max = cnt > max ? cnt : max;
    }
    printf("%d\n", max);
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc;// = new Scanner(System.in);
        sc = new Scanner(System.in);
        int n = sc.nextInt();
        int f[][][] = new int[4][3][10];
        for(int a=0;a<4;a++){
            for(int b=0;b<3;b++){
                for(int c=0;c<10;c++){
                    f[a][b][c] = 0;
                }
            }
        }
        for(int i=0;i<n;i++){
            sc.nextLine();
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            f[a-1][b-1][c-1] += sc.nextInt();
        }
        for(int a=0;a<4;a++){
            for(int b=0;b<3;b++){
                for(int c=0;c<10;c++){
                    System.out.print(" "+f[a][b][c]);
                }
                if(a<3 || b < 2){
                    
                }
                System.out.println();
            }
            if(a<3){
                for(int i=0;i<20;i++)System.out.print("#");
                System.out.println();
            }
            
        }
    }
}


Measured memory_bytes: 30300
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int a, b;
    std::cin>>a>>b;

    std::string ans;
    if(a == b){
        ans = "Draw";
    }else if(a == 1 || (a > b && b != 1)){
        ans = "Alice";
    }else{
        ans = "Bob";
    }
    std::cout<<ans<<std::endl;
    return 0;
}

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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	cout << min(a, k) - max(0, k - a - b) << endl;
	return 0;
}


Measured memory_bytes: 3612
#include<stdio.h>

int main(void) {

	int N, i, c = 0;
	int H[20];
	int count = 0;

	scanf("%d", &N);

	while (i < N) {
		scanf("%d", &H[i++]);
	}
	i = 0;
	int top = H[0];
	while (c < N) {
		if (top <= H[i]) {
			count++;
			top = H[i];
			c++;
			i++;
		}
		else {
			i++;
			c++;
		}
	}
	printf("%d", count);
	return 0;

}

Measured memory_bytes: 128
def kaibunChk(txt):
    txtLen = len(txt)
    for si in range(txtLen):
        if txt[si] != txt[txtLen - si - 1]:
            print("No")
            exit()


s = input()
slen = len(s)
clen = slen // 2

kaibunChk(s)
kaibunChk(s[:clen])
kaibunChk(s[clen + 1:])

print("Yes")

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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

template <typename T>
T mypow(T a, T b) {
  if (b == 0) return 1;
  T tmp = mypow(a, b / 2);
  if (b % 2)
    return (((tmp * tmp) % MOD) * a) % MOD;
  else
    return (tmp * tmp) % MOD;
}

const ll NMAX = 100010;
vector<ll> fact(NMAX + 1, 1), sum(NMAX + 1, 0);

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

  for (ll i = 1; i < NMAX; i++) {
    fact[i] = fact[i - 1] * i % MOD;
  }
  ll n;
  cin >> n;
  sum[0] = fact[n - 1];
  for (ll i = 1; i < n; i++) {
    sum[i] = sum[i - 1] + fact[n - 1] * mypow(i + 1, MOD - 2) % MOD;
    sum[i] %= MOD;
  }
  vector<ll> x(n), dif(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  ll ret = 0;
  for (int i = 0; i < n - 1; i++) {
    dif[i] = x[i + 1] - x[i];
    ret += dif[i] * sum[i] % MOD;
    ret %= MOD;
  }
  cout << ret << endl;
}


Measured memory_bytes: 3456
if __name__ == '__main__':
	n = int(input())

	cnt = 0
	ans = 0
	for x in range(1,n+1,2):
		cnt = 0
		for y in range(1,x+1):
			if x % y == 0:
				cnt += 1
		if cnt == 8:
			ans += 1

	print(ans)


Measured memory_bytes: 9116