akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

template <class T>
void cout_vec2(const vector<vector<T>> &vec){
  rep(i,vec.size()){
    rep(j,vec[i].size()){
      cout<<vec[i][j]<<' ';
    }
    cout<<endl;
  }
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  if(a<=9 && b<=9) cout<<a*b<<endl;
  else cout<<-1<<endl;
}

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

const int H = 3;
const int W = 3;
const int C_MAX = 100;

int main() {
	vector<vector<int>> c(H, vector<int>(W));
	for(int h = 0; h < H; h++)
		for(int w = 0; w < W; w++)  cin >> c[h][w];
	bool result = false;
	for(int i = 0; i <= c[0][0]; i++) {
		vector<int> a(H);
		vector<int> b(W);
		a[0] = i;
		b[0] = c[0][0] - a[0];
		for(int h = 1; h < H; h++) a[h] = c[h][0] - b[0];
		for(int w = 1; w < W; w++) b[w] = c[0][w] - a[0];
		bool ok = true;
		for(int h = 1; h < H; h++) {
			for(int w = 1; w < W; w++) {
				if(c[h][w] != a[h] + b[w]) {
					ok = false;
					break;
				}
			}
			if(!ok) {
				break;
			}
		}
		if(ok) {
			result = true;
			break;
		}
	}
	cout << (result ? "Yes" : "No") << endl;
	return 0;
}

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

int main()
{
  int N, X;
  int L[100];

  cin >> N >> X;
  for (int i = 0; i < N; i++)
  {
    cin >> L[i];
  }

  int D = 0, count = 1;

  while (D <= X && N > 0)
  {
    D = D + L[count-1];
    if(D <= X)
      count++;
    N--;
  }

  cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<string> vstring;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)
#define Inf 2147483647
#define llInf 9223372036854775807

int main() {
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	string ans = "";
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (j <= a && i <= b) {
				ans += "0";
			}
			else if (j > a&& i > b) {
				ans += "0";
			}
			else {
				ans += "1";
			}
		}
		ans += "\n";
	}
	cout << ans << endl;
	return 0;
}



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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

LL mod = 1e9 + 7;

LL fact(LL n)
{
    if(n < 2)
        return 1;

    LL ans = 1;
    for(int i = 2; i <= n; i++)
        ans = (i * ans) % mod;
    return ans;
}

int main()
{
    LL n, m;
    cin >> n >> m;

    if(abs(n - m) > 1)
        return cout << 0 << '\n', 0;

    n = fact(n), m = fact(m);
    LL ans = (n * m) % mod;
    if(n == m)
        ans = (ans * 2) % mod;

    cout << ans << '\n';
    return 0;
}


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

int main()
{
	int n;
	cin >> n;
	map<string, bool> gacha;
	for (int i = 0; i < n; ++i)
	{
		string in;
		cin >> in;
		gacha[in] = 1;
	}
	cout << gacha.size() << endl;
	return 0;
}

Measured memory_bytes: 19232
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const int INF = 2000000000;

    string S;
    ll N,ans,A;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>S;
    N=stoi(S);
    for(auto x:S){
        A+=int(x-'0');
    }
    cout<<(N%A==0?"Yes":"No");
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by Santa on 2016/10/16.
 */
public class Main {

    static int N;
    static long A;
    static long B;
    static long C;
    static int[] map;



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

        N = scanner.nextInt();

        int[] s = {11, 31, 41, 61, 71, 101, 131, 151, 181, 191, 211, 241, 251, 271, 281, 311, 331, 401, 421, 431, 461, 491, 521, 541, 571, 601, 631, 641, 661, 691, 701, 751, 761, 811, 821, 881, 911, 941, 971, 991, 1021, 1031, 1051, 1061, 1091, 1151, 1171, 1181, 1201, 1231, 1291, 1301, 1321, 1361, 1381, 1451, 1471, 1481, 1511, 1531, 1571, 1601, 1621, 1721, 1741, 1801, 1811, 1831, 1861, 1871, 1901, 1931, 1951, 2011, 2081, 2111, 2131, 2141, 2161, 2221, 2251, 2281, 2311, 2341, 2351, 2371, 2381, 2411, 2441, 2521, 2531, 2551, 2591, 2621, 2671, 2711, 2731, 2741, 2791, 2801, 2851, 2861, 2971, 3001, 3011, 3041, 3061, 3121, 3181, 3191, 3221, 3251, 3271, 3301, 3331, 3361, 3371, 3391, 3461, 3491, 3511, 3541, 3571, 3581, 3631, 3671, 3691, 3701, 3761, 3821, 3851, 3881, 3911, 3931, 4001, 4021, 4051, 4091, 4111, 4201, 4211, 4231, 4241, 4261, 4271, 4391, 4421, 4441, 4451, 4481, 4561, 4591, 4621, 4651, 4691, 4721, 4751, 4801, 4831, 4861, 4871, 4931, 4951, 5011, 5021, 5051, 5081, 5101, 5171, 5231, 5261, 5281, 5351, 5381, 5431, 5441, 5471, 5501, 5521, 5531, 2};

