akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n;
    cin >> n;
    ll dict[100010] = {};
    ll mx = 0;
    rep(i, n){
        ll a;
        cin >> a;
        dict[a]++;
        mx = max(a, mx);
    }
    
    ll sum, cnt, knd;
    sum = cnt = knd = 0;
    rep(i, mx+1){
        if(dict[i] > 1)cnt++, sum+=dict[i];
        if(dict[i] > 0)knd++;
    }
    if((sum-cnt)%2 != 0)cout << knd-1 << endl;
    else cout << knd << endl;
    
    
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin>>a[i];
  int s = 0;
  rep(i,n) s += a[i];
  int cnt = 0;
  rep(i,n) {
    if (a[i]*4*m >= s) cnt++;
  }
  if(cnt >= m) cout << "Yes" << endl;
  else cout << "No" << endl;
  return(0);
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  int n;
  cin >> n;
  double i=n;
  while(1){
    double j=sqrt(i);
    int d=(int)j;
    if((int)i/d==d&&(int)i%d==0){
      cout << (int)i << endl;
      break;
    }
    i-=1;
  }
  return 0;
}

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

int main(void) {
  char s[11];
  char t[12];
  scanf("%s", s);
  scanf("%s", t);
  int i;
  for(i=0; i<strlen(s); i++) {
    if(s[i] != t[i]) {
      printf("No\n");
      return 0;
    }
  }
  if(t[i+1] != '\0') {
    printf("No\n");
    return 0;
  }
  else {
    printf("Yes\n");
    return 0;
  }
}

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

using namespace std;

typedef long long ll;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int ans = 0, n = (int) s.size();
  for (int i = 0; i < n; i++) {
    ans += (s[i] != t[i]);
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 3792
import sys
sys.setrecursionlimit(10**6)
def MAP(): return [int(s) for s in input().split()]

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
#input = sys.stdin.readline

easy = True
S = input()
for i in range(len(S)):
	#print(i, S[i])
	if not i%2 and S[i] in 'RUD':
		continue
	if i%2 and S[i] in 'LUD':
		continue
	easy = False

print('Yes' if easy else 'No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define piii pair<pii, int>
#define pb push_back
#define fs first
#define sc second
#define ppb pop_back
//#define LOCAL
//#define endl "\n"
#define d0(x) cout<<x<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<endl
#define d5(x,y,z,w,s) cout<<x<<" "<<y<<" "<<z<<" "<<w<<" "<<s<<endl
#define fifo ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1e9+7;


inline ll po(int a,int m,int M)
{
    int ret=1;
    for(a = (a%M+M)%M;m;m>>=1,a=a*(ll)a%M)
        if(m&1)
            ret = ret*(ll)a%M;
    return ret;
}

int n;
void solve()
{
	cin>>n;

	ll ans = (po(10,n,mod)+po(8,n,mod))%mod;
	ans = (ans- 2*po(9,n,mod))%mod;
	if(ans<0)ans+=mod;

	d1(ans);
}


int main()
{
	fifo
	ll t=1;
	//cin>>t;
	//cout<<t<<endl;
	for(ll test_case=1;test_case<=t;++test_case)
	{
		//cout<<"#"<<test_case<<endl;
		solve();
	}
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define INF 1000000007
#define ggr getchar(); getchar();return 0;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

int h, w, dp[1010][1010];
char a[1010][1010];

signed main() {
	cin >> h >> w;
	rep(i, h) {
		rep(j, w) {
			cin >> a[i][j];
		}
	}
	dp[1][1] = 1;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (i == 1 && j == 1) ;
			else {
				if (a[i - 1][j - 1] == '.') {
					dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
					dp[i][j] %= INF;
				}
				else dp[i][j] = 0;
			}
		}
	}
	cout << dp[h][w] << endl;
	ggr
}

Measured memory_bytes: 5120
#include <iostream>

using namespace std;

int main(){
    int left=0,right=0,n,m,x;
    cin >> n >> m >> x;
    int a[m];
    for(int i=0;i<m;i++){
        cin >> a[i];
    }
    for(int i=0;i<m;i++){
        if(a[i] < x){
            left++;
        }else{
            right++;
        }
    }
    if(left > right){
        cout << right << endl;
    }else{
        cout << left << endl;
    }
    return 0;
}

Measured memory_bytes: 256
rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())

def solve(N, A, B):
    P = A + B
    if A == 0: return 0
    Q, R = divmod(N, P)
    ans = Q * A
    if R >= A:
        ans += A
    else:
        ans += R
    return ans

print solve(*rrm())


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

namespace MSA
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            int ans = (N - 2) * 180;

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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 namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const ll MOD = 1000000007;
const double pi = acos(-1);

ll modpow(ll a, ll n) {
    ll ans = 1;
    REP(i,n) {
        ans *= a;
        ans %= MOD;
    }
    return ans;
}

