akhauriyash/Code-Regression huggingface dataset:
package main

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

type node struct {
	v    int // value
	next *node
	prev *node
}

var head node

func initHead(n *node) {
	n.next = n
	n.prev = n
}

func insert(x int) {
	next := head.next
	n := new(node)
	n.v = x
	n.next = next
	n.prev = &head
	head.next = n
	next.prev = n
}

func deleteNode(x int) {
	for p := head.next; p != &head; p = p.next {
		if p.v == x {
			del(p)
			return
		}
	}
}

func deleteFirst() {
	if head.next == &head {
		return
	}
	del(head.next)
}

func deleteLast() {
	if head.prev == &head {
		return
	}
	del(head.prev)
}

func del(p *node) {
	next := p.next
	prev := p.prev
	prev.next = next
	next.prev = prev
}

func main() {
	initHead(&head)
	n := 0
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	var s string
	for i := 0; i < n; i++ {
		sc.Scan()
		s = sc.Text()
		switch s {
		case "deleteFirst":
			del(head.next)
		case "deleteLast":
			del(head.prev)
		default:
			// insert or delete
			sc.Scan()
			x, _ := strconv.Atoi(sc.Text())
			if s == "insert" {
				insert(x)
			} else if s == "delete" {
				deleteNode(x)
			}
		}
	}
	// To reduce the time to print out the result
	w := bufio.NewWriter(os.Stdout)
	for p := head.next; p != &head; p = p.next {
		if p != head.next {
			fmt.Fprintf(w, " ")
		}
		fmt.Fprintf(w, "%d", p.v)
	}
	fmt.Fprintf(w, "\n")
	w.Flush()
}



Measured memory_bytes: 47404
#include <stdio.h>
#include <queue>
using namespace std;

#define INF 1e9

queue<int> Q;
char a[1111];
int d[1111][1111], dy[4] = {-1, 0, 1, 0}, dx[4] = {0, 1, 0, -1};

int main(void)
{
	int h, w, i, j;

	scanf("%d %d" ,&h, &w);
	for (i = 1; i <= h; i++)
	{
		scanf("%s" ,&a[1]);
		for (j = 1; j <= w; j++)
		{
			d[i][j] = INF;
			if (a[j] == '#')
			{
				Q.push(i);
				Q.push(j);
				d[i][j] = 0;
			}
		}
	}

	while (!Q.empty())
	{
		int yy = Q.front(); Q.pop();
		int xx = Q.front(); Q.pop();

		for (i = 0; i < 4; i++)
		{
			int ty = yy + dy[i];
			int tx = xx + dx[i];

			if (ty >= 1 && ty <= h && tx >= 1 && tx <= w && d[ty][tx] == INF)
			{
				d[ty][tx] = d[yy][xx] + 1;
				Q.push(ty);
				Q.push(tx);
			}
		}
	}

	int ans = 0;

	for (i = 1; i <= h; i++)
		for (j = 1; j <= w; j++)
			if (ans < d[i][j])
				ans = d[i][j];

	printf("%d" ,ans);
	return 0;
}

Measured memory_bytes: 12816
#include<iostream>
#include<vector>
#include<stack>
#include<map>
using namespace std;

static const int NIL = -1;
int n, m, k;
vector<int> G[200000], G2[200000];
int color[200000];
map<int, int> mp;

void dfs(int r, int c){
    stack<int> S;
    S.push(r);
    color[r] = c;

    while( !S.empty()){
        int u = S.top(); S.pop();
        for ( int i=0; i<G[u].size(); i++){
            int v = G[u][i];
            if ( color[v] == NIL){
                color[v] = c;
                mp[color[v]] ++;
                S.push(v);
            }
        }
    }
}

void assignColor(){
    int id = 1;
    for ( int i=0; i<n; i++) color[i] = NIL;
    for ( int u=0; u<n; u++) {
        if (color[u] == NIL) dfs(u, id++);
    }
}

int main(){
    int A[100000],B[100000], C[100000], D[100000];

    cin >> n >> m >> k;
    for (int i=0; i<m; i++){
        cin >> A[i] >> B[i] ;
        A[i] = A[i] - 1;
        B[i] = B[i] - 1;
    }
    for (int i=0; i<k; i++){
        cin >> C[i] >> D[i] ;
        C[i] = C[i] - 1;
        D[i] = D[i] - 1;
    }


    for (int i=0; i<m; i++){
        int s = A[i];
        int t = B[i];
        G[s].push_back(t);
        G[t].push_back(s);
    }

    for (int i=0; i<k; i++){
        int s = C[i];
        int t = D[i];
        G2[s].push_back(t);
        G2[t].push_back(s);
    }

    assignColor();
    

    for (int j=0; j<n; j++){
        int count = mp[color[j]];
        int friend_cnt = G[j].size();
        int block_cnt = 0;
        for( int i=0; i<G2[j].size(); i++){
            int t = G2[j][i];
            int s = j; 
            if (color[t] == color[s]) block_cnt ++;
        }

        int ans = count - block_cnt - friend_cnt;
        //cout << count << " " << block_cnt << " " << friend_cnt << endl;
        cout << ans << " ";
    }
    cout << endl;
    return 0;


    

}

Measured memory_bytes: 19072
#include <stdio.h>
#include <math.h>

