akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  vector<int>A(M);
  int sum=0;
  for(int i=0;i<M;i++){
    cin>>A.at(i);
    sum=sum+A.at(i);
  }
  if(N-sum<0){
    cout<<-1<<endl;
  }
  else{
    cout<<N-sum<<endl;
  }
}

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

int main() {
  int n; cin >> n;
  int i = 0;
  int ans = 0;
  while(1) {
    int x = pow(2,i);
    if (x > n) break;
    ans = x;
    i++;
  }
  cout << ans << endl;
  return 0;
}

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

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void angshuGod()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){    

    int n;
    cin>>n;

    string s;
    cin>>s;

    map<int,bool>m;
    vi r,g;
    fo(i,n){
        char c = s[i];
        if(c=='R') r.pb(i);
        if(c=='B') m[i] = true;
        if(c=='G') g.pb(i);
    }
    int b = m.size();
    int ans = r.size()*g.size()*b;
    for(int a : r){
        for(int b : g){
            if((a+b)%2==0 and m[(a+b)/2]) ans--;
            if(m[2*a-b]) ans--;
            if(m[2*b-a]) ans--;
        }
    }
    cout<<ans;
}

 
int32_t main()
{
    angshuGod();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 4416
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	sort.Sort(sort.Reverse(sort.IntSlice(a)))

	var sum int
	for i := 0; i < n; i++ {
		if i%2 == 0 {
			sum += a[i]
		} else {
			sum -= a[i]
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define dbg(x) cerr<<#x": "<<(x)<<endl
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}
#define all(v) v.begin(), v.end()
#define fi first
#define se second

template<typename T1, typename T2>
ostream& operator <<(ostream &out, const pair<T1, T2> &item) {
	out << '(' << item.first << ", " << item.second << ')';
	return out;
}

template <typename T>
ostream& operator <<(ostream &out, const vector<T>& v) {
	for(const auto &item : v) out << item << ' ';
	return out;
}

int main()
{
	ios_base::sync_with_stdio(false);

	string s;
	int len = 1;

	cin >> s;
	for(auto ch : s) {
		if(ch == 'C' && len == 1) ++len;
		if(ch == 'F' && len == 2) ++len;
	}

	cout << (len == 3 ? "Yes" : "No") << '\n';

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    long long x,y;cin>>x>>y;
    bitset<32> a(x),b(y);
    cout<<(a & b)<<endl;
    cout<<(a | b)<<endl;
    cout<<(a ^ b)<<endl;
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define fs first
#define se second
#define M 1000000007
ll exp(ll a,ll p)
{
	if(p==1)
		return a;
	if(p==0)
		return 1;
	ll st=exp(a,p/2);
	st=(st*st)%M;
	if(p%2 != 0)
		st=(st*a)%M;
	return st;
} 
int solve(int A, int B, int C) {
    ll mn=0,mx=1e18;
    ll ans=INT_MAX,mid;
    ll g=__gcd(A,B);
    ll l=(A*B)/g;
    cout<<l<<endl;
    while(mn<=mx)
    {
        mid=mn+(mx-mn)/2;
        ll f2=mid/A;
        ll f3=mid/B;
        ll f4=mid/l;
        ll t=f2+f3-f4;
        cout<<mid<<" "<<t<<endl;
        if(t>=A)
        {
            mx=mid-1;
            ans=min(mid,ans);
        }
        else 
        {
            mn=mid+1;
        }
        
    }
    return ans%M;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	// ll t;
	// cin>>t;
	// while(t--)
	// {
		
	// }
	ll n;
	cin>>n;
	string s;
	cin>>s;
	ll c=0;
	for(ll i=0;i<n-2;i++)
	{
		if(s[i]=='A')
		{
			if(s[i+1]=='B' && s[i+2]=='C')
				c++;
		}
	}
	cout<<c<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define endl '\n'
#define N 100000 + 5
using namespace std;

int n, a[N];

int main(){
    IOS;
    set<int> s;
    vector<int> v;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(s.count(a[i])){
            v.push_back(a[i]);
            s.erase(a[i]);
        }
        else
            s.insert(a[i]);
    }
    sort(v.begin(), v.end(), greater<int>());
    long long ans = 0;
    if(v.size() >= 2) ans = 1LL * v[0] * v[1];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5376
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
#define endl '\n'
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 222222


string grid[555];
bool used[555][555];

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


  ll h, w;
  cin >> h >> w;
  rep(i, h) cin >> grid[i];
  queue<pll> q;
  pll cur;
  rep(y, h) rep(x, w) {
    if (used[y][x]) continue;
    q.push(make_pair(y, x));
    used[y][x] = true;
    ll a = 0, b = 0;
    while (!q.empty()) {
      cur = q.front();
      q.pop();
      if (grid[cur.first][cur.second] == '.') a++;
      else b++;
      FOR(i, 1, 5) {
        pll to = pll(cur.first + dy[i], cur.second + dx[i]);
        if (to.first < 0 || to.first >= h || to.second < 0 || to.second >= w) continue;
        if (used[to.first][to.second]) continue;
        if (grid[cur.first][cur.second] == grid[to.first][to.second]) continue;
        used[to.first][to.second] = true;
        q.push(to);
      }
    }
    ans += a * b;
  }
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define modulo 1000000007
#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;
int a[21][21];
ll dp[1<<21]={0};
int main(){
	fast_io;
	int n;
	cin>>n;
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < n; ++j){
			cin>>a[i][j];
		}
	}
	dp[0]=1;
	for (int i = 0; i < (1<<n); ++i){
		int idx=__builtin_popcount(i);
		for (int j = 0; j < n; ++j){
			if(a[idx][j] && (!(i & (1<<j))))
				dp[i | (1<<j)]=(dp[i | (1<<j)]+dp[i])%modulo;
		}
	}
	cout<<dp[(1<<n)-1]<<"\n";
	return 0;
}

Measured memory_bytes: 20036
import math
# A, B, H, M = 3, 4, 9, 0
A, B, H, M = map(int, input().split())

deg = 0
deg += 5.5 * M
deg -= 30 * H

print(math.sqrt(A**2 + B**2 - 2*A*B* math.cos(math.radians(abs(deg)))))

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

int main()
{
	int k, n;
	cin >> k >> n;
	vector<int> a(n);
	rep(i, n)
	{
		cin >> a[i];
	}
	int max_d = k - a[n - 1] + a[0];
	rep2(i, 1, n)
	{
		max_d = max(max_d, a[i] - a[i - 1]);
	}
	cout << k - max_d << endl;
	return 0;
}


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

int main()
{
    char a[7];
    while(cin>>a)
    {
        int flag=0;
        for(int i=0;i<strlen(a)-1;i++)
            if(a[i]=='A'&&a[i+1]=='C')
            {
                flag=1;
            }
        if(flag) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}

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

int main(){
	int N;
	cin >> N; 
	vector<int> a(N);
	for(int i=0; i<N; i++)cin >> a[i];
	sort(a.begin(),a.end());

	int ans = 1e9;
	for(int i=a[0]; i<=a[N-1]; i++){
		int t=0;
		for(int u : a){
			t += (u-i)*(u-i);
		}
		ans = min(ans,t);
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3624
#include<stdio.h>
#include<math.h>
int main(){
  int n,i,mi,mj,c;
  double max,m,ax,ay,by,bx,x[100],y[100];
  while(scanf("%d",&n),n){
    int f[100]={0};
    ay=1;
    ax=max=0;
    for(i=0;i<n;i++){
      scanf("%lf,%lf",&x[i],&y[i]);
      if(max<x[i])max=x[mi=i];
    }
    for(c=0;f[mi]==0;c++){//printf("%d\n",mi);
      f[mi]=1;
      for(i=max=0;i<n;i++){
	if(mi==i)continue;
	bx=x[i]-x[mi];
	by=y[i]-y[mi];
	m=(ax*bx+ay*by)/(hypot(ay,ax)*hypot(bx,by));
	if(ax*by<ay*bx)m=1-m;
	else m+=3;
	if(max<m){
	  max=m;
	  mj=i;
	}
      }
      ax=x[mj]-x[mi];
      ay=y[mj]-y[mi];
      mi=mj;
    }
    printf("%d\n",n-c);
  }
  return 0;
}

Measured memory_bytes: 652
var toInt = x=>parseInt(x,10);
var toIntArr = arr=>arr.map(x=>toInt(x));
var abs = x=>x>0?x:-x;
function min(){var rest=arguments,v=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]<v)v=rest[i];return v}
function max(){var rest=arguments,v=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]>v)v=rest[i];return v}
function gcd(){var rest=arguments,v=rest[0],temp=(a,b)=>b?temp(b,a%b):a;for(var i=1;i<rest.length;i++)v=temp(v,rest[i]);return v}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
 
function Main(input){
	var input = input.split('\n');
	var n = toInt(input[0]);
	var ta = toIntArr(input[1].split(' '));
	var hs = toIntArr(input[2].split(' '));
	var t = ta[0];
	var a = ta[1];

	var ans = 1;
	var x =abs(t-a-0.006*hs[0]) ,y;
	for(var i = 1; i < n; i++){
		y = abs(t-a-0.006*hs[i]);
		//console.log(i,x,y)
		if(y<x){
			ans = i+1;
			x = y;
		}
	}

	console.log(ans);

}



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

typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int ans = max(0, min(B, D) - max(A, C));
    cout << ans << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

int n;
ll A[3005];
ll dp[3005][3005];

ll solve(int i, int j) {
  if (i > j) {
    return 0;
  }
  if (dp[i][j] != -1) {
    return dp[i][j];
  }
  dp[i][j] = max(A[i] - solve(i + 1, j), A[j] - solve(i, j - 1));
  return dp[i][j];
}

int main() {
  fill(&dp[0][0], &dp[0][0] + 3005 * 3005, -1);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  cout << solve(0, n - 1) << '\n';
  return 0;
}


Measured memory_bytes: 71040
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>

using namespace std;
typedef long long ll;

ll W, H, x, y;

int main() {
	cout << fixed << setprecision(10);
	cin >> W >> H >> x >> y;
	cout << (double)W*H / 2 << " ";
	if ((double)x == (double)W / 2 && (double)y == (double)H / 2) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n,k,x,y,res=0;
	scanf("%d",&n);
	scanf("%d",&k);
	scanf("%d",&x);
	scanf("%d",&y);
	if(n > k){
		res += k*x + (n-k)*y;
	}else{
		res += x*n;
	}
	printf("%d\n",res);
}

Measured memory_bytes: 128
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner scan = new FastScanner();

		String s = scan.next();

		PrintWriter out = new PrintWriter(System.out);
		out.println(s.startsWith("S") ? "Cloudy"
				: s.startsWith("C") ? "Rainy" : "Sunny");
		out.flush();
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 21076
/*
Atcoder abc159F
*/
#include <bits/stdc++.h>
using namespace std;

#define int long long

const int M = 998244353;

int n,s,a[3005];
int ans,f[3005];

signed main()
{
	cin>>n>>s;
	for(int i=1;i<=n;cin>>a[i++]);
	for(int i=1;i<=n;i++)
	{
		if(a[i]==s)
			ans = (ans+i*(n-i+1))%M;
		else if(a[i]<s)
		{
			ans = (ans+f[s-a[i]]*(n-i+1))%M;
			for(int j=s;j>a[i];j--)
				f[j] = (f[j]+f[j-a[i]])%M;
			f[a[i]] = (f[a[i]]+i)%M;
		}
	}
	cout<<ans%M<<endl;
	
	return 0;
}

Measured memory_bytes: 3548
#!/usr/bin/env python3
import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b

def main():
    N = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())

    x = min(A, B, C, D, E)

    ans = 5
    ans += N // x
    if N % x == 0:
        ans -= 1
    print(ans)

