akhauriyash/Code-Regression huggingface dataset:
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   
int a[123456];
int main(){
    std::ios::sync_with_stdio(false);
    int n,i,odd=0,four=0,even=0;
    cin>>n;
    rep(i,n){
    	cin>>a[i];
    	if(a[i]%2==1){
    		odd++;
    	}
    	else if(a[i]%4==0){
    		four++;
    	}
    	else
    		even++;
    }
    if(even==0){

    	if(odd<=four+1){
    		cout<<"Yes"<<endl;
    	}
    	else{
    		cout<<"No"<<endl;
    	}
    }
    else{
    	if(odd<=four){
    		cout<<"Yes"<<endl;
    	}
    	else{
    		cout<<"No"<<endl;
    	}
    }

    return 0;      

}



Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//




int main() {

    int N; cin >> N;
    int a[N], b[N]; rep(i,N) cin >> a[i] >> b[i];

    bool ok = false;
    rep(i,N-2) {
        if (a[i] == b[i] && a[i+1] == b[i+1] && a[i+2] == b[i+2]){
            ok = true;
        }
    }

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

    return 0;
}





Measured memory_bytes: 3672
#include<iostream>
#include<algorithm>
#include<sstream>
#include<stack>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
#include<deque>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < n;i++)
#define req(i,n) for(int i = 1;i <= n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a)  (a).begin(),(a).end()
#define fix  fixed << setprecision(10)
const int MOD = 1000000007;
const ll INF = (1LL << 60);
string s; ll n, m,k,q, ans, sum = 0;
vector<ll> cnt(100010,0);
int main() {
    cin >> n >> m;
    rep(i, n) {
        cin >> k >> q;
        cnt[k] += q;
    }
    req(i,cnt.size()) {
        if (m <= cnt[i]) {
            cout << i << endl;
            return 0;
        }
        m -= cnt[i];
    }
}

Measured memory_bytes: 1152
#include<stdio.h>

#include<string.h>

int a[13], vis[13], flag;

void dfs(int x, int l, int r)
{

    int i;

    if(x == 11) return; 

    if(flag) return ;

    if(a[x] > l) dfs(x + 1, a[x], r);

    else  if(a[x] > r) dfs(x + 1, l, a[x]);

    else  {flag = 1; return;}
}

int main()

{

	int T, i, j, k;

	scanf("%d", &T);

	while(T--)

	{

		flag = 0;

		for(i = 1; i <= 10; i++)

		scanf("%d", &a[i]);

		memset(vis, 0, sizeof(vis));

		dfs(1, 0, 0);

		if(flag) printf("NO\n");

		else printf("YES\n");

	}

return 0;

}

Measured memory_bytes: 1008
function Main(input) {
  input = input.trim()
  input = input.split(" ");
  if(input[0]*input[1]>input[2]*input[3]){
    console.log(input[0]*input[1])
  }else{
    console.log(input[2]*input[3]);
  }

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long p = sc.nextInt();

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

    void run() {

        char[] s = sc.next().toCharArray();

        long ans = 0;

        long sumMod = 0;

        Map<Long, Long> map = new HashMap<>();

        map.put((long)0, (long)1);

        if (p == 2 || p == 5) {
            for (int i=n-1; 0<=i; i--) {
                if ((s[i]-'0') % p == 0) ans += i + 1;
            }

            System.out.println(ans);
            return;
        }

        for (int i=n-1; 0<=i; i--) {
            long tmp = s[i] - '0';
            tmp *= modPow(10, n-1-i);
            tmp %= p;
            sumMod += tmp;
            sumMod %= p;
            if (map.containsKey(sumMod)) {
                map.put(sumMod, map.get(sumMod)+(long)1);
            } else {
                map.put(sumMod, (long)1);
            }
        }

//        System.out.println(map);

        for (Long t: map.values()) {
            ans += t * (t - 1) / 2;
        }

        System.out.println(ans);

//        if (map.get((long)0) == null) {
//            System.out.println(ans);
//        } else {
//            System.out.println(ans + map.get((long)0));
//        }


    }

    long modPow(long x, long n) {
        long sum = 1;
        while (n > 0) {
            if ( (n & 1) == 1 ) {
                sum *= x;
                sum %= p;
            }
            x *= x;
            x %= p;
            n >>= 1;
        }
        return sum % p;
    }
}


Measured memory_bytes: 46284
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <numeric>
#include <limits>
#include <utility>
using namespace std;
typedef long long longlong;
typedef long long LL;