int main(void){
  int h, a;
  scanf("%d%d", &h, &a);
  for(int i=1; i<=h; i++){
    if(h<=a*i){
      printf("%d\n", i);
      return 0;
    }
  }
}

Measured memory_bytes: 1712
#include<bits/stdc++.h>
#include <math.h>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int a[3];
	cin >> a[0]>> a[1]>> a[2];
    sort(a,a+3);
      cout << a[2]-a[0] << endl;
}


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

int main() {
  int n;
  string s;
  cin >> n>>s;
  int cnt=0;
  rep(i,n-2){
    if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') cnt++;
  }
  cout << cnt << endl;
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll N, T, A;
    cin >> N >> T >> A;

    ll ans = 0;
    ll diff = 10000000;
    T *= 1000;
    A *= 1000;

    ll H;
    rep(i, N){
        cin >> H;
        if(diff > abs(A - (T - H * 6))){
            ans = i + 1;
            diff = abs(A - (T - H * 6));
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
int main()
{
    int c1,c5,c10,c50,c100,c500,d,e,f,g,h,i,j;
    c1=1;
    c5=5;
    c10=10;
    c50=50;
    c100=100;
    c500=500;
    scanf("%d%d%d%d%d%d",&e,&f,&g,&h,&i,&j);
    d=(c1*e)+(c5*f)+(c10*g)+(c50*h)+(c100*i)+(c500*j);
    if(d>=1000){
        printf("1\n");
    }
    if(1000>d){
        printf("0\n");
    }
    return 0;
}
        

Measured memory_bytes: 584
/**
 * Author : RDP
 * There are no two words in the English language more harmful than "good job".
 * 1729 ;)
**/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <numeric>
using namespace std;
using ll = long long;
#define endl '\n'
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) 
{
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define FAST_IO ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
#define bp(x) __builtin_popcount(x)
#define zf(x) __builtin_clz(x)
#define zl(x) __builtin_ctz(x)
#define par(x) __bultin_parity(x)
#define all(x) (x).begin(), (x).end()
/* **************************************************************************************** */

void test_case()
{
    string s;
    cin >> s;
    if(s.back() == 's')
        s += "es";
    else 
        s += "s";

    cout << s;
	return ;
}
int main()
{
	FAST_IO
    test_case();
	return 0;
}



Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
int H,W;
void dfs(int h,int w,vector<vector<int> > &table){
    //cout << h << " " << w << endl;
    table[h][w] = 0;
    int dx[] = {-1,-1,-1,0 ,0,1 ,1,1};
    int dy[] = {-1,0 ,1 ,-1,1,-1,0,1};
    rep(i,0,8){
        int nx = w + dx[i];
        int ny = h + dy[i];
        if (nx >= W || nx < 0 || ny >= H || ny < 0) continue;
        if(table[ny][nx])dfs(ny,nx,table);
    }
}
main(){
    cin >> W >> H;
    vector< vector<int> > table;
    while(W){
        table = vector< vector<int> > (H,vector<int>(W) );
        rep(i,0,H)rep(j,0,W)cin >> table[i][j];
        int cnt = 0;
        rep(i,0,H)rep(j,0,W){
            if(table[i][j] == 1){
                //cout << i << " " << j << endl;
                dfs(i,j,table);
                cnt++;
            }
        }
        cout << cnt << endl;
        cin >> W >> H;
    }
}


Measured memory_bytes: 3332
from collections import deque

N = int(input())
T = [ [] for _ in range(N) ]
ans = []
for i in range(N-1):
    a,b = map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
    ans.append((a-1,b-1))


used = [0]*N
used[0] = 1
a = dict()
parent = [0]*N
total = 0
q = deque()
q.append(0)

while(len(q) > 0):
    c = 1
    r = q.popleft()
    for j in T[r]:
        if used[j] == 0:
            used[j] = 1
            if c == parent[r]:
                c += 1
            a[(r,j)] = c
            parent[j] = c
            c += 1
            q.append(j)
    total = max(total,c-1)


print(total)
for pair in ans:
    print(a[pair])


Measured memory_bytes: 90144
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int>h(n);
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    vector<int>dp(n,INT_MAX);
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            if(i>=j){
                dp[i]=min(dp[i],abs(h[i]-h[i-j])+dp[i-j]);
            }
        }
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 4048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int A, B;
  cin >> A >> B;
  cout << A - B + 1 << endl;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << endl
#define prtd(n, var)     cout << fixed << setprecision(n) << var << endl
#define prt2(var1, var2) cout << var1 << " " << var2 << endl
#define prtseq(var, n)   rep(i,n){cout << var[i] << " ";} cout << endl
#define prtseql(var, n)  rep(i,n){cout << var[i] << " " << endl;}

//----------------------------------------------------------------

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

  vector<string> t;
  vector<int> hall;
  vector<int> num;
  int id=0;
  t.push_back("R");
  rep(i,s.size()-1){
    if(s[i]=='L' && s[i+1]=='R'){
      t.push_back("R");
      id++;
    } else {
      t[id].push_back(s[i+1]);
    }
  }
/*
  prt("---Debug---");
  rep(i,t.size()){
    prt2(i,t[i]);
  }
*/

  //prt("===Answer===");
  vec ans;
  rep(i,t.size()){
    rep(j,t[i].size()){
      if(t[i][j]=='R' && t[i][j+1]=='L'){
        if(t[i].size()%2==0){
          ans.push_back(t[i].size()/2);
          ans.push_back(t[i].size()/2);
        } else {
          ans.push_back(t[i].size()/2 + ((j+1)%2));
          ans.push_back(t[i].size()/2 + ((j+2)%2));
        }
        j++;
      } else {
        ans.push_back(0);
      }
    }
  }

  prtseq(ans,ans.size());

}


Measured memory_bytes: 3832
n=int(input())
t,a=map(int,input().split())
lis=list(map(int,input().split()))
li=abs((t-lis[0]*0.006)-a)
l=0
for i in range(1,n):
    b=abs((t-lis[i]*0.006)-a)
    if b<li:
        li=b
        l=i
print(l+1)

Measured memory_bytes: 3064
import heapq
n, m = map(int, input().split())
ab = [[] for _ in range(m)]
for _ in range(n):
    a, b = map(int, input().split())
    if m >= a:
        ab[a-1].append(-b)
heap = []
ans = 0
for i in range(m):
    for j in ab[i]:
        heapq.heappush(heap, j)
    if heap:
        res = heapq.heappop(heap)
        ans += -res
print(ans)

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug(x) cerr<<#x<<" = "<<x<<endl

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

void solve()
{
    string s;

    cin>>s;

    li n=s.length();

    if(s[n-1]=='s')
    {
        s+="es";
    }
    else
        s+='s';

    cout<<s;
}

int main()
{    
    //remove this in kickstart

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t=1;

    // cin>>t;

    f(i,1,t)
    {
        // cout<<"Case #"<<i<<": ";

        solve();
    }

    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define int long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
int mod = 1e9+7;

int32_t main(){
    int x,y;
    cin>>x>>y;

    for(int i = 0; i <= 100; i++){
        for(int j = 0; j <= 100; j++){
            if(2*i + 4*j == y && i+j == x){
                cout<<"Yes\n";
                return 0;
            }
        }
    }

    cout<<"No\n";
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
#define PI 3.14159265358979323846264338327950L

int main() {
  	ll n,m;	
  	cin>>n>>m;
  
  	vector<ll> unsafe(n+1,0);
  for(ll i=0;i<m;i++){
    		ll a;
    		cin>>a;
             unsafe[a]++;
            }
  	  
	vector<ll> dp(n+1,0);  
  dp[0]=1;
  
  if(unsafe[1]<1){
  	dp[1]=1;}
    else{
    dp[1]=0;
    }
  
  for(ll i=2;i<n+1;i++){
  	if(unsafe[i-1]<1){
    	dp[i]+=dp[i-1];
    }
    
    if(unsafe[i-2]<1){
    	dp[i]+=dp[i-2];
    }
    
    dp[i]%=1000000007;
    
  }
  
  cout<<dp[n]<<endl;
  return 0;
  



}

Measured memory_bytes: 4812
import java.util.*;
class Main{
    public static void main(String[] args){
	Scanner stdIn = new Scanner(System.in);
	String  S = stdIn.next();
	String[] W = {"Sunny","Cloudy","Rainy"};
	int j=0;
	for(int i=0;i<W.length;i++){
	    if(S.equals(W[i])){
		j =(i+1)%3;
		System.out.println(W[j]);
	    }
	}
    }
}


Measured memory_bytes: 21076
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>

using namespace std;

bool solve() {
    int N;
    cin >> N;
    if (N == 0) return false;

    vector<pair<int, int>> book(N);
    int rsum = 0, wsum = 0;
    for (auto& b : book) {
        cin >> b.first >> b.second;
        rsum += b.first;
        wsum += b.second;
    }
    sort(book.rbegin(), book.rend());

    int read = max(rsum, book[0].first * 2);
    int rem = read - rsum;
    if (rem > 0) {
        bitset<2000> dp(1);
        for (int i = 1; i < N; ++i) {
            dp |= (dp << book[i].second);
        }

        for (int r = rem; r > 0; --r) {
            if (dp[r]) {
                wsum -= r;
                break;
            }
        }
    }

    cout << read + wsum << endl;
    return true;
}

int main() {
    while (solve()) {}
    return 0;
}


Measured memory_bytes: 3068
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <tuple>
using namespace std;

//double???2?¬????????????????
struct vec{
    long double x,y;
    vec(double x, double y): x(x), y(y){};
    //eps??????????????´???????????¨
    inline double add(double a, double b){
        return abs(a+b)<(1e-10)*(abs(a)+abs(b)) ? 0.0 : a+b;
    }
    vec operator-(vec b){
        return vec(add(x,-b.x),add(y,-b.y));
    }
    vec operator+(vec b){
        return vec(add(x,b.x),add(y,b.y));
    }
    vec operator*(long double d){
        return vec(x*d,y*d);
    }
    bool operator==(vec b){
        return x==b.x&&y==b.y;
    }
    bool operator!=(vec b){
        return x!=b.x||y!=b.y;
    }
    bool operator<(const vec&r) const{
    return this->x==r.x?this->y<r.y:this->x<r.x;
    }
    long double dot(vec v){//??????
        return add(x*v.x,y*v.y);
    }
    long double cross(vec v){//??????
        return add(x*v.y,-y*v.x);
    }
    long double norm(){//?????????
        return hypot(x,y);
    }
};

struct union_find{
    vector<int> par, rank;
    union_find(int n){
        par = vector<int>(n);
        rank = vector<int>(n);
        init(n);
    }
    void init(int n){
        for(int i=0;i<n;i++){
            par[i]=i;
            rank[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(rank[x]<rank[y]){
            par[x]=y;
        }else{
            par[y]=x;
            if(rank[x]==rank[y]) rank[x]++;
        }
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

typedef tuple<double,int,int> T;

int main(){
    int N,M;
    cin>>N>>M;
    vector<vec> V;
    vector<T> E;
    union_find U(N);

    for(int i=0;i<N;i++){
        int x,y;
        cin>>x>>y;
        V.emplace_back(x,y);
    }
    double ans = 0;
    for(int i=0;i<M;i++){
        int p,q;
        cin>>p>>q;
        p--; q--;
        double l = (V[p]-V[q]).norm();
        ans+=l;
        E.emplace_back(l,p,q);
    }
    sort(E.begin(),E.end(),greater<T>());
    for(auto e:E){
        int p,q;
        double l;
        tie(l,p,q)=e;
        if(!U.same(p,q)){
            ans-=l;
            U.unite(p,q);
        }
    }
    cout<<fixed;
    cout.precision(3);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (innt i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
using namespace std;
using namespace atcoder;
using ll = long long;

template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}

__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    int n, q;
    cin >> n >> q;
    dsu d(n);
    while (q--) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            d.merge(u, v);
        } else {
            cout << d.same(u, v) << '\n';
        }
    }
}


Measured memory_bytes: 4028
#include<stdio.h>

typedef long long ll;

ll max(ll a, ll b) {
	return (a > b) ? a : b;
}

int main() {
	ll a,b,c,d;
	scanf("%lld%lld%lld%lld", &a,&b,&c,&d);
	ll ans = max(b*d,max(b*c,max(a * c, a * d)));
	printf("%lld", ans);

	return 0;
}

Measured memory_bytes: 2148
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		String b = sc.next();
        String s = b.substring(0,1)+b.substring(2,4);
        int c = Integer.parseInt(s);
        long d = a*c;
		System.out.println(d/100);
	}
}

Measured memory_bytes: 39316
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define endl '\n';
typedef long long ll;
typedef long double ld;
using namespace std;

const int mod = 1e9 + 7;
const int N = 4010;
int n, k;
ll c[N][N];

ll ways(int n, int k) {
  // k-tuples of non-negative integers summing to n
  assert(k > 0);
  return c[n + k - 1][k - 1];
}

int main() {

  c[0][0] = 1;
  for (int i = 1; i < N; i++) {
    for (int j = 0; j <= i; j++) {
      if (j == 0 || j == i) {
        c[i][j] = 1;
      } else {
        c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
      }
    }
  }

  scanf("%d%d", &n, &k);
  int blue = k;
  int red = n - k;

  for (int i = 1; i <= blue; i++) {
    printf("%lld\n", ways(blue - i, i) * ways(red - i + 1, i + 1) % mod);
  }

  return 0;
}

Measured memory_bytes: 124160
n, m = map(int, input().split())
dq = [1]*(n+1)
for _ in range(m):
  dq[int(input())]=0
mod = 10**9+7
x, y = 0, 1
for i in range(1, n+1):
  x,y = y, dq[i] * (x+y) % mod
print(y)

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int tot1 = h1 * 60 + m1, tot2 = h2 * 60 + m2;
  if(tot2 < tot1) tot2 += 24 * 60;
  int di = tot2 - tot1;
  di -= k;
  cout << di << endl;
  return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>

using namespace std;
using lli = long long int;

string comp(const string& l, const string& r) {
	if (l.size() > r.size()) {
		return l;
	}
	else if(l.size() == r.size()){
		if(l > r){
			return l;
		}
		else {
			return r;
		}
	}
	else {
		return r;
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<bool> v(10, false);
	vector<int> match = { 0,2,5,5,4,5,6,3,7,6 };
	for (int i = 0; i < M; i++) {
		int tmp;
		cin >> tmp;
		v[tmp] = true;
	}
	vector<string> dp(N+1);
	string ans = "";
	for (int i = N; i >= 0; i--) {
		for (int j = 1; j <= 9; j++) {
			if (!v[j])continue;
			if (i != N && dp[i] == "")continue;
			if (i - match[j] >= 0) {
				dp[i - match[j]] = comp(dp[i - match[j]], dp[i] + (char)('0' + j));
			}
		}
	}
	for (int j = 1; j <= 9; j++) {
		if (!v[j])continue;
		ans = comp(ans, dp[0]);
	}
	cout << dp[0] << endl;
	return 0;
}


Measured memory_bytes: 43776
#include<stdio.h>
int main()
{
  int n,m,i,j,k;
  int a[100][100],b[100][1],c[100][1];
  
  scanf("%d%d",&n,&m);

  for(i=0;i<n;i++)
    {
      for(j=0;j<m;j++)
	{
	  a[i][j]=0;	  
	  scanf("%d",&a[i][j]);	  
	}
    }
  for(i=0;i<m;i++)
    {
      for(j=0;j<1;j++)
	{
	  b[i][j]=0;
	  scanf("%d",&b[i][j]);
	}
    }
  for(i=0;i<n;i++)
    {
      for(j=0;j<1;j++)
	{
	  c[i][j]=0;
	  for(k=0;k<m;k++)
	    {	      
	      c[i][j] += a[i][k]*b[k][j];   
	    }
	  printf("%d\n",c[i][j]);
	}
    }
  return 0; 
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
    string s;
	map<char, bool> flag;
	cin>>s;
	for(int i=0;i<s.length();++i)
		flag[s[i]]=1;
	if(flag['N']!=flag['S']||flag['W']!=flag['E'])
	cout<<"No";
	else
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
bool check[3001];
int n,x,y,w[3001],i;
vector<int> point[3001];
bool dfs(int u,int f)
{
    check[u]=false;
    for(int v:point[u])
		if(v!=f&&w[v]<w[u])
			{
				dfs(v,u);
				if(!check[v])
				{
					check[u]=true;
					break;
				}
			}
}
int main()
{
    cin>>n;
    for(i=1;i<=n;++i)
		scanf("%d",w+i);
    for(i=1;i<n;++i){
		scanf("%d%d",&x,&y);
		point[x].push_back(y);
		point[y].push_back(x);
    }
    for(i=1;i<=n;++i){
        dfs(i,0);
		if(check[i])
		    printf("%d ",i);
	}
	return 0;
}

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

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

int main() {
    int k;
    cin >> k;
    ll ans = 0;

    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= k; j++) {
            for (int l = 1; l <= k; l++) {
                ans += gcd(gcd(i, j), l);
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3596
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    r, c, k = ns()

    mat = [[0 for _ in range(c + 1)] for __ in range(r + 1)]
    for _ in range(k):
        x, y, v = ns()
        x, y = x - 1, y - 1
        mat[x][y] = v

    dp = [[0 for __ in range(4)] for _ in range(c + 1)]

    for i in range(r):
        ndp = [[0 for __ in range(4)] for _ in range(c + 1)]
        for j in range(c):
            for n in range(2, -1, -1):
                dp[j][n + 1] = max(dp[j][n + 1], dp[j][n] + mat[i][j])

            ndp[j][0] = max(dp[j])
            for n in range(4):
                dp[j + 1][n] = max(dp[j + 1][n], dp[j][n])
        dp = ndp

    print(max(dp[c - 1]))


if __name__ == '__main__':
    main()


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

using namespace std ;
int main(){
int h,n;
cin>>h>>n;

vector<int >v(n);
int sum=0;
for(int  i=0;i<n;i++){
    cin>>v[i];
    sum+=v[i];
}
if(sum>=h)
    cout<<"Yes"<<endl;
else
    cout<<"No"<<endl;
}


Measured memory_bytes: 640
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars,
    };
    if (0..s.len() / 2).all(|i| s[i] == s[s.len() - i - 1]) {
        println!("0");
        return;
    }
    let nx = s
        .iter()
        .filter(|&&c| c != 'x')
        .map(|&c| c)
        .collect::<Vec<char>>();
    if !(0..nx.len() / 2).all(|i| nx[i] == nx[nx.len() - i - 1]) {
        println!("-1");
        return;
    }
    let mut ans = 0;
    let mut i_l = 0;
    let mut i_r = s.len() - 1;
    while i_l < i_r {
        let s_l = s[i_l];
        let s_r = s[i_r];
        if s_l == s_r {
            i_l += 1;
            i_r -= 1;
        } else if s_l == 'x' {
            i_l += 1;
            ans += 1;
        } else if s_r == 'x' {
            i_r -= 1;
            ans += 1;
        } else {
            unreachable!();
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2912
using System;

namespace _3_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 1;
            bool z = true;
            string answer = "a";
            while (z)
            {
                answer = Console.ReadLine();
                if (!(answer == "0"))
                {
                    Console.WriteLine("Case " + x.ToString() + ": " + answer);
                    x++;
                }
                else
                {
                    z = false;
                }
            }
        }
    }
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            bool ret = true;
            int[] tmp = { 0, 0, 0, 0, 0, 0 };

            tmp[0] = int.Parse(Console.ReadLine());
            tmp[1] = int.Parse(Console.ReadLine());
            tmp[2] = int.Parse(Console.ReadLine());
            tmp[3] = int.Parse(Console.ReadLine());
            tmp[4] = int.Parse(Console.ReadLine());
            tmp[5] = int.Parse(Console.ReadLine());


            if (tmp[4] - tmp[3] > tmp[5]) ret = false;
            if (tmp[4] - tmp[2] > tmp[5]) ret = false;
            if (tmp[4] - tmp[1] > tmp[5]) ret = false;
            if (tmp[4] - tmp[0] > tmp[5]) ret = false;
            if (tmp[3] - tmp[2] > tmp[5]) ret = false;
            if (tmp[3] - tmp[1] > tmp[5]) ret = false;
            if (tmp[3] - tmp[0] > tmp[5]) ret = false;
            if (tmp[2] - tmp[1] > tmp[5]) ret = false;
            if (tmp[2] - tmp[0] > tmp[5]) ret = false;
            if (tmp[1] - tmp[0] > tmp[5]) ret = false;


            if (ret)
                {
                    Console.WriteLine("Yay!");
                }
                else
                {
                    Console.WriteLine(":(");
                }
            

        }
        
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

int dy[] = {-1, 1, 0, 0};
int dx[] = {0, 0, -1, 1};

int N;

signed main()
{
	cin >> N;
	vi x(N), a;
	rep(i, N) cin >> x[i];
	a=x;
	sort(all(a));
	int med = a[N / 2 - 1];
	rep(i, N) {
		if (x[i] <= med) {
			cout << a[N / 2] << endl;
		} else {
			cout << a[N / 2 - 1] << endl;
		}
	}
}



Measured memory_bytes: 5376
package main
import (
  "fmt"
  "strings"
)
func main() {
  C()	
}

func C() {
	var (
		sx int
		sy int
		tx int
		ty int
	)
	_, _ = fmt.Scan(&sx, &sy, &tx, &ty)
	//fmt.Println(S)
	st_x := tx-sx
	st_y := ty-sy
	one := strings.Repeat("U", st_y) + strings.Repeat("R",st_x)
	two := strings.Repeat("D", st_y) + strings.Repeat("L",st_x)
	three := "L" + strings.Repeat("U", st_y+1) + strings.Repeat("R",st_x+1) + "D"
	four := "R" + strings.Repeat("D", st_y+1) + strings.Repeat("L",st_x+1) + "U"
	fmt.Println(one + two + three + four)
}

Measured memory_bytes: 640
#include <stdio.h>
int main(){
    while (1) {
        int a,b,n,x,y;
        scanf("%d %d",&a,&b);
        if (a==0&&b==0) {
            return 0;
        }
        scanf("%d",&n);
        int p[a][b],i,j;
        for (i=0; i<a; i++) {
            for (j=0; j<b; j++) {
                p[i][j]=0;
            }
        }
        for (i=0; i<n; i++) {
            scanf("%d %d",&x,&y);
            p[x-1][y-1]=-1;
        }
        int flag=1;
        for (i=0; i<a; i++) {
            if (p[i][0]==-1) {
                p[i][0]=0;
                flag=0;
            }
            if (flag) {
                p[i][0]=1;
            }
        }
        flag=1;
        for (j=0; j<b; j++) {
            if (p[0][j]==-1) {
                p[0][j]=0;
                flag=0;
            }
            if (flag) {
                p[0][j]=1;
            }
        }
        for (i=1; i<a; i++) {
            for (j=1; j<b; j++) {
                if (p[i][j]==-1) {
                    p[i][j]=0;
                }else{
                    p[i][j]=p[i-1][j]+p[i][j-1];
                }
            }
        }
        printf("%d\n",p[a-1][b-1]);
    }
}

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

using namespace std;

bool solve(int n)
{
  string str[505];
  for(int i = 0; i < n; i++) cin >> str[i];

  bool G[33][33] = {{false}};
  for(int i = 0; i < n-1; i++) {
    bool flag = (str[i].size() <= str[i+1].size());
    for(int j = 0; j < min(str[i].size(), str[i+1].size()); j++) {
      if(str[i][j] != str[i+1][j]) {
	G[str[i][j]-'a'][str[i+1][j]-'a'] = true;
	flag = true;
	break;
      }
    }
    if(!flag) return true;
  }
  
  for(int i = 0; i < 26; i++) {
    for(int j = 0; j < 26; j++) {
      for(int k = 0; k < 26; k++) {
	G[j][k] |= G[j][i] & G[i][k];
      }
    }
  }
  
  bool ans = false;
  for(int i = 0; i < 26; i++) ans |= G[i][i];

  return ans;
}

int main()
{
  int n;
  while(cin >> n, n) {
    cout << (solve(n) ? "no" : "yes") << endl;
  }
  return 0;
}

Measured memory_bytes: 3008
import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int A = sc.nextInt();
        int B = sc.nextInt();
        int Q = sc.nextInt();

        long[] s = new long[A];
        long[] t = new long[B];

        for (int i = 0; i < A; i++) {
            s[i] = sc.nextLong();
        }
        for (int i = 0; i < B; i++) {
            t[i] = sc.nextLong();
        }

//        System.out.println(Arrays.toString(s));
//        System.out.println(Arrays.toString(t));

        for (int i = 0; i < Q; i++) {
            long x = sc.nextLong();
//            System.out.println(x);

            int sPosi = ~Arrays.binarySearch(s, x);
//            System.out.println(sPosi);
            int tPosi = ~Arrays.binarySearch(t, x);
//            System.out.println(tPosi);


            long s1 = -1;
            long t1 = -1;
            long s2 = -1;
            long t2 = -1;

            if (0 < sPosi) {
                s1 = s[sPosi-1];
            }
            if (sPosi < A) {
                s2 = s[sPosi];
            }

            if (0 < tPosi) {
                t1 = t[tPosi-1];
            }
            if (tPosi < B) {
                t2 = t[tPosi];
            }

//            System.out.println("---");
//            System.out.println(s1);
//            System.out.println(s2);
//            System.out.println("---");
//            System.out.println(t1);
//            System.out.println(t2);
//            System.out.println("---");

            long ans = Long.MAX_VALUE;
            long d = 0;
            if (s1 > 0 && t1 > 0) {
                d = Math.max(Math.abs(x - s1), Math.abs(x - t1));
//                System.out.println("a " + d);
                ans = Math.min(ans, d);
            }
            if (s2 > 0 && t2 > 0) {
                d = Math.max(Math.abs(x - s2), Math.abs(x - t2));
//                System.out.println("b " + d);
                ans = Math.min(ans, d);
            }
            if (t1 > 0 && s2 > 0) {
                d = Math.min(Math.abs(x - t1), Math.abs(x - s2)) + Math.abs(t1 - s2);
//                System.out.println("c " + d);
                ans = Math.min(ans, d);
            }
            if (t2 > 0 && s1 > 0) {
                d = Math.min(Math.abs(x - t2), Math.abs(x - s1)) + Math.abs(t2 - s1);
//                System.out.println("d " + d);
//                System.out.println("x - t2 " + (x - t2));
//                System.out.println("t2 - s1 " + (t2 - s1));
                ans = Math.min(ans, d);
            }

            System.out.println(ans);
//            System.out.println("======================");
        }
    }
}

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

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    if ((int)(i * 1.08) == n) {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
const double PI=3.14159265358979323846;

int main(){
  int r;
  cin >> r;
  double ans = r*2*PI;
  printf("%.10f\n", ans);
  return 0;
}

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

int n,m,k;
long long a[200000];
long long b[200000];

int main(void) {
    scanf("%d %d %d\n",&n,&m,&k);
    for(int i=0;i<n;i++) {
        scanf("%lld",&a[i]);
    }
    for(int i=0;i<m;i++) {
        scanf("%lld",&b[i]);
    }
    int aind=0;
    int bind=0;
    long long sum=0;
    int ret=0;
    while (aind<n&&sum+a[aind]<=k) {
        sum+=a[aind];
        aind++;
    }
    while (bind<m&&sum+b[bind]<=k) {
        sum+=b[bind];
        bind++;
    }
    ret=max(ret,aind+bind);
    for(int i=aind-1;i>=0;i--) {
        sum-=a[i];
        while (bind<m&&sum+b[bind]<=k) {
            sum+=b[bind];
            bind++;
        }
        ret=max(ret,i+bind);
    }
    printf("%d",ret);
}

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

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

   int K,Q; cin>>K>>Q;
   vector<int> d(K);
   for(int i=0;i<K;i++) cin>>d[i];

   while(Q--){
      int N,X,M; cin>>N>>X>>M;

      vector<int> D=d;
      for(int i=0;i<K;i++) D[i]%=M;

      lint fst=X,lst=X;
      lint sumD=0;
      for(int i=0;i<K;i++) sumD+=D[i];
      for(int i=0;i<(N-1)%K;i++) lst+=D[i];
      lst+=(lint)sumD*((N-1)/K);

      int cnt_gt=lst/M-fst/M;
      int cnt_eq=0;
      for(int i=0;i<K;i++) if(i+1<N){
         if(D[i]!=0) continue;
         cnt_eq+=((N-1)-(i+1))/K+1;
      }
      int cnt_lt=(N-1)-cnt_gt-cnt_eq;
      cout<<cnt_lt<<endl;
   }
   return 0;
}


Measured memory_bytes: 384
from operator import add
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


# 解説見た

H, W, K = map(int, input().split())
MEIJI = []
for _ in range(H):
    MEIJI.append(list(map(int, list(input()))))

# 全部のカットを試す
ans = 10 ** 5
for h in range(2 ** (H - 1)):
    # 分割できるか
    ok = False

    # 先に横の分割の数
    row = 1
    for i in range(H - 1):
        row += (h >> i) & 1

    num_cut = row - 1
    cnt = [0] * row

    #print("cut == ", h, "row == ", row)

    # 列は貪欲にカット
    for c in range(W):
        idx = 0
        tmp_cnt = [0] * row
        for r in range(H):

            if r != 0 and (h >> r - 1) & 1:
                idx += 1

            tmp_cnt[idx] += MEIJI[r][c]

        # チェック
        new_cnt = list(map(add, cnt, tmp_cnt))

        if any([K < x for x in new_cnt]):
            cnt = tmp_cnt
            num_cut += 1
        else:
            ok = True
            cnt = new_cnt

        #print("column:", c, tmp_cnt)

    if ok:
        ans = min(num_cut, ans)

print(ans)


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

//using ll=long long;

const long long MOD = 1000000007;
long long INF = 90000000001000;
long long m,n;

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

int main() {

cin >> m >> n;

long long ans;
ans = modpow(m,n,MOD);
cout << ans << endl;
return 0;
}





Measured memory_bytes: 3108
#include <stdio.h>
#include <math.h>

double hayami_saori(int uesaka_sumire,
const double hanazawa_kana[], const double murakawa_rie[], double mimori_suzuko) {
	int utida_maaya;
	double tange_sakura = 0;
	for (utida_maaya = 0; utida_maaya < uesaka_sumire; utida_maaya++) {
		tange_sakura += pow(fabs(hanazawa_kana[utida_maaya] - murakawa_rie[utida_maaya]), mimori_suzuko);
	}
	return pow(tange_sakura, 1.0 / mimori_suzuko);
}

double minase_inori(int mizuki_nana,
const double fukuenn_misato[], const double mizuhasi_kaori[]) {
	int komatu_mikako;
	double tamura_yukari = 0;
	for (komatu_mikako = 0; komatu_mikako < mizuki_nana; komatu_mikako++) {
		double oohasi_ayaka = fabs(fukuenn_misato[komatu_mikako] - mizuhasi_kaori[komatu_mikako]);
		if (oohasi_ayaka > tamura_yukari) tamura_yukari = oohasi_ayaka;
	}
	return tamura_yukari;
}

int main(void) {
	int asumi_kana, kitamura_eri;
	double tomatu_haruka[128], iguti_yuka[128];
	if (scanf("%d", &asumi_kana) != 1) return 1;
	for (kitamura_eri = 0; kitamura_eri < asumi_kana; kitamura_eri++) {
		if (scanf("%lf", &tomatu_haruka[kitamura_eri]) != 1) return 1;
	}
	for (kitamura_eri = 0; kitamura_eri < asumi_kana; kitamura_eri++) {
		if (scanf("%lf", &iguti_yuka[kitamura_eri]) != 1) return 1;
	}
	for (kitamura_eri = 1; kitamura_eri <= 3; kitamura_eri++) {
		printf("%.15f\n", hayami_saori(asumi_kana, tomatu_haruka, iguti_yuka, kitamura_eri));
	}
	printf("%.15f\n", minase_inori(asumi_kana, tomatu_haruka, iguti_yuka));
	return 0;
}


Measured memory_bytes: 2100
import std.stdio, std.string, std.array, std.conv, std.algorithm;

void main() {
    string[] mark = ["S", "H", "C", "D"];
    bool[] cards = new bool[52];
    int n = readln.chomp.to!int;
    foreach (i; 0 .. n) {
        string[] tmp = readln.chomp.split;
        cards[mark.countUntil(tmp[0])*13+tmp[1].to!int-1] = true;
    }
    foreach (i; 0 .. 52) {
        if (cards[i] == false) {
            writeln(mark[i/13], " ", i % 13 + 1);
        }
    }
}


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

int main() {
    int n;
    cin >>n;
    vector <long double> a(n);
    vector<long double>b(n);
    long double sum=0;
    for(int i =0; i <n; i++){
        cin >>a.at(i);
        sum +=a.at(i);
        b.at(i) =sum;
    }
    long double mean =sum/2;

    long double dist =20202020210;
    for(int i =0; i < n; i++){
        if(std::abs(mean - b.at(i))<dist){
            dist = std::abs(mean - b.at(i));
        }

    }
    long int  ans = 2*dist;

    cout <<ans<<endl;

}

Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	
	if (a == b && b == c && c == a) { cout << "No" << endl; }
	else if (a == b || b == c || c == a) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    cin >> S;
    string ans;
    for(int i=0; i<S.size(); i++){
        if(!ans.size()){
            if(S[i] == 'A'){
                ans += S[i];
            }
            continue;
        }
        if(S[i] == 'Z' and ans.back() == 'A'){
            ans += S[i];
            continue;
        }
        if(S[i] == 'A' and ans.back() == 'Z'){
            ans += S[i];
            continue;
        }
    }    
    if(ans.size() and ans.back()=='A') ans.pop_back();
    if(ans.size()){
        cout << ans << "\n";
    }else{
        cout << "-1\n";
    }
    return 0;
}



Measured memory_bytes: 3228
import sys
sys.setrecursionlimit(10**7)
 
*D, = open(0)
n = int(D[0])
 
v = [[] for _ in range(n+1)]
 
dist = {}
 
for i in range(1, n):
    a, b, d = map(int, D[i].split())
    v[a].append(b)
    v[b].append(a)
    dist[(a,b)]=d
    dist[(b,a)]=d
 
def visit(current, v, dist, color):
   
    for it in v[current]:
        if color[it] != None:
            continue
        if dist[(it, current)]%2 == 0:
            color[it] = color[current]
        else:
            color[it] = not color[current]
        visit(it, v, dist, color)
        
color = [None for _ in range(n+1)]
color[1]=True
visit(1, v, dist, color)
 
for i in range(1, n+1):
    if color[i]:
        print('0')
    else:
        print('1')

Measured memory_bytes: 98948
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int main()
{
	int n, m;
	cin >> n;
	set<string> a;
	rep(i,0,n) {
		string s; cin >> s;
		a.insert(s);
	}
	cin >> m;
	bool f = true;
	rep(i,0,m) {
		string s; cin >> s;
		auto it = a.find(s);
		if (it == a.end()) {
			cout << "Unknown " << s << endl;
		}
		else {
			if (f) {
				cout << "Opened by " << s << endl;
				f = false;
			}
			else {
				cout << "Closed by " << s << endl;
				f = true;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 3236
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

s = S()
t = S()
l = len(s)
S_Alphabet = [-1]*26
T_Alphabet = [-1]*26
# ord('a') = 97
for i in range(l):
    si = ord(s[i])-97
    ti = ord(t[i])-97
    if S_Alphabet[si] == -1:
        S_Alphabet[si] = ti
    else:
        if S_Alphabet[si] == ti:
            continue
        else:
            print("No")
            exit()
    if T_Alphabet[ti] == -1:
        T_Alphabet[ti] = si
    else:
        if T_Alphabet[ti] == si:
            continue
        else:
            print("No")
            exit()
else:
    print("Yes")


Measured memory_bytes: 66796