akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
 
vector<string>dat;
ll dist[880][880];
 
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
 
	int H, W, K;
	cin >> H >> W >> K;
	for (int i = 0; i < H; i++) {
		string S;
		cin >> S;
		dat.pb(S);
	}
 
 
	queue<int>q;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			dist[i][j] = inf;
			if (dat[i][j] == 'S') {
				dat[i][j] = '.';
				dist[i][j] = 0;
				q.push(1000 * i + j);
			}
		}
	}
 
	while (q.size()){
		int v = q.front();
		q.pop();
		int i = v / 1000;
		int j = v % 1000;
		int di[4] = {-1,0,1,0};
		int dj[4] = {0,1,0,-1};
		for (int k = 0; k < 4; k++) {
			int i_ = i + di[k];
			int j_ = j + dj[k];
			if (0 <= i_ && i_ < H && 0 <= j_ && j_ < W && dat[i_][j_] == '.'){
				if (dist[i][j] + 1 >= dist[i_][j_])continue;
				dist[i_][j_] = dist[i][j] + 1;
				q.push(1000 * i_ + j_);
			}
		}
	}
 
	ll ans = inf;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (dist[i][j] <= K) {
				int dist1 = i;
				int dist2 = H - 1 - i;
				int dist3 = j;
				int dist4 = W - 1 - j;
				if (!dist1 || !dist2 || !dist3 || !dist4) {
					puts(1);
					return 0;
				}
				int temp = 2+((min(min(dist1, dist2), min(dist3, dist4))-1) / K);
				ans = min(ans,(ll)temp);
			}
		}
	}
	puts(ans);
 
	return 0;
}

Measured memory_bytes: 6528
#include<stdio.h>
int main(){
  int b[10110],c,n,i,j,r;
  while(scanf("%d",&n),n){
    for(i=r=0;i<n;i++)scanf("%d",&b[i]);
    for(i=0;i<10001;i++){
      for(j=n+i-1;j>r;j--){
	if(b[j]-b[j-1]-1)break;
      }
      if(j==r&&b[r]==1)break;
      b[n+i]=n+i-r;
      c=0;
      for(j=n+i-1;j>=r;j--){
	b[j+c]=b[j]-1;
	if(b[j+c]==0)c++;
      }
      r+=c;//for(j=r;j<n+i+1;j++)printf("%d ",b[j]);printf("\n");
    }
    if(i-10001)printf("%d\n",i);
    else       printf("-1\n");
  }
  return 0;
}

