akhauriyash/Code-Regression huggingface dataset:
/*Let's start.............*/
#define   ll                long long
#define   pb                push_back
#define   ff                first
#define   ss                second
#define   srt(v)            sort(v.begin(),v.end())
#define   inf               2000000000000000
#define   mxn               1009
#define   pi                acos(-1)
#define   MOD               1000000007
#define   db(x)             printf("### VALUE: (%lld) ###\n",(ll)x)
#include  <bits/stdc++.h>
using namespace std;


int main()
{
    string s;
    cin >> s;
    bool flag = false;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == '7')
            flag = true;
    }
    if(flag)
        cout  <<"Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}
/*
".....but the truth is that you can increase it slightly."
Day 27
*/



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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;
using pnt=pair<int,int>;
//status unsolved
bool cmp1(pair<int,int>x1,pair<int,int>x2){
    return x1.first<x2.first;
}
bool cmp2(pair<int,int>x1,pair<int,int>x2){
    return x1.second<x2.second;
}
int main(){
    int n;
    cin>>n;
    vector<pnt>red(n);
    vector<pnt>blue(n);


    rep(i,n){
        int a,b;
        cin>>a>>b;
        red[i]=pnt(a,b);
    }
    rep(i,n){
        int c,d;
        cin>>c>>d;
        blue[i]=pnt(c,d);
    }
    vector<bool>matched(n,false);
    int  ans=0;
    //xについてソート
    sort(red.begin(),red.end(),cmp1);
    sort(blue.begin(),blue.end(),cmp1);

    for(int i=0;i<n;i++){
        pnt now=blue[i];
        //int it=lower_bound(red.begin(),red.end(),now,cmp1)-red.begin();
        int it=0;
        int  cand=-1;
        int size=-1;
        while(it<n){
            if(red[it].first<now.first && !matched[it]){

                //今みている青点より左で、できるだけyの値が大きいものとペアを組む
                if(red[it].second<now.second && size<red[it].second){
                cand=it;
                size=red[it].second;
                }
            }
        it++;
        }
        if(cand!=-1){
            matched[cand]=true;
            ans++;
        }
    
    }
    cout<<ans<<endl;
    return 0;

}
/*


*/


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl;
template<class T>bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if (b<a){a=b;return 1;}return 0;}
const int INF = 1e9;
const ll LINF = 1e18;
// clang-format on

void solve(long long A, long long B) {
  ll ans = A * B;
  if (A < B) {
    swap(A, B);
  }
  ll r = A % B;
  while (r != 0) {
    A = B;
    B = r;
    r = A % B;
  }
  ANS(ans / B);
}

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


Measured memory_bytes: 256
#include <iostream>
using namespace std;
//B - Collatz Problem
int main(void){
    int s;
    std::cin >> s;
    int i=1;
    while(s!=4 && s!=2 && s!=1){
        if(s%2==0){
            s=s/2;
        }else{
            s=3*s+1;
        }
        i++;
    }
    std::cout << i+3 << std::endl;
    
}


Measured memory_bytes: 256
a, b = map(int, input().split())

def check(a, b):
    if a % 3 == 0:
        return 1
    elif b % 3 == 0:
        return 1
    elif (a + b) % 3 == 0:
        return 1
    else:
        return 0

def main():
    if check(a, b) == 1:
        print("Possible")
    else:
        print("Impossible")

main()

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

using namespace std;

vector <int> v;

int main() {
	int n , k;
	ios::sync_with_stdio(0);
	cin >> n >> k;
	string s;
	cin >> s;
	int ans = 0;
	for(int i = 1 ; i < s.length() ; i++) {
		if(s[i] == s[i - 1])ans++;
	}
	ans = min(2 * k + ans , n -1); 
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 512
/* ===================================*/
/* Author :   Moshiur Rahman Mohim    */
/* Email  :   mtmohim74@gmail.com     */
/* Institute: HSTU                    */
/* ===================================*/

#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cctype>

#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
using  namespace  std;

const int INF = 0x7f7f7f7f;

#define pi              acos(-1.0)
#define mod             1000000007
#define MAX             10000
#define FOR(i, b, n)    for(LL i=b; i<=n; i++)
#define FORR(i, n, b)   for(LL i=n; i>=b; i--)
// Library.
#define mem(a,b)        memset(a,b,sizeof(a))
#define Sort(x)         sort(x.begin(),x.end())
#define Reverse(x)      reverse(x.begin(),x.end())
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a * (b / gcd(a,b)))
#define sq(x)           (x)*(x)
// File.
#define READ(f)         freopen(f, "r", stdin)
#define WRITE(f)        freopen(f, "w", stdout)
// i/o.
#define sf              scanf
#define pf              printf
#define pr1(x)          cout<<x<<"\n"
#define pr2(x,y)        cout<<x<<" "<<y<<"\n"
#define pr3(x,y,z)      cout<<x<<" "<<y<<" "<<z<<"\n"
// Test Case.
#define TEST(i,t)       LL i,t;scanf("%lld",&t);for(i=1;i<=t;i++)

typedef unsigned int            U;
typedef long int                L;
typedef unsigned long int       LU;
typedef long long int           LL;
typedef unsigned long long int  LLU;
typedef float                   F;
typedef double                  LF;
typedef char                    C;

//STL
typedef vector<LL>vl;
typedef pair<int,int>pii;
typedef pair<string,int>psi;
typedef pair<LL,LL>pll;
typedef pair<LF,LF>pdd;
typedef vector<pii> vpii;