if __name__ == '__main__':
    main()


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

ll dfs(ll prev, ll now, vector<vector<ll>>& adj, vector<ll>& dp, vector<bool>& seen) {
	if (dp[now] > 0) return dp[now];
	if (seen[now]) return -1;
	seen[now] = true;
	ll ret = 0;
	for (auto i : adj[now]) {
		if (i == prev) continue;
		ll x = dfs(now, i, adj, dp, seen);
		if (x == -1) return -1;
		ret = max(ret, x);
	}
	seen[now] = false;
	return dp[now] = ret + 1;
}

int main() {
	ll n;
	cin >> n;
	vector<vector<ll>> a(n, vector<ll>(n - 1));
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < n - 1; j++) {
			cin >> a[i][j];
			a[i][j]--;
		}
	}

	auto idx = [&] (ll i, ll j) {
		if (i > j) swap(i, j);
		ll ret = n * (n - 1) / 2 - (n - i) * (n - i - 1) / 2;
		return ret + j - i - 1;
	}; // {i, j} が対戦する試合の頂点番号

	ll m = n * (n - 1) / 2;
	vector<vector<ll>> adj(m);
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < n - 2; j++) {
			ll u = idx(i, a[i][j]), v = idx(i, a[i][j + 1]);
			adj[u].push_back(v);
		}
	}

	vector<ll> dp(m, 0);
	ll ans = 0;
	for (ll i = 0; i < m; i++) {
		vector<bool> seen(m, false);
		ll x = dfs(-1, i, adj, dp, seen);
		if (x == -1) {
			cout << -1 << endl;
			return 0;
		} else ans = max(ans, x);
	}

	cout << ans << endl;
}

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

