akhauriyash/Code-Regression huggingface dataset:
#include<cstdint>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include <math.h>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<iterator>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>
#include<utility>
#include<initializer_list>


#define repi(i,start,end)for(int64_t (i)=(start);(i)<(end);++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x, v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vin(v) rep(i,(v).size()) cin >> (v)[i];
#define vpin(v) rep(i,(v).size()) cin >> (v)[i].first >> (v)[i].second

using namespace std;
using Int = int64_t;
using pint = pair<Int, Int>;
using vint = vector<Int>;
using vvint = vector<vint>;
using vpint = vector<pint>;
using vstr = vector<string>;

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;  }
template<class T>void put_double(T a){cout<<setprecision(12);cout<<a<<"\n";}
template<class T>void println(T a){cout << a << "\n";}
// auto [x, y] = make_tuple(3, 4); => let (x, y) = (3, 4);

int main(void) {
    Int a; long double b; cin >> a >> b;
    Int ans = a * b;
    println(ans);
    return 0;
}


Measured memory_bytes: 3732
#include <cstdio>
#define MAX 10000
#define NIL -1

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

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d)
{
  if (u == NIL)
    return;
  D[u] = d;
  setDepth(T[u].left, d + 1);
  setDepth(T[u].right, d + 1);
}

int setHeight(int u)
{
  int h1 = 0, h2 = 0;
  if (T[u].left != NIL)
  {
    h1 = setHeight(T[u].left) + 1;
  }
  if (T[u].right != NIL)
  {
    h2 = setHeight(T[u].right) + 1;
  }
  return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u)
{
  if (T[u].parent == NIL)
  {
    return NIL;
  }

  if (T[T[u].parent].left != u && T[T[u].parent].left != NIL)
  {
    return T[T[u].parent].left;
  }
  if (T[T[u].parent].right != u && T[T[u].parent].right != NIL)
  {
    return T[T[u].parent].right;
  }

  return NIL;
}

void print(int u)
{
  printf("node %d: ", u);
  printf("parent = %d, ", T[u].parent);
  printf("sibling = %d, ", getSibling(u));
  int degree = 0;
  if (T[u].left != NIL)
  {
    degree++;
  }
  if (T[u].right != NIL)
  {
    degree++;
  }
  printf("degree = %d, ", degree);
  printf("depth = %d, ", D[u]);
  printf("height = %d, ", H[u]);

  if (T[u].parent == NIL)
  {
    printf("root\n");
  }
  else if (T[u].left == NIL && T[u].right == NIL)
  {
    printf("leaf\n");
  }
  else
  {
    printf("internal node\n");
  }
}

int main()
{
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
  {
    T[i].parent = NIL;
  }
  int id, left, right;
  for (int i = 0; i < n; i++)
  {
    scanf("%d %d %d", &id, &left, &right);
    T[id].left = left;
    T[id].right = right;
    if (left != NIL)
    {
      T[left].parent = id;
    }
    if (right != NIL)
    {
      T[right].parent = id;
    }
  }

  int root = 0;
  for (int i = 0; i < n; i++)
  {
    if (T[i].parent == NIL)
    {
      root = i;
    }
  }

  setDepth(root, 0);
  setHeight(root);

  for (int i = 0; i < n; i++)
  {
    print(i);
  }

  return 0;
}


