akhauriyash/Code-Regression huggingface dataset:
#include<iostream>                                                                                                                                
#include<stdio.h>                                                                                                                                 
using namespace std;                                                                                                                              
                                                                                                                                                  
int main()                                                                                                                                        
{                                                                                                                                                 
        int n;                                                                                                                                    
        scanf("%d", &n);                                                                                                                          
        int h, h0 = 0, cnt = 0;                                                                                                                   
        for (int i = 1; i <= n; i++)                                                                                                              
        {                                                                                                                                         
                scanf("%d", &h);                                                                                                                  
                if (h >= h0) {                                                                                                                    
                        cnt++;                                                                                                                    
                        h0 = h;                                                                                                                   
                }                                                                                                                                 
        }                                                                                                                                         
        printf("%d", cnt);                                                                                                                        
        return 0;                                                                                                                                 
}

Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let mut X = read![[i64]];
    X.sort();

    // xxy or xyy
    let ok = (X[0] == X[1] && X[0] != X[2]) || (X[0] != X[1] && X[1] == X[2]);

    println!("{}", if ok { "Yes" } else { "No" })
}


Measured memory_bytes: 4352
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}

string s[2001];
int c[2001][2001];

int main(int argc, char const* argv[])
{
  int h, w;
  cin >> h >> w;
  rep(i, h)cin >> s[i];
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w - 1; j++){
      if(i == 0){c[i][j] = 1; continue;}
      bool p = (s[i][j] == s[i][j+1]) == (s[i-1][j] == s[i-1][j+1]);
      c[i][j] = p ? c[i-1][j] + 1: 1;
    }
    c[i][w - 1] = 0;
  }
  ll res = max(h, w);
  for(int i = 0; i < h; i++){
    stack<P> st;
    for(int j = 0; j < w; j++){
      if(st.empty()){
        st.push(mk(c[i][j], j));
      }else{
        if(st.top().first < c[i][j]){
          st.push(mk(c[i][j], j));
        }else if(st.top().first > c[i][j]){
          int pos = j;
          int target = j;
          while(!st.empty() && st.top().first >= c[i][j]){
            P p = st.top(); st.pop();
            res = max(res, (ll)p.first * (pos - p.second + 1));
            target = p.second;
          }
          st.push(mk(c[i][j], target));
        }
      }
    }
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 19968
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<=b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

int n;

int main(){
    INIT;
    cin >> n;
    cout << 180 * (n-2);
}

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

long gcd(long a, long b)
{
	return(b?gcd(b,a%b):a);
}

int main(void)
{
	long long x,y;
	while(cin >> x >> y){
	cout << gcd(x,y) << " " << x*y/gcd(x,y)<< endl;
	}
	return(0);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define Mod 1000000007
#define Val(x) (((long long)x) % Mod)
#define maxn 200005
using namespace std;
int fac[maxn];
int Pow(int a,int n) {
	int ret = 1;
	int base = a;
	while(n) {
		if(n&1)	ret = Val(ret*base);
		base = Val(base*base);
		n >>= 1;
	}
	return ret;
}
int cal(int n,int m) {
	return Val(Val(fac[n+m]*Pow(fac[n],Mod-2))*Pow(fac[m],Mod-2));
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	fac[0] = 1;
	for(int i=1;i<maxn;i++)
		fac[i] = Val(fac[i-1] * i);
		
	int n,m,a,b;
	cin >> n >> m >> a >> b;
	
	int ans = 0;
	for(int j=b+1;j<=m;j++)
		ans = Val(ans + Val(cal(n-a-1,j-1)*cal(a-1,m-j)));
	
	cout << ans << endl;
	return 0;
}


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

typedef long long ll;

int max(int a, int b){
  if(a > b) return a;
  else return b;
}
int min(int a, int b){
  if(a < b) return a;
  else return b;
}

int sort(const void *a ,const void *b){
  return *(int*)a - *(int*)b;
}

int main(){

  int n,k;
  scanf("%d %d",&n,&k);

  int h[100001];
  for(int i = 0; i < n ; ++i){
    scanf("%d",h+i);
  }

  qsort(h,n,sizeof(int),sort);

  int ans = 2000000000;
  int tmp = 0;
  for(int i = 0; i < n-k+1; ++i){
     tmp = h[i+k-1] - h[i];
     ans = min(ans,tmp);
  }

  printf("%d",ans);
  return 0;

}


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

int main(){
  int n;
  cin >> n;
  int a = n / 100;
  int b = n % 100;
  if(1 <= a && a <= 12 && 1 <= b && b <= 12){
    puts("AMBIGUOUS");
  }
  else if(a >= 13 && b >= 13){
    puts("NA");
  }
  else if(1 <= a && a <= 12){
    puts("MMYY");
  }
  else if (1 <= b && b <= 12){
    puts("YYMM");
  }
  else{
    puts("NA");
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
 
int main() {
    int N;
    int T; //気温最大値
    int A; //平均気温
    
    cin >> N;
    cin >> T;    
    cin >> A;
    
    vector <int> H(N);
    vector <int> M(N);
    
    for(int i=0; i<N; i++){
        cin >> H.at(i);
        M.at(i) = 0;
     }
    
    for(int i=0; i<N; i++){
        M.at(i) = abs(A*1000 - (T * 1000 - H.at(i) * 6));   
    }
    
    //for(int c : M){
      //  cout << "M=" << c << endl;
    //}
    
    int minElementIndex = min_element(M.begin(), M.end()) - M.begin();
    int minElement = *min_element(M.begin(), M.end());
    
    cout << minElementIndex+1 << endl;
    
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
using namespace std;



int long long solve(int long long n,int long long x){
    if(x==0){return 0;}
    if(n==0){return 1;}
    if(x<=pow(2,n+1)-2) return solve(n-1,x-1);
    return solve(n-1,x-pow(2,n+1)+1)+pow(2,n);
}


int main(){
    int long long a;
    int long long b;
    cin>>a>>b;
    int long long ans =solve(a,b);
    cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair < int, int > pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 305;

int n, m, a[MAXN][MAXN], ans, v[MAXN], cur[MAXN], cnt[MAXN];

inline bool Solve()
{
	int ret = 0;
	for (int i = 1; i <= m; i ++)
		cnt[i] = 0;
	for (int i = 1; i <= n; cnt[a[i][cur[i]]] ++, i ++)
		while (v[a[i][cur[i]]])
			cur[i] ++;
	for (int i = 1; i <= m; i ++)
		ret = max(ret, cnt[i]);
	if (!ret)
		return 0;
	ans = min(ans, ret);
	for (int i = 1; i <= m; i ++)
		if (cnt[i] == ret)
			v[i] = 1;
	return 1;
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	ans = n = Read(), m = Read();
	for (int i = 1; i <= n; i ++)
		for (int j = 1; j <= m; j ++)
			a[i][j] = Read();
	for (int i = 1; i <= n; i ++)
		cur[i] ++;
	while (Solve());
	return printf("%d\n", ans), 0;
}


Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
	static int mod=1000000007;
	static Scanner scan=new Scanner(System.in);
	static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
	static long lcm (long a, long b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
			}
		else {
			return a/b+1;
		}
	}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	static String reverce(String str) {
		String strr="";
		for(int i=str.length()-1;i>=0;i--) {
			strr+=str.charAt(i);
		}
		return strr;
	}
	static long modpow(long a,long n) {
		if(n==0) return 1;
		else if(n==1)return a;
		long tmp=modpow(a,n/2);
		tmp%=mod;
		tmp*=tmp;
		tmp%=mod;
		if(n%2==0)return tmp;
		else return (tmp*a)%mod;
	}
	public static void main(String[] args) {
		int a=scan.nextInt();
		long lcm=1;
		for(int i=0;i<a;i++) {
			int b=scan.nextInt();
			lcm=lcm(b,lcm);
		}
		System.out.println(lcm);
	}
}


Measured memory_bytes: 26208
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned long;
using ULL = unsigned long long;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

    void Solve() {
        double a, b, c; cin >> a >> b >> c;
        c *= 3.14159265358979 / 180.0;
        cout << (0.5 * a * b * sin(c)) << endl;
        cout << (a + b + sqrt(a * a + b * b - 2.0 * a * b * cos(c))) << endl;
        cout << (b * sin(c)) << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    cout << fixed << setprecision(10);
    p->Solve();
    return 0;
}



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

int main(){
  int n, m;
  cin >> n >> m;
  cout << n*(n-1)/2 + m*(m-1)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()

cnts = [0,0,0]
for c in S:
	if c == 'R':
		cnts[0] = cnts[0] + 1 
	if c == 'G':
		cnts[1] = cnts[1] + 1 
	if c == 'B':
		cnts[2] = cnts[2] + 1 

ans = cnts[0] * cnts[1] * cnts[2]

for j in range(1,N-1):
	for i in range(0,j):
		k = j + j - i
		if k >= N:
			pass
		elif S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
			ans = ans - 1

print(ans)

Measured memory_bytes: 9072
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,maximum=0;
    cin>>n;
    map<string,int>m;
    map<string,int>::iterator it;
    for(int i=0;i<n;i++)
    {
        string a;
        cin>>a;
        m[a]++;
        maximum=max(maximum,m[a]);

    }

    for(it=m.begin(); it!=m.end();it++)
    {
        if(it->second==maximum)
            cout<<it->first<<endl;
    }

    exit(0);
}


Measured memory_bytes: 19100
<?php
list($s) = strs();
$cnt = ['a' => 0, 'b' => 0, 'c' => 0];
for ($i = 0; $i < strlen($s); ++$i) ++$cnt[$s[$i]];
echo abs(max($cnt) - min($cnt)) <= 1 ? 'YES' : 'NO';
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}


Measured memory_bytes: 16444
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> T(N);
    int sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> T[i];
        sum += T[i];
    }

    int M;
    cin >> M;
    for (int i = 0; i < M; i++) {
        int P, X;
        cin >> P >> X; P--;
        cout << sum - (T[P] - X) << endl;
    }        
    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
#include <bitset> // bitset
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

ll mod = 1000000007;

int main() {
    int S;
    cin >> S;
    if (S < 3) {
        cout << 0 << endl;
        return 0;
    }
    else if (S < 6) {
        cout << 1 << endl;
        return 0;
    }
    vll data(S + 1, -1);
    data[3] = 1, data[4] = 1, data[5] = 1;
    for (int i = 6; i <= S; i++) {
        data[i] = (data[i - 1] + data[i - 3]) % mod;
    }
    cout << data[S] << endl;
}


Measured memory_bytes: 3632
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

D = i()
c = l()
C = sorted(c)
C.reverse()
rank = [0]*26
ans = [0]*D
for i in range(D):
    s = l()
    ans[i] = s.index(max(s))+1
for i in range(26):
    rank[i] = C.index(c[i])+1
for i in range(26):
    d = D//rank[i]
    for j in range(i,D,d):
        ans[j] = i+1
for i in ans:
    print(i)

Measured memory_bytes: 72832
import math
a=[input() for i in range(5)]
b,c=10,0
for i in range(5):
    if 0<int(a[i][-1])<b:
        b=int(a[i][-1])
        d=i
for i in range(5):
    if b!=10:
        if i==d:
            c+=int(a[i])
        else:
            if int(a[i][-1])==0:
                c+=int(a[i])
            elif int(a[i])<=10:
                c+=10
            else:
                c+=(int(a[i][0:-1])+1)*10
    else:
        c+=int(a[i])
print(c)

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

int main(){
  int i,j,n,a,count,num=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    count=0;
    scanf("%d",&a);
    count=1;
    for(j=2;j<=sqrt(a);j++){
      if(a%j==0)count=0;
    }
    if(a==1)count=0;
    num+=count;
    //if(a!=1 && count<=2) num++;
  }
  printf("%d\n",num);

  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h1, m1, h2, m2, k; cin >> h1 >> m1 >> h2 >> m2 >> k;
    if (m1 <= m2) cout << (h2 - h1) * 60 + m2 - m1 - k << '\n';
    else cout << (h2 - h1 - 1) * 60 + 60 - (m1 - m2) - k << '\n';
    return 0;
}


Measured memory_bytes: 3640
# -*- coding: utf-8 -*-
n = int(input())
g = [[] for i in range(n)]
c = [-1 for i in range(n)]

for i in range(n - 1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append([v, w])
    g[v].append([u, w])


q = [0]
while (len(q) > 0):
    v = q.pop()
    for u, w in g[v]:
        if c[u] != -1:
            continue
        q.append(u)
        c[u] = (c[v] + w) % 2

for v in c:
    print(v)


Measured memory_bytes: 45012
while True:
	h, w = map(int, input().split())
	if h == 0 and w == 0:
		break
	for i in range(1, h+1):
		if i % 2 == 0:
			print(('.#'*w)[:w])
		else:
			print(('#.'*w)[:w])
	print()


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

template<typename T>
ostream& operator<<(ostream &os, vector<T> &v){
	string sep = " ";
	if(v.size()) os << v[0];
	for(int i=1; i<v.size(); i++) os << sep << v[i];
	return os;
}

template<typename T>
istream& operator>>(istream &is, vector<T> &v){
	for(int i=0; i<v.size(); i++) is >> v[i];
	return is;
}

#ifdef DBG
void debug_(){ cout << endl; }
template<typename T, typename... Args>
void debug_(T&& x, Args&&... xs){
	cout << x << " "; debug_(forward<Args>(xs)...);
}
#define dbg(...) debug_(__VA_ARGS__)
#else
#define dbg(...)
#endif

int main() {
	ios_base::sync_with_stdio(false);
	cout << setprecision(20) << fixed;

	int n; cin >> n;

	vector<int> ans(n+1);
	for(int x=1; x<100; x++){
		for(int y=1; y<100; y++){
			for(int z=1; z<100; z++){
				int k = x*x+y*y+z*z+x*y+y*z+z*x;
				if(k<=n) ans[k]++;
			}
		}
	}

	for(int i=1; i<=n; i++){
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3548
use std::io::*;
fn main() {
	let a = read_v();
	let k = read();
	for c in 0..a.len() {
		let cc = c + 1;
		if cc == k {
			println!("{}", a[c]);
			break;
		}
		if a[c] != '1' {
			println!("{}", a[c]);
			break;
		}
	}

}

fn read_v() -> Vec<char> {
    let s = stdin();
    let b = s.bytes()
        .map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .collect::<Vec<char>>();
	b

}

fn read() -> usize{
    let s = stdin();
    let b = s.bytes()
        .map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    b.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int fx[]={0,1,0,-1};
int fy[]={-1,0,1,0};
int main()
{
    ll t,i,j,n,m,k,r,r1,ans,ck,cnt=0,sum=0,c=0,want;
    cin>>n>>want;
    pair<ll,ll>p[n];
    for(i=0;i<n;i++){
        cin>>p[i].first>>p[i].second;
    }
    sort(p,p+n);
    for(i=0;i<n;i++){
        ck=p[i].second;
        k=p[i].first;
        if(ck<=want){
            sum=sum+(k*ck);
            want=want-ck;
        }
        else{
            sum=sum+(k*want);
            want=0;
            break;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 1792
import sys
from functools import lru_cache

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def com(n, r):
    if n < r or n < 0 or r < 0:
        return 0
    r = min(r, n - r)
    numer = denom = 1
    for i in range(n - r + 1, n + 1):
        numer = numer * i
    for i in range(1, r + 1):
        denom = denom * i
    return numer // denom


def main():
    N, K = map(int, read().split())

    S = str(N)
    L = len(S)

    @lru_cache(maxsize=None)
    def rec(i, k, smaller):
        if i == L:
            if k == 0:
                return 1
            else:
                return 0
        if k == 0:
            return 1
        if smaller:
            return com(L - i, k) * pow(9, k)
        if S[i] == '0':
            return rec(i + 1, k, False)

        ans = 0
        ans += rec(i + 1, k, True)
        ans += rec(i + 1, k - 1, True) * (int(S[i]) - 1)
        ans += rec(i + 1, k - 1, False)
        return ans

    ans = rec(0, K, False)

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 67376
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926535
/*
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
*/
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1
#define LINF 1000000000000000001 // 1e18+1

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int d,n;cin>>d>>n;
  if(d==0){
    if(n==100){
      P(101);
    }else{
      P(n);
    }
  }else if(d==1){
    if(n==100){
      P(10100);
    }else{
      P(n*100);
    }
  }else{
    if(n==100){
      P(1010000);
    }else{
      P(n*10000);
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

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

    int a,b,c;

    cin >> a >> b >> c;

    if(c>=a and c<=b) cout << "Yes";
    else cout << "No";
}



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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using edge = pair<ll, P>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
using Graph = vector<vector<ll>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

vector<int> topological_sort(const Graph &graph) {
    int N = graph.size();
    vector<int> in_cnt(N, 0);
    for (int i = 0; i < N; ++i) {
        for (int v : graph[i]) {
            in_cnt[v]++;
        }
    }
    queue<int> S;
    for (int i = 0; i < N; ++i) {
        if (in_cnt[i] == 0) S.push(i);
    }
    vector<int> res;
    while (!S.empty()) {
        int u = S.front();
        S.pop();
        res.emplace_back(u);
        for (int v : graph[u]) {
            in_cnt[v]--;
            if (in_cnt[v] == 0) {
                S.push(v);
            }
        }
    }
    return res;
}

ll dp[100005];

void Main() {
    int N, M;
    cin >> N >> M;
    Graph graph(N);
    rep(i, M) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        graph[x].push_back(y);
    }
    vector<int> sorted = topological_sort(graph);

    for(int v : sorted) {
        for(int u : graph[v]) {
            dp[u] = max(dp[u], dp[v] + 1);
        }
    }
    int ans = -1;
    for (int i = 0; i < N; ++i) {
        ans = max((int)dp[i], ans);
    }
    cout << ans << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


Measured memory_bytes: 7024
#include<bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
using UL = unsigned int;
using ULL = unsigned long long;
using LL = long long;

#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
  string str1;
  cin >> str1;
  int n = 0;int x;
  rep(i, str1.size()){
    x = str1.at(i) -'0';
    n += x;
  }
  if (n%9==0) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}



Measured memory_bytes: 3752
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

int main() {
	int n;
	while (cin >> n) {
		int ans = 0;
		for (int i = 0; i <= 9; ++i) {
			for (int j = 0; j <= 9; ++j) {
				for (int k = 0; k <= 9; ++k) {
					int mon = n - i - j - k;
					if (0 <= mon && mon <= 9) { ++ans; }
				}
			}
		}
		cout << ans << endl;
	}
}


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

int main() {
    int k, s;
    cin >> k >> s;

    int ans = 0;
    for (int x = 0; x <= k; x++) {
        for (int y = 0; y <= k; y++) {
            int z = s - x - y;
            if (z >= 0 && z <= k)
                ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
<?php
list($h, $w) = explode(' ', trim(fgets(STDIN)));
 
if($h == 1 || $w == 1){
	echo 1;
	exit;
}
 
$ans = 0;
if($h % 2){
	if($w % 2){
		$ans = $h * floor($w / 2) + ceil($h / 2);
	}else{
		$ans = $h * $w / 2;
	}
}else{
	$ans = ($h / 2) * $w;
}
 
echo (int)$ans;
?>

Measured memory_bytes: 4604
import sys, math

sys.setrecursionlimit(10 ** 9)
from collections import defaultdict

IA = lambda: map(int, input().split())
IAS = lambda: map(str, input().split())

n = int(input())
N = 200005
def f(n):
    if n < 2: return 0
    return n * (n - 1) // 2

a = list(IA())
vis = [0 for i in range(0, n + 1)]
for it in a:
    vis[it] += 1

sum1 = 0
sumsum=0
for i in range(1,n):
    sumsum+=1
for i in range(1, n + 1):
    sum1 += f(vis[i])
ans = [int(-1) for i in range(0, n + 1)]
for it in a:
    if ans[it] == -1:
        ans[it] = sum1 - f(vis[it]) + f(vis[it] - 1)
    print(ans[it])








Measured memory_bytes: 26888
#include <bits/stdc++.h>
using std::cout;
using std::endl;
using std::cin;

int main(){
	long n, k; cin >> n >> k; std::vector<long> a(n), b(n);
	for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
	
	if(!k){
		long ans = 0;
		for(int i = 0; i < n; i++) if(!a[i]) ans += b[i];
		
		cout << ans << endl;
		return 0;
	}
	
	int K = 30;
	while(!((k >> K) & 1LL)) K--;
	
	long ans = 0;
	for(int l = -1; l <= K; l++){
		long B = 0;
		for(int i = 0; i < n; i++){
			if(~l and (a[i] >> l) & 1LL) continue;
			if(~l and !((k >> l) & 1LL)) continue;
			
			bool f = true;
			for(int j = l + 1; j < 30; j++){
				if((k >> j) & 1LL) continue;
				if((a[i] >> j) & 1LL){
					f = false;
					break;
				}
			}	
			
			if(f) B += b[i];
		}
		
		ans = std::max(ans, B);
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
#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 x,n;
  cin >> x >> n;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  int i=0;
  while (i<100) {
    if (count(p.begin(),p.end(),x-i) == 0) {
      cout << x-i << endl;
      return 0;
    }
    if (count(p.begin(),p.end(),x+i) == 0) {
      cout << x+i << endl;
      return 0;
    }
    i++;
  }
  return 0;
}


Measured memory_bytes: 3628
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int W = sc.nextInt();
    int h = sc.nextInt();
    int w = sc.nextInt();
    System.out.println((H-h)*(W-w));
  }
}

Measured memory_bytes: 22740
#include <stdio.h>

int main(){

  int H, i, tree[100001];

  scanf("%d", &H);

  for(i=1; i<=H; i++){

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

  for(i=1; i<=H; i++){

    printf("node %d: key = %d, ", i, tree[i]);

    if(i/2>=1){

      printf("parent key = %d, ", tree[i/2]);
    }

    if(2*i<=H){

      printf("left key = %d, ", tree[2*i]);
    }

    if(2*i+1<=H){

      printf("right key = %d, ",tree[2*i+1]);
    }

    printf("\n");

  }

  return 0;
}



Measured memory_bytes: 2052
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a

# Union Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# 約数生成
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


inf = 10 ** 18
mod = 10 ** 9 + 7

abc  =[list(sr()) for i in range(3)]
for a in abc:
    a.reverse()
dic = {'a':0, 'b':1, 'c':2}
now = dic[abc[0].pop()]

while True:
    if abc[now]:
        now = dic[abc[now].pop()]
    else:
        if now == 0:
            print('A')
        elif now == 1:
            print('B')
        else:
            print('C')
        break


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

int main() {
	int N, A;
	cin >> N >> A;
	cout << N * N - A;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

N*Nマス中Aマスが白色なので残りのN*N-Aマスが黒色
*/

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

using lint = long long;
using namespace std;

struct F {
    lint b;
    int e;
};

bool solve() {
    lint N;
    cin >> N;
    if (N == 0) return false;

    string S;
    cin >> S;
    reverse(S.begin(), S.end());

    F a = {1LL << 52, 0};
    for (int k = 0; k < 52; ++k) {
        if (S[k] == '1') a.b += (1LL << k);
    }

    F ans = a;
    while (N > 0) {
        ans.b += a.b;
        if (ans.b >= (1LL << 53)) {
            ans.b >>= 1;
            ans.e += 1;
            a.b >>= 1;
            a.e += 1;
            --N;
        }
        if (a.b == 0) break;

        lint ok = 0, ng = min(N + 1, 1LL << (a.e + 1));
        while (ng - ok > 1) {
            lint mid = (ok + ng) / 2;
            (ans.b + a.b * mid < (1LL << 53) ? ok : ng) = mid;
        }
        ans.b += a.b * ok;
        N -= ok;
    }

    cout << bitset<12>(ans.e) << bitset<52>(ans.b) << endl;
    return true;
}

int main() {
    while (solve()) {}
    return 0;
}



Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, a, b, abcnt = 0, bcnt = 0;
    string s;
    cin >> n >> a >> b >> s;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'c')
        {
            cout << "No" << endl;
        }
        else if (s[i] == 'a')
        {
            if (abcnt < a + b)
            {
                cout << "Yes" << endl;
                abcnt++;
            }
            else
            {
                cout << "No" << endl;
            }
        }
        else if (s[i] == 'b')
        {
            if (abcnt < a + b && bcnt < b)
            {
                cout << "Yes" << endl;
                abcnt++;
                bcnt++;
            }
            else
            {
                cout << "No" << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3692
from bisect import bisect_left

def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))

    surplus = []
    need = 0
    ans = 0
    for a, b in zip(A, B):
        diff = a - b
        if diff >= 0:
            surplus.append(diff)
        else:
            need += -diff
            ans += 1

    surplus.sort(reverse=True)
    cusum = [0] * (len(surplus) + 1)
    for i, sur in enumerate(surplus):
        cusum[i+1] = cusum[i] + sur

    ans += bisect_left(cusum, need)
    if ans > N:
        print(-1)
    else:
        print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 19012
#include<iostream>
#include<string>
using namespace std;
int main(){
	string a,b;
	cin>>a;
	int m=a.size();
	b="YAKI";
	int num=0;
	for(int i=0;i<m&&i<4;i++)
	if(a[i]==b[i])num++;
	if(num==4)printf("Yes\n");
	else printf("No\n");
} 

Measured memory_bytes: 256
#include <stdio.h>

int gcd(int x,int y){
	int r = x % y;
	while(r){
	    x = y; 
	    y = r;
	    r = x % y;
	}
	return y;
}

int main(){
	int x,y;
	scanf("%d %d",&x,&y);
	if(x >= y)
		printf("%d\n",gcd(x,y));
	else{
		printf("%d\n",gcd(y,x));
	}
}



Measured memory_bytes: 2076
#include<stdio.h>
int main(void)
{
int N, K, X, Y;
scanf("%d %d %d %d", &N, &K, &X, &Y);
int total;
if(N > K){
  total = K * X + (N - K) * Y;
} else if(N <= K){
  total = N * X;
}
printf("%d", total);
  return 0;
}


Measured memory_bytes: 128
n = int(input())
tasks = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: x[1])


def f():
    time = 0
    for task in tasks:
        time += task[0]
        if time > task[1]:
            return "No"
    
    return "Yes"

print(f())


Measured memory_bytes: 55192
# coding: utf-8

# https://atcoder.jp/contests/abc101


def main():
    N = int(input())

    n_sum = 0
    for n in str(N):
        n_sum += int(n)
    
    if N % n_sum == 0:
        return "Yes"
    else:
        return "No"


print(main())


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
using P = pair<int,int>;
int main() {
   int n,x,y;cin>>n>>x>>y;
   x--;y--;
   vector<int>ans(n-1,0);
   for (int i = 0; i < n; i++){
       for (int j = i+1; j < n; j++){
           ans[min(j-i,abs(i-x)+abs(j-y)+1)-1]++;
       }
   }
   rep(i,n-1)cout<<ans[i]<<" ";
   cout<<endl;
}

Measured memory_bytes: 3640
function main(input: string) {
  console.log(
    input
      .split("\n")[0]
      .split("")
      .reduce(
        (result: string, str: string) =>
          str !== "B" ? result + str : result.slice(0, result.length - 1),
        ""
      )
  );
}

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


Measured memory_bytes: 7372
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] a = new int[n];
    int sum = 0;
    int count = 0;
    for(int i = 0; i < n; i++)
    {
      a[i] = sc.nextInt();
      sum += a[i];
    }
    for(int i =0;i<n;i++)
    {
        if(4*m*a[i]>=sum)
        count++;
    }
    if(count>=m)
    System.out.println("Yes");
    else
    System.out.println("No");
  }}
    

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
#define lundi ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(), x.end()

struct Sieve{
	vector<bool> sieve;
    vector<int> primes;

	Sieve(int n){
		sieve.assign(n+1, true);
		if(n>=2){
			sieve[0] = sieve[1] = false;
		}
		int rt = sqrt(n);
		for(int i=4;i<=n;i+=2) sieve[i] = false;
		for(int i=3;i<=n;i+=2){
			if(sieve[i]){
				for(int j=i*3;j<=n;j+=(2*i)){
					sieve[j] = false;
				}
			}
		}
	}

	bool isPrime(int x){
		if(x>=sieve.size()){
			cout<<"Out of sieve range"<<endl;
			assert(x>=sieve.size());
		}
		return sieve[x];
	}

    void generatePrimes(){
        primes.clear();
        for(int i=2;i<sieve.size();i++){
            if(sieve[i]) primes.push_back(i);
        }
    }
};


void solve(){
    int n;
    cin>>n;
    vector<int> v(n);
    int gcd = -1;
    for(int i=0;i<n;i++) {
        cin>>v[i];
        if(gcd == -1){
            gcd = v[i];
        } else {
            gcd = __gcd(v[i], gcd);
        }
    }
    
    if(gcd != 1){
        cout<<"not coprime"<<endl;
        return;
    }

    Sieve sieve(1e6+10);
    sieve.generatePrimes();
    vector<bool> taken(sieve.primes.size(), false);
    for(int i=0;i<v.size();i++){
        int pind = 0;
        while(v[i] > 1 && pind < sieve.primes.size() && sieve.primes[pind]*sieve.primes[pind] <= v[i]){
            
            if(v[i] % sieve.primes[pind] == 0 && taken[pind]){
                cout<<"setwise coprime\n";
                return;
            }
            while(v[i] > 1 && v[i]% sieve.primes[pind] == 0){
                taken[pind] = true;
                v[i] /= sieve.primes[pind];
            }

            pind++;
        }

        if(sieve.isPrime(v[i])){
            int ind = lower_bound(all(sieve.primes), v[i]) - sieve.primes.begin();
            if(taken[ind]){
                cout<<"setwise coprime\n";
                return;
            }
            taken[ind] = true;
        }
        
    }



    cout<<"pairwise coprime\n";
}

signed main(){
    lundi;
    int t=1;
    // cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 7880
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll a,b;
    cin>>a>>b;
    b+=(a*3);
    cout<<b/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  map<string, int> polling;
  int max_count = 0;
  for(int i = 0; i < n; ++i){
    cin >> s;
    polling[s]++;
    max_count = max(max_count, polling[s]);
  }
  for(auto p: polling){
    if(p.second == max_count) cout << p.first << endl;
  }
}


Measured memory_bytes: 25216
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <cstring>
#include <map>
#include <vector>
#include <queue>
#define fi first
#define se second
using namespace std;
typedef long long i64;
inline i64 read(int f = 1, i64 x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 3e5+5, P = 998244353;
int n, ans; i64 k, A, B, fac[N], ifac[N];
i64 inv(int i) { return i == 1?1:P-(P/i)*inv(P%i)%P; }
i64 C(int n, int m) { return fac[n]*ifac[m]%P*ifac[n-m]%P; }
int main()
{
    n = read(), A = read(), B = read(), k = read();
    fac[0] = 1; for(int i = 1; i <= n; ++i) fac[i] = fac[i-1]*i%P;
    ifac[n] = inv(fac[n]); for(int i = n; i; --i) ifac[i-1] = ifac[i]*i%P;
    for(int x = 0; x <= n; ++x)
    {
        if((k-B*x)%A) continue; int y = (k-B*x)/A;
        if(0 <= y&&y <= n) ans = (ans+C(n, x)*C(n, y)%P)%P;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 4864
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)

#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int a;

int main()
{
    int a;
    cin >> a;
    if(a % 2 == 0){
        cout << a << endl;
    }
    else{
        cout << a * 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256