int main(void) {
	/*int i, j = 0, n, ans, l = 0, r = 0, s = 0;
	string a, b, c;
	cin >> n;
	cin >> a;
	for (i = 0; i < n; i++) {
		if (a[i] == '(') {
			for (j = max(i,j); j < n; j++) {
				if (a[j] == ')') {
					s++;
					break;
				}
			}
		}
		if (a[i] == '(')l++;
		if (a[i] == ')')r++;
	}
	r -= s; l -= s;
	for (i = 0; i < r; i++)b += '(';
	for (i = 0; i < l; i++)c += ')';
	b += a;
	b += c;
	cout << b << endl;*/

	LL n, i, j, k, mi = 0, ma = 0;
	vector<int> c(8);
	cin >> n;
	vector<LL> a(n);
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (i = 0; i < n; i++) {
		if (a[i] >= 1 && a[i] <= 399 && c[0] < 1)c[0]++;
		if (a[i] >= 400 && a[i] <=799  && c[1] < 1)c[1]++;
		if (a[i] >= 800 && a[i] <= 1199 && c[2] < 1)c[2]++;
		if (a[i] >= 1200 && a[i] <= 1599 && c[3] < 1)c[3]++;
		if (a[i] >= 1600 && a[i] <= 1999 && c[4] < 1)c[4]++;
		if (a[i] >= 2000 && a[i] <= 2399 && c[5] < 1)c[5]++;
		if (a[i] >= 2400 && a[i] <= 2799 && c[6] < 1)c[6]++;
		if (a[i] >= 2800 && a[i] <= 3199 && c[7] < 1)c[7]++;
		if (a[i] >= 3200)ma++;
	}
	for (i = 0; i < 8; i++)mi += c[i];
	if (mi == 0 && ma > 0) {
		cout << 1 << " " << ma << endl;
	}
	else {
		cout << mi << " " << ma + mi << endl;
	}

	return 0;
}

Measured memory_bytes: 256
N = int(input())
t = a = 1
for i in range(N):
    T, A = map(int, input().split())
    tb = (t + T - 1) // T
    ab = (a + A - 1) // A
    b = max(tb, ab)
    t = T * b
    a = A * b
print(t+a)

Measured memory_bytes: 38768
#include<iostream>
using namespace std;
int main(){
    int n, m, sum=0;
    
    cin >> n >> m;
    
    int a[n][m], b[m];
    
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a[i][j];
        }
    }
    
    for(int j=0;j<m;j++){
        cin >> b[j];
    }
    
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            sum += a[i][j]*b[j];
        }
        cout << sum << endl;
        sum = 0;
    }
    
    return 0;
}


Measured memory_bytes: 3112
import java.io.*;

public class Main{
    public static void main(String[]args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        while(true){
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int w = Integer.parseInt(str[1]);
            StringBuilder sb = new StringBuilder();

            if( h == 0 && w == 0)break;
            for(int i=1; i<=h; i++){
                if( i % 2 != 0 ){
                    for(int k=1; k<=w; k++){
                        if( k % 2 != 0 ){
                            sb.append("#");
                        }else{
                            sb.append(".");
                        }
                    }
                    sb.append("\n");
                }else{
                    for(int k=1; k<=w; k++){
                        if( k % 2 == 0 ){
                            sb.append("#");
                        }else{
                            sb.append(".");
                        }
                    }
                    sb.append("\n");
                }
            }
            System.out.println(sb);
        }

    }
}

Measured memory_bytes: 25580
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

int n, a[105];
ll dp[105][2];

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> n;
    dp[0][1] = 1;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        if (a[i] % 2 == 0) {
            dp[i][0] += dp[i - 1][0] + dp[i - 1][1];

            dp[i][0] += 2 * dp[i - 1][0];
            dp[i][1] += 2 * dp[i - 1][1];
        } else {
            dp[i][0] += 2 * (dp[i - 1][0] + dp[i - 1][1]);

            dp[i][0] += dp[i - 1][0];
            dp[i][1] += dp[i - 1][1];
        }
    }
    cout << dp[n][0] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std; typedef long long ll;
int main() {
  ll n,a,b; cin>>n>>a>>b; ll h[n]; for(int i=0;i<n;i++) cin>>h[i];
  ll ng=0,ok=1e9;
  while(ok-ng>1) {
    ll md=(ng+ok)/2LL, lf=md;
    for(int i=0;i<n;i++) {
      ll x=h[i]-md*b;
      if (x>0) lf-=x/(a-b);
      if (x>0 && x%(a-b)!=0) lf--;
    }
    if (lf<0) ng=md; else ok=md;
  }
  cout<<ok<<endl;
}

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