int main() {
    ll N; cin >> N;
    ll ans = 0;
    ans += modpow(10,N);
    ans -= modpow(9,N);
    ans -= modpow(9,N);
    ans += modpow(8,N);
    ans %= MOD;
    ans = (ans+MOD)%MOD;
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll n, k;
  cin >> n >> k;
  ll arr[n];
  fi(0, n)
    cin >> arr[i];
  sort(arr, arr + n);
  if(arr[n - 1] < k) {
    cout << "IMPOSSIBLE\n";
    return 0;
  }
  ll x = arr[n - 1];
  fi(0, n - 1) {
    x = gcd(x, arr[i]);
  }
  
  if(k % x == 0) 
    cout << "POSSIBLE\n";
  else
    cout << "IMPOSSIBLE\n";
  return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
using ll = long long;
const ll mod = 1e9 + 7;
 
int main(){
  int n; cin >> n;
  vector<pair<ll, int>> p(n);
  vector<int> y(n);
  rep(i, n){
    cin >> p[i].first;
    p[i].second = i + 1;
    y[i] = i + 1;
  }

   sort(p.begin(), p.end(), greater<pair<ll, int>>());
  
  vector<vector<ll>> dp(n+1,vector<ll>(n+1));
  dp[0][0] = 0;
  for(int i=1; i<n+1; i++){
  dp[i][0] = dp[i-1][0] + p[i-1].first*abs(p[i-1].second - i);
  dp[0][i] = dp[0][i-1] + p[i-1].first*abs(n-(i-1)-p[i-1].second);
  }
  
  ll ans = max(dp[n][0], dp[0][n]);
  for(int i=1; i<n+1; i++){
  	for(int j=1; j<n+1-i; j++){
  ll x_p1 = dp[i-1][j] +  p[i+j-1].first*abs(p[i+j-1].second- i);    
  ll y_p1 = dp[i][j-1] +  p[i+j-1].first*(n-(j-1)-p[i+j-1].second);   
      dp[i][j] = max(x_p1, y_p1);
      if( i + j == n ) ans = max(ans, dp[i][j]);
    }
  }
   cout << ans <<endl;
  
  
  return 0;
}


Measured memory_bytes: 34640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define endl '\n'

int main(){
    ios_base::sync_with_stdio(false);
    int n, m, x, sum = 0;
    cin >> n >> m;
    while(m--) cin >> x, sum += x;

    if(sum > n) cout << -1;
    else cout << n - sum;

    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;            //

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

    int discount = 200 * (N / 15);
    int ans = N * 800 - discount;
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int M = sc.nextInt();
    	int[] tabemono = new int[M]; 
    	for(int i = 0; i<N; i++) {
    		int K_i = sc.nextInt();
    		for(int p = 0; p<K_i; p++) {
    			int c = sc.nextInt();
    			tabemono[c-1]++;
    		}
    	}
    	int counter=0;
    	for(int r = 0; r<M; r++) {
    		if(tabemono[r]>=N)counter++;
    	}
    	
    	System.out.println(counter);
    	
    	
    	
    	
  }
  
 
    
        
}


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

using namespace std;

const int N = 1e5 + 5;
const int inf = 0x3f3f3f3f;

vector <int> g[N];
int n, k, dist[N];
priority_queue <pair <int, int>, vector <pair <int, int> >, greater <pair <int, int> > > pq;

void input(){
    scanf("%d", &n);
    for (int i = 1; i <= n - 1; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        g[u].push_back(v);
        g[v].push_back(u);
    }

    scanf("%d", &k);
    memset(dist, 0x3f, sizeof(dist));
    for (int i = 1; i <= k; i++) {
        int u, x;
        scanf("%d %d", &u, &x);
        dist[u] = x;
        pq.push(make_pair(dist[u], u));
    }
}

void dijkstra(){
    while (!pq.empty()) {
        int d = pq.top().first;
        int u = pq.top().second;
        pq.pop();

        for (int v: g[u]) {
            if (dist[v] == inf) {
                dist[v] = dist[u] + 1;
                pq.push(make_pair(dist[v], v));
            }
            else if (abs(dist[v] - dist[u]) != 1) {
                printf("No");
                return;
            }
        }
    }

    puts("Yes");
    for (int i = 1; i <= n; i++) printf("%d\n", dist[i]);
}

void solve(){
    dijkstra();
}

signed main(){
    input();
    solve();
    return 0;
}


