akhauriyash/Code-Regression huggingface dataset:
class node:
    def __init__(self,parent):
        self.parent=parent

def findset(x):
    global nodes
    if nodes[x].parent==x:
        return x
    else:
        nodes[x].parent=findset(nodes[x].parent)
        return nodes[x].parent

def unite(x,y):
    global rank,nodes
    findset(x)
    findset(y)
    if rank[nodes[x].parent]<rank[nodes[y].parent]:
        nodes[nodes[x].parent].parent=nodes[nodes[y].parent].parent
    elif rank[nodes[x].parent]==rank[nodes[y].parent]:
        nodes[nodes[x].parent].parent=nodes[nodes[y].parent].parent
        rank[y]+=1
    else:
        nodes[nodes[y].parent].parent=nodes[nodes[x].parent].parent

def same(x,y):
    global nodes
    findset(x)
    findset(y)
    if nodes[x].parent==nodes[y].parent:
        print(1)
    else:
        print(0)

n,q=map(int,raw_input().split())
rank=[0]*n
nodes=[]
for i in xrange(n):
    fac=node(i)
    nodes.append(fac)
for i in xrange(q):
    com,x,y=map(int,raw_input().split())
    if com==0:
        unite(x,y) 
    else:
        same(x,y)

Measured memory_bytes: 10380
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
// #define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  int n; cin >> n;
  int k = int(ceil((sqrt(8 * n + 1) - 1) / 2));
  int sum = k * (k + 1) / 2;

  for (int i = 1; i <= k; i++) {
    if (i == sum - n) continue;
    outl(i);
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


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

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    
    string s;
    cin >> s;
    queue<int> q;

    int n = s.length();
    for(int i=0; i<n; i++) {
        int cur = s[i] - '0';
        if(!q.empty() && cur != q.front()) {
            q.pop();
            continue;
        }
        else {
            q.push(cur);
        }
    }
    cout << n - q.size() << "\n";

    return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


int main() {
    cin.tie();
    ios::sync_with_stdio(false);
    
    // input
    int A, B, sum;
    cin >> A >> B;
    sum = A + B;
    // calculation
    if (sum >= 24) {
        cout << sum - 24 << "\n";
    } else {
        cout << sum << "\n";
    }
    
    return 0;
}


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

typedef string ll;

int main ()
{
	ll a,b,c;   cin>>a>>b>>c;
	
	
	if((a[a.size()-1]==b[0])&&(c[0]==b[b.size()-1])){
		cout<<"YES"<<endl;
	}
	 else
	  cout<<"NO"<<endl;
	
	
	


}



Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 7;
#define debug(a) cout<<#a<<": "<<a<<'\n'
ll read(){
	ll ans = 0,f = 1;
	char ch = getchar();
	for(;ch<'0'||ch>'9';ch =getchar())if(ch=='-')f = -1;
	for(;ch>='0'&&ch<='9';ch = getchar())ans = (ans<<3) + (ans << 1) + ch-'0';
	return ans * f;
}
int main() {
	ios::sync_with_stdio(false);
	ll tem;
	string s;
	//tem = read();
	cin >> tem;
	cin >> s;
	if(tem >=3200)cout << s;
	else cout << "red";
	return 0;
}


Measured memory_bytes: 256
package main

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

type proc struct {
	name string
	time int
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	quantum, _ := strconv.Atoi(strings.Split(sc.Text(), " ")[1])

	var queue []proc
	for sc.Scan() {
		inputs := strings.Split(sc.Text(), " ")
		time, _ := strconv.Atoi(inputs[1])
		queue = append(queue, proc{inputs[0], time})
	}

	var processedTime int
	for {
		restTime := queue[0].time - quantum
		if restTime <= 0 {
			processedTime = processedTime + queue[0].time
			fmt.Printf("%s %d\n", queue[0].name, processedTime)
			queue = queue[1:]
		} else {
			queue = append(queue[1:], queue[0])
			queue[len(queue)-1].time = restTime
			processedTime = processedTime + quantum
		}

		if len(queue) == 0 {
			break
		}
	}
}



Measured memory_bytes: 9444
N, K = map(int, input().split())
MOD = 10 ** 9 + 7

i = 1
n = []
while i <= N :
    j = N // i
    if i <= j :
        n.append(1)
        i += 1
    else :
        n.append(N//j-i+1)
        i = N // j + 1

M = len(n)

dp = [[0] * M for _ in range(K)]
dp[0] = n

for k in range(1, K) :
    sdp = [0] * M
    sdp[0] = dp[k-1][0]
    for i in range(1, M) :
        sdp[i] = (sdp[i-1] + dp[k-1][i]) % MOD
    for i in range(M) :
        dp[k][i] = sdp[M-i-1] * n[i] % MOD

ret = 0

for j in range(M) :
    ret += dp[K-1][j]
    ret %= MOD
    
print(ret)

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

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

#define LL long long

const int MOD = 1e9 + 7;
const int MX = 2e6 + 5;

LL expo(LL a, LL x) {
	if(x == 0) {
		return 1;
	}
	LL ret = expo(a, x/2);
	ret = (ret * ret)%MOD;
	if(x%2 != 0) {
		ret = (ret * (a%MOD))%MOD; 
	}
	return ret;
}

LL fact[MX], ifact[MX];
void aux() {
	fact[0] = 1;
	ifact[0] = 1;
	for(int i=1;i<MX;i++) {
		fact[i] = (fact[i-1] * i)%MOD;
		ifact[i] = expo(fact[i], MOD-2);
	}
}

LL ncr(int n, int r) {
	if(r > n || r < 0) return 0;
	LL ret = ((fact[n] * ifact[n-r])%MOD * ifact[r])%MOD;
	return ret;
}

LL calc(int r, int c) {
	LL ret = 0;
	for(int i=0;i<=r;i++) {
		ret = (ret + ncr(i + 1 + c, c))%MOD;
	}
	return ret;
}

int main() {
	aux();
	int r1, r2, c1, c2;
	cin >> r1 >> c1 >> r2 >> c2;

	LL ans = 0;
	ans = (calc(r2, c2) - calc(r1 - 1, c2) + MOD - calc(r2, c1 - 1) + MOD + calc(r1 - 1, c1 - 1))%MOD;

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


Measured memory_bytes: 34896
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
struct peak
{
	double r;
	double c;
};
void koch(int d,struct peak p1,struct peak p2)
{
	if(d==0)
		return;
	
	struct peak s,u,t;
	double th=60.0/180.0*3.14159265358979323;
	//计算s,u,t
	s.r=(2*p1.r+p2.r)/3;
	s.c=(2*p1.c+p2.c)/3;
	t.r=(p1.r+2*p2.r)/3;
	t.c=(p1.c+2*p2.c)/3;
	u.r=(t.r-s.r)*cos(th)-(t.c-s.c)*sin(th)+s.r;
	u.c=(t.r-s.r)*sin(th)+(t.c-s.c)*cos(th)+s.c;
	//绘制并输出
	koch(d-1,p1,s);
	printf("%.8f %.8f\n",s.r,s.c);
	koch(d-1,s,u);
	printf("%.8f %.8f\n",u.r,u.c);
	koch(d-1,u,t);
	printf("%.8f %.8f\n",t.r,t.c);
	koch(d-1,t,p2);
	return;
}
int main()
{
	int n;
	scanf("%d",&n);
	struct peak a,b;
	a.r=0;
	a.c=0;
	b.r=100;
	b.c=0;
	printf("%.8f %.8f\n",a.r,a.c);
	koch(n,a,b);
	printf("%.8f %.8f\n",b.r,b.c);
	return 0;
}


Measured memory_bytes: 2148
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int> > mat;

int main()
{
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int l[10];
  for (int i = 0; i < n; i++)
  {
    cin >> l[i];
  }

  int ans = 1e6;
  for (int S = 0; S < 65536; S++)
  {
    int s = S;
    int check[4] = {0};
    int use[4] = {0};
    for (int i = 0; i < n; i++)
    {
      int x = s % 4;
      s /= 4;
      check[x] += l[i];
      use[x]++;
    }
    if (use[0] == 0 || use[1] == 0 || use[2] == 0)
    {
      continue;
    }
    int zantei = abs(a - check[0]) + abs(b - check[1]) + abs(c - check[2]) + 10 * (use[0] + use[1] + use[2] - 3);
    ans = min(ans, zantei);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
long long dp[100010],h[100010];
int main(){
	int i,j,n,k;
	cin >> n >> k;
	for(i=1;i<=n;i++){
		cin >> h[i];
		dp[i] = 10000000000000000;
	}
	dp[1] = 0;
	for(i=1;i<=n;i++){
		for(j=1;j<=k;j++){
			dp[i+j] = min(dp[i+j],dp[i] + abs(h[i+j] - h[i]));
		}
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>

typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
using namespace std;

int main() {
    string N;
    cin >> N;
    if ((N[0] == N[1] && N[1] == N[2]) ||
        (N[1] == N[2] && N[2] == N[3]))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
  int i;
  cin >> i;
  int k=0;
  while(k<i){
    string j;
    cin >> j;
    if(j=="Y"){
      cout << "Four";
      k=i;
    }
    else if(k== i-1){
      cout << "Three";
      k++;
    }
    else{
      k++;
    }
  }
}

Measured memory_bytes: 3624
#include<stdio.h>

int main(void){
  
  int n,m,l,i,j,k;
  long sum;
  int a[101][101];
  int b[101][101];


  scanf("%d %d %d",&n,&m,&l);
 
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a[i][j]);
    }
  }

 for(i=0;i<m;i++){
    for(j=0;j<l;j++){
      scanf("%d",&b[i][j]);
    }
  }
 for(i = 0; i < n; i++){
    for(j = 0; j < l; j++){
      for(k = 0; k < m; k++)
    sum += a[i][k] * b[k][j];
      if(j == l -1)
    printf("%ld\n", sum);
      else
    printf("%ld ", sum);
      sum = 0;
    }
  }

  return 0;
}

Measured memory_bytes: 1848
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
    int N;
    cin>>N;
    int odd=0;
    
    rep(i,N){
        int cnt=0;
        int A=i+1;
        while(A!=0){
            cnt++;
            A/=10;
        }
        if(cnt%2==1){
            odd++;
        }
    }
    cout<<odd<<endl;
}


Measured memory_bytes: 3528
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
#define INF 1000000001;

int main() {
  int n;
  cin >> n;
  vector<int> a(n,0);
  vector<int> nums(100000,0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    nums[a[i]]++;
  }
  sort(a.begin(), a.end());
  int ans = 0;

  for (int i = 0; i < 100000-2; i++) {
    ans = max(ans, nums[i] + nums[i+1] + nums[i+2]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import java.util.*;

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

		int ans = 0;
		for(int i=0; i<N; i++) {
			int a = sc.nextInt();
			if((i+1)%2==1 && a%2==1) {
				ans++;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 27064
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    int n, m, X, Y;
    cin >> n >> m >> X >> Y;

    vector<int> x(n), y(m);
    rep(i, n) cin >> x.at(i);
    rep(i, m) cin >> y.at(i);

    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    if(Y>X && max(x.at(n-1), X)<min(Y, y.at(0))){
        cout << "No War" << endl;
    }
    else cout << "War" << endl;

    return 0;
}


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

int sum_of_digits(int N) {
    int sum = 0;
    while (N != 0) {
        int x;
        x = N % 10;
        sum = sum + x;
        N = N/10;
    }
    return sum;
}

int main() {

    int N;

    cin >> N;

    if (N % sum_of_digits(N) == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

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

void dfs(vector<long long> &dist, const vector<vector<P>> &g, int node,
         long long d) {
  dist[node] = d;
  for (auto n : g[node]) {
    if (dist[n.first] == -1) dfs(dist, g, n.first, d + n.second);
  }
}

int main(void) {
  int N;
  cin >> N;
  vector<vector<P>> g(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    g[a].push_back(P(b, c));
    g[b].push_back(P(a, c));
  }
  int Q, K;
  cin >> Q >> K;
  K--;
  vector<long long> dist(N, -1);
  dfs(dist, g, K, 0);

  for (int i = 0; i < Q; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    long long ans = dist[x] + dist[y];
    cout << ans << endl;
  }
  return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var input = int.Parse(Console.ReadLine());
        var array = Console.ReadLine().Split(' ');
        var flag = false;

        for(var i = int.Parse(array[0]); i < int.Parse(array[1]) + 1; i++)
        {
            if(i % input == 0)
            {
                flag = true;
            }
        }

        if (flag)
        {
            Console.WriteLine("OK");
        }
        else
        {
            Console.WriteLine("NG");
        }

        Console.ReadLine();
    }
}



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

using namespace std;

int firstC, begWith, N, dp[200009], lst[30], frm[200009];
char sir[200009];
pair < int, int > ansQ, aint[800009];
int howQ, how[800009];

void Update (int nod, int st, int dr, int pos, pair < int, int > val)
{
    if (st == dr)
    {
        aint[nod] = val, how[nod] = st;
        return ;
    }
    int mij = (st + dr) >> 1, f1 = nod << 1, f2 = f1 | 1;
    if (pos <= mij) Update (f1, st, mij, pos, val);
    else Update (f2, mij + 1, dr, pos, val);
    if (aint[f1] < aint[f2]) how[nod] = how[f1];
    else how[nod] = how[f2];
    aint[nod] = min (aint[f1], aint[f2]);
}

void Query (int nod, int st, int dr, int x, int y)
{
    if (x <= st && dr <= y)
    {
        if (x == st) ansQ = aint[nod], howQ = how[nod];
        else
        if (aint[nod] < ansQ)
            ansQ = aint[nod], howQ = how[nod];
        return ;
    }
    int mij = (st + dr) >> 1, f1 = nod << 1, f2 = f1 | 1;
    if (x <= mij) Query (f1, st, mij, x, y);
    if (mij < y) Query (f2, mij + 1, dr, x, y);
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%s", sir + 1), N = strlen (sir + 1);
Update (1, 1, N + 1, N + 1, {0, 0});
for (int i=0; i<26; i++)
    lst[i] = N + 1;
for (int i=N; i>=1; i--)
{
    sir[i] -= 'a';
    Query (1, 1, N + 1, i + 1, lst[sir[i]]);
    dp[i] = ansQ.first + 1, frm[i] = howQ;
    lst[sir[i]] = i;
    Update (1, 1, N + 1, i, {dp[i], sir[i]});
}
int mini = N + 2;
for (int i=0; i<26; i++)
{
    if (lst[i] > N)
    {
        printf ("%c\n", i + 'a');
        return 0;
    }
    for (int j=1; j<=lst[i]; j++)
        if (dp[j] + 1 < mini || (dp[j] + 1 == mini && firstC == i && sir[j] < sir[begWith]))
            mini = dp[j] + 1, firstC = i, begWith = j;
}
//printf ("%d\n", mini);
printf ("%c", firstC + 'a');
while (begWith <= N)
    printf ("%c", sir[begWith] + 'a'), begWith = frm[begWith];
printf ("\n");
return 0;
}


Measured memory_bytes: 11392
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;

int main(){
    //    cout<<fixed<<setprecision(2);
//cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
ll k,t,n;
cin>>t>>k;
set<ll> a;
while(k--){
    cin>>n;
    ll x;
    for(int i=0;i<n;i++){
        cin>>x;
        a.insert(x);
    }
}
cout<<t-a.size();
}



Measured memory_bytes: 3632
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  string s;
  cin >> s;
  ll curr = 0;
  string front = "", back = "";
  ll q;
  cin >> q;
  while(q--) {
  	ll t;
  	cin >> t;
  	if(t == 1) curr^=1;
  	if(t == 2) {
  		ll f;
  	  cin >> f;
  	  char c;
  	  cin >> c;
  	  if(curr == 1) {
  	  	if(f == 1)back.pb(c);
  	  	else front.pb(c);
  	  } else {
  	  	if(f == 1) front.pb(c);
  	  	else back.pb(c);
  	  }
  	}
  }
  if(curr == 1) {
  	reverse(all(back));
  	reverse(all(s));
  	cout << back << s << front;
  }else {reverse(all(front)); cout << front << s << back << endl;}
  return 0;
} //good night.

Measured memory_bytes: 1040
#include<iostream>
using namespace std;
string c[10]={
	"0111111",
	"0000110",
	"1011011",
	"1001111",
	"1100110",
	"1101101",
	"1111101",
	"0100111",
	"1111111",
	"1101111"
};
int n;
main()
{
	while(cin>>n,n>=0)
	{
		string s="0000000";
		for(;n--;)
		{
			int d;cin>>d;
			for(int j=0;j<7;j++)
			{
				cout<<(s[j]!=c[d][j]);
				s[j]=c[d][j];
			}
			cout<<endl;
		}
	}
}



Measured memory_bytes: 3152
#include<cstdio>
struct edge{
	int to,nx;
}e[5000001];
int h[200001],p;
int n,m,q;
int in[200001];
int v[200001],d[200001],c[200001];
int col[200001][11];
void ae(int fr,int to){
	e[++p]=(edge){to,h[fr]};h[fr]=p;
}
void dfs(int v,int d,int c){
	if(d==-1||col[v][d]) return;
	col[v][d]=c;
	for(int i=h[v];i;i=e[i].nx) dfs(e[i].to,d-1,c);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1,x,y;i<=m;i++){
		scanf("%d%d",&x,&y);
		ae(x,y);ae(y,x);
	}
	for(int i=1;i<=n;i++) ae(i,i);
	scanf("%d",&q);
	for(int i=1;i<=q;i++){
		scanf("%d%d%d",&v[i],&d[i],&c[i]);
	}
	for(int i=q;i>=1;i--)dfs(v[i],d[i],c[i]);
	for(int i=1;i<=n;i++) printf("%d\n",col[i][0]);
	return 0;
}

Measured memory_bytes: 14848
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++) {
        cout << s[i];
        i += 1;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
using namespace std;
 
int main(){
    string a,b;
    cin >> a >> b;
    if(a.length()>b.length()){cout << "GREATER" << endl;}
    else if(a.length()<b.length()){cout << "LESS" << endl;}
    else if(a==b){cout << "EQUAL" << endl;}
    else cout << (a > b ? "GREATER":"LESS") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
#define endl "\n"

int main(int argc, const char * argv[]) {
    ios::sync_with_stdio(false);
    int N;
    cin>>N;
    double ans = 0;
    for(int i=0;i<N;i++){
        double x;
        string u;
        cin>>x>>u;
        if(u=="JPY"){
            ans+=x;
        }else{
            ans+=x*380000.0;
        }
    }
    printf("%.10lf\n",ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	int i, X ,ans;



	cin >> X;
	// vector<int> a(N);
	// vector<int> b(M);
	for (i = 0; i < 8; i++){
		if (X >= 400+ i*200 && X < 600 + i*200){
			ans = 8-i;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	int n;
	long long  dp[10001];
	dp[0] = 1;
	for(int i = 0; i < 10000; i++){
		dp[i + 1] = dp[i] + i+1;
	} 
	while(cin>>n){
		cout << dp[n]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3076
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> c(H);
    for (int i = 0; i < H; ++i) cin >> c[i];
    ll bHlim = 1 << H;
    ll bWlim = 1 << W;
    ll ans = 0;
    for (ll bitH = 0; bitH < bHlim; ++bitH)
    {
        for (ll bitW = 0; bitW < bWlim; ++bitW)
        {
            vector<string> ccp = c;
            for (int h = 0; h < H; ++h)
            {
                if (bitH & (1LL << h))
                {
                    for (int j = 0; j < W; ++j)
                    {
                        ccp[h][j] = 'R';
                    }
                }
            }

            for (int w = 0; w < W; ++w)
            {
                if (bitW & (1LL << w))
                {
                    for (int i = 0; i < H; ++i)
                    {
                        ccp[i][w] = 'R';
                    }
                }
            }

            ll cnt = 0;
            for (int i = 0; i < H; ++i)
            {
                for (int j = 0; j < W; ++j)
                {
                    if (ccp[i][j] == '#') ++cnt;
                }
            }
            if (cnt == K) 
            {
                //cout << bitH << " " << bitW << endl;
                ++ans;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <string.h>

typedef struct {
    int ue, shita , migi, hidari, oku, temae;
    int men[7];
}Dice;

Dice initialization(Dice);
Dice North(Dice);
Dice East(Dice);
Dice South(Dice);
Dice West(Dice);

int main() {
    int i, len;
    char command[101];
    Dice d1;

    d1 = initialization(d1);

    for (i = 1; i <= 6; i++) {
        scanf("%d", &d1.men[i]);
    }

    scanf("%s", command);
    len = strlen(command);

    for (i = 0; i < len; i++) {
        if (command[i] == 'N') {
            d1 = North(d1);
        }
        else if (command[i] == 'E') {
            d1 = East(d1);
        }
        else if (command[i] == 'S') {
            d1 = South(d1);
        }
        else if (command[i] == 'W') {
            d1 = West(d1);
        }
    }

    printf("%d\n", d1.men[d1.ue]);

    return 0;
}


Dice initialization(Dice d) {
    d.ue = 1;
    d.temae = 2;
    d.migi = 3;
    d.hidari = 4;
    d.oku = 5;
    d.shita = 6;

    return d;
}

Dice North(Dice d) {
    int temp;

    temp = d.ue;
    d.ue = d.temae;
    d.temae = d.shita;
    d.shita = d.oku;
    d.oku = temp;

    return d;
}

Dice East(Dice d) {
    int temp;

    temp = d.ue;
    d.ue = d.hidari;
    d.hidari = d.shita;
    d.shita = d.migi;
    d.migi = temp;

    return d;
}

Dice South(Dice d) {
    int temp;

    temp = d.ue;
    d.ue = d.oku;
    d.oku = d.shita;
    d.shita = d.temae;
    d.temae = temp;

    return d;
}

Dice West(Dice d) {
    int temp;

    temp = d.ue;
    d.ue = d.migi;
    d.migi = d.shita;
    d.shita = d.hidari;
    d.hidari = temp;

    return d;
}



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

int main()
{
	long long int n,k,sum=0;
	cin>>n>>k;
	vector<long long int>v(n);
	for(long long int i=0;i<n;i++)
	{
		cin>>v[i];
	}
	sort(v.begin(),v.end());
	for(long long int i=0;i<((long long int)v.size()-k);i++)
	{
		sum=sum+v[i];
	}
	cout<<sum;
	
	
	return 0;
}

Measured memory_bytes: 1792
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
const ll inf = 1e16;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
//	#ifndef ONLINE_JUDGE
 //   	freopen("input.txt", "r", stdin);
  //  	freopen("output.txt", "w", stdout);
//	#endif
	int n;
	cin>>n;	
	ll W;
	cin>>W;
	int v[n];
	ll w[n];
	rep(i,n){
		cin>>w[i]>>v[i];
		// sum += v[i];
	}
	vector<ll> dp(1e5+1,inf);
	dp[0] = 0;
	rep(i,n){
		for(int j = 1e5;j>=v[i];j--){
			if(dp[j-v[i]]<inf){
				dp[j] = min(dp[j],dp[j-v[i]]+w[i]);	
			}
		}
	}
	// cout<<dp[80]<<" "<<dp[90]<<"\n";
	repr(i,1e5+1){
		// cout<<i<<" "<<dp[i]<<"\n";
		if(dp[i] <= W){
			cout<<i;
			return 0;
		}
	}	
	return 0;
}

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

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

    n = n % 10;
    
    if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
        cout << "hon" << endl;
    else if (n == 0 || n == 1 || n == 6 || n == 8)
        cout << "pon" << endl;
    else
        cout << "bon" << endl;
}

Measured memory_bytes: 3624
# coding: utf-8

l = list(map(int,input().split()))

t = 0
if l[3] >= l[1]:
    t += (l[2]-l[0]) * 60
    t += l[3]-l[1]
else:
    if l[0]+1 == l[2]:
        t += l[3]-l[1]+60
    else:
        t += (l[2]-l[0]-1) * 60
        t += l[3]-l[1]+60

ans = max((t-l[4]),0)
print(ans)

Measured memory_bytes: 9208
def main():
  n = int(input())
  values = list(map(int, input().split()))
  if 0 in values:
    print(0)
    return

  mult = 1
  for i in values:
    mult *= i
    if mult > 1000000000000000000:
      print(-1)
      return
  print(mult)

main()

Measured memory_bytes: 21704
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
const long long MOD = 998244353;
typedef pair<int, int> P;
const int MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

    COMinit();
    ll ans = 0;
    rep(i, K + 1) {
        ans += ((M * COM(N - 1, i) % MOD) % MOD) * modpow(M - 1, N - i - 1, MOD);
        ans %= MOD;
    }

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

Measured memory_bytes: 27064
import java.util.*;

public class Main {


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

        String nm =  sc.nextLine();
        int n = Integer.parseInt(nm.split(" ")[0]);
        int m = Integer.parseInt(nm.split(" ")[1]);

        int[] l = new int[m];
        int[] r = new int[m];

        for (int i = 0; i < m; i++) {
            String lr = sc.nextLine();
            l[i] = Integer.parseInt(lr.split(" ")[0]);
            r[i] = Integer.parseInt(lr.split(" ")[1]);

        }

        int min, max;
        min = 1000000;
        max = 0;

        for (int i = 0; i < m; i++) {
            min = Math.min(min, r[i]);
            max = Math.max(max, l[i]);
        }

        if (min - max >= 0) {
            System.out.println(min - max + 1);
        } else {
            System.out.println(0);
        }

        return;
    }
}


Measured memory_bytes: 139172
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 


int main()
{
  __;
  int x,y,n,m,r;
  cin >> x >> y >> n >> m >> r;
  multiset<ll> v,w,s;
  for(int i=0;i<n;i++)
  {
    int a;
    cin >> a;
    v.insert(a);
    if(v.size() > x) v.erase(v.find(*v.begin()));
  }

  for(int i=0;i<m;i++)
  {
    int a;
    cin >> a;
    w.insert(a);
    if(w.size() > y) w.erase(w.find(*w.begin()));
  }

  for(int i=0;i<r;i++)
  {
    int a;
    cin >> a;
    s.insert(a);
  }

  while(true)
  {
    if(s.empty() || (*s.rbegin() <= *v.begin() && *s.rbegin() <= *w.begin())) break;
    if(*v.begin() < *w.begin())
    {
      if(*s.rbegin() > *v.begin())
      {
        v.insert(*s.rbegin());
        s.erase(s.find(*s.rbegin()));
        v.erase(v.find(*v.begin()));
      }
    }
    else if(*s.rbegin() > *w.begin())
    {
      w.insert(*s.rbegin());
      s.erase(s.find(*s.rbegin()));
      w.erase(w.find(*w.begin()));
    }
  }

  ll sum1 = 0;
  for(auto it : v)
  {
    sum1 += it;
  }

  for(auto it : w)
  {
    sum1 += it;
  }

  cout << sum1 << endl;
  return 0;
}


Measured memory_bytes: 13440
#include <iostream>
#include <deque>
#include <vector>

using namespace std;

int N, M;
vector<int> G[100005];
bool used[100005];
deque<int> dq;

int main(void)
{
	cin >> N >> M;
	int a, b;
	for(int i = 0; i < M; i++){
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	
	used[G[1][0]] = true;
	int v = 1; bool flag = true;
	while(flag){
		used[v] = true;
		dq.push_back(v);
		flag = false;
		for(int i = 0; i < G[v].size(); i++){
			if(used[G[v][i]]) continue;
			v = G[v][i];
			flag = true;
			break;
		}
	}
	
	v = G[1][0], flag = true;
	while(flag){
		used[v] = true;
		dq.push_front(v);
		flag = false;
		for(int i = 0; i < G[v].size(); i++){
			if(used[G[v][i]]) continue;
			v = G[v][i];
			flag = true;
			break;
		}
	}
	
	cout << dq.size() << endl;
	for(int i = 0; i < dq.size(); i++){
		cout << dq[i];
		if( i != dq.size() - 1) cout << " ";
	}
	cout << endl;
	return 0;
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var A = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).OrderBy(i => i).ToArray();
            var B = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).OrderBy(i => i).ToArray();
            var C = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).OrderBy(i => i).ToArray();
            var ans = 0L;
            for (int i = 0; i < N; i++)
            {
                ans += (SearchA(A, B[i]) + 1) * (N - SearchC(C, B[i]));                
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static long SearchA(long[] parts, long val)
        {
            if (parts[0] >= val) return -1;
            if (parts[parts.Length - 1] < val) return parts.Length - 1;

            var low = 0;
            var high = parts.Length - 1;

            while (low + 1 < high)
            {
                var mid = (low + high) / 2;
                if (parts[mid] < val) low = mid;
                else high = mid;
            }

            return low;
        }

        static long SearchC(long[]parts,long val)
        {
            if (parts[0] > val) return 0;
            if (parts[parts.Length - 1] <= val) return parts.Length;

            var low = 0;
            var high = parts.Length - 1;

            while (low + 1 < high)
            {
                var mid = (low + high) / 2;
                if (parts[mid] > val) high = mid;
                else low = mid;
            }

            return high;
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

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

int dp[3001][3001];

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

	int n,t,a,b;
	vector <pair<int,int>> v;

	cin >> n >> t;

	for(int i=0;i<n;i++)
	{
		cin >> a >> b;
		v.push_back(make_pair(a,b));
	}

	sort(v.begin(),v.end());
	memset(dp,-1,sizeof(dp));
	dp[0][0] = 0;

	for(int i=0;i<n;i++)
	{
		for(int j=0;j<t;j++)
		{
			if(dp[i][j]==-1)
			{
				continue;
			}
			int T = min(j + v[i].first,t);
			dp[i+1][T] = max(dp[i+1][T],dp[i][j] + v[i].second);
			dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
		}
	}

	int res = 0;

	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=t;j++)
		{
			res = max(res,dp[i][j]);
		}
	}

	cout << res << '\n';
	return 0;
}

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

#define fprint(v) for(auto x : v) cout << x << ' '
#define all(x) (x.begin(), x.end())
#define pb(x) push_back(x)
#define sz(x) x.size()
#define ll long long
#define nl '\n'

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

const int N = 5e5 + 5;
int bit[N][30];

void sum(int idx, int val, int ch){
    while(idx < N){
        bit[idx][ch] += val;
        idx += idx & -idx;
    }
}

int query(int idx, int ch){
    int ans = 0;
    while(idx > 0){
        ans += bit[idx][ch];
        idx -= idx & -idx;
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = 0; i < sz(s); i++){
        sum(i + 1, 1, s[i] - 'a');
    }
    int q;
    cin >> q;
    while(q--){
        int type;
        cin >> type;
        if(type == 1){
            int pos;
            char ch;
            cin >> pos >> ch;
            if(s[pos - 1] != ch){
                sum(pos, -1, s[pos - 1] - 'a');
                sum(pos, 1, ch - 'a');
                s[pos - 1] = ch;
            }
        }else{
            int l, r;
            cin >> l >> r;
            int ans = 0;
            for(int i = 0; i < 26; i++){
                int yo = query(r, i) - query(l - 1, i);
                if(yo > 0) ans += 1;
            }
            cout << ans << nl;
        }
    }
    return 0;
}


Measured memory_bytes: 59548
use proconio::marker::Usize1;
use std::cmp::Reverse;
fn main() {
    proconio::input! {
        n: usize,
        m: usize,
        p: usize,
        r: [Usize1;p],
        abc: [(Usize1,Usize1,usize);m],
    }
    let inf=std::usize::MAX/2;
    let mut d=vec![vec![inf;n];n];
    for (a,b,c) in abc {
        d[a][b]=c;
        d[b][a]=c;
    }
    for i in 0..n {
        d[i][i]=0;
    }
    for k in 0..n { for i in 0..n { for j in 0..n {
        d[i][j]=d[i][j].min(d[i][k]+d[k][j]);
    }}}
    let mut d2=vec![vec![0;p];p];
    for (i,&v) in r.iter().enumerate() { for (j,&u) in r.iter().enumerate() {
        d2[i][j]=d[v][u];
    }}
    let w=1<<p;
    let mut e=vec![vec![inf;w];p];
    let mut q=std::collections::BinaryHeap::new();
    for i in 0..p {
        let v=1<<i;
        e[i][v]=0;
        q.push((Reverse(0),v,i));
    }
    while let Some((Reverse(c),v,i))=q.pop() {
        if e[i][v]<c {continue;}
        let mut b=!v & w-1;
        while b>0 {
            let j=b.trailing_zeros()as usize;
            let v=v|(1<<j);
            let c=c+d2[i][j];
            if e[j][v]>c {
                e[j][v]=c;
                q.push((Reverse(c),v,j));
            }
            b&=b-1;
        }
    }
    let mut a=inf;
    for i in 0..p {
        a=a.min(e[i][w-1]);
    }
    println!("{}",a);
}

Measured memory_bytes: 2956
use std::io;
fn main() {
    let mut l1 = String::new();
    let stdin = io::stdin();
    stdin.read_line(&mut l1).unwrap();
    let trimed = l1.trim_end();
    let mut itr = trimed.split_ascii_whitespace();
    let r = itr.next().unwrap().parse::<f64>().unwrap();
    println!("{}", 2_f64 * std::f64::consts::PI * r);
}


Measured memory_bytes: 2204
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int A,B,K;
	scanf("%d %d %d",&A,&B,&K);

	vector<int> V;

	for(int i = 0; i < K && A+i <= B; i++){

		V.push_back(A+i);
	}
	for(int i = 0; i < K && B-i >= A; i++){

		V.push_back(B-i);
	}

	sort(V.begin(),V.end());
	V.erase(unique(V.begin(),V.end()),V.end());

	for(int i = 0; i < V.size(); i++){

		printf("%d\n",V[i]);
	}

	return 0;
}


Measured memory_bytes: 3728
// Author: Amey Bhavsar
// IDE: Geany/Ubuntu
// Platform: ABC168

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

typedef long long ll;
typedef unsigned long long ull;

#define rep(i,a,b) for(auto i=a;i<b;i++)
#define repD(i,a,b) for(auto i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal
// traversal function to avoid long template definition
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)
//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define MOD 1000000007
//make sure to change MAXN according to constraints
#define MAXN 15
int n,m,x,a[MAXN][MAXN];
int main() {
	cin >> n >> m >> x;
	for (int i=0; i<n; i++) {
		cin >> a[i][0];
		for (int j=0; j<m; j++) {
			cin >> a[i][j+1];
		}
	}
	
	ll ans = 2e18;
	bool pos = false;
	for (int i=1; i<1<<n; i++) {
		ll cost = 0;
		vector<ll> al(m,0);
		for (int j=0; j<n; j++) {
			if (i&(1<<j)) {
				cost += a[j][0];
				for (int k=1; k<m+1; k++) {
					al[k-1] += a[j][k];
				}
			}
		}
		
		if (*min_element(all(al)) >= x) {
			pos = true;
			ans = min(ans, cost);
		}
	}

	if (pos)
		cout << ans << "\n";
	else
		cout << "-1\n";
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int get(int n) {
    if (n == 2) {
        return 0;
    } else if (n == 4 || n == 6 || n == 9 || n == 11) {
        return 1;
    } else {
        return 2;
    }
}

int main() {
    int N;
    cin >> N;
    cout << N * 800 - 200 * (N / 15) << endl;
}


Measured memory_bytes: 256
k,n = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
point = []
Min = 999999999
for i in range(n-1):
    point.append(abs(a[i+1] - a[i]))
point.append(k - a[-1] + a[0])
Max_index = point.index(max(point))
for i in range(n):
    if i != Max_index:
        cnt += point[i]
print(cnt)



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

int main() {
  int sum,p,q,N,M,Q,L[200009],R[200009],X[509][509],C[509][509];
	cin>>N>>M>>Q;
	for(int i=1;i<M+1;i++){
		cin>>L[i]>>R[i];X[L[i]][R[i]]++;
	}
	for(int i=1;i<N+1;i++){
		for(int j=1;j<N+1;j++){
          C[i][j]=C[i][j-1]+X[i][j];
	}
    }
	for(int i=1;i<Q+1;i++){
      cin>>p>>q;
		sum=0;
		for(int j=p;j<q+1;j++){
          sum+=C[j][q]-C[j][p-1];
        }
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 4480
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]

S_cnt = Counter(S)
max_cnt = max(S_cnt.values())
# print(max_cnt)

names = [name for name, v in S_cnt.items() if v == max_cnt]
names.sort()

print(*names, sep='\n')

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

typedef long long LL;

int main()
{
	LL n; cin>>n;
	LL ans=(1+n)*n/2;
	LL cnt=n/3;
	ans-=(3+cnt*3)*cnt/2;
	cnt=n/5;
	ans-=(5+cnt*5)*cnt/2;
	cnt=n/15;
	ans+=(15+cnt*15)*cnt/2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int isload(int);

int n, k, w[100000];

int main(void)
{
	int i, P, wmax=1, wave=0;
	
	scanf("%d %d",&n,&k);
	for (i=0; i<n; i++) {
		scanf("%d",&w[i]);
		if(wmax<w[i]) wmax = w[i];
		wave += w[i];
	}
	wave /= k;
	if(wave > wmax) P = wave;
	else P = wmax;
	while (isload(P)==0) {
		P++;
	}
	
	printf("%d\n",P);
	
	return 0;
}

int isload(int P)
{
	int i, ktemp, wsum;
	
	ktemp = 0;
	wsum = 0;
	i = 0;
	while (i < n) {
		if( wsum + w[i] <= P ) {
			wsum += w[i];
		} else {
			wsum = 0;
			ktemp++;
			if(ktemp >= k) return 0;
			continue;
		}
		i++;
	}
	return 1;
}

Measured memory_bytes: 984
#include <iostream>
using namespace std;
int main(void){
    int N,b=0,ans=0,c=0;
    cin>>N;
    int H[N];
    for(int i=0;i<N;i++){
        cin>>H[i];
    }
    for(int i=0;i<N-1;i++){
        while(H[i]>=H[i+1]){
            if(i+1>=N){
                break;
            }
            b=b+1;
            i++;
        }
        c=b;
        b=0;
        if(ans<c){
            ans=c;
        }
        
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#pragma GCC optimize(2)
#include<bits/stdc++.h>
typedef long long ll;
const int maxn=1e6+5;
using namespace std;
ll n,m;
ll a[10]={0,100,101,102,103,104,105};
ll dp[maxn];
int main()
{
    scanf("%lld",&n);
    dp[0]=1;
    for(int i=1;i<=6;i++)
    {
        for(int k=a[i];k<=n;k++)
            if(dp[k-a[i]]) dp[k]=1;
    }
    printf("%lld\n",dp[n]);
    return 0;
}

/**

**/



Measured memory_bytes: 1024
# じょえチャンネル
# 高評価・チャンネル登録宜しくお願いします！
# https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ

import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
    if f:
        print('Yes')
    else:
        print('No')
def Y(f):
    if f:
        print('YES')
    else:
        print('NO')
def Z(f):
    if f:
        print('Yay!')
    else:
        print(':(')
def ispow(n):
    if int(n**.5)**2==n:
        return True
    return False

n,r = map(int,input().split())
if n >= 10:
    print(r)
else:
    print(r + 100 * (10 - n))

Measured memory_bytes: 5420
#include <bits/stdc++.h>
const int inf=0x3f3f3f3f;
using namespace std;
template <typename T> void read(T &t) {
    t=0; char ch=getchar(); int f=1;
    while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
    do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
int main(){
	char a[6];
	for(int i=0;i<6;i++){
		cin>>a[i];
	}
	int ans=0;
	for(int i=0;i<3;i++){
		if(a[i]==a[i+3]){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}


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


int main() {

    int a, b;
    cin >> a >> b;
    cout << (a-1) * (b-1) << endl;
    return 0;
}

Measured memory_bytes: 256