Measured memory_bytes: 2772
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int H, W; ll L;
bool wall[101][101];
int memo[101][101][4];
map<int, char> dir2;
bool ok(int x, int y){
    return 0 <= x && 0 <= y && x < W && y < H && !wall[y][x];
}
void solve(int turn, int cx, int cy, int cd){
    if((ll)(turn - 1) == L){
        cout << cy + 1 << ' ' << cx + 1 << ' ' << dir2[cd] << endl;
        return;
    }
    int nx, ny, nd;
    rep(i, 4){
        nd = (cd + i) % 4;
        nx = cx + dx[nd]; ny = cy + dy[nd];
        if(ok(nx, ny)) break;
    }
    if(memo[ny][nx][nd] == -1){
        memo[ny][nx][nd] = turn;
        solve(turn + 1, nx, ny, nd);
    }else{
        int temp = memo[ny][nx][nd];
        ll mo = (L - (ll)turn) % (ll)(turn - temp);
        rep(i, H) rep(j, W) rep(k, 4)
          if(memo[i][j][k] == temp + (int)mo){
              cout << i + 1 << ' ' << j + 1 << ' ' << dir2[k] << endl;
              return;
          }
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    map<char, int> dir1;
    dir1['N'] = 3; dir1['E'] = 0; dir1['S'] = 1; dir1['W'] = 2;
    for(const auto& k : dir1) dir2[k.second] = k.first;
    while(cin >> H >> W >> L && H){
        int sx, sy, sd;
        memset(wall, 0, sizeof(wall));
        memset(memo, -1, sizeof(memo));
        rep(i, H){
            cin >> s;
            rep(j, W){
                if(s[j] == '#') wall[i][j] = true;
                if('A' <= s[j] && s[j] <= 'Z'){
                    sx = j; sy = i; sd = dir1[s[j]];
                }
            }
        }
        memo[sy][sx][sd] = 0;
        solve(1, sx, sy, sd);
    }
    return 0;
}

Measured memory_bytes: 3860
#include<iostream>

using namespace std;
int bubbleSort(int, int[]);

int main(void){
	static int A[100];
	int n;
	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> A[i];
	}

	int ans = bubbleSort(n, A);
	for (int i = 0; i < n; i++){
		cout << A[i];
		if (i != n - 1){
			cout << " ";
		}
		else{
			cout << endl;
		}
	}

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

int bubbleSort(int N, int A[]){
	bool flag = true;
	int num = 0;
	while (flag){
		flag = false;
		for (int i = N - 1; i > 0; i--){
			if (A[i] < A[i - 1]){
				int temp = A[i];
				A[i] = A[i - 1];
				A[i - 1] = temp;
				flag = true;
				num++;
			}
		}
	}

	return num;
}

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

char judge( char* c )
{
    if( c[1] == 'o' && c[2] == 'o' && c[3] == 'o' )
        return 'o';
    if( c[4] == 'o' && c[5] == 'o' && c[6] == 'o' )
        return 'o';
    if( c[7] == 'o' && c[8] == 'o' && c[9] == 'o' )
        return 'o';
    if( c[1] == 'o' && c[4] == 'o' && c[7] == 'o' )
        return 'o';
    if( c[2] == 'o' && c[5] == 'o' && c[8] == 'o' )
        return 'o';
    if( c[3] == 'o' && c[6] == 'o' && c[9] == 'o' )
        return 'o';
    if( c[1] == 'o' && c[5] == 'o' && c[9] == 'o' )
        return 'o';
    if( c[3] == 'o' && c[5] == 'o' && c[7] == 'o' )
        return 'o';

    if( c[1] == 'x' && c[2] == 'x' && c[3] == 'x' )
        return 'x';
    if( c[4] == 'x' && c[5] == 'x' && c[6] == 'x' )
        return 'x';
    if( c[7] == 'x' && c[8] == 'x' && c[9] == 'x' )
        return 'x';
    if( c[1] == 'x' && c[4] == 'x' && c[7] == 'x' )
        return 'x';
    if( c[2] == 'x' && c[5] == 'x' && c[8] == 'x' )
        return 'x';
    if( c[3] == 'x' && c[6] == 'x' && c[9] == 'x' )
        return 'x'; 
    if( c[1] == 'x' && c[5] == 'x' && c[9] == 'x' )
        return 'x';
    if( c[3] == 'x' && c[5] == 'x' && c[7] == 'x' )
        return 'x';
    
    return 'd'; 
}   

int main()
{
    int n = 50;
    string str;
    while( cin >> str )
    {
        char a[10];
        for( int i = 0; i < str.size(); i++ )
            a[i+1] = str[i];

        cout << judge(a) << endl;
    }
    return 0;
}


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void) {
  long long int n;
  scanf("%lld", &n);
  
  long long int sum = 0;
  for (long long int i = 1; i <= n; i++) {
    if ((i % 3) && (i % 5)) {
      sum += i;
    }
  }

  printf("%lld\n", sum);

  return 0;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);

  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  cout << abs(a[0] - a[n - 1]) << endl;
}


Measured memory_bytes: 3592
import heapq
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[-A[i] for i in range(N)]
heapq.heapify(A)
for i in range(M):
    a=A[0]
    heapq.heappop(A)
    heapq.heappush(A,-(a//-2))
print(-sum(A))

Measured memory_bytes: 14180
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 100
#define INF (1<<29)
 
int N, cost[MAX][MAX];
 
int get_sat(set<int> &inv)
{
    int sat = 0;
    for (auto &i: inv) {
        int s = INF;
        for (auto &j: inv) {
            if (i == j) continue;
            s = min(s, cost[i][j]);
        }
        sat += s;
    }
    return sat;
}
 
map<set<int>, int> memo;
 
int dfs(set<int> inv)
{
    int res = 0;
    if (memo.count(inv) > 0) {
        return memo[inv];
    }
         
    if (inv.size() >= 2) {
        res = get_sat(inv);
    }
    for (int i = 0; i < N; i++) {
        bool ok = 1;
        for (auto &j: inv) {
            if (cost[i][j] == 0) {
                ok = 0;
                break;
            }
        }
        if (ok) {
            set<int> ninv = inv;
            ninv.insert(i);
            res = max(res, dfs(ninv));
        }            
    }
    return (memo[inv] = res);
}
 
int main()
{
    int M, a, b, c;
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> a >> b >> c;
        a--; b--;
        cost[a][b] = cost[b][a] = c;
    }    
    cout << dfs(set<int>()) << endl;
    return 0;
}

Measured memory_bytes: 10068
#include <bits/stdc++.h>
using namespace std;
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)


int main(){
    int K;cin>>K;
    string S; cin>>S;
    if(S.size()>K){
        string output = "";
        rep(i, K){
            output+=S.at(i);
        }
        output+="...";
        cout<<output<<endl;

    }else{
        cout<<S<<endl;
    }

}
 

Measured memory_bytes: 3628
from math import floor
n, d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
cnt = 0
for i in range(n):
    for j in range(i+1, n):
        dist = 0
        for k in range(d):
            dist += (x[i][k] - x[j][k]) ** 2
        if floor(dist**0.5)**2 == dist:
            cnt += 1
print(cnt)

Measured memory_bytes: 3188
#include<cstdio>
#include<algorithm>
#include<map>
#include<cstring>
#include<cmath>
#include<iostream>
using namespace std;
typedef long long LL;

map<pair <string,string>,LL> cnt;
const int maxn = 50;
char s[maxn];

