akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

using ll = long long;
using namespace std;

ll M = 1000000007;
  
// Returns sum of bitwise OR 
// of all pairs 
long long int sumXOR(vector<ll>arr, int n) 
{ 
    long long int sum = 0; 
    for (int i = 0; i < 64; i++)  
    { 
        //  Count of zeros and ones 
        ll zc = 0, oc = 0;  
          
        // Individual sum at each bit position 
        long long int idsum = 0;  
        for (int j = 0; j < n; j++) 
        { 
            if (arr[j] % 2 == 0) 
                zc++; 
            else
                oc++; 
            arr[j] /= 2; 
        } 
          
        // calculating individual bit sum  
        ll tmp=1LL<<i;
        tmp%=M;
        oc%=M;
        zc%=M;
        ll beta=(oc*zc)%M;
        idsum = (ll)(beta * tmp)%M;  

  
        // final sum     
        sum += idsum%M;  
        sum%=M;
    } 
    return sum; 
} 
  
int main() 
{ 
    long long int sum = 0;
    int n ;
    cin>>n;

    vector<ll>arr(n); 
    rep(i,n)cin>>arr[i]; 
   // sort(all(arr),greater<ll>());
    int m=n;
    sum = sumXOR(arr, m); 
    cout << sum%M<<endl; 
    return 0; 
} 

Measured memory_bytes: 4992
#include <algorithm>
#include <iostream>
#include <list>
#include <map> //連想配列
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <typeinfo>
#include <vector> //動的配列

#define rep(i, N) for (int i = 0; i < N; i++)
using namespace std;

int main() {
  int A,B,C,X;
  cin >> A >> B >> C >> X;
  int count=0;
  rep(i,A+1){
    rep(j,B+1){
      rep(k,C+1){
        if(500*i +100*j+50*k == X){
          count++;
        } 
      }
    }
  }
  cout << count << endl;
  return 0;
}
// return 1するとエラー出るから気をつけよう


Measured memory_bytes: 256
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    H,W=MI()
    S=[[] for _ in range(H+2)]
    S[0]="."*(W+2)
    
    for i in range(H):
        S[i+1]=list("." + input() + ".")
    S[-1]="."*(W+2)
    
    
    dx=[0,0,1,1,1,-1,-1,-1]
    dy=[1,-1,1,0,-1,1,0,-1]
    
    def se(ii,jj):
        cnt=0
        for k in range(8):
            i=ii+dx[k]
            j=jj+dy[k]
            if S[i][j]=="#":
                cnt+=1
        return cnt
    
    for i in range(1,H+1):
        for j in range(1,W+1):
            if S[i][j]==".":
                S[i][j]=se(i,j)
                
    for i in range(1,H+1):
        print(''.join(map(str, S[i][1:-1])))
            
            
        

main()


Measured memory_bytes: 43376
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int D, N;
    cin >> D >> N;
    if (N < 100) {
        cout << N;
    } else {
        cout << N + 1;
    }
    rep(i, D) cout << "00";
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;

#define Ms(s, n) memset(s, n, sizeof(s))
#define Rp(i,l,m) for(int i=l; i<m; ++i)
#define Rpd(i,l,m) for(int i=l; i>=m; --i)
#define Rpp(i,l,m) for(int i=l; i<=m; i++)
#define RpAll(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define All(a) (a).begin(), (a).end()
#define Fi first
#define Se second
#define Pb push_back
#define Pf push_front
#define Is insert
#define Sz(a) int((a).size())
#define ooi INT_MAX
#define ool LLONG_MAX
#define endl "\n"
#define maxx(a, b, c) max(a, max(b, c))
typedef long long ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
const int MOD = (int) 1e9 + 7;
const ld PI = acos((ld) -1);
inline ll gcd(ll a,ll b) {ll r;while(b){r=a%b;a=b;b=r;}return a;}
inline ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
inline ll fpow(ll n,ll k){ll r=1; for(;k;k>>=1){if(k&1)r=r*n%MOD;n=n*n%MOD;}return r;}
const int base = 311;
const int N = 5000 + 5;

ll m, n, k, ans, a[N], F[N][N];
// 10 5 2 3 2 3 2 2 3 2 3 2
void Solve(){
    cin >> n >> m;
    for(int i = m - n + 1; i <= n + m - 1; i++) cout << i << " ";
}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    Solve();
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
  char s[25];
  int i,j,a,c=1;
  scanf("%s",s);
  a = strlen(s);
  for(i=0;i<a;i++){
    for(j=i+1;j<a;j++){
      if(s[i] == s[j]){
	printf("no\n");
	c = 0;
	i = 24;
	j = 24;
      }
    }
  }
  if(c){
    printf("yes\n");
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		boolean flag = false;
		int total = 0;
		int sum = 0;
		for (char c : arr) {
			if (flag) {
				total += 9;
			} else {
				if (c == '9') {
					total += 9;
				} else {
					if (total == 0) {
						total += c - '0' - 1;
						flag = true;
					} else {
						total--;
						total += 9;
						flag = true;
					}
				}
			}
			sum += c - '0';
		}
		System.out.println(Math.max(total, sum));
	}
}


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

