akhauriyash/Code-Regression huggingface dataset:
/*
 * Author: Khan
 * Date: 10th October, 2017
 */
#include <stdio.h>

void print(int A[], int N)
{
    printf("%d", A[0]);
    for (int i = 1; i < N; ++i)
    {
        printf(" %d", A[i]);
    }
    putchar('\n');
}

void insertionSort(int A[], int N)
{
    int v;
    for (int i = 1; i < N; ++i)
    {
        v = A[i];
        int j = i - 1;
        while(j >= 0 && A[j] > v)
        {
            A[j + 1] = A[j];
            --j;
        }
        A[j + 1] = v;
        print(A, N);
    }
}

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    int N, A[100];
    scanf("%d", &N);
    for (int i = 0; i < N; ++i)
    {
        scanf("%d", &A[i]);
    }
    print(A, N);
    insertionSort(A, N);
    return 0;
}

Measured memory_bytes: 1828
/*----------------by syr----------------*/
/*
  -----  -----  -----
  |   |  |---|    _/
  |   |  | \_    /
  -----  |   \  -----

  |---\  \   /  |\  /|
  |   |   \_/   | \/ |
  |   |   / \   |    |
  |---/  /   \  |    |
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i,x,y) for(int i=(x);i<(y);++i)
#define REP(i,x,y) for(int i=(x);i<=(y);++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef pair<int,int> pii;

const int INF=1e9+7;
const int maxn=105;
const int maxk=1e5+5;

int n,k;
int a[maxn];
int dp[maxn][maxk],sum[maxn][maxk];

int main(){
	scanf("%d%d",&n,&k);
	REP(i,1,n) scanf("%d",a+i);
	dp[0][k]=1;sum[0][k]=1;
	REP(i,1,n){
		REP(j,0,k){
//			printf("i=%d j=%d %d %d\n",i,j,sum[i-1][min(k,j+a[i])],(j?sum[i-1][j-1]:0));
			dp[i][j]=(sum[i-1][min(k,j+a[i])]-(j?sum[i-1][j-1]:0)+INF)%INF;
		}
		sum[i][0]=dp[i][0];
		REP(j,1,k) sum[i][j]=(sum[i][j-1]+dp[i][j])%INF;
	}
//	REP(i,1,n){
//		REP(j,0,k) printf("%d ",dp[i][j]);
//		puts("");
//	}
	printf("%d\n",dp[n][0]);
	return 0;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int64 t1,t2;
    cin >> t1 >> t2;
    int64 a1,a2,b1,b2;
    cin >> a1 >> a2 >> b1 >> b2;
    int64 dif = (t1 * a1 + t2 * a2) - (t1 * b1 + t2 * b2);
    if(dif == 0){
        cout << "infinity\n";
        return 0;
    }
    int64 difmid = t1 * a1 - t1 * b1;
    if((dif > 0 && difmid > 0) || (dif < 0 && difmid < 0)){
        cout << 0 << endl;
        return 0;
    }
    dif = abs(dif);
    difmid = abs(difmid);
    int64 ans = difmid / dif * 2 + 1;
    if(difmid % dif == 0)ans--;
    ANS(ans);
    return 0;
}

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

void nil()
{
	int n,d,count=0;
	cin>>n>>d;
	while(n--)
	{
		int a,b,x,y;
		cin>>a>>b;
		x=pow(a,2);
		y=pow(b,2);
		double m =  sqrt(x+y);
		if(m<=d)
		{
			count++;
		}
	}
	cout<<count;
}
int32_t main()
{
	#ifndef ONLINE_JUDGE

		freopen("input1.txt","r",stdin);
		freopen("output1.txt","w",stdout);
	#endif	
		nil();
		/*int t;
		cin>>t;
		while(t--)
		{
			nil();
		}*/
		

}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N;
  cin >> N;

  long long A[N];

  for (long long i = 0; i < N; i++) {
      cin >> A[i]; 
  }
  
  long long count_sum = 0;
  long long count = 0;
  long long count_pre = 0;
  long long mod = pow(10,9) + 7;

  for (long long i = 0; i < N; i++){
       count_sum += A[i];
  }

  for (long long i = 0; i < N; i++) {
      count_sum -= A[i]; 
      count_pre = count_sum % mod;
      count += (count_pre * A[i]) % mod;
      count_pre = 0;     
  }
      cout << count % mod <<endl;
}

Measured memory_bytes: 5188
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define sh short int
#define pb push_back
#define mid (l+r)/2
#define S second
#define F first
using namespace std;
const int inf = 1e9*2;
const int mod = 1e9+7;
ll t,id,n;
ll dp[69][19];
ll bt(ll id,ll last){
    if(id == n) return 1;
    ll &ret = dp[id][last];
    if(ret != -1) return ret;
    ret = 0;
    for(ll i=last;i<=9;i++){
        ret += bt(id+1,i);
    }
    return ret;
}
void solve(){
    cin>>id>>n;
    memset(dp,-1,sizeof(dp));
    cout<<id<<" "<<bt(0,0)<<endl;
}
string s,s1,s2;
int a,b;
int main(){
    cin>>s1>>s2;
    cin>>a>>b;
    cin>>s;
    if(s == s1) cout<<a-1<<" "<<b<<endl;
    else cout<<a<<" "<<b-1<<endl;
}


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