int main(){
    int n; scanf("%d",&n);
    scanf("%s",s);
    for(int i = 0;i < (1 << n);i++){
        string s1 = "",s2 = "";
        for(int j = 0;j < n;j++){
            if(i & (1 << j)) s1 += s[j]; 
            else s2 += s[j];
        }
        cnt[make_pair(s1,s2)]++;
    }
    LL sum = 0;
    for(int i = 0;i < (1 << n);i++){
        string s1 = "",s2 = "";
        for(int j = n - 1;j >= 0;j--){
            if(i & (1 << j)) s2 += s[j + n];
            else s1 += s[j + n];
        }
        sum += cnt[make_pair(s1,s2)];
    }
    printf("%lld\n",sum);
}

Measured memory_bytes: 91904
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	// 上面の色を固定してから、左右方向に回転して一致するものがあるかを調べる
	round := [][]int{
		{1,2,3,4,5,6}, {1,3,5,2,4,6}, {1,4,2,5,3,6}, {1,5,4,3,2,6}, // c1を上面に固定して回転
		{2,6,3,4,1,5}, {2,3,1,6,4,5}, {2,1,4,3,6,5}, {2,4,6,1,3,5}, // c2を上面に固定して回転
		{3,1,2,5,6,4}, {3,2,6,1,5,4}, {3,5,1,6,2,4}, {3,6,5,2,1,4}, // c3を上面に固定して回転
		{4,1,5,2,6,3}, {4,2,1,6,5,3}, {4,5,6,1,2,3}, {4,6,2,5,1,3}, // c4を上面に固定して回転
		{5,1,3,4,6,2}, {5,3,6,1,4,2}, {5,4,1,6,3,2}, {5,6,4,3,1,2}, // c5を上面に固定して回転
		{6,2,4,3,5,1}, {6,3,2,5,4,1}, {6,5,3,4,2,1}, {6,4,5,2,3,1}, // c6を上面に固定して回転

	}
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		cubes := make([][]string, n)
		for i := 0; i < n; i++ {
			scanner.Scan()
			cubes[i] = strings.Split(scanner.Text(), " ")
		}
		check := func(a, b int) bool {
			tmp := make([]string, 6)
			for i := 0; i < 24; i++ {
				for j := 0; j < 6; j++ {
					tmp[j] = cubes[b][round[i][j]-1]
				}
				if reflect.DeepEqual(tmp, cubes[a]) {
					return true
				}
			}
			return false
		}
		tbl := make([]int, n)
		// 全ての組み合わせを調べる
		for i := 0; i < n; i++ {
			if tbl[i] == 1 {
				continue
			}
			for j := i+1; j < n; j++ {
				if check(i, j) {
					tbl[j] = 1
				}
			}
		}
		fmt.Println(sum(tbl))
	}
}

func sum(a []int) int {
	ret := 0
	for _, v := range a {
		ret += v
	}
	return ret
}


Measured memory_bytes: 6124
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

class State {
public:
  int pos;
  int cost;
  int prev_hand;
  int prev_pos;
  State(int _p,int _c) : pos(_p),cost(_c),prev_hand(-1000),prev_pos(-1000) {}
  State(int _p,int _c,int _ph,int _pp) : pos(_p),cost(_c),prev_hand(_ph),prev_pos(_pp) {}
  bool operator<(const State& s) const{
    return cost < s.cost;
  }
  bool operator>(const State& s) const{
    return cost > s.cost;
  }
};

struct DP{
  int cost;
  int prev_hand;
  int prev_pos;
  DP(int _c,int _ph,int _pp) : cost(_c),prev_hand(_ph),prev_pos(_pp){}
  DP() : cost(INF),prev_hand(-1000),prev_pos(-1000){}
};

int main(){
  int total_cells;
  while(~scanf("%d",&total_cells)){
    int dice[7];
    for(int i=1;i<=6;i++){
      scanf("%d",dice + i);
    }
    int start,goal;
    scanf("%d %d",&start,&goal);
    int stage[303];
    for(int i=1;i<=total_cells;i++){
      scanf("%d",stage + i);
    }
    
    priority_queue<State,vector<State>,greater<State> > que;
    que.push(State(start,0,-1000,-1000));

    DP dp[303];

    while(!que.empty()){
      State s = que.top();
      que.pop();

      if(dp[s.pos].cost <= s.cost) continue;

      dp[s.pos].cost = s.cost;
      dp[s.pos].prev_hand = s.prev_hand;
      dp[s.pos].prev_pos = s.prev_pos;

      for(int i=1;i<=6;i++){
	int dx1 = s.pos + dice[i];
	int dx2 = s.pos - dice[i];

	if(1 <= dx1 && dx1 <= total_cells){
	  dx1 += stage[dx1];
	  que.push(State(dx1,s.cost + 1,i,s.pos));
	}
	if(1 <= dx2 && dx2 <= total_cells){
	  dx2 += stage[dx2];
	  que.push(State(dx2,s.cost + 1,-i,s.pos));
	}
      }
    }

    vector<int> hands;
    int prev_x = goal;
    for(int round = 0;round <= 3000;round++){
      hands.push_back(dp[prev_x].prev_hand);
      prev_x = dp[prev_x].prev_pos;
      if(prev_x == start) break;
    }

    reverse(hands.begin(),hands.end());

    int hand_idx = 0;
    for(int round = 0;round <= 3000;round++){
      int num;
      scanf("%d", &num);
      
      if(num != abs(hands[hand_idx])){
	printf("0\n"); fflush(stdout);
      }

      else if(num == abs(hands[hand_idx])){
	if(hands[hand_idx] > 0){
	  printf("1\n"); fflush(stdout);
	}
	else{
	  printf("-1\n"); fflush(stdout);
	}
	hand_idx++;
      }

      if(hand_idx >= hands.size()) break;
    }
  }
}