int main(){
    int n, count = 0;
    bool flg = true;
    cin >> n;

    vector<uint64_t> a(n);
    for (auto i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] % 2) {
            cout << 0 << endl;
            return 0;
        }
    }

    while(flg) {
        for (auto i = 0; i < n; i++) {
            if (a[i] % 2 == 0) a[i] /= 2;
            else {
                flg = false;
                break;
            }
        }
        if (flg) count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};



int main(){
    int n;cin >> n;
    vector<LL> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<vector<LL>> dp(n, vector<LL> (3, -LINF));
    if(n%2){
        dp[2][1] = a[2];
        dp[1][0] = a[1];
        dp[0][2] = a[0];
        for (int i = 0; i < n; i++) {
            if(i+2<n){
                chmax(dp[i+2][2],dp[i][2]+a[i+2]);
                chmax(dp[i+2][1],dp[i][1]+a[i+2]);
                chmax(dp[i+2][0],dp[i][0]+a[i+2]);
            }
            if(i+3<n){
                chmax(dp[i+3][0],dp[i][2]+a[i+3]);
                chmax(dp[i+3][1],dp[i][0]+a[i+3]);
            }
            if(i+4<n){
                chmax(dp[i+4][1],dp[i][2]+a[i+4]);
            }
        }
        cout << max({dp[n-1][1],dp[n-2][0],dp[n-2][1],dp[n-3][2]}) << endl;
    }
    else{
        dp[1][1] = a[1];
        dp[0][0] = a[0];
        for (int i = 0; i < n; i++) {
            if(i+2<n){
                chmax(dp[i+2][1],dp[i][1]+a[i+2]);
                chmax(dp[i+2][0],dp[i][0]+a[i+2]);
            }
            if(i+3<n) chmax(dp[i+3][1],dp[i][0]+a[i+3]);
        }
        cout << max(dp[n-1][1],dp[n-2][0]) << endl;
    }
    return 0;
}



