akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <numeric>
using namespace std;

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

//library----------------------------------------------


int main(){
    SCIN(o,e);
    rep(i,o.size()){
        cout<<o[i];
        if(i<e.size())cout<<e[i];
    }
    printf("\n");
    return 0;
}

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

using namespace std;

void loop(int n)
{
  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
      if(n == i*j){
        cout << "Yes" << endl;
        return;
      }
    }
  }
  cout << "No" << endl;                                                                                                                       
  return;
}

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

  if(N > 81){
    cout << "No" << endl;
    return 0;
  }else{
    loop(N);
  }

  return 0;
}

Measured memory_bytes: 256
n = int(input())
A = list(input().split())
q = int(input())

for i in range(q):
    queryi = list(map(int, input().split()))
    B = A[:queryi[0]]
    C = A[queryi[0] : queryi[1]]
    C.reverse()
    D = A[queryi[1]:]
    C.extend(D)
    B.extend(C)
    A = B

print(" ".join(A))


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

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

int main() {
    int n;
    cin>>n;
    ll ans;
    cin>>ans;
    rep(i,n-1){
        ll a;
        cin>>a;
        ans=gcd(ans,a);

    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().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
inf = float('INF')

#solve
def solve():
    a, b, c, d, e, f = LI()
    lis = []
    for i in range(f //c + 1):
        for k in range(f // d + 1):
            lis.append(c * i + d * k)
    lis = list(set(lis))
    lis.sort()
    ans = [100 * a, 0]
    for i in range(f // 100 + 1):
        for k in range(f // 100 + 1):
            if i == k == 0:
                continue
            water = a * i + b * k
            if water * 100 > f:
                continue
            E = min(f - water * 100, water * e)
            if E <= 0:
                continue
            aa = bisect_right(lis, E) - 1
            if aa == -1:
                continue
            aa = lis[aa]
            if ans[1] / ans[0] < aa / (water * 100 + aa):
                ans = [water * 100 + aa, aa]
    print(*ans)

    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 71092
#include <iostream>
#include<algorithm>

using namespace std;

int main()
{
	long long n,i,t,a,A,B,res=0;

	cin >> n;
	cin >> t >> a;
	A = t;
	B = a;
	for (i = 0; i < n-1; i++) {
		cin >> t >> a;
		res = max(A / t, B / a);
		while (!(A <= t*res && B <= a*res))res++;
		A = res * t;
		B = res * a;
	}
	cout << A + B << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int i,j,k,ans,answer=100000001;
int main(){
    cin>>s;
    for(i=0;i<s.size()-2;i++){
        for(j=i;j<i+3;j++){
            k=s[j]-'0';
            if(j - i == 0)ans+=k*100;
            if(j - i == 1)ans+=k*10;
            if(j - i == 2)ans+=k;
        }
        answer=min(answer,abs(753-ans));
        ans=0;
    }
    cout<<answer<<endl;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n, q = map(int, input().split())
graph = {i: [] for i in range(n)}
for a, b in [[int(i)-1 for i in input().split()] for _ in range(n-1)]:
    graph[a].append(b)
    graph[b].append(a)
ans = [0] * n
for p, x in [[int(i) for i in input().split()] for _ in range(q)]:
    ans[p-1] += x

def dfs(now, parent):
    if parent != -1:
        ans[now] += ans[parent]
    for i in graph[now]:
        if i == parent:
            continue
        dfs(i, now)

dfs(0, -1)
print(' '.join(map(str, ans)))


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  string s;
  cin >> s;
  int n = s.length();
  int score = 0;
  for (char c : s) {
    if (c == 'p') {
      score--;
    }
  }
  score += n / 2;
  cout << score << endl;
}

Measured memory_bytes: 512
S = input()
mod=10**9+7

suma,sumc,sumq=0,0,0
maxC=S.count("C")%mod
maxQ=S.count("?")%mod
ans1,ans2,ans3,ans4=0,0,0,0

for i,s in enumerate(S):
  if s=="A":
    suma+=1
    suma%=mod
  elif s=="C":
    sumc+=1
    sumc%=mod
  elif s=="?":
    sumq+=1
    sumq%=mod
  
  if i==0 or i==len(S):
    continue
  
  if s=="?":
    ans2+=suma    *(maxC-sumc)%mod
    ans3+=(sumq-1)*(maxC-sumc)%mod
    ans3+=suma    *(maxQ-sumq)%mod
    ans4+=(sumq-1)*(maxQ-sumq)%mod
  elif s=="B":
    ans1+=suma*(maxC-sumc)%mod
    ans2+=sumq*(maxC-sumc)%mod
    ans2+=suma*(maxQ-sumq)%mod
    ans3+=sumq*(maxQ-sumq)%mod
    
ans1*=3**maxQ%mod
ans2*=3**(maxQ-1)%mod
ans3*=3**(maxQ-2)%mod
ans4*=3**(maxQ-3)%mod
ans=ans1+ans2+ans3+ans4
print(int(ans%mod))

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

#define NREP() for(ull i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ull i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define MSGF(x, n) MSG(fixed << setprecision(n) << x)
#define END(x) cout << x << endl; exit(0);
#define IPT(v, n) REP(i, 0, n){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<ull> vul;
typedef vector<vector<ull>> vvul;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
const static ll INF = 1LL << 30;

ll a, b, c, d, k, l, m, n, h, w, q, x, y;
string s, t;

ull ans = 0;
ll sum = 0;
ll cnt = 0;
ll cur = 0;
ll tmp = 0;
ll mini = INF;
ll maxi = 0;

double ave = 0.0;

ll mod_pow(ll base, ll power) {
    if (power == 0) return 1;
    if (power == 1) return base % MOD;
    if (power % 2 == 0) return ((mod_pow(base % MOD, (power / 2)) % MOD) * (mod_pow(base, (power / 2)) % MOD)) % MOD;
    return (base % MOD * (mod_pow(base % MOD, power - 1) % MOD)) % MOD;
}

ll mod_fact(ll number) {
    ll ret = 1;
    ll count = 1;
    while (count <= number) {
        ret *= (count % MOD);
        ret %= MOD;
        count++;
    }
    return ret % MOD;
}

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

int main() {
    ull k;
    cin >> n >> k;
    vl a(n + 10);
    set<ll> s;
    NREP() {
        cin >> a[i];
    }

    s.insert(1);
    ll idx = a[0];
    ll start_idx;
    while (true) {
        if (s.find(idx) != s.end()) {
            start_idx = idx;
            break;
        }
        s.insert(idx);
        idx = a[idx - 1];
    }

    ull cnt_before = 0;
    if (start_idx != 1) {
        cnt_before++;
        idx = a[0];
        if (k == cnt_before) {
            END(idx)
        }
        while (idx != start_idx) {
            idx = a[idx - 1];
            cnt_before++;
            if (k == cnt_before) {
                END(idx)
            }
        }
    }

    ull cnt_circle = 0;
    idx = a[start_idx - 1];
    while (true) {
        idx = a[idx - 1];
        cnt_circle++;
        if (idx == start_idx) {
            break;
        }
    }
    cnt_circle++;
    ull rem = (k - cnt_before) % cnt_circle;
    if (rem == 0) {
        END(start_idx)
    }

    idx = a[start_idx - 1];
    ull cnt = 0;
    while (cnt < rem - 1) {
        idx = a[idx - 1];
        cnt++;
    }
    MSG(idx)
}


Measured memory_bytes: 14324
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
 
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
 
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
 
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 122)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 122)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 122)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll quickpow (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = quickpow (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return quickpow (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/__gcd(num1,num2))*num2;}
// end of Template

int main(){
 
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	int n;
	cin>>n;
	if(n<1200) cout<<"ABC\n";
	else cout<<"ARC\n";
  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        System.out.print((a < b ? a : b) + (c < d ? c : d));
    }
}


Measured memory_bytes: 23764
//
//  nomura_c.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <queue>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
ll mod = 998244353;
ll INF = 1000000007;
#define PI 3.14159265


int main() {
  int n;
  cin >> n;
  ll a[100001];
  ll sum[100001];

  for (int i = 0; i <= n; i++) {
    cin >> a[i];
    if (i>0) sum[i] = sum[i-1] + a[i];
    else sum[i] = a[i];
    if (i==0 && a[i]!=0 && !(a[i]==1 && n==0)) {
      cout << -1 << endl;
      return 0;
    }
  }

  ll ans = 1;
  ll nodes = 1;
  for (int i = 1; i <= n; i++) {
    if (nodes < a[i-1]) {
      std::cout << -1 << std::endl;
      return 0;
    }
    nodes = 2*(nodes - a[i-1]);
    if (nodes < a[i]) {
      std::cout << -1 << std::endl;
      return 0;
    }
    nodes = min(nodes, sum[n]-sum[i-1]);
    ans += nodes;
  }

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

Measured memory_bytes: 5100
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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(b<a){a=b;return 1;}return 0;}

typedef long long lint;

using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	cout<<(10<=a+b?"error":to_string(a+b))<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 10000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
	string s;
	cin >> s;
	int ans = 0;
	REP(i, s.size()-1){
		if(s[i] != s[i+1]) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
	int a,b,c,sum;
	scanf("%d%d%d",&a,&b,&c);
	sum=0;
	if(a<b){
		sum+=a;
		if(b<c) sum+=b;
		else sum+=c;
	}
	else{
		sum+=b;
		if(a<c) sum+=a;
		else sum+=c;
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main()
{
  int n,s[10000],q,t[500],i,j,count=0;

  scanf("%d",&n);
  for(i=0;i < n;i++){
    scanf("%d",&s[i]);
  }
  
  scanf("%d",&q);
  for(i=0;i < q;i++){
    scanf("%d",&t[i]);
  }

  for(i=0;i < q;i++){
    for(j=0;j < n;j++){
      if(t[i]==s[j]){
	count++;
	break;
      }
    }
  }
  
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 640
package main

import (
  "bufio"
  "fmt"
  "os"
  "strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var rd = bufio.NewReaderSize(os.Stdin, 10000000)

func readLine() string {
  buf := make([]byte, 0, 10000000)
  for {
	l, p, _ := rd.ReadLine()
	buf = append(buf, l...)
	if !p {
	  break
	}
  }
  return string(buf)
}

func nextStr() string {
  sc.Scan()
  return sc.Text()
}

func nextInt() int {
  sc.Scan()
  i, _ := strconv.Atoi(sc.Text())
  return i
}

func main() {
  sc.Split(bufio.ScanWords)
  K, S := nextInt(), nextInt()
  cnt := 0
  for i := 0; i <= K; i++ {
    for j := 0; j <= K; j++ {
		k := S - (i + j)
		if k >= 0 && k <= K{
		  cnt++
		}
	}
  }
  fmt.Println(cnt)
}

Measured memory_bytes: 2160
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 1000020;
ll A, B, C, D, E, F, G, H, X, Y, Z, P, Q, M, N, T, R, K, W, L, ANS;
string S, S1, S2;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    vector<PP> VP;
    multiset<PP> M1, M2;
    rep(i, N) {
        cin >> S;
        A = S.length();
        B = 0;
        C = 0;
        rep(j, A) {
            if(S[j] == '(')
                B++;
            else
                B--;
            C = min(B, C);
        }
        if(B >= 0) {
            M1.insert({-C, B});
            continue;
        }
        reverse(all(S));
        A = S.length();
        B = 0;
        C = 0;
        rep(j, A) {
            if(S[j] == '(')
                B--;
            else
                B++;
            C = min(B, C);
        }
        M2.insert({-C, B});
    }

    A = 0;
    while(!M1.empty()) {
        auto ite = M1.upper_bound({A + 1, -INF});
        if(ite == M1.begin()) {
            cout << "No" << endl;
            return 0;
        }
        ite--;
        // cout << (*ite).fi << " " << (*ite).se << endl;
        A += (*ite).se;
        M1.erase(ite);
    }

    B = 0;
    while(!M2.empty()) {
        auto ite = M2.upper_bound({B + 1, -INF});
        if(ite == M2.begin()) {
            cout << "No" << endl;
            return 0;
        }
        ite--;
        // cout << (*ite).fi << " " << (*ite).se << endl;
        B += (*ite).se;
        M2.erase(ite);
    }

    if(A != B)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
}

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

const int maxn=1005;

// int main(int argc, char const *argv[])
// {
// 	ios::sync_with_stdio(false);
// 	string s;
// 	while(cin>>s){
// 		map<char,int>ss;
// 		for(int i=0;i<s.length();i++){
// 			ss[s[i]]++;
// 		}
// 		bool flag=0;
// 		for(auto it:ss){
// 			if(it.second>=3){
// 				flag=1;
// 				break;
// 			}
// 		}
// 		if(flag) cout<<"Yes"<<endl;
// 		else cout<<"No"<<endl;
// 	}
// 	return 0;
// }
typedef long long ll;

ll a[maxn];

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	int n;
	a[0]=2,a[1]=1;
	for(int i=2;i<100;i++){
		a[i]=a[i-1]+a[i-2];
	}
	while(cin>>n){
		cout<<a[n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int A,B;
  cin >> A >> B;
  cout << 100 << " " << 100 << endl;
  char ans[100][100];
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      if (j < 50) {
        ans[i][j] = '.';
      } else {
        ans[i][j] = '#';
      }
    }
  }
  vector<P> black;
  for (int i = 0; i < 100; i+=2) {
    for (int j = 0; j < 50; j+=2) {
      black.push_back(make_pair(i,j));
    }
  }
  vector<P> white;
  for (int i = 0; i < 100; i+=2) {
    for (int j = 99; j >= 50; j-=2) {
      white.push_back(make_pair(i,j));
    }
  }
  for (int i = 0; i < B-1; i++) {
    ans[black[i].F][black[i].S] = '#';
  }
  for (int i = 0; i < A-1; i++) {
    ans[white[i].F][white[i].S] = '.';
  }
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      cout << ans[i][j];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3672
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

k = I()
tmp = 0
for i in range(k+1):
    tmp += 7 * pow(10, i, k)
    tmp %= k
    if tmp % k == 0:
        print(i+1)
        quit()
print(-1)

Measured memory_bytes: 68016
all_days=int(input())
days1=int(input())
sp_p=int(input())
n_p=int(input())
ans = 0

if all_days <= days1:
    ans = sp_p * all_days
else:
    ans = days1 * sp_p + (all_days-days1) * n_p

print(ans)

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

using namespace std;

string s;

bool dfs(int i, string v) {
    if (i == 3) {
        int sum = s[0] - '0';
        for (int j = 0; j < v.size(); j++) {
            if (v[j] == '+')
                sum += s[j+1] - '0';
            else 
                sum -= s[j+1] - '0';
        }
        if (sum == 7) {
            cout << s[0];
            for (int j = 0; j < v.size(); j++)
                cout << v[j] << s[j+1];
            cout << "=7" << endl;
            return true;
        }
        else 
            return false;
    }

    v.push_back('+');
    if (dfs(i+1, v))
        return true;
    v.pop_back();
    v.push_back('-');
    if (dfs(i+1, v))
        return true;

    else 
        return false;
}

int main() {
    cin >> s;
    string v;
    dfs(0, v);

    return 0;
}

Measured memory_bytes: 256
d = gets.chomp.split('')

kisu = []
gusu = []



d.each.with_index(1) do |s, e|
	if e.even?
		gusu << s
	else
		kisu << s
	end
end

if gusu.include?("R") || kisu.include?("L")
	puts "No"
else
	puts "Yes"
end

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

#define sz(x) (int) x.size()

using namespace std;
using pii = pair<int, int>;

const int N = 1e3+5;
const int MOD = 1e9 + 7;

int dp[N][N];
char c[N][N];

int add(int a, int b) {
    long long res = a + b;
    if (res > MOD)
        res -= MOD;
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            cin >> c[i][j];
    dp[0][1] = 1;
    for (int i = 1; i <= n; ++i) 
        for (int j = 1; j <= m; ++j)
            if (c[i][j] == '.') 
                dp[i][j] = add(dp[i - 1][j], dp[i][j - 1]);
    cout << dp[n][m];
    return 0;
}               

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

using namespace std;

int main(void){

	vector<vector<int>> c(4, vector<int>(4));

	for (int i = 1; i <= 3; i++) {
		for (int j = 1; j <= 3; j++) {
			cin >> c[i][j];
		}
	}

	if (c[2][1] - c[1][1] != c[2][2] - c[1][2]
		|| c[2][1] - c[1][1] != c[2][3] - c[1][3]
		|| c[3][1] - c[2][1] != c[3][2] - c[2][2]
		|| c[3][1] - c[2][1] != c[3][3] - c[2][3]
		) {
		cout << "No" << endl;
		return 0;
	}
	if (c[1][2] - c[1][1] != c[2][2] - c[2][1]
		|| c[1][2] - c[1][1] != c[3][2] - c[3][1]
		|| c[1][3] - c[1][2] != c[2][3] - c[2][2]
		|| c[1][3] - c[1][2] != c[3][3] - c[3][2]
		) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	return 0;
}

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

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N;
    cin >> N;
    string S;
    cin >> S;
    int max = 0;
    for (int ci = 0; ci < N; ci++) {
        vector<bool> xexists(26, false);
        for (int xi = 0; xi < ci; xi++) {
            xexists[S[xi] - 'a'] = true;
        }
        vector<bool> yexists(26, false);
        for (int yi = ci; yi < N; yi ++) {
            yexists[S[yi] - 'a'] = true;
        }
        int cnt = 0;
        for (int i = 0; i < 26; i++) {
            if (xexists[i] && yexists[i]) cnt++;
        }
        if (cnt > max) {
            max = cnt;
        }
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
// using System.Collections.Generic;
// using System.Linq;
// using System.Text;

class Program
{
    static void Main()
    {
        string[] arr = Console.ReadLine().Split();
        int A, B;
        A = int.Parse(arr[0]);
        B = int.Parse(arr[1]);
        int ans = 0;
        int cur = 1;
        while (cur < B)
        {
            ans++;
            cur += A - 1;
        }
        Console.WriteLine(ans);
        return;
    }
}

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

/* short names and const
using ll = long long;
using vll = vector<long long>;
using df = vector<vll>;
df data(n, vll(m));
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
*/

/* Boost!
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
using boost::algorithm::split; // split(result, s, boost::is_any_of(","));
#include <boost/algorithm/string/join.hpp>
using boost::algorithm::join; // string s = join(arr, "");
#include <boost/algorithm/string/replace.hpp>
using boost::algorithm::replace_all; // replace_all(s, "AtCoder", "A");
#include <boost/range/algorithm.hpp> // boost::sort(arr)
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
*/

/* print(arr)
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}
*/

/* fast cin and precise cout
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  getline(cin, s);
  cout << fixed << setprecision(15);
*/

/* sum function
int sum(vector<int> &arr) {
  int res = accumulate(arr.begin(), arr.end(), 0);
  return res;
}
*/

int main()
{
  int n;
  cin >> n;
  int sqr = static_cast<int>(sqrt(n));
  cout << sqr * sqr << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#define lowbit(a) ((a)&(-(a)))
using namespace std;

void file(bool opt)
{
	if (opt&&fopen("in.txt", "r"))
	{
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
}

long long a, b;
long long A, B;
priority_queue<long long>l;
priority_queue<long long, vector<long long>, greater<long long>>r;

void update()
{
	B += b;
	if (l.empty())
		l.push(a);
	else if (a <= l.top())
	{
		A += l.top() - a;
		l.push(a);
	}
	else
	{
		A += a - l.top();
		r.push(a);
	}

	while (l.size() >= (r.size() + 2))
	{
		r.push(l.top());
		l.pop();
		A -= 1ll * (r.top() - l.top())*(l.size() - r.size());
	}
	while (r.size() > l.size())
	{
		A -= 1ll * (r.top() - l.top())*(r.size() - l.size());
		l.push(r.top());
		r.pop();
	}

}

int main()
{
	int n;
	scanf("%d", &n);
	while (n--)
	{
		int opt;
		scanf("%d", &opt);
		if (opt == 1)
		{
			scanf("%lld%lld", &a, &b);
			update();
		}
		else
			printf("%d %lld\n", l.top(), A + B);
	}
	return 0;
}

Measured memory_bytes: 3828
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = Console.ReadLine().Split();
            var N = int.Parse(ss[0]);
            var K = int.Parse(ss[1]);

            if (K == 1)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(N - K);
            }
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	if (S == "Sunny") {
		cout << "Cloudy" << endl;
	}
	else if (S == "Cloudy") {
		cout << "Rainy" << endl;
	}
	else if (S == "Rainy") {
		cout << "Sunny" << endl;
	}
	
}


Measured memory_bytes: 3460
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
ll MOD = (1e9)+7;
const int dr[] = {+1, -1, +0, +0, +1, -1, +1, -1};
const int dc[] = {+0, +0, +1, -1, +1, -1, -1, +1};
const int kx[] = {+1, +2, -1, -2, +1, +2, -1, -2};
const int ky[] = {+2, +1, +2, +1, -2, -1, -2, -1};
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
inline void fastIO(){
  ios_base::sync_with_stdio(0);cin.tie(0);
}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "(" << #__VA_ARGS__ << "):", debug_out(__VA_ARGS__)
#else
#define debug(...) 47
#endif

int main(){
  fastIO();
  int k,ans=1,a=7;
  cin>>k;
  for(int i=0;i<k;i++){
    if(a%k==0){
      cout<<ans<<endl;
      return 0;
    }
    a=((a*10)+7)%k,ans++;
  }
  cout<<-1<<endl;
  return 0;
}


Measured memory_bytes: 3564
/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-11-15 21:19:09
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int main()
{
  string S;
  cin >> S;
  int ans = 0;
  for (auto x : S)
  {
    if (x == '1')
    {
      ++ans;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
# #!/usr/bin/env python3

N, W = map(int, input().split())

weight = []
value = []
for _ in range(N):
    w, v = map(int, input().split())
    weight.append(w)
    value.append(v)
# print(N, W)
# print(weight, value)

max_sum_v = N * 1000
inf = float("inf")
dp = [[inf for i in range(max_sum_v + 1)] for j in range(N + 1)]

# for i in range(max_sum_v + 1):
#     dp[0][i] = 0

dp[0][0] = 0

# # dp[i + 1][sum_v]: i番目までの品物から価値がsum_v以上になるように選んだときの、重さの総和の最小値
# # dp[i + 1][sum_v] = max(dp[i][sum_v], dp[i][sum_v - v[i]] + w[i])

for i in range(N):
    for sum_v in range(max_sum_v + 1):
        if sum_v - value[i] >= 0:
            dp[i + 1][sum_v] = min(dp[i][sum_v], dp[i][sum_v - value[i]] + weight[i])
        else:
            dp[i + 1][sum_v] = dp[i][sum_v]

for sum_v in range(max_sum_v + 1):
    if dp[N][sum_v] <= W:
        res = sum_v

print(res)


Measured memory_bytes: 319412
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
long long gcd(long long a, long long b) {
  // the greatest common divisor
  while (b != 0) {
    long long r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) {
  // the least common multiple
  return (a / gcd(a, b)) * b;
}

int main() {
  int n;
  LL X;
  cin >> n >> X;
  VEC<LL> x(n);
  VEC<LL> d(n);
  REP(i, 0, n) {
    cin >> x[i];
    d[i] = abs(x[i] - X);
  }
  LL ma = d[0];
  REP(i, 0, n - 1) { ma = min(ma, gcd(d[i], d[i + 1])); }
  cout << ma << endl;

  return 0;
}


Measured memory_bytes: 1792
a=list(map(int,input().split()))
b=list(map(int,input().split()))
count = a[0]
choice = a[1]
all = sum(b)
answer = 1
b.sort(reverse=True)
for i in range(choice):
     if b[i]<(all/(4*choice)):
          answer = answer*0
if answer==0:
     print("No")
else:
     print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int h,w;
    cin >> h >> w;
    string s;
    vector<string> ans;
    rep(i,h){
        cin >> s;
        rep(j,2) ans.push_back(s);
        
    }
    rep(i,h*2){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007
#define inf 1e18
#define all(v) (v).begin(),(v).end()
using namespace std;

vector <int> dx = {-1,1,0,0};
vector <int> dy = {0,0,-1,1};

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;cin>>n;
	vector<pair<int,int>> v(n);
	int i;
	pair<int,int> a;
	pair<int,int> b;
	pair<int,int> c;
	pair<int,int> d;
	int mn = INT_MAX, mx = INT_MIN, mn1 = INT_MAX, mx1 = INT_MIN;
	for(i = 0;i < n; ++i){
		cin >> v[i].first >> v[i].second;
	}
	for(i = 0;i < n; ++i){
		int p = v[i].first + v[i].second;
		int q = v[i].first - v[i].second;
		if(mn > p){
			mn = p;
			a = {v[i].first,v[i].second};
		}
		if(mx < p){
			mx = p;
			b = {v[i].first,v[i].second};
		}
		if(mn1 > q){
			mn1 = q;
			c = {v[i].first,v[i].second};
		}
		if(mx1 < q){
			mx1 = q;
			d = {v[i].first,v[i].second};
		}

	}
	int d1 = abs(a.first - b.first) + abs(a.second - b.second);
	int d2 = abs(c.first - d.first) + abs(c.second - d.second);
	cout << max(d1,d2) <<"\n";


	return 0;
}

Measured memory_bytes: 4744
#pragma region Preparation
/* competitive programming */
#include "bits/stdc++.h"
using namespace std;

/* using */
// long
using ll = long long;
using ld = long double;
// vector
using vi = vector<int>;
using vd = vector<double>;
using vll = vector<ll>;
using vld = vector<ld>;
using vs = vector<string>;
using vi2 = vector<vector<int>>;
using vll2 = vector<vector<ll>>;

/* define */
// array
#define ari(x) array<int, x>
#define ard(x) array<double, x>
#define arll(x) array<ll, x>
#define arld(x) array<ld, x>
#define ars(x) array<string, x>
#define ari2(x, y) array<array<int, y>, x>
#define arll2(x, y) array<array<ll, y>, x>
// int -> ll
#define int ll // int -> ll
// push_back系
#define pb(x) push_back(x)    // push_back
#define eb(x) emplace_back(x) // emplace_back
// all range
#define all(x) x.begin(), x.end() // all_range
// gcd, lcm
#define gcd(x, y) __gcd(x, y)         // gcd
#define lcm(x, y) (x / gcd(x, y) * y) // lcm
// PI
#define PI M_PI // PI
// 大文字・小文字変換
#define cup(x) toupper(x)                                              // char_toupper
#define clow(x) tolower(x)                                             // char_tolower
#define strup(x) *transform(x.begin(), x.end(), x.begin(), ToUpper())  // string_toupper
#define strlow(x) *transform(x.begin(), x.end(), x.begin(), ToLower()) // string_tolower
// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

// 大文字・小文字変換
struct ToUpper
{
    char operator()(char c) { return toupper(c); }
};
struct ToLower
{
    char operator()(char c) { return tolower(c); }
};
#pragma endregion

#pragma region External variables
/* A・B問題用外部変数 */
ll a, b, c, d, x, y, p, q, r; // 基本変数
ll n, k;                      // 範囲・長さ・整数用
ll ans;                       // 答え
ll tmp;                       // 一時保存
ll L, R;                      // 左、右
string s;                     // 文字列用
#pragma endregion

/* main */
void Main(void)
{
    cin >> a >> p;
    tmp = a * 3 + p;
    ans = tmp / 2;
    cout << ans << endl;
}

#pragma region main
signed main(void)
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0LL;
}
#pragma endregion


Measured memory_bytes: 3548
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws Exception {
		//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Scanner scanner = new Scanner(System.in);
		int A[] = new int[Integer.parseInt(scanner.next())];
		//Scanner scanner = new Scanner(br.readLine());
		for(int i=0; i<A.length; i++) {
			A[i] = Integer.parseInt(scanner.next());
		}
		//scanner.close();
		int B[] = new int[Integer.parseInt(scanner.next())];
		//scanner = new Scanner(br.readLine());
		for(int i=0; i<B.length; i++) {
			B[i] = Integer.parseInt(scanner.next());
		}
		scanner.close();

		int ret = 0;
		for(int i=0; i<B.length; i++) {
			for(int j=0; j<A.length; j++) {
				if(B[i]==A[j]) {
					ret++;
					break;
				}
			}
		}
		System.out.println(ret);

	}

}



Measured memory_bytes: 39252
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int d = in.nextInt();

            if (a + b < c + d) {
                out.print("Right");
            } else if (a + b > c + d) {
                out.print("Left");
            } else {
                out.print("Balanced");
            }

        }

    }
}



Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define MOD 1000000007
#define deb(n) cout<<"[ "#n<<" = "<<n<<" ]"<<endl;
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const long long  MAX = 1 << 18;
int case_no = 1;
#define w(x) int x; cin>>x; while(x--)

int main() {
	FIO
	int n, cnt = 0;
	cin >> n;
	vector<int> arr(n);
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	for(int i = 0; i < n - 2; i++) {
		for(int j = i + 1; j < n - 1; j++) {
			for(int k = j + 1; k < n; k++) {
				if((arr[i] != arr[j]) and (arr[j] != arr[k]) and (arr[i] != arr[k]) and (arr[i] + arr[j] > arr[k]) and (arr[i] + arr[k] > arr[j]) and (arr[j] + arr[k] > arr[i])) {
					//cout << i + 1 << " " << j + 1 << " " << k + 1 << endl;
					cnt++;
				}
			}
		}
	}
	cout << cnt << endl;

	return 0;
}

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

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

typedef pair<int, int> pint;

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front

#define MOD (1000 * 1000 * 1000 + 7)

struct D {ll x, y, z;};

ll score(D d, int bit) {
    ll s = 0L;

    s += d.x * (((bit >> 0) & 1) ? -1 : 1);
    s += d.y * (((bit >> 1) & 1) ? -1 : 1);
    s += d.z * (((bit >> 2) & 1) ? -1 : 1);

    return s;
}

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

    vector<D> xyz(N);

    REP(i, N) {
        ll x, y, z;
        cin >> x >> y >> z;
        xyz[i] = D{x, y, z};
    }

    ll ans = 0L;
    REP(i, 8) {
        vector<pair<ll, int>> scores;

        REP(j, N) {
            ll s = score(xyz[j], i);
            scores.pb(make_pair(s, j));
        }

        sort(ALL(scores), greater<pair<ll, int>>());

        vector<ll> sum(3, 0L);
        REP(j, M) {
            D d = xyz[scores[j].second];

            sum[0] += xyz[scores[j].second].x;
            sum[1] += xyz[scores[j].second].y;
            sum[2] += xyz[scores[j].second].z;
        }

        ans = max(ans, abs(sum[0]) + abs(sum[1]) + abs(sum[2]));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void)
{
    long long n,k,sum=0;
    cin >> n >> k;
    for(long long i=k;i<=n+1;i++)
    {
        long long a=i*(i-1)/2;
        long long b=n*(n+1)/2-(n-i)*(n-i+1)/2;
        sum+=(b-a+1)%1000000007;
        sum%=1000000007;
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long lint;

int main(){
	string s;
	cin >> s;
	if(s[2]==s[3] && s[4]==s[5])cout << "Yes\n";
	else cout<<"No\n";
}

Measured memory_bytes: 256
//   2次配列のよみこみ

function Main(input) {
    input = input.split("\n");
  
    a = input[0].split(" ").map(Number);
    b = input[1].split(" ").map(Number);
    c = input[2].split(" ").map(Number);
    
    n = Number(input[3].split(" "));
    a = a.concat(b);
    a = a.concat(c);

//console.log(a);

var r=[0,0,0,0,0,0,0,0,0];
for(i=4;i<n+4;i++){
    m = Number(input[i].split(" "));
    var result = a.indexOf(m);
    if(result!==-1){
             r[result]=1;}
    }
 // console.log(r);
  var ans=0;
  if(r[0]==1&&r[1]==1&&r[2]==1){var ans=1;}
   if(r[3]==1&&r[4]==1&&r[5]==1){var ans=1;}
    if(r[6]==1&&r[7]==1&&r[8]==1){var ans=1;}
     if(r[1]==1&&r[4]==1&&r[7]==1){var ans=1;}
      if(r[2]==1&&r[5]==1&&r[8]==1){var ans=1;}
       if(r[0]==1&&r[4]==1&&r[8]==1){var ans=1;}
       if(r[2]==1&&r[4]==1&&r[6]==1){var ans=1;}
        if(r[0]==1&&r[3]==1&&r[6]==1){var ans=1;}
   if(ans==1){console.log('Yes');}else{console.log('No');}    
  
  
    
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
import math

nd=input()

N = int(nd.split()[0])
D = int(nd.split()[1])

res = 0
for i in range(N):
 xy = input()
 x = int(xy.split()[0])
 y = int(xy.split()[1])
 dn = math.sqrt(x*x+y*y)
# print(x)
# print(y)
# print(dn)
 if dn <= D:
  res += 1
  
#print(N)
#print(D)
#print("res")
print(res)

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

long long solve(long long n) {
  
  if(n == 1) {
    return 1;
  }
  
  return 2 * solve(n / 2) + 1;
  
}

int main(){
  long long h, ans;
  cin >> h;
  
  ans = solve(h);
  
  cout << ans << endl;
}

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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

int n;

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n;

    int ans = (n-1)/2;
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int a,b,d;
	scanf("%d %d",&a,&b);
	d = a-b;

	if(d>0)
		printf("a > b\n");
	else if(d<0)
		printf("a < b\n");
	else
		printf("a == b\n");

	return 0;
}

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using pint = pair<int, int>; 
using pll  = pair<ll, ll>;
using vint = vector<int>; 
using vll  = vector<ll>;
using vstr = vector<string>;

//　定数, 変数 *********************************************
const ll MOD=1e9+7;
const ll INF=1ll<<60;

int A,B,C,K;
// *********************************************************
int main(){

    cin >>  A>> B >>C>>K ;

    while(A>=B){
        if(K==0){
            cout<<"No"<<endl;
            return 0;
        }
        B *= 2;
        K -= 1;
    }
    while(B>=C){
        if(K==0){
            cout<<"No"<<endl;
            return 0;
        }
        C *= 2;
        K -= 1;

    }

    cout << "Yes"<<endl;


    return 0;
}

Measured memory_bytes: 3596
import numpy as np

HWK=np.array(input().split(" "),dtype=np.int64)
H=HWK[0]
W=HWK[1]
K=HWK[2]

C=[]
for i in range(H):
    C.append(list(input()))

count=0

for maskR in range((1<<H)):
    for maskC in range((1<<W)):
        black=0
        for i in range(H):
            for j in range(W):
                if(((maskR>>i)&1)==0) and (((maskC>>j)&1)==0) and C[i][j]=="#":
                    black+=1
        if(black==K):
            count+=1

print(count)

Measured memory_bytes: 27092
#include <iostream>
    #include <vector>
    #include <cmath>
    using namespace std;

    int main() {

        int x, n;

        cin >> x >> n;

        vector<int> v(102, 0);

        for(int i = 0; i < n; ++i) {
            int index;
            cin >> index;
            v[index] = 1;

        }

        int minD = 1000000;
        int minValue = 10000;

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

            if(i >= 0 && v[i])
                continue;

            int a = abs(x - i);
            if(minD > a) {

                minD = a;
                minValue = i;

            }

        }

        cout << minValue << endl;

        return 0;    

    }

Measured memory_bytes: 3628