Measured memory_bytes: 7924
#include<bits/stdc++.h>
using namespace std;
const int maxn = 20;
long long dp[maxn];
char s[maxn];
long long sum(int x, int y)
{
    long long ret = 0;
    for(int i = x; i <= y; i++)
        ret = ret * 10 + s[i] - '0';
    return ret;
}
int main()
{
    while(scanf("%s", s + 1) != EOF)
    {
        int n = strlen(s + 1);
        memset(dp, 0, sizeof dp);
        for(int i = 1; i <= n; i++)
        {
            for(int j = 1; j <= i; j++)
            {
                dp[i] += dp[j - 1] + sum(j, i) * (1ll << max((j - 2), 0) );
            }
        }
        // for(int i=1;i<=n;i++) printf("%lld ",dp[i]);
        printf("%lld\n", dp[n]);
    }
    return 0;
}


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

using namespace std;

int main() {

	int a, b;
	int ans = 0;

	cin >> a >> b;

	if (a > b) ans = 2 * a - 1;
	else if (a < b) ans = 2 * b - 1;
	else if (b == a) ans = a + b;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
import math

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
#read = sys.stdin.buffer.read

pi = math.pi

def main():
    A, B, H, M = map(int, readline().split())
    Htmp = H*60+M
    h = (Htmp/(12*60))*2*pi; m = (M/60)*2*pi
    theta = min(abs(h-m), 2*pi-abs(h-m))
    #print(180*theta/pi)
    ans = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(theta))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9496
#include<iostream>
#include<vector>
#include<algorithm>
#include <functional>
using namespace std;
int main()
{
	vector<int> m;
	int n;
	for (int i = 0; i < 10; i++)
	{
		cin >> n;
		m.push_back(n);
	}
	sort(m.begin(), m.end(), std::greater<int>());
	for (int i = 0; i < 3; i++)
		cout << m[i] << endl;
	return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define cross(i,k) for (register int i=first[k];i;i=last[i])
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> pa;
inline ll read(){
    ll x=0;int ch=getchar(),f=1;
    while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar();
    if (ch=='-'){f=-1;ch=getchar();}
    while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
    return x*f;
}
const int N = 1e5+10;
int n,x,y,h,t;
pa q[N<<1];
map<pa,int>Map;
set<int>s[N];
set<int>::iterator it;
int fa[N];
inline int Find(int x){return fa[x]==x?x:fa[x]=Find(fa[x]);}
inline void Add(int x,int y){s[x].insert(y),s[y].insert(x),Map[mp(x,y)]++,Map[mp(y,x)]++;}
inline void Del(int x,int y){s[x].erase(y),s[y].erase(x),Map[mp(x,y)]=Map[mp(y,x)]=0;}
inline void Merge(int x,int y){
	if (s[y].size()>s[x].size()) swap(x,y);
	while (!s[y].empty()){
		int z=*(s[y].begin());Del(y,z),Add(x,z);
		if (Map[mp(x,z)]==2) q[++t]=mp(x,z);
	}
	fa[y]=x;
}
int main(){
	n=read();
	For(i,1,n-1<<1){
		x=read(),y=read(),Add(x,y);
		if (Map[mp(x,y)]==2) q[++t]=mp(x,y);
	}
	For(i,1,n) fa[i]=i;
	while (h<t){
		int x=Find(q[++h].fi),y=Find(q[h].se);
		s[x].erase(y),s[y].erase(x),Merge(x,y);
	}
	int ans=0;
	For(i,1,n) if (fa[i]==i) ++ans;
	puts(ans==1?"YES":"NO");
}

Measured memory_bytes: 57344
in1 = list(map(int, input().split()))
N = in1[0]
X = in1[1]
 
L = list(map(int, input().split()))
L.append(0)
L.append(0)
D = 0
overflow = False
for i in range(1, N+2):
  if X < D:
    print(i-1)
    overflow = True
    break
  if X == D:
    print(i)
    overflow = True
    break
  D = D + L[i-1]

if not overflow:
  print(N+1)

Measured memory_bytes: 3064
//Capitalize
using System;
using System.Linq;

namespace AOJ
{
	class Program
	{
		public static void Main(string[] args)
		{
			var arr = Console.ReadLine().ToCharArray();
			foreach(var i in Enumerable.Range(0, arr.Count() - 1))
			{
				if(arr[i] >= 'a' && arr[i] <= 'z')
				{
					arr[i] -= (char)('a' - 'A');
				}
			}
			Console.WriteLine(new string(arr));
		}
	}
}

Measured memory_bytes: 5472
#include<bits/stdc++.h>
#define llu unsigned long long
#define ll long long
#define INF 0x3f3f3f3f
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define to_lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define to_upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper);

using namespace std;

// scan vector
template <typename T> 
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// print vector
template <typename T> 
inline ostream &operator<<(ostream &out, vector<T> &a) {
    for(auto &x : a) out << x <<" ";
    return out;
}
// scan pair
template <typename T, typename U> 
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second; 
    return in;
}
int n,k;
vector<ll> a, pref;
vector<vector<ll> > dp;
vector<vector<bool> > visited;

ll sum(int left, int right)
{
    if(left>right)
        return LLONG_MAX;
    if(left==0)
        return pref[right];
    return pref[right]-pref[left-1];
}

