akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n, ans = 0, pre = 0; cin >> n;
    vector<string> s(2);
    cin >> s[0] >> s[1];

    // ブロックの置き方は2通りしかないため、左から順に処理していく
    // [置き方1] 縦に1個（2*1マス）
    //　最も左なら3通り、置き方1の後なら2通り、置き方2の後なら1通り
    // [置き方2] 横に2個（2*2マス）
    //　最も左なら6通り、置き方1の後なら2通り、置き方2の後なら3通り

    for(ll i=0; i<n; i++){
        // 置き方1の場合
        if(s[0][i] == s[1][i]){
            // 最も左の場合
            if(i == 0){
                ans = 3;
                pre = 1;
            }
            // 置き方1の後の場合
            else if(pre == 1){
                ans = (ans*2)%MODV;
                pre = 1;
            }
            // 置き方2の後の場合
            else{
                ans = ans*1;
                pre = 1;
            }
        }
        // 置き方2の場合
        else{
            // 最も左の場合
            if(i == 0){
                ans = 6;
                pre = 2;
            }
            // 置き方1の後の場合
            else if(pre == 1){
                ans = (ans*2)%MODV;
                pre = 2;
            }
            // 置き方2の後の場合
            else{
                ans = (ans*3)%MODV;
                pre = 2;
            }
            // 2個分読み取るのでその分iを増やす
            i++;
        }
    }

    // 答えの出力
    cout << ans << endl; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 35
using namespace std;
int n,m;
vector<int> suko[M];
int main()
{
    while (~scanf("%d %d", &n, &m)) {
        REP(i,0,n) suko[i].clear();
        REP(i,1,n) {
            int x,y;
            scanf("%d",&x);
            REP(j,1,x) {
                scanf("%d", &y);
                suko[i].push_back(y);
            }
        }

        auto check = [&](int x) {
            REP(i,1,n) {
                auto it = find(suko[i].begin(), suko[i].end(), x);
                if (it == suko[i].end()) return false;
            }
            return true;
        };
        int ans = 0;
        REP(i,1,m) if (check(i)) ans++;
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a,b,n,x,flag=0,res,choto,boro,lower;
    cin>>a>>b>>n;
    if(n<=b - 1) //ei x er jonnoi max value pabo, eitai x er amon man j b er kacher choto value
    {
        cout<< floor((a*n)/b)-a*floor(n/b)<<endl;
    }
    else if(b - 1<n)// mane x>b case :  x  er amon man khujbo ja b er kacher choto . jehutu x>b thle x er kacher choto hobe b er 1 kom
    {
        choto=b-1; //kacher choto always b-1 hobe
        cout<< floor((a*choto)/b)-a*floor(choto/b)<<endl;
    }
    return 0;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  int n; cin >> n;
  vector<int> x(n);
  for(int i=0; i<n; i++) cin >> x[i];
  int ans = 1e9;
  int s = 0;
  int tmp = 0;
  for(int i=0; i<n; i++) {
    tmp += x[i]*x[i];
    s += x[i];
  }

  for(int p=1; p<=100; p++) {
    int t = -2 * p * s + n * p * p;
    ans = min(ans, tmp + t);    
  }

  cout << ans << endl;

  return 0;
}


// EOF

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  a=LI()

  c=0
  for x in a:
    y=x
    while True:
      if y%2!=0:
        break
      else:
        y//=2
        c+=1

  print(c)

main()
# print(main())


Measured memory_bytes: 7844
import java.util.*;
 
public class Main {
 	public static void main(String[] args){
    	
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
		int B = sc.nextInt();
		int M = sc.nextInt();
		int [] a = new int[A];
		int [] b = new int[B];
		int min1 =1000000;
		int min2 =1000000;
		int min3 =2000000;
		
		for(int i=0; i<A;i++){
		    a[i] = sc.nextInt();
		    if(min1>a[i]){
		        min1 = a[i];
		    }
		}
		
		for(int i=0; i<B; i++){
		    b[i] = sc.nextInt();
		    if(min2>b[i]){
		        min2 = b[i];
		    }
		}
		
    	int [] x = new int[M];
		int [] y = new int[M];
		int [] c = new int[M];
		
		for(int i=0; i<M; i++){
		    x[i]=sc.nextInt();
            y[i]=sc.nextInt();
            c[i]=sc.nextInt();
		}
		
		
		for(int i=0; i<M; i++){
		   if( a[x[i]-1]+b[y[i]-1]-c[i] <min3){
		        min3 = a[x[i]-1]+b[y[i]-1]-c[i];
		    }
		}
		
		if(min1+min2 >= min3){
		    System.out.println(min3);
		}
		else{
	
		System.out.println(min1+min2);
		}
 	}
}

Measured memory_bytes: 134252
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

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

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll ans=0,a,b;
	string s;

	in(s);

	a = 0;
	b = s.size() - 1;
	for(ll i=0;i<s.size();i+=2) {
		if (s[a] != s[b]) {
			if (s[a] == 'x') {
				b++;
				i--;
				ans++;
			}
			else if (s[b]=='x') {
				ans++;
				i--;
				a--;
			}
			else {
				outn(-1);
				return 0;
			}
		}
		a++;
		b--;
	}

	outn(ans);

	return 0;


}