int sum_of_digits(int num){
  int sum = 0;
  while(num > 0){
    sum += num % 10;
    num /= 10;
  }

  return sum;
}


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

  if(num % sum_of_digits(num) == 0) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x

using namespace std;
int main()
{

	std::ios::sync_with_stdio(false);
	int t;
	cin >> t;
	ll ans = t + t * t + t * t * t ;
	cout << ans;
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep2(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define ALL(vec) vec.begin(), vec.end()
typedef long long ll;
typedef long double ld;

int cnt_le(vector<ll>::iterator b, vector<ll>::iterator e, ld val){
    return distance(b, upper_bound(b, e, val));
}
int cnt_ge(vector<ll>::iterator b, vector<ll>::iterator e, ld val){
    return distance(lower_bound(b, e, val), e);
}

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a.at(i);
    sort(ALL(a));

    ll ng = -1e18-1;
    ll ok =  1e18+1;
    while (abs(ok - ng) > 1){
        ll m = (ok + ng) / 2;
        ll c = 0;
        rep2(i, 1, n){
            ld val =  (ld)m / a.at(i);
            if     (a.at(i) > 0) c += cnt_le(a.begin(), a.begin()+i, val);
            else if(a.at(i) < 0) c += cnt_ge(a.begin(), a.begin()+i, val);
            else c += (m >= 0) ? i : 0;
        }
        if (c >= k) ok = m;
        else ng = m;
    }
    cout << ok << endl;
}

Measured memory_bytes: 1792
def gcd(l, r):
  while r:
    l, r = r, l%r
  return l
N, *X = map(int, open(0).read().split())
X = sorted(X)
ans = X[1] - X[0]
for i in range(N):
  ans = gcd(ans, X[i+1] - X[i])
print(ans)

Measured memory_bytes: 14052
package main

import "fmt"

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	var A, B, C, K int
	fmt.Scan(&A, &B, &C, &K)
	if K%2 != 0 {
		fmt.Println(-A + B)
	} else {
		fmt.Println(A - B)
	}
}


Measured memory_bytes: 512
import sys
from heapq import heappush, heappop
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())


def main():
    n = ii()
    F = []
    P = []
    for _ in range(n):
        F.append(li())
    for _ in range(n):
        P.append(li())
    
    inf = 10 ** 18
    ans = -inf
    for i in range(1, 1<<10):
        c = [0]*(n)
        tmp = 0
        for j in range(10):
            if (i>>j)&1:
                for k in range(n):
                    c[k] += F[k][j]
        for k in range(n):
            tmp += P[k][c[k]]
        ans = max(ans, tmp)
    print(ans)
            
            
        
    




if __name__ == '__main__':
    main()

Measured memory_bytes: 9220
# include <bits/stdc++.h>
# define pb push_back
# define ll long long
# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define DEBUG

using namespace std;

const int N = 1e5 + 7;
const int mod = 1e9 + 7;

ll n, ans;
string s[N];
map < string, int > mp;

int main()
{
    speed;
    /// Author: Dilshod--Imomov
    #ifdef DEBUGd
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif // DEBUG
    cin >> n;
    for ( int i = 0; i < n; i++ ) {
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
        mp[s[i]]++;
    }
    for ( int i = 0; i < n; i++ ) {
        if ( mp[ s[i] ] > 0 ) {
            ll cnt = mp[ s[i] ] - 1;
            cnt *= mp[ s[i] ];
            cnt /= 2;
            ans += cnt;
            mp[ s[i] ] = 0;
        }
    }
    cout << ans;
}



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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

ll maxi = 0;
ll H, W;
vector<string> S;

vector<pair<ll, ll>> directions{
    {1, 0},
    {-1, 0},
    {0, 1},
    {0, -1},
};

void bfs(ll x, ll y) {
    queue<pair<ll, ll>> Q;
    vector<vector<ll>> D(H, vector<ll>(W, -1));
    if(S[y][x] == '#') return;
    Q.emplace(x, y);
    D[y][x] = 0;
    while(!Q.empty()) {
        tie(x, y) = Q.front();
        Q.pop();
        iter(i, directions) {
            ll tx, ty;
            tx = x + i.first;
            ty = y + i.second;
            if(tx < 0 || tx >= W || ty < 0 || ty >= H) continue;
            if(S[ty][tx] != '#' && D[ty][tx] == -1) {
                D[ty][tx] = D[y][x] + 1;
                maxi = max(maxi, D[ty][tx]);
                Q.emplace(tx, ty);
            }
        }
    }
}

int main(void) {
    cin >> H >> W;
    S.resize(H);
    rep(i, H) cin >> S[i];
    rep(h, H) {
        rep(w, W) bfs(w, h);
    }
    cout << maxi << endl;
    return 0;
}