ll solve(int left, int right)
{
    if(left==right)
        return dp[left][right]=0;
    if(visited[left][right])
        return dp[left][right]; 
    visited[left][right]=true;

    for(int i=left; i<right; i++)
        dp[left][right]=min(dp[left][right],solve(left,i)+solve(i+1,right)+sum(left,right));

    return dp[left][right];    
}

int main()    
{
    #ifdef SANS
        freopen("ongoingin.txt","r",stdin);
        freopen("ongoingout.txt","w",stdout);
    #endif
    fast
    int t=1;
    // cin>>t;
    while(t--)
    {
        cin>>n;
        a.resize(n);
        pref.resize(n,0);
        cin>>a;
        pref[0]=a[0];
        for(int i=1; i<n; i++)
            pref[i]+=(pref[i-1]+a[i]);
        dp.resize(n,vector<ll>(n,LLONG_MAX));
        visited.resize(n,vector<bool>(n,0));
        cout<<solve(0,n-1)<<endl;
    }
    #ifdef SANS
        cout<<"\nTime Elapsed:"<<1.0*clock()/CLOCKS_PER_SEC <<"sec\n";
    #endif
}

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

// maximum size of x 
const int MAX = 100001; 

// to check whether x is possible or not 
int ispossible[MAX]; 

void check(int arr[], int N) 
{ 
  ispossible[0] = 1; 
  sort(arr, arr + N); 

  for (int i = 0; i < N; ++i) { 
    int val = arr[i]; 

    // if it is already possible 
    if (ispossible[val]) 
      continue; 

    // make 1 to all it's next elements 
    for (int j = 0; j + val < MAX; ++j) 
      if (ispossible[j]) 
        ispossible[j + val] = 1; 
  } 
} 

// Driver code 
int main() 
{ 
  int arr[] = { 100,101,102,103,104,105 }; 
  int N = sizeof(arr) / sizeof(arr[0]); 
  check(arr, N); 
  int x ;
  cin>>x;
  if (ispossible[x]) 
    cout<<1; 
  else
    cout << 0;
  return 0; 
} 

Measured memory_bytes: 640
from heapq import heapify, heappushpop
from itertools import accumulate

x, y, z = map(int, input().split())
persons = [list(map(int, input().split())) for _ in range(x + y + z)]
persons.sort(key=lambda abc: abc[0] - abc[1])

ans_g = sum(x[0] for x in persons[-x:])
ans_s = sum(x[1] for x in persons[:y])
ans_c = sum(x[2] for x in persons[y:-x])

gold_pq = [a - c for a, b, c in persons[-x:]]
silver_pq = [b - c for a, b, c in persons[:y]]
heapify(gold_pq)
heapify(silver_pq)

ans_f = [0]
for a, b, c in persons[y:-x]:
    np = b - c
    rp = heappushpop(silver_pq, np)
    ans_f.append(np - rp)

ans_b = [0]
for a, b, c in persons[-x - 1:y - 1:-1]:
    np = a - c
    rp = heappushpop(gold_pq, np)
    ans_b.append(np - rp)

ans_f = list(accumulate(ans_f))
ans_b = list(accumulate(ans_b))
print(ans_g + ans_s + ans_c + max(sum(z) for z in zip(ans_f, reversed(ans_b))))


Measured memory_bytes: 40264
#include <iostream>
#include <cstring>

using namespace std;

int used[20][20];
char M[20][20];
int W, H;

bool in(int sx, int sy) {
  return 0<=sx && sx<W && 0<=sy && sy<H;
}

int dfs(int x, int y) {
  int res = 1;
  used[y][x] = 1;
  
  const int dx[]={-1,1,0,0};
  const int dy[]={0,0,-1,1};
  for(int i=0; i<4; i++) {
    int nx = x+dx[i], ny = y+dy[i];
    if(in(nx, ny) && M[ny][nx] == '.' && !used[ny][nx])
      res += dfs(nx, ny);
  }
  return res;
}

int main() {
  
  int stx, sty;
  while(cin >> W >> H, (W|H)) {
    memset(used, 0, sizeof(used));
    for(int i=0; i<H; i++)
      for(int j=0; j<W; j++) {
	cin >> M[i][j];
	if(M[i][j] == '@') {
	  stx = j, sty = i;
	  M[i][j] = '.';
	}
      }
    cout << dfs(stx, sty) << endl;
  }
  
  return 0;
}

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