Measured memory_bytes: 512
#include <stdio.h>
int check(int e[]){
	int i;
	for(i=0;i<3;i++){
		if(e[i]!=e[i+1])
			return 0;
	}
	for(i++;i<7;i++){
		if(e[i]!=e[i+1])
			return 0;
	}
	for(i++;i<11;i++){
		if(e[i]!=e[i+1])
			return 0;
	}
	return 1;
}
int main(void){
	int i,j,e[12];
	for(i=0;i<12;i++)
		scanf("%d",&e[i]);
	for(i=0;i<11;i++){
		for(j=11;j>i;j--){
			if(e[j-1]>e[j]){
				int tmp=e[j-1];
				e[j-1]=e[j];
				e[j]=tmp;
			}
		}
	}
	if(check(e))
		puts("yes");
	else
		puts("no");
	return 0;
}

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

const int N = 1e3+10;
const int H = 1e4+10;
int h, n;
long long int INF = 1e9;
int a[N];
int b[N];

long long int dp[H][N];

int solve(int h_atual, int index){
	if(h_atual <= 0) return 0;
	if(index >= n) return INF;
	if(dp[h_atual][index] != -1) return dp[h_atual][index];
	else{
		int L = b[index] + solve(h_atual-a[index], index);
		int R = solve(h_atual, index+1);
		return dp[h_atual][index] = min(L, R);
	}
}

int main(){
	for(int i=0; i < H; i++) for(int j=0; j < N; j++) dp[i][j] = -1;

	cin >> h >> n;
	for(int i=0; i < n; i++) cin >> a[i] >> b[i];
	
	cout << solve(h, 0) << endl;
}


Measured memory_bytes: 79872
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <queue>
#include <cstring>
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;
}

int main() {
	int N; cin >> N;
	vector<vector<int>> x(N, vector<int>(3, 0)), z(N, vector<int>(3, 0));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 3; j++)cin >> z[i][j];
	}
	
	for (int i = 0; i < 3; i++)x[0][i] = z[0][i];
	for (int i = 1; i < N; i++) {
		for (int j = 0; j < 3; j++) {
			int a = j + 1; a %= 3;
			int b = j + 2; b %= 3;
			chmax(x[i][a], x[i - 1][j] + z[i][a]);
			chmax(x[i][b], x[i - 1][j] + z[i][b]);
		}
	}
	int ans = 0;
	for (int i = 0; i < 3; i++) {ans = max(ans, x[N - 1][i]); }
	cout << ans << endl;
}





Measured memory_bytes: 11136
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

S = read_str()
Q = read_int()[0]
Query = [list(read_str().split()) for _ in range(Q)]

d = deque([S])
# rd = deque([S])
def solve():
    reverse = False
    for q in Query:
        if q[0] == '1':
            reverse = not reverse
        else:
            if reverse:
                if q[1] == '1':
                    # rd.appendleft(q[2])
                    d.append(q[2])
                else:
                    d.appendleft(q[2])
                    # rd.append(q[2])
            else:
                if q[1] == '1':
                    d.appendleft(q[2])
                    # rd.append(q[2])
                else:
                    # rd.appendleft(q[2])
                    d.append(q[2])
        # print(d, rd, reverse)
    ans = ''
    if reverse:
        ans = ''.join(list(d))[::-1]
    else:
        ans = ''.join(list(d))
    return ans