Measured memory_bytes: 3580
h,w = map(int,input().split())
s = [input() for i in range(h)]
ans = 0
from collections import deque
for i in range(h):
    for j in range(w):
        if s[i][j]=='#':continue
        q = deque([(i,j)])
        reach = [[-1]*w for _ in range(h)]
        reach[i][j] = 0
        c = 0
        while q:
            x,y = q.popleft()
            for k,l in[[-1,0],[0,1],[1,0],[0,-1]]:
                if 0<=x+k<h and 0<=y+l<w:
                    if reach[x+k][y+l]<0 and s[x+k][y+l]=='.':
                        reach[x+k][y+l] = reach[x][y]+1
                        ans = max(ans,reach[x+k][y+l])
                        q.append((x+k,y+l))
            
print(ans)

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void) {
    ll n, m;
    cin >> n >> m;
    vector<ll> h(n+1, 0);
    for(ll i = 1; i <= n; i++){
        ll a;
        cin >> a;
        h[i] = a;
    }
    vector<bool> ans(n+1, true);
    vector<bool> check(n+1, false);
    for(ll i = 0; i < m; i++){
        ll a, b;
        cin >> a >> b;
        if(h[a]>h[b]) ans[b] = false;
        else if(h[a]<h[b]) ans[a] = false;
        else if(h[a]==h[b]) {
            ans[a] = false;
            ans[b] = false;
        }
    }
    ll count = 0;
    for(ll i = 1; i <= n; i++){
       // cout << ans[i] << endl;
        if(ans[i]==true) count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 4052
import java.util.Arrays;
import java.util.Scanner;

class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int[] cost = new int[3];
        for (int i = 0; i <3; i++) {
            cost[i] = sc.nextInt();
        }
        Arrays.sort(cost);
        System.out.println(cost[0] + cost[1]);
    }
}

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

int main() {
  std::vector<uint32_t> cache;
  cache.reserve(100);
  cache.push_back(1);
  {
    uint32_t six = 6;
    while (six < 100000) {
      cache.push_back(six);
      six *= 6;
    }
  }
  {
    uint32_t nine = 9;
    while (nine < 100000) {
      cache.push_back(nine);
      nine *= 9;
    }
  }

  std::sort(cache.begin(), cache.end());

  std::array<uint32_t, 100000> ans;
  ans.fill(100000);
  for (const auto i : cache) {
    ans[i - 1] = 1;
  }

  for (uint32_t i = 0; i < 100000; i++) {
    for (const auto j : cache) {
      if (i + j < 100000) {
        ans[i + j] = std::min(ans[i + j], ans[i] + 1);
      }
    }
  }

  uint32_t n;
  std::cin >> n;
  std::cout << ans[n - 1] << std::endl;

  return 0;
}


Measured memory_bytes: 640
N, M = map(int, input().split())
AB = [0] * N
for i in range(N):
    AB[i] =list(map(int, input().split()))

AB.sort()

count = 0
money = 0
i = 0

while count < M:
    money += AB[i][0] * AB[i][1]
    count += AB[i][1]
    i += 1

if count > M:
    tmp = count - M
    money -= AB[i-1][0]*tmp

ans = money
print(ans)





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