int main(){
    ios_base::sync_with_stdio(false);
    long long x1, x2, x3, x4, x5; cin >> x1 >> x2 >> x3 >> x4 >> x5;
    if (x1 == 0) cout << 1 << "\n";
    else if (x2 == 0) cout << 2 << "\n";
    else if (x3 == 0) cout << 3 << "\n";
    else if (x4 == 0) cout << 4 << "\n";
    else if (x5 == 0) cout << 5 << "\n";
    else cout << 0 << "\n";
}

Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  if (a>=k){
    cout << k << endl;
  }
  else if (a + b >= k) {
    cout << a << endl;
  }
  else if(a + b + c >= k){
    int n = k-(a+b);
    cout << a + (-1*n) << endl;
  }
}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
double a;
string s;
main()
{
	while(cin>>a,a>=0)
	{
		s="";
		for(double i=128;i>0.06;i/=2)
		{
			if(a>=i)
			{
				s+="1";
				a-=i;
			}
			else s+="0";
			if(i==1)s+=".";
		}
		if(a)s="NA";
		cout<<s<<endl;
	}
}



Measured memory_bytes: 3216
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

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

using namespace std;

int prim(vector<vector<int>> to, vector<vector<int>> dist, int n) {
  priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> q;
  q.push(make_pair(0,0));
  vector<bool> vis(n,false);
  int sum = 0;
  while(!q.empty()){
    auto p=q.top();q.pop();
    if(vis[p.second]) continue;
    vis[p.second] = true;
    sum += p.first;
    for(int i = 0;i < to[p.second].size(); ++i) {
      if(vis[to[p.second][i]] == false) {
        q.push(make_pair(dist[p.second][i], to[p.second][i]));
      }
    }
  }
  return sum;
}

int main() {
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    int m;
    cin >> m;
    vector<vector<int>> to(n);
    vector<vector<int>> dist(n);
    for(int i = 0; i < m; ++i) {
      int a,b,d;
      scanf("%d,%d,%d", &a,&b,&d);
      to[a].push_back(b);
      to[b].push_back(a);
      dist[a].push_back(d);
      dist[b].push_back(d);
    }
    int mspd = prim(to,dist,n);
    mspd /= 100;
    mspd -= n - 1;
    cout << mspd << endl;
  }
  return 0;
}

Measured memory_bytes: 1556
import scala.io.StdIn

object Main extends App {

  val Array(a,b,c) = StdIn.readLine.split(" ").map(_.toInt)

  val ans = if((a+b) >= c) b + c
    else if(b > c) c * 2 + a
    else  b * 2 + a + 1

  println(ans)
}

Measured memory_bytes: 27192
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

/*
1
4
0011
 */
public class Main {

    public static void main(String[] args) {
        FastScanner fs=new FastScanner();
        long n=fs.nextInt();
        long ans=0;
        if (n % 2 == 0 || n % 5 == 0) {
            ans = -1;
            System.out.println(ans);
            return;
        }
        long count = 1;
        long num = 7;
        while (num % n != 0) {
            count++;
            num = (10 * num + 7) % n;
            if (count > (long)1e6) {
                ans = -1;
                System.out.println(ans);
                return;
            }
        }
        System.out.println(count);



        

    }

    static final Random random=new Random();

    static void ruffleSort(int[] a) {
        int n=a.length;//shuffle, then sort
        for (int i=0; i<n; i++) {
            int oi=random.nextInt(n), temp=a[oi];
            a[oi]=a[i]; a[i]=temp;
        }
        Arrays.sort(a);
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] nextArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }


}

Measured memory_bytes: 32832
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int tmp;
    tmp=b;
    b=a;
    a=tmp;
    tmp=c;
    c=a;
    a=tmp;
    cout << a << " " << b << " " << c << endl;
    return 0;
}

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

const int mx=101,mxW=1e5+1;
int w[mx],v[mx],tWeiht,n;
long long dp[mx][mxW];
long long solve(int i,int cWeight)  //i->item
{
    if(i>n) return 0;
    if(dp[i][cWeight]!=-1) return dp[i][cWeight];
    long long ret1=solve(i+1,cWeight);
    long long ret2=0;
    if(w[i]+cWeight<=tWeiht)  ret2=v[i]+solve(i+1,cWeight+w[i]);
    return dp[i][cWeight]=max(ret1,ret2);
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt","r",stdin);
    cin>>n>>tWeiht;
    for(int i=1;i<=n;i++) cin>>w[i]>>v[i];
    memset(dp,-1,sizeof dp);

    cout<<solve(1,0);
    return 0;
}



Measured memory_bytes: 82532
#include <stdio.h>
#include <string.h>
int main()
{
	char str1[15], str2[15], trash [15];
	int balls1, balls2;
	scanf("%s %s", str1, str2);
	scanf("%d %d", &balls1, &balls2);
	scanf("%s", trash);
	(strcmp(trash, str1) == 0)? balls1 --: balls2 --;
	printf("%d %d\n", balls1, balls2);
	return 0;
}

Measured memory_bytes: 2144
#include <bits/stdc++.h>
    using namespace std;
    
    int main(){
        string str;
        cin >> str;
        for(int i = 0 ; i < str.length() ; i++){
            if(str[i] == ',') str[i] = ' ';
        }
        cout << str << endl;
        return 0;
    }

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