Measured memory_bytes: 1304
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  ll n,d,ans=0;
  cin>>n>>d;
  ll x[200005],y[200005];
  for(int i=0;i<n;i++)
  {
    cin>>x[i]>>y[i];
  }
  d=d*d;
  for(int i=0;i<n;i++)
  {
    ll dist=(x[i]*x[i] + y[i]*y[i]);
    if(dist<=d)
      ans++;
  }
  cout<<ans<<"\n";
  return 0;
}

Measured memory_bytes: 6700
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, m; cin >> n >> m;

    if(n == m){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, T, A;
	cin >> N >> T >> A;

	vector<int> H(N);
	for (int i = 0; i < N; i++) cin >> H[i];

	double tmp = INF;
	int ans;

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

		if (abs(T - H[i] * 0.006 - A) < tmp) {
			ans = i + 1;
			tmp = abs(T - H[i] * 0.006 - A);
		}
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
import os, sys, re, math

(N, K) = [int(n) for n in input().split()]

if K == 1:
    print(1)
else:
    lk = math.log2(K - 1)
    p = 0
    for i in range(1, N + 1):
        if i >= K:
            p += 1.0
        else:
            p += (0.5 ** (int(lk - math.log2(i) + 1)))
    print(p / N)


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

using ll = long long;
const ll MOD = 998244353;

int main() {
    string S;
    cin >> S;
    int n = S.size();
    vector<int> ans(n, 0);
    rep(i, n) {
        int L = 0;
        while (S[i] == 'R') {
            L++;
            i++;
        }
        //cout << "i=" << i << " R=" << L << endl;
        if (L % 2) {
            ans[i - 1] = L / 2 + 1;
        } else {
            ans[i - 1] = L / 2;
        }
        ans[i] = L / 2;
        //cout << ans[i - 1] << " " << ans[i] << endl;
        int R = 0, j = i;
        while (i < n && S[i] == 'L') {
            R++;
            i++;
        }
        //cout << "i=" << i << " L=" << R << endl;
        if (R % 2) {
            ans[j] += R / 2 + 1;
        } else {
            ans[j] += R / 2;
        }
        ans[j - 1] += R / 2;
        //cout << ans[j - 1] << " " << ans[j] << endl;
        i--;
    }
    rep(i, n) {
        cout << ans[i];
        if (i == n - 1) cout << endl;
        else cout << " ";
    }
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cmath>
#include <climits>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cassert>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <fstream>
#include <functional>
#include <utility>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <iomanip>


#define memtst(x) (sizeof(x) / 1024. / 1024.)
#define mem0(x) memset((x), 0, (sizeof x))
#define meminf(x) memset((x), INF, (sizeof x))
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define pq std::priority_queue
#define iter iterator
#define mp(x, y) std::make_pair((x), (y))
#define fst first
#define sec second
#define lc(x) ((x) * 2)
#define rc(x) ((x) * 2 + 1) 
#define md(x, y) (((x) + (y)) / 2)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef std::pair <int, int> pii;
const double PI = acos(-1);
const double EPS = 1e-6;
const ll MOD = 998244353;
const ll N = 1e5 + 10;
template <typename T>
inline T Abs(T x)
{
    return x < 0 ? x * -1 : x;
}
template <typename T>
inline T Max(T x, T y, T z)
{
    return std::max(std::max(x, y), z);
}
template <typename T>
inline T Min(T x, T y, T z)
{
    return std::min(std::min(x, y), z);
}
template <typename T>
inline void Ckmax(T &x, T y)
{
    x = std::max(x, y);
}
template <typename T>
inline void Ckmin(T &x, T y)
{
    x = std::min(x, y);
}
template <typename T>
inline T Sqr(T x)
{
    return x * x;
}
template <typename T>
inline T Pow(T x, T y)
{
    T r = 1;
    while (y > 0)
    {
        if (y % 2 > 0)
            (r *= x) %= MOD;
        (x *= x) %= MOD;
        y /= 2;
    }
    return r % MOD;
}
template <typename T>
T Pow(T x, T y, T z)
{
    T r = 1;
    while (y > 0)
    {
        if (y % 2 > 0)
            (r *= x) %= z;
        (x *= x) %= z;
        y /= 2;
    }
    return r % z;
}
template <typename T>
inline T gcd(T x, T y)
{
    return y > 0 ? gcd(y, x % y) : x;
}
template <typename T>
inline T lcm(T x, T y)
{
    return x / gcd(x, y) * y;
}
inline void cinspu(void)
{
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
}
inline ll fac(ll x)
{
	ll r = 1;
	for (; x > 1; --x)
		(r *= x) %= MOD;
	return r;
}


int main()
{
	cinspu();
	int x;
	std::cin >> x;
	std::cout << (x == 3 || x == 5 || x == 7 ? "YES" : "NO");
	return 0;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;

int A, B;

void solve()
{
    cin >> A >> B;
    cout << (A + B) % 24 << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for(ll i=0; i<n; i++)
#define all(v) v.begin(), v.end()
#define vec vector
typedef long long ll;
const int INF = 1001001001;
const double PI = 3.141592653589793238;


/*　<<stringで読み込んだ数列を一桁ずつint型へ変換>>
 
    string str;
    int N[桁数];
 
    cin >> str;
 
    for (int i = 0; i < 桁数; ++i) {
 
        N[i] = (int)(str[i] - '0');  //str[i]　はchar型なのでchar→intへ変換
 
        //cout << N[i] << endl;  //確認のため表示
    }
*/
 


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


int main() {

    int A, B;
    cin >>A >> B;

    cout << A * B << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rem(i, m, n) for (int i = m; i < (n); i++)
#define eps (1e-7)
#define inf (1e9)
#define pi (acos(-1))
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

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

    rep(i, 1001)
    {
        if (floor(i * 0.08) == a && floor(i * 0.1) == b)
        {
            cout << i << "\n";
            return 0;
        }
    }

    cout << -1 << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <ctime>

#define inf 0x3f3f3f3f
#define Inf 0x3FFFFFFFFFFFFFFFLL
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, n) for (int i = 1; i <= (n); ++i)
#define clr(x, a) memset(x, (a), sizeof x)
using namespace std;
typedef long long ll;

int main() {
  string s; cin >> s;
  if (s.length() == 6 && s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 256
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x) - 1 * 100);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>

using namespace std;

int n;
int main(void) {
	int a, b, c, d, mn = 101;
	int e, f;
	cin >> a >> b >> c >> d >> e >> f;
	int tot = a, sug = 0;
	rep(m, 3001) {
		rep(n, 3001) {
			rep(l, 2) {
				rep(o, 2) {
					if (l + o == 0)continue;
					if (m + d == 0)continue;
					int totwat = a*l + b*o;
					int totsug = m*c + d*n;
					if (totsug > e*totwat)continue;
					if (totwat * 100 + totsug > f)continue;
					if (sug*(totwat * 100 + totsug) <= totsug*tot) {
						tot = totwat * 100 + totsug;
						sug = totsug;
					}
				}
			}
		}
	}
	cout << tot << " " << sug << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  int sum = 0;
  rep(i, N) {
    cin >> A[i];
    sum += A[i];
  }

  sum = sum / (4 * M) - (sum % (4 * M) == 0);

  int cnt = 0;
  rep(i, N) {
    if (A[i] > sum)
      cnt++;
  }

  if (cnt >= M)
    cout << "Yes\n";
  else
    cout << "No\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define for_(i, s, e) for (int i = s; i < e; i++)
#define for__(i, s, e) for (ull i = s; i < e; i++)
#define SSTR(x) static_cast<std::ostringstream&>((std::ostringstream() << std::dec << x)).str()
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define endl "\n"


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

    int n; cin >> n;
    if (n % 1000 == 0) cout << 0 << endl;
    else cout << (1000 - (n % 1000));

    return 0;
}

Measured memory_bytes: 3656
import java.util.*;
import java.util.Map.Entry;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        HashMap<Integer, Integer> m = new HashMap<>();
        for(int i = 0; i < n; i++)
        {
            int a = sc.nextInt();
            m.put(a, m.containsKey(a) ? m.get(a) + 1 : 1);
        }
        
        int s = 0;
        
        for(Entry<Integer, Integer> e : m.entrySet())
        {
        	int k = e.getKey();
        	int v = e.getValue();
        	if(k <= v)
        	{
        		s += v - k;
        	}
        	else
        	{
        		s += v;
        	}
        }
        
        System.out.println(s);
  	}
}

Measured memory_bytes: 63172
using System;

namespace _0106
{
	class Program
	{
		static void Main(string[] args)
		{
			while (true)
			{
				int n = int.Parse(Console.ReadLine());
				if (n == 0) break;
				int[,] price = new int[,] { { 380, 1520, 200 }, { 550, 1870, 300 }, { 850, 2244, 500 }, };
				int ret = int.MaxValue;
				for (int i = 0; i <= n / price[0, 2]; i++)
				{
					for (int j = 0; j <= n / price[1, 2]; j++)
					{
						for (int k = 0; k <= n / price[2, 2]; k++)
						{
							if (price[0, 2] * i + price[1, 2] * j + price[2, 2] * k == n)
							{
								int now =
									price[0, 0] * (i % 5) + price[0, 1] * (i / 5) +
									price[1, 0] * (j % 4) + price[1, 1] * (j / 4) +
									price[2, 0] * (k % 3) + price[2, 1] * (k / 3) ;
								ret = Math.Min(ret, now);
							}
						}
					}
				}
				Console.WriteLine(ret);
			}
		}
	}
}


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

int main() {
	int n; cin >> n;
	map<string, int> dic;
	string s;
	for (int i = 0; i < n; i++) {
		cin >> s;
		if (s[0] == 'i') {
			cin >> s;
			dic[s] = 1;
		}else{
			cin >> s;
			if (dic.count(s)) cout << "yes" << endl;
			else cout << "no" << endl;
		}
	}
}


Measured memory_bytes: 36880
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x=0;
    cin>>n;
    char s[n];int b[n];
    for(int i=0;i<n;i++)
    cin>>s[i];
    for(int i=0;i<n;i++)
    {if(s[i]=='I')
    {++x;b[i]=x;}
    if(s[i]=='D')
    {--x;b[i]=x;}
    }
    sort(b,b+ n);
    if(b[n-1]<=0)
    cout<<"0";
    else cout<<b[n-1];
}

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

using namespace std;

int d;
int t;
int s;
int main()
{
	cin >> d >> t >> s;
	if((long long)t * s >= (long long) d)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 3616
use proconio::input;

#[proconio::fastout]
fn main() {
    input! {
        x: f64,
    }
    let mut num = 100.0;
    let mut n = 0;
    while num < x {
        n += 1;
        num = (num * 1.01).floor();
    }
    println!("{}", n);
}


Measured memory_bytes: 2624
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
#include <ctime>
#include <cassert>
#include <queue>
#include <deque>
#include <stack>
#include <memory.h>
#include <bitset>
#include <cstring>
#include <assert.h>
#include <random>

using namespace std;

#pragma comment(linker, "/STACK:64000000")

#define ll long long
#define mp make_pair

const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const ll maxn = 501;
const ll inf = 1000000007;
const ll mod = 1000000007;

ll a, b, c, x, y, z;

int main() {
	
	cin >> a >> b >> c;
	x = (a - 2 * (a / 2)) * b * c;
	y = (b - 2 * (b / 2)) * a * c;
	z = (c - 2 * (c / 2)) * a * b;
	cout << min(x, min(y, z));
	return 0;
}

Measured memory_bytes: 256
/*This Code Is Nude*/
#include <bits/stdc++.h>
 
#define pb push_back
#define ll long long
#define int long long
#define max(a,b) max((long long) a , (long long) b)
#define min(a,b) min((long long) a , (long long) b)

using namespace std;

const int inf = 1e12 + 10; 
const int maxn = 2e5 + 10;
const int mod = 1e9 + 7;
 
bool mark [maxn];
vector<int>adj[maxn];

int32_t main(){
	ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int r;
	cin >> r;
	double p = 3.14;
	cout << r * 2 * p << endl;
	return 0;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MN = 200010;
const ll INF = 1e18;

int N;
ll X;
int x[MN];
ll s[MN];

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

	rep(i, N) {
		cin >> x[i];
		s[i+1] = s[i] + x[i];
	}

	ll ret = LLONG_MAX;

	for (int num = 1; num <= N; ++num) {
		ll t = X * (num + N);
		int u = 0;
		bool sf = 1;

		for (int i = N; i >= 0; i -= num) {
			++u;

			if (u == 1) {
				t += (s[i] - s[i - num]) * 5;
			} else {
				ll ad = s[i] - s[max(0, i - num)];
				t += ad * (u * 2 + 1);
			}
			if (t > INF) {
				sf = 0;
				break;
			}
		}

		if (sf) {
			ret = min(ret, t);
		}
	}

	cout << ret << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;
const ll  N = 1e5+100;
ll siz[N],par[N],ans[N];
void init(ll n){
	for(ll i=1;i<=n;i++) par[i]=i,siz[i]=1;
}
ll find(ll x){
	return x==par[x]?x:find(par[x]);
}
ll sum;
void unite(ll x,ll y){
	x=find(x);y=find(y);
	if(x==y) return ;
	sum-=siz[x]*siz[y];
	if(siz[x]<siz[y]) swap(x,y);
	siz[x]+=siz[y];
	par[y]=x;
}
ll u[N],v[N];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,m;
	cin>>n>>m;
	init(n);
	for(ll i=1;i<=m;i++) cin>>u[i]>>v[i];
	sum=n*(n-1)/2;
	for(ll i=m;i>=1;i--){
		ans[i]=sum;
		unite(u[i],v[i]);	
	}
	for(ll i=1;i<=m;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

// Vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  s << "[";
	for (int i = 0; i < len; i++) {
    if (i > 0) s << ", ";
		s << v[i];
  }
  s << "]";
  return s;
}

struct Edge {
  const int from, to;
  Edge(int from, int to) : from(from), to(to) {}
};

vector<vector<Edge>> ReadUndirectedGraph(
    int n, int m, bool is_one_indexed=false) {
  vector<vector<Edge>> graph(n);
  for (int i = 0; i < m; i++) {
    int v1, v2;
    cin >> v1 >> v2;
    if (is_one_indexed) {
      v1--;
      v2--;
    }
    graph[v1].push_back(Edge(v1, v2));
    graph[v2].push_back(Edge(v2, v1));
  }
  return graph;
}

tuple<vector<int>, vector<int>>
BFS(const vector<vector<Edge>>& graph, int s) {
  int n = graph.size();

  deque<int> queue;
  queue.push_back(s);
  vector<int> ds(n, INT_MAX);
  vector<int> ps(n, -1);
  ds[s] = 0;
  while (!queue.empty()) {
    int v = queue.front();
    queue.pop_front();
    for (const auto& e : graph[v]) {
      if (ds[e.to] < INT_MAX) continue;
      ds[e.to] = ds[v] + 1;
      ps[e.to] = v;
      queue.push_back(e.to);
    }
  }
  return make_tuple(ds, ps);
}

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

  int n;
  cin >> n;
  auto graph = ReadUndirectedGraph(n, n - 1, true);
  vector<int> ds, ps;
  tie(ds, ps) = BFS(graph, 0);

  vector<int> path;
  int v = n - 1;
  while (v != 0) {
    path.push_back(v);
    v = ps[v];
  }
  path.push_back(0);
  reverse(path.begin(), path.end());
  if (DEBUG) cout << "path: " << path << endl;
  int w = path[(path.size() + 1) / 2];
  if (DEBUG) cout << "w: " << w << endl;

  vector<int> visited(n, 0);
  function<void(int, int)> dfs_fn = [&](int v, int p) {
    visited[v] = 1;
    for (const auto& e : graph[v]) {
      if (e.to == p) continue;
      if (e.to == w) continue;
      if (visited[e.to]) continue;
      dfs_fn(e.to, v);
    }
  };
  dfs_fn(0, -1);

  int count = 0;
  for (int b : visited) {
    if (b) count++;
  }
  if (2 * count > n) {
    cout << "Fennec" << endl;
  } else {
    cout << "Snuke" << endl;
  }
}

Measured memory_bytes: 10608
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s123: chars
    }
    let mut n: i32 = 0;
    for c in s123 {
        if c == '1' {
            n += 1;
        }
    }
    println!("{}", n);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int N;
      string Color;
      cin >> N;
      for (int i=0; i<N; i++){
        cin >> Color;
        if (Color == "Y"){
          cout << "Four";
          break;
        }
        if (i == N-1) cout << "Three";
      }
    }

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

