akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>
#include <iomanip>
#include <bitset>


using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

int main()
{
	int n,m;
	cin>>n>>m;
	vector<vector<int>> g(n,vector<int>());
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		g[a].push_back(b);
	}

	vector<int> ans;
	rep(i,n){
		queue<int> que;
		vector<int> prev(n),visited(n,0);
		que.push(i);
		visited[i]++;
		int last=-1;
		bool flag=false;
		while(!que.empty()){
			int p = que.front();que.pop();
			for(auto x:g[p]){
				if(visited[x]==0)que.push(x),prev[x]=p,visited[x]++;
				if(x==i){last=p,prev[x]=p,flag=true;}
			}
			if(flag)break;
		}
		if(last>=0){
			vector<int> path;
			set<int> s;
			int now = last;
			while (1){
				path.push_back(now);
				if(now==i)break;
				now = prev[now];
			}
			reverse(all(path));
			bool flag=true;
			for(auto v:path){
				s.insert(v);
				for(auto u:g[v]){
					if(s.count(u)>0){
						if(v==last&&u!=i) flag=false;
						if(v!=last) flag=false;
					}
				}
			}

			if(flag){
				cout<<s.size()<<endl;
				for(auto x:s)cout<<x+1<<endl;
				return 0;
			}
		}
	}
	
	cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int ans[10][331]={0};
int tmp;
int n,s;
int f[10];
int main(void){
  f[0] = 1;
  f[1] = 1;
  FOR(i,2,10){
    f[i] = f[i-1] * i;
  }
  int a[10] = {0,1,2,3,4,5,6,7,8,9};
  do{
    tmp=0;
    REP(i,10){
      tmp += (i+1)*a[i];
      ans[i][tmp]++;
    }
  }while(next_permutation(a,a+10));
  while(cin>>n>>s){
    if(s>330) cout<<0<<endl;
    else cout<<ans[n-1][s]/f[10-n]<<endl;
  }
  return 0;
}

Measured memory_bytes: 760
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

ll N;
string s;
ll num(int first,int last,int keta){
    if(last==0) return 0;
    if(keta>s.size()) return 0;
    if(keta==s.size()&&last>s[0]-'0') return 0;
    if(first!=last&&keta==1) return 0;
    vector<vector<ll>> dp(keta,vector<ll>(2,0));
    if(keta==s.size()&&last==s[0]-'0') dp[0][1]=1;
    else dp[0][0]=1;
    for(int i=1;i<keta-1;++i){
        dp[i][0]=10*dp[i-1][0]+(s[i]-'0')*dp[i-1][1];
        dp[i][1]=dp[i-1][1];
    }
    if(keta>=2){
        dp[keta-1][0]=dp[keta-2][0];
        dp[keta-1][1]=dp[keta-2][1];
    }
    if(keta==s.size()&&first>s.back()-'0') dp[keta-1][1]=0;
    return dp[keta-1][0]+dp[keta-1][1];
}