using namespace std;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    while (true) {
        int total_price;
        cin >> total_price;
        if (total_price == 0) break;

        int ans = total_price;
        int price;
        REP(i, 9) {
            cin >> price;
            ans -= price;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 2968
S = input()
strLen = len(S)

def evenStr():
    halfLen = len(S) // 2
    left = S[0:halfLen]
    right = S[halfLen:]
    if left == right:
        return True
    else:
        return False

while 1:
    strLen -= 2
    S = S[0:strLen]
    if evenStr():
        print(str(len(S)))
        break


Measured memory_bytes: 3064
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

string maxStr(string a, string b) {
  a = string(find_if(all(a), [&](char c) { return c != '0'; }), a.end());
  b = string(find_if(all(b), [&](char c) { return c != '0'; }), b.end());
  if (a.size() > b.size()) return a;
  if (a.size() < b.size()) return b;
  return max(a, b);
}
main {
  while (true) {
    int w, h;
    cin >> w >> h;
    if (w == 0 && h == 0) break;
    vector<string> c(h);
    cin >> c;
    auto dp = vectors(h, w, string());
    rep(i, h) rep(j, w) dp[i][j] = string(1, c[i][j]);
    string ans;
    rep(i, h) rep(j, w) {
      if (not isdigit(c[i][j])) continue;
      ans = maxStr(ans, dp[i][j]);
      if (i + 1 < h && isdigit(c[i + 1][j])) {
        dp[i + 1][j] = maxStr(dp[i + 1][j], dp[i][j] + string(1, c[i + 1][j]));
        ans = maxStr(ans, dp[i + 1][j]);
      }
      ans = maxStr(ans, dp[i][j]);
      if (j + 1 < w && isdigit(c[i][j + 1])) {
        dp[i][j + 1] = maxStr(dp[i][j + 1], dp[i][j] + string(1, c[i][j + 1]));
        ans = maxStr(ans, dp[i][j + 1]);
      }
    }
    cout << ans << endl;
  }
}



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

int main() {
  cout << fixed << setprecision(10);
  int A, B, H, M; cin >> A >> B >> H >> M;
  double theta, c, d;
  theta = 3.14159265359 / 360 * (60*H - 11*M);
  c = cos(theta);
  d = sqrt(A*A+B*B-2*A*B*c);
  cout << d;
}

Measured memory_bytes: 4124
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;
 
#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
 
const ll MAX_N = 100000;
 
int main(void){
    ll a,b,c,d;
    string s,t,u;
 
    //cin >> a >> b>> c >> d;
    cin >> s >> t >> u;
    ll ss,tt,uu;
    ss = s.length();
    tt = t.length();
    
    if (s[ss-1]==t[0]&&t[tt-1]==u[0]) cout << "YES";
    else cout << "NO";
 
 
 
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;


vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}

ll comb(long a, long b){     // C(a,b) = a! * b!^(M-2) * (a-b)^(M-2)
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % MOD;
    return tmp * fac[a] % MOD;
}

void pre_comb()
{
    fac[0] = 1;
    ifac[0] = 1;
    for(long i = 0; i<300000; i++){
        fac[i+1] = fac[i]*(i+1) % MOD; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, MOD-2) % MOD; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }
    return;
}

int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);

    vector<long> a(n+1);
    set<long> xx;
    long i;
    long m=0;
    long mm[2]={0};
    for(i=0; i<n+1; i++) {
        scanf("%ld", &a[i]);
        if(!xx.insert(a[i]).second) {
            m=a[i];
            mm[1]=i;
        }
    }
    for(i=0; i<n+1; i++) {
        if(m==a[i]) {
            mm[0]=i; break;
        }
    }
    long r = mm[1]-mm[0]-1;

    pre_comb();

    long k;
    for(k=1; k<=n+1; k++) {
        ll ans = comb(n-1, k);
        ans += comb(n-1, k-1)*2;
        ans %= MOD;
        if(k>0) ans+= MOD-comb(n-1-r, k-1);
        ans %= MOD;
        if(k>1) ans+= comb(n-1, k-2);
        ans %= MOD;

        printf("%lld\n", ans);
    }

    return 0;
}


