akhauriyash/Code-Regression huggingface dataset:
/*
 *  NIKHILESH CHAMARTHI @ nikki371  ==> CSE(2015-19)
 *  VIT UNIVERSITY, VELLORE
*/

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mset(m,v) memset(m,v,sizeof(m))
#define inrep int tc79;cin>>tc79;while(tc79--)
#define cppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define trace1(x) cerr<<#x<<": "<<x<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<"\n"
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<"\n"
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

// SOLUTION

char bb[55][55];
int dx[8] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy[8] = {1, -1, 1, 0, -1, 1, 0, -1};
int main(){
	cppio;
	int h, w;
	cin >> h >> w;
	for(int i = 0; i < h; ++i) {
		cin >> bb[i];
	}
	for(int i = 0; i < h; ++i) {
		for(int j = 0; j < w; ++j) {
			if(bb[i][j] == '#') cout << bb[i][j];
			else {
				int ans = 0;
				for(int k = 0; k < 8; ++k) {
					int x = i + dx[k], y = j + dy[k];
					if(x >= 0 && x < h && y >= 0 && y <= w && bb[x][y] == '#') ans++;
				}
				cout << ans;
			}
		}
		cout << "\n";
	}
	return 0;
}


Measured memory_bytes: 256
#他の方のきれいなACのから勉強させてもらいました

h,w=map(int, input().split())
a1=[list(input()) for _ in range(h)]
# print(a1)
a2=[b for b in a1 if b.count('#')]
# print(a2)
a3=[b for b in list(zip(*a2)) if b.count('#')]
# print(a3)
ans=list(zip(*a3))
# print(ans)
for i in ans:
    print(''.join(i))

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long lli;

const int MAXN = 101;
int N;
lli A[MAXN][MAXN];
lli S[MAXN][MAXN];