int main(){
    cin>>N;
    s=to_string(N);
    ll ans=0;
    rep(A,1,N+1){
        string a=to_string(A);
        // cout<<A<<endl;
        rep(i,1,7) {
            ans+=num(a[0]-'0',a.back()-'0',i);
            // cout<<ans<<" \n"[i==5];
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main()
{
	int n[3];
	cin >> n[0] >> n[1] >> n[2];

	int f = 0;
	int s = 0;
	for (int i = 0; i < 3; i++) {
		if (n[i] == 5) {
			f++;
		} else if (n[i] == 7) {
			s++;
		} else {
			break;
		}
	}

	if (f == 2 && s == 1) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
string S;
cin >> S;
bool ans = true;
for (int i = 0;i < S.size();i++) {
    if (S.at(i) == 'L') ans = false;
    i++;
    if (i == S.size()) break;
    if (S.at(i) == 'R') ans = false;

}
if (ans == true) cout << "Yes" << endl;
else cout << "No" << endl; 

return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc079/tasks/abc079_c

ticket = list(input())

for i in range(1 << (len(ticket)-1)):
    exp = []
    for j in range(len(ticket)-1):
        if (i >> j) & 1:
            # add +
            exp.append("{}+".format(ticket[j]))
        else:
            # add -
            exp.append("{}-".format(ticket[j]))
    exp.append(ticket[-1])
    e = "".join(exp)
    if eval(e) == 7:
        print("{}={}".format(e, eval(e)))
        exit()


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

int gcd(int a, int b){
  if(a < b){
    swap(a, b);
  }
  if(a % b == 0){
    return b;
  }
  
  return gcd(a % b, b);
}

int main(){
  int K;
  cin >> K;
  
  int ans = 0;
  for(int i = 0; i < K; i++){
    for(int j = 0; j < K; j++){
      for(int k = 0; k < K; k++){
        ans += gcd(i+1, gcd(j+1, k+1));
      }
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define INF 0x3f3f3f3f
using namespace std;
int n;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	cout<<n*n*n;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  string str(n,'a');
  for(int i=0;i<m;i++){
    int pos,num;
    cin>>pos>>num;
    pos--;
    if(str[pos]!='a'&&str[pos]!='0'+num){
      cout<<-1<<endl;
      return(0);
    }
    if(n!=1&&pos==0&&num==0){
      cout<<-1<<endl;
      return(0);
    }
    str[pos]='0'+num;
  }
  
  if(str[0]=='a'){
    if(n==1){
      cout<<0;
    }else{
      cout<<1;
    }
  }else{
    cout<<str[0];
  }
  for(int i=1;i<n;i++){
    if(str[i]=='a'){
      cout<<0;
    }else{
      cout<<str[i];
    }
  }
  cout<<endl;
  return(0);
}


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

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

    string a;
    cin >> a;
    int n = a.size();
    ll ans = (ll)(n) * (ll)(n - 1) / 2LL + 1LL;

    vector<ll> b(26);
    rep(i, n) b[a[i] - 'a']++;

    rep(i, 26) ans -= b[i] * (b[i] - 1) / 2LL;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 720
from collections import defaultdict

N, K = map(int, input().split())
A = list(map(int, input().split()))

d = defaultdict(list)

p = 1
root = []

#s, e = 0, 0

for i in range(K):
    d[p].append(i)
    root.append(p)
    if len(d[p]) == 2:
        s = d[p][0]
        e = i
        n = (K - s) % (e - s)
        p = root[s + n]
        break
    p = A[p - 1]
#print(s, e)

#print(root)

#n = (K - s) % (e - s)
print(p)

Measured memory_bytes: 45036
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
#include <utility>
#include<iomanip>
// #include <numeric>
using namespace std;



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector<vector<ll>> vvint;
typedef vector<string> vstring;
typedef vector<vector<string>> vvstring;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<long double> vdouble;
typedef vector<vector<long double>> vvdouble;
typedef vector<vector<vector<long double>>> vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INT_MAX 2147483647
#define LLONG_MAX 9223372036854775807
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define DIVIDER 1000000007


//
// struct Node{
//   vint children;
//   ll index;
//   ll prop;
// };
// struct edge{ll to; ll cost;};



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

// ll X,Y,Z,K;
// ll pmax = 30000000000;
// vint A,B,C;




// struct UnionFind {
//     vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
//
//     UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
//         for(int i = 0; i < N; i++) par[i] = i;
//     }
//
//     int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
//         if (par[x] == x) return x;
//         return par[x] = root(par[x]);
//     }
//
//     void unite(int x, int y) { // xとyの木を併合
//         int rx = root(x); //xの根をrx
//         int ry = root(y); //yの根をry
//         if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
//         par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
//     }
//
//     bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };
//
// vint divisor(ll n){ // nの約数
//   vint ret;
//   for(ll i=1;i*i<=n;i++){
//     if(n%i == 0){
//       ret.pb(i);
//       if(i*i!=n) ret.pb(n/i);
//     }
//   }
//   vsort(ret);
//   return ret;
// }
//
// ll get_digits_num(ll n){
//   ll ret=0;
//   while(n){
//     n/=10;
//     ret++;
//   }
//   return ret;
// }



int main() {
  cout<<fixed<<setprecision(10);


  string s;cin>>s;

  ll one = 0;
  ll zero = 0;
  rep(i,s.size()){
    if(s[i]=='0') zero++;
    else one++;
  }

  cout << min(one,zero)*2 << endl;



}

















//


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll> 
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k;cin>>n>>k;
  lvector p(n,0);rep(i,n) cin>>p[i];
  vector<double> S(n+1,0.0);
  rep(i,n) S[i+1]+=S[i]+0.5*(p[i]+1);
  double ans=0.0;
  for(ll pos=0;pos+k<=n;pos++) ans=max(ans,S[pos+k]-S[pos]);
  printf("%.10f\n",ans);
  return 0;
}

Measured memory_bytes: 3456
from collections import Counter
from itertools import combinations
N =int(input())
B = []
for i in range(N):
  S = list(input())
  if S[0]=="M" or S[0]=="A" or S[0]=="R" or S[0]=="C" or S[0]=="H":
    B.append(S[0])
B = Counter(B)
l = ["M","A","R","C","H"]
ans = 0
for a,b,c in combinations(l, 3):
  if a in B.keys() and b in B.keys() and c in B.keys():
    ans += B[a]*B[b]*B[c]
print(ans)



Measured memory_bytes: 4224
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    return

#B
def B():
    return

#C
def C():
    d, g = LI()
    pc = LIR(d)
    g = g // 100
    max_ = 0
    for i in range(d):
        pc[i][1] = pc[i][1] // 100
        max_ = max(pc[i][0], max_)
    dp = [float("INF") for i in range(g+1)]
    skip = [0 for i in range(max_+1)]
    if d >= g:
        print(1)
        return
    dp[0] = 1
    for i in range(d):
        skip[pc[i][0]] = max(skip[pc[i][0]], pc[i][1] + i + 1)
    x = 0
    for k in range(max_+1):
        if x <= skip[k]:
            for i in range(x + 1, skip[k] + 1):
                if i > g:
                    break
                dp[i] = k
            x = skip[k]
    for i in range(d + 1):
        dp[i] = 1
    i = d
    y = d
    while i < g:    
        for x in range(d):
            continue
        
        
     


    
    return

#D
def D():
    N, X = LI()
    def dfs(n, x):
        #print(n, x)
        if x == 1 and n > 0:
            return 0 
        elif x < 2 ** (n + 1) - 1:
            return dfs(n - 1, x - 1)
        elif x == 2 ** (n + 1) - 1:
            return 2 ** n 
        elif x == 2 ** (n + 2) - 3:
            return 2 ** (n + 1) - 1
        else:
            return dfs(n - 1, x - 2 ** (n + 1) + 1) + 2 ** n 
    a = dfs(N, X)
    print(a)
        
    return


#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 3820
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

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

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <numeric>
#include <queue>
 
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
 
using namespace std;
 
typedef long long ll;

int main(int argc, char const *argv[])
{
  ll n;
  cin >> n;
  vector<ll> a(n);
  REP(i,n) {
    cin >> a[i];
  }
  ll res = std::accumulate(ALL(a),0LL,[](ll acc, ll i) {return acc + (i-1);});
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
/* basic header */
#include <bits/stdc++.h>
/* define */
#define ll long long
#define pb emplace_back
#define mp make_pair
#define eps 1e-8
#define lson (curpos<<1)
#define rson (curpos<<1|1)
/* namespace */
using namespace std;
/* header end */

int n, r;

// 10-n=r/100

int main() {
    cin >> n >> r;
    if (n >= 10) cout << r << endl;
    else cout << r + 100 * (10 - n) << endl;
    return 0;
}

Measured memory_bytes: 256
object Main extends App {
  import scala.io.StdIn._
  def isShahad(number:Int):Boolean = {
    def digits(num:Int):Int = {
      num match{
        case 0 => 0
        case n => n % 10 + digits(n / 10)
      }
    }
    if (number % digits(number) == 0)
      true
    else
      false
  }
  println(if (isShahad(readInt())) "Yes" else "No")
}


Measured memory_bytes: 25412
import java.util.*;
public class Main
{
    public static void main(String[] args)
    {
        //Compute c1 = new Compute();//calc
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //StringBuilder answer=new StringBuilder();
        //input
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int h[] = new int[n];
        for (int i=0;i<n;++i) h[i]=sc.nextInt();

        for (int i=0;i<n;++i)
        {
            if (h[i]>=k)++count;
        }
        System.out.println(count);
        sc.close();
    }
}

Measured memory_bytes: 48940
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let n=read::<i32>();
    let mut c=0;
    let mut p=0;
    for _ in 0..n{
        let h=read::<i32>();
        if p<=h{p=h;c+=1}
    }
    println!("{}",c)
}


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

typedef long long ll;

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

int N;

bool is_prime(int num) {
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) return false;
  }
  return true;
}

int main() {
  scanf("%d", &N);
  printf("2 ");
  N--;
  int num = 11;
  while (N > 0) {
    if (is_prime(num)) {
      printf("%d ", num);
      N--;
    }
    num += 10;
  }
  printf("\n");
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define print(a) cout << (a) << endl; 
typedef long long ll;

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

    if (s == u) a--;
    else b--;
    cout << a << " " << b << endl;

    return 0;
}

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

int main(){
  while(1){
    int M, T, P, R, i;
    scanf("%d%d%d%d", &M, &T, &P, &R);
    if(M == 0){
      return 0;
    }
    int m, t, p, j;
    vector<vector<int>> time(T, vector<int>(P, -1)), pena(T, vector<int>(P, 0));
    for(i = 0; i < R; i++){
      scanf("%d%d%d%d", &m, &t, &p, &j);
      t--;
      p--;
      if(j == 0){
        time[t][p] = m + 20 * pena[t][p];
      }
      else{
        pena[t][p]++;
      }
    }
    vector<pair<int, pair<int, int>>> score(T);
    for(i = 0; i < T; i++){
      score[i].first = i;
      int num = 0, time_sum = 0, k;
      for(k = 0; k < P; k++){
        if(time[i][k] >= 0){
          num++;
          time_sum += time[i][k];
        }
      }
      score[i].second.first = num;
      score[i].second.second = time_sum;
    }
    sort(score.begin(), score.end(), [](pair<int, pair<int, int>> a,pair<int, pair<int, int>> b){
      if(a.second.first != b.second.first){
        return a.second.first > b.second.first;
      }
      else if(a.second.second != b.second.second){
        return a.second.second < b.second.second;
      }
      else{
        return a.first > b.first;
      }
    });
    for(i = 0; i < T; i++){
      if(i == T - 1){
        printf("%d\n", score[i].first + 1);
      }
      else{
        printf("%d", score[i].first + 1);
        if(score[i].second == score[i + 1].second){
          printf("=");
        }
        else{
          printf(",");
        }
      }
    }
  }
}



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

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  
  int xa = min(a, k);
  k -= xa;
  
  int xb = min(b, k);
  k -= xb;
  
  int xc = k;
  
  cout << xa - xc << endl;
}  

Measured memory_bytes: 3596
def resolve():
    N, M = list(map(int, input().split()))
    H = list(map(int, input().split()))
    AB = [list(map(int, input().split())) for _ in range(M)]
    good = [True for i in range(N)]
    for a, b in AB:
        a, b = a-1, b-1
        if H[a] < H[b]:
            good[a] = False
        elif H[a] == H[b]:
            good[a] = False
            good[b] = False
        else:
            good[b] = False
    cnt = 0
    for g in good:
        if g:
            cnt += 1
    print(cnt)


if '__main__' == __name__:
    resolve()

Measured memory_bytes: 101296
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

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

int main() {

	int a;
	cin >> a;
	cout << 180 * (a - 2) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>

typedef long long LL;
const LL Infll = 0x3f3f3f3f3f3f3f3f;
const int MN = 100005;

int N, M, A[MN], B[MN], P[MN], vis[MN];
std::vector<int> G[MN], T[MN];

int fa[MN];
inline int ff(int x) { return fa[x] ? fa[x] = ff(fa[x]) : x; }

LL f[MN], s[MN];

void DFS(int u) {
	s[u] = B[u], f[u] = Infll;
	for (auto v : T[u]) DFS(v), s[u] += s[v];
	for (auto v : T[u]) f[u] = std::min(f[u], s[u] - s[v] + std::max((LL)A[u], f[v]));
	if (T[u].empty()) f[u] = A[u] + B[u];
}

int main() {
	scanf("%d%d", &N, &M);
	for (int i = 1; i <= N; ++i)
		scanf("%d%d", &A[i], &B[i]),
		A[i] = std::max(A[i] - B[i], 0),
		P[i] = i;
	for (int i = 1, x, y; i <= M; ++i)
		scanf("%d%d", &x, &y),
		G[x].push_back(y),
		G[y].push_back(x);
	std::sort(P + 1, P + N + 1, [](int i, int j) { return A[i] < A[j]; });
	for (int i = 1; i <= N; ++i) {
		int u = P[i];
		for (auto v : G[u])
			if (vis[v] && ff(v) != u)
				T[u].push_back(ff(v)),
				fa[ff(v)] = u;
		vis[u] = 1;
	}
	DFS(P[N]);
	printf("%lld\n", f[P[N]]);
	return 0;
}

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

int main()
{
    long long x;
    long long sol,p=1;
    cin>>x;
    for(;p<=x;p*=2);
    for(sol=0;p;p/=2)
    {
     //   cout<<sol<<' '<<p<<' '<<(sol+p)*(sol+p+1)<<' '<<2*x<<'\n';
        if(sol+p<=x)
            if( 1LL*(sol+p)*(sol+p+1) <= 2*x )
                sol+=p;
    }
    if(sol*(sol+1)<2*x) sol++;
    cout<<sol<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

int ti(int x, int y) {
    if (x % y == 0) {
        return -1;
    }
//    const int max = 10^18;
//    while (x < max) {
//        if (x % y != 0) {
//            return x;
//        }
//        x += x;
//    }
    return x;
    
}

int main(int argc, const char * argv[]) {
    
    int x, y;
    cin>>x>>y;
    
    cout << ti(x, y);
    
    return 0;
}



Measured memory_bytes: 256
import sys
input = sys.stdin.readline

class BIT_RSQ():
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)

    def add(self, i, v):
        while i <= self.n:
            self.data[i-1] += v
            i += i & -i

    def sum(self, i):
        ret = 0
        while(i > 0):
            ret += self.data[i-1]
            i -= i & -i
        return ret

n,k = map(int, input().split())
a = [int(input())-k for i in range(n)]
s = [0]
for i in a:
    s.append(s[-1]+i)

# ざあつ
d = {j:i for i,j in enumerate(sorted(set(s)))}
bit = BIT_RSQ(len(d))
ans = 0
for i in range(n):
    # 一個前を足す
    bit.add(d[s[i]]+1, 1)
    ans += bit.sum(d[s[i+1]]+1)
print(ans)

Measured memory_bytes: 83548
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
ll a[1024];
int main(void) {
    ll n;
    cin >> n;
    ll k = 0;
    for(int i = 1; i <= n; i++)
        cin >> a[i];

    while(1) {
        ll cnt = 0;

        for(int i = 1; i <= n; i++) {
            //cout << a[i] << " ";
            if(a[i] >= n) {
                cnt += a[i]/n;

            }
        }
       // cout << endl;
        k += cnt;
        //cout << k<< endl;
        //int o;
        //cin >> o;

        if(cnt > 0) {
            for(int i = 1; i <= n; i++) {
                ll mod = a[i]%n;
                ll p = a[i]/n;
                a[i] = mod + cnt - p;
            }
        }
        else break;
    }
    cout << k;
    return 0;
}


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

typedef struct{
 int P;
 long Y;
 int position;
 int citynum;
} city;

int year_comp(city *a, city *b)
{
 if (a->Y < b->Y) return(-1);
 if (a->Y > b->Y) return(1);
 if (a->Y == b->Y) return(0);
};

int index_comp(city *a, city *b)
{
 if (a->position < b->position) return(-1);
 if (a->position > b->position) return(1);
 if (a->position == b->position) return(0);
};

void printzero(int num)
{
  int j;
  int temp;
  int count=5;
  temp=num;
  for(j=0;j<6;j++)
  {
   temp=temp/10;
   if(temp>0)
   {
    count--;
   }else{
    break;
   }
  }
  for(j=0;j<count;j++) printf("0");
 return;
}

int main()
{
 int N;
 int M;
 int i;
 city cities[100005];
 int pref_count[100005];
 int year_comp();

 for(i=0;i<100005;i++) pref_count[i]=0;

 scanf("%d %d\n",&N,&M);
 for(i=0;i<M;i++)
 {
  scanf("%d %ld",&cities[i].P,&cities[i].Y);
  cities[i].position=i;
 }

 qsort(cities, M, sizeof(city), year_comp);

 for(i=0;i<M;i++)
 {
  pref_count[cities[i].P]++;
  cities[i].citynum=pref_count[cities[i].P];
 }

 qsort(cities, M, sizeof(city), index_comp);

 for(i=0;i<M;i++)
 {
  int count=0;
  int temp=cities[i].P;
  printzero(cities[i].P);
  printf("%d",cities[i].P);
  printzero(cities[i].citynum);
  printf("%d\n",cities[i].citynum);
 }

 return 0;
}


Measured memory_bytes: 6504
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

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

    int w,h,x,y,ans=0,max=0,min=inf;
	cin >> w >> h >> x >> y;
	
/*
	if((w-x)*h < x*h){
		min = (w-x)*h;
	}
	else{
		min = x*h;
	}
	
	max = min;
	min = inf;

	if((h-y)*w < y*w){
		min = (h-y)*w;
	}
	else{
		min = y*w;
	}

	if(max < min){
		max = min;
	}
	else if(max==min){
		ans=1;
	}

	if(max==0){
		ans = 0;
	}
	
	cout << max << " " << ans <<endl;*/

	if(x+x==w && y+y==h){
		ans = 1;
	}
	cout << (double)w*(double)h/2 << " " << ans << endl;
}

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

int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    int ans=0;
    for(int i=0; i<n; ++i)for(int j=i+1; j<n; ++j)for(int k=j+1; k<n; ++k){
        if(a[i]==a[j]||a[j]==a[k]||a[k]==a[i])continue;
        if(a[i]+a[j]>a[k])ans++;        
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
n,q=map(int, input().split())
s=input()
num_ac=[0 for i in range(n)]
#num_ac[i]はi+1文字目までのACの数？
for i in range(1,n):
    num_ac[i]=num_ac[i-1]
    if s[i]=='C' and s[i-1]=='A':
        num_ac[i]+=1
for i in range(q):
    l,r=map(int,input().split())
    print(num_ac[r-1]-num_ac[l-1])

Measured memory_bytes: 52392
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main() {
  int q = in();
  set<int> s;
  while (q--) {
    int t = in();
    if (t == 0) {
      s.emplace(in());
      cout << s.size() << endl;
    }
    if (t == 1) cout << s.count(in()) << endl;
    if (t == 2) s.erase(in());
  }
}



Measured memory_bytes: 12352
use std::io;

fn read_line()-> String {
    let mut s = String::new();
    let _ = io::stdin().read_line(&mut s).unwrap();
    s
}

fn main() {
	let n = read_line().split_whitespace().map(|e|e.parse().unwrap())
	.collect::<Vec<i32>>();

	if n[0] <= n[2] && n[2] <= n[1] {
		println!("Yes");
	}else{
		println!("No");
	}
}


Measured memory_bytes: 4352
N = int(input())
e = [0] * (N+1)
for i in range(2, N+1):
    cur = i
    for j in range(2, i+1):
         while cur % j == 0:
            e[j] += 1
            cur //= j

def num(m):
    return len(list(filter(lambda x: x >= m-1, e)))

print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1)+ num(5) * (num(5) - 1) * (num(3) - 2) // 2)



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

int main() {
    int n,p;
    string s;

    cin >> n >> p >> s;

    reverse(s.begin(),s.end());
    if(p == 2 || p == 5) {
        ll res = 0;
        for (int i = 0; i < n; i++) {
            if((s[i] - '0') % p == 0) res += (n - i);
        }
        cout << res << endl;
        return 0;
    }

    map<ll,ll> mp;
    mp[0] = 1;
    int ten = 1;
    int cur = 0;
    for (int i = 0; i < n; i++) {
        cur = cur + (s[i] - '0') * ten;
        cur %= p;
        mp[cur]++;
        ten *= 10;
        ten %= p;
    }

    ll ans = 0;
    for (auto it : mp) {
        ans += (it.second) * (it.second - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1028
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define mp make_pair
#define fst first
#define snd second

#define fr(i,n) 	for(int i=0;i<n;i++)
#define frr(i,n)	for(int i=1;i<=n;i++)

#define ms(x,i)	memset(x,i,sizeof(x))
#define dbg(x)	cout << #x << " = " << x << endl
#define all(x)	x.begin(),x.end()

#define gnl cout << endl
#define olar cout << "olar" << endl
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef pair<ll,ll> pll;

const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f;
const int MOD = 1e9+7;

int x,y,a,b,c;
vi A,B,C;

map<int,int> aa,bb;
set<int> AA,BB;

int main(){

	fastio;

	cin >> x >> y >> a >> b >> c;
	int l;
	fr(i,a){
		cin >> l;
		A.pb(l);
	}
	fr(i,b){
		cin >> l;
		B.pb(l);
	}
	fr(i,c){
		cin >> l;
		C.pb(l);
	}

	sort(all(A));
	sort(all(B));
	sort(all(C));


	reverse(all(A));
	reverse(all(B));

	fr(i,x){
		AA.insert(A[i]);
		aa[A[i]]++;
	}

	fr(i,y){
		BB.insert(B[i]);
		bb[B[i]]++;
	}

	int p = c - 1;

	while(p >= 0){
		int at = C[p];
		auto ita = AA.begin();
		auto itb = BB.begin();

		int ata = *(ita);
		int atb = *(itb);

		if(ata < atb){
			if(at <= ata) break;
			aa[ata]--;
			if(aa[ata] == 0) AA.erase(AA.begin());
			aa[at]++;
			AA.insert(at);

		}
		else{
			if(at <= atb) break;
			bb[atb]--;
			if(bb[atb] == 0) BB.erase(BB.begin());
			bb[at]++;
			BB.insert(at);
		}
		p--;
	}

	ll sum = 0;

	while(!AA.empty()){
		auto it = AA.begin();
		ll x = *(it);

		sum += x*aa[x];
		AA.erase(AA.begin());
	}
	while(!BB.empty()){
		auto it = BB.begin();
		ll x = *(it);

		sum += x*bb[x];
		BB.erase(BB.begin());
	}

	cout << sum << endl;



}


Measured memory_bytes: 23032
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=500050;
//↑templete
int main(){
	string S;
	cin>>S;
	int N=S.length();
	ll A[SIZE]={}, B[SIZE]={};

	int a=0;
	for(int i=0;i<=N;i++){
		if(i==N){
			A[i]=a;
			continue;
		}
		if(S[i]=='<'){
			A[i]=a;
			a++;
		}
		else{
			A[i]=a;
			a=0;
		}
	}
	int b=0;
	for(int i=N;i>=0;i--){
		if(i==0){
			B[i]=b;
			continue;
		}
		if(S[i-1]=='>'){
			B[i]=b;
			b++;
		}
		else{
			B[i]=b;
			b=0;
		}
	}
	ll ans=0;
	for(int i=0;i<=N;i++)
		ans+=max(A[i], B[i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 8708
// schedule lectures codechef
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define clr clear()
#define ins insert
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define mem(x,val) memset((x),(val),sizeof(x));
#define cusmem(x,val) for(auto &i:x) i=val;
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false);\
            cin.tie(NULL);\
            cout.tie(NULL);
using namespace std;
typedef pair<int,int> pii;
typedef pair<ll,ll>pll;
typedef vector<ll> vl;
typedef vector<pll> vpll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pii> vpii;
string imp="Impossible\n";

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
clock_t startTime;
double getCurrentTime() {
    return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}
// const int N=10;
const int N=2e4+5;
ll MOD=1e9+7;
ll m,k,i,j;
bool f0,f1,f2;
const int MAXN=2e3;
int main(){
    #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin); 
            freopen("output.txt","w",stdout);
    #endif
    fastio
	cout<<fixed<<setprecision(11);
    int tests=1;    
    // cin>>tests;
    while(tests--){
        int a,b,c;  cin>>a>>b>>c;
        int k;  cin>>k;
        while(b<=a&&k>0){
            b*=2;
            k--;
        }
        while(c<=b&&k>0){
            c*=2;
            k--;
        }
        if(a<b&&b<c)    cout<<"Yes\n";
        else    cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 3648
n,k = map(int,input().split())

a = list(map(int,input().split()))

x = 0
for i in range(40,-1,-1):
    if x | (1 << i) > k:
        continue
    cnt = 0
    for j in range(n):
        if a[j] & (1 << i) == 0:
            cnt += 1
    
    if cnt > n - cnt:
        x = x | (1 << i)

ans = 0
for i in range(n):
    ans += x ^ a[i]

print(ans)

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

///Author:Refat(BSMRSTU)///

#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define pil pair<int,ll>
const int N = 1e5 + 5;
const int M = 1e9 + 7;
int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}
int main() {
    /// freopen("input.txt","r",stdin);
    /// freopen("output.txt","w",stdout);
    string s,s1;int ans=0;
    cin>>s>>s1;
    for(int i=0;i<s.length();i++){
        if(s1[i]==s[i]){
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<complex>
using namespace std;

typedef complex<double> P;

#define X real()
#define Y imag()


int main(){
    int mod=1000000007;
    map<char, int> d;
    d['I']=1;
    d['V']=5;
    d['X']=10;
    d['L']=50;
    d['C']=100;
    d['D']=500;
    d['M']=1000;
    char c[60];
    int len,t,value;
    while (fgets(c,60,stdin)!=NULL)  {
        len=strlen(c)-1;
        t=0,value=1000;
        for (int i=0;i<len;++i) {
            if (value>=d[c[i]]) {
                value=d[c[i]];
                t+=value;
            } else {
                t=t-value*2;
                value=d[c[i]];
                t+=value;
            }
        }
        printf("%d\n",t);
    }
    return 0;
}

Measured memory_bytes: 3148
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define deb(x) cout<<#x<<" = "<<x<<"\n";

void solve()
{
	int n, w; cin>>n>>w;
	int val[n+1], wt[n+1];
	for(int i=0; i<n; i++)
		cin>>wt[i]>>val[i];
	
	int dp[w+1];
	fill(dp, dp+w+1, 0);
	
	for(int i=0; i<n; i++)
	{
		for(int j=w; j>= wt[i]; j--)
			dp[j] = max(dp[j], val[i] + dp[j-wt[i]]);
	}
	cout<<dp[w]<<"\n";
}

signed main()
{
	//freopen("input.txt", "r", stdin);
	
	int t = 1; //cin>>t;
	while(t--)
	{
		solve();
	}
return 0;
}

Measured memory_bytes: 1024
(function main() {
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  let i, j, X, Y, xlen, ylen, maxlen;
  let c;
  while ((X = lines.shift()) && (Y = lines.shift())) {
    xlen = X.length;
    ylen = Y.length;
    c = Array.from(Array(xlen + 1), () => Array.from(Array(ylen + 1), () => 0));

    for (i = 1; i <= xlen; i++) {
      for (j = 1; j <= ylen; j++) {
        if (X[i-1] === Y[j-1]) c[i][j] = c[i - 1][j - 1] + 1;
        else c[i][j] = Math.max(c[i - 1][j], c[i][j - 1]);
      }
    }
    console.log(c[xlen][ylen]);
  }
})();



Measured memory_bytes: 209252
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(998244353)
#define INF (1e15)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	int n; cin>>n;
	int ans; cin>>ans;
	int t;
	For(i,1,n-1){
		cin>>t;
		ans=lcm(ans,t);
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define sz size()
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <pi, pi>
#define vi vector <int>
const ll mod = 1e9 + 7;
int n, a[100002];

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>n;
    int sum=0;
    for(int i=1; i<=n; i++){
        cin>>a[i];
        sum^=a[i];
    }
    if(sum==0) cout<<"Yes";
    else cout<<"No";
}



Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
#include<string>
#define fi(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

int main() {
	string S;
    long long K;
	cin >> S >> K;
	fi(i,0,min((long long)S.size(),K)-1){
		if(S[i]>='2'){
            cout << S[i] << endl;
            return 0;
        }
	}
	cout << '1' << endl;
	return 0;
}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

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

    int n, d;
    cin >> n >> d;
    
    double tmp = 2 * d + 1;
    cout << ceil(n / tmp) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    string a, b;
    cin >> a >> b;
    if (a[0] == b[2] && a[1] == b[1] && a[2] == b[0]) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  double res = 0;
  rep(i,n) {
    double m;
    string s;
    cin >> m >> s;
    if (s == "JPY") res += m;
    if (s == "BTC") res += m * 380000;
  }
  cout << fixed << setprecision(10);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3768
/*input 
8
2 2 286017
3 1 262355
2 -2 213815
1 -3 224435
-2 -2 136860
-3 -1 239338
-2 2 217647
-1 3 141903
*/ 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
#define ld double
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=15+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e16;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
ll ans[maxn],n;
pii arr[maxn];
ll p[maxn];
int x[maxn],die[maxn],y[maxn];
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    cin>>n;
    REP(i,n) ans[i]=INF64; 
    REP(i,n){
        cin>>arr[i].f>>arr[i].s>>p[i];
    }
    REP(i,mypow(3,n)){
        int z=i;
        int dd=0,dx=0,dy=0;
        REP(j,n){
            if(z%3==0) die[dd++]=j;
            else if(z%3==1) x[dx++]=arr[j].f;
            else y[dy++]=arr[j].s;
            z/=3;
        }
        ll cst=0;
        REP(j,dd){
            ll dst=min(abs(arr[die[j]].f),abs(arr[die[j]].s));
            REP(z,dx) MNTO(dst,abs(arr[die[j]].f-x[z]));
            REP(z,dy) MNTO(dst,abs(arr[die[j]].s-y[z]));
            cst+=dst*p[die[j]];
        }
        MNTO(ans[n-dd],cst);
    }
    REP(i,n+1) cout<<ans[i]<<'\n';
}


Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
        int a[5];
        for(int i=0;i<5;i++){
                cin >> a[i];
        }
        int k = 0;
        cin >> k;
        int count = 4;
        int vec = 0;
        int flag = 0;
        for(int i = 0; i < 4; i++){
                for(int j = 1; j <= count; j++){
                        vec = a[i+j] - a[i];
                        if(vec > k){
                                flag = 1;
                                break;
                        }
                }
                count = count - 1;
        }
        if(flag == 1){
                cout << ":(" << "\n";
        }else{
                cout << "Yay!" << "\n";
        }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long int lli;

lli solve(lli n)
{
  if(n == 1) return 0;
  if(n%3 == 0) return solve(n/3)+1;
  return solve(n/3+1)+1;
}

int main()
{
  lli n;
  while(cin>>n && n){
    cout << solve(n) << endl;
  }

  return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

class UnionFind{
private:
	vector<int32> par;
	int32 n;

public:
	UnionFind(){}
	UnionFind(int32 n):n(n){
		par.resize(n, -1);
	}

	int32 find(int32 x){
		return par[x] < 0 ? x : par[x] = find(par[x]);
	}

	int32 size(int32 x){
		return -par[find(x)];
	}

	void unite(int32 x, int32 y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		if(size(x) < size(y)) swap(x, y);
		par[x] += par[y];
		par[y] = x;
	}

	bool same(int32 x, int32 y){
		return find(x) == find(y);
	}
};

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

	int32 w, h;
	while(cin >> w >> h && w && h){
		UnionFind uf((w+2)*(h+2));
		vector<vector<int32>> f(h+2, vector<int32>(w+2, '0'));
		REP(i, h){
			REP(j, w){
				cin >> f[i+1][j+1];
			}
		}
		int32 dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
		int32 dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
		FOR(y, 1, h+1){
			FOR(x, 1, w+1){
				REP(k, 8){
					int32 yy = y+dy[k], xx = x+dx[k];
					if(f[y][x] == 1 && f[yy][xx] == 1 && !uf.same(yy*(w+2)+xx, y*(w+2)+x)){
						uf.unite(yy*(w+2)+xx, y*(w+2)+x);
					}
				}
			}
		}
		int32 cnt = 0;
		REP(y, h+2){
			REP(x, w+2){
				if(f[y][x] == 1 && uf.find(y*(w+2)+x) == y*(w+2)+x)
					cnt++;
			}
		}
		cout << cnt << endl;
	}
}



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

int main(){
	double a,b,c,d,e,f;
	while( cin >> a >> b >> c >> d >> e >> f){
		double s = a * e - b * d;
		double x = e * c + -b * f;
		double y = -d * c + a *f;
		
		printf("%.3lf %.3lf\n",x/s+1e-9,y/s+1e-9);
	}
}

Measured memory_bytes: 3272