int main() {
  int n, cnt = 0; cin >> n;
  for (int i = 1; i+i < n; i++)
    if (n - i != i && n - i != 0) cnt++;
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
M = int(input())
DC = [list(map(int, input().split())) for _ in range(M)]

digits_sum = 0
digits_length = 0
for d, c in DC:
    digits_sum += d*c
    digits_length += c

# print(digits_sum, digits_length)

print((digits_length - 1) + ((digits_sum-1) // 9))


Measured memory_bytes: 45360
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define mems(x)     memset(x,0,sizeof(x))
#define all(a)      a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

/*---------------------------------------------------------------------------------------------------*/

#define N 1000050 
  
int lpf[N], mobius[N]; 

void least_prime_factor() 
{ 
    for (int i = 2; i < N; i++) 
        if (!lpf[i]) 
  
            for (int j = i; j < N; j += i) 

                if (!lpf[j]) 
                    lpf[j] = i; 
} 

void Mobius() 
{ 
    for (int i = 1; i < N; i++) { 
  
        if (i == 1) 
            mobius[i] = 1; 
        else { 
  
            if (lpf[i / lpf[i]] == lpf[i]) 
                mobius[i] = 0; 
  
            else
                mobius[i] = -1 * mobius[i / lpf[i]]; 
        } 
    } 
} 
int gcd_pairs(int a[], int n) 
{ 
    int maxi = 0; 
  
    int fre[N] = { 0 }; 
  
    for (int i = 0; i < n; i++) { 
        fre[a[i]]++; 
        maxi = max(a[i], maxi); 
    } 
  
    least_prime_factor(); 
    Mobius(); 
  
    int ans = 0; 
  
    for (int i = 1; i <= maxi; i++) { 
        if (!mobius[i]) 
            continue; 
  
        int temp = 0; 
        for (int j = i; j <= maxi; j += i) 
            temp += fre[j]; 
  
        ans += temp * (temp - 1) / 2 * mobius[i]; 
    } 
  
    return ans; 
} 

void solve()
{
   int n;
   cin >> n;
   int a[n];
   int g=1;
   f(i,n)
    {
        cin >> a[i];
        if(i==0)
          g=a[i];
        g=__gcd(g,a[i]);
    }
   int x=gcd_pairs(a,n);
   int y=n*(n-1);
   y/=2;
   if(x==y)
    cout << "pairwise coprime\n";
   else if(g==1)
    cout << "setwise coprime\n";
   else
    cout << "not coprime\n";
  
  return;
} 

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


Measured memory_bytes: 34832
program main
	implicit none
    integer::a(32)=(/1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51/),n
    read(*,*)n
    write(*,*) a(n)
    stop
end program main

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/11/18  Problem: ABC 079 A / Link: http://abc079.contest.atcoder.jp/tasks/abc079_a  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	string s;
	cin >> s;
	int f = 0;
	if (s[0] == s[1] && s[1] == s[2])f = 1;
	if (s[1] == s[2] && s[3] == s[2])f = 1;

	if (f)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 764
s = [int(input()) for i in range(4)]
var = 0
for i in range(s[0]+1):
  if (s[3]-500*i) >= 0:
    Y = s[3]-500*i
    for j in range(s[1]+1):
      if ((Y-100*j) >= 0) and (((Y-100*j)//50) <= s[2]):
        var = var+1
print(var)

Measured memory_bytes: 3060
// AOJ 2720: Identity Function
// 2017.10.9 bal4u@uu

#include <stdio.h>
#include <math.h>

#define SIZE  25
int size;
int factor[SIZE];

int ptbl[] = {
         3,   5,   7,  11,  13,  17,  19,  23,  29,
   31,  37,  41,  43,  47,  53,  59,  61,  67,  71,
   73,  79,  83,  89,  97, 101, 103, 107, 109, 113,
  127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
  179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
  233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
  283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
  353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
  419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
  467, 479, 487, 491, 499, 503, 509, 521, 523, 541,
  547, 557, 563, 569, 571, 577, 587, 593, 599, 601,
  607, 613, 617, 619, 631, 641, 643, 647, 653, 659,
  661, 673, 677, 683, 691, 701, 709, 719, 727, 733,
  739, 743, 751, 757, 761, 769, 773, 787, 797, 809,
  811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
  877, 881, 883, 887, 907, 911, 919, 929, 937, 941,
  947, 953, 967, 971, 977, 983, 991, 997, 0 };

void prime_factor(long long n)
{
  int i, d, sw;
  int *pp;

  size = 0;
  if ((n & 1) == 0) {
    factor[size++] = 2;
    do n >>= 1LL;
    while ((n & 1) == 0);
  }
  for (pp = ptbl; n > 1 && *pp > 0; pp++) {
    if (n % *pp) continue;
    d = *pp;
    factor[size++] = d;
    do n /= d;
    while (n % d == 0);
  }
  if (n > 1) {
    int b = (int)sqrt((double)n);
    for (i = 1009, sw = 0; n > 1; ) {
      if (i > b) {
        factor[size++] = (int)n;
        break;
      }
      if (n % i == 0) {
        factor[size++] = i;
        do n /= i;
        while (n % i == 0);
      }
      if (sw) { i += 2, sw = 0; }
      else    { i += 4, sw = 1; }
    }
  }
}

long long gcd(long long a, long long b)
{
	long long r;
	while (b != 0) r = a % b, a = b, b = r;
	return a;
}

long long lcm(long long a, long long b)
{
	return a/gcd(a, b)*b;
}

long long big_mod(int b, long long p, long long m)
{
   long long s = 1;
   long long d;

   d = b % m;
   while (p > 0) {
      if (p & 1) s = (s * d) % m;
      p >>= 1;
      d = (d * d) % m;
   }
   return s;
}

int main()
{
	int n, i, i2;
	long long L, a, k;

	scanf("%d", &n);
	for (i = 2; ; i++) {
		if ((i2 = i*i) > n) break;
		if (n % i2 == 0) goto NG;
	}

	prime_factor(n);
	L = factor[0]-1;
	for (i = 1; i < size; i++) L = lcm(L, factor[i]-1);
	if (L == 1) { puts("1"); return 0; }
	if (gcd(n, L) != 1) goto NG;

	prime_factor(L);
	for (a = L, i = 0; i < size; i++) a = a/factor[i]*(factor[i]-1);

	for (k = 1; k <= a; k++) {
		if (a % k == 0 && big_mod(n, k, L) == 1) {
			printf("%lld\n", k);
			return 0; 
		}
	}
NG: puts("-1");
	return 0;
}

Measured memory_bytes: 1776
#include<stdio.h>
 
int max(int a,int b){return (a<b?b:a);};
typedef struct {
  int p,s,deg,dep,h,left,right;
} Node;
 
Node t[100000];
int n;
 
void setdepth(int x){
  if(t[x].p==-1){
    t[x].dep=0;
    return;
  }
  if(t[x].dep==-1){
    setdepth(t[x].p);
    t[x].dep=t[t[x].p].dep+1;
  }
}
 
void setheight(int x){
 
  int l=t[x].left;
  int r=t[x].right;
  if(t[x].deg==0){
    t[x].h=0;
    return;
  }
  if(t[x].h==-1){
    if(l!=-1){
      setheight(l);
      t[x].h=max(t[x].h,t[l].h+1);
    }
    if(r!=-1){
      setheight(r);
      t[x].h=max(t[x].h,t[r].h+1);
    }
  }
}
 
void init(){
  int i;
  for(i=0;i<100000;i++){
    t[i].p=t[i].s=t[i].deg=t[i].dep=t[i].h=t[i].left=t[i].right=-1;
  }
}
 
int main(){
  init();
  int i,id,a,b;
 
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d",&id,&a,&b);
    if(a!=-1){
      t[id].left=a;
      t[a].p=id;
    }
    if(b!=-1){
      t[id].right=b;
      t[b].p=id;
    }
    if(a!=-1&&b!=-1){
      t[a].s=b;
      t[b].s=a;
    }
    t[id].deg=(a!=-1)+(b!=-1);
    
  }
 
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, ",i,t[i].p,t[i].s,t[i].deg);
    setdepth(i);
    setheight(i);
    printf("depth = %d, height = %d, ",t[i].dep,t[i].h);
     
    if(t[i].p==-1)printf("root\n");
    else if(t[i].deg!=0)printf("internal node\n");
    else printf("leaf\n");
     
  }
  return 0;
}



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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n, m;
    cin >> n >> m;
    vector<int> h(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> h[i];
    }
    vector<int> h1(n + 1);
    for (int i = 1; i <= m; i++)
    {
        int a, b;
        cin >> a >> b;
        h1[a] = max(h1[a], h[b]);
        h1[b] = max(h1[b], h[a]);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
    {
        // DBG(h1[i]);
        // DBG(h[i]);
        if (h1[i] < h[i])
            ans++;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3968
#include <stdio.h>

int main() {
        char buf[255];
        scanf("%s", &buf);

        bool find_a = false;
        bool find_b = false;
        for (int i = 0 ; i < 3 ; i++) {
                if (buf[i] == 'A') {
                        find_a = true;
                } else {
                        find_b = true;
                }
        }

        if (find_a && find_b) {
                printf("Yes");
        } else {
                printf("No");
        }
}

Measured memory_bytes: 128
// atcoder/abc174/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

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

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

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

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

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

  int x;
  while (cin >> x) {
    cout << (30 <= x ? "Yes" : "No") << endl;
  }

  return 0;
}


Measured memory_bytes: 3520
n, k = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]
l = sorted(l, key=lambda x:x[0])
num = 0
for i in range(n):
  num += l[i][1]
  if num >= k:
    print(l[i][0])
    break

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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int left=a+b;
    int right=c+d;
    if(left>right){
        cout << "Left" << endl;
    }else if(left<right){
        cout << "Right" << endl;
    }else{
        cout << "Balanced" << endl;
    }
}

Measured memory_bytes: 256
// luogu-judger-enable-o2
#include<cstdio>
using namespace std;
int n,k,ans,p;
int map[12][6]={
    {4,2,0,9,7},
    {1,10,8,6,4},
    {9,7,5,3,1},
    {6,4,2,0,9},
    {3,1,10,8,6},
    {0,9,7,5,3},
    {8,6,4,2,0},
    {5,3,1,10,8},
    {2,0,9,7,5},
    {10,8,6,4,2},
    {7,5,3,1,10}};
int main()
{
    scanf("%d%d",&n,&k);n-=2;
    p=n%11;
    n/=11;
    ans=n*5;
    for(int i=0;i<p;i++)
        for(int j=0;j<5;j++)
            if(map[i][j]==k)
                ans++;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
long long n[99][21];a[100],i,j;main(N){
for(scanf("%d",&N);i<N;)scanf("%d",a+i++);
for(n[0][a[0]]=i=1;i<N-1;i++)for(j=0;j<=20;j++)0<=j-a[i]&&(n[i][j-a[i]]+=n[i-1][j]),j+a[i]<=20&&(n[i][j+a[i]]+=n[i-1][j]);
printf("%lld\n",n[N-2][a[N-1]]);exit(0);}

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

int N;
long long int a[100000];

int cmpnum(const void *n1,const void *n2){
    if(*(const long long int *)n1 < *(const long long int *)n2)
	return 1;
    else if(*(const long long int *)n1 > *(const long long int *)n2)
	return -1;
    else 
	return 0;
}



int main(){
    long long int res=1LL;
    scanf("%d",&N);
    for(int i=0;i<N;i++){
	scanf("%lld",&a[i]);
	if(a[i]==0){
	    printf("0\n");
	    return 0;
	}
    }

    for(int i=0;i<N;i++){
	if(res*a[i]<res || res*a[i] > 1000000000000000000){
	    printf("-1\n");
	    return 0;
	}
	else
	    res*=a[i];
    }
    
    printf("%lld\n",res);

    return 0;
}



Measured memory_bytes: 2480
var stdin = require('fs').readFileSync('/dev/stdin', 'utf8');
var input = stdin.toString().trim().split('\n');

var S = parseInt(input[0], 10);
var h = Math.floor(S / (60 * 60)); 
var m = Math.floor(S % (60 * 60) / 60);
var s = Math.floor(S % 60);


console.log([h,m,s].join(':'));

Measured memory_bytes: 15544
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var w = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var sum = 0; var ty = a[0] + w; var pre = a[0];
        for (int i = 1; i < n; i++)
        {
            var kt = a[i] - pre;
            if (kt >= ty) sum += w;
            else if (kt >= w) sum += w;
            else sum += kt;
            ty = a[i] + w;
            pre = a[i];
        }
        sum += w;
        Console.WriteLine(sum);
    }
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
//template end

int mod = 1e9+7;
struct Mint {
    int val;
    Mint inv() const {
        int tmp, a = val, b = mod, x = 1, y = 0;
        while(b) tmp = a / b, a -= tmp * b, swap(a, b), x -= tmp * y, swap(x, y);
        return Mint(x);
    }
public:
    Mint() :val(0) {}
    Mint(ll x) :val(x >= 0 ? x % mod : x % mod + mod) {}
    int mtoi() { return this->val; }
    Mint pow(ll t) { Mint res = 1,b = *this; while(t){if(t&1)res *= b;b *= b;t >>= 1;}return res; }
    Mint& operator+=(const Mint& x) { if ((val += x.val) >= mod) val -= mod; return *this; }
    Mint& operator-=(const Mint& x) { if ((val += mod - x.val) >= mod) val -= mod; return *this; }
    Mint& operator*=(const Mint& x) { val = (ll)val * x.val % mod; return *this; }
    Mint& operator/=(const Mint& x) { return *this *= x.inv(); }
    bool operator==(const Mint& x) const { return val == x.val; }
    bool operator!=(const Mint& x) const { return val != x.val; }
    bool operator<(const Mint& x) const { return val < x.val; }
    bool operator<=(const Mint& x) const { return val <= x.val; }
    bool operator>(const Mint& x) const { return val > x.val; }
    bool operator>=(const Mint& x) const { return val >= x.val; }
    Mint operator+(const Mint& x) const { return Mint(*this) += x; }
    Mint operator-(const Mint& x) const { return Mint(*this) -= x; }
    Mint operator*(const Mint& x) const { return Mint(*this) *= x; }
    Mint operator/(const Mint& x) const { return Mint(*this) /= x; }
};
struct factorial {
    vector<Mint> Fact, Finv;
public:
    factorial(int maxx) {
        Fact.resize(maxx+1),Finv.resize(maxx+1); Fact[0]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*Mint(i+1);
        Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*Mint(i);
    }
    Mint fact(int n,bool inv=0) { if(inv) return Finv[n]; else return Fact[n]; }
    Mint nPr(int n,int r) { if(n<0||n<r||r<0) return Mint(0); else return Fact[n]*Finv[n-r]; }
    Mint nCr(int n,int r) { if(n<0||n<r||r<0) return Mint(0); else return Fact[n]*Finv[r]*Finv[n-r]; }
};

Mint dp[41][1<<18];

int main(){
    int n,x,y,z; scanf("%d%d%d%d",&n,&x,&y,&z);
    int a=x+y+z-1,b=y+z-1,c=z-1;
    dp[0][0]=1;
    rep(i,0,n)rep(mask,0,1<<(x+y+z))if(dp[i][mask].mtoi()){
        rep(d,1,11){
            int nxt=((mask<<d)|(1<<(d-1)))&((1<<(x+y+z))-1);
            if((nxt>>a&1)&&(nxt>>b&1)&&(nxt>>c&1))continue;
            dp[i+1][nxt]+=dp[i][mask];
        }
    }
    Mint ans=Mint(10).pow(n);
    rep(mask,0,1<<(x+y+z))ans-=dp[n][mask];
    printf("%d\n",ans.mtoi());
    return 0;
}

Measured memory_bytes: 42240
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long c = sc.nextLong();
    
    if(a+b>c){
      System.out.println("No");
      return;
    }
    
    if(4*a*b < (c-a-b)*(c-a-b)) System.out.println("Yes");
    else System.out.println("No");
 
  }
}