if __name__ == "__main__":
    print(solve())


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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N, X;
int x[220000];
signed main() {
    cin >> N >> X;
    for (int i = 1; i <= N; i++)cin >> x[i];
    for (int i = 2; i <= N; i++)x[i] += x[i - 1];
    unsigned int ans = LLONG_MAX;
    for (int i = 1; i <= N; i++) {
        unsigned int cur = X * i + (x[N] - x[N - i]) * 5;
        int co = 5, st = N - i;
        while (st > 0) {
            if (st - i >= 0)cur += (x[st] - x[st - i]) * co;
            else cur += x[st] * co;
            st -= i;
            co += 2;
        }
        ans = min(ans, cur);
    }
    cout << ans + N*X << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds ;
#define ll long long
#define ld long double
#define pp pair<ll,ll>
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define sz(a) int((a).size())
#define hell 1000000007
#define f first
#define s second
#define sll(x) scanf("%lld",&x)
#define si(x) scanf("%d",&x)
typedef tree<ll , null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update > ordered_set ;
ll t = 1 ;
const ll N = 800 ;
void solve()
{
    ll n , a = 0 , b = 0 , c = 0 , A , B ;
    cin >> n >> A >> B ;
    rep( i , 0 , n ) 
    {
        ll x ;
        cin >> x ;
        if( x <= A )
            a++;
        else if( x <= B )
            b++;
        else
            c++;
    }
    cout << min(a,min(b,c));
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   // cin>>t;
    while(t--)
        solve() ;
    return 0 ;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>

typedef long long ll;

using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    bool takahashi = true;
    while(A > 0 && C > 0) {
        if (takahashi) {
            C -= B;
        } else {
            A -= D;
        }
        takahashi = !takahashi;
    }
    if (C <= 0) {
        cout << "Yes" << endl;
    }
    if (A <= 0) {
        cout << "No" << endl;
    }
    return 0;
}



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

bool is_kaibun(string s)
{
    auto len = s.length();
    for (auto i = 0; i < len; i++)
    {
        if (s.at(i) != s.at(len - i - 1))
        {
            return false;
        }
    }
    return true;
}

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

    int n = s.length();
    string first = s.substr(0, (n - 1) / 2);
    string last = s.substr((n + 3) / 2 - 1, (n - ((n + 3) / 2 - 1)));

    bool ans = is_kaibun(s) && is_kaibun(first) && is_kaibun(last);
    if (ans)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<tgmath.h>
#include<stdbool.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
const ll mod = 1000000007ll;
char s[100100];
ll a[100100], b[100100];
int main(){
    scanf("%s", s);
    int l = strlen(s);
    a[0] = 1; b[0]=2;
    for(int i=1; i<l; i++){
        a[i] = 3*a[i-1] % mod;
        if(s[i]=='0'){
            b[i] = b[i-1];
        }else {
            b[i] = b[i-1]*2 % mod;
            a[i] = (a[i] + b[i-1])%mod;
        }
    }
    printf("%lld\n", (a[l-1] + b[l-1]) % mod);
}

Measured memory_bytes: 1792
# frozen_string_literal: true

n, x = gets.split.map(&:to_i)
l = gets.split.map(&:to_i)

sum = 0
count = 1
0.upto(n - 1) do |i|
  sum += l[i]
  if sum > x
    break
  end
  count += 1
end
puts count


Measured memory_bytes: 1788
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

D = INT()
print("Christmas"," ", end ="")
for _ in range(25-D):
	print("Eve ",end="")

Measured memory_bytes: 5144
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <sstream>
#include <cassert>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
#include <ctime>

using namespace std;

#define en '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int((x).size())

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;

const int INF = 1e9 + 7;
const ll INFLL = 1e18;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int MAX_SIZE = 5e5;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

bool IS_ONE_TEST = 1;
ld START_TIME, TIME;

void fast_in_out() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

void solve() {
    ll x, k, d;
    cin >> x >> k >> d;
    ll cnt = min(abs(x) / d, k);
    ll xx = abs(x) - d * cnt;
    k -= cnt;
    if (k == 0LL) {
        cout << xx << en;
        return;
    }
    if (k & 1) {
        cout << min(abs(xx - d), abs(xx + d)) << en;
    }
    else {
        cout << xx << en;
    }
}

int main() {
    START_TIME = clock();
    fast_in_out();
    int TESTS = 1;
    if (!IS_ONE_TEST) cin >> TESTS;
    while (TESTS--) { solve(); }
#ifdef __APPLE__
    TIME = (clock() - START_TIME) / CLOCKS_PER_SEC;
    cerr << en << TIME * 1000 << " ms." << en;
#endif
    return 0;
}

/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */


Measured memory_bytes: 3688
/* HEADERS & NAMESPACES */
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

/* MACROS */
#define fastIO() ios_base:: sync_with_stdio(false); cin.tie(NULL)
#define fill(v, x) memset(v, x, sizeof(v))
#define rep(i, a, b) for(__typeof(b) i = (a)-((a)>(b)); i != (b)-((a)>(b)); i += 1-2*((a)>(b)))
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define int long long
#define ii pair<int, int>
#define ff first
#define ss second
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl;
#define CHK(x, y) cerr << "\n" << #x << "=" << (x) << ", " << #y << "=" << (y) << "\n"
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define INF (1ll)<<60
#define MOD 1000000007
#define N 200005

/* TEMPLATES */
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v: V) os << v << " ";
    return os << "]\n";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) {
    return os << "(" << P.ff << ", " << P.ss << ")\n";
}
template<class T> ostream& operator<<(ostream &os, set<T> S) {
    os << "{ ";
    for(auto s: S) os << s << " ";
    return os << "}\n";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> M) {
    os << "{ ";
    for(auto m: M) os << "(" << m.ff << ":" << m.ss << ") ";
    return os << "}\n";
}

/* GLOBAL */
/* FUNCTIONS */

void solve() {
    string s, t, u; cin >> s;
    int n = sz(s), flg = 0;
    t = s; reverse(all(t));
    if(t != s) flg = 1;
    t = s.substr(0, (n-1)/2);
    u = t; reverse(all(u));
    if(u != t) flg = 1;
    t = s.substr((n+1)/2, n);
    u = t; reverse(all(u));
    if(u != t) flg = 1;
    if(flg) cout << "No";
    else cout << "Yes";

}

signed main() {
    fastIO();
    solve();
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
    long long int N,i,D;
    int sum=0;
    scanf("%lld%lld",&N,&D);
    while(N--)
    {

       long long int a,b,s,t;
       double m,f;
        scanf("%lld%lld",&a,&b);
        s=abs(a);
        t=abs(b);
        m=(a*a)+(b*b);
        f=sqrt(m);
        if(f<=D)
        {
            sum++;
        }
    }
    printf("%d\n",sum);

    return 0;

}



Measured memory_bytes: 2148
#include "bits/stdc++.h"

#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)

using namespace std;