typedef long long       ll;

int h, w, k, idxToAdd[19], sum[19], sumNew[19];
char grid[1009][1009];

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

    cin >> h >> w >> k;
    for (int i=1; i<=h; ++i) {
        for (int j=1; j<=w; ++j) {
            cin >> grid[i][j];
        }
    }

    int ans=w*h;
    for (int bitmask=0; bitmask<(1<<(h-1)); ++bitmask) {
        int temp=bitmask;
        // memset
        for (int i=0; i<=h; ++i) {idxToAdd[i]=0; sum[i]=sumNew[i]=0;}

        // set bits positions
        int cur=1, cnt=1;
        while (temp) {
            if (temp&1) {idxToAdd[cur]=cnt++;}

            ++cur; temp >>= 1;
        }

        // set index to add
        cnt=1;
        for (int i=1; i<=h; ++i) {
            if (!idxToAdd[i])       idxToAdd[i]=cnt;
            else                    ++cnt;
        }

        int prv=0;
        bool can=1, finish=0;;
        cnt=0;
        while (can && prv<w) {
            // memset
            for (int i=1; i<=h; ++i) {sum[i]=0;}

            bool stop=0;
            can=0;
            for (int j=prv+1; j<=w && !stop; ++j) {
                bool canNew=1;
                for (int i=1; i<=h; ++i) {sum[i]+=sumNew[i]; sumNew[i]=0;}

                for (int i=1; i<=h; ++i) {
                    sumNew[ idxToAdd[i] ]+=(grid[i][j]=='1');

                    /*if (i==2 && j==5) {
                        cout << "idx= " << idxToAdd[i] << " " << grid[i][j] << "\n";
                    }*/

                    if (sumNew[ idxToAdd[i] ]+sum[ idxToAdd[i] ]>k) {
                        for (int t=1; t<=h; ++t) {
                            sumNew[t]=0;
                        }

                        canNew=0;
                        stop=1;
                        ++cnt;
                        break;
                    }
                }

                if (canNew) {can=1; prv=j;}


                /*for (int i=1; i<=h; ++i) {
                    cout << "\t" << sum[i] << " ";
                }
                cout << "\n";*/
            }
        }

        if (prv==w) {
            //cout << bitmask << " " << cnt+__builtin_popcount(bitmask) << "\n\n";
            ans=min(ans, cnt+__builtin_popcount(bitmask));
        }
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1e+7
#define int long long
#define garou ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
signed main() {
    garou;
    int n,k;
    cin>>n>>k;
    map<int,int> m;
    while(k--){
        int d;
        cin>>d;
     while(d--){
         int a;
         cin>>a;
         m[a]++;
     }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(m[i]==0){
            ans++;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define print(x) cout<<x;
#define printl(x) cout<<x<<endl;
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
using namespace std;
typedef long long int ll;

ll gcd(ll a, ll b) 
{ 
    // Everything divides 0  
    if (a == 0) 
       return b; 
    if (b == 0) 
       return a; 
   
    // base case 
    if (a == b) 
        return a; 
   
    // a is greater 
    if (a > b) 
        return gcd(a-b, b); 
    return gcd(a, b-a); 
} 

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b;
    cin>>a>>b;
    if(a<b)
        swap(a,b);
    ll g=gcd(a,b);
    cout<<a*b/g;
    return 0;
}

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

using namespace std;

int main() {
	string s;
	cin >> s;
	
	int ans1 = 0;
	for(int i = 0; i < s.size(); i++) {
		if(i % 2 == 1) {
			if(s[i] == '1') {
				ans1++;
			}
		}
		else {
			if(s[i] == '0') {
				ans1++;
			}
		}
	}
	
	int ans2 = 0;
	for(int i = 0; i < s.size(); i++) {
		if(i % 2 == 1) {
			if(s[i] == '0') {
				ans2++;
			}
		}
		else {
			if(s[i] == '1') {
				ans2++;
			}
		}
	}
	
	cout << (ans1 > ans2 ? ans2 : ans1) << endl;
	return 0;
}

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

int main(){
	int W,H,x,y,r;
	
	cin >> W >> H >> x >> y >> r;

	if (r > W || r > H)
		cout << "No" << endl;
	else if ((x - r) < 0 || W < (x + r))
		cout << "No" << endl;
	else if ((y - r) < 0 || H < (y + r))
		cout << "No" << endl;
	else
		cout << "Yes" << endl;

	return 0;
}

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

void solve(long long N, std::vector<long long> A)
{
    sort(A.begin(), A.end());
    if (A[0] == 0)
    {
        cout << 0 << endl;
        return;
    }

    ll ans = 1;
    for (ll i = 0; i < N; i++)
    {
        if (ans > (ll)1e18 / A[i])
        {
            ans = -1;
            break;
        }
        ans *= A[i];
    }
    cout << ans << endl;
}

signed main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


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

#define int long long
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)

int N;

signed main()
{
    cin >> N;

    int ans = 0;
    for(int i = 1; i < N; i++)
    {
        ans += (N - 1) / i;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramA
    {
        static void Main()
        {
            System.Console.WriteLine((NextInt * 3 + NextInt) / 2);
        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}


Measured memory_bytes: 13268
from math import factorial
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

x, y = map(int, input().split())
if x < y:
    tmp = y
    y = x
    x = tmp
plus = x + y
if plus % 3 != 0 or x / y > 2:
    print(0)
    exit()

n = int(plus / 3)

center = int(plus / 2)
dist = center - y
pos = int(n / 2) - dist

div = 10**9 + 7


print(int(cmb(n,pos) % div))



Measured memory_bytes: 45196
#くじ引き

import numpy
import re
import math

def main():
	"""
	テストコード実行
	:return:
	"""
	line = input()
	char_list = list(line)
	int_list = [int(s) for s in char_list]
	count = 0
	for i in int_list:
		if i == 1:
			count += 1
	print(count)


if __name__ == '__main__':
	main()


Measured memory_bytes: 12504
#include <stdio.h>
#define H 250
#define NIL -1

int parent(int);
int left(int);
int right(int);

int main(){
  
  int n = 0;
  int A[H];
  int i = 0;
  
  scanf("%d",&n);
  for(i = 1; i <= n; i++){//1-origin
    scanf("%d",&A[i]);
  }

  for(i = 1; i <= n; i++){
    printf("node %d: key = %d, ",i,A[i]);
    
    if(i != 1){
      printf("parent key = %d, ",A[parent(i)]);
    }
    if(left(i) <= n){
      printf("left key = %d, ",A[left(i)]);
    }
    if(right(i) <= n){
      printf("right key = %d, ",A[right(i)]);
    }
    printf("\n");
  }
  return 0;
}

int parent(int i){
  return i/2;
}

int left(int i){
  return i*2;
}

int right(int i){
  return i*2+1;
}



Measured memory_bytes: 2088
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,0,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;

signed main(){
    int A[3][3];
    REP(i,3){
        REP(j,3)cin>>A[i][j];
    }
    bool ok=true;
    int d=A[0][0]-A[0][1];
    int e=A[0][1]-A[0][2];
    REP(i,2){
        if(A[i+1][0]-A[i+1][1]!=d||A[i+1][1]-A[i+1][2]!=e)ok=false;
    }
    d=A[0][0]-A[1][0];
    e=A[1][0]-A[2][0];
    REP(i,2){
        if(A[0][i+1]-A[1][i+1]!=d||A[1][i+1]-A[2][i+1]!=e)ok=false;
    }
    if(ok)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
N,A,B,C = [int(x) for x in input().split()]
l = []
for _ in range(N):
    l.append(int(input()))

INF = 10**9

def dfs(cur,a,b,c):
    if cur == N:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else INF
    ret0 = dfs(cur+1, a,b,c)
    ret1 = dfs(cur+1, a+l[cur],b,c) +10
    ret2 = dfs(cur+1, a, b+l[cur],c)+10
    ret3 = dfs(cur+1, a, b,c+l[cur])+10
    return min(ret0,ret1,ret2,ret3)

print(dfs(0,0,0,0))

Measured memory_bytes: 3064
from collections import deque
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
G = [[] for _ in [0]*N]
deg = [0]*N
for _ in [0]*M:
    a, b = map(int, input().split())
    G[a].append(b)
    deg[b] += 1

q = deque()

for v, d in enumerate(deg):
    if d == 0:
        print(v)
        q.append(v)

while q:
    v = q.popleft()
    for u in G[v]:
        deg[u] -= 1
        if deg[u] == 0:
            print(u)
            q.append(u)



Measured memory_bytes: 9000
if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))
    mod = 10**9 + 7

    numlist = dict()

    if n % 2 == 1:
        for i in range(0, n+1, 2):
            numlist[i] = []
    else:
        for i in range(1, n+1, 2):
            numlist[i] = []

    for aa in a:
        if aa not in numlist.keys():
            print('0')
            exit()
        numlist[aa].append(aa)

    for num in numlist:
        if num == 0 and len(numlist[num]) != 1:
            print('0')
            exit()
        elif num == 0 and len(numlist[num]) == 1:
            continue
        elif len(numlist[num]) != 2:
            print('0')
            exit()

    print(str(pow(2, n//2) % mod))


Measured memory_bytes: 17380
#include<stdio.h>
int main(void){
	char ball[2]="A",where[4];
	while(scanf("%s",where)!=EOF){
			if(ball[0]==where[0])ball[0]=where[2];
		else if(ball[0]==where[2])ball[0]=where[0];
	}
	printf("%s\n",ball);
	return 0;
}

Measured memory_bytes: 524
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


int main() {
	int n, m, c, ans = 0;
	cin >> n >> m >> c;
	vector<vector<int>> a(n, vector<int>(m));
	vi b(m);
	repz(i, m)cin >> b[i];
	repz(i, n) {
		repz(j, m)cin >> a[i][j];
		ll sum = 0;
		repz(j, m) {
			sum += a[i][j] * b[j];
		}
		if (sum + c > 0)ans++;
	}

	cout << ans << endl;

	system("pause");
	return 0;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define OO pow(10, 9)
using namespace std;

int main()
{
   int nb_pierres, t_mouv;
   cin >> nb_pierres >> t_mouv;
   int hauteur[nb_pierres];
   for (int i=0;i<nb_pierres;++i)cin>>hauteur[i];
   int cost_min[nb_pierres];
   for (int i=0;i<nb_pierres;++i)cost_min[i]=OO;
   cost_min[0] = 0;
   
   for (int ipierre = 0; ipierre < nb_pierres; ++ ipierre)
   {
       if (cost_min[ipierre] != OO)
       {
           for (int t_cur = 1; t_cur <= t_mouv && ipierre + t_cur < nb_pierres; ++ t_cur)
                chmin(cost_min[ipierre+t_cur], cost_min[ipierre] + abs(hauteur[ipierre]-hauteur[ipierre+t_cur]));
       }
   }
   cout << cost_min[nb_pierres-1];
   return 0;
}

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

int main() {
  int A, B;
  string op;
  cin >> A >> op >> B;
  
  int sum;
  if (op == "+") {
    sum = A + B;
  }
  else {
    sum = A - B;
  }
  
  cout << sum << endl;
}

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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).bigin(), (c).end())

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

    int res = 1e9;
    for (int i = 0; i < (1 << n); i++)
    {
        int t = 1;
        REP(j, n)
        {
            if (i & (1 << j))
                t += k;
            else
                t *= 2;
        }

        res = min(res, t);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
A=input()
n=len(A)
if n==1:
    print(int(A))
elif n==2:
    print(9)
elif n==3:
    print(9+int(A)-99)
elif n==4:
    print(909)
elif n==5:
    print(9+900+int(A)-9999)
else:
    print(90909)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define endl '\n'

double dp[303][303][303], sum;

int main()
{
	int n, a, f[4] = {};
	scanf("%d", &n);
	for(int i=0; i<n; i++)
	{
		cin >> a;
		f[a]++;
	}
	dp[0][0][0] = 0;
	for(int three=0; three<=n; three++)
		for(int two=0; two<=n; two++)
			for(int one=0; one<=n; one++)
			{
				sum = one + two + three;
				if( sum )
					dp[three][two][one] = n / sum;
				if( one )
					dp[three][two][one] += one/sum * dp[three][two][one-1];
				if( two )
					dp[three][two][one] += two/sum * dp[three][two-1][one+1];
				if( three )
					dp[three][two][one] += three/sum * dp[three-1][two+1][one];
				//cout << three << ' ' << two << ' ' << one << " : " << dp[three][two][one] << endl;
			}

	printf("%.12lf\n", dp[f[3]][f[2]][f[1]]);
	return 0;
}

Measured memory_bytes: 217344
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	string w[100];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>w[i];
	}
	for(int i=1;i<n;i++){
		for(int j=0;j<i;j++){
			if(w[j]==w[i]){
                cout<<"No"<<endl;
                return 0;
            }

		}
		if(w[i][0]!=w[i-1][w[i-1].size()-1]){
            cout<<"No"<<endl;
            return 0;
        }
	}
    cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 256
from collections import Counter


H, W, M, *hw = map(int, open(0).read().split())
h_cnt = Counter(hw[::2])
w_cnt = Counter(hw[1::2])
h_max = h_cnt.most_common(1)[0][1]
w_max = w_cnt.most_common(1)[0][1]

not_on_bomb = sum(1 for k, v in h_cnt.items() if v == h_max)
not_on_bomb *= sum(1 for k, v in w_cnt.items() if v == w_max)
for h, w in zip(*[iter(hw)] * 2):
    if h_cnt[h] == h_max and w_cnt[w] == w_max:
        not_on_bomb -= 1

ans = h_max + w_max
print(ans) if not_on_bomb else print(ans - 1)


Measured memory_bytes: 78572
#include <bits/stdc++.h>
using namespace std;
int main(){
  int s,a,b,c;
  cin >> s;
  a = s / 100;
  b = (s - a * 100) / 10;
  c = (s - a * 100 - b * 10) / 1;
  cout << a + b + c;
  
  return 0;
}

Measured memory_bytes: 3568
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<unordered_map>
typedef unsigned long long ull;
typedef signed long long sll;
using namespace std;

#define INF 0x7FFFFFFFFFFFFFFF
#define BIG_PRIME 1000000007

#define DEP 19
vector<sll> data;
vector<sll> lazy;

void Add(sll l,sll r,sll a,sll k=0,sll s=0,sll t=-1)
{
  if(t<0)t=(1<<(DEP-1));
  if(t<=l||r<=s)
  {
    if(s+1<t)
    {
      lazy[2*k+1]+=lazy[k];
      lazy[2*k+2]+=lazy[k];
    }
    data[k]+=lazy[k];
    lazy[k]=0;
    return;
  }
  if(l<=s&&t<=r)
  {
    lazy[k]+=a;
    if(s+1<t)
    {
      lazy[2*k+1]+=lazy[k];
      lazy[2*k+2]+=lazy[k];
    }
    data[k]+=lazy[k];
    lazy[k]=0;
    return;
  }
  lazy[2*k+1]+=lazy[k];
  lazy[2*k+2]+=lazy[k];
  lazy[k]=0;
  Add(l,r,a,2*k+1,s,(s+t)/2);
  Add(l,r,a,2*k+2,(s+t)/2,t);
  data[k] = max(data[2*k+1],data[2*k+2]);
}

sll Max(sll l,sll r, sll k=0,sll s=0,sll t=-1)
{
  if(t<0)t=(1<<(DEP-1));
  if(t<=l||r<=s)
  {
    if(s+1<t)
    {
      lazy[2*k+1]+=lazy[k];
      lazy[2*k+2]+=lazy[k];
    }
    data[k]+=lazy[k];
    lazy[k]=0;
    return -INF;
  }
  if(l<=s&&t<=r)
  {
    if(s+1<t)
    {
      lazy[2*k+1]+=lazy[k];
      lazy[2*k+2]+=lazy[k];
    }
    data[k]+=lazy[k];
    lazy[k]=0;
    return data[k];
  }
  
  lazy[2*k+1]+=lazy[k];
  lazy[2*k+2]+=lazy[k];
  lazy[k]=0;
  sll ml,mr;
  ml=Max(l,r,2*k+1,s,(s+t)/2);
  mr=Max(l,r,2*k+2,(s+t)/2,t);
  data[k]=max(data[2*k+1],data[2*k+2]);
  return max(ml,mr);
}
sll Max(sll n)
{
  return Max(0,n+1);
}

vector<pair<sll,sll>> R[200001];

int main()
{
  data.resize(1<<DEP,0);
  lazy.resize(1<<DEP,0);
  ull i,j,N,M;
  sll l,r,a;
  cin >> N >> M;
  for(i=0;i<M;++i)
  {
    cin >> l >> r >> a;
    R[r].push_back(make_pair(l,a));
  }
  
  for(i=1;i<=N;++i)
  {
    Add(i,i+1,Max(i-1));
    for(auto itr:R[i])
    {
      Add(itr.first,i+1,itr.second);
    }
  }
  
  cout << Max(N);

  return 0;
}


Measured memory_bytes: 20352
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let r: isize = iterator.next().unwrap().parse().unwrap();
    let d: isize = iterator.next().unwrap().parse().unwrap();
    let mut x: isize = iterator.next().unwrap().parse().unwrap();

    let mut result = String::new();
    for _ in 0..10 {
        x = r * x - d;
        result.push_str(&format!("{}\n", x));
    }
    return result.trim().to_string();
}


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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int ggcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  long long int n,k;
  cin>>n;
  vector<long long int> a(n),b(n),c(n),d(n);
  rep(i,n) cin>>a[i]>>b[i];
  c[0]=a[0];
  d[0]=b[0];
  rep(i,n-1){
    k=max((c[i]+a[i+1]-1)/a[i+1],(d[i]+b[i+1]-1)/b[i+1]);
    c[i+1]=k*a[i+1];
    d[i+1]=k*b[i+1];
  }
  cout<<c[n-1]+d[n-1]<<endl;
}
///////////////////////////

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>3
using namespace std;
void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}
int main(){
init();
long long a,t,c=0;
cin>>a;
string s;
  set <string> v;
for(int i=0;i<a;i++){
cin>>s;
v.insert(s);
}
    cout<<v.size();

}


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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,c; cin>>a>>b>>c;
	if (a+b>=c) cout<<"Yes\n"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


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

string reverse(string s){
  int n = s.size();
  string r;

  for(int i = n - 1; i >= 0; i--)r += s[i];
  
  return r;
}

int main(){
  string s;
  cin >> s;

  cout << reverse(s) << endl;

  return 0;
}

Measured memory_bytes: 3036
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  lint n, m, q, s = 0; cin >> n >> m >> q;
  v2i v(q, v1i(4)); string a = "", b = ""; rep(i, n) a += '0'; rep(i, n) b += '9';
  rep(i, q) rep(j, 4) cin >> v[i][j];
  while(a != b){
    v1i w(n);
    rep(i, n) w[i] = a[i]-'0'+1;
    rrep(i, n){
      if(a[i] != '9'){
        a[i] = (char)(a[i] + 1);
        while(i < n-1){
          ++i;
          a[i] = a[i-1];
        }
        break;
      }
    }
    bool d = 1;
    rep(i, n) if(w[i] > m) d = 0;
    if(d){
      lint t = 0;
      rep(j, q) if(w[v[j][1]-1]-w[v[j][0]-1] == v[j][2]) t += v[j][3];
      s = max(s, t);
    }
  }
  cout << s << "\n";
  return 0;
}

Measured memory_bytes: 3588
#include <iostream>
int main() {
    while (true) {
        int a, b;
        std::cin >> a >> b;
        if (a == 0 && b == 0) {
            break;
        } else {
            if (a > b) {
                std::cout << b << " " << a << "\n";
            } else {
                std::cout << a << " " << b << "\n";
            }
        }
    }
}


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


int main() {
    int64_t D, G;
    cin >> D >> G;
    vector<pair<int, pair<int, int>>> pairs(D);
    rep(i, D){
        int p, c;
        cin >> p >> c;
        pairs.at(i) = make_pair(100 * (i + 1), make_pair(p, c));
    }
    sort(pairs.begin(), pairs.end());
    reverse(pairs.begin(), pairs.end());

    int ans = 1001;
    for (int bit = 0; bit < (1 << 10); bit++){
        int count = 0;
        int64_t sum = 0;
        rep(i, D){
            if (bit & (1 << i)){
                int tmp_count = pairs.at(i).second.first;
                count += tmp_count;
                sum += pairs.at(i).first * tmp_count;
                sum += pairs.at(i).second.second;
            }
        }
        if (sum < G){
            rep(i, D){
                if (!(bit & (1 << i))){
                    int tmp_count = pairs.at(i).second.first;
                    tmp_count--;
                    if (sum + tmp_count * pairs.at(i).first < G){
                        count += tmp_count;
                        sum += tmp_count * pairs.at(i).first;
                    }
                    else{
                        tmp_count = (G - sum + pairs.at(i).first - 1) / pairs.at(i).first;
                        count += tmp_count;
                        sum += pairs.at(i).first * tmp_count;
                        break;
                    }
                }
            }
        }
        if (sum >= G) ans = min(ans, count);
    }
    cout << ans << endl;
}


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

#define GYOU_MAX 256

int main(void) {
	int A, B;
	scanf("%d%d", &A, &B);
	char va[100];
	int count = 0;
	for (int i = A; i <= B; i++) {
		sprintf(va, "%d", i);
		if (va[0] == va[4] && va[1] == va[3]) {
			count++;
		}
	}
	printf("%d\n", count);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
class DSU{
public:
    vector<int>p;
    int n;
    vector<int>sz;
    int ans = 1;
    DSU (int n){
        p.resize(n+1);sz.resize(n+1);for (int i = 0;i<=n;i++){p[i] = i;sz[i] = 1;}
    }
    int Find(int a){
        return p[a] = {p[a]==a ? a : Find(p[a])};
    }
    void Unite(int a,int b){
        a = Find(a);b = Find(b);if (a==b)return;if (sz[a]<sz[b])swap(a,b);p[a] = b;sz[b]+=sz[a];ans = max(ans,sz[b]);
    }
};
int main()
{
    int n,m;
    cin>>n>>m;
    DSU val(n);
    while (m--){
        int a,b;
        cin>>a>>b;
        val.Unite(a,b);
    }
    cout<<val.ans;
    return 0;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}




const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;

  int K = 0;
  for(;K*(K+1)/2 < N;++K);
  if(N != K*(K+1)/2){
	cout << "No" << endl;
	return 0;
  }

  const int sz = K+1;
  cout << "Yes" << endl << sz << endl;
  VVI ans(sz);
  int n = 1;
  REP(k,sz-1){
	for(int i=0;i<sz-k-1;++i){
	  ans[k].PB(n+i);
	}
	for(int i=k+1;i<sz;++i){
	  ans[i].PB(n+(i-k-1));
	}
	n += K-k;
  }

  for(auto& xs: ans){
	cout << SZ(xs) << " " << xs << endl;
  }

  return 0;
}


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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll INF = (1LL<<60);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int r;
  cin >> r;
  if(r < 1200) cout << "ABC" << endl;
  else if(r < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
	string A; cin >> A;

	for (int i = 0; i < 26; i++) {
		char a = 'a' + i;
		A.push_back(a);
	}
	int N = A.size();
	int INF = N * 2;
	
	int* dp = new int[N];
	int buf[26];
	for (int i = 0; i < N; i++) {
		int k = A[i] - 'a';
		dp[i] = INF;
		if (i + 26 >= N) { dp[i] = 0; buf[i + 26 - N] = i; }
	}
	for (int i = N - 27; i >= 0; i--) {
		int k = A[i] - 'a';

		for (int j = 0; j < 26; j++) {
			dp[i] = min(dp[i], dp[buf[j]] + 1);
		}
		buf[k] = i;
	}

	int n = INF;
	int M = INF;
	
	for (int i = 0; i < 26; i++) {
		if (dp[buf[i]] < M) {
			M = dp[buf[i]];
			n = buf[i];
		}
		buf[i] = 0;
	}

	while (1) {
		cout << A[n];
		if (M == 0) { break; }
		M--;

		for (int i = 0; i < 26; i++) {
			buf[i] = max(buf[i], n + 1);
			while (buf[i] < N && A[buf[i]] != 'a' + i) {
				buf[i]++;
			}
		}
		for (int i = 0; i < 26; i++) {
			if (dp[buf[i]] == M) {
				n = buf[i];
				break;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 1412