akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int a, b;
    
    scanf("%d%d", &a, &b);
    
    if (a>b) {
        printf("%d", a+a-1);
    } else if (a==b) {
        printf("%d", a+b);
    } else {
        printf("%d", b+b-1);
    }
    
    return 0;
}



Measured memory_bytes: 1672
#include <iostream>
using namespace std;
   
int main(){
int a,b,c;
cin >> a >> b >> c;
if (a < b){
    if (b < c) {
        cout << "Yes" << endl;
        }else{
        cout << "No" << endl;
        }
   }else{
    cout << "No" << endl;
    }
}


Measured memory_bytes: 3080
import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N, x = map(int, input().split())
    A = [int(i) for i in input().split()]
    ans = 0

    for i in range(1, N):
        tmp = max(min(A[i] + A[i-1] - x, A[i]), 0)
        A[i] -= tmp
        ans += tmp
        
        if A[i] + A[i - 1] > x:
            tmp = A[i - 1] - x
            A[i - 1] -= tmp
            ans += tmp

    print(ans)


if __name__ == '__main__':
    solve()

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

int main () {
  ll x;
  cin >> x;
  ll num = x/11 * 2;
  ll sum = num / 2 * 11;;
  int cnt = 0;
  while (sum < x) {
    if (cnt % 2 == 0) sum += 6;
    else sum += 5;
    num++;
    cnt++;
  }
  cout << num << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;

int main(){

  int a, b, c;
  cin >> a >> b >> c;
  int s;

  s = min(min(a + b, b + c), c + a);

  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
using Graph = vector<vector<int>>;

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

  ll r, g, b, n; cin >> r >> g >> b >> n;
  ll ans = 0;
  Rep(i, 0, 3000){
    Rep(j, 0, 3000){
      ll m = n - r*i - g*j;
      if(m < 0) continue;
      if(m%b == 0) ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int a,b;
  cin >> a >> b;
  int ans = max(max(2*a-1,2*b-1),a+b);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int i,N,T;
	int min, sum = 0;
	// コスト
	int* c;
	//　時間
	int* t;
	int* count;
	scanf("%d", &N);	scanf("%d", &T);

	// 配列の動的確保
	c = (int*)malloc(N*sizeof(int));
	t = (int*)malloc(N*sizeof(int));
	count = (int*)malloc(N*sizeof(int));

	for(i=0; i<N; i++){
		if(t[i]>T) count[i] = 0;
	}

	for(i=0; i<N; i++){
		scanf("%d", &c[i]); 
		scanf("%d", &t[i]);
		if(t[i]>T) count[i] = 1;
	}

	for(i=0; i<N; i++){
		sum += count[i];
	}

	min = c[0];

	for(i=1; i<N; i++){
		if(count[i] != 1){
			if(min > c[i]) min = c[i];
		}
	}

	if(sum==N) printf("TLE");
	else printf("%d", min);

	free(c);
	free(t);
	free(count);

	return 0;
}

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

#define io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pii pair<ll, ll>
#define piii pair<ll, pair<ll, ll>>
#define debug(x) cout<<#x<<" = "<<x<<endl

using namespace std;
const int N = 200005;
ll t, n, m, k, a, b, x, y, ans, arr[N];
ll mod = 998244353;
string s;
bool vis[N];

int main() {
    io;
    t = 1;
//    cin >> t;
    while (t--) {
        cin >> x;
        a = 100;
        while (a < x) {
            b = a / 100;
            a += b;
            ++ans;
        }
        cout << ans << endl;
    }
    return 0;
}
//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);


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

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

    long long ans = 0;
    for(char c1 = '0'; c1 <= '9'; c1++){
        if(s.find(c1) == string::npos) continue;
        string s1 = s.substr(s.find(c1)+1);

        for(char c2 = '0'; c2 <= '9'; c2++){
            if(s1.find(c2) == string::npos) continue;
            string s2 = s1.substr(s1.find(c2)+1);

            for(char c3 = '0'; c3 <= '9'; c3++){
                if(s2.find(c3) != string::npos) ans++;
            }
        }
    }

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

Measured memory_bytes: 3756
#include<stdio.h>
int main()
{
  int a;
  int b;
  int c;

  scanf("%d" "%d" "%d",&a,&b,&c);

  if(a<b && b<c){
    printf("Yes\n");

  }else{
    printf("No\n");
  }
  
  return 0;
}

Measured memory_bytes: 580
import java.util.Scanner;

public class Main {
	private static final boolean TEST = false;
	private static final int TEST_NUM = 3;

	public static void main(String[] args) {
		int N = 0;
		Integer[] A = {};
		Integer[] A1 = {-10,5,4};
		Integer[] A2 = {10,-4,-8,-11,3};
		Integer[] A3 = {-1000000000,1000000000,-1000000000,1000000000,-1000000000,0,1000000000,
				-1000000000,1000000000,-1000000000,1000000000};

		switch(TEST_NUM) {
		case 1:
			N = 3;
			A = A1;
			break;
		case 2:
			N = 5;
			A = A2;
			break;
		case 3:
			N = 11;
			A = A3;
			break;
		default:
				break;
		}
		if(!TEST) {
			Scanner sc = new Scanner(System.in);
			N = sc.nextInt();
			A = new Integer[N];
			for(int i = 0; i < N; i++) {
				A[i] = sc.nextInt();
			}
			sc.close();
		}
		solve(A, N);
	}

	private static void solve(Integer[] A, int N) {
		// 1. マイナスの数を数える
		int minusNum = countMinus(A,N);

		// 2. 0があるかを調べる
		boolean isIncludeZero = checkIsIncludeZero(A,N);

		// 3. マイナスが偶数または0を含むなら絶対値の総和
		//    それ以外なら絶対値が最小値の数だけマイナスにして総和を求める
		if(minusNum % 2 == 0 || isIncludeZero) {
			printSum(A);
		} else {
			printOddSum(A);
		}
	}

	private static void printSum(Integer[] A) {
		long sum = 0;
		for(int i = 0; i < A.length; i++) {
			sum += Math.abs(A[i]);
		}
		System.out.println(sum);
	}

	private static void printOddSum(Integer[] A) {
		// 1. 絶対値の最小値求める
		int min = Math.abs(A[0]);
		for(int i = 1; i < A.length; i++) {
			if(Math.abs(A[i]) < min) {
				min = Math.abs(A[i]);
			}
		}

		// 2. 最小値以外の和を求めて、最小値を引いたものを出力
		// 対象とする最小値は1つだけ
		boolean flag = false;
		long sum = 0;
		for(int i = 0; i < A.length; i++) {
			// 除外する最小値なら(1度だけ)
			if(Math.abs(A[i]) == min && flag == false) {
				flag = true;
				continue;
			}
			sum += Math.abs(A[i]);
		}
		System.out.println(sum - min);
	}

	private static int countMinus(Integer[] A, int N) {
		int counter = 0;
		for(int i = 0; i < A.length; i++) {
			if(A[i] < 0) {
				counter++;
			}
		}
		return counter;
	}

	private static boolean checkIsIncludeZero(Integer[] A, int N) {
		for(int i = 0; i < A.length; i++) {
			if(A[i] == 0) {
				return true;
			}
		}
		return false;
	}


}


Measured memory_bytes: 64048
#include <cstdio>
#include <math.h>
#include <algorithm>
const int mx = 5e5+5;

int n, q, a[mx], blk;
struct node{
    int l, r, p;
    node(){}
    node(int _l, int _r, int _p):
        l(_l), r(_r), p(_p){}
    bool operator < (const node &ot){
        if(l/blk != ot.l/blk)
            return l < ot.l;
        return (bool)((r<ot.r) ^ ((l/blk)&1));
    }
}qq[mx];

int ans=0, cnt[mx], res[mx];
void add(int x){
    if(!cnt[ a[x] ]) ans++;
    cnt[ a[x] ]++;
}
void remove(int x){
    cnt[ a[x] ]--;
    if(!cnt[ a[x] ]) ans--;
}

int main(){
    scanf("%d %d", &n, &q);
    
    blk = sqrt(n);
    for(int i=0; i<n; i++)
        scanf("%d", &a[i]);

    for(int l,r,i=0; i<q; i++){
        scanf("%d %d", &l, &r);
        qq[i] = node(l-1, r-1, i);
    }std :: sort(qq, qq+q);

    int cl=0, cr=0;
    for(int l,r,i=0; i<q; i++){
        l = qq[i].l, r = qq[i].r;
        while(cl < l) remove(cl++);
        while(cl > l)    add(--cl);
        while(cr<= r)    add(cr++);
        while(cr>r+1) remove(--cr);
        res[qq[i].p] = ans;
    }

    for(int i=0; i<q; i++)
        printf("%d\n", res[i]);

    return 0;
}

Measured memory_bytes: 15284
use whiteread::parse_line;

fn main() {
    let x: u64 = parse_line().unwrap();
    let mut b: u64 = 100;
    let mut n: u32 = 0;
    while b < x {
        b = b + b / 100;
        n = n + 1;
    }
    println!("{:?}", n);
}


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

const int N = 1e6 + 5;

#define st first
#define nd second
#define make(a,b) make_pair(a,b)

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

set<int> mamy;

int main()
{
	int n, k;
	scanf("%d%d", &n, &k);
	int g = 0;
	int MAX = 0;
	for (int i = 0; i < n; i ++) {
		int a;
		scanf("%d", &a);
		g = __gcd(g, a);
		mamy.insert(a);
		MAX = max(MAX, a);
	}
	if (n == 1) {
		printf("%s\n", mamy.find(k) != mamy.end() ? "POSSIBLE" : "IMPOSSIBLE");
	} else {
		if (g == 0) {
			printf("%s\n", mamy.find(k) != mamy.end() ? "POSSIBLE" : "IMPOSSIBLE");	
		} else {
			if (k % g != 0 || k > MAX) {
				printf("IMPOSSIBLE\n");
			} else {
				printf("POSSIBLE\n");
			}
		}
	}
}


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

int main()
{
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  int max_x = -101;
  int min_y = 101;

  rep(i, N)
  {
    int x;
    cin >> x;
    max_x = max(max_x, x);
  }

  rep(i, M)
  {
    int y;
    cin >> y;
    min_y = min(min_y, y);
  }

  string ans = "War";

  if (X < max_x && max_x < min_y && min_y <= Y)
    ans = "No War";

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

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

using namespace std;

int main(void){

  int n,pm,pe,pj;

  while(cin >> n,n){
    while(n--){
      cin >> pm >> pe >> pj;
      
      int ave=(pm+pe+pj)/3;
      
      if((pm==100 || pe==100 || pj==100)||(pm+pe)/2 >=90 || ave>=80){
	cout << "A" << endl;
	continue;
      }
      
      if(ave>=70 || (ave>=50 && (pm>=80 || pe>=80))){
	cout << "B" << endl;
	continue;
      }
      
      cout << "C" << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 1156
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

struct Node {
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node*)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL) {
		y = x;
		if (z->key < x->key) {
			x = x->left;
		}else{
			x = x->right;
		}
	}
	z->parent = y;

	if (y == NIL) {
		root = z;
	} else {
		if (z->key < y->key) {
			y->left = z;
		} else {
			y->right = z;
		}
	}
}

void inorder(Node *u) {
	if (u == NIL)return;
	inorder(u->left);
	cout << " " << u->key;
	inorder(u->right);
}
void preorder(Node *u) {
	if (u == NIL)return;
	cout << " " << u->key;
	preorder(u->left);
	preorder(u->right);
}

int main()
{
	int n, i, x;
	string com;

	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> com;
		if (com == "insert") {
			cin >> x;
			insert(x);
		}else if(com=="print"){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}
    return 0;
}

Measured memory_bytes: 26616
S = [-1 if s == 'L' else 1 for s in input().strip()]
N = len(S)
L = -1
R = 1
ro = 0
re = 0
Ans = [0]*N
pre = 0
for i in range(N):
    s = S[i]
    if s == L:
        Ans[pre+1] += ro
        Ans[pre] += re
        ro = 0
        re = 0
        Ans[pre + (i-pre)%2] += 1
    elif s == R:
        re, ro = ro, re
        re += 1
        pre = i

print(*Ans, sep = ' ')

Measured memory_bytes: 48416
#include <iostream>
#include <algorithm>
#include<cstdio>
#include<string>
#include<vector>
using namespace std;
int main() {
	string s1, s2;
	cin >>s1 >>s2;
	if (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  for(int i=0; i<m; i++) cin >> x[i];
  vector<int> y(m-1);
  sort(x.begin(), x.end());
  for(int i=0; i<m-1; i++){
    y[i] = x[i+1] - x[i];
  }
  sort(y.rbegin(), y.rend());
 
  int sum = 0;
  for(int i=0; i<m-1; i++){
    if(i<=n-2) continue;
    sum += y[i];
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1024
/*input
aabhfgfaagjffasaaabaaazxzxcohxzcohxzcohzcxohizxciaabaaagfaabaaaaasfdasfabaaaaabaaafgsdffdhaabaagffgffhdfaaabaghfdaa
aa
*/
#include <iostream>
//#include <chrono>

  void computeLPSArray(std::string * pattern, int M, int * lps) {
    int len = 0;
    lps[0] = 0;
    int i = 1;
    while (i < M) {
      if ((*pattern)[i] == (*pattern)[len]) {
        len++;
        lps[i] = len;
        i++;
      } else {
        if (len != 0) {
          len = lps[len - 1];
        } else {
          lps[i] = 0;
          i++;
        }
      }
    }
  }

void KMPSearch(std::string *pattern, std::string *string) {
  int M = pattern->length();
  int N = string->length();
  int lps[M];
  computeLPSArray(pattern, M, lps);
  int i = 0;
  int j = 0;
  while (i < N) {
    if ((*pattern)[j] == (*string)[i]) {
      j++;
      i++;
    }
    if (j == M) {
      std::cout << i - j << std::endl;
      j = lps[j - 1];
    }else if (i < N && (*pattern)[j] != (*string)[i]) {
      if (j != 0){
        j = lps[j - 1];
      }else{
        i = i + 1;
      }
    }
  }
}

int main() {
  std::string pattern, string;
  getline(std::cin, string);
  getline(std::cin, pattern);
  //std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
  KMPSearch(&pattern, &string);
  //std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
  //std::cout << std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count() << "micros" <<std::endl;
  return 0;
}



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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;


signed main() {
    int a, b;
    cin >> a >> b;
    if (a <= 9 && b <= 9) {
        cout << a * b << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int,int>
#define ff first
#define ss second
#define ll long long int
#define vi vector<int>
#define vvll vector<ll>
#define vll(a) vector<ll> a(MAXN)
#define pb push_back
#define fo(a) for(auto&a1:(a))
#define fd(a,b) for(int i=(a);i>=(b);i--)
#define fk(a,b) for(int k=(a);k<(b);k++)
#define fj(a,b) for(int j=(a);j<(b);j++)
#define f(a,b) for(ll i=(a);i<(b);i++)
#define forni(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define fdk(a,b) for(int k=(a);k>=(b);k--)
#define fdj(a,b) for(int j=(a);j>=(b);j--)
#define ri(n) scanf("%d",&(n));
#define rll(n) scanf("%lld",&(n));
#define T(t) int t;scanf("%d",&(t));while((t)--)
#define MAXN 3005
#define MAXN2 10000005
#define pll pair<ll,ll>
#define PI 3.14159265
#define mset(a) memset((a),0,sizeof((a)))
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
const ll mod=1000000007;
double dp[MAXN][MAXN];
double dp_pref[MAXN][MAXN];
vector<double> a(MAXN);
int main()
{
    ll n;
    cin>>n;
    f(1,n+1)
    cin>>a[i];
    dp[0][0]=1;
    f(1,n+1)
    {
        fj(0,i+1)
        {
            if(j>0)
            dp[i][j]+=(1-a[i])*(dp[i-1][j-1]);
            dp[i][j]+=a[i]*(dp[i-1][j]);
        }
    }
    cout<<fixed<<setprecision(10);
    double sum=0;
    f(0,(n+1)/2)
    sum+=dp[n][i];
    cout<<sum<<"\n";
    return 0;
}


Measured memory_bytes: 49964
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val MAX = 10_000_000
    val C = LongArray(MAX + 1)
    for (i in 2 .. MAX) {
      var j = i
      while (j <= MAX) {
        C[j]++
        j += i
      }
    }
//    debug(C)
    var ans = 0L
    for (i in 1 .. ni()) {
      ans += (C[i] + 1) * i
    }
    out.println(ans)
  }













































  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}

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

class DICE_MODEL
{

public:
    int l1, l2, l3, l4, l5, l6;

    DICE_MODEL()
    {
        std::cin >> l1 >> l2 >> l3 >> l4 >> l5 >> l6;
    }

    DICE_MODEL(DICE_MODEL& dice)
    {
        l1 = dice.l1;
        l2 = dice.l2;
        l3 = dice.l3;
        l4 = dice.l4;
        l5 = dice.l5;
        l6 = dice.l6;
    }

    void turnNorth()
    {
        int temp = l2;
        l2 = l6;
        l6 = l5;
        l5 = l1;
        l1 = temp;
    }

    void turnEast()
    {
        int temp = l4;
        l4 = l6;
        l6 = l3;
        l3 = l1;
        l1 = temp;
    }

    void turnSouth()
    {
        int temp = l5;
        l5 = l6;
        l6 = l2;
        l2 = l1;
        l1 = temp;
    }

    void turnWest()
    {
        int temp = l3;
        l3 = l6;
        l6 = l4;
        l4 = l1;
        l1 = temp;
    }

    void turnClock()
    {
        int temp = l2;
        l2 = l3;
        l3 = l5;
        l5 = l4;
        l4 = temp;
    }

    void turnCounterClock()
    {
        int temp = l2;
        l2 = l4;
        l4 = l5;
        l5 = l3;
        l3 = temp;
    }

    bool operator == (DICE_MODEL target)
    {
        return (l1 == target.l1 && l2 == target.l2 && l3 == target.l3 && l4 == target.l4 && l5 == target.l5 && l6 == target.l6) ? true : false;
    }

    void printTop()
    {
        std::cout << l1 << std::endl;
    }

    void printRight()
    {
        std::cout << l3 << std::endl;
    }

    void printAll()
    {
        std::cout << l1 << " "  << l2 << " " << l3 << " " << l4 << " " << l5 << " " << l6 << std::endl;
    }
};

int main()
{
    DICE_MODEL diceA;
    DICE_MODEL diceB;

    int  men = 1;
    int  clockCnt  = 0;
    bool equalFlag = false;
    while (1)
    {
        if (diceA == diceB)
        {
            equalFlag = true;
            break;
        }

        diceA.turnClock();
        clockCnt++;
        if (clockCnt > 3)
        {
            men++;

            if      (men <= 4) diceA.turnNorth();
            else if (men == 5)
            {
                diceA.turnNorth();
                diceA.turnEast();
            }
            else if (men == 6)
            {
                diceA.turnEast();
                diceA.turnEast();
            }
            else break;
            
            clockCnt = 0;
        }
    }

    if (equalFlag) std::cout << "Yes" << std::endl;
    else           std::cout << "No"  << std::endl;
}


Measured memory_bytes: 3092
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
using namespace std;

int main() {
	int N, ans = 0;
	cin >> N;
	queue<string> a, b;
	a.emplace("0");
	a.emplace("3");
	a.emplace("5");
	a.emplace("7");
	while (a.front().size() < 9) {
		while (!a.empty()) {
			b.emplace(a.front() + '0');
			b.emplace(a.front() + '3');
			b.emplace(a.front() + '5');
			b.emplace(a.front() + '7');
			a.pop();
		}
		a.swap(b);
	}
	while (!a.empty()) {
		a.front() = to_string(stoi(a.front()));
		if (stoi(a.front()) <= N && a.front().find('7') != string::npos && a.front().find('5') != string::npos && a.front().find('3') != string::npos && all_of(a.front().begin(), a.front().end(), [](char& a) { return a == '7' || a == '5' || a == '3'; })) ans++;
		a.pop();
	}
	cout << ans;
}

Measured memory_bytes: 18816
//Author : Prakhar Asaiya
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=a;i<b;++i)
#define REPN(i,a,b) for(int i=a;i<=b;++i)
#define REPV(i,a,b) for(int i = a; i>= b; --i)
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define with_tests int t; cin>>t; while(t--){ solve(); }
#define without_tests solve();
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 100000000
#define ff first
#define ss second
const int M=1e9+7;

void solve()
{
	ll n,W;
	cin>>n>>W;
	ll w[n], v[n];
	REP(i,0,n)
	{
		cin>>w[i]>>v[i];
	}
	vector<vector<ll> > dp(n+1, vector<ll> (W + 1, 0));
	REP(i,0,W+1)
	{
		dp[0][i] = 0;
	}
	REP(i,0,n+1)
	{
		dp[i][0] = 0;
	}
	REP(i,1,n+1)
	{
		REP(j,1,W+1)
		{
			if(w[i-1] <= j)
			dp[i][j] = max(v[i-1] + dp[i-1][j-w[i-1]], dp[i-1][j]);
			else
			dp[i][j] = dp[i-1][j];
		}
	}
	cout<<dp[n][W];
}

int main()
{/*
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#*/
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  //with_tests;
  without_tests;
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<ll> L(N);
    for (int i = 0; i < N; i++) cin >> L[i];
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            for (int k = j+1; k < N; k++) {
                if (L[i] == L[j] || L[j] == L[k] || L[i] == L[k]) continue;
                ll a = min(L[i], min(L[j], L[k]));
                ll c = max(L[i], max(L[j], L[k]));
                ll b = L[i]+L[j]+L[k]-a-c;
                if (c<a+b) ans++;
            }
        }
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
N, A, B = map(int, input().split())
l = []
 
for i in range(N):
  value = 0
  for j in range(len(list(str(i+1)))):
    value += int(list(str(i+1))[j])
  if A <= value and value <= B:
    l.append(i+1)
    
print(sum(l))

Measured memory_bytes: 3296
import bisect
n = int(input())
*A, = map(int, input().split())
B = [A[i] + i for i in range(n)]
C = [i - A[i] for i in range(n)]
C.sort()
ans = 0
for b in B:
    ans += bisect.bisect_right(C, b) - bisect.bisect_left(C, b)
print(ans)

Measured memory_bytes: 33756
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 998244353
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=100001 ;
vector<pll>v ;
int main()
{
   fast ;
   ll tests=1 ;
   ///cin>>tests ;
   for(ll testcase=1;testcase<=tests;testcase++)
   {
     /// cout<<"Case #"<<testcase<<": " ;
     ll n ;
     cin>>n ;
     ll a[n] ;
     for(ll i=0;i<n;i++)
        cin>>a[i] ;

     ll r[21][2] ;
     ll ans=0 ;
     for(ll i=0;i<21;i++)
     {
         r[i][0]=n ;
         r[i][1]=n ;
     }

     for(ll i=n-1;i>=0;i--)
     {
         for(ll j=0;j<21;j++)
         {
             ll bit=a[i]&(1<<j) ;
             if(bit!=0)
             {
                 r[j][1]=r[j][0] ;
                 r[j][0]=i ;
             }
         }
         ll mx=n ;
         for(ll j=0;j<21;j++)
         {
             mx=min(mx,r[j][1]) ;
         }
         ans+=mx-i ;
     }
     cout<<ans ;
     cout<<endl ;
   }
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define Mo 1000000007
char zf[2][100];
int symbol[100]={0};
long long sum=1;
int change(char zf)
{
	if(zf>='a' && zf<='z')
		return zf-'a'+50;
	else
		return zf-'A';
}
int main()
{
	int N;
	scanf("%d",&N);
	for(int i=0;i<2;i++)
		scanf("%s",zf[i]);
	for(int i=0;i<N;i++)
	{
		int flag1=change(zf[0][i]);
		int flag2=change(zf[1][i]);
		if(symbol[flag1]==0)
		{
			symbol[flag1]=1;
			symbol[flag2]=1;
			if(i==0)
			{
				if(flag1!=flag2)
					sum=(sum*6)%Mo;
				else
					sum=(sum*3)%Mo;
			}
			else
			{
				int q_flag1=change(zf[0][i-1]);
				int q_flag2=change(zf[1][i-1]);
				if(flag1==flag2)
				{
					if(q_flag1==q_flag2)
						sum=(sum*2)%Mo;
				}
				else
				{
					if(q_flag1!=q_flag2)
						sum=(sum*3)%Mo;
					else
						sum=(sum*2)%Mo;
				}
			}
		}
	}
	printf("%lld\n",sum);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k,d[100005],n,m,s;
	cin>>n>>m>>s;
	for(i=0;i<m;i++) cin>>d[i];
	d[m]=s;
	int ans,left,right;
	ans=21000000;
	sort(d,d+m+1);d[m+1]=d[0];
	for(i=0;i<=m;i++) {
		left=d[i]-s;
		if(left<0) left+=n;
		right=s-d[i+1];
		if(right<0) right+=n;
		ans=min(ans,right*2+left);
		ans=min(ans,left*2+right);
	}
	cout<<ans*100<<endl;
}

Measured memory_bytes: 3184
def examC():
    X = I()
    p,q = divmod(X,100)
    if q>p*5:
        ans = 0
    else:
        ans = 1
    print(ans)
    return

def examD():
    return
def examE():
    return

def examF():
    return

import sys,copy,bisect,itertools,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


Measured memory_bytes: 38256
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
typedef pair<int,int> pii;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define inf 1000000000

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

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

void solve(){

    int a, b;
    cin >> a >> b;

    if(a<b)swap(a,b);
    int c = gcd(a,b);

    int ans = 0;
    ans++;

    for(int i = 2;i*i<=c;i++){
        if(c%i==0){
            ans++;

            while(c%i==0)c/=i;
        }
    }

    if(c!=1)ans++; //the left c isnt 1
    cout << ans << endl;
   

} 

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		scan.close();

		if (-1000 <= a && a <= 1000 && -1000 <= b && b <= 1000) {
			if (a < b) {
				System.out.println("a < b");
			} else if (a > b) {
				System.out.println("a > b");
			} else {
				System.out.println("a == b");
			}
		}
	}

}

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

#define rep(i,n) for(signed i=0;i<n;++i)
#define int long long
#define str string
#define debg(a) cout<<#a<<":"<<a<<endl;
#define print(a) cout<<a<<endl;
#define end cout<<endl;
#define elif else if

int a,b,c,i,j,k,n,m,x,y,z;
str s,t;
vector<signed> v;

signed main(){
  cin>>s;
  str t="keyence";
  int len=s.length()-t.length();
  str ans;
  bool asd=false;
  rep(i,s.length()-len){
    ans=s.substr(0,i)+s.substr(i+len,s.length()-len);
    if(ans==t){
      asd=true;
      break;
    }
  }
  cout<<(asd?"YES":"NO")<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    int IO = 0, OI = 0;
    for (int i = 0; i < S.size();i++){
        if (i%2==0){
            if(S[i]=='0')
                IO++;
            else if(S[i]=='1')
                OI++;
        }
        else {
            if(S[i]=='0')
                OI++;
            else if (S[i]=='1')
                IO++;
        }
    }
    cout << min(OI, IO) << endl;
}

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

string solve(int N) {
    vector<vector<int>> posi(21, vector<int>(21, 0));
    for (int i = 0; i < N; i++) {
        int x, y;
        cin >> x >> y;
        posi[y][x] = 1;
    }

    // for(int i = 0; i < 21; i++){
    //     for(int j = 0; j < 21; j++){
    //         cout<<posi[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }

    int M;
    cin >> M;
    vector<pair<char, int>> order;
    char c;
    int a;
    for (int i = 0; i < M; i++) {
        cin>>c;
        cin >> a;
        order.push_back(make_pair(c, a));
    }

    pair<int, int> machine_position = make_pair(10, 10);
    int cnt                         = 0;
    for (int i = 0; i < M; i++) {
        // cout<<"test"<<endl;
        
            if(order[i].first == 'N'){
                for (int j = 0; j <= order[i].second; j++) {
                    if (posi[machine_position.first + j][machine_position.second] == 1) {
                        cnt++;
                        posi[machine_position.first + j][machine_position.second] = 0;
                    }
                }
                machine_position = make_pair(machine_position.first + order[i].second, machine_position.second);
            }
            else if(order[i].first == 'S'){
                for (int j = 0; j <= order[i].second; j++) {
                    if (posi[machine_position.first - j][machine_position.second] == 1) {
                        cnt++;
                        posi[machine_position.first - j][machine_position.second] = 0;
                    }
                }
                machine_position = make_pair(machine_position.first - order[i].second, machine_position.second);
                }

            else if(order[i].first == 'E'){
                for (int j = 0; j <= order[i].second; j++) {
                    if (posi[machine_position.first][machine_position.second + j] == 1) {
                        cnt++;
                        posi[machine_position.first][machine_position.second + j] = 0;
                    }
                }
                machine_position = make_pair(machine_position.first, machine_position.second + order[i].second);
            }

            else if(order[i].first == 'W'){
                for (int j = 0; j <= order[i].second; j++) {
                    if (posi[machine_position.first][machine_position.second - j] == 1) {
                        cnt++;
                        posi[machine_position.first][machine_position.second - j] = 0;
                    }
                }
                machine_position = make_pair(machine_position.first, machine_position.second - order[i].second);
            }
            else cout<<order[i].first<<endl;

    }
    // cout<<cnt<<endl;
    if (cnt == N) return "Yes";
    return "No";
}

int main() {
    int N;
    vector<string> ans;
    while (cin >> N) {
        if (!N) break;
        ans.push_back(solve(N));
    }
    for(string a:ans) cout<<a<<endl;
}


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

int arr[200005], n, nums[1000005];

int main(){
    scanf("%d", &n);
    for (int i = 0; i < n; ++i){
        scanf("%d", &arr[i]);
        ++nums[arr[i]];
    }
    int ans = 0; bool done;
    for (int i = 0; i < n; ++i){
        if (nums[1] != 0 && arr[i] != 1) continue;
        if (nums[arr[i]] != 1) continue;
        done = false;
        for (int j = 2; j * j <= arr[i]; ++j){
            if (arr[i] % j == 0 && nums[j] != 0){
                done = true; break;
            }
            if (arr[i] % j == 0 && nums[arr[i] / j] != 0){
                done = true; break;
            }
        }
        if (!done) ++ans;
    }
    printf("%d", ans);
    return 0;
}


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

N, M = map(int, input().split())
L = [[int(v) - 1 for v in input().split()] for _ in range(M)]
L.sort(key = lambda x:(-x[1], -x[0]))

ans = 1
sx, sy = L[0]
for i in range(1, M):
    x, y = L[i]
    
    if sx >= y:
        ans += 1
        sx = x
    elif sx <= x:
        sx = x
    
print(ans)

Measured memory_bytes: 35544
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<queue>
using namespace std;
int main()
{
    int a,b,c;
    while(~scanf("%d%d%d",&a,&b,&c)){
        if(a==b)
            printf("%d\n",c);
        else if(a==c)
            printf("%d\n",b);
        else printf("%d\n",a);
    }
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int binarySearch(int, int, int*);

int main() {
  int n, q, i, count = 0; 
  int s[100000], t;
  
  scanf("%d",&n);
  for(i = 0;i < n;i++) scanf("%d",&s[i]);
  
  scanf("%d",&q);
  for(i = 0;i < q;i++) {
    scanf("%d",&t);
    count += binarySearch(n,t,s);
  }
  
  printf("%d\n",count);
  
  return 0;
}

int binarySearch(int n,int key,int s[]) {
  int left = 0;
  int right = n;
  int mid;
  while(left < right) {
    mid = (left + right) / 2;
    if(key == s[mid]) return 1;
    if(key > s[mid]) left = mid + 1;
    else if(key < s[mid]) right = mid;
  }
  return 0;
}

Measured memory_bytes: 988
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  string s;
  cin >> s;
  int n;
  cin >> n;
  REP(i,n){
    string q;
    int a,b;
    cin >> q >> a >> b;
    if(q=="print"){
      cout << s.substr(a,b-a+1) << endl;
    }else if(q=="reverse"){
      auto sub = s.substr(a,b-a+1);
      reverse(ALL(sub));
      s.replace(a,b-a+1,sub);
    }else{
      string p;
      cin >> p;
      s.replace(a,b-a+1,p);
    }
  }
}


Measured memory_bytes: 3224
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int[] a = new int[N];

		int[] b = new int[N];

		double sum = 0;

		double ave = 0;

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

			a[i] = sc.nextInt();

			b[i] = a[i];

			sum += a[i];

		}

		ave = sum/a.length;

		sort(a);

		boolean flag = false;

		int c = 0;

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

			if(ave<=a[i]) {

				c = i;

				break;
			}
		}


		if(c-1>=0 && (Math.abs(ave-a[c])==Math.abs(ave-a[c-1]))) {

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

				if(b[i]==a[c] || b[i]==a[c-1]) {

					System.out.println(i);

					break;
				}
			}


		}else {

			if(c-1>=0 && (Math.abs(ave-a[c])>Math.abs(ave-a[c-1]))){

				c = c-1;
			}

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

				if(b[i] == a[c]) {

					System.out.println(i);

					break;
				}
			}
		}
	}

	public static void sort(int[] a) {

		for(int i=1;i<a.length;i++) {

			int j = i;

			while(j>=1 && a[j-1]>a[j]) {

				int temp = a[j];

				a[j] = a[j-1];

				a[j-1] = temp;

				j--;
			}
		}
	}

}