Measured memory_bytes: 652
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll n,k,*a,*f;
bool comp(const int &p, const int &q){
    if(p>q) return true;
    return false;
}
int isAns(ll mid){
    ll temp,total=0;
    // cout<<mid<<"--\n";
    // cout<<n<<endl;
    for(int i=0;i<n;i++){
      //  cout<<"hi";
        temp=mid%f[i];
        if(a[i]>=mid/f[i]){
            
            total+=a[i]-(mid/f[i]);
            //if(temp!=0) total+=1;
        }
        //cout<<a[i]-(mid/f[i])<<" "<<temp<<endl;
    }
   // cout<<total<<" total\n";
    if(total>k) return 0;
    return 1;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n>>k;
    a=new ll[n];
    f=new ll[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>f[i];
    }
    sort(a,a+n,comp);
    sort(f,f+n);
    // for(int i=0;i<n;i++){
    //     cout<<a[i]<<" ";
    // }
    // cout<<endl;
    // for(int i=0;i<n;i++){
    //     cout<<f[i]<<" ";
    // }
    // cout<<endl;
    ll s=0,e=1LL*a[0]*f[n-1],ans=-1,mid;
    while(s<=e){
        mid=s+(e-s)/2;
        if(isAns(mid)==1){
            ans=mid;
            e=mid-1;
        }
        else{
            s=mid+1;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3456
var ans:int64;
    q,h,s,d,n:int64;
begin
  read(q,h,s,d);
  if 4*q<s then s:=4*q;
  if 2*h<s then s:=2*h;
  if 2*s<d then d:=2*s;
  read(n);
  if s*2>d then inc(ans,(n div 2)*d) else inc(ans,s*n);
  if (n mod 2=1)and(s*2>d) then inc(ans,s);
  writeln(ans);
end.

Measured memory_bytes: 128
// kid_kb //

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define ull unsigned long long int
#define lower(str) transform(str.begin(),str.end(),str.begin(),::tolower);
#define upper(str) transform(str.begin(),str.end(),str.begin(),::toupper);
#define mod 1000000007
#define SORT(vec) sort(vec.begin(),vec.end());
#define pb push_back
#define csb __builtin_popcount
#define msb(n) (ll)(log2(n))
#define DIG(n) floor(log10(n))+1
#define kb ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ptr(arr) for(auto i:arr)cout<<i<<" ";
#define ptr2(vec) for(auto i:vec){for(auto j: i){cout<<j<<" ";}cout<<endl;}
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,n,a) for (int i=n-1;i>=a;i--)
#define mem(a,val) memset(a,val,sizeof(a))
#define INF INT_MAX
#define inf INT_MIN

// cout<<fixed<<setprecision(8)<<endl;

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

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

ll fastpower(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=fastpower(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}

ll modInverse(ll a, ll m) { return fastpower(a, m-2, m); }

//----------------------------------------Let's Fight-----------------------------------------------------------------

void solve(){
    ll n;
    cin>>n;
    ll ans=0;
    //int maxi=min(n,(ll)1000);
    rep(i,1,n){
        rep(j,1,n){
            ll x=i*j;
            if(x<n)ans++;
            else break;
        }
    }
    //if(maxi<n)
    //ans+=2*(n-1000);
    cout<<ans<<endl;
}

int main()
{
    kb
//  clock_t tStart = clock();
    ll t;
     t=1;
//    cin>>t;
    while(t--){
        solve();
    }
//  printf("%.2fs time lga\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    return 0;
}


Measured memory_bytes: 3684
n,l = map(int, input().split())
a = list(map(int, input().split()))

x = -1

for i in range(n-1):
    if a[i]+a[i+1] >= l:
        x = i+1
        break

if x == -1:
    print('Impossible')
else:
    print('Possible')
    for i in range(1,x):
        print(i)
    for i in range(n-x):
        print(n-i-1)

Measured memory_bytes: 63984
h,w = list(map(int,input().split()))

x = []
for i in range(h):
    x.append(input())

x2  = []
for i in x:
    if '#' in i:
        x2.append(i)

de = []

for i in range(w):
    flag = 0
    for line in x2:
        if line[i] == '#':
            flag = 1
            break
    if flag == 0:
        de.append(i)

for line in x2:
    st = ""
    for i in range(w):
        if i in de:
            pass
        else:
            st += line[i]
    print(st)


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

#define llint long long int

using namespace std;

int main(){
    string S;

    cin >> S;

    int N = S.length();

    S = " " + S;

    for(int i = 1, j = N; i < j; i ++, j --){
        if(S[i] != S[j]){
            cout << "No" << endl;

            return 0;
        }
    }
    for(int i = 1, j = (N - 1) / 2; i < j; i ++, j --){
        if(S[i] != S[j]){
            cout << "No" << endl;

            return 0;
        }
    }
    for(int i = (N + 3) / 2, j = N; i < j; i ++, j --){
        if(S[i] != S[j]){
            cout << "No" << endl;

            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <deque>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <cassert>
#include <iostream>
#include <stdio.h>
#include <time.h>
 
using namespace std;

typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define endl "\n"
 
#define MOD 1000000007

int main(){
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  cout << max(max(a*c,b*d),max(a*d,b*c)) << endl;
  return 0;
}

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

int main() {
    long long a,b,n;
    cin>>a>>b>>n;
    if(n<b) {
        cout << (a*n/b)<<endl;
    }
    else {
        cout <<(a*(b-1)/b)<<endl;
    }
    return 0;
}

Measured memory_bytes: 3528
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()

#define endl "\n"
#define pb push_back
#define elif else if
#define cout_db cout << fixed

#define MOD 1000000007LL
#define PI 3.1415926

typedef long long ll;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int n;
	string s[50];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	int letters[26];
	for (int i = 0; i < 26; i++) {
		letters[i] = 1145141919;
	}
	for (int i = 0; i < n; i++) {
		int cnt[26] = {0};
		for (int j = 0; j < s[i].size(); j++) {
			cnt[s[i][j] - 'a']++;
		}
		for (int j = 0; j < 26; j++) {
			if(cnt[j] < letters[j]) letters[j] = cnt[j];
		}
	}
	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < letters[i]; j++) {
			cout << (char)('a'+i);
		}
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
int main(){
  int A,B, C, D ,E ,F;
  long long int Aa[10000000] = {};
  string S,Sa,Sb,Sc;
  cin >> Aa[0] >> Aa[1] >> Aa[2];
  bool ans = false;
  sort(Aa, Aa + 3);
  if(Aa[0] == 5 && Aa[1] == 5 && Aa[2] == 7)ans = true;
  if(ans)cout << "YES" << endl;
  else cout << "NO" << endl;
  
        return 0;
}

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

using namespace std;
typedef long long int lld;
#define rep(i,a,b) for(int i=a;i<b;i++)

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  int a[n];
  int b[n];
  int c[n-1];
  rep(i,0,n) cin>>a[i];
  rep(i,0,n)cin>>b[i];
  rep(i,0,n-1)cin>>c[i];
  int ans=0;
  rep(i,0,n-1){
    ans+=b[i];
    if(a[i]+1==a[i+1]){
      ans+=c[a[i]-1];
    }
  }
  cout<<ans+b[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 256
/**
*	created: 19.09.2020 21:07:25
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rrep(i,n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
using ll = long long;
using P = pair<int,int>;
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> inline bool chmax(T &a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> inline bool chmin(T &a, T b) {if (b < a) {a = b; return 1;} return 0;}
inline void print(P a) {cout << a.first << " " << a.second << endl;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

int dp[MAX];


signed main() {
    int n; cin >> n;
    dp[0] = 0;
    rep2(i,1,n+1) {
        for (int j = i; j <= n+1; j+=i) {
            dp[j]++;
        }
    }
    rep2(i,1,n) {
        dp[i] += dp[i-1];
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 11420
let solve n w d =
  let t = Array.make (w + 1) 0 in
  let rec doit = function
    | (i, _) when i = n -> Array.fold_left max min_int t
    | (i, x) when x = w -> doit (i + 1, 0)
    | (i, x) ->
      let (vi, wi) = d.(i) in
      if x + wi <= w then t.(x+wi) <- max t.(x+wi) (t.(x) + vi);
      doit (i, x + 1) in
  doit (0, 0)

let read () = Scanf.scanf "%d %d\n" (fun x y -> (x, y))

let () =
  let (n, w) = read () in
  let d = Array.init n (fun _ -> read ()) in
  Printf.printf "%d\n" (solve n w d)

Measured memory_bytes: 2528
import java.util.Scanner;
    class Main{
       
   public static void main(String args[]){
      int n =10;
      int i; int g ;
      for(i=1;i<n;i++){  
           for(g=1;g<n;g++){
                System.out.println(i+"x"+g+"="+(i*g));
           }
          
           
      }
     
     
    
      
      
      
      
      
      
      
       

 
  
   
}
      
  }


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

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

    int members[4][3][10] = {};
    int n, b, f, r, v;
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> b >> f >> r >> v;
        if (members[b - 1][f - 1][r - 1] + v > 10)
            members[b - 1][f - 1][r - 1] = 9;
        else if (members[b - 1][f - 1][r - 1] + v < 0)
            members[b - 1][f - 1][r - 1] = 0;
        else
            members[b - 1][f - 1][r - 1] += v;
    }

    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++) {
                cout << " " << members[i][j][k];
            }
            cout << endl;
        }
        if (i < 3)
            cout << "####################" << endl;
    }
}


Measured memory_bytes: 3208
import java.util.*;
import java.io.*;

public class Main {	

	private static void solve(){
		//Implement solution here.
		int H = ni();
		int W = ni();
		int K = ni();
		long result = 0;
		char[][] c = new char[H][W];
		for(int i = 0; i < H; i++) c[i] = next().toCharArray();

		for(int i = 0; i < Math.pow(2, H); i++) {
			String Hfilter = String.format("%0" + H + "d",Integer.parseInt(Integer.toBinaryString(i)));
			for(int j = 0; j < Math.pow(2,W); j++) {
				String Vfilter = String.format("%0" + W + "d",Integer.parseInt(Integer.toBinaryString(j)));
				int cnt = 0;
				for(int k = 0; k < H; k++) {
					if(Hfilter.charAt(k) == '0') continue;
					for(int l = 0; l < W; l++) {
						if(Vfilter.charAt(l) == '0')continue;
						if(c[k][l] == '#') cnt++;
						if(cnt > K)break;
					}
					if(cnt > K)break;
				}
				if(cnt == K)result++;
			}

		}
		System.out.println(result);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();	
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();			
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			} 
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}


Measured memory_bytes: 34700
using System;
public class Hello{
    public static void Main()
    {
        ulong K = ulong.Parse(System.Console.ReadLine());
        if (K % 2 == 0)
        {
            Console.WriteLine(-1);
            return;
        }
        ulong count = (ulong)Math.Log10(K) + 1;
        ulong v = 7; 
        for (ulong i = 1; i < count; i++)
        {
            v = v * 10 + 7;
        }
        while (true)
        {
            ulong a = v % K;

            if (a == 0)
            {
                Console.WriteLine(count);
                return;
            }
            if (count == K)
            {
                Console.WriteLine(-1);
                return;
            }            
            v = a * 10 + 7;
            count++;
        }
    }
}

Measured memory_bytes: 27740
#include<iostream>
using namespace std;
struct Vector
{
	double x;
	double y;
	Vector(double x, double y) :x(x), y(y) {}
};
bool isParallel(Vector &p1, Vector &p2)
{
	return p1.x*p2.y - p1.y*p2.x == 0;
}
bool isOrhogonal(Vector &p1, Vector &p2)
{
	return p1.x*p2.x + p1.y*p2.y == 0;
}
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		double x0, y0, x1, y1, x2, y2, x3, y3;
		cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		Vector p1(x1 - x0, y1 - y0);
		Vector p2(x3 - x2, y3 - y2);
		if (isParallel(p1, p2))
			cout << 2 << endl;
		else if (isOrhogonal(p1, p2))
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
long int gcd(long int a,long int b)
{
	if (a%b==0){
      return(b);
    }
  else{
    return(gcd(b,a%b));
  }
}
int main(){
  
	long int n,m;
    cin >>n >>m;
  string s,t;
  cin >> s ;
  cin >> t;
  long long int l=gcd(n,m);
  long long int k=n*m/l;
  
 
  for(long int i=0;i<l;i++){
  	if (s[i*(n/l)]!=t[i*(m/l)]){
       cout << -1 <<endl;
      return 0;
    }
    
  }
  
  cout << k <<endl;
  
  
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] t = new int[n+1];
		int[] x = new int[n+1];
		int[] y = new int[n+1];
		t[0] = 0;
		x[0] = 0;
		y[0] = 0;
		for(int i = 1; i < n+1; i++) {
			t[i] = Integer.parseInt(sc.next());
			x[i] = Integer.parseInt(sc.next());
			y[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		boolean ans = false;
		// どのときYes
		// dt >= dist && (dt - dist)%2==0
		for(int i = 0; i < n; i++) {
			int dt = t[i+1] - t[i];
			int dist = calcMan(x[i], y[i], x[i+1], y[i+1]);
			if (dt >= dist && (dt - dist) % 2 ==0) {
				ans = true;
			} else {
				ans = false;
				break;
			}
		}
		if (ans) System.out.println("Yes");
		if (!ans) System.out.println("No");
		
		
	}
	public static int calcMan(int x, int y, int nx, int ny) {
		return Math.abs(nx - x) + Math.abs(ny - y);
		
	}

}


Measured memory_bytes: 61760
/** Author : Parth Prajapati
 * 	Institute : Pandit Deendayal Petroleum University
**/
#include<bits/stdc++.h>

using namespace std;

#define l long // -2^31 to +2^31-1 (upper limit ~ 2*(10^9))
#define ul unsigned long // 0 to +2^32-1
#define ll long long // -2^63 to +2^63-1 (upper limit ~ 9*(10^18))
#define ull unsigned long long // 0 to +2^64-1
#define mod(x, m) ((((x)%(m))+(m))%(m))
#define vi vector<int>
#define pi pair<int,int>
#define vl vector<ll int>
#define pl pair<ll int,ll int>
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const ll MOD = 1e9 + 7;
const double pie = 3.141592653589793;
const ll int MD = 998244353 ;

#define setcount(x) __builtin_popcount(x) // counts set bits
#define parity(x) __builtin_parity(x) // checks parity of the number
#define lzcount(x) __builtin_clz(x) // count leading zeros in binary representation of number
#define tzcount(x) __builtin_ctz(x) // count trailing zeros in binary representation of number

template<typename T> T inf() { return (T)__builtin_inf();} // syntax for use inf<datatype>();
template<typename T> T gcd(T a,T b){ if(b>a) return gcd(b,a);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 fast_power(T x,T y,ll m=MOD){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

string IntToString(ll a){ ostringstream temp; temp << a; return temp.str();}
ll findMMI_fermat(ll n,ll M) {ll ans= fast_power(n,M-2,M);return ans;}//i.e In (a/b)%M..it calculates MMI of b wrt M,only if M is prime
ll add(ll a,ll b,ll M) { return ( mod(a,M ) + mod(b,M ))%M; }
ll sub(ll a, ll b,ll M) { return (mod(a,M ) + M - mod(b,M ))%M; }
ll mult(ll a,ll b,ll M) { return  ( mod(a,M)*mod(b,M) ) %M ; }
bool isprime(ll a){ if(a==2) {return 1;}if(!(a&1) ) {return 0;}for(ll i=3;i*i<=a;i+=2){if(a%i==0) {return 0;} } return 1;} 

/************************** main program **************************/

int main()
{
	FASTIO
	//code
	ll int a,b;
	cin>>a>>b;
	cout<<lcm(a,b);
	return 0;
}

Measured memory_bytes: 256
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
mod = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def inverse(N, mod):
	return (pow(N, mod - 2, mod))

def main():
	X = int(input())
	print(X ^ 1)





if __name__ == '__main__':
	main()

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
const int M = 1e9 + 7;
const ll INF = 1e9;
const int MAX_V = 1000 + 5;
const int MAX_N = 1e5 + 5;

int main() {
    int n;
    cin >> n;
    vector<int> a(n + 1);
    repeat(i, 1, n + 1) cin >> a[i];
    int broken = 0;
    repeat(i, 1, n + 1) {
        if (i - broken == a[i]) {
            continue;
        } else {
            broken++;
        }
    }
    if (broken == n)
        cout << -1 << endl;
    else
        cout << broken << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
// #define int long long
typedef long long ll;
#define fi first
#define se second
#define pii pair<int,int>
#define endl '\n'
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define sz(s) (int)s.size()
#define y1 fdfbvfds
typedef long double f80;
#define all(x) x.begin(), x.end()
typedef long double f80;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rand(ll l,ll r){
    uniform_int_distribution<ll> uid(l, r);
    return uid(rng);
}

const int mod = 1e9 + 7;
int pwr(int a,int b) {
    int ans = 1;
    while(b) {
        if(b & 1) {
            ans = (ans * 1LL * a) % mod;
        }
        a = (a * 1LL * a) % mod;
        b >>= 1;
    }
    return ans;
}

const int N = 5e5 + 5;
int a[N];

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int n = sz(s) + 1;
    fill(a, a + n, -1);
    if(s[0] == '<')
        a[0] = 0;
    if(s[n - 2] == '>')
        a[n - 1] = 0;
    fr(i, 1, n - 2) {
        if(s[i] == '<' && s[i - 1] == '>') a[i] = 0;
    }
    fr(i, 1, n - 1) {
        if(s[i - 1] == '<') {
            a[i] = max(a[i], a[i - 1] + 1);
        }
    }
    for(int i = n - 2; i >= 0; i--) {
        if(s[i] == '>') {
            a[i] = max(a[i], a[i + 1] + 1);
        }
    }
    ll ans = 0;
    fr(i, 0, n - 1) {
        ans += a[i];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 2844
#include<stdio.h>
using namespace std;

int main(){
  int a, b, c, d, r;
  double f;
  scanf("%d %d", &a, &b);
  d = a / b;
  r = a % b;
  f = 1.0 * a / b;
  printf("%d %d %.5lf\n", d, r, f);
  return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int l,r,d;
    cin>>l>>r>>d;
    cout<<r/d-(l-1)/d<<"\n";
	return 0;
}

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

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

    int now;
    cin >> now;
    for (int i = 0; i < n - 1; i++) {
        int h;
        cin >> h;

        if (h < now) {
            cout << "No" << endl;
            return 0;
        }

        if (h >= now + 1) now = h - 1;
    }
    cout << "Yes" << endl;
}   

Measured memory_bytes: 256
import itertools

a, b, c = map(int, input().split(" "))
k = int(input())
f = False
for conb in list(itertools.combinations_with_replacement([0, 1, 2], k)):
    a_i = conb.count(0)
    b_i = conb.count(1)
    c_i = conb.count(2)
    
    if (a * (2 ** a_i) < b * (2 **b_i)) and (b * (2 ** b_i) < c * (2 ** c_i)):
        f = True

if f:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9068
s = input()
t = input()
s_list = list(s)
flg = False
for i in range(len(s)):
    s_list.insert(0,s_list[-1])
    del s_list[-1]
    if "".join(s_list) == t:
        print('Yes')
        flg = True
        break
        
if not flg:
    print('No')

Measured memory_bytes: 3060
n,m,x,y = gets.split.map(&:to_i)
xa = gets.split.map(&:to_i) + [x]
ya = gets.split.map(&:to_i) + [y]

xa,ya = ya,xa if x>y

if xa.max<ya.min
  puts "No War"
else
  puts "War"
end

Measured memory_bytes: 3836
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
string s = "         ";
char c[3] = { '3','5','7' };
map<string, bool> m;
int n;
ll res = 0;
void rec(int dig) {
	if (dig == 10) {
		for (int i = 3; i < 10; i++)
		{
			string s2 = s.substr(0, i);
			int v = stoi(s2);
			if (v > n) continue;
			if (m.count(s2) > 0) continue;
			m[s2] = true;
			bool a = false, b = false, c = false;
			for (size_t j = 0; j < s2.size(); j++)
			{
				if (s2[j] == '3') a = true;
				if (s2[j] == '5') b = true;
				if (s2[j] == '7') c = true;
			}
			if (a && b && c) {
				res++;
			}
		}
		return;
	}
	for (size_t i = 0; i < 3; i++)
	{
		s[dig] = c[i];
		rec(dig + 1);
	}
}
void p755() {
	cin >> n;
	rec(0);
	cout << res << endl;
}
int main() {

	p755();
	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
        using namespace std;
        #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
        #define M_PI 3.14159265358979323846
        #define data data_
        #define ff first
        #define ss second
        #define pb push_back
        #define ll long long
        #define ld long double

        long long fun(long long x)
        {
            if(x == 1)
                return 1;
            else
                return 2LL*fun(x/2)+1;
        }
        int main()
        {
            tani_nachi_ke  

            long long h;
            cin >> h;
            cout << fun(h) << endl;








           return 0;
        }

Measured memory_bytes: 256
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
using Graph = vector<vector<int>>;
Graph G;

int main(){
    int n; cin >> n;
    Graph G(n);
    vector<pair<int,int>> p;
    rep(i, n - 1){
        int a, b; cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
        p.emplace_back(a, b);
    }
    int k = 0;
    rep(i, n) k = max(k, (int)G[i].size());

    queue<int> que;
    map<pair<int,int>, int> ans;
    vector<bool> seen(n, false);
    vector<int> color(n, 0);

    que.emplace(0);
    seen[0] = true;

    while(!que.empty()){
        int v = que.front();
        que.pop();
        int cur = 1;
        for(auto next_v : G[v]){
            if(seen[next_v]) continue;
            if(cur == color[v]) cur++;
            color[next_v] = ans[{next_v, v}] = ans[{v, next_v}] = cur;
            cur++;
            seen[next_v] = true;
            que.emplace(next_v);
        }
    }
    cout << k << endl;
    for(auto it : p) cout << ans[it] << endl;
    return 0;
}

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

int main() {
    long long n,y;
    cin >> n >> y;

    for (int i = 0; i < n+1; i++){
        for (int j = 0; j < n+1-i; j++){
            if(10000*i+5000*j+1000*(n-i-j)==y){
                cout << i << " " << j << " " << n-i-j << endl;
                exit(0);
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}



Measured memory_bytes: 3536
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp

N,q = gets.chomp.split(' ').map(&:to_i)
a = Array.new(N+1).map{0}
$bit = Array.new(N+1).map{0}
$bit_siten = Array.new(N+1)
(N+1).times do |n|
	binary = n.to_s(2)
	i = 0
	binary.reverse.each_char do |b|
		if b=="1"
			binary[binary.length-1-i] = '0'
			break
		end
		i = i + 1
	end
	#p "binary is #{binary}"
	$bit_siten[n] = binary.to_i(2)+1
end
# tate_index?????????????´??????????S???????????????????????????????????????n???tate?????????
tate = Array.new(N+1).map{[]}
(N+1).times do |n|
	($bit_siten[n]..n).each do |tate_index|
		#p "#{tate_index}, with n is #{n}"
		tate[tate_index] << n
	end
end


def sum(n)
	if $bit_siten[n]==1
		$bit[n]
	else
		sum($bit_siten[n]-1)+$bit[n]
	end
end

q.times do | index |
	com,x,y = gets.chomp.split(' ').map(&:to_i)
	if com==0
		tate[x].each do |tate_value|
			$bit[tate_value] = $bit[tate_value] + y
		end
	elsif com== 1
		#p $bit
		#p "sum y is #{sum(y)}, sum x is #{sum(x-1)}"
		p sum(y)-sum(x-1)
	end
end

Measured memory_bytes: 36544
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;
    int B[N];

    for (int i=1;i<N;i++){
        cin >> B[i];
    }
    ll sum=0;

    sum += B[1];

    for(int i=2;i<N;i++){
        sum += min (B[i-1],B[i]);
    }
    sum += B[N-1];
    cout << sum;

}

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

int main()
{
    int d;
    scanf("%d",&d);
    if(d==25)
        printf("Christmas\n");
    if(d==24)
        printf("Christmas Eve\n");
    if(d==23)
        printf("Christmas Eve Eve\n");
    if(d==22)
        printf("Christmas Eve Eve Eve\n");
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iostream>
#include<queue>
#include<stack>
#define Max 1000
using namespace std;

vector<pair<int,int>>vec;

bool cmp(pair<int,int>&x,pair<int,int>&y){
	return (x.second == y.second)?(x.first<y.first):(x.second<y.second);
}

int main(){


	int n,i,x,a[Max],index;
	for(i=0;i<Max;i++)
		a[i] = -1;
	scanf("%d",&n);
	for(i=0;i<n-1;i++){
		scanf("%d",&x);
		vec.push_back(make_pair(i,x));
	}

	sort(vec.begin(),vec.end(),cmp);

	for(i=0;i<vec.size();i++){
		//printf("%d %d\n",vec[i].first,vec[i].second);
		index = vec[i].first;
		if(a[index] == -1 && a[index+1] == -1){
			a[index] = vec[i].second;
			a[index+1] = a[index];
			//printf("A %d %d\n",a[index],a[index+1]);
		}else if(a[index] == -1){
			a[index] = vec[i].second;
			//printf("B %d %d\n",a[index],a[index+1]);
		}else if(a[index+1] == -1){
			a[index+1] = vec[i].second;
			//printf("C %d %d\n",a[index],a[index+1]);
		}
		
	}

	int value = 0;
	for(i=0;i<n;i++){
		value += a[i];
		//printf("%d ",a[i]);
	}
	printf("%d\n",value);

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define pp push_back
#define pi pair<ll,ll>
#define pii pair<int,int>
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,i,j,k,l,m,b,t,sum,sum1,flag;
    cin>>n;
    ll a[n+1];
    sum=0;
    for(i=1;i<=n;i++){
        cin>>a[i];
        if(i%2!=0&&a[i]%2!=0){
            sum+=1;
        }
    }
    cout<<sum<<endl;


}


Measured memory_bytes: 3648
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n, m = map(int, input().split())
dict_road = {}
dict_room = {}
for i in  range(0, m):
    a, b = map(int, input().split())
    if a in dict_road:
        dict_road[a].append(b)
    else:
        dict_road[a] = [b]
    if b in dict_road:
        dict_road[b].append(a)
    else:
        dict_road[b] = [a]
start_list = dict_road[1]
temp_list = []
for no in start_list:
    dict_room[no] = 1
    temp_list.append(no)

while True:
    next_temp_list = []
    for no in temp_list:
        for next_no in dict_road[no]:
            if next_no not in dict_room:
                dict_room[next_no] = no
                next_temp_list.append(next_no)
    if len(next_temp_list) == 0:
        break
    temp_list = next_temp_list
print("Yes")
for i in range(2, n + 1):
    print(dict_room[i])

Measured memory_bytes: 48976
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int N, X;
    cin >> N >> X;
    int L[100];
    for(int i=0;i<N;i++)
        cin >> L[i];
    
    int D[101], ans = 0;
    D[0] = 0;
    ans++;
    for(int i=1;i<=N;i++){
        D[i] = D[i-1] + L[i-1];
        if(D[i] <= X)
            ans++;
        else
            break;
    }
    
    cout << ans << endl;

}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc080/tasks/abc080_c

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int N, P[100][11], m, t, s;
bool F[100][10];
int main()
{
  cin >> N;
  REP(i, N)
  {
    REP(j, 10)
    {
      cin >> F[i][j];
    }
  }
  REP(i, N)
  {
    REP(j, 11)
    {
      cin >> P[i][j];
    }
  }

  m = -INF;
  FOR(i, 1, 1 << 10)
  {
    s = 0;
    REP(j, N)
    {
      t = 0;
      REP(k, 10)
      {
        if (i >> k & 1 && F[j][k])
          t++;
      }
      s += P[j][t];
    }
    m = max(m, s);
  }

  cout << m << '\n';

  return 0;
}


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

int x[112345];
int N,X;
int main () {
    cin >> N >> X;
    x[0] = X;
    for(int i=1; i<=N; i++) cin>>x[i];
    for(int i=0; i<N; i++) x[i] = abs(x[i+1] - x[i]);
    for(int i=0; i<N; i++) x[0] = __gcd(x[0],x[i]);
    cout << x[0] << endl;
    return 0;
}


Measured memory_bytes: 640
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <math.h>

char orderedList[5][6] = { "{{{{{", "{{{{{", "{{{{{", "{{{{{", "{{{{{" };

static void my_strcpy(char * dst, const char * const src, const uint32_t size) {
	for (uint32_t idx = 0; idx < size; idx++) {
		dst[idx] = src[idx];
	}
	dst[size] = '\0';
}

static void moveDownListEntries(const uint32_t pos) {
	for (uint32_t idx = 4; idx > pos; idx--) {
		strcpy(orderedList[idx], orderedList[idx - 1]);
	}
}

static void insertIntoOrderedList(const char * const pSubstring, const uint32_t substringLength, const uint32_t K) {
	char substring[6];

	my_strcpy(substring, pSubstring, substringLength);

	for (uint32_t idx = 0; idx < K; idx++) {
		int cmpResult = strcmp(substring, orderedList[idx]);
		if (cmpResult < 0) {
			moveDownListEntries(idx);
			strcpy(orderedList[idx], substring);
			break;
		}
		else if (cmpResult == 0) {
			break;
		}
	}
}

int main(void) {
	char s[5001];
	uint32_t K;

	scanf("%s\n%"PRIu32, s, &K);

	const uint32_t stringLength = (uint32_t)strlen(s);

	for (uint32_t substringLength = 1; (substringLength <= K) && (substringLength <= stringLength); substringLength++) {
		for (uint32_t substringBeginPos = 0; substringBeginPos <= stringLength - substringLength; substringBeginPos++) {
			insertIntoOrderedList(&(s[substringBeginPos]), substringLength, K);
		}
	}

	printf("%s", orderedList[K - 1]);

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define pii pair<int,int>
#define mp make_pair 
using namespace std;
const int mxn=3e5+5;
pii arr[mxn],st1[mxn],st2[mxn];
int n,w,h,ans;
namespace Max_Segment_Tree{
	struct M_Sgt{
		int mx[mxn<<3],lazy[mxn<<3];
		inline void modify(int x,int l,int r,int L,int R,int d){
			if(L<=l and r<=R){
				mx[x]+=d;
				lazy[x]+=d;
				return;
			}
			int md=l+r>>1;
			if(L<=md)modify(x<<1,l,md,L,R,d);
			if(md<R)modify(x<<1|1,md+1,r,L,R,d);
			mx[x]=max(mx[x<<1],mx[x<<1|1])+lazy[x];
		}
		inline void init(){
			memset(lazy,0,sizeof(lazy));
			memset(mx,-0x3f,sizeof(mx));
		}
	};
}
using namespace Max_Segment_Tree;
M_Sgt segt;
inline void work(){
	sort(arr,arr+n);
	segt.init();
	int tp1=0,tp2=0;
	for(int i=0;i<n-1;++i){
		auto *st=arr[i].second<=h/2?st1:st2;
		int nxt=i-1,&tp=arr[i].second<=h/2?tp1:tp2;
		for(;tp and ((st[tp-1].second<arr[i].second)^(arr[i].second>h/2));){
			segt.modify(1,0,n-1,st[tp-1].first,nxt,(st[tp-1].second-arr[i].second)*(arr[i].second<=h/2?1:-1));
			nxt=st[--tp].first-1;
		}
		if(nxt!=i-1)st[tp++]=mp(nxt+1,arr[i].second);
		st1[tp1++]=mp(i,0);
		st2[tp2++]=mp(i,h);
		segt.modify(1,0,n-1,i,i,-segt.mx[0]+h-arr[i].first);
		ans=max(ans,segt.mx[1]+arr[i+1].first);
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin>>w>>h>>n;
	for(int i=0;i<n;++i)cin>>arr[i].first>>arr[i].second;
	arr[n++]=mp(0,0);
	arr[n++]=mp(w,h);
	work();
	swap(w,h);for(int i=0;i<n;++i)swap(arr[i].first,arr[i].second);
	work();
	cout<<ans*2<<endl;
	return 0;
}

Measured memory_bytes: 25984
#include<iostream>
using namespace std;
int main() {
	long long n, m, l, a[100][100], b[100][100], c[100][100] = {};
	cin >> n >> m >> l;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j) cin >> a[i][j];
	for (int i = 0; i < m; ++i)
		for (int j = 0; j < l; ++j) cin >> b[i][j];
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < l; ++j) {
			for (int k = 0; k < m; ++k) {
				c[i][j] += a[i][k] * b[k][j];
			}
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < l; ++j) {
			if (j) cout << " ";
			cout << c[i][j];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3312
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;
import java.math.*;

public class Main {
    public final static long MOD = 1000000007;

    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        int H = reader.nextInt();
        int N = reader.nextInt();
        for (int i=0; i<N; i++) H -= reader.nextInt();
        if (H <= 0) System.out.println("Yes");
        else System.out.println("No");
    }

    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

int main (){
    ll n,W;
    cin >> n >> W;
    vl w(n);
    vl v(n);
    rep(i,n) cin >> w[i] >> v[i];
    ll dp[n+1][100001];
    rep(i,n+1) rep(j,100001) dp[i][j]=inf;
    dp[n][0]=0;
    for(ll i=n-1;i>=0;i--){
        for(ll j=0;j<=100000;j++){
            if(j-v[i]>=0) dp[i][j]=min(dp[i+1][j],dp[i+1][j-v[i]]+w[i]);
            else dp[i][j]=dp[i+1][j];
        }
    }
    for(int j=100000;j>=0;j--){
        if(dp[0][j]<=W){
            cout << j << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
const long long INF=1000000000;
typedef long long ll;
int main(){
   int n;
   cin>>n;
   ll a[n];
   int count=0;
   for (int i = 0; i < n;i++){
      cin>>a[i];
      if(a[i]%2==0)
         count++;
   }
   int ans=0;
   while(count==n){
      count = 0;
      for (int i = 0; i < n;i++){
         a[i]/=2;
         if(a[i]%2==0)
            count++;
      }
      ans++;
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P	  = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

constexpr ll INF = 1e16;
constexpr ll INM = 114514;
constexpr ll MOD = 1e9 + 7;
constexpr ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};

ll g[200][200];
ll d[200][200];

int main() {
	IOS();
	int n;
	cin >> n;
	dump(n * n);
}

Measured memory_bytes: 256
import java.util.*;

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

		String[] sArray = s.split("");
		String[] tArray = t.split("");

		int num_times = sArray.length - tArray.length + 1;

		String part = new String();

		int count = 9999;

		for (int i = 0; i < num_times;i++){

			StringBuilder sb = new StringBuilder();

			for(int j=i; j < i + tArray.length; j++){
				sb.append(sArray[j]);
			}
			part = sb.toString();

			//System.out.println(part);

			String[] partArray = part.split("");
			int currentCount = 0; 

			for(int k = 0; k < tArray.length; k++){

				if(!partArray[k].equals(tArray[k])){
					//System.out.println("P:"+ partArray[k] +"  " + "T:" + tArray[k]);
					currentCount ++;
					//System.out.println(currentCount);
				}
			}

			count =  currentCount < count ? currentCount : count;  
			// if(currentCount < count){
			// 	count = currentCount;
			// }
			//System.out.println(count);		
		}
		System.out.println(count);
		sc.close();	
	}
}


Measured memory_bytes: 55964
#include<stdio.h>
#include<math.h>

typedef struct {
  double x, y;
} Point;

void print(Point point){ printf("%.8f %.8f\n", point.x, point.y); }

void plot(int n, Point point1, Point point2){
  Point s, t, u;
  double th = 60.0*(acos(-1)/180.0);
  if ( n == 0 ) return;
  s.x = (2.0 * point1.x + 1.0 * point2.x)/3.0;
  s.y = (2.0 * point1.y + 1.0 * point2.y)/3.0;
  t.x = (1.0 * point1.x + 2.0 * point2.x)/3.0;
  t.y = (1.0 * point1.y + 2.0 * point2.y)/3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y ) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y ) * cos(th) + s.y;

  plot(n-1, point1, s);
  print(s);
  plot(n-1, s, u);
  print(u);
  plot(n-1, u, t);
  print(t);
  plot(n-1, t, point2);
}

int main(){
  Point point1, point2;
  int n;
  scanf("%d",&n);

  point1.x = 0;
  point1.y = 0;
  point2.x = 100;
  point2.y = 0;
  print(point1);
  plot(n, point1, point2);
  print(point2);

  return 0;
}


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

int main() {
    int n;
    cin >> n;
    int c = 0;
    int x = 0;
    for(int i=0; i<n; ++i) {
        int a;
        cin >> a;
        if(a%2!=0) c++;
        if(a%4==0) x++;
    }
    if(c==0) cout << "Yes" << endl;
    else {
        if(x>=c) cout << "Yes" << endl;
        else if(n%2!=0&&x+1>=c) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 384