akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

ll solve(const ll n, const ll A, const ll B, const ll C, const ll D, map<ll, ll> &memo) {
    if (memo.find(n) != memo.end()) {
        return memo[n];
    }

    // printf("n: %lld\n", n);

    ll cand = LONG_LONG_MAX / 2;

    const vector<ll> costs = {A, B, C};
    const vector<ll> muls = {2LL, 3LL, 5LL};
    for (int i = 0; i < 3; i++) {
        const ll cost = costs[i];
        const ll mul = muls[i];
        const ll above = ((n - 1 + mul) / mul) * mul;
        chmin(cand, (above - n) * D + cost + solve(above / mul, A, B, C, D, memo));
        const ll below = (n / mul) * mul;
        chmin(cand, (n - below) * D + cost + solve(below / mul, A, B, C, D, memo));
    }

    // it might be better to decrease one by one if n <= 2 * 1e9
    if (n <= 2LL * 1000LL * 1000LL * 1000LL) {
        chmin(cand, D * n);
    }

    memo[n] = cand;
    // printf("n: %lld, ans: %lld\n", n, cand);
    return cand;
}

int main(void) {
    int T;
    cin >> T;
    for (int i = 0; i < T; i++) {
        ll N, A, B, C, D;
        cin >> N >> A >> B >> C >> D;
        map<ll, ll> memo;
        memo[0] = 0LL;
        memo[1] = D;
        cout << solve(N, A, B, C, D, memo) << endl;
    }
    return 0;
}


Measured memory_bytes: 4384
N,d=gets.chomp.split(' ').map{|n| n.to_i}
A=gets.chomp.split(' ').map{|n| n.to_i}
B=A.each_with_index.map{|a,i| a-i}
offs = B.sort[A.size/2]
puts B.inject(0){|sum,b| sum+(b-offs).abs}


Measured memory_bytes: 24760
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int i,j,k;
  string str,s="AZ";
  cin>>str;
  int re=0;
  rep(i,str.size())
    if(str[i]==s[re%2])
      ++re;
  if(re<2)
    cout<<-1;
  else
    rep(i,re/2)cout<<"AZ";
  cout<<endl;
  return 0;
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)
#define fi first
#define se second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
template <class T> using vec = vector<T>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

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

  ll ans = 0;
  rep(i, 1, N + 1) {
    if (i % 15 == 0 || i % 3 == 0 || i % 5 == 0) continue;
    ans += i;
  }

  put(ans);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

template <class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) {
  T c = min(a, b), d = max(a, b);
  return c * (d / gcd(c, d));
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


Measured memory_bytes: 3688
#include <iostream>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
using namespace std;
typedef unsigned long long ull;
typedef pair<ll, ll>P;
const ll mod = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool fl = true, flag = false;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
struct edge { ll to, cost; };
string abc = "abcdefghijklmnopqrstuvwxyz";

int main() {
	int n, a[100], Min = INF, Max = 0, maxit = 0, minit = 0;
	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		if (Min > a[i]) {
			Min = min(Min, a[i]);
			minit = i + 1;
		}
		if (Max < a[i]) {
			Max = max(Max, a[i]);
			maxit = i + 1;
		}
	}
	if (Min >= 0 && Max >= 0) {
		cout << n - 1 << endl;
		for (int i = 0;i < n - 1;i++) {
			cout << i + 1 << ' ' << i + 2 << endl;
		}
	}
	else if (Min <= 0 && Max <= 0) {
		cout << n - 1 << endl;
		for (int i = n - 1;i > 0;i--) {
			cout << i + 1 << ' ' << i << endl;
		}
	}
	else if (abs(Min) < abs(Max)) {
		cout << n + n - 1 << endl;
		for (int i = 0;i < n;i++) {
			cout << maxit << ' ' << i + 1 << endl;
		}
		for (int i = 0;i < n - 1;i++) {
			cout << i + 1 << ' ' << i + 2 << endl;
		}
	}
	else {
		cout << n + n - 1 << endl;
		for (int i = 0;i < n;i++) {
			cout << minit << ' ' << i + 1 << endl;
		}
		for (int i = n-1;i > 0;i--) {
			cout << i + 1 << ' ' << i << endl;
		}
	}
}

Measured memory_bytes: 256
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
import numpy as np
A=np.array(A)
B=np.array(B)

if np.sum(A)<np.sum(B):
    print(-1)
    exit()

difAB=A-B
negdif=difAB[difAB<0]
posdif=sorted(difAB[difAB>0], reverse=True)
ans=len(negdif)
needs=sum(negdif)
i=0
while needs<0:
    needs+=posdif[i]
    ans+=1
    i+=1

print(ans)

Measured memory_bytes: 21124
#include <stdio.h>