int main()
{
    ll S;
    cin >> S;
    ll s = S % 60;
    ll m = S / 60 % 60;
    ll h = S / 60 / 60;
    cout << h << ":" << m << ":" << s << endl;
    return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1000000007;
const long long INF = 1LL << 60;
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n,m;
    cin>>n>>m;
    VI l(m);
    VI r(m);
    int mal=0;
    int mar=10000000;
  
    rep(i,m){
        cin>>l[i]>>r[i];
        mal = max(mal,l[i]);
        mar = min(mar,r[i]);
    }
    if(mal <= mar){
        cout << mar - mal + 1 << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 1792
// Try DPC 5
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    let mut xs = vec![];
    let mut sum = 0;
    for _ in 0..n {
    	let a = get!();
        sum += a;
        xs.push(a * n);
    }
    let mut ys = vec![];
    for i in 0..xs.len() {
    	ys.push(((xs[i]-sum).abs(), i));
    }
    ys.sort();
    println!("{}", ys[0].1);
    
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ll infll=(1ull<<63)-1,mod=1e9+7;
const int inf=(1ull<<31)-1;
int a,b;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(18);
	cin>>a>>b;
	cout<<max({a+b,a-b,a*b});
	return 0;
}


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

int main()
{
    int a,b;
    cin >>a>>b;
    stringstream ss;
    stringstream s2;
    ss << a;
    s2 << b;
    string as = ss.str();
    string bs = s2.str();
    string temp = as;
    string temp2 = bs;
    for(int i = 1; i < b; i++){
        as += temp;
    }
    for(int i = 1; i < a; i++){
        bs += temp2;
    }
    cout << min(as,bs);
    return 0;
}


Measured memory_bytes: 256
//g++  7.4.0

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAXN 200005
#define MOD 1000000007
vector<ll> adj[MAXN];
ll vis[MAXN];
ll sz = 0;

ll solve(string a,string b)
{
    ll count = 0;
    for(ll i=0;i<a.length();++i)
    {
        if(a[i] != b[i])
            count++;
    }
    
    return(count);
}

void DFS(ll s)
{
    vis[s] = 1;
    sz++;
    for(auto it: adj[s])
    {
        ll v = it;
        
        if(!vis[v])
            DFS(v);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll N,M; cin>>N>>M;
    
    for(ll i=0;i<M;++i)
    {
        ll u,v; cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    
    ll ans = 0;
    for(ll i=1;i<=N;++i)
    {
        if(!vis[i])
        {
            sz = 0;
            DFS(i);
            ans = max(ans,sz);
        }
    }
    
    cout<<ans<<endl;
}

Measured memory_bytes: 22392
S = input()
counts =[0] * 2019
counts[0] = 1
num, d = 0,1

for s in S[::-1]:
  num += int(s) *d
  d *= 10
  num %= 2019
  d %= 2019
  counts[num] += 1

ans = 0
for count in counts:
  ans += count * (count - 1) //2
print(ans)

Measured memory_bytes: 9272
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <string>
#include <deque>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <assert.h>
#include <sstream>
typedef long long ll;
#define vi vector<int>
using namespace std;

int dX[4] = { 0, 0, -1, 1 };
int dY[4] = { -1, 1, 0, 0 };

int N, K;
const int MOD = 998244353;
const int mxn = 200000;
const int mxk = 10;
int L[mxk], R[mxk];
ll dp[mxn];
int main() {
	cin >> N >> K;
	for (int k = 0; k < K; k++) {
		cin >> L[k] >> R[k];
		R[k]++;
	}
	for (int i = 0; i < N; i++) {
		dp[i] = 0;
	}
	dp[0] = 1; dp[1] = MOD - 1;
	for (int i = 0; i < N; i++) {
		if (i > 0) {
			dp[i] = (dp[i] + dp[i - 1] + MOD) % MOD;
		}
		for (int k = 0; k < K; k++) {
			int l = L[k];
			int r = R[k];
			if (i + l < N) {
				dp[i + l] = (dp[i + l] + dp[i] + MOD) % MOD;
			}
			if (i + r < N) {
				dp[i + r] = (dp[i + r] - dp[i] + MOD) % MOD;
			}
		}
	}
	cout << dp[N - 1] << '\n';
}


Measured memory_bytes: 5132
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
using namespace std;
int a,b;
int main(){
	cin>>a>>b;
	if (abs(a-b)%2!=0) cout<<"IMPOSSIBLE";
	else cout<<abs(a+b)/2;
} 

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

public class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        int a=fsc.nextInt();
        int b=fsc.nextInt();
        fsc.close();
        System.out.println(a<10&&b<10?a*b:-1);
        
    }
    static class FastScanner {
        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() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; 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 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();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


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

string s;

int main()
{
	cin>>s;
	for(int i=0;i<s.size() ;i++)
	{
		if(s[i]=='9')
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

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

int main(void){
    int n, x;
    cin >> n >> x;
    vector<int> m(n);
    for (int i=0; i<n; i++) cin >> m[i];
    int sum = accumulate(m.begin(), m.end(), 0);
    sort(m.begin(), m.end());
    cout << n + (x-sum) / m[0] << endl;
    return 0;
}

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

#define mod 1000000007

// iの階乗 = fact[i], main内の階乗計算をする必要がある
#define MAX_FACT 200100
ll fact[MAX_FACT];

int main() {
    ll N;
    string S;
    cin >> N >> S;

    // 階乗計算
    fact[0]=1;
    for(int i = 1; i < MAX_FACT; ++i) {
        fact[i] = fact[i-1] * i % mod;
    }

    ll ans = 1;
    ll t = 0;
    for (int i = 0; i < 2*N; ++i) {
        if(t == 0){
            if(S[i] == 'W'){
                cout << 0;
                return 0;
            } else{
                t++;
            }
        } else if(t % 2 == 0){
            if(S[i] == 'W'){
                ans *= t;
                ans %= mod;
                t--;
            } else{
                t++;
            }
        } else{
            if(S[i] == 'W'){
                t++;
            } else{
                ans *= t;
                ans %= mod;
                t--;
            }
        }
    }
    if(t != 0){
        cout << 0;
        return 0;
    }
    ans = ans * fact[N] % mod;
    cout << ans;
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  int a = n % 10;
  int b = n / 10;
  if(a == 9 || b == 9) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
S = input()
num1 = S[:2]
num2 = S[2:]
if 0 < int(num1) <= 12 and 0 < int(num2) <= 12:
    print("AMBIGUOUS")
elif 0 <= int(num1) <= 99 and 0 < int(num2) <= 12:
    print("YYMM")
elif 0 < int(num1) <= 12 and 0 <= int(num2) <= 99:
    print("MMYY")
else:
    print("NA")

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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);

template <class T, class S>
using umap = std::unordered_map<T, S>;
using ll = long long;
using namespace std;

int main() {
    ll x, y, z;

    cin >> x >> y >> z;
  
  	cout << z << " " << x << " " << y << endl;

    return 0;
}

Measured memory_bytes: 256
#
import sys
import math
import numpy as np
import itertools

# いくつか入力
h,w = (int(i) for i in input().split())  

# 2次元配列
grid = []
for i in range(h):
    array = list(input())
    grid.append(array)
b = np.array(grid)
b = np.where(b == ".", 1, 0)

a1 = np.zeros((h,w), dtype=np.int)
a2 = np.zeros((h,w), dtype=np.int)
a3 = np.zeros((h,w), dtype=np.int)
a4 = np.zeros((h,w), dtype=np.int)
#print(b)

for i in range(1,h):
    a1[i] += (a1[i-1]+1)*b[i-1]

for i in range(h-2,-1,-1):
    a2[i] += (a2[i+1]+1)*b[i+1]

for i in range(1,w):
    a3[:, i] += (a3[:, i-1]+1)*b[:, i-1]

for i in range(w-2,-1,-1):
    a4[:, i] += (a4[:, i+1]+1)*b[:, i+1]

#print(a1,a2,a3,a4)

answer = ( (a1+a2+a3+a4)*b ).max()

print(answer+1)



Measured memory_bytes: 266468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second

const int INF = 1e9+5;


int main() {
	ll n, w;
	cin >> n >> w;
	vector<int> we(n), v(n);
	forn(i, n) cin >> we[i] >> v[i];
	int sum = 0;
	for(int x : v)
		sum += x;
	vector<vector<ll>> dp(n+1, vector<ll>(sum+1, INF));
	dp[0][0] = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 0; j <= sum; j++){
			if(j - v[i-1] >= 0)
				dp[i][j] = min(dp[i-1][j], dp[i-1][j-v[i-1]]+we[i-1]);
			else dp[i][j] = dp[i-1][j];
		}
	}
	
	int ans = 0;
	for(int i = 0; i <= sum; i++){
		if(dp[n][i] <= w)
			ans = max(ans, i);
	}
	cout << ans << endl;
	return 0;

}



Measured memory_bytes: 80256
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.charset.StandardCharsets;
//给出两个数a,b 求出[a,b]中各位数字之和能整除原数的数的个数。
public class Main {

    int mod ;
    void solve(int[] arr) {
        for(int i=0;i<arr.length;i++){
            if(arr[i]==0){
                System.out.println((i+1));
            }
        }

    }


    public static void main(String[] args)  throws IOException {
        // Use the Scanner class

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[]  s = br.readLine().split(" ");
        Main test = new Main();
//
//        int n = Integer.parseInt(s[0]);
//        int w = Integer.parseInt(s[1]);
//        int[] volumn = new int[n];
//        int[] values = new int[n];
//        for(int i=0;i<n;i++) {
//            s = br.readLine().split(" ");
//            volumn[i] = Integer.parseInt(s[0]);
//            values[i] = Integer.parseInt(s[1]);
//        }
        int[] arr = new int[5];
        for(int i=0;i<5;i++){
            arr[i] = Integer.parseInt(s[i]);
        }
        test.solve(arr);
        //int tot = Integer.parseInt(br.readLine());


//        int i =1;
//        System.out.println();
//        while(tot>0){
//
//            String s = br.readLine();
//            String[] sr = s.split(" ");
//            List<Long> ls = new ArrayList<>();
//            for(String ss:sr){
//                ls.add(Long.parseLong(ss));
//            }
//            Main tt = new Main();
//            tt.sol(ls);
//            // String Buffer to store answer
//            StringBuffer sb = new StringBuffer();
////            Solution obj = new Solution();
////
////            System.out.println("Case #"+i+": "+obj.sol());
//            tot--;
//            i++;
//        }
    }

}


Measured memory_bytes: 32380
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    int N;
    cin >> N;
    vector<ll> p(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> p[i];
    }
    sort(p.begin(), p.end(), greater<ll>());
    ll ans = 0;
    ans += p[0]/2;
    for ( int i = 1; i < N; i++ ) {
        ans += p[i];
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int gcd(int x, int y)
{
	if (x > y)
	{
		swap(x, y);
	}
	return x ? gcd(x, y % x) : y;
}

int main()
{
	int n;
	
	vector<int> a;
	for (cin >> n; n--; )
	{
		int x;
		cin >> x;

		a.push_back(x);
	}
	
	for (;;)
	{
		vector<int> b;
		for (int i = 1; i <= a.size(); i += 2)
		{
			if (i == a.size())
			{
				b.push_back(a.at(i - 1));
			}
			else
			{
				int g = gcd(a.at(i - 1), a.at(i));
				b.push_back(a.at(i - 1) / g * a.at(i));
			}
		}


		if (b.size() == 1)
		{
			cout << b.at(0) << endl;
			break;
		}

		a.clear();
		a = b;
	}
}


Measured memory_bytes: 3164
def BFS(K,edges,N):
  INF = 10**10
  roots=[ [] for i in range(N)]
  for a,b in edges:
    roots[a-1]+=[b-1]
    roots[b-1]+=[a-1]
  dist=[INF]*N
  pre = [-1]*N
  stack=[]
  stack.append(K)
  dist[K]=0
  while stack:
    label=stack.pop(0)
    for i in roots[label]:
      if dist[i]==INF:
        dist[i]=dist[label]+1
        pre[i]=label
        stack+=[i]

  return pre
 
N,M=map(int,input().split())
edges=[]
for i in range(M):
  edges+=[list(map(int,input().split()))]


ans=BFS(0,edges,N)
print("Yes")
for i in range(1,N):
  print(ans[i]+1)

Measured memory_bytes: 70852
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N){
        cin >> A.at(i);
        }
        ll maximam=A.at(0);
        ll minimam=A.at(0);
        
        rep(i,N){
            maximam=max(A.at(i),maximam);
            minimam=min(A.at(i),minimam);
        }
        cout << maximam-minimam << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ONLINE_JUDGE
 
#define V vector
#define P pair
 
using LL = long long;
#define FOR(i, x, y) \
    for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) \
    for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifndef ONLINE_JUDGE
#define dbg(x...)                             \
    do {                                      \
        cerr << "\033[32;1m" << #x << " -> "; \
        err(x);                               \
    } while (0)
void err() { cerr << "\033[39;0m" << endl; }
template <template <typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) {
    for (auto v : a) cerr << v << ' ';
    err(x...);
}
template <typename T, typename... A>
void err(T a, A... x) {
    cerr << a << ' ';
    err(x...);
}
#else
#define dbg(...)
#endif
#define sz(x) (int)x.size()
 
LL bin(LL a, LL b, LL p) {
    LL res = 1;
    a = (a % p + p) % p;
    for (; b; b >>= 1, a = a * a % p)
        if (b & 1) res = res * a % p;
 
    return res;
}
#define int long long
 
const int N = 105, M = 10055;
 
int n;
struct E {
    int to, w, cost;
    E(int to=0, int w=0, int cost=0):to(to), w(w), cost(cost) {};
};
 
V<E> G[N];
int c[N], d[N];
 
int m, s;
 
struct node {
    int u, s;
    LL t;
    node(int u=0, int s=0, LL t=0):u(u), s(s), t(t) {}
    bool operator>(const node &other) const { return t > other.t; }
};
 
LL dis[N+10][M + 10];
 
void solve() {
    scanf("%lld%lld%lld", &n, &m, &s);
    for (int i = 1; i <= m; ++i) {
        int u, v, a, b;
        scanf("%lld%lld%lld%lld", &u, &v, &a, &b);
        G[u].emplace_back(v, b, a);
        G[v].emplace_back(u, b, a);
    }
    for (int i = 1; i <= n; ++i) {
        scanf("%lld%lld", &c[i], &d[i]);
        memset(dis[i], 0x3f3f3f3f, sizeof dis[i]);
    }
    s = min(s, M - 1);
    // queue<node> q;
    priority_queue<node, vector<node>, greater<node>> q;
    q.emplace(1, s, 0);
    dis[1][s] = 0;
    int cnt = 0;
    while (!q.empty()) {
        auto now = q.top();
        q.pop();
        if (now.t > dis[now.u][now.s]) continue;
        int u = now.u;
        dbg(now.u, now.s, now.t);
        ++cnt;
            int ns = min(M-1, now.s + c[u]);
            if (dis[u][ns] > now.t + d[u]) {
                dis[u][ns] = now.t + d[u];
                q.emplace(u, ns, now.t + d[u]);
            }
        
        for (const auto &e : G[now.u]) {
            int v = e.to, w = e.w, cost = e.cost;
            int cnt = 0;
            int ns = now.s - cost;
            if (ns >= 0 && dis[v][ns] > now.t + w) {
                dis[v][ns] = now.t + w;
                q.emplace(v, ns, now.t + w);
            }
        }
    }
    for (int i = 2; i <= n; ++i) {
        LL ans = 1e18;
        for (int j=0; j<M; ++j) {
            if (dis[i][j] < ans)
                ans = dis[i][j];
        }
        printf("%lld\n", ans);
    }
    dbg(cnt);
}
 
signed main() {
    // int t;
    // cin >> t;
    // while (t--) solve();
 
    solve();
 
    return 0;
}

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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
#define rep2(i, startValue, N) for (int i = (int)(startValue); i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double
#define DUMP(v) "," #v ":" << v


// ABC159 D - Banned K
int main(){
  ll n;
  cin >> n;
  vector<ll> a(n,0);
  unordered_map<ll, ll> nummap; // 数値->個数
  rep(i,n) {
    cin >> a[i];
    nummap[a[i]]++;
  }

  // 計算が不要な要素を除去する
  for(auto itr = nummap.begin(); itr != nummap.end();) {
    if (itr->second <= 1) {
      itr = nummap.erase(itr);
    } else {
      ++itr;
    }
  }

  // 全通りを1回計算しておく
  ll maxtotal = 0;
  {
    for(const auto& p:nummap) {
      const ll num = p.second;
      maxtotal += num * (num-1) / 2;
    }
  }

  unordered_map<ll, ll> cache; // 数値 -> 結果

  rep(i,n) {
    const ll target = a[i];
    const auto itr = cache.find(target);
    ll total = 0;
    if (itr == cache.end()) {
      total = maxtotal;
      const ll num = nummap[target];
      total -= num * (num-1) / 2;
      if (num >= 2) {
        total += (num-1) * (num-2) / 2;
      }
      cache[target] = total;
    } else {
      total = cache[target];
    }
    cout << total << endl;
  }
  return 0;
}


Measured memory_bytes: 17672
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;




// a^n mod を計算する
long int modpow(long int a, long int n, long int mod) {
    long int res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}

long int modcomb(long int a, long int b, long int mod){
    long int res = 1;
    for(long int i = a; i > a - b; i--){
        res *= i % mod;
        res %= mod;
    }
    res %= mod;
    for(long int i = 1; i <= b; i++){
        long int i_inv = modpow(i, mod - 2, mod);
        res *= i_inv % mod;
        res %= mod;
    }
    res %= mod;
    // cout << res << endl;
    return res;
}



int main(){
    ll n, m, k;
    cin >> n >> m >> k;
    ll mod = 1000000007;
    ll combx = modcomb(n * m - 2, k - 2, mod);
    ll comby = modcomb(n * m - 2, k - 2, mod);
    ll ans = 0;
    rep(i, n){
        ans += (((((i * (n - i)) % mod) * m) % mod * m) % mod) * combx;
        ans %= mod;
    }
    rep(i, m){
        ans += (((((i * (m - i)) % mod) * n) % mod * n) % mod) * comby;
        ans %= mod;
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b, c;
    
    cin >> a >> b >> c;
    
    if (a <= c && c <= b) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double INF=1e+10;
const long double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int solve(long long a,long long b){
	if(a==1)return 0;
	int ret=0;
	while(b%a==0){
		b/=a;
		if(b%a==1)ret++;
	}
	return ret;
}
int main(){
	long long a;scanf("%lld",&a);
	int ret=0;
	for(long long i=1;i*i<=a;i++){
		if(a%i==0){
			ret+=solve(i,a);
			if(i!=a/i)ret+=solve(a/i,a);
		}
	}
	a--;
	for(long long i=1;i*i<=a;i++){
		if(a%i==0){
			if(i>1)ret++;
			if(i!=a/i)ret++;
		}
	}
	
	printf("%d\n",ret);
}

Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var (
		n int
		q int
		s string
		l int
		r int
	)

	fmt.Scan(&n, &q)
	acCnt := make([]int, n)

	fmt.Scan(&s)

	for i := 1; i < n; i++ {
		acCnt[i] = acCnt[i-1]
		if s[i-1] == 'A' && s[i] == 'C' {
			acCnt[i]++
		}
	}

	for i := 0; i < q; i++ {
		fmt.Scan(&l, &r)

		fmt.Println(acCnt[r-1] - acCnt[l-1])
	}
}


Measured memory_bytes: 7812
import java.util.HashSet;
import java.util.Scanner;


public class Main {
	static Scanner InData = new Scanner(System.in);
	static HashSet<Integer> S = new HashSet<Integer>();
	
	public static void main(String[] args) {
		getQuery();
	}

	private static void getQuery() {
		int qNum = InData.nextInt();
		int qType, qVal;
		for(int indexOfQuery = 0; indexOfQuery < qNum; indexOfQuery++) {
			qType = InData.nextInt();
			qVal = InData.nextInt();;
			doQuery(qType, qVal);
		}
	}

	private static void doQuery(int type, int val) {
		switch(type) {
		case 0:
			S.add(val);
			System.out.println(S.size());
			break;
		case 1:
			System.out.println(S.contains(val) ? 1 : 0);
			break;
		}
	}
}



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

const int maxn = 200010;

int a[maxn]; int n;
int b[maxn];

int main()
{
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) b[i/2] = a[n-i-1];
    else b[n-i/2-1] = a[n-i-1];
  }
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll max_N = 105, max_K = 1e5 + 50, MOD = 1e9 + 7;
ll N, K, arr[max_N], DP[max_N][max_K];

int main()
{
    cin >> N >> K;
    for (int i = 0; i < N; ++i)
        cin >> arr[i];
    DP[0][0] = 1;
    ll dp_presum[max_K];
    for (int j = 0; j <= arr[0]; ++j)
        DP[0][j] = 1;
    dp_presum[0] = DP[0][0];
    for (int j = 1; j < max_K; ++j)
        dp_presum[j] = dp_presum[j - 1] + DP[0][j];
    for (int i = 1; i < N; ++i)
    {
        for (int j = 0; j <= K; ++j)
        {
            DP[i][j] = dp_presum[j];
            if (j > arr[i])
                DP[i][j] = (DP[i][j] - dp_presum[j - arr[i] - 1] + MOD) % MOD;
        }
        dp_presum[0] = DP[i][0];
        for (int j = 1; j < max_K; ++j)
            dp_presum[j] = (dp_presum[j - 1] + DP[i][j]) % MOD;
    }
    cout << DP[N - 1][K] << "\n";
}

Measured memory_bytes: 82484
// atcoder/abc142/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, k;
  while (cin >> n >> k) {
    vector<int> v(n);
    cin >> v;
    int cnt = 0;
    each (i, v) cnt += (k <= i);
    cout << cnt << endl;
  }

  return 0;
}