Measured memory_bytes: 35660
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <functional>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
using namespace std;
// #define int long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = (((1<<30)-1)<<1)+1;
const int nINF = 1<<31;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, int> pci;

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

const int N = 1e5+10, M = 1e5+10;
vector<pair<int, int> > g[N];
int cur[N], d[N], lasts[N], n, m;
bool used[M];
vector<int> tour;

void dfs(int s) {
	while(cur[s] != g[s].size()) {
		if (used[g[s][cur[s]].second]) {
			++cur[s];
			continue;
		}
		auto p = g[s][cur[s]++];
		used[p.second] = true;
		dfs(p.first);
	}
	tour.push_back(s);
}

void bad() {
	cout << "No" << endl;
	exit(0);
}

void print(int l, int r) {
	FOR(i, l, r) cout << tour[i] << ' ';
	cout << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(7);
    cin >> n >> m;
    int start = 1;
    REP(i, m) {
    	int u, v;
    	cin >> u >> v;
    	g[u].push_back({v, i});
    	g[v].push_back({u, i});
    	++d[u];
    	++d[v];
    	if(d[start] < d[u]) start = u;
    	if(d[start] < d[v]) start = v;
    }
    FOR(i, 1, n) if(d[i] & 1) bad();
    if(d[start] >= 6) {
    	cout << "Yes" << endl;
    	exit(0);
    }
    if(d[start] <= 2) bad();
    int cnt = 0;
    FOR(i, 1, n) if(d[i] == 4) ++cnt;
    if(cnt > 2) {
    	cout << "Yes" << endl;
    	exit(0);
    }
    if(cnt == 1) bad();
    dfs(start);
    int cyc = 0;
    memset(lasts, -1, sizeof(lasts));
    REP(i, tour.size()) {
    	if(lasts[tour[i]] != -1) {
    		// print(lasts[tour[i]], i);
    		FOR(j, lasts[tour[i]], i-1) lasts[tour[j]] = -1;
    		++cyc;
    	}
		lasts[tour[i]] = i;
    }
    if(cyc < 3) bad();
    cout << "Yes" << endl;

    return 0;
}