Measured memory_bytes: 15632
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<tuple>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll a[3] = { 0,0,0 };
	rep(i, n) {
		if (s[i] == 'R')a[0]++;
		if (s[i] == 'G')a[1]++;
		if (s[i] == 'B')a[2]++;
	}
	ll ans = a[0] * a[1] * a[2];
	for (int i = 0; i <= n - 3; i++) {
		for (int j = i+1; j <= n - 2; j++) {
			if (s[i] != s[j] && s[i] != s[2 * j - i] && s[j] != s[2 * j - i]&&j<2*j-i&&2*j-i< n) {
				ans--;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3596
#include<cstdio>
#include<algorithm>
using namespace std;
#define MOD 1000000007
#define MAXN 200005
#define LL long long
LL inv[MAXN],s[MAXN];
int N;
int n,m,x,y;
LL Pow(LL a,int b)
{
    LL ans=1;
    while(b)
	{
        if(b&1) ans=ans*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return ans;
}
void Pre()
{
    s[0]=1;
    for(int i=1; i<=N; i++)
        s[i]=s[i-1]*i%MOD;
    inv[0]=1;
    inv[N]=Pow(s[N],MOD-2);
    for(int i=N-1; i>0; i--)
        inv[i]=inv[i+1]*(i+1)%MOD;
}
LL C(int a,int b)
{
    if(a<0||b<0) return 1;
    return s[a]*inv[b]%MOD*inv[a-b]%MOD;
}
int main()
{
 
    scanf("%d%d",&n,&m);
    scanf("%d%d",&x,&y);
    N=n+m-2;
    Pre();
    LL ans=0;
    for(int i=y+1;i<=m;i++)
    {
        ans+=C(n-x+i-2,i-1)*C(x+m-i-1,x-1)%MOD;
        ans%=MOD;
    }
    printf("%lld\n",ans);
}//

Measured memory_bytes: 3328
#include <stdio.h>

#define N 10000

int main(){

  int i,j,n,q,S[N],T[N],count=0;

  scanf("%d",&n);

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

  scanf("%d",&q);

   for(j=0;j<q;j++){
     scanf("%d",&T[j]);
     for(i=0;i<n;i++){
       if(S[i] == T[j]){
     count++;
     break;
       }
     }
   }

   printf("%d\n",count);

   return 0;

}

Measured memory_bytes: 2740
package main

import "fmt"

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type min struct {
	mi  int
	abs int
}

func main() {
	var N, L int
	fmt.Scan(&N, &L)

	p := min{301, 301}

	all := 0
	for i := 0; i < N; i++ {
		mi := L + i
		all += mi
		if abs(mi) < p.abs {
			p.mi = mi
			p.abs = abs(mi)
		}
	}
	if p.abs < 301 {
		all -= p.mi
	}
	fmt.Println(all)
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
	int a,b,x,y;
	scanf("%d %d",&a,&b);
	if(a<b){
		x=b/a;
		y=b%a;
		if(y!=0){
			x=x+1;
		}
	}
	else{
		x=1;
	}
	printf("%d\n",x);
	return 0;
}


Measured memory_bytes: 2756
# -*- coding: utf-8 -*-

from fractions import gcd
from math import ceil,floor
import collections

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# list = list(map(int, input().split()))


A=int(input())
B=int(input())

ans = 0
sum = A+B


if sum == 3:
    ans = 3
if sum == 4:
    ans = 2
if sum == 5:
    ans = 1

print(ans)


Measured memory_bytes: 66028
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#define mop 1000000007

using namespace std;

static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int m[101][101] = {};
int nt[101] = {};
int n;
int color[101] = {};
int d[101] = {};
int f[101] = {};
int tt = 0;

int next(int u){
    for (int v = nt[u];v <= n;v++){
      nt[u] = v+1;
      if(m[u][v]){
          return v;
      }
    }
    return -1;
}

void dfs_visit(int r){
    stack<int> S;
    S.push(r);
    color[r] = GRAY;
    d[r] = ++tt;

    while(!S.empty()){
        int u = S.top();
        int v = next(u);
        if(v != -1){
            if (color[v] == WHITE){
                color[v] = GRAY;
                d[v] = ++tt;
                S.push(v);
            }
        }else{
            S.pop();
            color[u] = BLACK;
            f[u] = ++tt;
        }
    }
}

void dfs(){

    for (int u=1;u<=n;u++){
        if(color[u] == WHITE){
            dfs_visit(u);
        }
    }
    for (int i=1;i<=n;i++){
        cout << i << " " << d[i] << " " << f[i] << endl;
    }
}

int main() {
    
    cin >> n;
    for (int u=1;u<=n;u++){
        nt[u] = 1;
    }
    for (int i=1;i<=n;i++){
        int x,k;
        cin >> x >> k;
        for (int j=1;j<=k;j++){
            int p;
            cin >> p;
            m[i][p] = 1;
        }
    }
    dfs();

}


Measured memory_bytes: 3108
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define ll long long int
#define INF 1000000000 
#define fill(space,a) memset(space,a,sizeof(space))

#define optimize() ios_base::sync_with_stdio(0);
#define MAXN 100005

int n;
vector <int> h;
int dp[MAXN];

int main()
{
	optimize();
	//freopen("input.txt", "r", stdin);
	cin >> n;

	h.resize(n+1);
	h[0] = 0;
	for (int i = 1; i <= n; i++) cin >> h[i];
		
	dp[1] = 0;
	dp[2] = abs(h[2] - h[1]);
	for (int i = 3; i <= n; i++) 
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	
	cout << dp[n] << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

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

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma optimize("Ofast")
using namespace std;

using ll = long long;
const int N = 1e5+5;

int main()
{
    ios_base::sync_with_stdio(0);

    int n;
    cin >> n;
    vector<int> a(n),b(n);
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for(int i = 0; i < n; ++i) {
        cin >> b[i];
    }
    int sum = 0;
    for(int i = 0; i < n; ++i) {
        if(a[i] - b[i] > 0) {
            sum += (a[i]-b[i]);
        }
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 3576
from collections import deque

n,m=map(int,input().split())
f=[[] for i in range(n+1)]
for i in range(m):
    a,b=map(int,input().split())
    f[a].append(b)
    f[b].append(a)
g=[0]*(n+1)
p=[0]*(n+1)
for i in range(1,n+1):
    if p[i]==0:
        p[i]=i
        data=[i]
        data=deque(data)
        while len(data)>0:
            pos=data.popleft()
            p[pos]=i
            for j in f[pos]:
                if p[j]==0:
                    data.append(j)
            f[pos]=[]
for i in range(n):
    g[p[i+1]]+=1
print(max(g))



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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define int long long
#define pb push_back
#define pii pair<int,int>
#define fr(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main()
{   fastio;
    string s , t;
    cin>>s>>t;
    int fl=-1;
    if(s.size()-t.size() != -1) {
        cout<<"No\n";
        return 0;
    }
    for(int i=0; s[i]; i++)
    {
        if(s[i] != t[i]) {
            cout<<"No\n";
            return 0;
        }
    }
    cout<<"Yes\n";

}

Measured memory_bytes: 3648
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

const int MAXN = 1e5 + 10;
int N, M;
int Cnt[MAXN];
int Red[MAXN];
int ans;

int main() {
	register int i; int x, y;
	scanf( "%d%d", &N, &M ); Red[1] = 1;
	for( i = 1; i <= N; ++i ) Cnt[i] = 1;
	for( i = 1; i <= M; ++i )
		scanf( "%d%d", &x, &y ),
		--Cnt[x], ++Cnt[y],
		Red[y] |= Red[x],
		Red[x] &= Cnt[x] != 0;
	for( i = 1; i <= N; ++i )
		ans += Red[i];
	printf( "%d\n", ans );
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, M, X, Y, Z, c, t[100000];

int T(int x) {
	if (t[x] < 0)return x;
	return t[x] = T(t[x]);
}

void U(int x, int y) {
	x = T(x);
	y = T(y);
	if (x != y) {
		if (t[x] < t[y]) {
			t[x] += t[y];
			t[y] = x;
		}
		else {
			t[y] += t[x];
			t[x] = y;
		}
	}
}

int main() {
	cin >> N >> M;
	for (int i = 0; i < N; ++i) {
		t[i] = -1;
	}
	for (int i = 0; i < M; ++i) {
		cin >> X >> Y >> Z;
		--X;
		--Y;
		U(X, Y);
	}
	for (int i = 0; i < N; ++i) {
		if (t[i] < 0)++c;
	}
	cout << c << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
#include <climits>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

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

#define pb push_back
#define mp make_pair

template <typename T>
class WarshallFloyd {
private:
    int m_V;                   
    vector<vector<T>> m_d;
    
public:
    T INF;
    
    WarshallFloyd(int V)
        : INF(std::numeric_limits<T>::max()/2)
        , m_V(V) {

        // ???????????????????????????
        // ???????????¨???????????¨??????INF??¨??????
        m_d.resize(m_V, vector<T>(m_V, INF));
        REP(i,V) m_d[i][i] = 0;
    }

    void add_dir_edge(int from, int to, int cost) {
        m_d[from][to] = cost;
    }

    void add_undir_twoways(int v1, int v2, int cost) {
        add_dir_edge(v1, v2, cost);
        add_dir_edge(v2, v1, cost);
    }

    // ??¨????????????????????¢????±???????
    vector<vector<T>> shortest_path() {
        REP(k, m_V){
            REP(i, m_V){
                REP(j, m_V){
                    // ???????????¨????????¨?????????????????§??????
                    if(m_d[i][k] != INF && m_d[k][j] != INF)
                        m_d[i][j] = min(m_d[i][j], m_d[i][k] + m_d[k][j]);
                }
            }
        }
        return m_d;
    }

    // shortest_path?????????????????¨????????¶?????¨
    bool has_negative_loop() {
        REP(i, m_V) {
            if (m_d[i][i] < 0) return true;
        }
        return false;
    }
};


int main(){
    int V, E;
    cin >> V >> E;

    WarshallFloyd<ll> wf(V);

    REP(e,E) {
        int v1, v2, cost;
        cin >> v1 >> v2 >> cost;
        wf.add_dir_edge(v1, v2, cost);
    }

    auto d = wf.shortest_path();

    if (wf.has_negative_loop()) {
        cout << "NEGATIVE CYCLE" << endl;
    }
    else {
        REP(i,V) {
            REP(j,V) {
                if (d[i][j] == wf.INF) cout << "INF";
                else cout << d[i][j];
                    
                if (j == V-1) cout << endl;
                else cout << " ";
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1372
#include <stdio.h>

int main() {
	int i;

	int N, A[100];
	double ans = 0;

	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}
	
	for (i = 0; i < N; i++) {
		ans += 1 / (double)A[i];
	}

	ans = 1 / ans;

	printf("%lf", ans);

	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            char[] l = sc.nextLine().toCharArray();
            char a = 'd';
            for (int i = 0; i < 3; i++) {
                if (l[i * 3] != 's' && l[i * 3] == l[i * 3 + 1] && l[i * 3 + 1] == l[i * 3 + 2]) {
                    a = l[i * 3];
                    break;
                }
                if (l[i] != 's' && l[i] == l[i + 3] && l[i + 3] == l[i + 6]) {
                    a = l[i];
                    break;
                }
            }
            if (l[4] != 's' && (l[0] == l[4] && l[4] == l[8] || l[2] == l[4] && l[4] == l[6])) {
                a = l[4];
            }
            System.out.println(a);
        }
    }
}



Measured memory_bytes: 26060
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,ll> P;

int C[30],CC[30];

int main(){
    bool flag=true;
    memset(C,-1,sizeof(C));
    string s,t;
    cin>>s>>t;

    for(int i=0;i<(int)s.size();i++){
        int x=s[i]-'a';
        if(C[x]==-1){
            C[x]=t[i]-'a';
        }else{
            if(C[x]!=t[i]-'a') flag=false;
        }
    }
    for(int i=0;i<30;i++){
        if(C[i]==-1) continue;
        CC[C[i]]++;
    }

    for(int i=0;i<30;i++){
        if(CC[i]>=2) flag=false;
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 1020
#[allow(dead_code)]
fn main() {
    let n = i::u();
    let mut s = i::cmap(n);
    for i in 0..n {
        let mut c = s[i].clone();
        c.sort();
        s[i] = c;
    }
    s.sort();

    let mut before = s[0].clone();
    let mut count = 1usize;
    let mut ans = 0;
    for i in 1..n {
        if s[i] != before {
            ans += count * (count - 1) / 2;
            count = 1;
            before = s[i].clone();
            continue;
        }
        count += 1;
    }
    ans += count * (count - 1) / 2;
    println!("{}", ans);
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 14588
n = int(input())
lr = [list(map(int,input().split())) for _ in range(n-1)]
cnt = [[-1] for _ in range(n)]
for u,v in lr:
    if u < v:
        cnt[v-1].append(u-1)
    else:
        cnt[u-1].append(v-1)

for i in range(n):
    cnt[i].sort()

ans = 0
tmp = 0

for i in range(n):
    tmp += (i+1)
    for j in range(len(cnt[i])-1):
        tmp -= (len(cnt[i]) - j-1) * (cnt[i][j+1] - cnt[i][j])
    ans += tmp

print(ans)


Measured memory_bytes: 132060
package main 

import (
        "fmt"
        "sort"
)

func main () {
        var n, k, l, an int
        f := []int{}
        fmt.Scan(&n,&k)
        for i := 0 ; i < n ; i++ {
                fmt.Scan(&l)
                f = append (f, l)
        }
        sort.Sort(sort.IntSlice(f))
        sort.Sort(sort.Reverse(sort.IntSlice(f)))
        for i := 0 ; i < k ; i++{
                an += f[i]
                }
        fmt.Println(an)
}


Measured memory_bytes: 512
n = int(input())
s = str(input())
d ={}
for i in range(n):
  x = s[i]
  if x not in d:
    d[x] = 1
  else:
    d[x] += 1
ans = 1
for a in d.values():
  ans = ans*(a+1)
  
print((ans-1)%(10**9+7))
  

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

int main()
{
    int a[4], count = 0;
    cin >> a[0] >> a[1] >> a[2];
    sort (a,a+3);
    while (a[0] != a[1] || a[1] != a[2])
    {
        sort (a,a+3);
        if (a[1] - a[0] >= 2)
            a[0] += 2;
        else if (a[2] - a[1] >= 2)
            a[1] += 2;
        else if (a[2] - a[0] >= 2)
            a[0] += 2;
        else if (a[2] - a[0] > 0 && a[2] - a[1] > 0)
            a[0]++,a[1]++;
        else if (a[1] == a[2])
            a[1]++,a[2]++;
        sort (a,a+3);
        count++;
    }
    cout << count;
    return 0;
}

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

const int MAX_N = 100000;

int n, k, ans = 0;
vector<int> edges_reversed[MAX_N + 1];
bool visited[MAX_N + 1];


int dfs(int node, int depth, int parent) {
  visited[node] = true;
  int max_depth = depth;
  for (int i = 0; i < edges_reversed[node].size(); i++) {
    int next_node = edges_reversed[node][i];
    if (!visited[next_node]) {
      int next_depth = dfs(next_node, depth + 1, node);
      max_depth = max(max_depth, next_depth);
    }
  }
  if (max_depth - depth + 1 < k) {
    return max_depth;
  } else {
    if (parent != 0 && parent != 1) {
      ans++;
    }
    return depth - 1;
  }
}


int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    int to;
    cin >> to;
    if (i == 1 && to != 1) {
      ans++;
    }
    edges_reversed[to].push_back(i);
  }
  visited[1] = true;
  dfs(1, 0, 0);
  cout << ans;
}

Measured memory_bytes: 13568
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = [ True if sv == "o" else False for sv in list(str(readline().rstrip().decode('utf-8')))]
    dp = [[True] * n for _ in range(4)]
    dp[0][0] = True
    dp[0][1] = True
    dp[1][0] = False
    dp[1][1] = False
    dp[2][0] = True
    dp[2][1] = False
    dp[3][0] = False
    dp[3][1] = True
    for i in range(1, n-1):
        for j in range(4):
            if dp[j][i] == s[i]:
                dp[j][i+1] = dp[j][i-1]
            else:
                dp[j][i + 1] = not dp[j][i - 1]
    for i in range(4):
        b = True
        if dp[i][0] == s[0]:
            if dp[i][1] != dp[i][-1]:
                b = False
        else:
            if dp[i][1] == dp[i][-1]:
                b = False

        if dp[i][-1] == s[-1]:
            if dp[i][0] != dp[i][-2]:
                b = False
        else:
            if dp[i][0] == dp[i][-2]:
                b = False
        if b:
            ans = []
            for j in range(len(dp[i])):
                ans.append("S" if dp[i][j] else "W")
            print("".join(ans))
            exit()
    print(-1)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 56584
def main():
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())
    s = 0
    l = {i:0 for i in range(1,100001)}
    for num in A:
        l[num] += 1
        s += num



    for _ in range(Q):
        B, C = map(int, input().split())
        num_of_before = l[B]
        l[C] += num_of_before
        s = s + num_of_before * (C-B)
        print(s)
        l[B] = 0


if __name__ == '__main__':
    main()



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

const ll INF = 1e18;

int main(){
	int a,b,q;
	cin >> a >> b >> q;
	map<ll,bool> isTera;
	vector<ll> locate;
	vector<ll> jinja;
	vector<ll> tera;
	
	jinja.push_back(-INF);
	tera.push_back(-INF);
	locate.push_back(-INF);
	isTera[-INF] = true;
	
	rep(i,a){
		ll x;
		cin >> x;
		jinja.push_back(x);
		isTera[x] = false;
		locate.push_back(x);
	}
	rep(i,b){
		ll x;
		cin >> x;
		tera.push_back(x);
		isTera[x] = true;
		locate.push_back(x);
	}
	
	jinja.push_back(INF);
	tera.push_back(INF);
	locate.push_back(INF);
	isTera[INF] = true;
	
	sort(locate.begin(), locate.end());
	
	rep(i,q){
		ll x;
		cin >> x;
		
		ll res = INF;
		
		auto p = lower_bound(locate.begin(), locate.end(), x);
		ll vp = *p;

		if(vp != INF){
			if(isTera[vp] == true){
				auto q = lower_bound(jinja.begin(), jinja.end(),vp);
				res = min(res, abs(*q - x));
				//auto backq = q; backq--;
				res = min(res, abs(vp - x) + abs(jinja[q-jinja.begin()-1] - vp));
			}
			else{
				auto q = lower_bound(tera.begin(), tera.end(),vp);
				res = min(res, abs(*q - x));
				// auto backq = q; backq--;
				res = min(res, abs(vp - x) + abs(tera[q-tera.begin()-1] - vp));
			}		
			
		}
		//←←
		// auto backp = p; backp--;
		ll vbackp = locate[p-locate.begin()-1];
		if(vbackp != -INF){
			if(isTera[vbackp] == true){
				auto q = lower_bound(jinja.begin(), jinja.end(),vbackp);
				// auto backq = q; backq--;
				res = min(res, abs(jinja[q-jinja.begin()-1] - x));
				res = min(res, abs(vbackp - x) + abs(vbackp - *q));
			}
			else{
				auto q = lower_bound(tera.begin(), tera.end(),vbackp);
				// auto backq = q; backq--;
				res = min(res, abs(tera[q-tera.begin()-1] - x));
				res = min(res, abs(vbackp - x) + abs(vbackp - *q));
			}
		}
		
		cout << res << endl;
	}
	return 0;
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int n;
    int a[200004];
    int ans[200003];

    Scd(n);

    Rep(i,n){
        Scd(a[i]);
    }

    int head = 0;
    int butt = n-1;
    Rep(i,n){
        if( i % 2 == 0 ){
            ans[head++] = a[n-i-1];
        }else{
            ans[butt--] = a[n-i-1];
        }
    }

    Rep(i,n){
        printf( "%d",ans[i] );
        if( i != n-1 ) printf (" ");
        else printf ("\n");
    }


    return 0;
}



Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}



int main(){
  int n,x,t;
  cin>>n>>x>>t;

  int a=n/x;
  if(n%x!=0) a++;

  cout<<a*t;

  

return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#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)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int h,w,k;
  cin>>h>>w>>k;
  char mp[9][9];
  rep(i,h)rep(j,w)cin>>mp[i][j];

  int ans=0;
  rep(b1,1<<h){
    rep(b2,1<<w){
      int cnt=0;
      rep(i,h){
        rep(j,w){
          if(b1>>i&1&&b2>>j&1){
            if(mp[i][j]=='#')cnt++;
          }
        }
      }
      if(cnt==k)ans++;
    }
  }
  cout<<ans<<endl;
  return(0);
}

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

int main() {
  int N;
  cin >> N;
  if(N % 10 == 3){
  	cout << "bon" << endl;
  }
  else if(N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8){
  	cout << "pon" << endl;
  }
  else{
  	cout << "hon" << endl;
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
    int m,d;cin>>m>>d;
    int ans = 0;
    for(int i = 1; i <= m; i++)
    {
        for(int j = 22; j <= d; j++)
        {
            int dig = j;
           
            int ones = dig%10;
            dig = dig/10;
            int tens = dig%10;
            if(ones >= 2 && tens >=2 ){
            if(ones*tens == i){
                // cout<<i<<" "<<j<<"\n";
                ans++;
            }
            }
            
        }
    }

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


Measured memory_bytes: 256
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}




signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i)
        cin >> a[i];

    unordered_map<int,int> v;
    i64 ans = 0;
    for(int i = 0; i < n; ++i){
        ans += v[i - a[i]];
        ++v[a[i] + i];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 19292
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <string.h>
#include <bits/stdc++.h>
#include <math.h>

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;


int main(){
    //std::ifstream in("resource/input.txt");
    //std::cin.rdbuf(in.rdbuf());

	while(true)
	{
		int n;
		cin >> n;
		if(n == 0)break;

		double a_bunsan;
		double a_hensa;
		double s[n];
		double sum = 0.0;
		double ave;
		REP(i,n)
		{
			cin >> s[i];
			sum += s[i];
		}
		ave = sum / double(n);

		a_bunsan = 0.0;
		REP(i,n)
		{
			a_bunsan += (s[i] - ave) * (s[i] - ave);
		}
		a_bunsan /= double(n);

		a_hensa = sqrt(a_bunsan);
    	cout << fixed << setprecision(5) << a_hensa << endl;

	}
	//std::printf("%.5f¥n", res);
	
	return 0;
}




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

using namespace std;

const int Max = 1e6 + 5;
int h[Max], dp[Max];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> h[i];
	dp[2] = abs(h[2] - h[1]);
	for (int i = 3; i <= n; ++i)
		dp[i] = min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2]);
	cout << dp[n];
	return 0;
}

Measured memory_bytes: 4736
import java.io.IOException;
import java.util.Scanner;
import java.util.TreeSet;

public class Main{
	public static double EPS = 1e-6;
	public static void main(String[] args) throws IOException{
		Scanner in = new Scanner(System.in);
		while(true){
			int n = in.nextInt();
			if(n == 0) break;
			Line[] line = new Line[n];
			int res = 1;
			TreeSet<Point> set = new TreeSet<Point>();
			for(int i=0; i<n; i++){
				line[i] = new Line(
						in.nextInt()
						, in.nextInt()
						, in.nextInt()
						, in.nextInt());
				res++;
				set.clear();
				for(int j=i-1; j>=0; j--){
					Point p = line[i].crossPoint(line[j]);
					if(p == null || line[i].link(line[j])) continue;
					if(set.contains(p)) continue;
					set.add(p);
					res++;
				}
			}
			System.out.println(res);
		}
	}
	
	
}

class Point implements Comparable<Point>{
	static final double EPS = 1e-10;
	double x, y;
	public Point(double x, double y){
		this.x = x;
		this.y = y;
	}
	
	public double dist2(Point p){
		return (x-p.x)*(x-p.x) + (y-p.y)*(y-p.y);
	}
	
	@Override
	public int compareTo(Point o) {
		if(Math.abs(x-o.x) >= EPS) return Double.compare(x, o.x);
		if(Math.abs(y-o.y) >= EPS) return Double.compare(y, o.y);
		return 0;
	}
}

class Line{
	Point p1, p2;
	Point vec;
	public Line(Point p1, Point p2){
		this.p1 = p1;
		this.p2 = p2;
		vec = new Point(p2.x-p1.x, p2.y-p1.y);
	}
	
	public Line(double x1, double y1, double x2, double y2){
		p1 = new Point(x1, y1);
		p2 = new Point(x2, y2);
		vec = new Point(x2-x1, y2-y1);
	}
	
	Point crossPoint(Line l){
		if(!cross(p1, p2, l.p1, l.p2)) return null;
		double d1 = Math.abs(cross(l.vec.x, l.vec.y, p1.x-l.p1.x, p1.y-l.p1.y));
		double d2 = Math.abs(cross(l.vec.x, l.vec.y, p2.x-l.p1.x, p2.y-l.p1.y));
		double t = d1/(d1+d2);
		return new Point(p1.x+(p2.x-p1.x)*t, p1.y+(p2.y-p1.y)*t);
	}
	
	boolean link(Line l){
		return p1.compareTo(l.p1) == 0
				|| p1.compareTo(l.p2) == 0
				|| p2.compareTo(l.p1) == 0
				|| p2.compareTo(l.p2) == 0;
	}
	
	static boolean cross(Point p1, Point p2, Point p3, Point p4){
		return ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0;
	}
	
	static double cross(Point a, Point b){
		return a.x*b.y - b.x*a.y;
	}
	
	public static double cross(double x1, double y1, double x2, double y2){
		return x1*y2 - x2*y1;
	}
	
	// ?????£??§?¨???§???????¨????????????£
	// ?????£???????????¶????????????
	static double ccw(Point a, Point b, Point c){
		double dx1 = b.x - a.x;
		double dy1 = b.y - a.y;
		double dx2 = c.x - a.x;
		double dy2 = c.y - a.y;
		return dx1*dy2 - dx2*dy1;
	}
}

Measured memory_bytes: 51100
#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;

ll digitSum(ll x){
    ll sum = 0;
    while(x > 0){
        sum += x % 10;
        x /= 10;
    }

    return sum;
}

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

    ll ans = 0;
    REP(i, N){
        ll sum = digitSum(i);
        if(sum >= A && sum <= B){
            ans += i;
        }
    }

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

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n;
ll sum[401], dp[401][401];
vector <int> a;

ll getsum(int l, int r){
    return sum[r] - sum[l - 1];
}
ll solve(int l, int r){
    if(l == r) return 0;
    ll &ret = dp[l][r];
    if(ret != -1) return ret;
    ret = 1e15;
    for(int i = l ; i + 1 <= r ; i++)
        ret = min(ret, solve(l, i) + solve(i + 1, r) + getsum(l, i) + getsum(i + 1, r));
    return ret;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(dp, -1, sizeof dp);
    cin >> n;
    a.resize(n + 1);
    for(int i = 1 ; i <= n ; i++){
        cin >> a[i];
        sum[i] = a[i] + sum[i - 1];
    }
    cout << solve(1, n) << endl;
}


Measured memory_bytes: 1536
[N,K,Q] = list(map(int,input().split()))
A=[]
P=[K]*N
for i in range(Q):
    A.append(int(input()))
for i in range(Q):
    P[A[i]-1] += 1
for i in range(N):
    if P[i] > Q:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 56024
fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).ok();

    let inputs = input.split_whitespace().map(|x| x.parse::<i32>().unwrap()).collect::<Vec<_>>();
    let (x1, y1, x2, y2) = (inputs[0], inputs[1], inputs[2], inputs[3]);

    let xd = x2 - x1;
    let yd = y2 - y1;

    let x3;
    let y3;
    let x4;
    let y4;

    x3 = x2 - yd;
    y3 = y2 + xd;
    x4 = x1 - yd;
    y4 = y1 + xd;

    println!("{} {} {} {}", x3, y3, x4, y4);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

long double W,H,x,y;
cin >> W >> H >> x >> y ;

cout << W / 2 * H << endl;
if(x == W/2 && y == H/2) cout << 1 << endl;
else cout << 0 << endl;

return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
#include <math.h>
#include <typeinfo>
#include <numeric>
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <queue>

using namespace std;

struct obj {
	int A;
	int B;
};

bool cmp(const obj &a, const obj &b)
{
	if (a.A == b.A)
	{
		return a.B < b.B;
	}

	return a.A < b.A;
}


int main()
{
	int N, M;
	cin >> N >> M;
	priority_queue<int> q;
	
	vector<obj> d(N);
	for (int i = 0; i < N; i++)
	{
		cin >> d[i].A >> d[i].B;
	}

	sort(d.begin(), d.end(), cmp);
	int c = 0;
	int idx = 0;
	for (int i = 1; i <= M; i++)
	{
		while (idx < N && d[idx].A <= i)
		{
			q.push(d[idx].B);
			idx++;
		}

		if (q.empty() == false)
		{
			c += q.top();
			q.pop();
		}
	}

	cout << c << endl;
	return 0;
 
}

Measured memory_bytes: 1660
import java.util.*;

public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long t[]= new long[n];
        for(int i=0;i<n;i++)t[i]=sc.nextLong();
        for(int i=1;i<n;i++){
            t[i]=lcm(t[i],t[i-1]);
        }
        System.out.println(t[n-1]);

    }

    private static long gcd(long a,long b){
        if(b==0)return a;
        return gcd(b,a%b);
    }
    private static long lcm(long a,long b){
        return (a/gcd(a,b))*b;
    }
}


Measured memory_bytes: 21844
//ARC061-C(たくさんの数式)
//'+'を入れるか入れないかで2^n通りのbit全探索
#include<iostream>
#include<string>
#include<numeric>
using namespace std;

string S;
long long a[20];

int main(){
    cin>>S;
    long long ans=0;
    int n=S.size();
    for(long long mask=0; mask<(1<<(n-1)); mask++){
        
        for(int i=0; i<n; i++)a[i]=S[i]-'0';
        
        for(int i=0; i<(n-1); i++){//どこに+を入れるか
            if(mask & (1<<i)){
                //'+'をiとi+1の間に入れない
                a[i+1]=a[i]*10+a[i+1];
                a[i]=0;
            }
        }
        ans+=accumulate(a,a+n,0LL);//long long型なので0LLにする(int型は0)
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int A, B, C, D, X, Y;
	cin >> A >> B >> C >> D >> X;

	int S = A * 60 + B;
	int T = C * 60 + D;

	cout << T - S - X  << endl;





	return 0;
}



Measured memory_bytes: 3640
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**5*2)
n=int(input())
child=[[]for _ in range(n)]
color=[-1]*(n-1)
#adj は(子供,辺番号)
for i in range(n-1):
	a,b=map(int,input().split())
	child[a-1].append((b-1,i))
#x=現在見ている頂点
#r=その頂点の親とその頂点の間のnodeの色
def f(now,parent_node):
	color_num=1
	for i,j in child[now]:
		if color_num==parent_node:
			color_num+=1
		color[j]=color_num 
		f(i,color_num)
		color_num+=1
f(0,0)
print(max(color))
for x in color:
	print(x)

Measured memory_bytes: 69192
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
 
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
 
using namespace std;
 
typedef long long ll;

int main(int argc, char const *argv[])
{
  int n;
  cin >> n;
  vector<ll> h = vector<ll>(n);
  for (int i = 0; i < n; i++){
    cin >> h[i];
  }
  ll res = 0;
  ll high = 0;
  REP(i,n){
    if (i == 0) {
     res ++; 
    }
    else {
      if (high <= h[i]){
        res++;
      }
    }
    high = max(h[i],high);
  }
 cout << res << endl;
  return 0;
}


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

string  n;

void hon(int b){
    if(n.at(b) == '3') cout << "bon" << endl;
    else if(n.at(b) == '0' || n.at(b) == '1' || n.at(b) == '6' || n.at(b) == '8' ) cout << "pon" << endl;
    else cout << "hon" << endl;
}


int main(){
    cin >> n;
    
    if(n.size() == 3)  hon(2);
    else if(n.size() == 2) hon(1);
    else hon(0);
    
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int N, M, Q;

void dfs(vector<vector<int>> &I, vector<int> A, int biggest = 1) {
    if (A.size() == N) {
        I.push_back(A);
        return;
    }

    REP(i, biggest, M + 1) {
        vector<int> tmp = A;
        tmp.push_back(i);
        dfs(I, tmp, i);
    }
}

int main() {
    cin >> N >> M >> Q;
    vector<int> A(Q), B(Q), C(Q), D(Q);
    REP(i, 0, Q) cin >> A[i] >> B[i] >> C[i] >> D[i];

    vector<vector<int>> integers;
    dfs(integers, vector<int>());

    ll ans = 0;
    for (auto i : integers) {
        ll tmp = 0;
        REP(j, 0, Q) {
            if (i[B[j] - 1] - i[A[j] - 1] == C[j]) tmp += D[j];
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9848
def c(x1, y1, x2, y2, x, y)
  (y2 - y1)*(x - x1) - (x2 - x1)*(y - y1)
end

while s = gets
  x1, y1, x2, y2, x3, y3, xp, yp = s.split(/\s/).map(&:to_f)
  gx, gy = (x1 + x2 + x3)/3, (y1 + y2 + y3)/3

  r1 = c(x1, y1, x2, y2, gx, gy)*c(x1, y1, x2, y2, xp, yp) > 0
  r2 = c(x2, y2, x3, y3, gx, gy)*c(x2, y2, x3, y3, xp, yp) > 0
  r3 = c(x3, y3, x1, y1, gx, gy)*c(x3, y3, x1, y1, xp, yp) > 0
  puts (r1 && r2 && r3) ? 'YES' : 'NO'
end

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


int main()
{
    int n,i,j;
    vector<int> alpha(26,0);
    cin >> n;
    string s;
    cin >> s;
    for(i = 0;i < s.size();++i){
        ++alpha.at((int)s.at(i)-97);
    }

    for(i = 1;i < n;++i){
        vector<int> temp_alpha(26,0);
        cin >> s;
        for(j = 0;j < s.size();++j){
            ++temp_alpha.at((int)s.at(j)-97);
        }
        for(j = 0;j < alpha.size();++j){
            alpha.at(j) = min(alpha.at(j), temp_alpha.at(j));
        }
    }

    string ans = "";

    for(i = 0;i < alpha.size();++i){
        for(j = 0;j < alpha.at(i);++j){
            ans += (char)(i+97);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256