Measured memory_bytes: 640
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
def ceil(x,y):
  return (x-1)//y+1
h,w = map(int,input().split())
if h == 1 or w == 1:
  print(1);exit()
yoko = ceil(w,2)
yokoteki = w-ceil(w,2)
ans += yoko * ceil(h,2)
ans += yokoteki * (h-ceil(h,2))
print(ans)

Measured memory_bytes: 38460
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>


using namespace std;


long gcda(long x, long y)
{
    long r;

    if(x == 0 || y == 0)  
    {
        return 0;
    }

    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

int main(){

	long N, S;

	cin >> N >> S;
	long x[N];

	for(long i=0;i<N;i++){
		cin >> x[i];
	}

	sort(x, x+N);

	long less =-1, more=-1, ans = 1000000001;

	for(int i=0; i<N; i++){
		ans = min(ans, abs(x[i] - S));
	}

	for(int i=1; i<N; i++){
		ans = gcda(ans,x[i] - x[i-1]);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF (1<<30)
#define MOD 1000000007
#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 all(x) (x).begin(),(x).end()
int main(){
    int m;
    cin>>m;
    cout<<48-m<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
cl = []
sl = []
fl = []

for _ in range(n-1):
    c,s,f = map(int,input().split())
    cl += [c]
    sl += [s]
    fl += [f]

        

for i in range(n):
    time = 0
    while True:
        if i==n-1:
            print(time)
            break
        if sl[i]<=time and time%fl[i]==0:
            time += cl[i]
        elif sl[i]>time:
            time = sl[i] +cl[i]
        else: #sl[i]<=time and time%fl[i]!=0
            time += fl[i] - time%fl[i] +cl[i]
        i += 1
    



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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> h(n);
  vector<int> y(n,1);
  for(int i=0;i<n;i++){
    cin >> h.at(i);
  }
  vector<int> a(m),b(m);
  for(int i=0;i<m;i++){
    cin >> a.at(i) >> b.at(i);
    if(h.at(a.at(i)-1)==h.at(b.at(i)-1)){
      y.at(a.at(i)-1)=0;
      y.at(b.at(i)-1)=0;
    }else if(h.at(a.at(i)-1)>h.at(b.at(i)-1)){
      y.at(b.at(i)-1)=0;
    }else{
      y.at(a.at(i)-1)=0;
    }
  }
  int ans=0;
  for(int i=0;i<n;i++){
    ans+=y.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 4844
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        pys: [(i64, i64); m],
    }
    let mut v = vec![];
    for _ in 0..n {
        v.push(std::collections::BTreeMap::new());
    }
    for (i, &(p, y)) in pys.iter().enumerate() {
        v[(p - 1) as usize].insert(y, (p, i, y, None));
    }
    for v in v.iter_mut() {
        for (i, v) in v.values_mut().enumerate() {
            v.3 = Some(i + 1);
        }
    }
    let ans = pys
        .iter()
        .map(|&(p, y)| {
            let (p, _i, _y, number) = v[(p - 1) as usize][&y];
            format!("{:06}{:06}", p, number.unwrap())
        })
        .collect::<Vec<_>>()
        .join("\n");
    println!("{}", ans);
}


Measured memory_bytes: 89596
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
using ll = long long;

const long double PI = acos(-1.0);
const int MOD = 1e9 + 7;

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

    int all;
    int a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    all = a[0];
    for(int i = 1; i < n; i++) {
        all ^= a[i];
    }

    for(int i = 0; i < n; i++) {
        int ans = all ^ a[i];
        cout << ans << ' ';
    }
    cout << endl;

    /*
    int a = 3 ^ 5;
    cout << a << endl;
     */



    return 0;
}

Measured memory_bytes: 4276