// Easy things to check:
// - LONG LONGS (WA)
// - const int N is correct (WA, RTE)
// - .size()-k underflow (WA, RTE, TLE)
// - small n edge cases (WA)

// Rare mistakes made in the past:
// - division by 0 (WA)
// - integer division (WA)
// - setprecision (WA)
// - INF not big enough using ll (WA)
// - setting max to 0 instead of -INF/min to 0 instead of INF (WA)
// - outputting debug (WA)
// - allocating too much memory (locRTE, MLE)
// - stack size (locRTE)
// - round announcements (WA)
// - multiset::erase (WA)



Measured memory_bytes: 10616
import sys
s = str(input())
t = str(input())
l = len(s)
tmp = [[], []]
for i in range(l):
    if (not s[i] in tmp[0]) and (not t[i] in tmp[1]):
        tmp[0].append(s[i])
        tmp[1].append(t[i])
    else:
        if s[i] in tmp[0]:
            tmp2 = 0
            for j in range(len(tmp[0])):
                if s[i] == tmp[0][j]:
                    tmp2 = j
            if t[i] != tmp[1][tmp2]:
                print('No')
                sys.exit()
        else:
            print('No')
            sys.exit()
print('Yes')


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
  int n;
void equival(char *out,int i,char ch)
{
if(i==n)
{
    out[i] = '\0';
    cout<<out<<endl;
    return;
}

for(char c = 'a' ;c<=ch;c++)
{
    out[i] = c;
    if(c==ch)
    {
        equival(out,i+1,ch+1);
    }else
    {
         equival(out,i+1,ch);
    }
}



}
int main() {

  cin>>n;
  char out[1000];
  equival(out,0,'a');
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, int> Pli;

int N, X, Y;

struct Edge {
    int dst, weight;
};
const int MAX_V = 2010;
vector<Edge> G[MAX_V];
int d[MAX_V];
const int INF = 1.0e9;

int ans[100010];

void dijkstra(int s) {
    using P = pair<int, int>;

    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+N+1, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i = 0; i < G[v].size(); i++) {
            Edge e = G[v][i];
            if (d[e.dst] > d[v] + e.weight) {
                d[e.dst] = d[v] + e.weight;
                que.push(P(d[e.dst], e.dst));
            }
        }
    }
    return;
}