Measured memory_bytes: 22996
#C-attention
n=int(input())
s=input()
import collections
numberw=s.count("W")
numbere=n-numberw
start=0
if s[0]=="W":
    start=numbere
    
elif s[0]=="E":
    start=numbere-1
ans=n
for i in range(n-1):
    ans=min(ans,start)
    if s[i]=="W" and s[i+1]=="W":
        start+=1
    elif s[i]=="W" and s[i+1]=="E":
        start=start
    elif s[i]=="E" and s[i+1]=="W":
        start=start
    elif s[i]== "E"and s[i+1]=="E":
        start-=1  
    ans=min(ans,start)
print(ans)

Measured memory_bytes: 3784
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        s: Chars,
    }
    let n = s.len();
    let mut result = n;
    for i in 1..n {
        if s[i - 1] != s[i] {
            result = min(result, max(i, n - i));
        }
    }
    println!("{}", result);
}


Measured memory_bytes: 2468
$PI=2*atan2 1,0;
($x1,$y1,$x2,$y2)=glob<>;
($xl,$xr)=sort{$a-$b}$x1,$x2;
($yl,$yr)=sort{$a-$b}$y1,$y2;
<>;
@y=map{s/.* //r}sort{$a-$b}grep{/ /;$xl<=$`&&$`<=$xr&&$yl<=$'&&$'<=$yr}<>;
@y=reverse@y if($x1-$x2)*($y1-$y2)<0;
@d=-inf;
for(@y){
	for($l=0,$r=@d;$m=$l+$r>>1,$r-$l>1;){
		${$d[$m]<$_?l:r}=$m;
	}
	$d[$m+1]=$_;
}
if($xr-$xl+1==$#d||$yr-$yl+1==$#d){
	print 100*($xr-$xl+$yr-$yl)+($#d-1)*5*($PI-4)+10*($PI-2)
}else{
	print 100*($xr-$xl+$yr-$yl)+$#d*5*($PI-4)
}


Measured memory_bytes: 57724
dice = list(map(int, input().split()))
slist = input()

for s in slist:
    if s == "N":
        next = list("263415")
    elif s == "E":
        next = list("421653")
    elif s == "S":
        next = list("513462")
    else:
        next = list("326154")

    tmp = [0] * 6
    for i, n in enumerate(next):
        tmp[i] = dice[int(n)-1]

    dice = tmp

print(dice[0])



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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

int main(int argc, char **argv)
{
	double n, m, d; cin >> n >> m >> d;

	double res;
	if (d == 0)
		res = (m-1) * (1/n);
	else
		res = (m-1) * 2 * (n - d) / (n*n);
	std::cout << fixed << setprecision(10) << res << std::endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,i,t,sum=0;
    scanf("%d",&n);
    {
        t=n;
        while(t)
        {
                sum+=t%10;
            t/=10;
        }
        if(n%sum==0)    printf("Yes\n");
        else    printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 128
from sys import stdin

s = stdin.readline().rstrip()

count = 0
if s[0] == 'A':
    if s[1] == 'B':
        count += 1
if s[1] == 'A':
    if s[2] == 'B':
        count += 1
if s[0] == 'B':
    if s[1] == 'A':
        count += 1
if s[1] == 'B':
    if s[2] == 'A':
        count += 1
if count > 0:
    print('Yes')
else:
    print('No')


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

int main(){
  int N; cin >> N;
  vector<float> v(N);
  for(int i=0; i<N; i++){
    cin >>v[i];
  }
  sort(v.begin(),v.end());
  float ans = (v[0]+v[1])/2;
  for(int i = 2; i<N; i++){
    ans = (v[i] + ans)/2;
  }
  std::cout << std::setprecision(10) << ans << endl;


}


Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

ull gcd(ull a,ull b){
    if(b==0) return a;
    return gcd(b,a%b);
}

int main(){
    int n;
    cin>>n;
    ulvec t(n);
    ull x;
    rep(i,n) cin>>t[i];
    if(n==1) cout<<t[0];
    else{
        x=t[1]/gcd(t[0],t[1]);
        x*=t[0];
        for(int i=2;i<n;i++){
            ull y=t[i]/gcd(x,t[i]);
            x*=y;
        }
        cout<<x<<endl;
    }
}

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

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

//fill(score, score+202020, 0);
#define NN 202020

int main(){
  ll n, m;
  cin >> n >> m;
  vector<pll> vec;
  ll a, b;
  for (int i=0;i<m;i++){
    cin >> a >> b;
    vec.push_back(pll(b, a));
  }

  sort(vec.begin(), vec.end());
  //cout << vec[0].first << " " << vec[0].second << endl;
  //cout << vec[1].first << " " << vec[1].second << endl;
  
  ll ans = 0;
  ll last = 0;
  for (int i=0;i<vec.size();i++){
    if (vec[i].second <= last) continue;
    else{
      last = vec[i].first - 1;
      ans += 1;
      //cout << vec[i].second << " " << vec[i].first << " " << last << " " << ans << endl;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 2420
#include <stdio.h>          // printf(), putchar(), getc()
#include <ctype.h>          // isdigit()

#define MAX_N 100000
#define swap(x, y) { int t = x; x = y; y = t; }
const char NUL = '\0';

int
partition(int a[], int p, int r)
{
	int j;

	int x = a[r];
	int i = p - 1;
	for (j = p; j < r; ++j)
	{
		if (a[j] <= x)
		{
			i++;
			swap(a[i], a[j]);
		}
	}

	swap(a[i + 1], a[r]);
	return i + 1;
}

void
print_number(int n)
{
	char text[12];
	char* s = &text[11];
	*s = NUL;
	do
	{
		int m = n % 10;
		*--s = m + '0';
		n /= 10;
	} while (n != 0);

	printf("%s", s);
}


int
main(int argc, char** argv)
{
	int a[MAX_N];
	int n, m;
	int i;
	int c;

	c = getc(stdin);
	n = 0;
	while (isdigit(c))
	{
		n = n * 10 + c - '0';
		c = getc(stdin);
	}

	for (i = 0; i < n; ++i)
	{
		while (!isdigit(c) && c != NUL)
			c = getc(stdin);

		m = 0;
		while (isdigit(c))
		{
			m = m * 10 + c - '0';
			c = getc(stdin);
		}

		a[i] = m;
	}

	int q = partition(a, 0, n - 1);
	for (i = 0; i < n; ++i)
	{
		if (i == q)
			putchar('[');
		print_number(a[i]);
		if (i == q)
			putchar(']');
		printf("%c", (i != n - 1) ? ' ' : '\n');
	}

	return 0;
}

Measured memory_bytes: 896
#include <iostream>

using namespace std;

using Int = int64_t;
using Uint = uint64_t;

int main() {
  Int A, B, K;
  cin >> A >> B >> K;

  if (A + B <= K) {
    cout << 0 << " " << 0 << endl;
    return 0;
  }

  if (A >= K) {
    cout << A - K << " " << B << endl;
    return 0;
  }

  cout << 0 << " " << B - (K-A) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll c[100000];
int main(void){
  int n;
  scanf("%d",&n);
  ll a[n],b[n];
  FOR(n){
    scanf("%lld",&a[i]);
    b[i]=a[i];
  }
  qsort(b,n,sizeof(ll),u);
  ll l=b[n/2]+b[n/2-1];
  FOR(n)PRL(b[n/2-(l<a[i]*2)]);
  return 0;
}


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

public class AtCoder
{
  public static void Main()
  {
    var n = int.Parse(Console.ReadLine().Trim());

    var v = new int[n];

    for(var i=0; i < n; i++) {
      v[i] = int.Parse(Console.ReadLine().Trim()) - 1;
    }

    var now = 0;
    var count = 0;

    for(;;)
    {
      if(now == 1)
      {
        break;
      }
      if(count >= n)
      {
        count = -1;
        break;
      }

      count++;
      now = v[now];
    }

    Console.WriteLine(count);
  }
}

Measured memory_bytes: 13280
#include <stdio.h>
#include <algorithm>
 
using namespace std;
 
int main(){
    int n,max_num = -1000001,min_num = 1000001,tmp;
    long long int sum = 0;
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d",&tmp);
        sum += tmp;
        max_num = max(max_num,tmp);
        min_num = min(min_num,tmp);
    }
    printf("%d %d %lld\n",min_num,max_num,sum);
}


Measured memory_bytes: 2768
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		for(int i=N; i<=M/4; i++){
			if(M%i==0){
				System.out.println(M/i);
				return;
			}
		}
		if(M%3==0 && M/3>=N){
			System.out.println(3);
			return;
		}
		if(M%2==0 && M/2>=N){
			System.out.println(2);
			return;
		}
		System.out.println(1);
		return;
	}
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
#define lol long long
#define mp(x,y) make_pair(x,y)
using namespace std;

//const lol mod=1e9+7;

/*  author: H3XoRuSH  */

int main() {
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lol n,x,y,a;
    cin >> n >> x >> y;
    lol q1=0,q2=0,q3=0;
    while(n--){
        cin >> a;
        if(a<=x) q1++;
        else if(a<=y) q2++;
        else q3++;
    }
    lol ans=min(q1,min(q2,q3));
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
xu=[input().split()for i in range(n)]

for i in range(n):
    if xu[i][1]=='BTC':
        xu[i][0]=float(xu[i][0])* 380000.0
    else:
        xu[i][0]=float(xu[i][0])

print(sum(x[0] for x in xu))

Measured memory_bytes: 3064