using namespace std;

const int N = 2e5 + 5, mod = 998244353;

vector<int> g[N];
int par[N], lv[N];
long long dp[N][3], tmp[3];

void add(long long & var, long long val) {
  var += val;
  if (var >= mod)
    var -= mod;
}

void dfs(int v, int p) {
  par[v] = p;
  for (int u : g[v]) {
    if (u == p) continue;
    lv[u] = lv[v] + 1;
    dfs(u, v);
  }
}

void solve(int v, int p, int depth) {
  memset(dp[v], 0, sizeof dp[v]);
  dp[v][(depth == 0)] = 1;
  --depth;
  for (int u : g[v]) {
    if (u == p) continue;
    solve(u, v, depth);
    memset(tmp, 0, sizeof tmp);
    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) {
        add(tmp[min(i+j, 2)], dp[v][i] * dp[u][j] % mod);
        add(tmp[i], 2LL * dp[v][i] * dp[u][j] % mod);
      }
    }
    for (int i = 0; i < 3; ++i)
      dp[v][i] = tmp[i];
  }
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  lv[0] = 0;
  dfs(0, 0);
  int root = 0;
  for (int i = 0; i < n; ++i) {
    if (lv[i] > lv[root])
      root = i;
  }
  lv[root] = 0;
  dfs(root, -1);
  int leaf = 0;
  for (int i = 0; i < n; ++i) {
    if (lv[i] > lv[leaf])
      leaf = i;
  }
  int diam = lv[leaf];
  long long ans = 0;
  if (diam & 1) {
    int a = leaf;
    for (int i = 0; i < diam/2; ++i) {
      a = par[a];
    }
    int b = par[a];
    solve(a, b, diam/2);
    solve(b, a, diam/2);
    ans = 1LL * dp[a][1] * dp[b][1] % mod;
  }
  else {
    int c = leaf;
    for (int i = 0; i < diam/2; ++i) {
      c = par[c];
    }
    long long best[3];
    memset(best, 0, sizeof best);
    best[0] = 1;
    for (int u : g[c]) {
      solve(u, c, diam/2-1);
      memset(tmp, 0, sizeof tmp);
      if (diam == 2)
        dp[u][0] = dp[u][1];
      else {
        dp[u][0] = (dp[u][0] - dp[u][1] - dp[u][2]) % mod;
        dp[u][0] = (3LL * dp[u][0] + 4LL * dp[u][1] + 4LL * dp[u][2]) % mod;
      }
      tmp[0] = (best[0] * dp[u][0]) % mod;
      tmp[1] = (best[0] * dp[u][1] + best[1] * dp[u][0]) % mod;
      tmp[2] = (best[1] * dp[u][1] + best[2] * dp[u][0]) % mod;
      for (int i = 0; i < 3; ++i)
        best[i] = tmp[i];
    }
    ans = best[2];
  }
  ans %= mod;
  if (ans < 0)
    ans += mod;
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define ii pair<int, int>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define ld long double
#define iii tuple<int, int, int>
#define sc scanf
#define pb push_back
#define FOR(x, n) for(int i=x; i<=n; ++i)

