akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if((a == b && a != c) || (a ==c && b != c) || (b == c && a != c)){
    cout << "Yes" << endl;
  }else{
    cout << "No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
const ll mei = (ll)1e9 + 7;

int main(){
  string s, t;
  cin >> s;
  if(s == "Sunny")
    t = "Cloudy";
  if(s == "Cloudy")
    t = "Rainy";
  if(s == "Rainy")
    t = "Sunny";
  cout << t << endl;
}

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

using namespace std;

double judge(double, double, double, double, double, double);

int main() {

	double xa, ya, ra, xb, yb, rb, N, ans;

	cin >> N;

	for(int i=0; i<N; i++) {
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		ans=judge(xa, ya, ra, xb, yb, rb);
		cout << ans << endl;
	}

	return 0;

}

double judge(double xa, double ya, double ra, double xb, double yb, double rb) {

	double d=sqrt(pow(xa-xb, 2)+pow(ya-yb, 2));

	if(ra+rb<d)
		return 0;
	else if(abs(ra-rb)>d)
		return ra>rb ? 2 : -2;
	else
		return 1;

}

Measured memory_bytes: 0
import math

N, M = map(int, input().split())

if abs(N - M) > 1:
    print(0)
    exit()
else:
    x = math.factorial(min(N, M))
    if N == M:
        ans = 2 * x * x % (10 ** 9 + 7)
    else:
        ans = x * x * max(N, M) % (10 ** 9 + 7)
    print(ans)

Measured memory_bytes: 5188
#include "bits/stdc++.h"
using namespace std;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define nl cout<<"\n"
#define endl "\n"
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
typedef long long ll;
typedef unsigned long long ull ;
typedef long double ld;
inline ll max(ll a,ll b) {return ((a>b)?a:b);}
inline ll min(ll a,ll b) {return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b) {if(b==0) return a;a%=b;return gcd(b,a);}
ll power(ll x, ll y) { if (y == 0) return 1;  ll a = power(x,y/2);if (y % 2 == 0) return a * a; else return x * a * a; }
ll powermod(ll x, ll ex , ll md) {ll ans = 1ll;while (ex > 0) {    if (ex & 1ll) ans = (ans * x) % md;    ex >>= 1ll;x = (x * x) % md;}return ans;}
const ll inf = 1e18 + 9;
const ll mod = 1e9 + 7;
const long double eps = 1e-9;
const ll N = 1e6 + 1;

void solve(){
	 ll a , b;
	 cin >> a >> b;
	 cout << a*b << endl;
}
int main(){
    IOS;
    cout<<fixed<<setprecision(20);
    ll T=1;
    // cin>>T;
    ll t=0;
    while(t++<T){
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3796
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
//#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define printP(x) "(" << (x).first << ", " << (x).second << ")"
#define mod 1000000007
using namespace std;
typedef pair<int, int> P;

llint n;
vector<llint> G[100005];

llint dfs(int v)
{
	if(G[v].size() == 0) return 0;
	vector<llint> vec;
	for(int i = 0; i < G[v].size(); i++){
		vec.push_back(dfs(G[v][i]));
	}
	sort(vec.rbegin(), vec.rend());
	
	llint ret = 0;
	for(int i = 0; i < vec.size(); i++) ret = max(ret, vec[i]+i+1);
	return ret;
}

int main(void)
{
	cin >> n;
	llint p;
	for(int i = 2; i <= n; i++){
		cin >> p;
		G[p].push_back(i);
	}
	cout << dfs(1) << endl;
	
	return 0;
}


Measured memory_bytes: 15104
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define double long double
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{//cout<<"Case #"<<T1<<": ";
    int n;
    cin>>n;
    VI ans(n+1,0);
    for(int j=1;j<=n;j++)
    {
        for(int k=j;k<=n;k+=j)
        {
            ans[k]++;
        }
    }
     int anss=0;
    for(int i=1;i<=n;i++)
    anss+=i*ans[i];
    cout<<anss<<endl;
}


return 0;
}





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

using namespace std;

long long sum[200005];
long long ans[200005];
bool vis[200005];
vector<int>v[200005];

void dfs(int u,long long x)
{
    int i;
    x += sum[u];
    for(i=0;i<v[u].size();i++){
        if(vis[v[u][i]])continue;
        vis[v[u][i]]=true;
        ans[v[u][i]] = x;
        dfs(v[u][i],x);
    }
}

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

    int q,n,i,x,y;
    memset(sum,0,sizeof(sum));
    memset(ans,0,sizeof(ans));
    cin>>n>>q;
    for(i=0;i<n-1;i++){
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for(i=0;i<q;i++){
        cin>>x>>y;
        sum[x]+=y;
    }
    memset(vis,false,sizeof(vis));
    vis[1]=true;dfs(1,0);
    for(i=1;i<=n;i++)cout<<ans[i]+sum[i]<<' ';
    cout<<'\n';
    return 0;
}


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

int main(){
  int n;cin >> n;
  vector<double> v(n);
  for (auto && a : v) {
    cin>>a;
  }
  sort(v.begin(),v.end());
  for (int i = 1; i < n; i++) {
    v.at(i) = (v.at(i-1) + v.at(i)) / 2;
  }
 
  cout << v.at(n-1) << endl;
  return 0;
}

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

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

int F[MAXN]; //min cost
int n, k;
int h[MAXN]; //each cost

int frog2(int n) {

    if (n == 0) {
        return F[n] = 0;
    }

    if (F[n] != -1) return F[n];

    
    ll minv = ll(INF);

    for(int j=1; j<=k; j++) {
        if (n-j>=0) {
            minv = min(minv, ll(frog2(n-j) + abs(h[n] - h[n-j])));
        }
    }
    return F[n] = minv;

}


int main() {

    cin >> n >> k;
    for(int i=0; i<n; i++) {
        cin >> h[i];
        F[i] = -1;
    }

    frog2(n-1);
    cout << F[n-1] << endl;
}


Measured memory_bytes: 5760
public class Main {

  private static void solve() {
    int m = ni();

    long sum1 = 0;
    long sum2 = 0;
    for (int i = 0; i < m; i++) {
      long d = ni();
      long c = nl();

      sum1 += d * c;
      sum2 += c;
    }

    System.out.println(sum2 - 1 + (sum1 - 1) / 9);

  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



Measured memory_bytes: 45132
#include <stdio.h>
using namespace std;

int main() {
	int n;
	scanf("%d",&n);
	int count = 0;
	int max = 0;
	for (int i = 0; i < n; i++) {
		int h;
		scanf("%d",&h);
		if (h >= max) {
			max = h;
			count++;
		}
	}
	
	printf("%d",count);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;
// a b c d a
int main() {
    string s;
    cin >> s;
    int ans = s.size();
    for(char c : s) {
        int cnt = 0;
        rep(i,s.size()) {
            int j = i;
            while(j < s.size() && !((s[i]==c)^(s[j]==c))) j++;
            if(s[i]!=c) cnt = max(cnt, j-i);
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <iomanip>

using namespace std;

const int maxk = 100002;
const int maxn = 102;

int n, k, a[maxn];
bool f[maxk];

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n >> k;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		f[a[i]] = true;
	}

	for (int i = 1; i <= k; ++i)
		if (!f[i]) {
			for (int j = 0; j < n; ++j)
				if (a[j] < i && !f[i-a[j]]) {
					f[i] = true;
					break;
				}
		}
	
	if (f[k])
		cout << "First" << endl;
	else
		cout << "Second" << endl;

	return 0;
	
}

Measured memory_bytes: 384
import sys
from math import ceil
from operator import itemgetter as get

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

def iinput():
    return int(input())

def finput():
    return float(input())

def tinput():
    return input().split()

def rinput():
    return map(int, tinput())

def rlinput():
    return list(rinput())

def nok(a, b):
    m = a * b
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return m // (a + b)    


def main():
    n = iinput()
    q, res = [], 0
    for i in range(n):
        q.append(tuple(rinput()))
    q = sorted(q, key = get(1))
    for i, v in q:
        res += i
        if res > v:
            print("No")
            return 0
    print("Yes")
main() 

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

using namespace std;

priority_queue <int> coada;

int main()
{
    int n, m, x, val;
    long long s = 0;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
    {
        cin >> x; s += x;
        coada.push(x);
    }
    while (m)
    {
        val = coada.top();
        coada.pop();
        coada.push(val / 2);
        if (val % 2) s--;
        s -= val / 2;
        --m;
    }
    cout << s;
    return 0;
}


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

  vector<int> to[30];
  vector<bool> seen; 
  int ans=0,n;

void dfs(int v){
  for(auto w : to[v]){
    if(seen[w])continue;
    seen[w]=true;
    dfs(w);
    seen[w]=false;
  }
  rep(i,n){
    if(!seen[i])return;
  }
  ans++;
  return;
}


int main() {
  int m;
  cin>>n>>m;
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  seen.resize(n);
  seen[0]=true;
  dfs(0);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
N,M = map(int, input().split())
h = [0]*(N+1)
mod = 1000000007

for _ in range(M):
  h[int(input())] = 1

for i in range(1,N):
  if h[i]+h[i+1] == 2:
    print(0)
    exit()

memo = [0]*(N+1)
memo[0] = 1
if h[1] == 0:
  memo[1] = 1
else:
  memo[1] = 0

for i in range(2,N+1):
  if h[i] == 1:
    memo[i] = 0
  else:
    memo[i] = (memo[i-1] + memo[i-2]) % mod
    
print(memo[N])

Measured memory_bytes: 45144
package main

import (
	"fmt"
)

func main() {
	a, b, x := SingleInt(), SingleInt(), SingleInt()

	fn := divide(x)

	fmt.Println(fn(b) - fn(a-1))
}

func SingleInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func divide(x int) func(int) int {
	return func(a int) int {
		if a < 0 {
			return 0
		}
		return a/x + 1
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#define rep(i,N) for(int i=0;i<((int)N);i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
int main(void){
  ll N;
  cin>>N;
  ll a[N];
  for(int i=0;i<N;i++){
      cin>>a[i];
  }
   for(int i=N-1;i>=0;i-=2){
       cout<<a[i]<<' ';
   }
   if(N%2==0){
       for(int i=0;i<N;i+=2){
           if(i!=N-2){cout<<a[i]<<' ';}
           else cout<<a[i];
       }
   }
   else if(N%2==1&&N!=1){
       for(int i=1;i<N;i+=2){
           if(i!=N-1){cout<<a[i]<<' ';}
           else cout<<a[i];
       }
   }
   
      
  return 0;
}


Measured memory_bytes: 3712
def b_nice_shopping():
    A, B, M = [int(i) for i in input().split()]
    refrigerator = [int(i) for i in input().split()]
    microwave = [int(i) for i in input().split()]
    discount_ticket = [[int(i) for i in input().split()] for j in range(M)]

    # 最も安い冷蔵庫と電子レンジをそれぞれ買うか、割引券を使える組み合わせを買うか
    ans = min(refrigerator) + min(microwave)
    for x, y, c in discount_ticket:
        ans = min(ans, refrigerator[x - 1] + microwave[y - 1] - c)
    return ans

print(b_nice_shopping())

Measured memory_bytes: 32488
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cstdio>
using namespace std;


int n;

string rev(string s){
	reverse(s.begin(), s.end());
	return s;
}
main(){
	int i,j;
	cin >> n;
	while(n--){
		string s;
		cin >> s;
		set<string> se;
		for(i=1;i<s.size();i++){
			string t = s.substr(0, i);
			string u = s.substr(i);
			se.insert(t+u);
			se.insert(rev(t)+u);
			se.insert(t+rev(u));
			se.insert(rev(t)+rev(u));
			se.insert(u+t);
			se.insert(rev(u)+t);
			se.insert(u+rev(t));
			se.insert(rev(u)+rev(t));
		}
		cout << se.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 1296
import java.util.*;

class Main{
	static int a;
	static int b;
	static int c;
	static int d;
	static int e;
	static int p;
	static double f;
	static int g;
	static int h;
	static int i;
	static int j;
	static int k;
	static int l;
	static int m;
	static int o;
	static int q;
	static int r;
	static int s;
	static int t;
	static int u;
	private static Scanner sc;
	public static void main(String[]agrs){
		sc=new Scanner(System.in);
		a=sc.nextInt();
		b=sc.nextInt();
		d=a/b;
		r=a%b;
		f=1.0*a/b;
		System.out.printf("%d %d %f",d,r,f);
	}
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    long long k; cin >> k;
    vector<int> a(n);
    for (auto &x: a) {
        cin >> x; x--;
    }
    int c = 0, d = 0;
    vector<int> vis(n, -1);
    long long ans = k;
    while (d <= k) {
        if (vis[c] != -1) {
            long long e = d - vis[c];
            k -= vis[c];
            k %= e;
            ans = vis[c] + k;
            break;
        }
        vis[c] = d++;
        c = a[c];
    }
    for (int i = 0; i < n; i++) {
        if (vis[i] == ans) {
            cout << i+1 << "\n";
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 4788
#include <stdio.h>

int main(void)
{
    int date=0;
    scanf("%d",&date);
    if (date==25) printf("Christmas");
    else if (date==24) printf("Christmas Eve");
    else if (date==23) printf("Christmas Eve Eve");
    else if (date==22) printf("Christmas Eve Eve Eve");
    return 0;
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

int main(){
	int n,m;
	int maxProfit,minPrice;
	cin>>n;
	cin>>minPrice>>m;
	maxProfit=m-minPrice;
	if(minPrice>m)minPrice=m;
	for(int i=2;i<n;++i){
		cin>>m;
		if(m-minPrice>maxProfit)
			maxProfit=m-minPrice;
		if(minPrice>m)
			minPrice=m;

	}
	cout<<maxProfit<<endl;

}


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

int main() {
    int k, sz=9;
    cin >> k;
    
    vector<string> arr;
    for(char i='0'; i<='9'; i++) {
        string s = "";
        s += i;
        arr.push_back(s);
    }
    
    if(k <= 9) {
        cout << arr[k] << endl;
        return 0;
    }
    
    while(true) {
        vector<string> temp;
        for(char i='0'; i<='9'; i++) {
            int j=0, count=0;
            for(j=0; j<arr.size(); j++) {
                if(abs(arr[j][0]-i) <= 1)
                    break;
            }

            for(; j<arr.size(); j++) {
                if(abs(arr[j][0]-i) > 1)
                    break;

                string s = "";
                s = i + arr[j];
                //cout << s << endl;
                temp.push_back(s);
                if(i != '0')    ++count;
                if(sz + count == k) {
                    cout << temp.back() << endl;
                    return 0;
                }
            }

            sz += count;
        }
        
        arr = temp;
    }
    
    return 0;
}

Measured memory_bytes: 4876
#include <stdio.h>

int main()
{
	int i,N,D,X,A;
	scanf("%d",&N);
	scanf("%d %d",&D, &X);
	
	for(i=0;i<N;i++)
	{
		scanf("%d",&A);
		X += (D-1)/A + 1;
	}
	
	printf("%d\n", X);
	return 0;
}


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

int main(){
    string s;
    cin >> s;
    int N = s.size();
    string res= "";
    for(int i =0; i < N; i++){
        if(i%2 == 0){
            res += s[i];
        }
    }
    cout << res << endl;
}

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

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

    if(n % 2 == 0){
        cout << n/2;
    } 
    else{
        cout << n/2+1;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int n,a,num;

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

    if(n<500)
    {
        if(a>=n)
            printf("Yes");
        else
            printf("No");
    }

    else
    {
        num = n%500;

        if(a>=num)
            printf("Yes");
        else
            printf("No");
    }

    return 0;
}


Measured memory_bytes: 1684
import java.util.*;
/**
 * @author yamato
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int M = scanner.nextInt();
		if (N==M) System.out.print("Yes");
		else System.out.print("No");
		
	}

}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;
	cout<<(a+b-1)/b<<endl;
	return 0;
}

Measured memory_bytes: 256
using System.Linq;
using System;
class Program
{
    static void Main()
    {
        // 入力
        var NMQ = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var N = NMQ[0];
        var M = NMQ[1];
        var Q = NMQ[2];
        var S = new int[N + 1, M + 1];
        for (int i = 1; i <= N; i++)
        {
            var s = Console.ReadLine();
            for (int j = 1; j <= M; j++)
            {
                S[i, j] = s[j - 1] - '0';
            }
        }
        var XY = new int[Q, 4];
        for (int i = 0; i < Q; i++)
        {
            var line = Console.ReadLine().Split(' ');
            XY[i, 0] = int.Parse(line[0]);
            XY[i, 1] = int.Parse(line[1]);
            XY[i, 2] = int.Parse(line[2]);
            XY[i, 3] = int.Parse(line[3]);
        }

        // 計算
        var cell = new int[N + 1, M + 1];
        var edgeX = new int[N + 1, M + 1];
        var edgeY = new int[N + 1, M + 1];
        for (int i = 1; i <= N; i++)
        {
            for (int j = 1; j <= M; j++)
            {
                cell[i, j] += cell[i - 1, j] + cell[i, j - 1] - cell[i - 1, j - 1] + S[i, j];
                edgeX[i, j] += edgeX[i - 1, j] + edgeX[i, j - 1] - edgeX[i - 1, j - 1] + (S[i, j] & S[i - 1, j]);
                edgeY[i, j] += edgeY[i - 1, j] + edgeY[i, j - 1] - edgeY[i - 1, j - 1] + (S[i, j] & S[i, j - 1]);
            }
        }
        for (int q = 0; q < Q; q++)
        {
            int x1 = XY[q, 0], y1 = XY[q, 1], x2 = XY[q, 2], y2 = XY[q, 3];
            var edgesX = edgeX[x2, y2] - edgeX[x1, y2] - edgeX[x2, y1 - 1] + edgeX[x1, y1 - 1];
            var edgesY = edgeY[x2, y2] - edgeY[x1 - 1, y2] - edgeY[x2, y1] + edgeY[x1 - 1, y1];
            var cells = cell[x2, y2] - cell[x1 - 1, y2] - cell[x2, y1 - 1] + cell[x1 - 1, y1 - 1];
            Console.WriteLine(cells - edgesX - edgesY);
        }
    }
}

Measured memory_bytes: 84212
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e5 + 5;

int main()
{
    ios::sync_with_stdio(false);
    string a; cin >> a;
    if (a.back() == 's') a += "es";
    else a += 's';
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 3592
#define  _USE_MATH_DEFINES
#include<stdio.h>
#include<math.h>

int main()
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	a *= 1.0;
	b *= 1.0;
	double angle = sinl(1.0*c*2*M_PI/360.0);
	double S, L, h;
	S = 0.5*a*b*angle;
	L = a + b + sqrt(powl(a, 2) + powl(b, 2) - 2 * a*b*cosl(1.0*c*2*M_PI/360.0));
	h = 2 * S / a;
	printf("%lf\n", S);
	printf("%lf\n", L);
	printf("%lf\n", h);
}

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

int main() {
    cout << fixed << setprecision(0);
    int64_t N, K;
    cin >> N >> K;
    vector<int> L(K), R(K);
    for(int i = 0; i < K; i++) {
        cin >> L[i] >> R[i];
    }

    const int64_t MOD = 998244353;
    vector<int64_t> ans(N), sm(N);
    ans[0] = 1;
    sm[0] = 1;

    for(int i = 1; i < N; i++) {
        for(int j = 0; j < K; j++) {
            if(i - L[j] < 0)
                continue;
            int s = max(0, i - R[j]);
            int g = min(i - 1, i - L[j]);
            ans[i] =
                (sm[g] + MOD - (s - 1 >= 0 ? sm[s - 1] : 0) + ans[i]) % MOD;
        }
        sm[i] = (sm[i - 1] + ans[i]) % MOD;
    }

    cout << ans[N - 1] << endl;

    return 0;
}

Measured memory_bytes: 6380
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  string s;cin>>s;
  if(siz(s)%2){
    cout<<"No"<<ENDL;
    return 0;
  }

  rep(i,0,siz(s)){
    if(s[i]!='h' || s[i+1]!='i'){
      cout<<"No"<<ENDL;
    return 0;
    }
    i++;
  }

  cout<<"Yes"<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

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

using namespace std;

int n, m;

inline int read() {
	int x = 0; bool neg = false; char ch = getchar();
	while(!isdigit(ch)) (ch == '-') && (neg = true), ch = getchar();
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return neg ? -x : x;
}

int main() {
	n = read(), m = read();
	cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
	return 0;
}

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

using namespace std;

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

int main(){
    int N;
    cin >> N;
    int a[101];
    rep(i, N) {
        cin >> a[i];
    }
    sort(a, a + N,greater<int>());
    int turn = N;
    int asum = 0;
    int bsum = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            asum += a[i];
        }
        else bsum += a[i];
    }
    cout << asum - bsum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define pii pair<int,int>
#define prec(n) fixed<<setprecision(n)
#define MOD 1000000007
#define eps 1e-8
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    int n,a,b;cin>>n>>a>>b;
    cout<<min(n*a,b);
}


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

#define pi 3.14159265358979323846264

#define ll long long
#define fori(n) for(long long i=0;i<n;i++)
#define forj(n) for(long long j=0;j<n;j++)

#define sp(n) setprecision(n)
#define d7 1000000007
#define mkp make_pair
#define mkt make_tuple

using namespace std;

bool isPrime(long long k){
    if(k<=1){return false;}
    if(k==2){return true;}
    if(k%2==0){return false;}
    long long i = 3;
   while (i*i <= k) {if (k % i == 0) {return false;}i += 2;}
return true;
}

ll binomialCoeff(ll n, ll k){
    ll C[n + 1][k + 1];ll i, j;
    for (i = 0; i <= n; i++){
        for (j = 0; j <= min(i, k); j++)
        {if (j == 0 || j == i) C[i][j] = 1;
            else C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);}}
    return C[n][k];
 }

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

ll srihrg(ll n,ll k,ll m){
    ll ans;
    ans=1;
    fori(k){
        ans=(ans*n)%m;
    }
    return ans;
}

ll kk=1;
void dfsi(vector<bool> &vis, vector<ll> adj1[], ll n, ll start, vector<ll> &pre, vector<ll> &pos){
    vis[start]=true;
    pre[start]=kk;kk++;
    for(ll i: adj1[start]){
        if(!vis[i]){
            vis[i]=true;
            dfsi(vis,adj1,n,i,pre,pos);
        }
    }
    pos[start]=kk;kk++;
}

void bfsi(vector<ll> &dis, vector<ll> adj[], ll s, vector<ll> &parent){
    dis[s]=-1;
    queue<ll> q;
    q.push(s);
    while(!q.empty()){
        ll z=q.front();
        q.pop();
        for(ll v:adj[z]){
            if(dis[v]==0){
            q.push(v);
            dis[v]=-dis[z];
                parent[v]=z;}
        }
    }
}

void make_set(ll v, vector<ll> &parent, vector<ll> &krank) {
    parent[v] = v;
    krank[v] = 0;
}

ll find_set(ll v,vector<ll> &parent, vector<ll> &krank) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v], parent, krank);
}

void union_sets(ll a, ll b,vector<ll> &parent, vector<ll> &krank) {
    a = find_set(a,parent,krank);
    b = find_set(b,parent,krank);
    if (a != b) {
        if (krank[a] < krank[b])
            swap(a, b);
        parent[b] = a;
        if (krank[a] == krank[b])
            krank[a]++;
    }
}

void dijkstra(ll s, vector<ll> &dist, vector<ll> &parent, ll n, vector<pair<ll,ll>> adj[]){
    dist[s]=0;
    vector<bool> u(n,false);
    fori(n){
        ll v=-1;
        forj(n){
            if(!u[j] &&(v==-1||(dist[j]<dist[v]))) v=j;
        }
        if(dist[v]==d7) break;
        u[v]=true;
        for(auto j:adj[v]){
            ll a,b;
            a=j.first;
            b=j.second;
            if(dist[v]+b<dist[a]){
                dist[a]=dist[v]+b;
                parent[a]=v;
            }
        }
    }
}


int main(int argc, const char * argv[]) {
 //cout<<"Om\n";
 //Praise to Lord
 //make cin/cout faster
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
// code now
   
    ll n,m;
    cin>>n>>m;
    if(n>=10){cout<<m;}
    else{
        cout<<m+100*(10-n);
    }
    
//code ends
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> f(N+1,0);

    for(int x=1; x<100; x++){
        for(int y=1; y<100; y++){
            for(int z=1; z<100; z++){
                int a=x*x+y*y+z*z+x*y+y*z+z*x;
                if(a<N+1) f.at(a)++;
            }
        }
    }
    for(int i=1; i<=N; i++){
        cout << f.at(i) << endl;
    }
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {
	int N,M;
	cin>>N>>M;
	vector<vector<pair<int,int>>> cities(N);
	for(int i=0;i<M;i++) {
		int p,y;
		cin>>p>>y;
		--p;
		cities[p].push_back(make_pair(y,i));
	}

	for(int i=0;i<N;i++) {
		sort(begin(cities[i]), end(cities[i]));
	}

	vector<pair<int,int>> ans(M);
	for(int i=0;i<N;i++) {
		for(int j=0;j<cities[i].size();j++) {
// err<<cities[i][j].first<<" "<<cities[i][j].second<<endl;
			int c = cities[i][j].first;
			ans[cities[i][j].second] = make_pair(i, j);
		}
	}


	for(int i=0;i<M;i++) {
		printf("%06d%06d\n", ans[i].first+1, ans[i].second+1);
//		cout << setfill('0') << setw(6)  (ans[i].first+1) << " " << (ans[i].second+1) <<endl;
	}

	
	return 0;
}


Measured memory_bytes: 7808
import java.util.Scanner;

class Main{
	
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		long H = sc.nextLong(), N = sc.nextLong(), sum = 0;
		long[] A = new long[100005];
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
			sum += A[i];
		}
		if(sum >= H) {
			System.out.print("Yes");
		} else {
			System.out.print("No");
		}
	}
}


Measured memory_bytes: 59312
using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] price = new int[N];
            for (int i = 0; i < N; i++)
            {
                price[i]= int.Parse(Console.ReadLine());
            }
            Console.WriteLine(price.Sum() -price.Max()/2);
        }
    }
}


Measured memory_bytes: 13268
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	for i := 1; i <= N; i++ {
		cnt := 0
		for x := 1; x*x <= i; x++ {
			for y := 1; x*x+y*y <= i; y++ {
				for z := 1; x*x+y*y+z*z+x*y+y*z+x*z <= i; z++ {
					if x*x+y*y+z*z+x*y+y*z+x*z == i {
						cnt++
					}
				}
			}
		}
		fmt.Println(cnt)
	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 1856
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const int INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 20000;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;
    cin >> h >> w;
    vector<vector<ll>> ans(h,vector<ll>(w));
    vector<string> grid(h);
    rep(i,h) cin >> grid[i];
    rep(i,h){
        rep(j,w){
            if(grid[i][j] == '.'){
                int cnt = 0;
                rep(k,8){
                    int xn = i+nx[k],yn = j+ny[k];
                    if (xn >= 0 && xn < h && yn >= 0 && yn < w && grid[xn][yn] == '#'){
                        cnt++;
                    }
                }
                grid[i][j] = '0'+cnt;
            }
        }
    }
    rep(i,h){
        PRINT(grid[i]);
    }
}


Measured memory_bytes: 256
import java.util.*;
 
class Main{
 
    long[] kaijo;  
    int[] a;
    String s;
    int len;
         
 
    void init(){
    kaijo=new long[21];
    kaijo[0]=1;
    for(int i=1;i<kaijo.length;i++){
        kaijo[i]=kaijo[i-1]*i;
    }
 
    }
 
    void run(){
    init();
    Scanner sc=new Scanner(System.in);
    a=new int[256];
    s=sc.next();
    len=s.length();
    for(int i=0;i<len;i++)a[s.charAt(i)]++;
    System.out.println(count(s));
    }
    long count(String s){
    long res=kaijo[len/2];
    if(len%2==0){
        for(int i=0;i<a.length;i++)if(a[i]%2==1)return 0L;
        for(int i=0;i<a.length;i++){
        if(a[i]>=2)res/=kaijo[a[i]/2];
        }
    }else{
        int k=0;char c='#';
        for(int i=0;i<a.length;i++){
        if(a[i]%2==1){
            c=(char)i;k++;
        }}
        if(k!=1)return 0L;
        a[c]--;
        for(int i=0;i<a.length;i++){
        if(a[i]>=2)res/=kaijo[a[i]/2];
        }
    }
    return res;
    }
 
    public static void main(String[] args){
    new Main().run();
    }
}

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

void proc(int n);

typedef struct pile PILE;
PILE *pile_new(int n);
void pile_delete(PILE *self);
void pile_shuffle(PILE *self, int x, int y);
int pile_count(PILE *self, int p, int q, int r);
PILE *pile_cut(PILE *self, int x);
void pile_join(PILE *self, PILE *joined);

typedef struct group GROUP;

int main()
{
	while (1) {
		int n;
		scanf("%d", &n);
		if (n == 0) {
			break;
		} else {
			proc(n);
		}
	}
	return 0;
}

void proc(int n)
{
	int m, p, q, r;
	scanf("%d", &m);
	scanf("%d %d %d", &p, &q, &r);

	PILE *pile = pile_new(n);

	for (; m > 0; m--) {
		int x, y;
		scanf("%d %d", &x, &y);
		pile_shuffle(pile, x, y);
	}

	printf("%d\n", pile_count(pile, p, q, r));

	pile_delete(pile);
}

struct pile {
	GROUP *first;
	GROUP *last;
};

struct group {
	int start;
	int length;
	GROUP *next;
};

PILE *pile_new(int n)
{
	PILE *self;
	self = malloc(sizeof(PILE));
	self->first = self->last = malloc(sizeof(GROUP));
	self->first->start = 1;
	self->first->length = n;
	self->first->next = NULL;
	return self;
}

void pile_delete(PILE *self)
{
	GROUP *w;
	while (self->first) {
		w = self->first->next;
		free(self->first);
		self->first = w;
	}
	free(self);
}

void pile_shuffle(PILE *self, int x, int y)
{
	PILE *p0, *p1, *p2;

	p0 = malloc(sizeof(PILE));
	p0->first = self->first;
	p0->last = self->last;
	p1 = pile_cut(p0, x);
	p2 = pile_cut(p1, y-x);
	pile_join(p2, p1);
	pile_join(p2, p0);
	self->first = p2->first;
	self->last = p2->last;
	free(p2);
}

PILE *pile_cut(PILE *self, int x)
{
	PILE *cut;
	int rest;
	GROUP *cur;

	cut = malloc(sizeof(PILE));
	rest = x;
	cur = self->first;

	while (cur->length < rest) {
		rest -= cur->length;
		cur = cur->next;
	}

	if (cur->length == rest) {
		cut->first = cur->next;
		cut->last = self->last;
		cur->next = NULL;
		self->last = cur;
	} else {
		cut->first = malloc(sizeof(GROUP));
		cut->first->start = cur->start + rest;
		cut->first->length = cur->length - rest;
		cut->first->next = cur->next;
		cut->last = (cur == self->last) ? cut->first : self->last;
		cur->length = rest;
		cur->next = NULL;
		self->last = cur;
	}

	return cut;
}

void pile_join(PILE *self, PILE *joined)
{
	self->last->next = joined->first;
	self->last = joined->last;
	free(joined);
}

int pile_count(PILE *self, int p, int q, int r)
{
	int offset, count;
	GROUP *cur;
	offset = 0;
	count = 0;
	cur = self->first;
	while (cur) {
		if (p <= offset + cur->length && q > offset) {
			int out_p, out_q, start, length;
			out_p = p <= offset ? 0 : p - offset - 1;
			out_q = q >= offset + cur->length ? 0 : offset + cur->length - q;
			start = cur->start + out_p;
			length = cur->length - out_p - out_q;
			if (start + length - 1 <= r) {
				count += length;
			} else if (start <= r) {
				count += r - start + 1;
			}
		}
		offset += cur->length;
		cur = cur->next;
	}

	return count;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define pb push_back
#define nl cout<<"\n"
#define F first
#define S second
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

const ll MOD = 1000000007;
ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    string s;
    cin>>s;

    int n = s.size();
    string a = "";
    for(int i=0;i<(n/2);i++)
    {
        a += "hi";
    }
    puts( (a==s) ? "Yes" : "No" );

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


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

using namespace std;

long C(long n, long r){
    if(n < r) return 0;
    long p[n+1][n+1];
    p[0][0] = 1;
    for(int i = 1; i <= n; i++){
        p[i][0] = 1;
        p[i][i] = 1;
        for(int j = 1; j <= i-1; j++){
            p[i][j] = p[i-1][j] + p[i-1][j-1];
        }
    }
    return p[n][r];
}

void solve()
{
    int A, B;
    cin >> A >> B;
    if(A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0){
        cout << "Possible" << endl;
    }
    else{
        cout << "Impossible" << endl;
    }
    return;
}

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

Measured memory_bytes: 256
x, y = map(int, input().split())
result_x = 0
result_y = 0
if x > 1:
    result_x = 0
    for i in range(x):
        result_x = result_x + i

if y > 1:
    result_y = 0
    for i in range(y):
        result_y = result_y + i


print(result_x + result_y)

Measured memory_bytes: 3060
def main(str)
  str.split("\n")[1].split(" ").map(&:to_i).sort.inject do |m, x|
    r = m * x
    break -1 if r > 10 ** 18
    r
  end
end

unless ENV["TEST"]
  puts(main($stdin.read.chomp))
  exit(0)
end

require 'minitest/autorun'

class TestA < Minitest::Test
  def test_main
    assert_equal(1000000000000000000, main("2
1000000000 1000000000"))
    assert_equal(-1, main("3
101 9901 999999000001"))
    assert_equal(0, main("31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0"))
  end
end




Measured memory_bytes: 23328
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
const int N = 5e5 + 5;
typedef long long ll; 
using namespace std;

int n, tm, m, t[N];
ll ans; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("cpp.in", "r", stdin); 
#endif
	n = read <int> (), tm = m = read <int> ();
	for(int i = 1; i <= n; i++) t[i] = read <int> (); 
	for(int i = 2; i <= n; i++) ans += min(tm, t[i]) - t[i - 1], tm = t[i] + m; 
	printf("%lld\n", ans + m); 
	return 0; 
}


Measured memory_bytes: 3708
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int x,a,b;
cin>>x;
for(a=1;a<=125;a++)
{
for(b=-64;b<=124;b++)
{
if((a*a*a*a*a-b*b*b*b*b)==x)
{
cout<<a<<" "<<b<<endl;
return 0;

}
}

}


}


Measured memory_bytes: 3584
import math
a,b,x = map(int,input().split())
if x <= b*a*a*1/2:
    dum = 2*x/(a*b)
    ans = 90-(math.degrees(math.atan(dum/b)))
else:
    x -= b*a*a*1/2
    dum = b-(x*2/(a*a))
    ans = math.degrees(math.atan(dum / a))
print(ans)

Measured memory_bytes: 9380
N,H = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

import numpy
A = numpy.array(A)
B = numpy.array(B)
AsortA = numpy.sort(A)[::-1]
BsortB = numpy.sort(B)[::-1]

ans = 0
maxattack = AsortA[0]
throw = BsortB[maxattack < BsortB]
if(sum(throw) >= H):
    ak = 0
    for i in range(len(throw)):
        ak += throw[i]
        if(ak >= H):
            ans = i+1
            break
else:
    resH = H - sum(throw)
    ak = int(numpy.ceil(resH/maxattack))
    ans = ak + len(throw)
    
print(ans)

Measured memory_bytes: 20976
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	string s;
	cin >> s;
	int l = 1, r = (int) s.length() + 1;
	auto can = [](int x, string s) {
		int res = 0;
		int n = s.length();
		for (int i = n - x; i <= x - 1; i++) {
			res += s[i] - '0';
		}
		return res == 0 || res == 2 * x - n;
	};
	while (r - l > 1) {
		int mid = (r + l) / 2;
		if (can(mid, s)) l = mid;
		else r = mid;
	}
	cout << (can(r, s) ? r : l) << endl;
	return 0;	
}

Measured memory_bytes: 512
while True:
    try:
        a = int(input())
        primes = [1] * (a+1)
        for i in range(2, int(a**0.5)+1):
            if primes[i]==1:
                for j in range(i*i, a+1, i):
                    primes[j] = 0
        print(sum(primes)-2)
    except EOFError:
        break


Measured memory_bytes: 22156