int main() {
    cin >> N >> X >> Y;
    for (int i = 0; i < N-1; i++) {
        Edge e1 = {i+1, 1};
        G[i].push_back(e1);
        Edge e2 = {i, 1};
        G[i+1].push_back(e2);
    }

    Edge ex = {Y-1, 1};
    G[X-1].push_back(ex);
    Edge ey = {X-1, 1};
    G[Y-1].push_back(ey);

    memset(ans, 0, sizeof(ans));
    for (int i = 0; i < N; i++) {
        dijkstra(i);
        for (int j = 0; j < N; j++) {
            if (i != j) {
                ans[d[j]]++;
            }
        }
    }

    for (int i = 1; i < N; i++) {
        cout << ans[i]/2 << endl;
    }

    
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
#define gr vector<vpii>
#define str string
#define mask vector<bool>
#define vs vector<str>
#define ordered_set_of(T) tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define nub(x) x.resize(unique(all(x)) - x.begin())
#define TWO class T1, class T2
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define GAME_OVER return 0
using namespace std;
using namespace __gnu_pbds;
char _$ = ' ';
struct sep {sep(char c) {_$ = c;}};
ostream& operator<<(ostream& o, sep s) {return o;}
template<TWO> ostream& operator<<(ostream& o, pair<T1, T2> x) {return o << x.fi << ' ' << x.se;}
template<TWO> istream& operator>>(istream& i, pair<T1, T2>& x) {return i >> x.fi >> x.se;}
template<class T> ostream& operator<<(ostream& o, vector<T> x) {for (auto it : x) o << it << _$; return o;}
template<class T> istream& operator>>(istream& i, vector<T>& x) {for (auto& it : x) i >> it; return i;}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    vs s(n);
    cin >> s;
    map<vi, int> m;
    for (str it : s)
    {
        vi cnt(26);
        for (char c : it)
            cnt[c - 'a']++;
        m[cnt]++;
    }
    int res = 0;
    for (auto it : m)
        res += it.se * (it.se - 1) / 2;
    cout << res << endl;
    GAME_OVER;
}