int main(void) {
  int i, sum = 0, s[10];

  for (i = 0; i < 10; i++)
    scanf("%d", &s[i]);

  for (i = 0; i < 10; i++)
    sum += s[i];

  printf("%d\n", sum);

  return 0;
}

Measured memory_bytes: 600
import math

x = int(input())

def is_prime(n):
    if n <= 1:
        return False

    if n == 2:
        return True

    if n % 2 == 0:
        return False

    for i in range(3, math.ceil(math.sqrt(n)), 2):
        if n % i == 0:
            return False

    return True

while is_prime(x) != True:
  x += 1

print(x)

Measured memory_bytes: 3060
// Problem : C - Skill Up
// Contest : AtCoder - AtCoder Beginner Contest 167
// URL : https://atcoder.jp/contests/abc167/tasks/abc167_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define all(x) x.begin(),x.end()
#define fast  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int N = 12;
int n,m,x;
int c[N];
int a[N][N];
int solve (int book,int mask,vector<int> level){
    int cnt = __builtin_popcount(mask);
    if(cnt == m){
        return 0;
    }
    if(book == n){
        return 1e18;
    }
    int ans = 1e18;
    ans = min(ans,solve(book+1,mask,level));//skip this book
    //read this book
    for(int i = 0;i<m;i++){
        level[i]+=a[book][i];
        if(level[i]>=x)
            mask|=(1<<i);
    }
    ans = min(ans,c[book]+solve(book+1,mask,level));
    return ans;
}
signed main(){
    fast;
    cin>>n>>m>>x;
    for(int i = 0;i<n;i++){
        cin>>c[i];
        for(int j = 0;j<m;j++)
            cin>>a[i][j];
    }
    vector<int> level(12,0);
    int ans = solve(0,0,level);
    if(ans == 1e18){
        cout<<-1;
    }
    else cout<<ans;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

using ll=long long;
using mat=vector<vector<long long>>;
const int MAX_N=60;
const int MOD = 1e9+7;
int N;
ll K;
mat G;

mat mul(mat& A, mat& B)
{
    mat C(A.size(), vector<long long>(B[0].size()));
    for(int i=0;i<A.size();++i)for(int j=0;j<B[0].size();++j){
        for(int k=0;k<B.size();++k){
            C[i][j]=(C[i][j]+A[i][k]*B[k][j])%MOD;
        }
    }
    return C;
}

mat mat_pow(mat A, ll k)
{
    mat B(N, vector<long long>(N));
    for(int i=0;i<N;++i)B[i][i]=1;
    while(k>0){
        if(k&1) B=mul(B,A);
        A=mul(A,A);
        k>>=1;
    }
    return B;
}

void solve()
{
    mat P = mat_pow(G, K);
    ll res = 0;
    for(int i=0;i<N;++i)for(int j=0;j<N;++j){
        res = (res + P[i][j])%MOD;
    }
    res %= MOD;
    while(res < 0) res += MOD;
    cout << res << endl;
}


int main()
{
    cin >> N >> K;
    vector<long long> cur;
    int x;
    for(int i=0;i<N;++i){
        cur.clear();
        for(int j=0;j<N;++j){
            cin >> x;
            cur.push_back(x);
        }
        G.emplace_back(cur);
    }
    solve();
    return 0;
}

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

int main(){
  ll n, x; cin >> n >> x;
  ll a[n];
  for(int i=0; i<n; i++) cin >> a[i];

  ll ans = 0;
  for(int i=0; i<n-1; i++){
    if(a[i]+a[i+1] > x){
      ans += a[i]+a[i+1]-x;
      if(a[i+1] >= a[i]+a[i+1]-x){
        a[i+1] -= a[i]+a[i+1]-x;
      }
      else{
        a[i] -= (x-a[i+1]);
        a[i+1] = 0;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

struct angler{
	int ID;
	int num;
	
	angler(){
		ID = 0;
		num = 0;
	}
	
	angler(int id, int NUM){
		if(id <= 0){
			id = (1 << 30);
		}else{
			ID = id;
		}
		num = NUM;
	}
};

int const MAX_TREE_SIZE = 1 << 21;
angler max_tree[MAX_TREE_SIZE];

angler max_a(angler p1, angler p2){
	if(p1.num > p2.num){
		return p1;
	}else if(p1.num < p2.num){
		return p2;
	}else{
		if(p1.ID < p2.ID){
			return p1;
		}
	}
	return p2;
}

void add(int a, int w){
	
	// a?????????????´????w????¶???? O(log N)
	
	a += (1 << 20);
	
	max_tree[a].num += w;
	
	for(int x = a / 2; x > 0; x /= 2){
		max_tree[x] = max_a(max_tree[2 * x], max_tree[2 * x + 1]);
	}
}

angler max_person(int a){
	
	// MAX_SIZE_TREE?????§???????´?????????§???????????? O(1)
	
	return max_tree[1];
}

int main(){
	
	int N, q;
	
	cin >> N >> q;
	
	for(int i = 0; i < (MAX_TREE_SIZE); i++){
		max_tree[i] = angler(i - (1 << 20), 0);
	}
	
	for(int i = 0; i < q; i++){
		int a, v;
		cin >> a >> v;
		add(a, v);
		angler ang = max_person(N);
		printf("%d %d\n", ang.ID, ang.num);
	}
	
	return 0;
}

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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

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

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}


int main() {
  ll a,b;
  cin>>a>>b;

  ANS(lcm(a, b));
  return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;

int n,m;
int s[1001];
int k[1001];
vector<int> c[1001];
int dp[10001];
int dp2[10001];

int main(void){
	while(1){
		scanf("%d%d",&n,&m);
		if(n==0 && m==0)break;
		for(int i=0;i<m;i++){
			scanf("%d",&s[i]);
			scanf("%d",&k[i]);
			c[i].clear();
			for(int j=0;j<k[i];j++){
				int a;
				scanf("%d",&a);
				c[i].push_back(a);
			}
		}
		memset(dp,0,sizeof(dp));
		memset(dp2,0,sizeof(dp2));
		for(int i=1;i<=n;i++){
			for(int j=0;j<m;j++){
				int v=lower_bound(c[j].begin(),c[j].end(),i)-c[j].begin();
				if(v<c[j].size() && c[j][v]==i){
					dp[i]+=s[j];
					if(c[j].size()==1){
						dp2[i]+=s[j];
					}
				}
			}
		}
		int res=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if(i==j)continue;
				res=max(res,dp[i]-dp2[j]);
			}
		}
		printf("%d\n",res+1);
	}
	return 0;
}

Measured memory_bytes: 4604
#include <stdio.h>
#include <stdlib.h>

void quicksort(int,int);
void partitition(int,int);
typedef struct{

  int num;
  char m[2];
  int check;

} data;

data A[100000];

int main(){

  int n,i,r,a,c=0;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s %d",A[i].m,&A[i].num);
    A[i].check=i;
  }
   quicksort(0,n-1);

   for(i=0;i<n-1;i++){
     if(A[i].num==A[i+1].num && A[i].check>A[i+1].check) c++;
   }

   if(c>0) printf("Not stable\n");
   else printf("Stable\n");

  for(i=0;i<n;i++){
    printf("%c %d\n",A[i].m[0],A[i].num);

    }
  return 0;
}

int partition(int p,int r){
  int x,j,i;
  data a,b;
  x=A[r].num;
  i=p-1;
  for(j=p;j<r;j++){

    if(A[j].num<=x){
      i=i+1;
      a=A[i];
      A[i]=A[j];
      A[j]=a;
    }
  }
  b=A[i+1];
  A[i+1]=A[r];
  A[r]=b;

  return i+1;
}

void quicksort(p,r){
  int q;
  if(p<r){
    q=partition(p,r);
    quicksort(p,q-1);
    quicksort(q+1,r);
  }

}

Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define ld long double
#define For(i,j,n) for(lli i=(lli)j; i<(lli)n; ++i)
#define DFor(i, n, j) for(lli i=(lli)n; i>=(lli)j; --i)
#define mod 1000000007
#define pb emplace_back
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)

int main(){
    fastio;
    
	lli n; cin >> n;
	lli h[n+1];
	For(i, 1, n+1) cin >> h[i];
	
	vector<lli> dp(n+1, 0);
	dp[1] = 0; dp[2] = abs(h[1]-h[2]);
	For(i, 3, n+1) 
		dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
	
	cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>

using namespace std;

int solve(int* raw,int ri, int le, int t);

int main(){
  int time, i, j;
  int raw[10];
  scanf("%d",&time);
  for(i=0;i<time;i++){
    for(j=0;j<10;j++){
      scanf("%d",&raw[j]);
      }
    if(solve(raw,0,0,0)){
      printf("YES\n");
    }else printf("NO\n");
  }
    return 0;
}

  //solve???YES??????1NO??????0
int solve(int* raw, int ri, int le, int t){
  if(t==10){return 1;}
  int rid=0,led=0;
  if(ri<raw[t]) rid=solve(raw,raw[t],le, t+1);
  if(le<raw[t]) led=solve(raw,ri,raw[t], t+1);
  if(ri>=raw[t]&&le>=raw[t]) return 0;
  if(rid+led) return 1;
  else return 0;
  }

Measured memory_bytes: 1008
#include<iostream>
#include<string>
using namespace std;
int main(){
    int ans = 0;
    char t;
    string s;
    cin >> s;
    int n = s.size();
    for(int i=0 ; i<n ; i++){
        int count = 0;
        for(int j=i;j<n;j++){
            t = s[j];
            if (t == 'A' || t == 'C' || t == 'G' || t == 'T') {
                count++;
            } else {
                break;
            }
        }
        if(ans < count)ans = count;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
    int n;
    cin>>n;
    int h[n];
    for (int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    int c[n+1];
    c[0]=0;
    c[1]=0;
    for(int i=2;i<=n;i++)
    {
        c[i]=std::min(c[i-1]+abs(h[i-2]-h[i-1]),c[i-2]+abs(h[i-3]-h[i-1]));
    }
    cout<<c[n]<<endl;
}

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

int nth_bit(int64_t num, int n){
    return (num >> n) & 1;
}

void chmin(int& a, int b){
    a = min(a, b);
}

int main(){
    int N, M;
    cin >> N >> M;
    int A[1000], B[1000] = {0};
    for(int i=0; i<M; i++){
        int n;
        cin >> A[i] >> n;
        while(n--){
            int c;
            cin >> c;
            B[i] += 1<<(c-1);
        }
    }

    vector<int> dp(1<<N, 1e9);
    dp[0] = 0;
    for(int i=0; i<(1<<N); i++) for(int j=0; j<M; j++){
        chmin(dp[i|B[j]], dp[i] + A[j]);
    }
    int ans = dp[(1<<N)-1];
    if(ans == 1e9) ans = -1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include<iostream> 
#include<string>
#include<vector>
using namespace std;
int main()
{
	int N;
	cin>>N;

	int x,y,z;
	x=N%10;
	y=(N%100-x)/10;
	z=(N-y-x)/100;
	if(x==y && y==z){
		cout<<N;
	}else{
		if(N < z*111){
		cout<<111*z;}else{
		cout<<111*(z+1);
		}
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		String S = tokens[0];
		String T = in.readLine();
		if (S.length() + 1 == T.length()) {
			if (S.equals(T.subSequence(0, S.length()))) {
				System.out.println("Yes");
			} else {
				System.out.println("No");

			}
		} else {
			System.out.println("No");
		}

	}

	void calc() {
	}

	void showResult() {
	}

}

Measured memory_bytes: 32524
N, M = map(int, input().split())
swi = []
for _ in range(M):
    _, *s = map(int, input().split())
    swi.append(s)
swi =[list(map(lambda x: x-1, ss)) for ss in swi]
# print(swi)
*P, = map(int, input().split())
ans = 0
for i in range(2 ** N):
    # print(bin(i))
    chk = True
    for m in range(M):
        on_off_cnt = 0
        for s in swi[m]:
            if i >> s & 1:
                on_off_cnt += 1
        if on_off_cnt % 2 != P[m]:
            chk = False
    if chk == True:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
template <long long mod>
class Combination
{
    std::vector<long long> fact, finv, inv;
public:
    Combination(int sz)
    {
        fact.resize(sz);
        finv.resize(sz);
        inv.resize(sz);
        fact[0] = 1;
        for (int i = 1; i < sz; ++i)
        {
            fact[i] = fact[i - 1] * i % mod;
        }
        inv[0] = 0;
        inv[1] = 1;
        for (int i = 2; i < sz; ++i)
        {
            inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        }
        finv[0] = 1;
        for (int i = 1; i < sz; ++i)
        {
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
    long long C(long long n, long long k)
    {
        if (n < k)
            return 0;
        if (n < 0 || k < 0)
            return 0;
        return (fact[n] * finv[k] % mod) * finv[n - k] % mod;
    }
    long long P(long long n, long long k)
    {
        if (n < k)
            return 0;
        if (n < 0 || k < 0)
            return 0;
        return fact[n] * finv[n - k] % mod;
    }
    long long H(long long n, long long k)
    {
        return this->C(n + k - 1, k);
    }
    long long getfact(int i)
    {
        return fact[i];
    }
    long long getinv(int i)
    {
        return inv[i];
    }
    long long getfinv(int i)
    {
        return finv[i];
    }
};
using namespace std;
template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const ld eps = 1e-9;
const ll MOD = 1000003;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int q; cin >> q;
  Combination<MOD> comb(2500006);
  while(q) {
    q--;
    ll x, d, n; cin >> x >> d >> n;
    if(d == 0) {
      cout << mod_pow(x, n, MOD) << endl;
      continue;
    }
    if(n >= MOD) {
      cout << 0 << endl;
      continue;
    }
    ll tmp = x * comb.getinv(d) % MOD;
    ll ans = comb.getfact(tmp+n-1) * comb.getfinv(tmp-1) % MOD;
    cout << ans * mod_pow(d, n, MOD) % MOD << endl;
  }
}


Measured memory_bytes: 59520
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 
const int INF = 1e9 + 10 ;
const int N = 110 ; 
int main(){
    fastio
    int n ; 
    cin >> n ; 
    vector<int> b(n - 1) ; 
    for(int i = 0; i < n - 1; i++){
        cin >> b[i] ; 
    }
    vector<int> a(n,INF) ; 
    a[0] = a[1] = b[0];
    for(int i = 1; i < n - 1; i++){
        a[i] = min(a[i],b[i]);
        a[i + 1] = b[i];
    }
    a[n - 1] = b[n - 2] ;
    debug() << imie(a) ;
    int sum = 0 ; 
    for(int &c : a){
        sum += c ;
    }
    cout << sum << endl;
    return 0 ;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    string[] A = Console.ReadLine().Split(' ');
    long[] Flow = new long[N + 1];
    Flow[0] = 0;
    
    for (int i = 1; i < N + 1; i++)
    {
      Flow[i] = long.Parse(A[i - 1]) * 2 - Flow[i - 1];
    }
    
    long x = Flow[N] / 4;
    
    var result = new List<long>();
    for (int i = 0; i < N; i++)
    {
      long r;
      if (i % 2 == 0)
      {
        r = Flow[i] + x * 2;
      }
      else
      {
        r = Flow[i] - x * 2;
      }
      result.Add(r);
    }
    
    Console.WriteLine(string.Join(" ", result));
  }
}

Measured memory_bytes: 32092
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
#include <sstream>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

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

    ll n, m;
    cin >> n >> m;

    int *food = new int[m];
    
    for (int i = 0; i < m; i++) {
        food[i] = 0;
    }

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

    for (int i = 0; i < m; i++) {
        if (food[i] == n) ans++;
    }

    cout << ans << endl;

}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

const ll INF = LLONG_MAX;

vector<tuple<int, int, ll> > edge;

int main(){
    int N, M, P;
    cin >> N >> M >> P;
    REP(i,M){
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        edge.emplace_back(a, b, P-c);
    }

    vector<ll> d(N, INF);
    d[0] = 0;
    ll tmp;
    for(int v = 0; v < 2*N; v++){
        for(auto&& e : edge){
            int a = get<0>(e);
            int b = get<1>(e);
            ll c = get<2>(e);

            if(d[a] != INF && d[b] > d[a] + c){
                if(v < N)
                    d[b] = d[a] + c;
                else
                    d[b] = -1e12;
            }
        }

        if(v == N-1)
            tmp = d[N-1];
    }

    if(tmp != d[N-1]){
        cout << -1 << endl;
        return 0;
    }

    cout << max(0LL, -tmp) << endl;


    return 0;
}


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

int main() {
  string s; cin >>s;
  bool exist = false;
  int ans = 0;
  s.pop_back(); s.pop_back();
  
  while (!exist && s.size()>0){
    int foo = s.size()/2;
    bool ok = true;
    for (int i=0; i<foo; i++){
      if (s.at(i) != s.at(i+foo)){
        ok = false;
        break;
      }
    }
    if (ok){
      exist = true;
      ans = s.size();
    }
    s.pop_back(); s.pop_back();
  }
  
  cout <<ans <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  string S;
  cin >> S;
  vector<int> A_pos = {8, 6, 4, 0};

  /* 2bit */
  rep(b, bit(4)) {
    string T = "AKIHABARA";

    rep(i, 4) {
      if ((b >> i) & 1)
        T.erase(T.begin() + A_pos[i]);
    }
    if (S == T) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
}

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

using namespace std;
using ll = long long;

int main(void) {
    int N, K;
    cin >> N >> K;
    vector<int> P(N);
    for(int i=0; i<N; ++i)
        cin >> P[i];

    sort(P.begin(), P.end());
    int ret = 0;
    for(int i=0; i<K; ++i) {
        ret += P[i];
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
#define mod 1000000007
typedef long long ll;

int main(void) {
  ll i, j, k, n, ans = 0;
  scanf("%lld%lld", &n, &k);
  ll a[n + 1];
  a[0] = 0;
  for(i = 1; i <= n; ++i) a[i] = a[i - 1] + i, a[i] %= mod;
  for(; k < n + 2; ++k) {
    ans += 2 * mod + a[n] - (k == n + 1 ? 0 : a[n - k]) - a[k - 1] + 1;
    ans %= mod;
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 3252
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    /*val n =*/ scanner.nextInt()
    val a = scanner.nextInt() - 1
    val b = scanner.nextInt() - 1
    val c = scanner.nextInt() - 1
    val d = scanner.nextInt() - 1
    val s = scanner.next()

    // 空がtrue 岩がfalse
    val course = s.map { it == '.' }

    val r: Parson   // ゴールとおいほう
    val l: Parson   // ゴールちかいほう

    if (c > d) {
        r = Parson(a, c, course)
        l = Parson(b, d, course)
    } else {
        r = Parson(b, d, course)
        l = Parson(a, c, course)
    }
    r.other = l
    l.other = r

    while (true) {
        val rc = r.location
        val lc = l.location
        while (!r.done()) {
            // ゴールするまで、進めるだけすすめる
            if (!r.forward()) break
        }
        // rが進めなくなったとき
        if (!l.done()) {
            // lがゴールしてなくて進める場合は一回進める
            l.forward()
        }
        if (r.done() && l.done()) {
            // できた
            print("Yes")
            return
        } else if (rc == r.location && lc == l.location) {
            // 進捗なし
            print("No")
            return
        }
    }
}

data class Parson(var location: Int, private val goal: Int, private val course: List<Boolean>) {
    lateinit var other: Parson

    private fun looksEmpty(target: Int): Boolean {
        return course[target] && other.location != target
    }

    // 移動出来たらtrue
    fun forward(): Boolean {
        if (looksEmpty(location + 1)) {
            location++
            return true
        } else if (looksEmpty(location + 2)) {
            location += 2
            return true
        }
        return false
    }

    fun done(): Boolean {
        return location == goal
    }
}

Measured memory_bytes: 33832
#include<forward_list>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<iterator> 
#include<sstream>
#include<fstream>
#include<istream>
#include<utility>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>
#include<deque>
#include<list>
#include<map> 
#include<set>
#define TitansGo ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(v) v.begin(),v.end()
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define ll long long 
#define endl "\n"
#define S second
#define F first
using namespace std;
int frq[200000];
int main()
{
	TitansGo
		int n,a;
	cin >> n;
	for (int i = 1; i < n; i++){
		cin >> a;
		frq[a]++;
	}
	for (int i = 1; i <= n; i++)
		cout << frq[i] << endl;






}

Measured memory_bytes: 3832
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;
const ll INF = 1LL<<60;

int main() {
    ll N,M;
    cin >> N >> M;
    int rate[9]={2,5,5,4,5,6,3,7,6};
    vector<ll> A(M);
    for(int i=0;i<M;i++){
        cin >> A[i];
    }
    sort(A.rbegin(),A.rend());
    vector<ll> dp(N+10);
    fill(dp.begin(),dp.end(),-1);
    dp[0]=0;
    for(int i=1;i<=N;i++){
        for(int j=0;j<M;j++){
            if(i-rate[A[j]-1]<0) continue;
            else{
                dp[i]=max(dp[i],dp[i-rate[A[j]-1]]+1);
            }
        }
    }
    string ans="";
    ll ct=N;
    while(ct>0){
        for(int i=0;i<M;i++){
            if(ct-rate[A[i]-1]<0) continue;
            if(dp[ct]==dp[ct-rate[A[i]-1]]+1){
                ans=ans+char(A[i]+'0');
                ct-=rate[A[i]-1];
                break;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const double eps = 1e-8;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

ll f(string &s, int i, ll add) {
    if (i >= (int)s.size()) return add;
    ll sum = 0, k = 0;
    for (int j=i; j<(int)s.size(); ++j) {
        k = k * 10 + (s[j] - '0');
        sum += f(s, j+1, add+k);
    }
    return sum;
}

int main() {
    string s;
    cin >> s;
    cout << f(s, 0, 0) << endl;
    return 0;
}

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

int main(void) {
  long int A;
  scanf("%ld", &A);
  double aa = pow(A,0.5);
  long int i;
  long int fac,tor,dist;
  dist = A;
  //printf("%f\n",aa);
  for(i=1;i<aa+1;i++)
  {
  	if(((long int)A/i)*i==A)
    {
   		fac =i;
      	tor =((long int)A/i);
      	if(dist > fac + tor - 2)
        {
          	//printf("%ld %ld %ld %ld\n",i,((long int)A/i),dist,fac + tor - 2);
        	dist = fac + tor - 2;	
        }
    }
  }
	printf("%ld",dist);
}

Measured memory_bytes: 128
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def dfs(s,mx,N):
    if len(s) == N:
        print(s)
    else:
        alpha = 'abcdefghijk'
        for c in range(mx+1):
            if c == mx:
                mx += 1
            dfs(s+alpha[c],mx,N)


def main():
    N = int(input())

    dfs('',0,N)



main()


Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i,n){cin>>p[i];}
  sort(p.rbegin(),p.rend());
  p[0] /= 2;
  int ans=accumulate(p.begin(),p.end(),0);
  cout << ans << endl;

  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n,ans=1,flag=0;cin>>n;
  	vector<int> a(n);
  	for(int i=0;i<n;i++) cin>>a[i];
  	for(int i=0;i<n-1;i++){
    	if(a[i]>a[i+1]){
        	if(flag==1){flag=0;ans++;}
          	else if(flag==0) flag=-1;//減少
        }
      	if(a[i]<a[i+1]){
          if(flag==-1){flag=0;ans++;}
          else if(flag==0) flag=1;//増加
        }
    }
  	cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j,k,l;
  int a,d,n,s[78500];
  s[0]=2;
  j=1;
  for(i=3;i<1000000;i+=2){
    l=(int)sqrt(i)+1;
    for(k=3;k<l;k+=2){
      if(i%k==0)
	break;
    }
    if(k>=l){
      s[j]=i;
      j++;
    }
  }
  while(cin>>a>>d>>n&&a+d+n){
    for(i=0;s[i]<a;i++);
    for(j=0;j<n;i++){
      if((s[i]-a)%d==0)
	j++;
    }
    cout<<s[i-1]<<endl;
  }
  return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
  int n, q; cin >> n >> q;
  dsu d(n);
  while(q--){
    int t, u, v; cin >> t >> u >> v;
    if(t == 0){
      d.merge(u, v); 
    }else{
      cout << d.same(u, v) << endl;
    }
  }
  return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 3960
from math import gcd
from collections import defaultdict

n=int(input())
z=[]
d=defaultdict(int)
for i in range(n):
    s=input()
    if '.' in s:
        ind=s.index('.')
        ls=len(s)
        p=ls-ind-1
        s=s[:ind]+s[ind+1:]
        s=int(s)
        c=gcd(s,10**p)
        s//=c
        t=(10**p)//c
    else:
        s=int(s)
        t=1
    l=[]
    for j in [s,t]:
        n2=0
        n5=0
        while j%2==0:
            n2+=1
            j//= 2
        while j%5==0:
            n5+=1
            j//= 5
        l.append([n2,n5])
    d[(l[0][0]-l[1][0],l[0][1]-l[1][1])]+=1
d=list(d.items())
ans=0
for j in range(len(d)):
    if d[j][0][0]>=0 and d[j][0][1]>=0:
        ans+=d[j][1]*(d[j][1]-1)//2
    for i in range(j):
        if d[i][0][0]+d[j][0][0]>= 0 and d[i][0][1]+d[j][0][1]>=0:
            ans+=d[i][1]*d[j][1]
print(ans)

Measured memory_bytes: 78488
#include<iostream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
using namespace std;
typedef long long ll;

ll N, index = 0, ans = 0;
ll a[100010];

int main() {
	cin >> N;
	map<int, int> map;

	for (int i = 0; i < N; i++) {
		ll ai;
		cin >> ai;
		if (map.find(ai) == map.end()) {
			map[ai] = 1;
			a[index] = ai;
			index++;
		}
		else {
			map[ai]++;
		}
	}
	for (int i = 0; i < index; i++) {
		ll no = a[i];
		ll sum = map[a[i]];
		if (sum < no) ans += sum;
		else ans += sum - no;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5504
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!int).array;
    int ans = 0;

    for (int i = 1; i < N; ++i) {
        if (A[i] == A[i-1]) {
            ans += 1;
            i += 1;
        }
    }

    ans.writeln;
}


Measured memory_bytes: 256
import heapq
N, K  = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] * N
dp[1] = dp[0] + abs(h[1]-h[0])

for i in range(2, N):
    compare = []
    heapq.heapify(compare)
    cnt = min(K, i)
    for j in range(cnt):
        heapq.heappush(compare, dp[i-j-1] + abs(h[i]-h[i-j-1]))
    dp[i] = heapq.heappop(compare)

print(dp[-1])


Measured memory_bytes: 56320
#include<iostream>
#include<cstdlib>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
//--------------------
#define MOD 1000000007 
using namespace std;
//--------------------
int main(){

	string res = "No";
	int A , B , C; cin >> A >> B >> C;

	if (A + B >= C) res = "Yes";

	cout << res << endl;

}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    val AArr = readInputLine().split(" ").map { it.toLong() }.toLongArray()
    val sumArr = LongArray(N)
    val sumArrCnt = mutableMapOf<Long, Long>()
    sumArr[0] = AArr[0]
    sumArrCnt.put(sumArr[0], 1L)
    
    for (i in 1 until N) {
        sumArr[i] = sumArr[i - 1] + AArr[i]
        sumArrCnt.put(sumArr[i], (sumArrCnt.get(sumArr[i]) ?: 0L) + 1L)
    }
    
    var ans = 0L
    var sum = 0L

    for (i in 0 until N) {
        ans += sumArrCnt.get(sum) ?: 0L
        sumArrCnt.put(sumArr[i], sumArrCnt.get(sumArr[i])!! - 1L)
        sum += AArr[i]
    }

    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 107488
#include<iostream>
#include<stdio.h>
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;
int L[MAX/2+2],R[MAX/2+2];
llong merge(int A[],int n,int left,int mid,int right)
{
    int i,j,k;
    llong cnt=0;
    int n1=mid-left;
    int n2=right-mid;
    for(i=0;i<n1;i++)L[i]=A[left+i];
    for(i=0;i<n2;i++)R[i]=A[mid+i];
    L[n1]=R[n2]=SENTINEL;
    i=j=0;
    for(k=left;k<right;k++)
    {
        if(L[i]<=R[j])
        {
            A[k]=L[i++];
        }
        else
        {
            A[k]=R[j++];
            cnt+=n1-i;
        }
    }
    return cnt;
}
llong mergesort(int A[],int n,int left,int right)
{
    int mid;
    llong v1,v2,v3;
    if(left+1<right)
    {
        mid=(left+right)/2;
        v1=mergesort(A,n,left,mid);
        v2=mergesort(A,n,mid,right);
        v3=merge(A,n,left,mid,right);
        return v1+v2+v3;
    }
    else return 0;
}
using namespace std;
int main()
{
    int A[MAX],n,i;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>A[i];
    }
    llong ans=mergesort(A,n,0,n);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4660
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a,b,c;
  cin>>a>>b>>c;
  if(a.at(a.size()-1)==b.at(0)&&b.at(b.size()-1)==c.at(0))cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
import Data.Bits
import Data.Bool
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
main=print.solve.U.unfoldr(B.readInt.B.dropWhile isSpace)=<<B.getContents
solve nabcl=minimum$map f$U.replicateM n[0..2]where
  n=U.head nabcl
  abc=U.slice 1 3 nabcl
  ls=U.drop 4 nabcl
  f=U.sum.U.zipWith(\i b->dp V.! b U.! i)abc.U.accumulate(.|.)(U.replicate 3 0).(`U.zip`w)
  w=U.iterateN n(*2)1
  m=U.maximum abc+1
  dp=V.generate(shift 1 n)$ \b->case b of
    0->U.generate m$bool(maxBound`div`4)0.(==0)
    b->let(p,l)=(dp V.! (b.&.(b-1)),ls U.!countTrailingZeros b) in U.generate m$ \i->
      min(p U.! i)$if i<l then l-i else min(i-l)$p U.! (i-l)+10

Measured memory_bytes: 7468
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    string s; cin >> s;
    string t; cin >> t;
    ll a; cin >> a;
    ll b; cin >> b;
    string u; cin >> u;
    if (u==s){
        a--;
    } else {
        b--;
    }
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
N=int(input())
b=[int(input()) for i in range(N)]

B=[A1[0], A2[1], A3[2]]
C=[A1[2], A2[1], A3[0]]
D=[A1[0], A2[0], A3[0]]
E=[A1[1], A2[1], A3[1]]
F=[A1[2], A2[2], A3[2]]


answer='No'
if len(set(A1) & set(b))>2:
  answer='Yes'
if len(set(A2) & set(b))>2:
  answer='Yes'
if len(set(A3) & set(b))>2:
  answer='Yes'
if len(set(B) & set(b))>2:
  answer='Yes'
if len(set(C) & set(b))>2:
  answer='Yes'
if len(set(D) & set(b))>2:
  answer='Yes'
if len(set(E) & set(b))>2:
  answer='Yes'
if len(set(F) & set(b))>2:
  answer='Yes'
print(answer)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
//typedef LL int;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    int n;
    int a[100000];
    cin >> n;
    
    REP(i, n){
        cin >> a[i];
    }

    int a2 = 0, a4 = 0, a0 = 0;

    REP(i, n){
        if(a[i] % 4 == 0){
            a4++;
        }else if(a[i] % 2 == 0){
            a2++;
        }else{
            a0++;
        }
    }
    
    if(a0 <= a4+1 && (a4+1 - a0) >= a2 % 2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
 
int n, w;
int dat[101];
int maxi;
int l, r;
double calc() {
  double ans = 0;
  l = 0;
  for(int i = l; i <= r; ++i) {
    ans += ((double)(r-i)/(r-l)) * ((double)dat[i]/maxi);
  }
  return ans + 0.01;
}
 
int main() {
  while((cin >> n >> w) && (n || w)) {
    fill(dat, dat+101, 0);
    for(int i = 0; i < n; ++i) {
      int v;
      cin >> v;
      v /= w;
      ++dat[v];
      l = i == 0 ? v : min(l, v);
      r = i == 0 ? v : max(r, v);
      maxi = i == 0 ? dat[v] : max(maxi, dat[v]);
    }
    cout << calc() << endl;
  }
  return 0;
}

Measured memory_bytes: 1232