Measured memory_bytes: 11392
#include<stdio.h>
int main(void)
{
	int a[6],i,w,x,j;
	for(i=0;i<6;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<3;i++){
		for(j=i+1;j<4;j++){
			if(a[i]<a[j]){
				w=a[i];
				a[i]=a[j];
				a[j]=w;
			}
		}
	}
	if(a[4]>a[5]){
		x=a[0]+a[1]+a[2]+a[4];
	}
	else{
		x=a[0]+a[1]+a[2]+a[5];
	}
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 2712
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &in, vector<T> &vec) {
    for (auto &e : vec) in >> e;
    return in;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

double rad(double deg) {
    return deg / 180 * M_PI;
}

double deg(double rad) {
    return rad / M_PI * 180;
}

double f(double a, double b, double theta) {
    const double atan = a * tan(theta);

    if (atan - 1e-10 > b) {
        const double k = b / tan(theta);
        return k * b / 2 * a;
    }
    else {
        return a * a * b - (a * atan / 2 * a);
    }
}

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

    double a, b, x;
    read(a, b, x);

    double ok = 0.0;
    double ng = rad(90);
    rep(i, 100) {
        const double mid = (ok + ng) / 2;
        if (f(a, b, mid) + 1e-10 < x) {
            ng = mid;
        } else {
            ok = mid;
        }
    }

    cout << fixed << setprecision(12);
    print(deg(ok));

    return 0;
}


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

int main() {
  int n, h; cin >> n >> h;
  vector<int> a(n), b(n);
  int max_a = 0;
  // input and calc max(a)
  for (int i = 0; i < n; i++){
    int ai, bi; cin >> ai >> bi;
    a.at(i) = ai;
    b.at(i) = bi;
    max_a = max(max_a, ai);
  }
  //division swords
  vector<int> attack;
  int key_b = 1000000005;
  for (int i = 0; i < n; i++){

    if (a.at(i) == max_a){

      if (b.at(i) < key_b){
        if (key_b != 1000000005){
          attack.push_back(key_b);
        }
        key_b = b.at(i);
      }
      else{
        attack.push_back(b.at(i));
      }

    }
    else if (max_a < b.at(i)){
      attack.push_back(b.at(i));
    }
  }

  sort(attack.begin(), attack.end());
  reverse(attack.begin(), attack.end());

  int ans = 0;
  for (int i = 0; i < attack.size(); i++){
    if (attack.at(i) > key_b){
      h -= attack.at(i);
      ans++;
    }
    else if (h <= key_b){
      h -= key_b;
      ans++;
    }
    else{
      h -= attack.at(i);
      ans++;
    }

    if (h <= 0){
      break;
    }
  }

  if (h <= 0){
    cout << ans << endl;
  }
  else if (0 < h && h <= key_b){
    cout << ans+1 << endl;
  }
  else if (key_b < h){
    h -= key_b;
    ans ++;

    if (h % max_a == 0){
      ans += h/max_a;
    }
    else{
      ans += 1 + h/max_a;
    }
    cout << ans << endl;
  }

}