/*.......Global Function.......*/
// Compute b^p%m
int BigMod(LL B,LL P,LL M)
{
    LL R=1;
    while(P>0)
    {
        if(P%2==1)
            R=(R*B)%M;
        P/=2;
        B=(B*B)%M;
    }
    return (int)R;
}
//Ugly Numbers
LL maxDivide(LL a,LL b)
{
    while(a%b==0)
        a=a/b;
    return a;
}
LL isUgly(LL no)
{
    no=maxDivide(no,2);
    no=maxDivide(no,3);
    no=maxDivide(no,5);
    return (no==1)?1:0;
}
//XOR of 2 Numbers
LL myXOR(LL x,LL y)
{
    LL res=0;
    FORR(i,31,0)
    {
        bool b1=x&(1<<i);
        bool b2=y&(1<<i);
        bool xoredBit=(b1&b2)?0:(b1|b2);
        res<<=1;
        res|=xoredBit;
    }
    return res;
}
/*............End............*/
/*.......Global Declaration.......*/
C st[1002];
int main()
{
    //READ("input.txt");
    //WRITE("output.txt");
    cin>>st;
    LL x=0;
    if(count(st,st+strlen(st),'W')!=0)
        x+=1;
    if(count(st,st+strlen(st),'E')!=0)
        x+=1;
    if(x==1)
    {
        pf("No\n");
        return 0;
    }
    else
        x=0;
    if(count(st,st+strlen(st),'S')!=0)
        x+=1;
    if(count(st,st+strlen(st),'N')!=0)
        x+=1;
    if(x==1)
    {
        pf("No\n");
        return 0;
    }
    else
        pf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

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

int main()
{
  INT(N);
  vector<P> A(N);
  REP(i,N) cin >> A[i].first >> A[i].second;
  REP(i,N-2){
    if(A[i].fi==A[i].se&&A[i+1].fi==A[i+1].se&&A[i+2].fi==A[i+2].se){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
int cnt(vector<int> V,int D){
    int ans = 0;
    rep(i,1,(int)V.size()){
        ans += abs(V[i] - V[i-1]) == D;
    }
    return ans;
}
int powi(int a,int b){
    int ans = 1;
    rep(i,0,b)ans *= a;
    return ans;
}
vector<int> fil(int M,int N,int x){
    vector<int> V(M);
    for(int i = 0;i < V.size();i++){
        V[i] = x % N;
        x /= N;
    }
    return V;
}
main(){
    double N,M,D;
    cin >> N >> M >> D;
    /*
    ll sum = 0;
    rep(i,0,powi(N,M)){
        vector<int> V = fil(M, N, i);
        sum += cnt(V,D);
    }
    cout << sum << " " << powi(N,M) << endl;
    printf("%.9lf\n",1. * sum / powi(N,M));
    */
    if(D != 0)printf("%.9lf\n",2 / (N * N) * (N - D) * (M - 1));
    else printf("%.9lf\n", (M - 1) / N);
    /*
    printf("%.9lf\n", (M - D) / N);
    printf("%.9lf\n", pow(M - 1, 2 * (N - D)) / N );
    */
}

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

int main() {
	int N;
	cin >> N;
	long long power=1, c = 1000000007;

	for (int i = 1; i <= N; i++) {
		power *= i;
		power %= c;
	}

	cout << power << endl;

	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

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 EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	int n; cin >> n;
	vector<int> v(n);

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

	vector<int> c(n);

	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}


	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (v[i] - c[i] > 0) {
			ans += v[i] - c[i];
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
int main(){
	int n;
	bitset<10003> bs;
	bs[0] = 1;
	cin >> n;
	FOR(i,0,n){
		int k;
		cin >> k;
		bs = bs|(bs<<k);
	}
	for(int i=10000;i>0;i--){
		if(i%10==0)continue;
		if(bs[i]){
			cout << i << endl;
			return 0;
		}
	}
	cout << 0 << endl;
}

Measured memory_bytes: 256
package main
 
import (
	"fmt"
	"math"
)
 
func main() {
	var n int
	fmt.Scan(&n)
	var (
		min = +math.MaxInt32
		max = -math.MaxInt32
	)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)
		if tmp < min {
			min = tmp
		}
		if tmp > max {
			max = tmp
		}
	}
	fmt.Printf("%d\n", max-min)
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
 public static void main (String[ ] args) {
   int x, y, z;
   int s, k;
   int count = 0;

   Scanner sc = new Scanner(System.in);
   k = Integer.parseInt(sc.next());
   s = Integer.parseInt(sc.next());

  for(x = 0; x <= k; x++) {
    for( y = 0; y <= k; y++) {
     z = s - x - y;
     if ( z <= k && z >= 0) {
      count++;
     }
    }
  }

  System.out.println(count);
 }
}

Measured memory_bytes: 9680
fn print_vec(arr: &Vec<i32>) {
    for i in 0..arr.len() {
        print!("{}", arr[i]);
        if i < arr.len() - 1 {
            print!(" ");
        }
    }
}

static mut N_COMPARE: i32 = 0;

fn merge_sort(inputs: &mut Vec<i32>, left: usize, right: usize) -> () {
    if left + 1 >= right {
        return ();
    }
    let middle = (left + right) / 2;
    merge_sort(inputs, left, middle);
    merge_sort(inputs, middle, right);
    merge(inputs, left, middle, right)
}

fn merge(inputs: &mut Vec<i32>, left: usize, middle: usize, right: usize) -> () {
    let n1 = middle - left;
    let n2 = right - middle;
    let infinity: i32 = 2 * 10_f32.powi(9) as i32;
    let mut l = inputs[left..(left + n1)].to_vec();
    let mut r = inputs[middle..(middle + n2)].to_vec();
    l.push(infinity);
    r.push(infinity);

    let mut i = 0 as usize;
    let mut j = 0 as usize;
    for k in left..right {
        if l[i] <= r[j] {
            inputs[k] = l[i];
            i += 1;
        } else {
            inputs[k] = r[j];
            j += 1;
        }
        unsafe {
            N_COMPARE += 1;
        }
    }
}

fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();
    let n = line.trim().parse::<usize>().unwrap();

    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();
    let mut inputs: Vec<i32> = line.split_whitespace()
        .map(|e| e.parse::<i32>().ok().unwrap())
        .collect();

    let (left, right) = (0, n);
    merge_sort(&mut inputs, left, right);

    print_vec(&inputs);
    println!();
    unsafe {
        println!("{}", N_COMPARE);
    }
}



Measured memory_bytes: 18420
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int a, b, i=0;
    string s;
    cin >> a >> b; cin >> s;
    for(; i < a; i++){
        if((s[i] > '9') || (s[i] < '0')){
            cout << "No" << endl; return 0;
        }
    }
    if(s[i] != '-'){
        cout << "No" << endl; return 0;
    }
    i++;
    for(; i < a+b+1; i++){
        if((s[i] > '9') || (s[i] < '0')){
            cout << "No" << endl; return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

#define max(a,b) ((a) > (b) ? (a) : (b))
#define mix(a,b) ((a) < (b) ? (a) : (b))

int main(void) {
	int k;
	char s[101];
	
	scanf("%d", &k);
	scanf("%s", s);
	
	for (int i = 0; i < k; i++) {
		if (i < strlen(s))
			printf("%c", s[i]);
	}
	
	if (k < strlen(s))
		printf("...");
	
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 1724
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var nx = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
            var li = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
            var count = 1;
            var current = 0L;
            for (var i = 0; i < li.Length; i++)
            {
                current += li[i];
                if (current <= nx[1]) count++;
                else break;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13396
p = []
cnt = 0
x, n = map(int, input().split())

p = input().split()

for i in range(n):
    p[i] = int(p[i])

while True:
    if not x in p:
        print(x)
        break
    if cnt % 2 == 0:
        x = x - (cnt + 1)
    elif cnt % 2 == 1:
        x = x + (cnt + 1)
    cnt += 1

Measured memory_bytes: 9192
#include "bits/stdc++.h"

// clang-format off
template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
char capitalize(char c) { return static_cast<char>(std::toupper(static_cast<unsigned char>(c))); }
// template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
// template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }
// clang-format on

#define int long long
#define YES "Yes"
#define NO  "No"
#define MOD 1000000000+7

#define forit(v) for(auto it = v.begin(); it != v.end(); ++it)

using namespace std;

int f(int n, int x) {
  if (n == -1) return 0;
  else return n / x + 1;
}

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

  int num = 0;
  // num = numeric_limits<int>::max();
  // num = numeric_limits<int>::min();
  bool flag = false;
  // flag = true;

  int n; cin >> n;
  num = 1;
  for (int i = 2; i <= n; ++i) {
    if (i >= MOD) num *= (i % MOD);
    else num *= i;
    if (num >= MOD) num %= MOD;
  }
  
  cout << num << endl;
  // cout << (flag ? YES : NO) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdlib>  // abs() for integer
#include <math.h>     // math.h をインクルードする！
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

bool find_prime(int n) {
    for(int i = 2; i < sqrt(n); i++) {
        //if(i == n) return false;  
        if (n % i == 0) return true;
    }
    return false;

}

int main() {
    int x;
    cin >> x;
    while(find_prime(x)) x++;
    cout << x << endl;
}

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

int main()
{
	string s;
	cin >> s;
	while (s.size() != 0) {
		int n = s.size();
		if (n >= 5 && s.substr(n - 5) == "dream") {
			s = s.substr(0, n - 5);
		}
		else if (n >= 7 && s.substr(n - 7) == "dreamer") {
			s = s.substr(0, n - 7);
		}
		else if (n >= 5 && s.substr(n - 5) == "erase") {
			s = s.substr(0, n - 5);
		}
		else if (n >= 6 && s.substr(n - 6) == "eraser") {
			s = s.substr(0, n - 6);
		}
		else {
			break;
		}
	}
	if (s.size() == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <functional>
#include <map>



using namespace std;

int main(void) {

	int n, k;
	cin >> n >> k;
	bool a[105] = {};
	int d;
	int i;
	while (k--) {
		cin >> d;
		while (d--) {
			cin >> i;
			if (a[i] == false) {
				a[i] = true;
				n--;
			}



		}
	}


	cout << n << endl;
	return 0;
}


Measured memory_bytes: 3548
use std::collections::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let _: usize = read();
    let mut a = read_vec::<usize>();
    a.sort();

    let mut num_dict = HashMap::new();
    for num in a.iter() {
        *num_dict.entry(*num).or_insert(0) += 1;
    }
    let mut ans = 0;
    for num in a.iter().rev() {
        // already consumed
        if num_dict[num] == 0 {
            continue;
        }
        *num_dict.get_mut(num).unwrap() -= 1;
        let power = (*num as f64).log2() as usize + 1;
        let key = (1 << power) - *num;
        // println!("{:?}", (*num, 1 << power, key));
        if num_dict.contains_key(&key) && num_dict[&key] > 0 {
            *num_dict.get_mut(&key).unwrap() -= 1;
            ans += 1;
        }
    }
    println!("{:?}", ans);
}


Measured memory_bytes: 18928
from itertools import chain

n,m,k = map(int,input().split())
 
bff = [list(map(int,input().split())) for i in range(m)]
 
blk = [list(map(int,input().split())) for i in range(k)]


rank = [0] * (n+1)
par = [i for i in range(n+1)]
demi = [1] * (n+1)


for i,j in bff:
    x = par[i]
    y = par[j]
    while x != par[x]:
        x = par[x]
    while y != par[y]:
        y = par[y]
    if(x == y):
        continue
    
    if rank[x] < rank[y]:
        par[x] = y
        demi[y] += demi[x]
        
    else:
        par[y] = x
        demi[x] += demi[y]
        
        if rank[x] == rank[y]:
             rank[x] += 1


for i in range(n):
    x = par[i+1]
    while x!=par[x]:
        x = par[x]
    par[i+1] = x


for i in range(n):
    x = par[i+1]
    while x!=par[x]:
        x = par[x]
    demi[i+1] = demi[x]



a = list(chain.from_iterable(bff))
b = list(chain.from_iterable(blk))

fqua = [0] * n
bqua = [0] * n
 
for i,j in bff:
    if(par[i] == par[j]):
        fqua[i-1] += 1
        fqua[j-1] += 1

for i,j in blk:
    if(par[i] == par[j]):
        bqua[i-1] += 1
        bqua[j-1] += 1

for i in range(n):
    print(demi[i+1] - fqua[i] - bqua[i] - 1 ,end=" ")

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	VI a(n);
	
	rep(i, n){
		cin >>a[i];
	}
	auto b = a;
	sort(b.rbegin(), b.rend());
	int m1 = b[0], m2=b[1];
	rep(i, n){
		if(a[i] != b[0]) cout << b[0] <<"\n";
		else cout <<b[1] <<"\n";
	}
	
	return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
const int N=0x3f3f3f3f;
int main(){
	string n;
	int sum=0;
	getline(cin,n);
	for(int i=0;i<n.length();i++){
		sum=sum+(n[i]-'0');
	}
	if(sum%9==0||sum==0)
		cout << "Yes";
	else
		cout<< "No";	
	return 0;
}

Measured memory_bytes: 3724
#include "bits/stdc++.h"
#define inf 0x3f3f3f3f
#define pb push_back
#define vi vector<int>
#define fi first
#define se second 
#define mp make_pair
typedef unsigned long long ull;
//typedef pair<int,int> P;
#define LL long long 
#define pi acos(-1)
#define MOD 998244353
typedef long long ll;
using namespace std;
const int maxn = 105; 
const char p[]="AGC";
int n,m,c;
int b[maxn],a[maxn][maxn];
int ans;
int main(){
	cin>>n>>m>>c;
	for(int i=0;i<m;i++) cin>>b[i];
	for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin>>a[i][j];
	for(int i=0;i<n;i++){
		int tot=0;
		for(int j=0;j<m;j++) tot+=a[i][j]*=b[j];
		tot+=c;
		ans += tot>0;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  bool ans=true;
  for(int i=0;i<N;i++){
    if(A[i]%2==1)continue;
    else {
      if(A[i]%3!=0&&A[i]%5!=0) ans=false;
    }
  }
  if(ans==true)cout<<"APPROVED"<<endl;
  else cout<<"DENIED"<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ft first
#define sd second
#define pb push_back
using ll = long long;
const int INF = 1e9+7;
const int EPS = -1e6;
inline void fastio() {ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);}
const int maxn = 100000+5;

int h[200];

int main(){
    //freopen("input.txt", "r", stdin);
    fastio();


    int N;
    cin >>N;
    for(int i = 0; i < N; ++i)
        cin>>h[i];

    int ans = 0, i = 0;
    while(true){
        if(*max_element(h, h+N) == 0)break;
        i = 0;
    while(i < N){

        if(h[i] == 0)++i;
        else{
            ++ans;
            while(i < N && h[i] > 0){
                --h[i];
                ++i;
            }
        }
    }}

    cout<< ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#define INF (1 << 26)
#define fr first
#define sc second
using namespace std;

typedef pair<int,int> S;
typedef pair<S,int> P;
struct edge{
    int to,cost; edge(){}
    edge(int to,int cost):to(to),cost(cost){}
};

int c,n,m,s,d,costed[1024][101];
vector< vector<edge> > info(1024);

void init(){
    for(int i=0;i<1024;i++){
        for(int j=0;j<101;j++) costed[i][j] = INF;
    }
    info.resize(0); info.resize(1024);
}

void add_info(){
    int a,b,f;
    cin >> a >> b >> f;
    info[a].push_back(edge(b,f));
    info[b].push_back(edge(a,f));
}

int Dijkstra(){
    priority_queue<P,vector<P>,greater<P> > que;
    que.push(P(S(0,s),c));  costed[s][c] = 0;
    while(!que.empty()){
        P p = que.top(); que.pop();
        int now = p.fr.sc,c = p.fr.fr,tic = p.sc;
        if(now == d) return c;
        for(int i=0;i<info[now].size();i++){
            edge e = info[now][i];
            if(e.cost + c < costed[e.to][tic]){
                que.push(P(S(e.cost+c,e.to),tic));
                costed[e.to][tic] = e.cost + c;
            }
            if(tic != 0){
                if(e.cost/2 + c < costed[e.to][tic-1]){
                    que.push(P(S(c+e.cost/2,e.to),tic-1));
                    costed[e.to][tic-1] = e.cost/2 + c;
                }
            }
        }
    }
}

int main(){
    while(cin>>c>>n>>m>>s>>d,c||n||m||s||d){
        init();
        for(int i=0;i<m;i++) add_info();
        cout << Dijkstra() << endl;
    }
}

Measured memory_bytes: 1668
implicit none
integer q,l,r
!integer,allocatable,dimension(:)::l,r
integer,allocatable,dimension(:)::prime,a,s
integer:: qmax=100000
integer i,j,k,n,m

allocate(prime(qmax),a(qmax),s(qmax))
prime(1)=0
prime(2:qmax)=1
a(:)=0
s(:)=0

do i=2,qmax
if(prime(i).eq.1)then
do j=2*i,qmax,i
prime(j)=0
enddo
endif
enddo

do k=1,qmax
if(prime(k).eq.1 .and. prime((k+1)/2).eq.1)then
a(k)=1
endif
enddo


do n=1,qmax-1
s(n+1)=s(n)+a(n)
enddo


read(5,*)q

do m=1,q
read(5,*) l,r 
write(6,*) s(r+1)-s(l)
enddo


deallocate(prime,a,s)
end

Measured memory_bytes: 2688
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>

//
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
void yes(bool cond) { cond ? puts("Yes") : puts("No"); }

//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    vector<ll> p;
    cin >> N;
    rep(i, N)
    {
        ll t;
        cin >> t;
        p.push_back(t);
    }
    const auto calcCost = [&](ll i0, ll i1)
    {
        return abs(p[i1] - p[i0]);
    };
    vector<ll> costs(N,0);
    costs[0] = 0;
    costs[1] = costs[0] + calcCost(0,1);

    for(ll i =2;i<N;++i)
    {
        ll i0 = i - 2;
        ll i1 = i - 1;
        ll i2 = i;
        costs[i2] = min(costs[i1] + calcCost(i1, i2), costs[i0] + calcCost(i0, i2));
    }
    cout << costs.back();
}

Measured memory_bytes: 4580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1<<30;

int calc(int a, int b){
  if(a>b)swap(a, b);
  if(a==0)return b;
  return calc(b%a, a);
}

int main(){
  int a, b, c;cin>>a>>b>>c;
  cout << (c%calc(a, b)==0?"YES":"NO") << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}


signed main() {
  int n, k, ans = 0;
  cin >> n >> k;
  rep(i, 0, n) {
    int a;
    cin >> a;
    ans += min(a, k - a) * 2;
  }
  cout << ans << endl;
}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int n,m;
vector<pair<int,int>> edges[maxn];
vector<int> g[maxn];
int par[maxn], siz[maxn];
int parent(int x) {
  return par[x]==x ? x: par[x]=parent(par[x]);
}
void join(int x, int y) {
  x=parent(x);
  y=parent(y);
  if (siz[x]<siz[y]) swap(x, y);
  par[y]=x;
  siz[x]+=siz[y];
}

bool used[maxn];
int id[maxn];

void add_edge(int x, int y) {
  g[x].push_back(y);
  g[y].push_back(x);
}

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

  cin>>n>>m;
  for (int i=0; i<m; i++) {
    int u,v,c; cin>>u>>v>>c;
    edges[c].push_back({u,v});
  }
  
  for (int i=1; i<=n; i++) {
    par[i]=i;
    siz[i]=1;
  }

  int hi=n;

  for (int i=0; i<maxn; i++) {
    if (edges[i].empty()) continue;
    // reset everything
    for (auto ed: edges[i]) {
      int x=ed.first; int y=ed.second;
      par[x]=x;
      par[y]=y;
      siz[x]=siz[y]=1;
    }
    for (auto ed: edges[i]) {
      int x=ed.first; int y=ed.second;
      join(x,y);
      used[x]=used[y]=false;
      id[x]=id[y]=-1;
    }
    for (auto ed: edges[i]) {
      int x=ed.first; int y=ed.second;
      if (!used[x]) {
	used[x]=true;
	int p=parent(x);
	if (id[p]==-1)  id[p]=++hi;
	add_edge(id[p], x);
      }
      if (!used[y]) {
	used[y]=true;
	int p=parent(y);
	if (id[p]==-1)  id[p]=++hi;
	add_edge(id[p], y);
      }
    }
  }

  queue<int> qq;
  vector<int> dist(hi+10, -1);
  qq.push(1);
  dist[1]=0;
  while (qq.size()) {
    int at = qq.front(); qq.pop();
    for (int to: g[at]) {
      if (dist[to] == -1) {
	dist[to] = 1+dist[at];
	qq.push(to);
      }
    }
  }

  if (dist[n] == -1) out(-1);
  cout<<dist[n]/2<<endl;

  
  // for (int i=1; i<=hi; i++) {
  //   watch(i);
  //   for (int x: g[i]) cout<<x<<" ";
  //   cout<<endl;
  // }

  return 0;
}
// don't forget to read in the input :^)


Measured memory_bytes: 71296
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=100005;

int n,m,a[N];
LL b[N];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int main()
{
	n=read();m=read();
	for (int i=1;i<=n;i++) a[i]=read();
	LL ans=0;
	for (int i=1;i<n;i++)
	{
		int l=a[i]+1,r=a[i+1],s;
		if (l<=r) b[l+1]++,b[r+1]-=r-l+1,b[r+2]+=r-l,ans+=r-l+1;
		else b[l+1]++,s=m-l+1,b[1]+=s,b[2]-=s-1,b[r+1]-=s+r,b[r+2]+=s+r-1,ans+=m-l+r+1;
	}
	for (int i=1;i<=m;i++) b[i]+=b[i-1];
	for (int i=1;i<=m;i++) b[i]+=b[i-1];
	LL mx=0;
	for (int i=1;i<=m;i++) mx=max(mx,b[i]);
	cout<<ans-mx;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    string S; cin>>S;
    int K; cin>>K;

    int64_t ans;

    bool allSame=true;
    rep(i,0,S.size()) if(S.at(i)!=S.at(0)){allSame=false;break;}
    if(allSame){ans=S.size()*K/2;}
    else{
        int64_t val1=0;
        string _S=S;
        if(K>1) _S+=S;
        rep(i,1,_S.size()){
            if(_S.at(i-1)==_S.at(i)){
                _S.replace(i,1,".");
                val1++;
                i++;
            }
        }

        ans=val1;

        if(K>2){
            int64_t val2=0;
            _S=S+S+S;
            rep(i,1,_S.size()){
                if(_S.at(i-1)==_S.at(i)){
                    _S.replace(i,1,".");
                    val2++;
                    i++;
                }
            }
            ans+=(val2-ans)*(K-2);
        }
    }
    cout<<ans<<endl;
}

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

	int main()
	{
		char A[100001];
		scanf("%s",A);
		int i;
		int n = strlen(A);
		int flag = 0;
		if( n > 2)
		{
		
		for(i=0;i<n-2;++i)
		{
			if( A[i] == A[i+1] || A[i] == A[i+2] || A[i+1] == A[i+2])
			{
				printf("%d %d",i+1,i+3);
				flag = 1;
				break;
			}
			
		}
	       }
	    else
		{
			if( A[0] == A[1])
			{
				printf("1 2");
				flag = 1;
			}
		 } 
	
		if(flag == 0)
		{
			printf("-1 -1");
		}
		return 0;
	}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int cl(int a, int b) {
	return (a - (a%b)) / b;//b=0だと積む
}
int up(int a, int b) {
	return cl(a + b - 1, b);//b=0だと積む
}
int ord(int a, int p) {
	if (a%p == 0) {
		return ord(a / p, p) + 1;
	}
	else {
		return 0;
	}
}
int main() {
	int n;
	cin >> n;
	while(n!=0)
	{
	int ans = 0;
	vector<int> go(n);
	int ch, ba,fi;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if (i == 0) {
			go[0] = 1;
			ch = 0;
			fi = x;
		}
		else if (i % 2 == 0) {
			if(x != ba){
				ch++;
			}
			go[ch]++;
		}
		else {
			if (x == ba) {
				go[ch]++;
			}
			else {
				if (ch == 0) {
					go[ch]++;
					fi = (fi + 1) % 2;
				}
				else {
					go[ch - 1] = go[ch - 1] + go[ch] + 1;
					go[ch] = 0;
					ch = ch - 1;
				}
			}
		}
		ba = x;
	}
	int wh = 1 - fi;
	for (int i = 0; i < n; i++) {
		ans = ans + wh * go[i];
		wh = 1 - wh;
	}
	cout << ans<<endl;
	cin >> n;
	}
	return 0;
}



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

int main() {
  int N;
  cin >> N;
  int i = 0;
  string color;
  while (i < N) {
    cin >> color;
    if (color == "Y") {
      cout << "Four" << endl;
      break;
    }
    i++;
  }
  if (i == N) {
    cout << "Three" << endl;
  }
}


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

using namespace std;


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

  vector<int> b;

  for (int i = n - 1; i >= 0; i -= 2) {
    b.push_back(a[i]);
  }
  
  for (int i = (n % 2 == 0)? 0 : 1; i < n; i += 2) {
    b.push_back(a[i]);
  }

  for (int i = 0; i < n; i++) {
    cout << b[i] << " \n"[i == n - 1];
  }


  return 0;
}

/*
  1
  2 1
  3 1 2
  4 2 1 3
  5 3 1 2 4
  6 4 2 1 3 5
 */


Measured memory_bytes: 3828
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

class FactInvMOD:
    """ 階乗たくさん使う時用のテーブル準備 """

    def __init__(self, MAX, MOD):
        """ MAX：階乗に使う数値の最大以上まで作る """
        
        MAX += 1
        self.MAX = MAX
        self.MOD = MOD

        # 階乗テーブル
        factorial = [1] * MAX
        factorial[0] = factorial[1] = 1
        for i in range(2, MAX):
            factorial[i] = factorial[i-1] * i % MOD
        # 階乗の逆元テーブル
        inverse = [1] * MAX
        # powに第三引数入れると冪乗のmod付計算を高速にやってくれる
        inverse[MAX-1] = pow(factorial[MAX-1], MOD-2, MOD)
        for i in range(MAX-2, 0, -1):
            # 最後から戻っていくこのループならMAX回powするより処理が速い
            inverse[i] = inverse[i+1] * (i+1) % MOD
        self.fact = factorial
        self.inv = inverse
    
    def nCr(self, n, r):
        """ 組み合わせの数 (必要な階乗と逆元のテーブルを事前に作っておく) """
        if n < r: return 0
        # 10C7 = 10C3
        r = min(r, n-r)
        # 分子の計算
        numerator = self.fact[n]
        # 分母の計算
        denominator = self.inv[r] * self.inv[n-r] % self.MOD
        return numerator * denominator % self.MOD

N,K=MAP()
R=N-K
B=K

fim=FactInvMOD(N, MOD)

for i in range(1, K+1):
    print(fim.nCr(R+1, i) * fim.nCr(B-1, i-1) % MOD)


Measured memory_bytes: 3444
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#define rep(i,l,r) for(i=l;i<r;i++)
#define repb(i,r,l) for(i=r;i>l;i--)
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
const int mod=1000000007;
using namespace std;

int main(){
    int n,k;
    cin>>n>>k;
    ll s;
    cin>>s;
    ll a[n];
    int i;
    if(s!=(ll)1e9){
        //int i;
        rep(i,0,k){
            a[i]=s;
        }
        rep(i,k,n){
            a[i]=s+1;
        }
    }
    else{
        //int i;
        rep(i,0,k){
            a[i]=s;
        }
        rep(i,k,n){
            a[i]=s-1;
        }
    }
    rep(i,0,n){
        cout<<a[i]<<" ";
    }
}



Measured memory_bytes: 2048
def calc_digit(n):
    tmp = str(n)

    return len(tmp)

n = int(input())

a = 1
ans = calc_digit(n)

while a**2 <= n:
    if n%a == 0:
        b = n//a

        cur = max(calc_digit(a),calc_digit(b))

        if ans > cur:
            ans = cur

    a += 1

print(ans)



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

#define FOR(i,a,b) for(int i = a; i < b; i++)
#define REP(i,n) FOR(i,0,n)
 
int main() {
 int H,W,N;
 cin >> H >> W >>N;

 int sum = 0;
 int cnt = 0;

 if(H < W){
   while(1){
     sum += W;
     cnt++;
     if(sum >= N){
       break;
     }
   }
 }else{
   while(1){
     sum += H;
     cnt++;
     if(sum >= N){
       break;
     }
   }
 }

 cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define mod 998244353
using namespace std;
long long fac[1010000],inv[1010000];
long long qpow(long long x,int p)
{
	long long ans=1;
	while(p)
	{
		if(p&1)ans=(ans*x)%mod;
		x=(x*x)%mod;p>>=1;
	}
	return ans;
}
long long C(int a,int b){if(a>b||a<0||b<0)return 0;return fac[b]*inv[a]%mod*inv[b-a]%mod;}
int main()
{
	fac[0]=1;for(int i=1;i<=1000000;i++)fac[i]=fac[i-1]*i%mod;
	inv[1000000]=qpow(fac[1000000],mod-2);
	for(int i=999999;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
	long long n,a,b,k;scanf("%lld%lld%lld%lld",&n,&a,&b,&k);
	if(k==0)return 0*puts("1");
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		if((k-i*a)%b)continue;
		int j=(k-i*a)/b;
		ans=(ans+C(i,n)*C(j,n)%mod)%mod;
	}
	printf("%lld",ans);return 0; 
}

Measured memory_bytes: 16000
#include<bits/stdc++.h>
#define ll long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;

signed main(){
	ios_base::sync_with_stdio(0);
	int r,g,b;
	cin>>r>>g>>b;
	int x=r*100+g*10+b;
	cout<<(x%4?"NO":"YES");
	re 0;
}

Measured memory_bytes: 3640
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);

    int N = in.nextInt();
    long K = in.nextLong();

    int d[][] = new int[65][N];
    for (int i = 0; i < N; i++) {
      d[0][i] = in.nextInt() - 1;
    }

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

    int now = 0;
    for (int i = 63; i >= 0; i--) {
      if (((K >> i) & 1) == 1) {
        now = d[i][now];
      }
    }

    System.out.println(now + 1);
  }
}

Measured memory_bytes: 124984
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct patient{
  int p, d, dd;
  bool operator<(const patient &p)const{
    return d + dd < p.d + p.dd;
  }
  bool operator>(const patient &p)const{
    return d + dd > p.d + p.dd;
  }
};


int main(int argc, char *argv[]){
  int n;
  while(std::cin >> n, n){
    vector<patient> vp;
    for (int i = 0; i < n; i++) {
      patient p;
      std::cin >> p.p >> p.d >> p.dd;
      vp.push_back(p);
    }
    sort(vp.begin(), vp.end(), greater<patient>());
    std::cout << vp[0].p << " " << vp[0].d + vp[0].dd << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1444
from fractions import gcd
a, b = map(int, input().split())
n = gcd(a, b)

divisors = []
for i in range(1, int(n**0.5)+1):
    if n%i == 0:
        divisors.append(i)
        if i!=n // i:
            divisors.append(n//i)

divisors.sort()
cnt = 0
num = 1
for i in range(len(divisors)):
    if num == 1:
        cnt += 1
        num *= divisors[i]
    elif gcd(num, divisors[i]) == 1:
        cnt += 1
        num *= divisors[i]

print(cnt)

Measured memory_bytes: 5304
#include <stdio.h>

void round_decimal(double x, int ndec, char *x_str);

int main(){
   double a, b, c, d, e, f, x, y, det;
   char x_str[10], y_str[10];
   while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)==6){
      det=a*e-b*d;
      x=(c*e-b*f)/det;
      y=(a*f-c*d)/det;
      round_decimal(x,3,x_str);
      round_decimal(y,3,y_str);
      printf("%s %s\n",x_str,y_str);
   }
   return 0;
}

void round_decimal(double x, int ndec, char *x_str){
   int i, ix, factor, integ, decim;
   char format[10];
   for(factor=1,i=0;i<ndec;i++) factor*=10;
   ix=(int)(x*factor);
   if(x<0){
      sprintf(format,"-%%d.%%0%dd",ndec);
      ix=-ix;
   } else {
      sprintf(format,"%%d.%%0%dd",ndec);
   }
   integ=ix/factor;
   decim=ix%factor;
   sprintf(x_str,format,integ,decim);
}

Measured memory_bytes: 652
#include<stdio.h>

int main(void)
{
int a,b,c,x;

scanf("%d %d %d",&a,&b,&c);
   if(a>b)
{
x=a;
a=b;
b=x;
}
if(b>c)
{
x=b;
b=c;
c=x;
}
if(a>b)
{
x=a;
a=b;
b=x;
}
printf("%d %d %d\n",a,b,c);
return 0;
}

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

int main() {
    int k, cnt, a;
    scanf("%d", &k);
    if (k % 2 == 0 || k % 10 == 5) {
        puts("-1");
        return 0;
    }
    a = 7, cnt = 1;
    while (1) {
        if (a % k == 0) {
            break;
        }
        a %= k;
        a = a * 10 + 7;
        ++cnt;
    }
    cout << cnt << endl;
    return 0;
}

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

int main(void){
    int d, t, s;
    cin >> d >> t >> s;

    if (d <= t*s) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define eps 1e-67
#define pf printf
#define sf scanf
#define sd(n) scanf("%d",&n)
#define sd2(n1,n2) scanf("%d %d",&n1,&n2)
#define slf(n) scanf("%lf",&n)
#define slf2(n1,n2) scanf("%lf %lf",&n1,&n2)
#define sLf(n1) scanf("%Lf",&n1)
#define sLf2(n1,n2) scanf("%Lf %Lf",&n1,&n2)
#define sl(n) scanf("%lld",&n)
#define sl2(n1,n2) scanf("%lld %lld",&n1,&n2)
#define rep(i,a,b) for( i=a;i<b;i++)
#define repb(i,a,b) for( i=a;i>=b;i--)
#define repa(i,a,b,c) for( i=a;i<b;i=i+c)
#define reps(i,a,b,c) for(i=a;i>b;i=i-c)
#define asort(a) sort(a.begin(),a.end())
#define asortb(a,comp) sort(a.begin(),a.end(),comp)
#define arev(a) reverse(a.begin(),a.end())
#define all(v) (v).begin(),(v).end()
#define allc(v,comp) (v).begin(),(v).end(),comp
#define allrc(v,a,b,comp) (v).begin()+a,(v).end()-b,comp
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define pbb pop_back
#define mp make_pair
#define mt make_tuple
#define sq(a) ((a)*(a))
#define cube(a) ((a)*(a)*(a))
#define mx 1000
#define MX 100000
#define mod 1000000007
using namespace std;
typedef string str;
typedef long long int ll;
typedef double lf;
typedef long double llf;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef char ch;
typedef map<ll,ll> mp;

void Solve()
{
    ll n,m,x;
    ll ans=mod;
    cin>>n>>m>>x;
    ll cc[n+1];
    ll i,j,k,l,d,dd;
    ll a[n+1][m+1];
    

    rep(i,0,n)
    {
        cin>>cc[i];
       rep(j,0,m)
       {
           cin>>a[i][j];
       }
    }
    rep(i,0,(1<<n))
    {
        ll cost=0;
        vll sum(m);
        rep(j,0,n)

         {




                if(i & (1<<j))
                    {
                 cost=cost+cc[j];
                 rep(k,0,m){
                sum[k]+=a[j][k];
                 }
            }


         }
        bool pos=true;
        rep(l,0,m)
        {
            if(sum[l]<x)
            {
                pos=false;
            }
        }

        if(pos) ans=min(ans,cost);

    }

    if(ans==mod)
    {
        cout<<"-1"<<"\n";
    }
    else
    {
        cout<<ans<<"\n";
    }


}

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

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
int main(){
int x,a,b,c;
  cin>>x>>a>>b;
  int dif_a=abs(x-a);
  int dif_b=abs(x-b);
 if(dif_a>dif_b){
 cout<<"B"<<endl;
 }
  else{
  cout<<"A"<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int hight[10], i, j, tmp;
    
    for(i = 0; i < 10; i++) 
        cin >> hight[i];
    
    for(i = 0; i < 10; i++){
        for(j = i + 1; j < 10; j++){
            if(hight[i] >= hight[j]){
                tmp = hight[i];
                hight[i] = hight[j];
                hight[j] = tmp;
            }
        }
    }
    
    for(i = 9; i > 6; i--){
        cout << hight[i] << endl;
    }
}



Measured memory_bytes: 3072
#include <iostream>

using namespace std;

const int M = 1046527;
const int L = 14;

string H[M];

int getChar(char ch) {
    if (ch == 'A') {
        return 1;
    }
    else if (ch == 'C') {
        return 2;
    }
    else if (ch == 'G') {
        return 3;
    }
    else if (ch == 'T') {
        return 4;
    }
    return 0;
}

long long getKey(string str) {
    long long sum = 0, p = 1, i;
    for (int i = 0; i < str.size(); i++) {
        sum += p * (getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key) {
    return key % M;
}

int h2(int key) {
    return 1 + (key % (M - 1));
}

int find(string str) {
    long long key, i, h;
    key = getKey(str);
    for (int i = 0;; i++) {
        h = (h1(key) + i * h2(key)) % M;
        if (str == H[h]) {
            return 1;
        }
        else if (H[h].size() == 0) {
            return 0;   
        }
    }
    return 0;
}

int insert(string str) {
    long long key, i, h;
    key = getKey(str);
    for (i = 0;; i++) {
        h = (h1(key) + i * h2(key)) % M;
        if (str == H[h]) {
            return 1;
        }
        else if (H[h].size() == 0) {
            H[h] = str;
            return 0;
        }
    }
    return 0;
}

int main() {
    int i, n, h;
    string str, com;
    for (int i = 0; i < M; i++) {
        H[i][0] = '\0';
    }

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> com >> str;
        if (com[0] == 'i') {
            insert(str);
        }
        else {
            if (find(str)) {
                cout << "yes" << endl;
            }
            else {
                cout << "no" << endl;
            }
        }
    }
}

Measured memory_bytes: 27740