akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define pq priority_queue
#define rep(i,n) for (int i=1;i<=n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
ll n,m,r,ans;
ll dis[205][205];
const ll INF=1e13;
int rs[10];
int main()
{
    ios::sync_with_stdio(false);
    ans=INF;
    rep(i,201) rep(j,201) dis[i][j]=INF;
    rep(i,201) dis[i][i]=0;
    cin>>n>>m>>r;
    rep(i,r) cin>>rs[i];
    rep(i,m){
    	int a,b,c;
    	cin>>a>>b>>c;
    	dis[a][b]=c;
    	dis[b][a]=c;
    }
    for (int k=1;k<=n;k++){
    	for (int i=1;i<=n;i++){
    		for (int j=1;j<=n;j++){
    			//if (i==j) continue;
    			dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
    			dis[j][i]=min(dis[j][i],dis[i][j]);
    		}
    	}
    }
    sort(rs+1,rs+r+1); 
    do{
    	ll tmp=0;
    	for (int i=1;i<r;i++) tmp+=dis[rs[i]][rs[i+1]];
    	ans=min(ans,tmp);
    }while (next_permutation(rs+1,rs+r+1));
    cout<<ans;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int a = 0;
    int b = 0;
    for(int i = 0; i < s.length(); i++) {
      if(s.charAt(i) == 'A') {
        a++;
      } else {
        b++;
      }
    }
    String ans = "No";
    if((a > 0) && (b > 0)) ans = "Yes";
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
#include <iostream>
#include <map>
#include <algorithm>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;

int main(void){
  int N, K; cin >> N >> K;
  int a, b, c; cin >> a >> b >> c;
  char T[N]; cin >> T;
  //ここまで入力

  //出した手と得点を対応させる写像
  map<char, int> point;
  point.insert(make_pair('r', a) );
  point.insert(make_pair('s', b) );
  point.insert(make_pair('p', c) );

  //出した手に勝つような出し方を返す写像
  map<char, char> win;
  win.insert(make_pair('r', 'p'));
  win.insert(make_pair('s', 'r'));
  win.insert(make_pair('p', 's'));

  //最大得点
  int sum = 0;

  //初めのK-1回は全て勝つとしてよい
  //T[i]に勝つ出し方の得点
  rep(i, K)
    sum += point[win[T[i] ] ];

  //K回目から数えて，K回前と同じ出し方でなければ勝ってもよい
  for(int i=K; i<N; i++){
    if((T[i-K] != T[i]) || (T[i-K]=='o'))
      sum += point[win[T[i] ] ];
    //K回前と同じ出し方をしたいとき
    //出せないが，K回後は出してもよいので印をつける
    else
      T[i] = 'o';
  }

  cout << sum << endl;
  
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+18;

Int nodesize[100005];
Int node[100005];

Int root(Int x) {
    if (node[x] == x) return x;
    return node[x] = root(node[x]);
}

void unite(Int x, Int y) {
    Int rx = root(x); //xの根をrx
    Int ry = root(y); //yの根をry
    if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
    node[rx] = ry; 
}

bool same(Int x, Int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    Int rx = root(x);
    Int ry = root(y);
    return rx == ry;
}

int main() {
    ios::sync_with_stdio(false);
    Int n, m;
    cin >> n >> m;
    vector<Int> a(m), b(m);
    for (Int i = 0; i < m; i++) cin >> a[m - 1 - i] >> b[m - 1 - i];
    for (Int i = 1; i <= n; i++) {
        nodesize[i] = 1;
        node[i] = i;
    }
    vector<Int> res;
    for (Int i = 0; i < m; i++) {
        if (root(a[i]) == root(b[i])) {
            res.emplace_back(0);
        }
        else if (a[i] == node[a[i]] && nodesize[a[i]] == 1 && b[i] == node[b[i]] && nodesize[b[i]] == 1) {
            res.emplace_back(1);
            unite(a[i], b[i]);
            nodesize[root(a[i])]++;
        }
        else if (a[i] == node[a[i]] && nodesize[a[i]] == 1) {
            res.emplace_back(nodesize[root(b[i])]);
            unite(a[i], b[i]);
            nodesize[root(a[i])]++;
        }
        else if (b[i] == node[b[i]] && nodesize[b[i]] == 1) {
            res.emplace_back(nodesize[root(a[i])]);
            unite(b[i], a[i]);
            nodesize[root(a[i])]++;
        }
        else {
            res.emplace_back(nodesize[root(a[i])] * nodesize[root(b[i])]);
            nodesize[root(b[i])] += nodesize[root(a[i])];
            unite(a[i], b[i]);
        }
    }
    //for (Int i = 0; i < (Int)res.size(); i++) dump(res[i]);
    for (Int i = (Int)res.size() - 1; i > 0; i--) res[i - 1] += res[i];
    for (Int i = (Int)res.size() - 1; i >= 0; i--) dump(res[i]);
    
    return 0;
}

Measured memory_bytes: 5364
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

void solve() {
    ll n; cin >> n;
    ll m = n % 10;
    string ans = "pon";
    if(m==2 || m == 4 || m == 5 || m == 7 || m == 9){
        ans = "hon";
    }
    else if (m==3){
        ans = "bon";
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 3632
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1001001001
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
int main() {
    int l,r,d;cin>>l>>r>>d;
    int cnt=0;
    REP(i,105){
        int reg=d*i;
        if(reg >= l && r >= reg) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3580
import java.util.*;

public class Main {
    

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
       
        int N = sc.nextInt();int c=0,i=0;boolean flag=false;
        for(int x=1;x<=N;++x){
            int a=sc.nextInt();
            int b=sc.nextInt();//String s1="",s2="";
            
            if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            }
            if(c==3){
                flag=true;
                break;
            }
        }
            if(flag){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        
    
    }
}

Measured memory_bytes: 36052
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

int MOD_BIG = 1000000007;
int MOD_BIG2 = 998244353;
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

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

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

int main() {
    
    int N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> B(N);
    REP(i, N) {
        cin >> A[i] >> B[i];
    }
    if (N%2 == 1) {
        std::sort(A.begin(), A.end());
        std::sort(B.begin(), B.end());
        cout << B[N/2] - A[N/2] + 1 << endl;
        return 0;
    } else {
        std::sort(A.begin(), A.end());
        std::sort(B.begin(), B.end());
        cout << B[N/2-1]+B[N/2] - (A[N/2-1]+A[N/2]) + 1 << endl;
        return 0;
    }
    
    return 0;
}


Measured memory_bytes: 6376
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>
#include <tuple>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
    ll m, d[200020], c[200020];
    cin >> m;
    for (int i = 0; i < m; i++) cin >> d[i] >> c[i];

    ll ans = 0, bef = -1;
    vector<int> sp;
    for (int i = 0; i < m; i++) {
        while (c[i] != 0) {
            if (c[i] % 2) sp.push_back(d[i]);
            if (d[i] >= 5) ans += (c[i] / 2) * 2;
            else ans += (c[i] / 2) * 2 / 2;
            d[i] = (d[i] * 2) % 10 + (d[i] >= 5);
            c[i] /= 2;
        }
    }
  	//cout << ans << endl;
    bef = 0;
    for (int i = 0; i < sp.size(); i++) {
        bef += sp[i];
        if (i != 0) ans++;
        if (bef >= 10) {
            bef = bef % 10 + 1;
            ans++;
        }
    }
    cout << ans << endl;

}


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

int main() {

int H,W,x,y;

do{

cin >> H >> W;

if(H==0 && W==0){break;}

for(x=1;x<=H;++x){
if(x%2==1){
for(y=1;y<=W;++y){
if(y%2==1){cout << "#";}
else{cout << ".";}
}
}

else{
for(y=1;y<=W;++y){
if(y%2==0){cout << "#";}
else{cout << ".";}
}
}
cout << endl;
}
cout << endl;
}while(H>0 && W>0);

}


Measured memory_bytes: 3088
class Tree:
    def __init__(self):
        self.root = None

    def insert(self, key):
        z = Node(key)
        y = None  # x?????????????´????????????°
        # z???parent???????´?
        x = self.root
        while x:
            y = x
            if z.key < x.key:
                x = x.left
            else:
                x = x.right
        z.parent = y
        # z??????????????´??????????´?
        if y is None:
            self.root = z
        elif z.key < y.key:
            y.left = z
        else:
            y.right = z

    def show(self):
        print(" ", end="")
        print(*list(map(str, self.root.inwalk())))
        print(" ", end="")
        print(*list(map(str, self.root.prewalk())))


class Node:
    def __init__(self, key):
        self.key = key
        self.parent = self.left = self.right = None

    def prewalk(self):
        nodeList = [self.key]
        if self.left:
            nodeList += self.left.prewalk()
        if self.right:
            nodeList += self.right.prewalk()
        return nodeList

    def inwalk(self):
        nodeList = []
        if self.left:
            nodeList += self.left.inwalk()
        nodeList += [self.key]
        if self.right:
            nodeList += self.right.inwalk()
        return nodeList


tree = Tree()
P = []
I = []
n = int(input())
for i in range(n):
    cmd = list(input().split())
    if cmd[0] == 'insert':
        tree.insert(int(cmd[1]))
    else:
        tree.show()

Measured memory_bytes: 196872
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		double[] d = new double[6];
		double ans_x;
		double ans_y;
		double tmp_a1;
		double tmp_b1;
		double tmp_c1;
		double tmp_a2;
		double tmp_b2;
		double tmp_c2;
		double tmp_r;
		double ans_r;
		
		Scanner scanner = new Scanner(System.in);
		int dset = scanner.nextInt();
		for( int i=0; i<dset; i++){
			for(int j=0; j<6; j++){
				d[j] = scanner.nextDouble();
			}
			tmp_a1 = 2 * (d[2] - d[0]);
			tmp_b1 = 2 * (d[3] - d[1]);
			tmp_c1 = Math.pow(d[0], 2) - Math.pow(d[2], 2) + Math.pow(d[1], 2) - Math.pow(d[3], 2);
			tmp_a2 = 2 * (d[4] - d[0]);
			tmp_b2 = 2 * (d[5] - d[1]);
			tmp_c2 = Math.pow(d[0], 2) - Math.pow(d[4], 2) + Math.pow(d[1], 2) - Math.pow(d[5], 2);
			
			ans_x = ( (tmp_b1 * tmp_c2) - (tmp_b2 * tmp_c1) ) / ( (tmp_a1 * tmp_b2) - (tmp_a2 * tmp_b1) );
			ans_y = ( (tmp_c1 * tmp_a2) - (tmp_c2 * tmp_a1) ) / ( (tmp_a1 * tmp_b2) - (tmp_a2 * tmp_b1) );
			ans_r = Math.sqrt( Math.pow((ans_x - d[0]), 2) + Math.pow((ans_y - d[1]), 2));

			ans_r = new BigDecimal(ans_r).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
			ans_x = new BigDecimal(ans_x).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
			ans_y = new BigDecimal(ans_y).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
			
			
			System.out.printf("%.3f %.3f %.3f\n", ans_x, ans_y, ans_r);
			
		}
	}
}

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

int main(){
  string S,T;
  cin >> S >> T;
  int ans=100000;
  for(int i=0;i<(int)S.size()-(int)T.size()+1;i++){
    int count=0;
    for(int j=0;j<(int)T.size();j++){
      if(S[i+j]!=T[j]){
        count++;
      }
    }
    ans=min(ans,count);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3536
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n, m;
int par[100000];   //親
int rank1[100000]; //木の深さ
void init(int n)
{
    for (int i = 0; i < n; i++)
    {
        par[i] = i;
        rank1[i] = 0;
    }
}
//木の根を求める
int find(int x)
{
    if (par[x] == x)
    {
        return x;
    }
    else
    {
        return par[x] = find(par[x]);
    }
}
//併合
void unite(int x, int y)
{
    x = find(x);
    y = find(y);
    if (x == y)
        return;
    if (rank1[x] < rank1[y])
    {
        par[x] = y;
    }
    else
    {
        par[y] = x;
        if (rank1[x] == rank1[y])
            rank1[x]++;
    }
}
bool same(int x, int y)
{
    return find(x) == find(y);
}
int size(int x)
{
    return -par[find(x)];
}
vector<int> per(100000);
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        cin >> per[i];
        per[i]--;
    }
    init(n);
    for (int i = 0; i < m; i++)
    {
        int temp1, temp;
        cin >> temp >> temp1;
        unite(temp - 1, temp1 - 1);
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (same(par[per[i]], par[i]))
        {
            ans++;
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 1408
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    d,g = map(int,input().split())
    pc = [list(map(int,input().split())) for i in range(d)]
    p = [pc[i][0] for i in range(d)]
    c = [pc[i][1] for i in range(d)]
    ans = 10 ** 9
    def dfs(i,pro):
        if i == 0:
            return 10**9
        cnt = min(pro//(i*100),p[i-1])
        tmp = 100*i*cnt
        if cnt == p[i-1]:
            tmp += c[i-1]
        if tmp < pro:
            cnt += dfs(i-1,pro-tmp)
        return min(cnt,dfs(i-1,pro))
    print(dfs(d,g))
if __name__ == "__main__":
    main() #endline===============================================

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

int main() 
{
    int k;
    cin >> k;
    int x = k/2;
    if (k%2!=0)
        x *= (k/2+1);
    else 
        x *= k/2;
    cout << x;
    return 0;
}

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

     
    public class Program
    {

        public void Proc() {
            int pointCount = int.Parse(Reader.ReadLine());

            int posX = 0;
            int posY = 0;
            int tm = 0;
            for(int i=0; i<pointCount;i++) {
                int[] inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray();
                int diff = inpt[0]-tm;
                int mnh = Math.Abs(posX-inpt[1])+Math.Abs(posY-inpt[2]);
                if(diff<mnh) {
                    Console.WriteLine("No");
                    return;
                }
                if((diff-mnh)%2!=0) {
                    Console.WriteLine("No");
                    return;
                }
                posX = inpt[1];
                posY = inpt[2];
                tm = inpt[0];
            }
            Console.WriteLine("Yes");

        }



        public class Reader {
            public static bool IsDebug = false;
            private static System.IO.StringReader SReader;
            private static string InitText = @"



2
3 1 2
6 1 1





";
            public static string ReadLine() {
                if(IsDebug) {
                    if(SReader == null) {
                        SReader = new System.IO.StringReader(InitText.Trim());
                    }
                    return SReader.ReadLine();
                } else {
                    return Console.ReadLine();
                }
            }
        }
        public static void Main(string[] args)
        {
            #if DEBUG
            Reader.IsDebug = true;
            #endif
            Program prg = new Program();
            prg.Proc();
        }
    }

Measured memory_bytes: 15404
/*ex9_2 hightierra*/
#include <stdio.h>
#include <stdlib.h>
#define LIMIT 100000

//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char cube;
    struct node *next;
}node;

//スタックのpush
void push(node **first, char cube){
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->cube = cube;
    new->next = *first;
    *first = new;
}

//スタックのpop
char pop(node **first){
    char cube;
    node *tmp = *first;
    if(tmp == NULL){
        exit(1);
    }
    cube = tmp->cube;
    *first = tmp->next;
    //取り出したノードのメモリを解放
    free(tmp);
    return cube;
}

int main(void){
    int count=0,i;
    char cubic[LIMIT];
    //スタックの一番上
    node *first = NULL;
  	node *tmp = NULL;

    //キューブの積み方
    scanf("%s",cubic);

    //キューブを最後まで積むまでループ
    i=0;
    while(cubic[i] != '\0'){ 
        //積み方通りにキューブを積む       
        push(&first,cubic[i]);
        //もしも、前のキューブと今のキューブの色が異なったら両方を取り除く
        if(first->next != NULL && (first->cube != first->next->cube)){
            pop(&first);
            pop(&first);
            count += 2;
        }
        i++;
    }
    while(first!=NULL){
    	tmp = first;
      	first = first->next;
      	free(tmp);
    }
    printf("%d\n",count);
    
    return 0;
}


Measured memory_bytes: 4872
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long int N,T,c[2000],t[2000],res=INF;





int main()
{
    cout << fixed << setprecision(18);
    cin>>N;
    res=(N/11)*2;
    N%=11;
    if(N==0){}
    else if(N<=6){res++;}
    else{res+=2;}

    cout<<res<<endl;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>a(n); for(auto&&i:a)cin>>i;
	vector<int64_t>sum(n+2); sum.front()=0;
	sum.at(2)=a.at(0),sum.at(3)=a.at(1);
	for(int i=4;i<n+2;++i){
		sum.at(i)=sum.at(i-2)+a.at(i-2);
	}
	cout<<sum.at(n+1)-sum.at(0)-sum.at(n)+sum.at(1)+sum.at(1)-sum.at(0);
	for(int i=3;i<n+2;++i){
		if(i&1)cout<<" "s<<sum.at(n)-sum.at(i-2)-sum.at(n+1)+sum.at(i-1)+sum.at(i-1)-sum.at(i-2);
		else cout<<" "s<<sum.at(n+1)-sum.at(i-2)-sum.at(n)+sum.at(i-1)+sum.at(i-1)-sum.at(i-2);
	}
	cout<<"\n"s;
}


Measured memory_bytes: 4484
nums = list(map(int, input().split()))
n = nums[0]
k = nums[1]
l = [True] * n
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        if l[a[j] - 1]:
            l[a[j] - 1] = False
print(l.count(True))

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

int main(){
 int N;
 cin>>N;
 vector<vector<int>>G(N);
 vector<pair<int,int>>vp;
 for(int i=1;i<N;i++){
     int a,b;
     cin>>a>>b;
     a--,b--;
     G[a].emplace_back(b);
     G[b].emplace_back(a);
     vp.emplace_back(a,b);
 }

int K=0;
map<pair<int,int>,int>I;
vector<int>cs(N,0);//color of edge between its parent

vector<int>used(N,0);
queue<int>que;
used[0]=1;
que.emplace(0);
while(!que.empty()){
    int v=que.front();
    que.pop();
    if(K<(int)G[v].size())K=G[v].size();
    int cur=1;
    for(int u:G[v]){
        if(used[u])continue;
        if(cur==cs[v])cur++;
        cs[u]=I[make_pair(u,v)]=I[make_pair(v,u)]=cur++;
        used[u]=1;
        que.emplace(u);
    }
}

cout<<K<<endl;
for(auto p:vp)cout<<I[p]<<endl;

return 0;
}


Measured memory_bytes: 20084
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll INF = 1LL << 62;
const int inf = 1 << 30;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    char c; cin >> c;
    set<int> s = {'a', 'e', 'i', 'o', 'u'};

    string res = "vowel";
    if(s.find(c) == end(s)){
        res = "consonant";
    }
    cout << res << endl;

    return 0;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MOD 1000000007
#define INF 110110110

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

int d, g;
vector<p> v;

vector<p> init(){
  vector<p> tmp(d);
  for (int i = 0; i < d; i++) {
    cin >> tmp[i].first >> tmp[i].second;
  }
  return tmp;
}

int res = INF;

void calc(vector<bool> use){
    int sum_point = 0;
    int sum = 0;
    for (int i = 0; i < d; i++) {
      if(use[i]) {
        sum_point += v[i].first * 100 * (i+1) + v[i].second;
        sum += v[i].first;
      }
    }
    if(sum_point < g){
      for (int i = d-1; i >= 0; i--) {
        if(!use[i]) {
          if(sum_point + v[i].first * 100 * (i+1) < g) break;
          else{
            sum += ceil(double(g - sum_point) / double((i+1) * 100));
            sum_point += ceil(double(g - sum_point) / double((i+1) * 100)) * 100 * (i+1);
          }
          break;
        }
      }
    }
    // cout << sum << endl;
    // cout << sum_point << endl;
    if(sum_point >= g) res = min(res, sum);
}

void dfs(int step, vector<bool> use){
  if(step == d){
    // print(use);
    calc(use);
    return;
  }
  dfs(step+1, use);
  use[step] = true;
  dfs(step+1, use);
}


int main(){
  cin >> d >> g;
  v = init();
  vector<bool> use(d, false);
  dfs(0, use);
  cout << res << endl;
}


Measured memory_bytes: 256
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(N, M, inputs):
    chains_list = list(map(string_to_int, inputs))
    chains = {i+1: set() for i in range(N)}
    for c in chains_list:
        chains[c[0]].add(c[1])
        chains[c[1]].add(c[0])

    if 1 not in chains:
        return "IMPOSSIBLE"
    hops = chains[1]

    for h in hops:
        if N in chains[h]:
            return "POSSIBLE"
    return "IMPOSSIBLE"


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    [N, M] = string_to_int(input())
    ret = solve(N, M, inputs(M))
    print(ret)


Measured memory_bytes: 141848
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <climits>

using namespace std;

int main() {
  double W, H, x, y;
  cin >> W >> H >> x >> y;
  cout << W*H/2 << " ";
  if (x == W/2 && y == H/2) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(const T a, const T b){return a>=0 ? a/b : (a+1)/b-1;}
template<class T> T div_ceil(const T a, const T b){return a>=0 ? (a-1)/b+1 : a/b;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

int main(){
    int n;
    scanf("%d", &n);
    string s;
    rep(i, n){
        char c;
        scanf(" %c", &c);
        s += c;
    }
    rep(i, 1000000)if(s.find(to_string(i)) == string::npos){
        printf("%d\n", i);
        return 0;
    }
}


Measured memory_bytes: 3344
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, L: "List[int]", R: "List[int]"):
    min = L[0]
    max = R[0]
    for i in range(M):
        if L[i] > min:
            min = L[i]
        if R[i] < max:
            max = R[i]
    ans = 0
    for i in range(1, N+1):
        if min <= i <= max:
            ans += 1
    print(ans)

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    L = [int()] * (M)  # type: "List[int]"
    R = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        L[i] = int(next(tokens))
        R[i] = int(next(tokens))
    solve(N, M, L, R)

if __name__ == '__main__':
    main()


Measured memory_bytes: 75672
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using NX = System.Int64;


public class Prog
{
    public struct Pair { public int x, y; public Pair(int a, int b) { x = a; y = b; } }
    public static void Solve()
    {
        int N = NextInt();
        int K = NextInt();
        String S = NextString();
        int happy = 0;
        int unhappy = 0;
        for (int i = 1; i < N; i++) {
            if (S[i - 1] == S[i]) happy++;
            else unhappy++;
        }
        Console.WriteLine(happy + Math.Min(K*2,unhappy));
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        return;
    }
}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


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

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

  int n,y; cin >> n >> y;

  int ans[3] = {y/1000,0,0};
  if(ans[0] == n){
    cout << ans[2] << " " << ans[1] << " " << ans[0] << endl;
    return 0;
  }

  while(ans[0] >= 0){
    while(ans[1] >= 2){
      ans[2] += 1;
      ans[1] -= 2;
      if(ans[2] + ans[1] + ans[0] == n){
        cout << ans[2] << " " << ans[1] << " " << ans[0] << endl;
        return 0;
      }
    }

    ans[1] += 1;
    ans[0] -= 5;
    if((ans[2]+ans[1]+ans[0]-n)%4 == 0){
      while(ans[2]+ans[1]+ans[0] != n){
        ans[1] += 1;
        ans[0] -= 5;
        if(ans[0] < 5) break;
      }
    }
    if(ans[2] + ans[1] + ans[0] == n){
      cout << ans[2] << " " << ans[1] << " " << ans[0] << endl;
      return 0;
    }
  }
  cout << "-1 -1 -1" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<int, int>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

int n, cc;

int main() {
    cin >> n >> cc;
    vector< vector<int> > imos(cc, vector<int>(200200, 0));
    for(int i = 0; i < n; ++i) {
        int sv, tv, cv; cin >> sv >> tv >> cv;
        cv--; sv *= 2; tv *= 2;
        if(sv != 0) sv--;
        imos.at(cv).at(sv)++;
        imos.at(cv).at(tv+1)--;
    }

    for(int i = 0; i < cc; ++i) {
        for(int j = 0; j < 200020; ++j) {
            imos.at(i).at(j+1) += imos.at(i).at(j);
        }
    }

    int ans = 1;
    for(int i = 0; i < 200020; ++i) {
        int sum = 0;
        for(int j = 0; j < cc; ++j) {
            if(imos.at(j).at(i) >= 1) sum++;
        }
        chmax(ans, sum);
    }

    cout << ans << endl;
}

Measured memory_bytes: 24576
let () = Scanf.scanf "%d\n" @@ fun n ->
  let ls = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun l -> l in
  let acc = Array.make 2002 0 in
  Array.iter (fun l -> acc.(l) <- 1 + acc.(l)) ls;
  for i = 0 to 2000 do
    acc.(i + 1) <- acc.(i) + acc.(i + 1)
  done;
  Printf.printf "%d\n" @@
  (fun s -> s / 6) @@
  Array.fold_left (Array.fold_left ( + )) 0 @@
  Array.init n @@ fun i ->
    Array.init n @@ fun j ->
      if i = j then 0 else
      (* |a - b| < c < a + b *)
      acc.(ls.(i) + ls.(j) - 1) - acc.(abs (ls.(i) - ls.(j)))
      - (if abs (ls.(i) - ls.(j)) < ls.(i) then 1 else 0)
      - (if abs (ls.(i) - ls.(j)) < ls.(j) then 1 else 0)

Measured memory_bytes: 32896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Atcoderrrrrr
    {
        static void Main(string[] args)
        {
            string N = Console.ReadLine();

            int n = 0;
            for(int i = 0; i < N.Length; i++)
            {
                n += int.Parse(N[i].ToString());
            }
            Console.WriteLine(
                int.Parse(N) % n == 0 ? "Yes":"No"
                );
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
using namespace std;
int main(){
  int a, b, c, d,abcd;
  cin >> abcd;
  d = abcd % 10;
  abcd /= 10;
  c = abcd % 10;
  abcd /= 10;
  b = abcd % 10;
  abcd /= 10;
  a = abcd;
  int count;
  for(int i = 0;i < 8;i++){
    count = a;
    if((i >> 2) & 1){
      count += b;
    }else{
      count -= b;
    }
    if((i >> 1) & 1){
      count += c;
    }else{
      count -= c;
    }
    if(i & 1){
      count += d;
    }else{
      count -= d;
    }
    if(count == 7){
      cout << a;
      if((i >> 2) & 1){
        cout << '+';
      }else{
        cout << '-';
      }
      cout << b;
      if((i >> 1) & 1){
        cout << '+';
      }else{
        cout << '-';
      }
      cout << c;
      if(i & 1){
        cout << '+';
      }else{
        cout << '-';
      }
      cout << d;
      cout << "=7" << endl;
      return 0;
    }
  }
}


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

bool is_easy_tap(char c, int n) {
	if (c == 'U' || c == 'D')
		return true;
	if (n%2 && c == 'R') {
		return true;
	} else if (!(n%2) && c == 'L') {
		return true;
	}
	return false;
}

int main() {
	string S;
	cin >> S;
	string r = "Yes";
	for (int i = 0; i < S.length(); i++) {
		if (!is_easy_tap(S[i], i+1)) {
			r = "No";
			break;
		}
	}
	cout << r << endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author jcg
 */

#include <iostream>

#include <iostream>
#include <vector>
#include <functional>
#include <numeric>

class DKi
{
public:
    void solve(std::istream& in, std::ostream& out)
    {
        int N, Q;
        in >> N >> Q;
        std::vector<std::vector<int>> g(N);
        for (int i = 1; i < N; ++i)
        {
            int a, b;
            in >> a >> b;
            --a, --b;
            g[a].emplace_back(b);
            g[b].emplace_back(a);
        }
        std::vector<int> ord, first(N), last(N);
        std::function<void(int, int)> dfs = [&](int u, int p)
        {
            first[u] = ord.size();
            ord.emplace_back(u);
            for (int v : g[u])
                if (v != p) dfs(v, u);
            last[u] = ord.size();
        };
        dfs(0, 0);
        std::vector<long long> data(N + 1);
        for (int i = 0; i < Q; ++i)
        {
            int p;
            long long x;
            in >> p >> x;
            --p;
            data[first[p]] += x;
            data[last[p]] -= x;
        }
        std::partial_sum(data.begin(), data.end(), data.begin());
        for (int i = 0; i < N; ++i)
            out << data[first[i]] << " \n"[i + 1 == N];
    }
};


int main()
{
    std::ios_base::sync_with_stdio(0);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    in.tie(0);
    DKi solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 29944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1234567890


int main(){
    ll i,j;
    ll n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    ll ans=0;
    for(i=0;i<n-1;i++){
        if(s[i]==s[i+1]) ans++;
    }
    cout<<min(ans+2*k,n-1)<<endl;
    
    return 0;
}

Measured memory_bytes: 512
N = int(input())
a = 0
b = 0
c = 0
d = 0

for _ in range(N):
  s = input()
  if s == "AC":
    a += 1
  elif s == "WA":
    b += 1
  elif s == "TLE":
    c += 1
  else:
    d += 1
print("AC","x",a)
print("WA","x",b)
print("TLE","x",c)
print("RE","x",d)

Measured memory_bytes: 9208
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
using namespace std;
#define FAST   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll          long long
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define mii         map<int,int>
#define vi          vector<int>
#define vll         vector<long long>
#define all(a)      (a).begin(),(a).end()
#define clz(a)      __builtin_clz(a) // count leading zeroes
#define ctz(a)      __builtin_ctz(a) // count trailing zeroes
#define popc(a)     __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define SIZE        1000005
#define F           first
#define S           second
#define debug(x)    cerr << #x << " = " << x << endl;
#define mod         998244353

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " = " << arg1<<" |";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define endl        '\n'
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

void solve()
{
  int n,k; cin>>n>>k;
  k--;
  string s; cin>>s;
  rep(i,0,n)
  {
    if(i==k) cout<<(char)(s[i]-'A'+'a');
    else cout<<s[i];
  }
} 
int main()
{   
    FAST;
    // #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    while(t--){
       solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  int n,k,s,c;
  double p = 0;
  cin >> n >> k;
  for(int i = 1; i <= n;i++)
  {
      c = 0;
      s = i;
      while(s < k)
      {
          s *= 2;
          c++;
      }
      p += 1.0/n * pow(0.5,c);
  }
  cout << setprecision(10) << p << endl;
  return 0;
}



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

using namespace std;

bool haveOkashi[102];
int H[100002];
vector<int> road[100002];

int main(){
    int N, M, h, s,g, cnt=0, curH;
    cin >> N >> M;
    for(int i=1; i<N+1; i++){
        cin >> h;
        H[i] = h;
    }
    for(int i=0; i<M; i++){
        cin >> s >> g;
        road[s].push_back(g);
        road[g].push_back(s);
    }

    for(int i=1; i<N+1; i++){
        curH = H[i];
        bool isOK = true;
        for(int j=0; j<road[i].size(); j++){
            if ( curH <= H[road[i][j]] ){
                isOK = false;
            }
        }
        if (isOK){
            cnt ++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 9156
# -*- coding: utf-8 -*-
import math

#入力
#S = str(input())
#A1, A2, A3 = map(int, input().split())
R = int(input())

if R < 1200 :
  print ("ABC")
elif R < 2800 :
  print ("ARC")
else :
  print ("AGC")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int dist[801][801];
string f[801];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
template<class T> bool uin(T &a,T b){return a>b?(a=b,true):false;}
template<class T> bool uax(T &a,T b){return a<b?(a=b,true):false;}
int nceil(int a,int b){
	return (a+b-1)/b;
}
int main(){
	int n,m,k;
	cin>>n>>m>>k;
	int sx=-1,sy=-1;
	for(int i=0;i<n;i++){
		cin>>f[i];
		for(int j=0;j<m;j++){
			if(f[i][j]=='S'){
				sx=i;
				sy=j;
			}
		}
	}
	vector<pair<int,int> > q;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			dist[i][j]=1e9;
		}
	}
	dist[sx][sy]=0;
	q.push_back(make_pair(sx,sy));
	for(int cur=0;cur<q.size();cur++){
		int x=q[cur].first,y=q[cur].second;
		int ncur=dist[x][y];
		for(int d=0;d<4;d++){
			int xx=x+dx[d],yy=y+dy[d];
			if(min(xx,yy)<0||min(n-xx,m-yy)<=0||dist[xx][yy]<1e8||f[xx][yy]=='#')continue;
			dist[xx][yy]=ncur+1;
			q.push_back(make_pair(xx,yy));
		}
	}
	int ans=1e9;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(dist[i][j]>k)continue;
			int res=1e9;
			uin(res,nceil(i,k));
			uin(res,nceil(j,k));
			uin(res,nceil(n-i-1,k));
			uin(res,nceil(m-j-1,k));
			uin(ans,res+1);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 13296
#include<bits/stdc++.h>
using namespace std;
bool x(int n)
{
    int sum = 0;
    for (int temp=n; temp>0; temp /= 10)
        sum += temp % 10;
    return (n%sum == 0);
}
int main()
{
	int n;
	cin>> n;
	x(n)? cout << "Yes\n" : cout << "No\n";
    
 
    return 0;
}

Measured memory_bytes: 256
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,m,*A = get_all_int()
ans = n - sum(A)
print(ans if ans >= 0 else -1)


Measured memory_bytes: 74272
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char X,Y;
  cin >> X >> Y;
  int x, y;
  if(X == 'A') x=10;
  else if (X == 'B') x = 11;
  else if (X == 'C') x = 12;
  else if (X == 'D') x = 13;
  else if (X == 'E') x = 14;
  else if (X=='F') x=15;
  if(Y == 'A') y = 10;
  else if (Y == 'B') y = 11;
  else if (Y == 'C') y = 12;
  else if (Y == 'D') y = 13;
  else if (Y == 'E') y = 14;
  else if (Y == 'F') y = 15;
  if(x < y) cout << "<" <<endl;
  else if (x == y) cout << "=" << endl;
  else if (x > y) cout << ">" << endl;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


int main()
{
	IOS;
	int n,x,t;
	cin>>n>>x>>t;
	long long int ans=n/x;
	int rem=n%x;
	if(rem){
        ans+=1;
	}
	cout<<ans*t<<endl;
	return 0;
}



Measured memory_bytes: 3188
def main():
    length = int(input())
    stones = list(input())
    white = [0] * length
    if stones[0] == ".":
        white[0] = 1
    for i in range(1, length):
        if stones[i] == ".":
            white[i] = white[i - 1] + 1
        else:
            white[i] = white[i - 1]
    answer = min(white[-1], length - white[-1])
    for i in range(length):
        answer = min(answer, i + 1 + white[-1] - 2 * white[i])
    print(answer)


if __name__ == '__main__':
    main()



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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    double x[n], y[n];
    int indices[n];
    for (int i = 0; i < n; ++i) {
        cin >> x[i] >> y[i];
        indices[i] = i;
    }

    double d_total = 0;
    int count = 0;

    do {
        for (int i = 0; i < n - 1; ++i){
            int begin = indices[i];
            int end = indices[i + 1];
            d_total += sqrt((x[begin] - x[end]) * (x[begin] - x[end]) + (y[begin] - y[end]) * (y[begin] - y[end]));
        }
        count++;
    } while(next_permutation(indices, indices + n));

    printf("%.10f\n", d_total / count);


}

Measured memory_bytes: 256