Measured memory_bytes: 1660
#include <iostream>
using namespace std;
int main()
{
int a , b ,c ;
cin>>a>>b>>c;
if (a==b&&b==c){
    cout<<"1"<<endl;return 0;
}
if(a==b||b==c||a==c){
    cout<<"2"<<endl;return 0;
}
if(a!=b && b!=c && a!=c)
    cout<<"3"<<endl;return 0;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

S = list(input().rstrip())
T = list(input().rstrip())

t = {}
for i in range(len(S)):
    if S[i] in t:
        if t[S[i]] == T[i]:
            continue
        else:
            print('No')
            exit()

    t[S[i]] = T[i]

if len(t) == len(set(t.values())):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 6704
PI = 3.14159265358979323846

a,b,x = gets.split.map(&:to_f)

s = x / a
ans = 0
a2  = 0

  if s > b * a / 2
    bu = 2 * s / a - b
    s -= a * bu
    b -= bu
    a2 = a
  else
    a2 = 2 * s / b
  end
  r = Math.atan(b/a2)
  ans = r * (180.0/PI)

puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << min(b / a, c) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int N, X, f = 0;

	cin >> N;
	X = N;
	
	while (true) {
		if (X == 0) {
			break;
		}
		f += X % 10;
		X /= 10;
	}
	if (N % f == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

s = [list(map(int,input().split())) for i in range(n)]
s.sort()

stop = s[0][0] + s[0][1]
ans = 1
for i in range(1,n):
    num = s[i][0]
    l = s[i][1]
    if num - l >= stop:
        ans += 1
        stop = num + l
    if num + l < stop:
        stop = num + l
    

print(ans)




Measured memory_bytes: 27872
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-03-14 21:31:08 +0900
# LastModified: 2020-03-16 13:10:13 +0900
#


import os
import sys
import math

def main():
    a,b,c = map(int,input().split())
    if 4*a*b<(c-a-b)**2 and c-a-b>0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

void solve(long long H, long long W){
	ll res = INF;
	if (H%3 != 0) res = min(res, W); else res = 0;
	if (W%3 != 0) res = min(res, H); else res = 0;
	repn(i, H-1) {
		priority_queue<ll> que;
		que.push(W*i);
		que.push(W/2*(H-i));
		que.push((W/2+W%2)*(H-i));
		ll ma, mi;
		ma = que.top();
		que.pop();
		que.pop();
		mi = que.top();
		res = min(res, ma-mi);
	}
	repn(i, W-1) {
		priority_queue<ll> que;
		que.push(H*i);
		que.push(H/2*(W-i));
		que.push((H/2+H%2)*(W-i));
		ll ma, mi;
		ma = que.top();
		que.pop();
		que.pop();
		mi = que.top();
		res = min(res, ma-mi);
	}
	cout << res << endl;
}

int main(){	
	long long H;
	long long W;
	scanf("%lld",&H);
	scanf("%lld",&W);
	solve(H, W);
	return 0;
}



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

using namespace std;
using p=pair<int,int>;
typedef long long ll;
const ll mod = 1000000007;

int main(){
  ll n;
  cin >> n;
  ll k=0;
  ll m=0;
  for(int i=1;i*i<n;i++){
    for(int j=i;i*j<n;j++){
      k++;  
      if(i==j){
        m++;
      }
    }
  }
  cout << (k-m)*2+m << endl;
  
}


Measured memory_bytes: 3632
N = int(input())
l = []
for i in range(N-1):
  c, s, f = map(int, input().split())
  l.append([c, s, f])
  
for i in range(N-1):
  time = l[i][1] + l[i][0]
  for j in range(i+1, N-1):
    if time-l[j][1] >= 0:
      wait = time % l[j][2]
      if wait == 0:
        time += l[j][0]
      else:
        time += l[j][2] - wait + l[j][0]
    else:
      time = l[j][1] + l[j][0]
  print(time)
print(0)

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod=1000000007;
//const int mod=998244353;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
VL dx={1,0,-1,0};
VL dy={0,1,0,-1};
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
vector<VL> adj;
VL visit2;
void dfs(int v)
{
    visit2[v]=1;
    for(auto to: adj[v])
    {
        if(visit2[to]==0)
        {
            dfs(to);
        }
    }
    return;
}
void solve()
{
    ll n,m;
    cin>>n>>m;
    adj.assign(n,VL());
    fr(i,0,m)
    {
        ll x,y;
        cin>>x>>y;
        x--,y--;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    visit2.assign(n,0);
    ll comp=0;
    fr(i,0,n)
    {
        if(visit2[i]==0)
        {
            comp++;
            dfs(i);
        }
    }
    cout<<comp-1<<endl;
    return;
}
int main()
{
    IOS;
    ll t=1,pp;
    //cin>>t;
    pp=t;
    while(t--)
    {
        //cout<<"Case #"<<pp-t<<": ";
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
/*
recursion - matrix exponential

*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

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

int main(){
    int A,B;
    // int a,b,c,d;
    int tmp = 0, ans = 0;
    vector<int> a(5);
    cin >> A >> B;
    for(int i = A ; i <= B; i++){
        int tmp = i;
        for(int j = 0; j < 5; j++){
            a[4-j] = tmp % 10;
            tmp /= 10;
        }
        if(a[0] == a[4] && a[1] == a[3]){
            ans++;
        }
    } 
    cout << ans << endl;
}

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

using namespace std;

#define frei(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define fred(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define fri(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define frd(i,n) for (int i = (n) - 1; i >= 0; i--)
#define foreach(it, ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )

#define uint64 unsigned long long
#define int64 long long
#define all(ar) ar.begin(), ar.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define ff first
#define ss second
#define pr pair

#define BIT(n) (1<<(n))
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a) | (b))
#define XOR(a,b) ((a) ^ (b))
#define sqr(x) ((x) * (x))

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<pii> vii;
typedef vector<int> vi;

#define PI 3.1415926535897932385
#define INF 1000111222
#define eps 1e-7
#define maxN 5005



int main(int argc, char const *argv[])
{
    /* code */
    int n, w;
    cin >> n >> w;
    vector<int64> dp(w+1);
    vector<int64> new_dp(w+1);
    int item[n+1][2];
    for(int i = 1; i <= n; i++) {
        cin >> item[i][0] >> item[i][1];
    }
    //memset(dp, 0, sizeof(dp));
    //memset(new_dp, 0, sizeof(new_dp));
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= w; j++) {
            if(j >= item[i][0]) {
                new_dp[j] = max(dp[j], dp[j - item[i][0]] + item[i][1]);
            } else {
                new_dp[j] = dp[j];
            }
        }
        dp = new_dp;
    }
    int64 ans = 0;
    for(int i = 1; i <= w; i++) ans = max(ans, dp[i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <stdlib.h>
using namespace std;

typedef long long int ll;

ll minCheck(ll min, ll K){
    ll m = abs(min - K);
    
    if(min > m) return minCheck(m, K);
    
    return min;
}

int main(void){
    ll N, K, cut;
    cin >> N >> K;
    
    cut = (N / K);
    if(cut > 0) N = N - (K * cut);
    cout << minCheck(N, K) << endl;
    
    return 0;
}


Measured memory_bytes: 256