int main() {

    int d, t, s;
    sc("%d %d %d", &d, &t, &s);

    int x = s * t;

    if(x >= d) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
}



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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string S;
    cin >> N;
    cin >> S;
    int wc = 0, bc = 0, counter = 0;
    for(int i = 0; i < N; i++)
    {
      if(S[i] == '.')
      {
        wc++;
      }
    }
    
  	counter = wc;
    for(int i = 0; i < N; i++)
    {
      if (S[i] == '.') {
            wc--;
        } else {
            bc++;
        }
        counter = min(counter, bc + wc);
    }
  
  	cout << counter << endl;
    return 0;
}


Measured memory_bytes: 720
#include <stdio.h>

int main(void){
  int H, W, i, j;
   while(1){
       scanf("%d %d", &H, &W);
       
       if(H==0 && W==0){
           break;
       }
     
      //Hが偶数
      if(H%2 == 0){
          if(W%2){
              //Wが奇数
              for(j=0; j<H/2; j++){
                  for(i=0; i<W/2; i++){
                      printf("#.");
                  }
                  printf("#\n");
                 
                  for(i=0; i<W/2; i++){
                      printf(".#");
                  }
                  printf(".\n");
              }
            
           }else{
              //Wが偶数
              for(j=0; j<H/2; j++){
                  for(i=0; i<W/2; i++){
                      printf("#.");
                  }
                  printf("\n");
                 
                  for(i=0; i<W/2; i++){
                      printf(".#");
                  }
                  printf("\n");
              }
              //ここまで
           }
       }else{
           //Hが奇数
           if(W%2){
              //Wが奇数
              for(j=0; j<H/2; j++){
                  for(i=0; i<W/2; i++){
                      printf("#.");
                  }
                  printf("#\n");
                 
                  for(i=0; i<W/2; i++){
                      printf(".#");
                  }
                  printf(".\n");
              }
             
              for(i=0; i<W/2; i++){
                  printf("#.");
              }
              printf("#\n");
              //ここまで        
           }else{
              //Wが偶数
              for(j=0; j<H/2; j++){
                  for(i=0; i<W/2; i++){
                      printf("#.");
                  }
                  printf("\n");
                 
                  for(i=0; i<W/2; i++){
                      printf(".#");
                  }
                  printf("\n");
               }
              for(i=0; i<W/2; i++){
                      printf("#.");
                  }
                  printf("\n");
              //ここまで
           }
       }
       
       printf("\n");
   }
      return 0;
     
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

const int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int a, p;
    cin >> a >> p;
    cout << (3 * a + p) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>
    #include<cstdint>

    #define INF 1e7
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<int,int>;

    int main(){
        int a,b;cin>>a>>b;
        int c = a+b;
        if(c%2==0)cout<<c/2;
        else cout<<"IMPOSSIBLE";
    }
    


Measured memory_bytes: 384
#include<iostream>
#include<map>
#include<queue>
#define mp(a,b) make_pair(a,b)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  int n,m;
  cin >> n >> m;
  int t[100005]={};
  priority_queue<P,vector<P> > q;
  int i,j,k;
  for(i=0;i<n;i++){
    cin >> k;
    q.push(mp(k,i));
  }
  int o=0,time;
  while(!q.empty()){
    P f=q.top();q.pop();
    if(f.second==0){
      time=t[1];
    }else if(f.second==n-1){
      time=t[n-2];
    }else{
      time=max(t[f.second-1],t[f.second+1]);
    }
    t[f.second]=time+m-f.first;
    o=max(o,t[f.second]);
  }
  cout << o << endl;
  return 0;
}