        String ans = "11";

        for (int i = 1; i < N; i++) {
            ans = ans + " " + s[i];
        }

        System.out.println(ans);






    }

}



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

#print(S)

if len(S)%2==1:
    ans=int(len(S)/2)+1
    for i in range(1,int(len(S)//2)+1):
        if S[int(len(S)/2)+i]==S[int(len(S)/2)] and S[int(len(S)/2)-i]==S[int(len(S)/2)]:
            ans+=1
        else:
            break
    print(ans)
else:
    ans=len(S)//2
    if S[int(len(S)//2)]==S[int(len(S)//2)-1]:
        ans+=1
        for i in range(1,int(len(S)//2)):
            if S[int(len(S)//2)+i]==S[int(len(S)//2)] and S[int(len(S)//2)-1-i]==S[int(len(S)//2)]:
                ans+=1
            else:
                break
    print(ans)

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

int main(){
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);    
  }
  long long int ans =0;
  long long int mx=a.at(0);
  for(int j=1;j<n;j++){
    if(a.at(j)<mx){
      ans+=mx-a.at(j);
    }else{
      mx=a.at(j);
    }
  }
  cout << ans << endl; 
}

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


int main() {

    int n, l, t;
    cin >> n >> l;
    int sum = 0;
    int num = 100000;
    for (int i = 1; i <= n; i++) {
        sum += l+i-1;
        if (abs(l+i-1) < num) {
            num = abs(l+i-1);
            t = i;
        }
    }
    cout << sum - (l+t-1) << endl;
    return 0;
}

Measured memory_bytes: 256
n, m = [int(x) for x in input().split()]
ac = [0] * (n + 1)
wa = [0] * (n + 1)

for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        ac[p] = 1
    if s == "WA" and ac[p] == 0:
        wa[p] += 1

print(sum(ac), sum([p for a, p  in zip(ac, wa) if a == 1]))



Measured memory_bytes: 5528
/*zxj*/
#include<iostream> 
#include<string>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<sstream>
#define sf scanf
#define pf printf
#define pfn printf("\n");
#define pfk printf(" ");
#define pf0 printf("0");
#define pf1 printf("1");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfdd(n,m) scanf("%d%d",&n,&m);
#define sfld(n) scanf("%lld",&n);
#define sfldd(n,m) scanf("%lld%lld",&n,&m);
#define sflf(n) scanf("%lf",&n);
#define sflff(n,m) scanf("%lf%lf",&n,&m);
#define sfc(n) scanf("%c",n);
#define sfcc(n,m) scanf("%c%c",n,m);
#define sfs(n) scanf("%s",n);
#define sfss(n,m) scanf("%s%s",n,m);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);
using namespace std;
#define csh(a,n) memset(a,n,sizeof(a));
ll arr[1000000];
int main(){
	ll sum=0;
	ll n;
	cin>>n;
	for(ll i=0;i<n+1;i++){
		cin>>arr[i];
	}
	for(ll i=0;i<n;i++){
		ll a;
		cin>>a;
		if(a>arr[i]){
			a-=arr[i];
			sum+=arr[i];
			if(a>arr[i+1]){
				sum+=arr[i+1]; 
				arr[i+1]=0;
			}
			else{
				arr[i+1]-=a;
				sum+=a;
			}
		}
		else{
			sum+=a;
		}
	}
	cout<<sum<<endl;
}

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

int main(){
  string str;
  cin >> str;
  int q;
  cin >> q;
  for(int i=0; i<q; i++){
      string ord;
      int a, b;
      cin >> ord;
      cin >> a >> b;
      if(ord == "print") cout << str.substr(a,b-a+1) << endl;
      else if(ord == "reverse"){
          string revs;
          revs=str.substr(a,b-a+1);
          reverse(revs.begin(), revs.end());
          str.replace(a, b-a+1, revs);
      }
      else{
          string reps;
          cin >> reps;
          str.replace(a, b-a+1, reps);
      }
  }
  return 0;
}


Measured memory_bytes: 3216
def m_of_f(l,m,m_min,fm):
    global k
    global n
    global n_min

    print(l)

    s=input()

    if l%2==0:
        if s==fm:
            n_min=l
            l=int(0.5*(m+l))
            k=l
            
        else :
            n=l
            l=int(0.5*(l+m_min))
            k=l
            
    else:
        if s!=fm:
            n_min=l
            l=int(0.5*(m+l))
            k=l
        else :
            n=l
            l=int(0.5*(l+m_min))
            k=l
n=int(input())
nn=n
n_min=0



print(0)
sss=input()
k=int(0.5*n)

for i in range(19):
    m_of_f(k,n,n_min,sss)


Measured memory_bytes: 3660
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long data1[] = new long[N];
    long total = 0;

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

    for (int i = 0 ; i < N ; i++ ) {
      if (data1[i]%3 != 0 && data1[i]%5 != 0) {
        total = total + data1[i];
      }
    }

    System.out.println(total);


  }
}


Measured memory_bytes: 43472
N = int(input())

ans = 0
a = [3, 5, 7]
i = 0
while a[i] <= N:
    x10 = a[i] * 10
    a.append(x10+3)
    a.append(x10+5)
    a.append(x10+7)
    i += 1

for j in range(i):
    s = str(a[j])
    if "3" in s and "5" in s and "7" in s:
        ans += 1

print(ans)

Measured memory_bytes: 7076
#include <bits/stdc++.h>
#define ll long long

using namespace std;
ll N, a[200000];
int main(){
  ios_base::sync_with_stdio(false);
  cin >> N;
  for(ll i = 0; i < N; i++){
    cin >> a[i];
  }
  unordered_map<ll, ll> mp1, mp2;
  stack<ll> st;
  st.push(a[0]);
  for(ll i = 1; i < N; i++){
    if(st.empty()){
      st.push(a[i]);
    }else{
      if(st.top() < a[i]){
	st.push(a[i]);
      }else{
	while(!st.empty() && st.top() > a[i]){
	  mp1[st.top()] = i - 1;
	  st.pop();
	}
	st.push(a[i]);
      }
    }
  }
  
  while(!st.empty()){
    mp1[st.top()] = N - 1;
    st.pop();
  }

  st.push(a[N-1]);
  for(ll i = N -2; i >= 0; i--){
    if(st.empty()){
      st.push(a[i]);
    }else{
      if(st.top() < a[i]){
	st.push(a[i]);
      }else{
	while(!st.empty() && st.top() > a[i]){
	  mp2[st.top()] = i + 1;
	  st.pop();
	}
	st.push(a[i]);
      }
    }
  }

  while(!st.empty()){
    mp2[st.top()] = 0;
    st.pop();
  }
  ll ans = 0;
  for(ll i = 0; i < N; i++){
    ans += a[i] * (mp1[a[i]] - i + 1) * (i - mp2[a[i]] + 1);
  }
  cout << ans << endl;

}


Measured memory_bytes: 18376
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
int int_max = 2147483647;
int max_n = 1e5;
using mat2d_t = std::vector<std::vector<int64_t>>;

int calc_power(const std::vector<int>& vec, int pos) {
    int res{0};
    for (int v: vec) {
        res += (v-pos) * (v-pos);
    }
    return res;
}

int main(int argc, char **argv) {
    int n;
    cin >> n;
    std::vector<int> vec(n);

    for (int i=0; i<n; ++i) {
        cin >>vec[i];
    }
    std::sort(vec.begin(), vec.end());

    int min_pow = int_max;
    int min_pos;
    for (int x=0; x <101; ++x) {
        int power = calc_power(vec, x);
        if (power < min_pow) {
            min_pow = power;
            min_pos = x;
        }
    }
    cout << min_pow << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int,int>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<string.h>
#include<ctype.h>
#include<queue>
#include<set>
#include<stack>
#include<cmath>
const int N=1e6+10;
const int maxn=0x3f3f3f3f;
const int minn=0xc0c0c0c0;
const int inf=99999999;
using namespace std;
int n;
int check(int n)
{
	int m=n%10,k=n/10;
	while(k)
	{
		if(m!=k%10)
			return 1;
		k/=10;
	}
	return 0;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n;
	while(check(n))
		n++;
	cout<<n<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<math.h>
#include<vector> 
#include<cstdio> 
#include<set>
#include<string.h>
#include<stdio.h>
#include<queue>
#include<cstring> 
using namespace std;
int main()
{int a,b,c,x;
 cin>>a>>b>>c>>x;
 int ax=max(a,max(b,c));
 if(ax==a){
 for(int i=1;i<=x;i++){
 ax*=2;
 }
 cout<<ax+b+c<<endl;
 }
 else if(ax==b){
 for(int j=1;j<=x;j++){
 ax*=2;
 }
 cout<<a+ax+c<<endl;
 }
 else if(ax==c){
 for(int k=1;k<=x;k++){
 ax*=2;
 }
 cout<<a+b+ax<<endl;
 } 
 system("pause");
 return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int mod = 1e9+7;

int dp[1001][1001]={};

int main()
{
    string t,b;
    cin >>t >>b;

    int T = t.size(), B = b.size();

    dp[0][0] = 1;
    rep(i,B)
    {
        int s = dp[i][0];
        rep(j,T)
        {
            if(b[i]==t[j]) dp[i+1][j+1] = s;
            (s += dp[i][j+1]) %= mod;;
        }
    }

    int ans = 0;
    rep(i,T+1) (ans += dp[B][i]) %= mod;
    cout << ans << endl;
    return 0;
}

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

int a, b;
int main(){
  
	cin >> a >> b;
  	
  	int S = 0;
  
  	for( int i = 0 ; i < b-a ; i++ ){
    
      S += i;
    
    }	
  	
  	cout << S - a << endl;
  
}

Measured memory_bytes: 256
#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)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int main() {
	int x, t;
	cin >> x >> t;
	cout << max(x - t, 0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	int tot = 0;
	cin >> s;
	for(int i = 0;i<s.size()/2; i++)
	{
		if(s[i]!=s[s.size()-1-i])
		{
			tot++;
		}
	}
	cout << tot;
	
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  bool b = false;
  for(int i = 1;i < 10;i++) {
    for(int j = 1;j < 10;j++) {
      if(i*j==N) {
        b = true;
        break;
      }
    }
  }
  if (b == false){
    cout << "No" << endl;
  }
  else if (b == true){
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
# code like professional "write main function"
def main():
	# we can always make a tree from the given set of nodes what we like
	# any possible tree
	n , m = map(int , input().split())
	deg = [0 for i in range(n+2)]
	for i in range(m):
		x , y = map(int , input().split())
		deg[x]+=1
		deg[y]+=1
	f=0
	# traversing a node would add 1 to one of its outgoing edges
	# if the out going edges need to have 0 parity than it should occur even no ot times
	for i in range(1, n+1):
		if deg[i]%2==1:
			f = 1
	if f:
		print("NO")
	else:
		print("YES")
if __name__=="__main__":
	main()

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

void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if(x % 3 == 0){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if(x % 10 == 3){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if( x )goto INCLUDE3;
 END_CHECK_NUM:
  if(++i <= n)goto CHECK_NUM;
  cout << endl;
}

int main(void){
  int n;
  cin >> n;
  call(n);
  return 0;
}

Measured memory_bytes: 1164
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
typedef long long ll;
const long long llnrm=LLONG_MAX;
const int nrm=INT_MAX;
const int nrn=INT_MIN;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
int n,k,tmp,ans;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n>>k;
    for(int i=0,j=1;j<nrm,i<n;i++)
    {
        if(j+k<j*2) j+=k; else j*=2;
        ans=j;
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

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

  int ans = 0;
  if(s[0] == t[0]) { ans++; }
  if(s[1] == t[1]) { ans++; }
  if(s[2] == t[2]) { ans++; }

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

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef int in;
#define int long long
#define pb push_back
#define f first
#define s second
#define double long double
const int MAX=2e5+10;
const int MAX2=2e5+4;
const int MAAX=2e18;
const int MOD=1e9+7;
int n,w;
int dp[104][MAX];
int we[105],v[105];
int fun(int idx,int lw)
{
    if(lw<0) return INT_MIN;
    if(idx==n)
    {
        return 0;
    }
    int &ret=dp[idx][lw];
    if(ret!=-1)
    {
        return ret;
    }

    return ret=max(fun(idx+1,lw),v[idx]+fun(idx+1,lw-we[idx]));
}
in main()
{
    memset(dp,-1,sizeof dp);
cin>>n>>w;
for(int i=0;i<n;i++)
{
    cin>>we[i]>>v[i];
}
cout<<fun(0,w)<<endl;
    return 0;
}


Measured memory_bytes: 162816
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

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

    int N, M; cin >> N >> M;
    vector<int> A(N);
    rep(i, 0, N) cin >> A[i];
    sort(A.begin(), A.end());

    vector<pair<int, int>> op(M);
    rep(i, 0, M) cin >> op[i].second >> op[i].first;
    sort(op.begin(), op.end());
    reverse(op.begin(), op.end());

    int i_card = 0;
    rep(i_op, 0, M) {
        if (A[i_card] < op[i_op].first) {
            rep(j_op, 0, op[i_op].second) {
                A[i_card] = op[i_op].first;
                ++i_card;
                if (A[i_card] >= op[i_op].first or i_card >= N) break;
            }
        }
    }

    ll res = 0;
    rep(i, 0, N) res += A[i];
    cout << res << endl;
}

Measured memory_bytes: 1408
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <cstdlib>
#include <vector>
#include <string>
#include <bitset>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
 
typedef long long ll;
typedef long double ld;
 
const ll MOD = 1e9 + 7, INF = 1e18 + 1;
 
using namespace std;

int n, m;

vector <int> g[1000000];

int f (int a, int b)
{
	return a * (a - 1) + b * (b - 1);
}

int cl[1000000], u[1000000], d[700][700], cnt[1000][2];
 
bool dfs (int x, int c, int bw)
{
	u[x] = 1;
	cl[x] = bw;
	cnt[c][bw]++;

	for (int to : g[x])
	{
		if (u[to] && cl[x] == cl[to]) return false;
		if (!u[to] && !dfs (to, c, !bw)) return false;
	}

	return true;
}

int main ()
{
	cin >> n >> m;

	for (int i = 0; i < m; i++)
	{
		int u, v;

		scanf ("%d%d", &u, &v);

		d[u-1][v-1] = 1;
		d[v-1][u-1] = 1;
	}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (!d[i][j])
			{
				g[i].push_back (j);
				g[j].push_back (i);
			}

	int color = 0;

	for (int i = 0; i < n; i++)
		if (!u[i] && !dfs (i, ++color, 0))
		{
			cout << -1;
			return 0;
		}

	vector <int> v;

	int sum = 0;

	for (int i = 1; i <= color; i++)
	{
		sum += min (cnt[i][0], cnt[i][1]);
		v.push_back (abs (cnt[i][0] - cnt[i][1]));
	}

	vector <int> d (n + 1);

	d[0] = 1;

	for (int a : v)
	{
		for (int i = n; i >= 0; i--)
			if (d[i]) d[i + a] = 1;
	}

	int ans = 1e9;

	for (int i = 0; i <= n; i++)
	{
		if (d[i])
			ans = min (ans, f (i + sum, n - i - sum));
	}

	cout << ans / 2;
}

Measured memory_bytes: 30208
#include <iostream>

using namespace std;

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

    int ans=0;
    for(int i=str.size()-2; i>=0; i--) {
        if(i%2==0) {
            bool flag=true;
            for(int j=0; j<i/2; j++) {
                if(str[j]!=str[j+i/2]) {
                    flag=false;
                    break;
                }
            }
            if(flag) {
                ans = i;
                break;
            }
        }
    }
    
    cout << ans << endl;


    return 0;
    
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;

class Main {
	public static Scanner sc = new Scanner(in);
	public static Random rand=new Random();

	public void run() {
		long n=sc.nextLong();
		int t=1;
		for(long k=3;k<n;k*=3,t++);

		ln(t);
	}
	public static void main(String[] args) {
		new Main().run();
	}

	public int[] nextIntArray(int n){
		int[] res=new int[n];
		for(int i=0;i<n;i++){
			res[i]=sc.nextInt();
		}
		return res;
	}
	public static void pr(Object o) {
		out.print(o);
	}
	public static void ln(Object o) {
		out.println(o);
	}
	public static void ln() {
		out.println();
	}
}

Measured memory_bytes: 17368
class dictionary:

    def __init__(self):
        self._d = set()

    def insert(self, s):
        self._d.add(s)

    def find(self, s):
        if s in self._d:
            print("yes")
        else:
            print("no")


if __name__ == '__main__':

    dd = dictionary()

    n = int(input())
    for _ in range(n):
        args = input().split()
        if args[0] == "insert":
            dd.insert(args[1])
        elif args[0] == "find":
            dd.find(args[1])


Measured memory_bytes: 30996
#include <stdio.h>
#include <math.h>
int main(){
    int a, b, C;
    double pi=3.14159265359;
    scanf("%d %d %d", &a, &b, &C);
    double h=b*sin(C*pi/180);
    double s=h*a/2;
    double L=a+b+sqrt(a*a+b*b-2*a*b*cos(C*pi/180));
    printf("%.6lf %.6lf %.6lf\n", s, L, h);
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  char c;
  set<char> s;
  for(int i=0;i<n;i++){
    cin>>c;
    s.insert(c);
  }
  cout<<(s.size()==3?"Three":"Four");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = pow(10, 9) + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divCeil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << A << endl; exit(0);}

int main()
{
  ll N, M;
  cin >> N >> M;

  vector<pair<ll, ll>> ba(M);
  for (ll i = 0; i < M; i++)
  {
    ll a, b;
    cin >> a >> b;
    ba.at(i) = make_pair(b, a);
  }

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

  ll ans = 0;
  ll x = 0;
  for (ll i = 0; i < M; i++)
  {
    ll a = ba.at(i).second, b = ba.at(i).first;
    if (a > x)
    {
      x = b - 1;
      ans++;
    }
  }

  cout << ans << endl;
}

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

int main()
{
	char x, y, z;
	int res=0;
	cin>>x>>y>>z;
	if (x==y && y==z)
	{
		if (x=='R')	res=3;
	}
	else if (x==y && x=='R')	res=2;
	else if (y==z && z=='R')	res=2;
	else res=1;
	cout<<res;
	return 0;
}

Measured memory_bytes: 3600
import io.{StdIn => in}

object Main extends App {
  val x = in.readLong
  val ans = if(x % 11 == 0) (x / 11) * 2
            else if(x % 11 < 7) (x / 11 ) * 2 + 1
            else (x / 11 ) * 2 + 2
  println(ans)
}

Measured memory_bytes: 25416
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    double n, d; cin >> n >> d;
    double cnt = 0;
    while(n--)
    {
        double x, y; cin >> x >> y;
        double xi = x*x;
        double yi = y*y;
        double ans = sqrt(xi+yi);
        if(ans<=d) cnt++;
    }
    cout << cnt << endl;
 
    return 0;
}
 

Measured memory_bytes: 3788
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>

typedef unsigned long long int uint64;
typedef long long int          int64;
 
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void get_N (int64 *n)
{
  int cnt;
  
  cnt = scanf("%lld", n);

  return;
}

void get_NK (int64 *n, int64 *k)
{
  int cnt;
  
  cnt = scanf("%lld %lld", n, k);

  return;
}

void get_N1234 (int64 *n1, int64 *n2, int64 *n3, int64 *n4)
{
  int cnt;

  if (n2 == NULL) {
    cnt = scanf("%lld", n1);
    return;
  }
  if (n3 == NULL) {
    cnt = scanf("%lld %lld", n1, n2);
    return;
  }
  if (n4 == NULL) {
    cnt = scanf("%lld %lld %lld", n1, n2, n3);
    return;
  }
  cnt = scanf("%lld %lld %lld %lld", n1, n2, n3, n4);
  return;
}

void omit_LF (void)
{
  char c;
  int  cnt;
  
  cnt = scanf("%c", &c);
  return;
}

char *get_S (int64 n)
{
  char *buf;
  int  i;
  int  cnt;

  buf = (char *)malloc((size_t)(n * sizeof(char)));
  if (buf == NULL) {
    return NULL;
  }

  cnt = scanf("%s", buf);

  return buf;
}

char *get_SN (int64 max, int64 *size)
{
  char *buf;
  int  i;
  int  n;
  int  cnt;

  buf = (char *)malloc((size_t)(max * sizeof(char)));
  if (buf == NULL) {
    return NULL;
  }

  cnt = scanf("%s", buf);

  n = strlen(buf);

  *size = n;
  
  return buf;
}

int64 *get_NSeq (int64 n)
{
  int64 *buf;
  int64 i;

  buf = (int64 *)malloc((size_t)(n * sizeof(int64)));
  for (i=0; i<n; i++) {
    get_N(&buf[i]);
  }

  return buf;
}

typedef struct _tmp_t {
  int64    a;
  int64    b;
} tmp_t;

typedef int64 simple_t;

int compare_simple(const void *a, const void *b)
{
  simple_t *x;
  simple_t *y;

  x = (simple_t *)a;
  y = (simple_t *)b;

  if (x > y) return 1;
  if (y < x) return -1;

  return 0;
}
void qsort_simple (simple_t *array, int size)
{
  qsort(array, size, sizeof(simple_t), compare_simple);
}

int compare_a(const void *a, const void *b)
{
  tmp_t *x;
  tmp_t *y;

  x = (tmp_t *)a;
  y = (tmp_t *)b;

  if (x->a > y->a) return 1;
  if (x->a < y->a) return -1;

  return 0;
}

int compare_b(const void *a, const void *b)
{
  tmp_t *x;
  tmp_t *y;

  x = (tmp_t *)a;
  y = (tmp_t *)b;

  if (x->b > y->b) return 1;
  if (x->b < y->b) return -1;

  return 0;
}

void qsort_a (tmp_t *array, int size)
{
  qsort(array, size, sizeof(tmp_t), compare_a);
}

void qsort_b (tmp_t *array, int size)
{
  qsort(array, size, sizeof(tmp_t), compare_b);
}


int resolve1()
{
  int64 R;
  double pi=3.14159;
  double L;

  get_N(&R);

  L = pi*R*2;

  printf("%lf", L);
  return 0;
}

int resolve2()
{
  int64 M;
  int64 *A;
  int64 i;
  
  M=5;
  A = get_NSeq(M);

  for (i=0; i < M; i++) {
    if (A[i] == 0) {
      printf("%d",(i+1));
      return 0;
    }
  }

  return 0;
}


int main()
{

  resolve2();
  
  return 0;
}



Measured memory_bytes: 1732
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){
    int n;
    cin >> n;
    while(n>0)n-=1000;
    P(-n);
    
    return  0;
}


Measured memory_bytes: 3616
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 998244353
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------
/*freopen("data.in"  ,"r",stdin);
    freopen("main.out","w",stdout);*/
//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    ll n;cin>>n;
    V<ll>a(n);
    for(ll i=0;i<n;i++)cin>>a[i];
    ll cnt=0;
    for(ll i=0;i<n;i++){
        if(a[i]%2!=0)cnt++;
    }
    if(cnt%2!=0){
        cout<<"NO"<<endl;
    }
    else cout<<"YES"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------


































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



int main(){	
	string s;
	cin >> s;
	ll n = s.length();
	if (s[0] == '0' || s[n-2] == '0' || s[n-1] == '1') {
		cout << "-1" << endl;
		return 0;
	}
	for (ll i = 0; i < n-2; i++) {
		if (s[i] != s[n-2-i]) {
			cout << "-1" << endl;
			return 0;
		}
	}

	ll now = 1;

	for (ll i = 0; i < n-1; i++) {
		if (s[i] == '1') {
			cout << now << " " << i+2 << endl;
			now = i+2;
		} else {
			cout << now << " " << i+2 << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using ll = long long; 
using vpii = vector<pair<int, int>>;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep1(i, n) for (int i = 1; i < (int)n; i++)
ll mod = 1e9+7;
ll inf = 1e10;

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

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  ll ans = 0;
  char tmp = 'X';
  rep(i, s.size()){
    char x = s[i];
    if(x == tmp) continue;
    tmp = x;
    ++ans;
  }
  cout << ans-1 << "\n";
  return 0;
}   

Measured memory_bytes: 512
#include<iostream>
#define l(a,b) a*a+b*b
#define INF 150
using namespace std;
int main(){
  int h,w,mh,mw;
  while(cin >> h >> w && h|w){
    mh=mw=INF;
    for(int i=INF;i>0;i--){
      for(int j=INF;j>i;j--){
	if((l(i,j)>l(h,w)) || (l(i,j)==l(h,w)&&i>h)){
	  if(l(i,j)<l(mh,mw) || (l(i,j)==l(mh,mw)&&i<mh)){
	    mh=i,mw=j;
	  }
	}
      }
    }
    cout << mh << " " << mw << endl;
  }
}

Measured memory_bytes: 1164
# https://atcoder.jp/contests/abc070/tasks/abc070_c
n = int(input())
nums = []
for _ in range(n):
    nums.append(int(input()))


def gcd(x, y):
    x, y = max(x, y), min(x, y)
    if y == 0:
        return 0
    if x % y == 0:
        return y
    return gcd(x % y, y)

ans = nums[0]
for num in nums:
    ans = ans * num // gcd(ans, num)
print(ans)


Measured memory_bytes: 75452
#include <stdio.h>
int main(void){
    int n,i;
    scanf("%d",&n);
    int a[n],odd=0,two=0,four=0,ans; //奇数、2の倍数だが4の倍数でない、4の倍数
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        a[i]%2==0?a[i]%4==0?four++:two++:odd++;
    };
    if(two==0){
        ans=odd<=four+1?1:0;
    }else{
        ans=odd<=four?1:0;
    };
    ans==1?puts("Yes"):puts("No");
    return 0;
};


Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
int main(){
    int n,i;
    scanf("%d",&n);
    for (i=0; i<n; i++) {
        int h,m;
        double x;
        scanf("%d:%d",&h,&m);
        x=fmod(5.5*(60*h+m),360);
        if ((x>=0&&x<30)||x>330) {
            printf("alert\n");
        }else if (x>=90&&x<=270){
            printf("safe\n");
        }else{
            printf("warning\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1008
N, X, D = list(map(int, input().split()))

if D == 0:
  if X == 0:
    print(1)
  else:
    print(N + 1)
  exit()

if D < 0:
  D *= -1
  X *= -1

R = {}
R[0] = [[0, 0]]
d, m, l, r = 0, 0, 0, 0

for i in range(N):
  d += (m + X) // D
  m = (m + X) % D
  l += i
  r += N - i - 1
  if m not in R:
    R[m] = [[d + l, d + r]]
  else:
    R[m].append([d + l, d + r])
  
ans = 0
for i in R:
  t = R[i]
  t.sort()
  l, r = t[0]
  for j in range(1, len(t)):
    if r < t[j][0]:
      ans += abs(r - l) + 1
      l, r = t[j]
    else:
      r = max(r, t[j][1])
  ans += abs(r - l) + 1

print(ans)

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

int main(void) {
  int N;
  cin >> N;
  string ans="No";
  
  for(int i=1; i<=9; i++){
    for(int j=1; j<=9; j++){
      if(N == i*j) ans = "Yes";
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod=998244353;

int n,k;
int l[1005],r[1005],dp[1000005],pre[2000005];

inline int query(int ll,int rr)
{
	return ((pre[rr]-pre[ll-1])%mod+mod)%mod;
}

signed main()
{
	cin>>n>>k;
	for (int i=1;i<=k;i++)  cin>>l[i]>>r[i];
	
	dp[1]=1;
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=k;j++)
		{
			if (l[j]>=i)  continue;
			int nowr=min(r[j],i-1ll);
			dp[i]=(dp[i]+max(query(i-nowr,i-l[j]),0ll))%mod;
		}
		pre[i]=(pre[i-1]+dp[i])%mod;
	}
	cout<<dp[n]%mod<<endl;
	
	return 0;
}

Measured memory_bytes: 6768
#include <bits/stdc++.h>
using namespace std;
int a[100005],n;
inline int read()
{int x=0;
char c=getchar();
while (c<'0'||c>'9') c=getchar();
while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
return x;
}
int main (){
	int x,i,ans=0;
	n=read();
	for (i=1;i<=n;i++)
	{x=read();
	if (x>100000) {ans++;}
	else {a[x]++;}
	}
	for (i=1;i<=100000;i++)
	{if (a[i]<i) {ans+=a[i];}
	else {ans+=(a[i]-i);}
	}
	printf ("%d",ans);
	return 0;
}
	

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	 public static void main(String args[]){
			Scanner sc = new Scanner(System.in);
			// 整数の入力
			double input1 = sc.nextDouble();
			double input2 = sc.nextDouble();
			if(input1 == input2) System.out.println("EQUAL");
			if(input1 > input2)System.out.println("GREATER");
			if(input1 < input2)System.out.println("LESS");
		  }

}


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

int main()
{
    ll n;
    cin >> n;

    int s = sqrt(n) + 1;
    while (s--)
    {
        if (n % s == 0)
        {
            cout << s + (n / s) - 2 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3640
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int n = 3, m = 0;
        int mat[][] = new int[n][n];
        int mat2[][] = new int[n][n];
        for(int i=0;i<n;i++)
            for(int j=0;j<n;j++)
                mat[i][j] = in.nextInt();
        n = in.nextInt();
        for(int i=0;i<n;i++){
            m = in.nextInt();
            for(int j=0;j<3;j++){
                for(int k=0;k<3;k++){
                    if(mat[j][k]==m) mat2[j][k]=1;
                }
            }
        }
        int cnt=0;
        boolean bingo = false;
        for(int i=0;i<3;i++){
            cnt=0;
            for(int j=0;j<3;j++){
                if(mat2[i][j]==1) cnt++;
            }
            if(cnt==3) bingo = true;
        }
        for(int i=0;i<3;i++){
            cnt=0;
            for(int j=0;j<3;j++){
                if(mat2[j][i]==1) cnt++;
            }
            if(cnt==3) bingo = true;
        }
        cnt=0;n=3;
        for(int i=0;i<n;i++) if(mat2[i][i]==1) cnt++;
        if(cnt==3) bingo = true;
        cnt=0;
        for(int i=0;i<n;i++) if(mat2[i][n-i-1]==1) cnt++;
        if(cnt==3) bingo = true;
        out.println(bingo?"Yes":"No");
    }
    
    /************* SOLUTION ENDS HERE **********/
}

Measured memory_bytes: 22356
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(' ').map(String::toInt)
    if (n % 3 != 0) {
        if (a.all { it == 0 }) {
            println("Yes")
            return
        }
    } else {
        val po = a.groupBy { it }.map { Pair(it.key, it.value.size )}.sortedBy { it.second }
        if (po.size == 1) {
            if (po[0].first == 0) {
                println("Yes")
                return
            }
        } else if (po.size == 2) {
            if (po[0].second * 2 == po[1].second && po[0].first == 0) {
                println("Yes")
                return
            }
        } else if (po.size == 3) {
            if (po.groupBy { it.second }.size == 1 && po[0].first xor po[1].first == po[2].first) {
                println("Yes")
                return
            }
        }
    }
    println("No")
}


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

const int N = 1e5 + 10;
int n, a[N], b[N];
vector<long long> v;
long long s, o;

bool cmp(int a, int b){
	return a > b;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++){
		cin >> b[i];
		v.push_back(a[i] - b[i]);
	}
	sort(v.begin(), v.end(), cmp);
	if(v[0] < 0)
		return cout << -1, 0;
	
	int q, p;
	for (int i = n - 1; i >= 0; i--){
		if(v[i] >= 0)
			break;
		s += -v[i];
		q++;
	}
	
	for (int j = 0; j < n; j++){
		if(v[j] < 0 || o >= s)
			break;
		o += v[j];
		p++;
	}
	if(o < s)
		return cout << -1, 0;
	
	cout << q + p;
}

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

int n, a, p;
long long ans;

int main(){
    scanf("%d", &n);
    p = 0;
    for (int i = 0; i < n; ++i){
        scanf("%d", &a);
        if (a < p) ans += p - a;
        p = max(a, p);
    }
    printf("%lld", ans);
}


Measured memory_bytes: 3808
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,w;cin>>n>>w;
    ll dp[n+1][w+1];
    ll v[n+1],we[n+1];
    for(int i=1;i<=n;++i)
    {
        cin>>we[i]>>v[i];
    }
    for(int i=0;i<=n;++i)
    {
        for(int j=0;j<=w;++j)
        {
            dp[i][j]=0;
        }
    }
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=w;++j)
        {
            if(j-we[i]<0)
            {
                dp[i][j]=dp[i-1][j];
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-we[i]]+v[i]);
            }
        }
    }
    cout<<dp[n][w]<<endl;

    
    return 0;
}

Measured memory_bytes: 79232