Measured memory_bytes: 35456
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
//  cout.precision(15); cout << fixed;

int main() {
  int n, k; cin >> n >> k;
  int x = 1;
  while (n--) {
    x = min(x * 2, x + k);
  }
  cout << x << endl;
  return 0;
}


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

using namespace std;



int main(){
	stack<char> box;
	string S;
	cin>>S;

	for(int i=0;i<S.length();i++){
		if(S[i]=='B'){
			if(box.empty()==false){
				box.pop();
			}
		}
		else{
			box.push(S[i]);
		}

	}

string ans;
while(box.empty()==false){
	ans+=box.top();
	box.pop();
}
reverse(ans.begin(),ans.end());
cout<<ans<<endl;

}



Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};

int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    cout<<(n*n*n)<<endl;

    return 0;
}


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

int main(){
  int i=0,tmp,ans=2000000;
  char s[11];
  scanf("%s",s);
  while(s[i+2]!=0){
    tmp=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
    if(ans>abs(753-tmp))ans=abs(753-tmp);
    i++;
  }
  printf("%d",ans);
  return 0;
}

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

using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ll = long long int;
using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using cdouble = complex<double>;

const double eps = 1e-9;
const double INFD = numeric_limits<double>::infinity();
const double PI = 3.14159265358979323846;
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loopll(i, n) for(ll i = 0; i < (ll)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopll1(i, n) for(ll i = 1; i <= (ll)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = (ll)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define Looprll1(i, n) for(ll i = (ll)n; i >= 1; i--)
#define Foreach(buf, container) for(auto buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(ex_i, vector.size()) { cout << vector[ex_i] << " "; } cout << endl;
#define printmx(matrix) Loop(ex_i, matrix.size()) { Loop(ex_j, matrix[ex_i].size()) { cout << matrix[ex_i][ex_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
#define fst first
#define snd second
bool nearlyeq(double x, double y) { return abs(x - y) < eps; }
bool inrange(ll x, ll t) { return x >= 0 && x < t; }
bool inrange(vi xs, ll t) { Foreach(x, xs) if (!(x >= 0 && x < t)) return false; return true; }
int ceillog2(ll x) { int ret = 0;	x--; while (x > 0) { ret++; x >>= 1; } return ret; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (m * m <= x ? 0 : -1); }
ll ceilsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

/*******************************************************/

int main() {
	int n, m, c; cin >> n >> m >> c;
	vi b(m); Loop(i, m) cin >> b[i];
	int ans = 0;
	Loop(unused, n) {
		vi a(m); Loop(i, m) cin >> a[i];
		int sum = c;
		Loop(i, m) {
			sum += a[i] * b[i];
		}
		if (sum > 0) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	
		String str = sc.nextLine();
		
		sc.close();
		
		int size = str.length();
		
		for(int i = 1 ; i < size ; i++){
			if(str.charAt(i) == str.charAt(i-1)){
				System.out.println(i + " " + (i+1));
				System.exit(0);
			}
		}
		
		for(int i = 2 ; i < size ; i++){
			if(str.charAt(i) == str.charAt(i-2)){
				System.out.println((i-1) + " " + (i+1));
				System.exit(0);
			}
		}
		
		System.out.println(-1 + " " + -1);
	}
}


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

int main(){
  int n,m,x,y,xmax=-1e9,ymin=1e9,t,ans=0;
  cin>>n>>m>>x>>y;
  REP(i,n){
    cin>>t; xmax=max(xmax,t);
  }
  REP(i,m){
    cin>>t; ymin=min(ymin,t);
  }
  for(int i=x+1;i<=y;i++) if(xmax<i && i<=ymin) ans=1;
  cout<<(ans?"No War":"War");
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cctype>
#include <algorithm>
#include <string>
#include <queue>
#include <cstring>
using namespace std;

char map[21][21];
int w, h;
int tile = 0;

void dfs(int x, int y){
    if (!(0 <= x && x < w && 0 <= y && y < h)) return;
    tile++;
    map[y][x] = '#';
    if (map[y-1][x] == '.') dfs(x, y-1);
    if (map[y+1][x] == '.') dfs(x, y+1);
    if (map[y][x-1] == '.') dfs(x-1, y);
    if (map[y][x+1] == '.') dfs(x+1, y);
}

int main(){
    int sx, sy;
    while (1){
	scanf("%d %d", &w, &h);
	if (w == 0 && h == 0) break;
	memset(map, '#', sizeof(map));
	tile = 0;
	for (int i = 0; i < h; i++){
	    cin >> map[i];
	    for (int p = 0; p < w; p++){
		if (map[i][p] == '@'){
		    sx = p;
		    sy = i;
		}
	    }
	}
	dfs(sx, sy);
	printf("%d\n", tile);
    }
    
    return 0;
}

Measured memory_bytes: 0