Measured memory_bytes: 2444
import itertools

n = int(input())
p = tuple(int(s) for s in input().split())
q = tuple(int(s) for s in input().split())
seq = []

for i in range(n):
    seq.append(i+1)

b = list(itertools.permutations(seq))

print(abs(b.index(p) - b.index(q)))


Measured memory_bytes: 8052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define MAX_P 200005
ll fact[MAX_P];
ll extgcd(ll a,ll b,ll& x,ll& y){
  ll d=a;
  if(b!=0){
    d=extgcd(b,a%b,y,x);
    y-=(a/b)*x;
  }else{
    x=1;y=0;
  }
  return d;
}
ll mod_inverse(ll a,ll m){
  ll x,y;
  extgcd(a,m,x,y);
  return (m+x%m)%m;
}
ll mod_fact(ll n,ll p,ll& e){
  e=0;
  if(n==0) return 1;
  ll res=mod_fact(n/p,p,e);
  e+=n/p;
  if(n/p%2!=0)return res*(p-fact[n%p]) %p;
  return res*fact[n%p]%p;
} 
ll mod_comb(ll n,ll k,ll p){
  if(n==k||k==0) return 1;
  ll e1,e2,e3;
  ll a1=mod_fact(n,p,e1),a2=mod_fact(k,p,e2),a3=mod_fact(n-k,p,e3);
  if(e1>e2+e3) return 0;
  return a1*mod_inverse(a2*a3%p,p)%p;
}