using I = int;
using L = long;
using F = float;
using S = string;
using SS = stringstream;
using C = char;
using LL = long long;
using VI = vector<int>;
using VL = vector<long>;
using VF = vector<float>;
using VS = vector<string>;
using VVI = vector<vector<int>>;
using VVL = vector<vector<long>>;
using PLL = pair<long, long>;
using PLF = pair<long, float>;
using PLS = pair<long, string>;
using PSL = pair<string, long>;
using PSF = pair<string, float>;
using PSS = pair<string, string>;
using MLL = map<long, long>;
using MLF = map<long, float>;
using MLS = map<long, string>;
using MSL = map<string, long>;
using MSF = map<string, float>;
using MSS = map<string, string>;

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;

const long kMaxN = 1e5 + 5;

template <class T>
void PrintVector(const vector<T> & v) {
  for (const auto & e: v) {
    cout << e << endl;
  }
}

template <class T>
void PrintVector(const vector<T> & v, unsigned n) {
  rep(i, 0, n - 1) {
    cout << v[i] << endl;
  }
}

int main(int argc, char const *argv[]) {
  const L kMod = 1000000007;
  L a, b;

  cin >> a >> b;

  cout << (a + b + 1) / 2 << endl;
  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#define llint long long
#define mod 1000000007

using namespace std;

int N;
int A[100005];
llint ans = 1;

int main(void)
{
	cin >> N;
	for(int i = 0; i < N; i++) cin >> A[i];
	sort(A, A+N);
	
	for(int i = 0; i < N; i++){
		if(N % 2){
			if((i + 1) / 2 * 2 != A[i]) goto ng;
		}else if(i / 2 * 2 + 1 != A[i]) goto ng;
	}
	
	
	for(int i = 0; i < N/2; i++){
		ans *= 2;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
	
	ng:;
	cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 640
// ABC061B - Counting Roads

#include <bits/stdc++.h>
using namespace std;

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

	vector<int> ans(N);

	for (int i = 0; i < N; i++) {
		ans.at(i)= 0;
	}

	for (int i = 0; i < M; i++) {
		int t1, t2;
		cin >> t1 >> t2;
		ans.at(t1 - 1)++;
		ans.at(t2 - 1)++;
	}

	for (int i = 0; i < N; i++) {
		cout << ans.at(i) << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

int main(){
    int n, x;
    while(1){
        cin>>n>>x;
         if(n==0&&x==0) break;
        int cnt = 0;
        rep(i, n){
            for(int j = i+1; j < n; ++j){
                for(int k = j+1; k < n; ++k){
                    if(i+j+k+3 == x) cnt++;
                }
            }
        }
        cout << cnt << endl;
    }
    return 0;
}


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

int p[50001] ={0};


int main()
{	
	for(int i=4;i<=50000;i++){
		if(i%2==0) p[i] = 1;
		for(int j=3;j*j<=i;j++){
			if(i % j == 0){
				p[i] = 1;
			}
		}
	}
	
	int n;
	while(cin>>n && n){
		int cnt = 0;
		for(int i=2;i<=n/2;i++){
			if( p[i]==0 && p[n-i]==0 ){
					cnt++;
			}	
		}
		
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1356
fun main(args: Array<String>) {
    val s = readLine()!!.toCharArray()
    var cnt = 0
    var max = 0
    for (c in s) {
        when (c) {
            'A', 'C', 'G', 'T' -> {
                cnt = cnt + 1
                if (max < cnt) {
                    max = cnt
                }
            }
            else -> {
                cnt = 0
                if (max < cnt) {
                    max = cnt
                }
            }
        }
    }
    println(max)
}

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

int main(void){

  int M , D ;
  cin >> M >> D;
  int i , j;
  int count = 0;
  for(i = 1; i <= M;i++){
    for(j = 1;j <= D;j++){
      if(j%10 >= 2 && j/10 >= 2){
      if((j%10)*(j/10) == i){
        count ++ ;
      }
      }
    }
  }

  cout << count << endl;
  
  return 0;

}


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

const int Max = 10005;
int pre[Max];
int n, q, com, x, y;

int findRoot(int x)
{
    int r = x;
    while(pre[r]!=r)
    {
        r = pre[r];
    }
    int j = x, i;
    while(pre[j]!=r)
    {
        i = j;
        pre[j] = r;
        j = pre[i];
    }
    return r;
}

void join(int x, int y)
{
    int fx = findRoot(x), fy = findRoot(y);
    if(fx!=fy)
    {
        pre[fx] = fy;
    }
}
int main()
{
    scanf("%d %d", &n, &q);
    for(int i=0; i<n; i++)//初始化
    {
        pre[i] = i;
    }
    for(int i=0; i<q; i++)
    {
        scanf("%d %d %d", &com, &x, &y);
        if(com==0)
        {
            join(x, y);
        }
        else
        {
            if(findRoot(x)==findRoot(y))
                printf("1\n");
            else
                printf("0\n");
        }
    }
    return 0;
}



Measured memory_bytes: 3188
n, k = gets.split.map(&:to_i)
sunukes = {}
k.times do |i|
  di = gets.to_i
  if di >= 2
    array = gets.split.map(&:to_i)
  else
    array = [gets.to_i]
  end
  sunukes[i+1] = array
end

collection = []

sunukes.each_value do |v|
  collection << v
end

puts ((1..n).to_a - collection.flatten.uniq).size



Measured memory_bytes: 14404
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int i;
    int N;
    int count=0;
    cin >> N;
    int A[N];
    for(i=0;i<N;i++){
        cin >>A[i];
    }
    bool flag = true;
    while(flag){
        for(i=0; i<N; i++){
            if(A[i]%2 == 1){
                flag = false;
                break;
            }
            A[i]=A[i]/2;
        }
        if(flag)count++;
    }

    cout << count << endl;
}

Measured memory_bytes: 3560
#include <iostream>
#include<vector>
#include<stdio.h>

#define FOR(i,n) for(int i=0;i<n;i++)
#define SORT(v,n) sort(v[0],v[n-1])
#define INF 999999999
#define mod 1000000007

using namespace std;

/*int sqrt(int n){
	for(int i=0;i<n;i++){
		if(i^2>n){
			return i-1;
		}
	}
	return -1;
}

bool isPrime(int n){
	//bool x=false;
	for(int i=0;i<sqrt(n);i++){
		if(n%i==0){
			return false;
		}
	}
	return true;
}*/
vector<int> soinsu(int num,vector<int> v,int N){
	// 割る数の初期値
	int n=num;
	//int amax=0;
	if(n==1){
		return v;
	}
	int a = 2;
	    // √n ≧ a ( n ≧ a * a ) の間ループ処理
	while (n >= a * a) {
	        // a で割り切れたら、a は素因数
	        // そして、割られる数を a で割る
	        // a で割り切れなかったら、 a を 1 増加させる
		if (n % a == 0) {
			//printf("%d * ", a);
			v[a-1]++;
	        n /= a;
	        //if(amax<a)amax=a;
		} else {
			a++;
		}
	}
	    // 最後に残った n は素因数
	//printf("%d\n", n);
	v[n-1]++;
	//if(amax<(n-1))amax=(n-1);

	//counter*=amax;

	return v;
}
int main(){
	int N;
	cin >> N;
	vector<int> primes(N+1,0);// {2,3,5,..
	//int pointer =0;
	//int counts[N]={0};{
	if(N==1){
		cout << 1 <<endl;
		return 0;
	}

	for(int i=1;i<=N;i++){

		primes=soinsu(i,primes,N);

	}
	long long sum=1;

	FOR(i,N+1){
		if(primes[i]!=0){
			//cout << i << ";" << primes[i] << endl;
			sum=(sum*(primes[i]+1))%mod;
		}
	}
	cout << sum << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define bs binary_search
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ipr pair<ll,ll>
#define ps push_back
#define fs first
#define sc second
#define mkp make_pair
#define mod 1000000007
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,a,b;
	cin>>a>>b>>k;
	vector<ll> vc;
	for(i=1;i<=min(a,b);i++){
		if(a%i==0&&b%i==0){
			//cout<<i<<endl;
			vc.ps(i);
		}
	}
	sort(all(vc),greater<ll>());
	cout<<vc[k-1];
	return 0;
}

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

typedef long long ll;
ll n;
int main() {
	cin >> n;
	
	ll a = 7;
	if (n % 2 == 0 || n % 5 == 0) {
		cout << -1 << '\n';
		return 0;
	}
	
	for (int i=0; i<(int)1e7; i++) {
		a %= n;
		if (a == 0) {
			cout << i+1;
			return 0;
		}
		a*=10;
		a+=7;
	}
	cout << -1 << '\n';	
	
	
	
	return 0;
}


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

int main(){
  long n;  cin >> n;
  vector<long> a(n), eras(1e6+1, 0);
  for(int i=0; i<n; i++)  cin >> a[i];

  for(int i=2; i<=1e6; i++)
    if(eras[i] == 0){
      eras[i] = i;
      for(int j=2; i*j<=1e6; j++)
        if(eras[i*j] == 0)  eras[i*j] = i;
    }

  vector<long> alle(1e6+1, 0);
  for(int i=0; i<n; i++){
    if(a[i] == 1)  continue;
    long ai = a[i];
    do{
      alle[eras[ai]]++;
      for(long d=eras[ai]; ai%d==0; )  ai /= d;
//      ai /= eras[ai];
    }while(ai != 1);
  }
  
  string ans = "pairwise coprime";
  for(int i=2; i<=1e6; i++){
    if(alle[i] == n)  ans = "not coprime";
    else if(alle[i]>1 && ans=="pairwise coprime")
      ans = "setwise coprime";
  } 

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


Measured memory_bytes: 26688
#include <iostream>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

int main()
{
    double ans = 0;

    int N, K;
    cin >> N >> K;

    double oneNth = 1.0 / N;

    for (int i = 1; i <= N; ++i) {
        int j = 1;
        int k = i;
        while (k < K) {
            j *= 2;
            k *= 2;
        }
        ans += oneNth / j;        
    }

    cout << setprecision(12) << ans << endl;

    return 0;
}


Measured memory_bytes: 256
# 外積を利用した三角形の内外判定
def sub_vector(a, b)
  return [a[0] - b[0], a[1] - b[1]]
end

while nums = gets
  ax, ay, bx, by, cx, cy, px, py = nums.split.map(&:to_f)

  a = [ax, ay]
  b = [bx, by]
  c = [cx, cy]
  p = [px, py]

  ab = sub_vector(b, a)
  bp = sub_vector(p, b)

  bc = sub_vector(c, b)
  cp = sub_vector(p, c)

  ca = sub_vector(a, c)
  ap = sub_vector(p, a)

  c1 = ab[0] * bp[1] - ab[1] * bp[0]
  c2 = bc[0] * cp[1] - bc[1] * cp[0]
  c3 = ca[0] * ap[1] - ca[1] * ap[0]

  if (c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)
    puts 'YES'
    next
  end
  puts 'NO'
end

Measured memory_bytes: 6136
#include<stdio.h>

int main(void)
{
   int r1,r2,r3,s,n,i,z;
   int a[100001];
   scanf("%d",&n);
   a[0]=0;
   for(i=1;i<=n;i++)
      scanf("%d",&a[i]);

   a[n+1]=s=z=0;
   for(i=0;i<=n;i++){
      z=a[i+1]-a[i];
      if(z<0)  z*=-1;
      s+=z;
   }
   for(i=0;i<n;i++){
      r1=a[i+1]-a[i];
      r2=a[i+2]-a[i+1];
      r3=a[i+2]-a[i];
      if(r1<0) r1*=-1;
      if(r2<0) r2*=-1;
      if(r3<0) r3*=-1;
   printf("%d\n",s-r1-r2+r3);
   }
   return 0;
}


Measured memory_bytes: 1536
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def solve(N, M, a, b):
    pass


def main():
    N, M = map(int, input().split())
    l = []
    for _ in range(M):
        a, b, = map(int, input().split())
        l.append((a, b))
    l.sort()

    ans = 0
    mini = INF
    for a, b in l:
        if mini <= a:
            ans += 1
            mini = INF
        mini = min(mini, b)

    print(ans + 1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 17812
#include<bits/stdc++.h>
using namespace std;
char name[15];
int N;
map<string, int> mp;
//map<string, int>::iterator iter; 
vector<string> vec;
bool cmp(const string a, const string b){
	return a < b;
}
int main(){
	cin >> N;
	int maxn = 0;
	for(int i = 0 ; i < N ; i++){
		cin >> name;
		mp[name]++;
		maxn = max(maxn, mp[name]);
	}
	for(auto iter: mp)
		if(iter.second == maxn)
			vec.push_back(iter.first);
	//printf("%d\n", vec.size());
	sort(vec.begin(), vec.end(), cmp);
	for(auto ele: vec)
		cout << ele << "\n";
	
} 

Measured memory_bytes: 25584
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
typedef long long ll;
const int N = 3e5 + 10;
int num[N];
int main()
{
  // freopen("in.txt","r",stdin); 
   int n;
   while (~scanf("%d", &n))
   {
    int m = 3*n;
     for (int i = 0; i < m; i++)
      scanf("%d", num + i);
    sort(num, num + m);
      ll sum = 0;
      int f = 0;
      for (int i = m - 1; i >= 0; i--, f ^= 1)
        if (f)
        {
          
          if (n)
          {
            n--;
            sum += num[i];
          }
        }
        

      printf("%lld\n", sum);
   }
   return 0;
}


Measured memory_bytes: 1408
use strict;
use warnings;

my $g = [];

sub main {
    chomp(my $s = <STDIN>);
    my ($N,$M) = split(/ /,$s);
    my (@ab);
    for(1..$M){
        chomp(my $tmp = <STDIN>);
        push @ab, [split(/ /, $tmp)];
    }
    print solver($N,$M,\@ab);
}
main() unless caller;

sub solver {
    my ($N,$M,$ab) = @_;
    my %x;

    for my $i(0..$M-1) {
        my $u = $ab->[$i]->[0];
        my $v = $ab->[$i]->[1];
        $g->[$u] = $g->[$u] ? $g->[$u] : [];
        $g->[$v] = $g->[$v] ? $g->[$v] : [];
        $g->[$u-1]->[$v-1] = 1;
        $g->[$v-1]->[$u-1] = 1;
    }
    my $visited = [];
    for my $i(0..$N-1){
        $visited->[$i]=0;
    }
    $visited->[0]=1;
    return dfs(0,$N,$visited);
}

sub dfs {
    my ($v, $N, $visited) = @_;
    
    my $all_visited = 1;
    
    for my $i(0..$N-1){
        if($visited->[$i] == 0){
            $all_visited = 0;
        }
    }
    if($all_visited){
        return 1;
    }
    my $ret=0;

    for my $i(0..$N-1){
        next if(!$g->[$v]->[$i]);
        next if($visited->[$i]);

        $visited->[$i]=1;
        $ret += dfs($i,$N,$visited);
        $visited->[$i]=0;
    }

    return $ret;
}

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

int main()
{
  int n;
  cin >> n;
  int A[n];
  for(int i=0;i<n;++i)
  {
    cin >> A[i];
  }
  vector<int> dp(n, INT_MAX);
  dp[0] = A[0];
  dp[1] = abs(A[0] - A[1]);
  for(int i=2;i<n;++i)
  {
    dp[i] = min(dp[i], dp[i-1] + abs(A[i-1] - A[i]));
    if(i == 2) dp[i] = min(dp[i], abs(A[i] - A[i-2]));
    else 
        dp[i] = min(dp[i], dp[i-2] + abs(A[i-2] - A[i]));
  }
  
  cout << dp[n-1] << endl;
  
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
 
#ifdef _WIN32
    #define gx getchar
    #define px putchar
    #define ps putchar(' ')
    #define pn putchar('\n')
    #define DEBUG 1
#else
    #define gx getchar_unlocked
    #define px putchar_unlocked
    #define ps putchar_unlocked(' ')
    #define pn putchar_unlocked('\n')
    #define DEBUG 0
#endif
 
#define rep(i,j,k) for(ll i=0;i<j;i+=k)
//input
void scan(int &n)
{
    int sign = 1;
    n = 0;
    char c = gx();
    while( c < '0' || c > '9' )
    {
        if( c == '-' ) sign = -1;
        c = gx();
    }
    while( c >= '0' && c <= '9' ) n = (n<<3) + (n<<1) + c - '0', c = gx();  n = n * sign;
}
void lscan(ll &n)
{
    int sign = 1;
    n = 0;
    char c = gx();
    while( c < '0' || c > '9' )
    {
        if( c == '-' )
        sign = -1;
        c = gx();
    }
    while( c >= '0' && c <= '9' ) n = (n<<3) + (n<<1) + c - '0', c = gx();  n = n * (ll)(sign);
}
int sscan(char a[])
{
    char c = gx();
    while(c==' ' || c=='\n') c=gx();
    int i=0;
    while(c!='\n')a[i++] = c,c=gx();
    a[i]=0;
    return i;
}
int wscan(char a[])
{
    char c = gx();
    while(c==' ' || c=='\n') c=gx();
    int i=0;
    while(c!='\n' && c!=' ')a[i++] = c,c=gx();
    a[i]=0;
    return i;
}
 
//output
void print(int n)
{
    if(n<0)
    {
        n=-n;
        px('-');
    }
    int i=10;
    char o[10];
    do{o[--i] = (n%10) + '0'; n/=10;}while(n);
    do{px(o[i]);}while(++i<10);
}
void lprint(ll n)
{
    if(n<0LL)
    {
        n=-n;
        px('-');
    }
    int i=21;
    char o[21];
    do{o[--i] = (n%10LL) + '0'; n/=10LL;}while(n);
    do{px(o[i]);}while(++i<21);
}
void sprint(const char a[])
{
    const char *p=a;
    while(*p)px(*p++);
}
 
 
ll po(ll a, ll b, ll m)
{
	ll x=1,y=a;
	while(b > 0)
	{
		if(b%2 == 1)
		{
			x=(x*y);
			if(x>m) x%=m;
		}
		y = (y*y);
		if(y>m) y%=m;
		b /= 2;
	}
	return x;
}
 
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main()
{
	long double a;
	long double b;
	cin>>a>>b;
	long double c = a*b;
	cout<<(unsigned long long int)c<<endl;
	return 0;
}

Measured memory_bytes: 3736
n=int(input())
a= list(map(int, input().split()))
a.sort()
ans=True
if n%2==0:
    for i in range(n//2):
        if a[2*i]!=a[2*i+1]:
            ans=False
    if ans:
        print((2**(n//2))%(1000000007))
    else:
        print(0)
else:
    for i in range(n//2):
        if a[2*i+1]!=a[2*i+2]:
            ans=False
    if ans:
        print((2**(n//2))%(1000000007))
    else:
        print(0)



Measured memory_bytes: 13880
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
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; }
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << -1 << endl;return 0
#define MM <<" "<<
#define Endl endl


signed main(void){
    int N;
    cin >> N;
    int Ans=0;
    for(int i=1;i<=N;i++){
        if(((int)log10(i))%2==0){
            Ans++;
        }
    }
    cout << Ans << endl;
    return 0;
}


Measured memory_bytes: 512
H, W, A, B = map(int, input().split())


for i in range(B):
    answer = ['0' if j < A else '1' for j in range(W)]
    print(''.join(answer))
for i in range(H-B):
    answer = ['1' if j < A else '0' for j in range(W)]
    print(''.join(answer))

Measured memory_bytes: 3956
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int d[151515],p[151515],c[151515];
double dp[151515],memo[151515];
bool done[151515];
vector<int> g[151515];

double treedp(int v, int pr){
	int i;
	if(d[v]>=0){
		return dp[v];
	}
	d[v] = d[pr]+1;
	p[v] = pr;
	c[v] = 0;
	dp[v] = 0.0;
	for(i=(g[v].l_ength()-1); i>=0; --i){
		if(g[v][i] == pr){
			continue;
		}
		dp[v] += treedp(g[v][i],v);
		++c[v];
	}
	if(!c[v]){
		return dp[v];
	}
	dp[v] /= ((double)(c[v]));
	dp[v] += 1.0;
	return dp[v];
}

double solve(int v){
	if(done[v]){
		return memo[v];
	}
	done[v] = true;
	if(p[v]==0){
		if(c[0]>1){
			memo[v] = (treedp(0,p[0])-1.0)*((double)(c[0]));
			memo[v] -= treedp(v,0);
			memo[v] /= ((double)(c[0]-1));
			memo[v] += 1.0;
		}else{
			memo[v] = 0.0;
		}
		return memo[v];
	}
	memo[v] = (treedp(p[v],p[p[v]])-1.0)*((double)(c[p[v]]));
	memo[v] -= (treedp(v,p[v])+1.0);
	memo[v] += (solve(p[v])+1.0);
	memo[v] /= ((double)(c[p[v]]));
	memo[v] += 1.0;
	return memo[v];
}

int main(void){
	int n,i,v,u;
	fill(d,d+151515,-1);
	fill(done,done+151515,false);
	cin >> n;
	for(i=1; i<n; ++i){
		cin >> v >> u;
		--v; --u;
		g[v].push_back(u);
		g[u].push_back(v);
	}
	printf("%.15lf\n",treedp(0,n));
	for(i=1; i<n; ++i){
		printf("%.15lf\n",(treedp(i,p[i])*((double)(g[i].l_ength()-1))+solve(i)+1.0)/((double)(g[i].l_ength())));
	}
	return 0;
}


Measured memory_bytes: 20096
import java.util.*;
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();
  if( a < b && b < c) {
   System.out.println("Yes");
  }else{
   System.out.println("No");
  }
 }
}


Measured memory_bytes: 26428
#include <bits/stdc++.h>
#define ll long long
#define MAX_N 51
using namespace std;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    vector<ll> t(n);
    for(int i=0;i<n;i++){
        ll tt=0;
        cin>>tt;
        t[i] = tt;
    }
    sort(t.begin(), t.end());
    ll ans = 0;

    for(int a = 0; a < n; a++){
        for(int b = a+1;b <n; b++){
            ll lc = b+1;
            ll rc = lower_bound(t.begin(),t.end(),(t[a]+t[b]))- t.begin();
            if((rc-lc) < 0) continue;
            ans += rc-lc;
        }
    }
    cout<< ans <<endl;
  	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k;
int pd;
int gcd;
int mx;
int max(int a,int b){
    return (a>b)?a:b;
}
int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>pd;
		if(i==0) gcd=pd;
		else gcd=__gcd(gcd,pd);
		mx=max(mx,pd);
	}
	if(mx>=k){
		if(k%gcd==0){
			cout<<"POSSIBLE"<<endl;
		}
		else cout<<"IMPOSSIBLE"<<endl;
	}
	else{
		cout<<"IMPOSSIBLE"<<endl;
	}
	while(0){
		;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	}
	return 0;
}

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

//int main(){
//    int N;
//    cin >> N;
//    int A[N+1] = {};
//    int B[N+1] = {};
//
//    for(int i = 1; i <= N; i++){
//        cin >> A[i];
//        B[A[i]] = i;
//    }
//    for(int i = 1; i <= N; i++){
//        cout << B[i] << " ";
//    }
//    cout << endl;
//    return 0;
//}

int main(){
    int N;
    cin >> N;
    int A[N+1] = {};
    int B[N] = {};

    for(int i = 1; i <= N; i++){
        cin >> A[i];
        B[A[i]-1] = i;
    }
    for(int i = 0; i < N; i++){
        cout << B[i] << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;

typedef long long ll;
typedef pair<ll, ll> Pa;

vector<pair<int, int>> says[15];
int main() {
    cin >> N;
    rep(i, N){
        cin >> A;
        rep(j, A){
            cin >> X >> Y;
            says[i].push_back(make_pair(X-1, Y));
        }
    }

    max_value = 0;
    rep(i, pow(2, N)){
        bool flag = true;
        int curr = i;
        int index = 0;
        ll count = 0;
        bool bi[15] = {};
        while(curr != 0){
            if(curr%2 == 1){
                bi[index] = 1;
                count++;
            }else{
                bi[index] = 0;
            }
            curr /= 2;
            index++;
        }
        rep(j, N){
            if(bi[j] == 1){
                rep(k, says[j].size()){
                    if(bi[says[j][k].first] != says[j][k].second) flag = false;
                }
            }
        }
        if(flag) max_value = max(max_value, count);
    }
    cout << max_value;
}


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

using namespace std;

string solve(string s){
    string res = "Yes";
    for(int i=0; i<s.size(); i++){
        if((i+1)%2==0){
            if(s[i]!='L' && s[i]!='U' && s[i]!='D'){
                res = "No";
                break;
            }
        }else{
            if(s[i]!='R' && s[i]!='U' && s[i]!='D'){
                res = "No";
                break;
            }
        }
    }

    return res;

}

int main(){
    string S; cin >> S;
    string res = solve(S);
    cout << res << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int L = sc.nextInt();

        System.out.println(solve(N, L));

        sc.close();
    }

    static int solve(int N, int L) {
        int[] flavors = IntStream.range(0, N).map(i -> L + i).toArray();

        return Arrays.stream(flavors).sum()
                - Arrays.stream(flavors).boxed().min((f1, f2) -> Integer.compare(Math.abs(f1), Math.abs(f2))).get();
    }
}

Measured memory_bytes: 36304
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	string s;
	cin >> s;
	if (s == "AAA" || s == "BBB") cout << "No" << endl;
	else cout << "Yes" << endl;
}

Measured memory_bytes: 256