int main() {
  cin >> N;
  for(int i = 0; i < N; ++i) {
    for(int j = 0; j < N; ++j) {
      cin >> A[i][j];
    }
  }

  for(int i = 0; i < N; ++i) {
    for(int j = 0; j < N; ++j) {
      S[i+1][j+1] = S[i+1][j] + A[i][j];
    }
  }

  for(int j = 0; j <= N; ++j) {
    for(int i = 0; i < N; ++i) {
      S[i+1][j] += S[i][j];
    }
  }

  lli res = -10000;
  for(int i = 0; i < N; ++i) {
    for(int j = 0; j < N; ++j) {
      for(int h = 1; i+h <= N; ++h) {
        for(int w = 1; j+w <= N; ++w) {
          res = max(res, S[i+h][j+w] - S[i][j+w] - S[i+h][j] + S[i][j]);
        }
      }
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1324
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod=1e9+7;
const int maxn=2e5+10;
LL a[maxn],sum[maxn];
int n;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=n;i>=1;i--){
        sum[i]=sum[i+1]+a[i];
        sum[i]%=mod;
    }
    LL res=0;
    for(int i=1;i<=n;i++){
        LL pre=a[i]*sum[i+1]%mod;
        res+=pre;
        res%=mod;
    }
    printf("%lld\n",res);
    return 0;
}


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

int main() {
int n;
cin >> n;
switch(n%10){
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
            cout << "hon" << endl;
            break;
    case 0:
    case 1:
    case 6:
    case 8:
            cout << "pon" << endl;
            break;
    case 3:
            cout << "bon" << endl;
            break;
}
return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <algorithm>

using namespace std;
using ll = long long;

int main(){
    int n;
    ll d;
    cin>>n>>d;
    ll x,y;
    int cnt = 0;
    for(int i = 0; i < n;i++){
        cin>>x>>y;
        if(x*x + y*y <= d*d) cnt++;
    }    
    cout<<cnt<<endl;
    return 0;
}  


Measured memory_bytes: 3600
#include<stdio.h>
int main()
{
	int N, K, num, all;
	scanf("%d %d", &N, &K);
	if (N <= 10)
		num = 100 * (10 - N);
	else
		num = 0;
	all = K + num;
	printf("%d", all);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
int n,a[2100000],ans;
int main(void)
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        a[x]++;
    }
    for(int i=1;i<=1000000;i++)
    {
        if(a[i]==1)ans++;
        if(a[i]>0)
        {
            for(int j=i;j<=1000000;j+=i)
            {
                a[j]=0;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 7128
#include <iostream>
#include <vector>
#include <map>

using namespace std;

using graph = vector<vector<int>>;
using V = vector<int>;
using P = pair<int,int>;

void dfs(const int& u, const int& k, const int& n, const graph& g, V& ord, V& lowlink, map<P,bool> mp) {
    lowlink[u] = ord[u] = k;
    for (auto v : g[u]) {
        if (ord[v] == -1) {
            mp[P(u,v)] = true;
            mp[P(v,u)] = true;
            dfs(v, k+1, n, g, ord, lowlink,mp);

            lowlink[u] = min(lowlink[u], lowlink[v]);
        } else if (!mp[P(u,v)]) {
            lowlink[u] = min(lowlink[u], ord[v]);
        }
    }
}

int main() {
    int n,m;
    cin >> n >> m;
    graph g(n+1);
    for (int i=0; i<m; i++) {
        int a,b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    map<P, bool> mp;
    vector<int> ord(n+1, -1);
    vector<int> lowlink(n+1, 0);
    dfs(1,n,  0,g, ord, lowlink,mp);

    int ans = 0;
    for (int u=1; u<=n; u++) {
        for (auto v : g[u]) {
            if (ord[u] < lowlink[v]) {
//                cerr << u << " => " << v << endl;
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,c=1000000001;
  cin>>n>>k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n-k+1;i++){
    c=min(c,a[i+k-1]-a[i]);
  }
  cout<<c;
}

Measured memory_bytes: 640
h,w,k=map(int,input().split())
c=[]
ans=0
for _ in range(h):
    c.append(list(input()))
for i in range(2**h):
    for j in range(2**w):
        b=0
        for x in range(h):
            for y in range(w):
                if (i>>x)&1==False and (j>>y)&1==False:
                    if c[x][y]=='#':
                        b+=1
        if b==k:
            ans+=1
print(ans)

Measured memory_bytes: 9072
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        Map<String,Integer> map = new TreeMap<>();
        
        for(int i = 0;i < n;i++){
            String str = sc.next();
            if(map.containsKey(str)){
                int tmp = map.get(str)+1;
                map.put(str,tmp);
                max = Math.max(max,tmp);
            }else{
                map.put(str,1);
                max = Math.max(max,1);
            }
        }
        
        for(String key:map.keySet()){
            if(max == map.get(key)){
                System.out.println(key);
            }
        }

    }
}


Measured memory_bytes: 78316
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define int int64_t
#define pb push_back
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
    int operator()(int x) const { return x ^ RANDOM; }
};
typedef gp_hash_table<int, int, chash> ht;
const int MOD = 1e9 + 7;
const int N = 1e5 + 3;
int dp[N],h[N],n,k;
signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> n >> k;
	for(int i = 1 ; i <= n ; i ++){
		cin >> h[i];
		dp[i] = LLONG_MAX;
	}
	dp[1] = 0;
	for(int i = 1 ; i < n ; i ++)
		for(int j = 1 ; j <= min(k, n - i) ; j ++)
		dp[i+j] = min(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
	cout << dp[n];
}




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

const int maxh=2000+9;
vector < string > mp;
int h,w;
vector < vector < int > > heng,shu;

int solve(){
    heng.assign(h+2,vector < int > (w+2,0));
    shu=heng;
    int i,j,k,p;
    for(i=1;i<=h;++i){
        k=0;
        for(j=1;j<=w+1;++j)
        if(mp[i][j]=='#'){
            for(p=k+1;p<j;++p)heng[i][p]=j-1-k;
            k=j;
        }
    }
    for(j=1;j<=w;++j){
        k=0;
        for(i=1;i<=h+1;++i)
        if(mp[i][j]=='#'){
            for(p=k+1;p<i;++p)shu[p][j]=i-1-k;
            k=i;
        }
    }
    int ans=0;
    for(i=1;i<=h;++i)
    for(j=1;j<=w;++j){
        ans=max(ans,heng[i][j]+shu[i][j]);
    }
    return ans-1;
}

void _prepare(){
    cin>>h>>w;
    mp.resize(h+2);
    for(int i=1;i<=h;++i){
        cin>>mp[i];
        mp[i]='#'+mp[i]+'#';
    }
    mp[0]=mp[h+1]=string(w+2,'#');
}

int main(){
    _prepare();
    cout<<solve()<<endl;
    return 0;
}


Measured memory_bytes: 39552
#include <stdio.h>
#define N 10000
#define F 500

int main(){
  int array1[N];
  int array2[F];
  int i,j,a,b,cnt=0;

  scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d",&array1[i]);
  }

  scanf("%d",&b);
  for(i=0;i<b;i++){
    scanf("%d",&array2[i]);
  }

  for(i=0;i<b;i++){
    for(j=0;j<a;j++){
      if(array2[i]==array1[j]){ cnt++; break; }
    }
  }

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

  return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int dfs(long long prefix, long long n, bool t, bool f, bool s){
  if(prefix>n){
    return 0;
  }
  int res;
  if(t && f && s){
    res = 1;
  }else{
    res = 0;
  }
  res += dfs(10*prefix+3,n,true,f,s);
  res += dfs(10*prefix+5,n,t,true,s);
  res += dfs(10*prefix+7,n,t,f,true);
  return res;
}

int main(){
  
  int n;
  long long X;
  cin>>n>>X;
  long long x[n];
  REP(i,n){
    cin>>x[i];
  }
  long long d;
  long long temp;
  REP(i,n){
    temp = x[i]-X;
    if(i==0){
      d = max(temp,-temp);
    }else{
      d = gcd_(d,max(temp,-temp));
    }
  }
  cout<<d<<endl;
  return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  priority_queue<int> pq;
  rep(i,n) {
    int a;
    cin >> a;
    pq.push(a);
  }
  rep(i,m) {
    int v = pq.top() / 2;
    pq.pop();
    pq.push(v);
  }
  ll ans = 0;
  rep(i,n) {
    ans += pq.top(); pq.pop();
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 892
import java.util.Arrays;
import java.util.Scanner;
import java.math.BigDecimal;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int M=stdIn.nextInt();
		int A[]=new int[N];
		int sum=0;
		for(int i=0;i<N;i++){
			A[i]=stdIn.nextInt();
			sum+=A[i];
		}
		Arrays.sort(A);
		for(int i=0;i<M;i++){
			if(A[N-i-1]*4*M<sum){
				System.out.println("No");
				System.exit(0);
			}
		}
		System.out.println("Yes");
	}
}


Measured memory_bytes: 21972
S = list(input())

dist1 = 0  # 1010...01 との編集距離
dist2 = 0  # 0101...10 との編集距離
for i, s in enumerate(S):
    if i % 2 == 1:
        if s == '1':
            dist2 += 1
        else:
            dist1 += 1
    if i % 2 == 0:
        if s == '1':
            dist1 += 1
        else:
            dist2 += 1

print(min(dist1, dist2))

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

int64_t euclid_gcd(int64_t A, int64_t B) {
  while (1) {
    if (A > B && B != 0)  A = A % B;
    if (B > A && A != 0)  B = B % A;
    if (A == B || A == 0 || B == 0)  break;
  }
  return max(A,B);
}

int main() {
  int64_t a,b;
  cin >> a >> b;
  int64_t gcd = euclid_gcd(a,b);
  cout << a * b / gcd << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
struct process_info_t {
	char name[11];
	int time;
	struct process_info_t *next;
};
typedef struct process_info_t ProcessInfo;

int main(void) {
	int num, qt, i, process, living_process;
	ProcessInfo rrs[100001], *p, *prev;

	scanf("%d %d ", &num, &qt);
	for (i = 0; i < num; i++) {
		scanf("%10s %d ", rrs[i].name, &rrs[i].time);
		rrs[i].next = &rrs[i+1];
	}
	rrs[num-1].next = &rrs[0];

	process = 0;
	living_process = num;
	prev = &rrs[num-1];
	for (p = &rrs[0];; p = p->next) {
		p->time -= qt;
		if (p->time > 0) {
			process += qt;
			prev = p;
		} else {
			process += qt + p->time;
			printf("%s %d\n", p->name, process);
			prev->next = p->next;
			if (--living_process <= 0)
				break;
		}
	}
	return 0;
}



Measured memory_bytes: 2892
"use strict";
function main(input) {
    const args = input.split(' ');

    const A = parseInt(args[0]);
    const B = parseInt(args[1]);
    const C = parseInt(args[2]);

    if((A < C && C < B) || (B < C && C < A)) {
        console.log('Yes')
    } else {
        console.log('No')
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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

// 無限大の値
const ll  LINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  int a,b,c;
  cin >> a >> b >> c;
  
  cout << (c >=  a && c <= b ? "Yes" : "No")  << endl;
  return 0;
} 

Measured memory_bytes: 3592
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  if (N % 2 == 1) {
    cout << 0 << endl;
    return 0;
  }
  ll ret = 0;
  N /= 10;
  while (N > 0) {
    ret += N;
    N /= 5;
  }
  cout << ret << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int n;
    cin >> n;
    map<int, bool> tbl;
    for (int i = 0; i < 9; i++) {
        for (int j = 0; j < 9; j++) {
            tbl[(i + 1) * (j + 1)] = true;
        }
    }
    string ans = "No";
    if (tbl.count(n)) {
        ans = "Yes";
    }
    cout << ans << endl;
    return 0;
}

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

using ll = long long;

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

 	ll n;
 	cin >> n;

 	vector<ll>v(n);
 	for(ll i=0;i<n;i++){
 		cin >> v[i];
 	}

 	map<ll,ll>mp;

 	for(ll i=0;i<n;i++){
 		if(mp.count(v[i])==0){
 			mp[v[i]] = 1;
 		} 		
 		else{
 			mp[v[i]]++;
 		}
 	}

 	ll sum = 0;
 	// for(auto it = mp.begin();it!=mp.end();it++){
 	// 	cout << it->first << " " << it->second << "\n"; 
 	// }

 	for(auto it = mp.begin();it!=mp.end();it++){
 		ll y = it->second;
 		sum = sum + (y*(y-1))/2;
 	}

 	//cout << sum << "\n";

 	for(ll i=0;i<n;i++){
 		ll k = mp[v[i]];
 		ll ans = sum - (k*(k-1))/2 + ((k-1)*(k-2))/2;
 		cout << ans << "\n";
 	}
	return 0;
}

Measured memory_bytes: 11136
def answer(a: int, b: int, c: int, d: int) -> int:
    return len(set(range(a, b)) & set(range(c, d)))


def main():
    a, b, c, d = map(int, input().split())
    print(answer(a, b, c, d))


if __name__ == '__main__':
    main()

Measured memory_bytes: 9060
# -*- coding: utf-8 -*-
import numpy as np
from collections import Counter
N = input()
# t = np.array(map(int, raw_input().split()))
t = np.array(list(map(int, input().split())))

odd = t[0::2]
even = t[1::2]
rest = 0

co = Counter(odd)
ce = Counter(even)

omc = co.most_common()
emc = ce.most_common()

if omc[0][0] == emc[0][0]:
    if len(omc) < 2 and len(emc) < 2:       # same
        rest = len(even)
    elif len(omc) < 2:
        rest = len(even)
    elif len(emc) < 2:
        rest = len(odd)
    else:
        or1 = len(odd) - co.most_common()[0][1]
        or2 = len(odd) - co.most_common()[1][1]
        er1 = len(even) - ce.most_common()[0][1]
        er2 = len(even) - ce.most_common()[1][1]

        if or1 + er2 > or2 + er1:
            rest = or2 + er1
        else:
            rest = or1 + er2
else:
    rest = len(odd) - co.most_common()[0][1] + len(even) - ce.most_common()[0][1]


print(rest)


    # counter.most_common()[0][0]
    # uni = list(set(_k))
    # cnt = np.zeros((len(uni), ))
    # for _i in uni:
    #     cnt[uni.index(_i)] += 1
    # unique = np.unique(odd, return_counts=True)
    # rest += len(_k) - count[np.argmax(count)]


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

int main(){
    
    int a, b, c;
    int sum;
    
    cin >> a >> b >> c;
    
    for(int i = a; i <= b; ++i){
        
        if(c % i == 0){
            ++sum;
        }
    }
    
    cout << sum << endl;
    
    
    return 0;
}


Measured memory_bytes: 3120
/*
 * A.c
 *
 *  Created on: 2019/02/17
 *      Author: X250
 */


#include <stdio.h>

int main(void) {
	int A,B,ans;
	scanf("%d%d",&A,&B);
	if(B%A==0)ans=A+B;
	else ans=B-A;
	printf("%d",ans);
}


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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

#define MOD 1000000007

using ll = long long;
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<P> vpi;
typedef pair<ll,ll> Pl;
typedef vector<ll> vl;
typedef vector<Pl> vpl;

ll gcd(ll a, ll b){
    if(a < b) swap(a, b);
    if(b <= 0) return -1;
    ll r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

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

int main() {
    int N,M,K;
    cin >> N >> M >> K;
    string ans;
    
    bool flag = false;
        rep(i, N+1){
            rep(j, M+1){
                if(M*i + N*j - 2*i*j == K) {
                    flag = true;
                    break;
                }
            }
            if(flag) break;
        }


    ans = (flag?"Yes":"No");
    cout << ans;
    //printf("%.12lf", ans);
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
S=input()[::-1]
L=[]
P=0

import sys
while P<N:
    k=0
    for i in range(1,M+1):
        if P+i>N:
            break
        if S[P+i]=='0':
            k=i
    if k==0:
        print(-1)
        sys.exit()
    L.append(k)
    P+=k

L=L[::-1]
print(*L)

Measured memory_bytes: 6408
#include<iostream>
#include<math.h>
using namespace std;
const int N=1e5+10;
long long a[N],sum[N];
// 0~tmp-1 tmp+1-n 
int main()
{
	int n;cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<=n+1;i++)
	{
		sum[i]=sum[i-1]+abs(a[i]-a[i-1]);
		//cout<<i<<" "<<sum[i]<<endl;
	}
	int tmp=1;
	while(tmp<=n)
	{
		//cout<<tmp<<" "<<sum[n+1]-sum[tmp+1]<<" "<<sum[tmp-1]-sum[0]<<" "<<abs(a[tmp+1]-a[tmp-1])<<endl;
		cout<<sum[n+1]-sum[tmp+1]+sum[tmp-1]-sum[0]+abs(a[tmp+1]-a[tmp-1])<<endl;
		//cout<<endl;
		tmp++;
	}
}

Measured memory_bytes: 2816
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int a, b, c;
  cin >> a >> b >> c;
  int ans = a + b;
  ans = min(ans, b + c);
  ans = min(ans, c + a);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define ll long long
typedef pair<ll, ll> P;
const ll INF = 1LL << 60;
//const int MOD = 1000000007;
const ll MOD=998244353;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main(){
  int k,t;
  cin>>k>>t;
  priority_queue<int>a;
  rep(i,t){
    int x;
    cin>>x;
    a.emplace(x);
  }
  int x=a.top();a.pop();
  if(x*2<=k)cout<<0<<endl;
  else cout<<x*2-k-1<<endl;
  return 0;
}

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

using namespace std;

int main(void)
{
	int n,k;
	cin >> n >> k;
	int l[60];
	for(int i=1;i<=n;i++)
		cin >> l[i-1];

	sort(l,l+n);
	reverse(l,l+n);

	int ans=0;

	for(int i=1;i<=k;i++)
		ans+=l[i-1];

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N, Q;
	cin >> N >> Q;
	vector<pair<ll, ll>> list;
	for (auto i = 0; i < N; ++i)
	{
		ll S, T, X;
		cin >> S >> T >> X;
		list.push_back({ S - X, X });
		list.push_back({ T - X, -X });
	}

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

	vector<ll> time;
	vector<ll> stop;
	map<ll, int> exist;
	for (auto i = 0; i < (int)list.size(); ++i)
	{
		auto& p = list[i];
		if (p.second >= 0)
		{
			++exist[p.second];
		}
		else
		{
			--exist[abs(p.second)];
			exist.erase(abs(p.second));
		}

		time.push_back(p.first);
		if (exist.size() > 0)
		{
			stop.push_back(exist.begin()->first);
		}
		else
		{
			stop.push_back(-1);
		}
	}

	vector<ll> ans;
	for (auto i = 0; i < Q; ++i)
	{
		ll D;
		cin >> D;
		auto it = upper_bound(time.begin(), time.end(), D);
		if (it != time.begin())
		{
			--it;
			auto index = (int)(it - time.begin());
			ans.push_back(stop[index]);
		}
		else
		{
			ans.push_back(-1);
		}
	}

	for (auto i = 0; i < (int)ans.size(); ++i)
	{
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 32744
n,m,x,y = map(int,input().split())

xl = list(map(int,input().split()))
yl = list(map(int,input().split()))

if x < y and max(xl) < min(yl) and x < min(yl) and max(xl) < y:
    print("No War")
else:
    print("War")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
map<int,int>z;
map<int,int>zz;
typedef pair<int,int>P;
priority_queue<P> q;
priority_queue<P> qq;
int main()
{
    int a;
    cin>>a;
    int max1=0,max2=0;
    int x,xx;
    for(int i=1; i<=a; i++)
    {
        int c;
        cin>>c;
        if(i&1)
        {
            z[c]++;
        }
        else
        {
            zz[c]++;
        }
    }
    map<int,int>::iterator it=z.begin();
    P p;
    p.first=0;
    p.second=0;
    q.push(p);
    qq.push(p);
    for(; it!=z.end(); it++)
    {
        p.first=it->second;
        p.second=it->first;
        q.push(p);
    }
    it=zz.begin();
    for(; it!=zz.end(); it++)
    {
        p.first=it->second;
        p.second=it->first;
        qq.push(p);
    }
    int t=q.top().second;
    int tt=qq.top().second;
    int sum=0;
    if(t==tt)
    {
        t=q.top().first;
        tt=qq.top().first;
        q.pop();
        sum=tt+q.top().first;
        qq.pop();
        sum=max(sum,t+qq.top().first);
    }
    else
        sum=q.top().first+qq.top().first;
        cout<<a-sum;
    return 0;
}


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

int main()
{
    int n, max=0, out=1;
    cin >> n;

    for (int i = 1; i <= n; ++i)
    {
        int j = i;
        int k = 0;
        while(j%2 == 0){
            j /= 2;
            k++;
        }
        if (k > max)
        {
            max = k;
            out = i;
        }
    }

    cout << out << endl;
    return 0;

}

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

using namespace std;

string s, t;
int a[105], b[105];

int main()
{
    cin >> s >> t;
    int S = s.size();
    int T = t.size();
    for (int i = 0; i < S; i++)
        a[i+1] = s[i] - 'a';
    for (int i = 0; i < T; i++)
        b[i+1] = t[i] - 'a';
    sort (a+1, a+S+1);
    sort (b+1, b+T+1);
    for (int i = 1; i <= T/2; i++)
        swap(b[i], b[T+1-i]);
    for (int i = 1; i <= min(S,T); i++)
    {
        if (a[i]<b[i])
        {
            cout << "Yes";
            break;
        }
        if (a[i]>b[i])
        {
            cout << "No";
            break;
        }
        if (i==min(S,T) && a[i]==b[i])
        {
            if (S<T) cout << "Yes";
            else cout << "No";
        }
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)

int main(void){
	int i=0,n,cnt=1,ans,sz;
	bool flag=true;
	string s;
	cin >> s;
	n = s.length();
	ans = n;
	for(i=1; i<n; i++){
		if(s[i-1] != s[i]){
			ans = min(ans,max(i,n-i));
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n, k = Is()
H = LI()

C = [x for x in H if x >= k]
print(len(C))

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

typedef long long lli;

lli a[3], m[3], t[3];

lli gcd(lli a, lli b) {
  return b == 0 ? a : gcd(b, a%b);
}

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

int main() {
  while(1) {
    bool flag = false;
    for(int i = 0; i < 3; ++i) {
      cin >> a[i] >> m[i];
      if(a[i] == 0 && m[i] == 0); else flag = true;
    }
    if(!flag) break;
    for(int i = 0; i < 3; ++i) {
      lli x = 1;
      t[i] = 0;
      do {
        x = a[i]*x%m[i];
        ++t[i];
      } while(x != 1);
    }
    cout << lcm(lcm(t[0],t[1]),t[2]) << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#pragma region head
    #include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pi = pair<int, int>;
    using pll = pair<ll,ll>;
    template <class T> using vv = vector<vector<T>>;
    #define rep(i,n) for(int i = 0; i < (int)(n); i++)
    #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
    #define rrep(i,n) for(int i = (int)(n)-1; i >= 0; i--)
    #define rrepi(i,a,b) for(int i = (int)(b)-1; i >= (int)(a); i--)
    #define all(x) (x).begin(), (x).end()
    #define bit(n) (1LL<<(n))
    const int INF = 1002003004;
    const ll LINF = 1002003004005006007ll;
    struct preprocess{preprocess()
    {cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}}____;
#pragma endregion head

#pragma region library
template <class T>
struct Edge{
    int src;
    int to;
    T cost;
    Edge(int t,T c) : to(t),cost(c) {}
    Edge(int src, int t,T c) : src(src),to(t),cost(c) {}
};
template<class T> using WeightedGraph = vector<vector<Edge<T>>>;
template<class T>
vector<T> dijkstra(WeightedGraph<T>& g, int s){
    const auto INFD = numeric_limits<T>::max();
    vector<T> dist(g.size(),INFD);
    dist[s] = 0;
    using pd = pair<T, int>;
    priority_queue<pd,vector<pd>,greater<pd>> que;
    que.emplace(dist[s],s);
    while(!que.empty()){
        T cost; int idx;
        tie(cost,idx) = que.top(); que.pop();
        if(dist[idx]<cost) continue;
        for(auto& e: g[idx]){
            if(dist[e.to] > dist[idx]+e.cost){
                dist[e.to] = dist[idx]+e.cost;
                que.emplace(dist[e.to],e.to);
            }
        }
    }
    return dist;
}
#pragma endregion library

int main(){
    int n; cin >> n;
    WeightedGraph<ll> to(n);
    rep(i,n-1){
        int a,b; ll c;
        cin >> a >> b >> c;
        a--; b--;
        to[a].emplace_back(b, c);
        to[b].emplace_back(a, c);
    }
    int q,k; cin >> q >> k;
    k--;
    vll dist = dijkstra<ll>(to,k);
    while(q--){
        int x,y; cin >> x >> y;
        x--; y--;
        cout << dist[x] + dist[y] << '\n';
        
    }
    
}

Measured memory_bytes: 13944
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
//const int MOD = 1e9 + 7;
const int MOD = 998244353;
const int INF = 1e10;
const long double PI = (acos(-1));

struct mint {
	int x;
	mint(int x = 0) :x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= MOD)x -= MOD;
		return *this;
	}
	mint & operator-=(const mint a) {
		if ((x += MOD - a.x) >= MOD)x -= MOD;
		return *this;
	}
	mint & operator*=(const mint a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint a)const {
		return mint(*this) += a;
	}
	mint operator-(const mint a)const {
		return mint(*this) -= a;
	}
	mint operator*(const mint a)const {
		return mint(*this) *= a;
	}
	mint pow(int t)const {
		if (!t)return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1)a *= *this;
		return a;
	}

	//for prime mod
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a)const {
		mint res(*this);
		return res /= a;
	}
};
ostream& operator<<(ostream & os, const mint & m) {
	os << m.x;
	return os;
}

signed main() {
	int N;
	cin >> N;
	map<int, int>m;
	int mx = -1;
	bool can = true;
	rep(i, N) {
		int D;
		cin >> D;
		if (!i)if (D == 0)can = false;
		m[D]++;
		mx = max(mx, D);
	}
	if (m[0] != 1 || can) {
		cout << 0 << endl;
		return 0;
	}
	mint ans = 1;
	for (int i = 1; i <= mx; i++) {
		mint a = m[i - 1];
		ans *= a.pow(m[i]);
	}
	cout << ans << endl;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  
  vll cnt(n+1);
  ll ans=0;
  reps(i,n){
    for(ll j=1; j*i<=n; j++){
      cnt[i*j]++;
    }
    ans+=i*cnt[i];
  }
  
  // reps(i,n) cout<<cnt[i]<<' ';
  // cout<<endl;
  
  cout<<ans<<endl;
}

Measured memory_bytes: 81308
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}

bool check(vector<LL> h){
    REP(i, h.size()){
        if(h[i]!=0)return true;
    }
    return false;
}

void solve(long long N, std::vector<long long> h){
    int ans=0;
    while(check(h)){
        bool flag = false;
        REP(i,h.size()){
            if(h[i]==0 && flag==true){ans++;flag=false;}
            if(h[i]!=0 && flag==false){flag = true;}
        }
        if(flag==true)ans++;
        REP(i, h.size())if(h[i]>0)h[i]--;
    }
    cout<<ans<<endl;
}

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


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

int main(void){
  ll n, ans = 0, i, cur = 1;
  scanf("%lld", &n);

  for (i = n; i != n / (cur + 1); ++cur, i = n / cur)
    if (n % i == n / i) ans += cur;

  for (; i >= 1; i--){
    ll ml = (n + i + 1) / (i + 1), mu = n / i;
    if ((n - i) % i == 0){
      ll m = (n - i) / i;
      if (ml <= m && m <= mu) ans += m;
    }
  }

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


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

long long numList[100005];

int main()
{
	int N;
	scanf("%d", &N);
	
	long long product = 1;
	const long long maxVal = (long long)(1E9) * (long long)(1E9);
	
	for(int i = 1; i <= N; i++)
	{
		scanf("%lld", &numList[i]);
		if(numList[i] == 0)
		{
			printf("0");
			return 0;
		}
	}
	
	for(int i = 1; i <= N; i++)
	{
		long long Ai = numList[i];
		
		if(maxVal / product < Ai)
		{
			printf("-1");
			return 0;
		}
		
		product *= Ai;
	}
	
	printf("%lld", product);
}


Measured memory_bytes: 4540
#include<iostream>
using namespace std;
int main()
{
	int w;
	while(cin>>w)
	{
		bool flag=0;
		for(int i=1;w>0;i*=2)
		{
			if(w%2>0)
			{
				if(flag)
				{
					cout<<' ';
				}
				cout<<i;
				flag=1;
				w--;
			}
			w/=2;
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3080
s = input()
n = len(s)

ans = 0

for bit in range(1 << n-1):
    f = s[0]
    for i in range(n-1):
        if (bit & (1<<i)):
            f += "+"
        f += s[i+1]
    ans += sum(map(int , f.split("+")))

print(ans)

Measured memory_bytes: 41452
import java.util.Scanner;

public class Main {
	static int maxn = 100 + 10;
	static String str;
	static int k,n;
	static int cnt[];
	public static void main(String[] args) 
	{
		Scanner cin = new Scanner(System.in);
		cnt =new int[maxn];
		str=cin.next();
		k=cin.nextInt();
		n=str.length();
		int ans=0;
		
		for(int i=0;i<n;i++)
			if(str.charAt(i)!='0')
				cnt[i]=1;
		for(int i=1;i<n;i++)
			cnt[i]+=cnt[i-1];
		
		if(k==1)
		{
			for(int x=0;x<n;x++)
				for(int a=1;a<=9;a++)
					if(panduan1(x,a)) ans++;
		}
		else if(k==2)
		{
			for(int x=0;x<n;x++)
				for(int y=x+1;y<n;y++)
					for(int a=1;a<=9;a++)
						for(int b=1;b<=9;b++)
						{
							if(panduan2(x,y,a,b)) ans++;
						}
		}
		else if(k==3)
		{
			for(int x=0;x<n;x++)
				for(int y=x+1;y<n;y++)
					for(int z=y+1;z<n;z++)
						for(int a=1;a<=9;a++)
							for(int b=1;b<=9;b++)
								for(int c=1;c<=9;c++)
									if(panduan3(x,y,z,a,b,c))ans++;
		}
		System.out.println(ans);
	}
	public static boolean judge(int l,int r)
	{
		if(l > r)
	        return false;
	    if(l == 0)
	        return cnt[r]==0?false:true;
	    return cnt[r] - cnt[l - 1]==0?false:true;
	}
	public static boolean panduan1(int x,int a)
	{
		if(x!=0)
			return true;
		if(str.charAt(0)-'0' >= a)
	        return true;
	    return false;
	}
	public static boolean panduan2(int x,int y,int a,int b)
	{
		if(x!=0) 
			return true;
		if(str.charAt(0)-'0'> a)
	        return true;
	    if(str.charAt(0)-'0' < a)
	        return false;
	    
	    if(judge(x + 1, y - 1))
	        return true;
	    if(str.charAt(y)-'0'>= b)
	        return true;
		return false;
	}
	public static boolean panduan3(int x,int y,int z,int a,int b,int c)
	{
		if(x!=0)
	        return true;
	    if(str.charAt(0)-'0'> a)
	        return true;
	    if(str.charAt(0)-'0'< a)
	        return false ;
	    if(judge(x + 1, y - 1))
	        return true;
	    if(str.charAt(y)-'0'> b)
	        return true;
	    if(str.charAt(y)-'0'< b)
	        return false;
	    if(judge(y + 1, z - 1))
	        return true;
	    if(str.charAt(z)-'0'>= c)
	        return true;
	    return false;
	}
}

Measured memory_bytes: 25044
N,M=map(int,input().split())
series=[[] for N in range(N)]
for n in range(N):
	series[n]=list(map(int,input().split()))
ans = 0
for m in range(1,M+1):
	for n in range(N):
		if m not in series[n][1:]:
			break
	else:
		ans += 1
print(ans)

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	string s;
	cin>>s;
	long long int size=s.size();
	long long int c1=0,c2=0;
	for(long long int i=0;i<s.size();i++){
		if(i&1){
			if(s[i]!='1'){
				c1++;
			}
		}
		else{
			if(s[i]!='0'){
				c1++;
			}
		}
	}
	for(long long int i=0;i<s.size();i++){
		if(i&1){
			if(s[i]!='0'){
				c2++;
			}
		}
		else{
			if(s[i]!='1'){
				c2++;
			}
		}
	}
	long long int ans=min(c1,c2);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3764
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int K = sc.nextInt();
		int Q = sc.nextInt();
		int[] p = new int[N+1];
		Arrays.fill(p, K);
		int border = 0;
		for(int i=0;i<Q;i++) {
			int x = sc.nextInt();
			p[x]++;
			border++;
		}
		for(int i=1;i<=N;i++) {
			if(p[i]>border) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}
}

Measured memory_bytes: 72104
import java.util.*;
import java.io.*;
public class Main{
	public static void main(String args[]){
    	Scanner in = new Scanner(System.in);
      	char[] s = in.next().toCharArray();
      	int freq[] = new int[26];
      	for(int i=0;i<s.length;i++){
        	freq[s[i]-'a']++;
        }
      	boolean check = true;
      	for(int i =0;i< 26;i++){
        	if(freq[i]%2!=0){
            	check = false;
              break;
            }
     
        }
      	if(!check){
        	System.out.println("No");
        }
      	else{
        	System.out.println("Yes");
        }
    }
}

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

//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long

int main() {
	int a,b,c,k;
	cin >> a >> b >> c >> k;

	int op = 0;
	while(b <= a) {
		op++;
		b = b*2;
	}
	while(c <= b) {
		op++;
		c = c*2;
	}

	if(op <= k) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


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

int A, B;
string S;

int main() {
	cin >> A >> B >> S;
	bool ans = true;
	for (int i = 0; i < A; i++) if (!(0 <= S[i] - '0' && S[i] - '0' <= 9)) ans = false;
	if (S[A] != '-') ans = false;
	for (int i = A + 1; i < A + B + 1; i++) if (!(0 <= S[i] - '0' && S[i] - '0' <= 9)) ans = false;

	if (ans) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

#define rep(a,b) for(int ii=a;ii<b;ii++)
#define ll long long int
#define test() int tt; cin>>tt; while(tt--) 
#define arrayInput for(int ii = 0; ii<n; ii++) cin >> arr[ii];
#define fst_io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl '\n'
#define lg 1000000000

int main()
{
  int n, i, j, c = 0;
  cin >> n;
  for(i = 1; i <= n; i++)
  {
    for(j = 1; j <= n/i; j++)
    {
      if(n - (i*j) > 0) c++;
    }
  }
  cout << c;
  return 0;
}

Measured memory_bytes: 3636
#!/usr/bin/ruby
while (h,w,l=gets.split.map(&:to_i))!=[0,0,0]
d=[[0,-1],[1,0],[0,1],[-1,0]]
d0="NESW".split('')
f=(h+2).times.map{[1]*(w+2)}
g=(h+2).times.map{(w+2).times.map{[nil]*4}}
z=x=y=0
h.times{|i|
	s=gets.chomp
	w.times{|j|
		if (k=d0.index(s[j..j]))
			x=j+1;y=i+1;z=k
		end
		if s[j..j]!='#'
			f[i+1][j+1]=nil
		end
	}
}
c=0
while l>0
	break if g[y][x][z]&&(l%=c-g[y][x][z])==0
	g[y][x][z]=c
	z=(z+1)%4 while f[y+d[z][1]][x+d[z][0]]
	x+=d[z][0];y+=d[z][1]
	l-=1
	c+=1
end
puts "#{y} #{x} #{d0[z]}"
end

Measured memory_bytes: 8784
from fractions import gcd

def main():
    A, B, C, D = map(int, input().split())
    ans = 0
    ans += B - ((B // C) + (B // D) - (B // (lcm(C, D))))
    ans -= (A-1) - (((A-1) // C) + ((A-1) // D) - ((A-1) // (lcm(C, D))))
    print(ans)

def lcm(a, b):
    return a * b // gcd(a, b)

main()


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

int main(int argc, char *argv[]){
  int n, m;
  cin >> n >> m;
  int c[m], d[m];
  int road[n + 1];
  memset(road, 0, sizeof(road));
  for (int i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
    for (int j = c[i]; j < d[i]; j++) {
      road[j] = 1;
    }
  }
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    if(road[i] == 1)ans++;
    // std::cout << road[i];
    // if(i == n)std::cout << std::endl;
    // else std::cout << " ";
  }
  
  std::cout << ans*2 + n + 1 << std::endl;
  return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a, b;
    cin >> a >> b ;
    //*/

    /*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;

    sort(vec.begin(), vec.end());
    //*/
    
    //*
    if( a > b ){
        cout << "safe" << endl;
    } else {
        cout << "unsafe" << endl;
    }
    //*/
    
    //cout << ((floor(a / 2) + fmod(a, 2)) / a) << endl;
    
    return 0; 
}


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

int main()
{
	int n,k,x,y,money=0;
	cin>>n>>k>>x>>y;
	if(n>k)
	{
		money=k*x+(n-k)*y;
	}
	else 
	{
		money=n*x;
	}
	cout<<money<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
 
int value[6] = {1, 5, 10, 50, 100, 500};
int ns[6];
int p;
 
#define INF (1<<28)
 
int count_coins(int n) {
    int cnt = 0;
    for (int i = 5; i >= 0; i--) {
        int c = n / value[i];
        n -= c * value[i];
        cnt += c;
        if (n == 0) break;
    }
    return cnt;
}
 
int solve(int index, int rem) { 
    if (rem == 0) return 0;
    if (rem < 0) return count_coins(-rem);
    if (index < 0) return INF;
    int min_pay = INF;
 
    int s = rem / value[index];
    if (s < ns[index]) {
        min_pay = min(solve(index-1, rem-value[index]*s) + s,
                      solve(index-1, rem-value[index]*(s+1)) + s + 1);
        return min_pay;
    }
    return solve(index-1, rem-value[index]*ns[index]) + ns[index];
}
 
int main() {
    while (cin >> p) {
        if (p == 0) break;
        for (int i = 0; i < 6; i++) 
            cin >> ns[i];
        
        int min_total = INF;
        for (int i = 0; i <= 500; i++) {
            min_total = min(min_total, solve(5, p+i) + count_coins(i));
        }
        cout << min_total << endl;
    }
    return 0;
}

Measured memory_bytes: 1160