int main(){
  ll h,w,a,b;
  cin >> h >> w >> a >> b;
  h--;w--;
  fact[0]=1;
  for(ll i=1;i<MAX_P;i++) fact[i]=(fact[i-1]*i)%MOD;
  //cout << fact[88888] << endl;
  ll ans=0;
  ll x=b,y=h-a;
  while(x<=w&&y>=0){
    //cout << y << "/" << x << ":";
    //cout << w-x+h-y << "/" << w-x <<":";
    //cout << mod_comb(x+y,x,MOD)<<"/"<<mod_comb(w-x+h-y,w-x,MOD) << endl;
    ans+=mod_comb(x+y,x,MOD)*mod_comb(w-x+h-y,w-x,MOD);
    ans%=MOD;
    //if(ans) cout << ans << endl;
    x++;y--;
  }
  cout << ans % MOD << endl;
  return 0;
}


Measured memory_bytes: 1792
p = 1000000007

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

fac = [0] * (N + 1)
fac[0] = 1
for i in range(N):
    fac[i + 1] = fac[i] * (i + 1) % p


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], p - 2, p) * pow(fac[k], p - 2, p) % p


A.sort(reverse=True)
result = 0
for i in range(N - K + 1):
    result += A[i] * mcomb(N - (i + 1), K - 1)
    result %= p

A.reverse()
for i in range(N - K + 1):
    result -= A[i] * mcomb(N - (i + 1), K - 1)
    result %= p

# result += p
# result %= p
print(result)


Measured memory_bytes: 14416
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<vector>
#include<queue>
#define ll long long
ll read()
{
	ll tmp=0;char c=getchar(),f=1;
	while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
	while('0'<=c&&c<='9'){tmp=tmp*10+c-48;c=getchar();}
	return tmp*f;
}
using namespace std;
ll x[110];
ll n,k;
int main()
{
	int i;
	n=read(); k=read();
	for(i=1;i<=n;i++)x[i]=read();
	ll ans=0;
	for(i=1;i<=n;i++)
		ans+=min(x[i],abs(k-x[i]))*2;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
n = int(input())
cnt = 0
is_true = False
for i in range(n):
    a, b = map(int, input().split())
    if a == b:
        cnt += 1
    else:
        cnt = 0
    if cnt >= 3:
        is_true = True
        break
if is_true:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 62336
N, K = map(int, input().split())
D = set(map(int, input().split()))
i = N
while True:
    j = i
    flag = True
    while j > 0:
        r = j % 10
        if r in D:
            flag = False
            break
        j //= 10
    if flag:
        print(i)
        break
    i += 1


Measured memory_bytes: 3064
#include <cctype>
#include <iostream>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (a >= 13) {
        cout << b;
    }
    else if (a >= 6) {
        cout << b / 2;
    }
    else {
        cout << 0;
    }
    return 0;
}


Measured memory_bytes: 3596