akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main()
{
  int S;
  int a,b,c,d;
  scanf("%d\n",&S);
  a=S/1000;
  S=S-a*1000;
  b=S/100;
  S=S-b*100;
  c=S/10;
  S=S-c*10;
  d=S;
  if(a==b||b==c||c==d){
    printf("Bad\n");
  }
  else{
    printf("Good\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <iterator>
#include <utility>
#include <iomanip>
#include <stack>
#include<bitset>
#include <cmath>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > >pq;
vector<ll>adj[1000005];
ll expo(ll b,ll n,ll m)
{
 ll r,p;
	p=1;
	 b=b%m;
	while(n>0)
	{ 
		r=n%2;
		if(r==1)
		   p=((p%m)*(b%m))%m;
		b=((b%m)*(b%m))%m; 
		n=n/2;		
	}
 return (p%m);
}
ll divide1(ll a,ll b,ll m)
	{ ll r,p,n;
			p=a%m;
				n=m-2;
				while(n>0){
						 r=n%2;
						if(r==1)
							p=((p%m)*(b%m))%m;
						b=((b%m)*(b%m))%m; 
						n=n/2;	
					}
	return (p%m); }
bool marked[1000002];
ll dp[2006][2006][2];
vector<ll>v;
ll fact[3003];
ll summa[2002][2002];
int main(int argc, char const *argv[])
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);
	ll n,k;
	cin>>n>>k;
	ll mod=924844033;
	ll i=1;
	while(i<=n)
	{
		ll j=i;
		while(j<=n)
		{
			v.pb(j);
			marked[j]=1;
			j+=2*k;
		}
		while(i<=n&&marked[i]!=0)
			++i; 
		//cout<<i<<"\n";
	}
	//dp[v.size()-1][1][1]=1;
	fact[0]=1;
	for (ll i = 1; i <= n; ++i)
	{
		fact[i]=(fact[i-1]*i)%mod;		
	}
	for(int i=n-1;i>=0;--i)
	{
		//cout<<v[i]<<" ";
		if(v[i]-k>0)
		dp[i][1][0]=1;
		if(v[i]+k<=n)
			dp[i][1][1]=1;
		for (int j = 1; j <= n; ++j)
		{
			// dp[i][j][1]=(dp[i][j][1]+dp[i+1][j][1]+dp[i+1][j][0])%mod;
			// dp[i][j][0]=(dp[i][j][0]+dp[i+1][j][0]+dp[i+1][j][1])%mod;	
			if(v[i]-k>0)
			dp[i][j][0]=(dp[i][j][0]+summa[i+1][j-1])%mod;	
			if(i+1<n&&v[i]+k==v[i+1]-k)
			{
				dp[i][j][1]=(dp[i+1][j-1][1]+dp[i][j][1]+summa[i+2][j-1])%mod;	
			}
			else
			{
				if (v[i]+k<=n)
				{
					dp[i][j][1]=(dp[i][j][1]+summa[i+1][j-1])%mod;	
				}
			}
			summa[i][j]=(summa[i+1][j]+dp[i][j][0]+dp[i][j][1])%mod;
		}
	}
	ll ans=fact[n];
	ll m=-1;
	for (ll i = 1; i <= n; ++i)
	{
		ll x=(summa[0][i])%mod;
		x=(x*fact[n-i])%mod;
	//	cout<<x<<"\n";
		ans=(ans+x*m+mod)%mod;	
		m=-m;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 118912
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		int mod = 998244353;
		int N = stdIn.nextInt();
		int K = stdIn.nextInt();
		ArrayList<Integer> L = new ArrayList<Integer>();
		ArrayList<Integer> R = new ArrayList<Integer>();
		for(int i = 0; i < K; i ++) {
			L.add(stdIn.nextInt());
			R.add(stdIn.nextInt());
		}
		
		ArrayList<Long> A = new ArrayList<Long>();
		A.add((long) 0);
		A.add((long) 1);
		ArrayList<Long> Sum = new ArrayList<Long>();
		Sum.add((long) 0);
		Sum.add((long) 1);
		
		for(int i = 2; i <= N; i ++) {
			long addNum = 0;
			for(int j = 0; j < K; j ++) {
				int idxL = i - R.get(j) - 1;
				int idxR = i - L.get(j);
				if(idxR <= 0) {
					continue;
				}else if(idxL < 0 && 0 <idxR) {
					addNum += (Sum.get(idxR) - Sum.get(0)) % mod;
				}else {
					addNum += (Sum.get(idxR) - Sum.get(idxL)) % mod;
				}
			}
			A.add(addNum);
			Sum.add(Sum.get(Sum.size() - 1) + addNum);
		}
		
		System.out.println(A.get(A.size() - 1) % mod);
		
		
		
//		for(int i = 1; i < N; i ++) {
//			long addNum = (long) 0;
//			for(int j = 0; j < S.size(); j ++) {
//				int sub = i - S.get(j);
//				if(sub < 0) {
//					break;
//				}
//				if(sub == 0) {
//					addNum ++;
//				}else {
//					addNum += A.get(sub - 1);
//				}
//			}
//			A.add(addNum);
//		}
		
//		System.out.println(A.get(A.size() - 1) % mod);
	}
}

Measured memory_bytes: 65872
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string

S = input()
T = input()

slen = len(S)
tlen = len(T)

def can_fill(substr, T):
    for s, t in zip(substr, T):
        if s != '?' and s != t:
            return False
    return True

ans = None
for i in range(len(S) - tlen + 1):
    substr = S[i:i+tlen]
    if can_fill(substr, T):
        S2 = S[:i] + T + S[i+tlen:]
        S2 = S2.replace('?', 'a')
        if ans == None:
            ans = S2
        else:
            ans = min(ans, S2)

if ans is None:
    print('UNRESTORABLE')
else:
    print(ans)





Measured memory_bytes: 6940
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

vector<ll> v;

void dfs(int depth, int pre, ll now){
    v.emplace_back(now);
    if (depth > 11) return;
    for (int i = max(pre - 1, 0); i <= min(9, pre + 1); i++){
        dfs(depth + 1, i, now * 10 + i);
    }
}

signed main() {
    int k;
    cin >> k;
    for (int i = 1; i <= 9; i++) {
        dfs(1, i, i);
    }
    sort(ALL(v));
    cout << v[k - 1] << endl;
    return 0;
}

Measured memory_bytes: 18792
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;

const int INF = 200000000;
const int MOD = 1e9 + 7;

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

    int H, W;
    int h, w;
    cin >> H >> W >> h >> w;
    cout << H * W - h * W - w * H + h * w << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define rep(i, n) for(int i=0; i<n; i++)

using namespace std;

//入力のX
long long X;

//N=iでの層の総数
long long sum[51];

//N=iでのパティの総数
long long psum[51];

//
long long calc(int level){
  long long half = (sum[level]+1)/2;

  //レベル0バーガー
  if(level == 0){
    //1層食べられる
    if(X>0)
      return 1;
    //1層も食べられない
    else
      return 0;
  }

  //食べる層が総数の半分未満
  if(X < half ){
    //最下層のバンを除いてlevel-1バーガーへ再帰
    X--;
    return calc(level-1);
  }
  //食べる層が総数の半分
  else if(X == half){
    //level-1バーガーを全て食べて，中心のペティを食べる
    return psum[level-1] + 1;
  }
  //食べる層が総数の半分より多い
  else{
    //食べるバーガーの補正
    //下側のlebel-1バーガーを取り除き，上下端のバンと中央のペティを取り除く
    X = X - sum[level-1] - 3 + 1;
    //level-1バーガーで再帰し，下側のlevel-1バーガーのペティ，中央のペティを足す
    return calc(level-1) + psum[level-1] + 1;
  }
  
  return 1;
}


int main(void){
  int N;
  cin >> N >> X;
  //入力終わり  

  //初期化
  sum[0] = 1;
  psum[0] = 1;

  //レベルiの層の総数とパティの総数を計算
  rep(i, N){
    sum[i+1]  = 2*sum[i] + 3;
    psum[i+1] = 2*psum[i]+1;
  }

  //解答
  cout << calc(N) << endl;
  
  return 0;
}


Measured memory_bytes: 3596
a ,b, c = map(int, input().split())
m = max(a, b, c)
for i in range(100000):
        mod1 = 3*(m + i) % 2
        mod2 = (a + b + c) % 2
        if mod1 == mod2:
                print((3*(m + i) - (a + b + c))//2)
                exit()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for(const auto& e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void yn(bool j){cout << (j ? "Yes" : "No") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> long long bcount(T1 v, T2 a){return upper_index(v, a) - lower_index(v, a);} 
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> void sortTwoVecter(vector<T1> &f, vector<T2> &s, bool isReverse = false){
    vector<pair<T1, T2>> p;
    rep(i, f.size()) p.emplace_back(make_pair(f[i], s[i]));
    if (!isReverse) sort(p.begin(), p.end());
    else sort(p.rbegin(), p.rend());
    rep(i, f.size()) tie(f[i], s[i]) = p[i];
    return;
}

int main(){
    ll N, cnt = 0; cin >> N;
    rep(i, N + 1){
        if (i % 3 != 0 && i % 5 != 0) cnt += i;
    }
    pt(cnt);
    return 0;
}

Measured memory_bytes: 3636
list = []

while True:
    H, W = [int(i) for i in input().split()]
    if H == 0 and W == 0:
        break
    list.append([H, W])

for i in range(len(list)):
    for j in range(list[i][0]):
        for k in range(list[i][1]):
            print('#', end='')
        print()
    print()

Measured memory_bytes: 9028
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1000000007
#define wi while
#define vl vector<ll>
#define vi vector<int>
#define map map<char,ll>
#define endl "\n"
const int mxN = 200001;
int main()
{
    
    int a,b;
    cin>>a>>b;
    if(b+b>=a)
    {
        cout<<0<<endl;
    }
    else
    {
        cout<<(a - (2 * b))<<endl;
    }
    
    return 0;

}


Measured memory_bytes: 3556
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int max = 0;
    int[][] a = new int[2][n];
    for(int i = 0; i < 2; i++){
      for(int j = 0; j < n; j++){
        a[i][j] = sc.nextInt();
      }
    }
    for(int i = 0; i < n; i++){
      int count = 0;
      for(int j = 0; j < n; j ++){
        if(i == j){
          count += a[0][j] + a[1][j];
        }else if(i > j){
          count += a[0][j];
        }else{
          count += a[1][j];
        }
      }
      max = Math.max(max, count);
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 23636
//g++  5.4.0

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

#define ff first
#define ss second
#define int long long
#define pb push_back
#define pii pair< int,int >
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;


signed main()
{
    fast;
    int n , m;
    cin >> n >> m;
    cout << min( n%m , m-n%m );
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pr pair <double ,int >
#define f first
#define s second
#define mmp(a,b) make_pair(a,b)
priority_queue <pr > Q;
const int N=1005,E=2500005;
int Head[N],Next[E],Adj[E],tot=0;
double Weight[E];
inline void addedge(int u,int v,double w){
	Next[++tot]=Head[u],Head[u]=tot,Adj[tot]=v,Weight[tot]=w;
	Next[++tot]=Head[v],Head[v]=tot,Adj[tot]=u,Weight[tot]=w;
}
bool vis[N];int n;
double dis[N];
inline void dijkstra() {
	for (int i=1;i<=n+2;i++) dis[i]=100000000000.0;
	dis[1]=0;
	Q.push(mmp(0.0,1));
	while (!Q.empty()) {
		pr x=Q.top();Q.pop();
		if (vis[x.s]) continue;
		vis[x.s]=true;
		for (int e=Head[x.s]; e; e=Next[e])
			if (dis[x.s]+Weight[e]<dis[Adj[e]]) {
				dis[Adj[e]]=dis[x.s]+Weight[e];
				Q.push(mmp(-dis[Adj[e]],Adj[e]));
			}
	}
}
double x[N],y[N],r[N];
inline double dist(int t1,int t2){
	return sqrt((x[t1]-x[t2])*(x[t1]-x[t2])+(y[t1]-y[t2])*(y[t1]-y[t2]));
}
int main (){
	scanf ("%lf%lf%lf%lf",&x[1],&y[1],&x[2],&y[2]);
	scanf ("%d",&n);
	for (int i=1;i<=n;i++) scanf ("%lf%lf%lf",&x[i+2],&y[i+2],&r[i+2]);
	for (int i=1;i<=n+2;i++)
		for (int j=i+1;j<=n+2;j++)
			addedge(i,j,max(dist(i,j)-r[i]-r[j],0.0));
	dijkstra();
	printf ("%.12f",dis[2]);
	return 0;
}


Measured memory_bytes: 25840
import scala.io.StdIn.readInt

object Main {
  def scan(n:Int, cnt:Int, a:Array[Int]):Int = {
    if(n==1) cnt
    else if(a(n)!=0) a(n)
    else {
      val m = if(n%2==0)n/2 else n*3+1
      a(n) = scan(m,cnt+1,a)
      a(n)
    }
  }

  def main(args:Array[String]) = {
    var n = 0
    while( {n=readInt;n} != 0 ){
      println(scan(n,0,new Array[Int](1000001)))
    }
  }
}

Measured memory_bytes: 207628
def main():
    H, W = map(int, input().split())
    S = list(input() for _ in range(H))

    left = [[0] * W for _ in range(H)]
    right = [[0] * W for _ in range(H)]
    up = [[0] * W for _ in range(H)]
    down = [[0] * W for _ in range(H)]

    for i in range(H):
        for j in range(W):
            if S[i][j] == '.':
                if j == 0:
                    left[i][j] = 1
                else:
                    left[i][j] = left[i][j-1] + 1

    for i in range(H):
        for j in range(W-1,-1,-1):
            if S[i][j] == '.':
                if j == W-1:
                    right[i][j] = 1
                else:
                    right[i][j] = right[i][j+1] + 1

    for j in range(W):
        for i in range(H):
            if S[i][j] == '.':
                if i == 0:
                    down[i][j] = 1
                else:
                    down[i][j] = down[i-1][j] + 1

    for j in range(W):
        for i in range(H-1,-1,-1):
            if S[i][j] == '.':
                if i == H - 1:
                    up[i][j] = 1
                else:
                    up[i][j] = up[i+1][j] + 1

    ans = 0
    for i in range(H):
        for j in range(W):
            if S[i][j] == '#':
                continue
            ans = max(ans, left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3)

    print(ans)

main()

Measured memory_bytes: 179460
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
int main(){
  ios::sync_with_stdio(0);  cin.tie(0); cout<<setprecision(3); cout<<fixed;
  #ifdef DEBUG
  freopen("ip.txt","r",stdin);
  clock_t tStart = clock();
  #endif
  string s,t; cin>>s>>t; bool change=false;
  for(ll i=s.size()-t.size();i>=0;--i){
    string temp=s.substr(i,t.size()); bool same=true;
    for(ll j=0;j<temp.size();++j) if(temp[j]!='?' && temp[j]!=t[j]) same=false;
    if(same){
      change=true;
      for(ll k=0;k<t.size();++k){
        s[i+k]=t[k];
      }
      break;
    }
  }
  if(change) for(ll i=0;i<s.size();++i) {if(s[i]=='?') cout<<'a'; else cout<<s[i];}
  else cout<<"UNRESTORABLE";

  #ifdef DEBUG
	cout<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)<<"s.\n";
	#endif
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
struct p
{
    char s[20];
    int score;
    int num;
}a[200];
int cmp(p a,p b)
{
    if(strcmp(a.s,b.s)==0)
    {
        return a.score>b.score;
    }
    else
        if(strcmp(a.s,b.s)<0)
        return 1;
    return 0;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%s%d",a[i].s,&a[i].score);
        a[i].num=i+1;
    }
    sort(a,a+n,cmp);
    for(int i=0;i<n;i++)
        printf("%d\n",a[i].num);
    return 0;
}


Measured memory_bytes: 128
n = int(input())
data = []
for i in range(3):
    data.append(list((map(lambda x: int(x), input().split()))))


content_plus = 0

for i in range(n):
    if i == 0:
        pass
    else:
        if data[0][i-1]+1 == data[0][i]:
            content_plus = content_plus + data[2][data[0][i-1]-1]


def sum(list):
    lsum = 0
    for i in range(len(list)):
        lsum = lsum+list[i]
    return lsum

print(sum(data[1])+content_plus)




Measured memory_bytes: 3064
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var pi = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var qi = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            Func<IEnumerable<int>, long> func = items =>
            {
                var count = items.Count();
                var copiedItems = items.ToList();
                copiedItems.Sort();
                var index = 0L;
                for (var i = 0; i < count - 1; i++)
                {
                    var k = count - i - 1;
                    var val = items.ElementAt(i);
                    var region = PermutationCount(k, k) * (copiedItems.IndexOf(val));
                    copiedItems.Remove(val);
                    index += region;
                }
                return index;
            };
            Console.WriteLine(Math.Abs(func(pi) - func(qi)));
        }

        static long PermutationCount(int n, int k)
        {
            if (n < k) throw new ArgumentException();
            long result = n;
            for (var i = 1; i < k; i++)
                result *= (n - i);
            return result;
        }
    }
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
  }*/

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

  vi a(n);
  rep(i, 0, n) cin >> a[i];

  int mi = inf, ma = -inf;
  rep(i, 0, n){
    chmin(mi, a[i]);
    chmax(ma, a[i]);
  }

  if(ma-mi >= 2){
    cout << "No" << endl;
    return 0;
  }

  if(ma-mi == 0){
    bool ok = true;
    rep(i, 0, n) if(a[i] != n-1) ok = false;
    if(ok){
      cout << "Yes" << endl;
      return 0;
    }

    ok = true;
    rep(i, 0, n) if(2*a[i] > n) ok = false;
    if(ok){
      cout << "Yes" << endl;
      return 0;
    }

    cout << "No" << endl;
  }else{
    int alone = 0;
    rep(i, 0, n) if(a[i] == ma-1) alone++;
    if(alone < ma and 2*(ma-alone) <= n-alone){
      cout << "Yes" << endl;
      return 0;
    }
    
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
const int maxn=5e3+10,mod=1e9+7;
int n,u,v,g[maxn],tmp[maxn],siz[maxn],f[maxn][maxn];
vector <int> to[maxn];
inline long long read(){
	long long x=0,f=1;
	char c;
	do{c=getchar();if(c=='-') f*=-1;}while(!isdigit(c));
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
	return x*f;
}
void Dfs(int now,int fa){
	siz[now]=1;
	f[now][1]=1;
	int sizz=to[now].size();
	for(int i=0;i<sizz;i++){
		int v=to[now][i];
		if(v==fa) continue;
		Dfs(v,now);
		for(int j=0;j<=siz[now];j++){for(int k=0;k<=siz[v];k++){(tmp[j+k]+=1ll*f[now][j]*f[v][k]%mod)%=mod;}}
		siz[now]+=siz[v];
		for(int j=0;j<=siz[now];j++){f[now][j]=tmp[j];tmp[j]=0;}
	}
	for(int i=1;i<=siz[now];i++){(f[now][0]+=(mod-1ll*f[now][i]*g[i]%mod))%=mod;}
}
int main(){
	n=read();
	g[0]=1;g[1]=0;
	for(int i=2;i<=n;i++){g[i]=1ll*g[i-2]*(i-1)%mod;}
	for(int i=1;i<n;i++){
		u=read();v=read();
		to[u].push_back(v);to[v].push_back(u);
	}
	Dfs(1,0);
	printf("%lld\n",(mod-f[1][0])%mod);
	return 0;
}

Measured memory_bytes: 97536
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
#define OUT(n) cout << (n) << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    string s; cin >> s;
    ll ans = 0;
    ll mx = 0;
    ll cnt = 0;
    char prev = '0';
    REP(i,s.size()) {
        if (prev != s[i]) {
            if (s[i] == '<') {
                mx = max(mx,cnt);
                ans += cnt * (cnt-1) / 2;
                ans += mx;
                cnt = 1;
                //cerr << ans << endl;
            } else {
                ans += cnt * (cnt-1) / 2;
                mx = cnt;
                cnt = 1;
                //cerr << ans << endl;
            }
        } else {
            cnt++;
        }
        prev = s[i];
    }
    if (s.back() == '>') {
        mx = max(mx,cnt);
        ans += cnt * (cnt-1) / 2;
        ans += mx;
    } else {
        ans += cnt * (cnt+1) / 2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1172
<?php
//error_reporting(0);
//$H = trim(fgets(STDIN));
list($H,$N) = explode(" ",trim(fgets(STDIN)));
//$P = explode(" ",trim(fgets(STDIN)));
//$H = array_map('intval',explode(" ",trim(fgets(STDIN))));
//function chmax(&$a,$b) {if ($a<$b){$a=$b;return true;}return false;}
//function chmix(&$a,$b) {if ($a>$b){$a=$b;return true;}return false;}

$N=(int)$N;
$H=(int)$H;
$dp = array_fill($dp,$H+1,1001001001);
$dp[0]=0;
for($i=0;$i<$N;$i++) {
  list($a,$b) = explode(" ",trim(fgets(STDIN)));
  $a = (int)$a;
  $b = (int)$b;
  for($j=0;$j<$H;$j++) {
    $nj = min($j+$a,$H);
    $dp[$nj]=min($dp[$nj],$dp[$j]+$b);
  }
}
printf("%d\n",$dp[$H]);

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

large e(large x) { return x * x * x * x * x; }

int main() {
    large x;
    cin >> x;

    for (large A = -1000; A <= 1000; A++) {
        for (large B = -1000; B <= 1000; B++) {
            if (e(A) - e(B) == x) {
                cout << A << " " << B << "\n";
                return 0;
            }
        }
    }

    cout << x;
    return 0;
}


Measured memory_bytes: 3636
<?php
   $array = explode(" ",trim(fgets(STDIN)));
   $s = trim(fgets(STDIN));
   $ans = "";
   $i = 0;
 
   while($i < $array[0] ){
      $chage_num = (int)$array[1] - 1;
      if($i == $chage_num)
      {
         $ans .= strtolower($s[$i]);
      }
      else
      {
         $ans .= $s[$i];
      }
 
      $i++;
   }
 
   echo $ans;
   echo "\n";


Measured memory_bytes: 4604
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');
const args: string[][] = input.split('\n').map(l => l.split(' '));

const x = parseInt(args[0][0]);

const f = (a: number, b: number) => Math.pow(a, 5) - Math.pow(b, 5);

let [a, b] = [0, 0];
let tmp = 1;
while (f(a, b) !== x) {
    if (tmp % 2 === 1) {
        for (let i = 1; i <= tmp; i++) {
            [a, b] = [a + 1, b];
            if (f(a, b) === x) break
        }

        if (f(a, b) === x) break

        for (let i = 1; i <= tmp; i++) {
            [a, b] = [a, b - 1];
            if (f(a, b) === x) break
        }
    } else {
        for (let i = 1; i <= tmp; i++) {
            [a, b] = [a - 1, b];
            if (f(a, b) === x) break
        }

        if (f(a, b) === x) break

        for (let i = 1; i <= tmp; i++) {
            [a, b] = [a, b + 1];
            if (f(a, b) === x) break
        }
    }

    tmp++;
}

console.log(`${a} ${b}`);



Measured memory_bytes: 36996
#include<bits/stdc++.h>
using namespace std;
int main(){
    int team;
    cin >> team;
    vector<int>point(team,0);
    for(int i = 0;i < team*(team-1)/2;i++){
        int home,away;
        int hpo,apo;
        cin >> home;
        cin >> away;
        cin >> hpo;
        cin >> apo;
        if(hpo > apo){
            point[home-1]+=3;
        }
        else if(hpo < apo){
            point[away-1]+=3;
        }
        else{
            point[home-1]++;
            point[away-1]++;
        }
    }
    vector<int>runk;
    runk = point;
    sort(runk.begin(),runk.end());
    for(int i = 0;i < team;i++){
        int R;
        for(int j = team-1;j >= 0;j--){
            if(point[i] == runk[j]){
                R = team-j;
                break;
            }
        }
        cout << R << endl;
    }
    return 0;
}

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

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

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

const long long INF = 1LL << 60;

int main()
{
  int N;
  cin >> N;
  vector<long long int> h(N);
  for (int i = 0; i < N; i++)
  {
    cin >> h[i];
  }

  long long dp[100010];

  // 初期化（最小化問題なのでINFに初期化）
  for (int i = 0; i < 100010; i++)
  {
    dp[i] = INF;
  }

  // 初期条件
  dp[0] = 0;

  for (int i = 0; i < N; i++)
  {
    chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
    if (i > 1)
      chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
  }

  cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

/*
  What if this problem were DP on Tree?
  And we actually want to calculate how many paths pass through u (for every u)
*/

const int maxN = 2e5; int n;
int colors[maxN]; lli ans[maxN];
int colorCnt[maxN];
vector<int> tree[maxN];

int subtreeSize[maxN];
void dfs1(int u = 0, int prv = -1)
{
  subtreeSize[u] = 1;
  for (int v: tree[u])
    if (v != prv)
    {
      dfs1(v, u);
      subtreeSize[u] += subtreeSize[v];
    }
}

lli toAdd(int branchSize)
{
  return 2LL*branchSize + (lli)branchSize*(n - branchSize - 1);
}
int colorSubtree[maxN]; int hadAbove[maxN];
void dfs2(int u = 0, int prv = -1)
{
  ans[colors[u]] += 2; // path with only u (times 2 because we will divide by 2 later)

  if (prv != -1) // parent as a child
    ans[colors[u]] += toAdd(n - subtreeSize[u]);

  int beforeAll = colorSubtree[colors[u]];

  hadAbove[colors[u]]++;

  for (int v: tree[u])
    if (v != prv)
    {
      // if (hadAbove[colors[v]] == 0)
      // ans[colors[v]] -= 2LL * colorSubtree[colors[v]] * subtreeSize[v];
      DEBUG printf("left %d | %d - %d = %lld\n", colors[v] + 1, u + 1, v + 1, 2LL * colorSubtree[colors[v]] * subtreeSize[v]);

      int before = colorSubtree[colors[u]], bf = colorSubtree[colors[v]];
      hadAbove[colors[v]]--;
      dfs2(v, u);
      int after = colorSubtree[colors[u]], af = colorSubtree[colors[v]];

      ans[colors[u]] += toAdd(subtreeSize[v]);

      ans[colors[u]] -= 2LL * (after - before) * (n - subtreeSize[v] - before); // but you still need to count the ones the have passed before you (not only below)
      DEBUG printf("down %d | %d - %d = %lld\n", colors[v] + 1, u + 1, v + 1, 2LL * (after - before) * (n - subtreeSize[v] - before));
      // if (bf) ans[colors[v]] -= (af - bf) * subtreeSize[v] >> 1LL;
      // ans[colors[v]] -= 2LL * (subtreeSize[v] - (af - bf) + 1) * (bf);
    }
  ans[colors[u]] -= 2LL * beforeAll * subtreeSize[u];

  colorSubtree[colors[u]] = beforeAll + subtreeSize[u];
}

int main()
{
  int t = 0;
  while (scanf("%d", &n) != EOF)
  {
    if (t++) printf("----------------------\n");
    for (int i = 0; i < n; i++) tree[i].clear(), ans[i] = 0, colorSubtree[i] = 0, hadAbove[i] = 0;

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

    for (int i = 1; i < n; i++)
    {
      int u, v; scanf("%d %d", &u, &v); u--, v--;
      tree[u].push_back(v), tree[v].push_back(u);
    }

    dfs1();
    dfs2();

    for (int i = 0; i < n; i++)
      printf("%lld\n", ans[i] >> 1LL);
  }
  return 0;
}

Measured memory_bytes: 38952
import scala.io.StdIn

object Main extends App{

  val line = StdIn.readLine().split(" ").map(_.toInt).toList.splitAt(2)

  def solve(input: (List[Int], List[Int])): String = {
    val result = input._1.sum - input._2.sum

    if(result > 0){
      "Left"
    } else if (result < 0){
      "Right"
    } else {
      "Balanced"
    }
  }

  println(solve(line))
}



Measured memory_bytes: 25660
#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define mem(i, j) memset(i, j, sizeof(i))
#define rep(i, j, k) for(int i = j; i <= k; i++)
#define dep(i, j, k) for(int i = k; i >= j; i--)
#define pb push_back
#define make make_pair
#define INF INT_MAX
#define inf LLONG_MAX
#define PI acos(-1)
using namespace std;

const int N = 1e6 + 5;

const LL mod = 1e9 + 7;

LL ksm(LL a, LL b) { LL ans = 1LL; while(b) { if(b & 1) ans = ans * a % mod; a = a * a % mod; b >>= 1; }  return ans; }

char a[N];

void solve() {
    scanf("%s", a + 1);
    int len = strlen(a + 1);

    int L = 1, R = len;

    while(L < R) {
        if(a[L] != a[R]) {
            puts("No");
            return ;
        }
        L++; R--;
    }

    L = 1, R = (len - 1) / 2;
    while(L < R) {
        if(a[L] != a[R]) {
            puts("No");
            return ;
        }
        L++; R--;
    }

    L = (len + 3) / 2;
    R = len;

    while(L < R) {
        if(a[L] != a[R]) {
            puts("No");
            return ;
        }
        L++; R--;
    }

    puts("Yes");
    return ;

}


int main() {
//    int _; scanf("%d", &_);
//    while(_--) solve();

    solve();

    return 0;
}


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

#define    int               long long int
 #define    sp(x)                 setprecision(x)
#define    bp(x)           __builtin_popcount(x)
 #define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}
int p[200005],s[200005];
int fin(int a){
    if(a==p[a]) return a;
    return p[a]=fin(p[a]);
}
void mak(int a,int b){
    if(s[a]<s[b])   swap(a,b);
    s[a]+=s[b];
    p[b]=p[a];
}
int32_t main()
{
    fast
    int n,m,x,y,ans=0;
    set<int>ss;
    cin>>n>>m;
    f(i,0,n+1){
        s[i]=1;
        p[i]=i;
    }
    f(i,1,m){
        cin>>x>>y;
        x=fin(x);
        y=fin(y);
        if(x!=y)    mak(x,y);
    }
    f(i,1,n)    ans=max(ans,s[fin(i)]);
    cout<<ans;
}

Measured memory_bytes: 6780
read S
A=0
if [[ $S == *keyence ]]; then
	A=1
fi
if [[ $S == k*eyence ]]; then
	A=1
fi
if [[ $S == ke*yence ]]; then
	A=1
fi
if [[ $S == key*ence ]]; then
	A=1
fi
if [[ $S == keye*nce ]]; then
	A=1
fi
if [[ $S == keyen*ce ]]; then
	A=1
fi
if [[ $S == keyenc*e ]]; then
	A=1
fi
if [[ $S == keyence* ]]; then
	A=1
fi

if [ $A == 1 ]; then
	echo YES
else
	echo NO
fi



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


using namespace std;


using ll = long long;


mt19937 mt(736);


bool dfs(const vector<vector<int>> &gr, vector<bool> &used, vector<int> &rd, int v)
{
	if (used[v])
		return false;
	used[v] = true;

	for (auto it : gr[v])
		if (rd[it] == -1 || dfs(gr, used, rd, rd[it]))
		{
			rd[it] = v;

			return true;
		}
}


void Kuhn(const vector<vector<int>> &gr, vector<int> &rd)
{
	vector<bool> matched(gr.size());

	bool loop = true;

	while (loop)
	{
		loop = false;

		vector<bool> used(gr.size());

		for (int i = 0; i < gr.size(); i++)
			if (!matched[i])
				loop |= matched[i] = dfs(gr, used, rd, i);
	}
}


void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	int n, m;

	cin >> n >> m;

	vector<vector<int>> matr(n, vector<int>(m));

	for (auto &row : matr)
		for (auto &it : row)
		{
			cin >> it;
			it--;
		}


	vector<vector<int>> gr(n);


	for (int r = 0; r < n; r++)
		for (auto it : matr[r])
			gr[r].push_back(it / m);


	vector<vector<int>> transpone(m, vector<int> (n));

	for (auto &col : transpone)
	{
		vector<int> rd(n, -1);

		Kuhn(gr, rd);

		for (int i = 0; i < rd.size(); i++)
		{
			col[rd[i]] = i;

			gr[rd[i]].erase(find(gr[rd[i]].begin(), gr[rd[i]].end(), i));
		}
	}

	for (int r = 0; r < n; r++)
		for (int c = 0; c < m; c++)
		{
			int pos = 0;

			while (pos < matr[r].size() && matr[r][pos] / m != transpone[c][r])
				pos++;

			assert(pos < matr[r].size());

			transpone[c][r] = matr[r][pos];

			swap(matr[r][pos], matr[r].back());
			matr[r].pop_back();
		}


	for (int i = 0; i < n; i++)
	{
		for (const auto &row : transpone)
			cout << row[i] + 1 << ' ';
		cout << endl;
	}

	for (auto &row : transpone)
		sort(row.begin(), row.end());

	for (int i = 0; i < n; i++)
	{
		for (const auto &row : transpone)
			cout << row[i] + 1 << ' ';
		cout << endl;
	}
}


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

	cout << fixed;

#ifdef LOCAL
	auto st = clock();

	ifstream fin("../input.txt");

	solve(fin);

	cout << "clock: " << setprecision(4) << (clock() - st) / (double) CLOCKS_PER_SEC << endl;
#else
	solve();
#endif

	return 0;
}


Measured memory_bytes: 512
while true
  n, m = gets.split(' ').map(&:to_i)
  break if n == 0 && m == 0
  results = []
  prices = gets.split(' ').map(&:to_i)
  (0..n-1).each do |i|
    (0..i-1).each do |j|
      sum = prices[i] + prices[j]
      results.push(sum) if sum <= m
    end
  end
  puts results.empty? ? 'NONE' : results.max
end

Measured memory_bytes: 24480
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
 
typedef long long ll;
 
int f(ll x){
  int ret = 0;
  while(x){
    x/=10; ret++;
  }
  return ret;
}
 
int main(){
  ll n;
  cin>>n;
  int ans = 252521;
  for(ll x=1;x*x<=n;x++){
    if(n%x!=0)continue;
    ll y = n/x;
    ans = min(ans, max(f(x), f(y)));
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
using System;

 public class AtCorder
 {
   static void Main(string[] args)
   {
     string input = Console.ReadLine();
     string[] inputs = input.Split(' ');
     int result =Give(inputs[0], inputs[1]);
     Console.WriteLine(result);
   }
   
  public static int Give(string args1, string args2)
  {
    int num = int.Parse(args1);
    int peoples = int.Parse(args2);
    // 分ける
    int min = num/peoples;

    int remainder = num%peoples;

    if(remainder > 0)
    {
      return 1;
    }
    else
    {
      return 0;
    }
  }
}

Measured memory_bytes: 11092
import sys
import socket
 
if socket.gethostname() in ['N551J', 'F551C']:
    sys.stdin = open('c1.in')
 
 
def read_int_list():
    return list(map(int, input().split()))
 
 
def read_int():
    return int(input())
 
 
def read_str_list():
    return input().split()
 
 
def read_str():
    return input()
 
 
def solve():
    n = read_int()
    s = read_str()

    #同じ文字が連続する場合、redとblueに振り分ける順番が変わってもそのあとの判定に影響を与えないので、計算結果をcasheに格納して同一計算を省略する
    cache = {}

    #1文字ずつredとblueに振り分けながら再帰的に関数読み出しを繰り返し、条件を満たしながらredとblue双方の長さが2nになったものの数を数える
    #探索数は基本的に2のn乗でスケールするが、条件に当てはまらないような塗分けは排除しながら進んでいく（再帰読み出しを行わず戻り値0を返す）
    def rec(red, blue):
        #一度探索したことのある文字列は即答する
        if (red, blue) in cache:
            return cache[(red, blue)]

        nr = len(red)
        nb = len(blue)

        #redとblueのどちらかが長さnを超えていたら関数は0を返す
        if nr > n or nb > n:
            res = 0
            cache[(red, blue)] = res
            return res
        #長さの合計がちょうど2nなら（上記と合わせると、両方の長さがnずつならば関数は1を返す）
        if nr + nb == 2 * n:
            res = 1
            cache[(red, blue)] = res
            return res
        c = s[nr + nb]
        res = 0

        #文字列sの一番左の文字から始め、1文字ずつredの左側もしくはblueの右側に格納していく
        #nr+nbがn未満の場合無条件で再帰的関数読み出しを行う
        #nr+nbがnを超えた場合、新しく追加する文字cがこれまでのred, blueと整合性が取れている場合のみに再帰的関数読み出しを行う
        if nr + nb < n or (nr < n and c == blue[nr - n]):
            res += rec(red + c, blue)
        if nr + nb < n or (nb < n and c == red[n - 1 - nb]):
            res += rec(red, c + blue)

        
        cache[(red, blue)] = res
        return res

    res2 = rec('', '')
    return res2
 
 
def main():
    res = solve()
    print(res)
 
 
if __name__ == '__main__':
    main()


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

using namespace std;

using ll = long long;
using p  = pair<ll, ll>;

ll dfs(ll node, vector<vector<ll> >& G, vector<bool> used) {
    used[node] = true;
    
    bool end = true;
    for (auto b : used) {
        end &= b;
    }
    if (end) {
        return 1;
    }
    
    ll ans = 0;
    for (auto n : G[node]) {
        if (!used[n]) {
            ans += dfs(n, G, used);
        }
    }
    
    return ans;
}

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N, M;
    cin >> N >> M;
    vector<bool> used(N, false);
    vector<vector<ll> > G(N, vector<ll>());
    
    for (ll i = 0; i < M; i++) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    cout << dfs(0, G, used) << endl;

    return 0;
}



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

int main() {
  int n,ans=1;
  cin >> n;
  vector<int> p(n);
  REP(i,n) cin >> p[i];

  int mi = p[0];
  for (int i = 1; i < n; i++) {
    if (mi >= p[i]) { ans++; mi = p[i]; }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#https://atcoder.jp/contests/code-festival-2017-qualb/tasks/code_festival_2017_qualb_c
from collections import deque
N,M=map(int,input().split())
G=[[] for i in range(N)]
for i in range(M):
	a,b = map(int,input().split())
	G[a-1].append(b-1)
	G[b-1].append(a-1)
visit=[False]*N
color=[-1]*N
que=deque()

def nibu():
	que.append(0)
	color[0]=1

	while que:
		p=que.pop()
		visit[p]=True
		for q in G[p]:
			if visit[q] and color[q]==color[p]:
				return False
			elif not visit[q]:
				que.append(q)
				color[q]=(color[p]+1)%2
	return True

if nibu():
	B=color.count(0)
	W=color.count(1)
	ans=B*W-M
else:
	ans = (N*(N-1))//2 -M
print(ans)

Measured memory_bytes: 89180
#
# File    : A.rb
# Author  : Kazune Takahashi
# Created : 2/24/2019, 8:54:51 PM
# Powered by Visual Studio Code
#

s = gets.chomp
if s <= "2019/04/30"
  puts "Heisei"
else
  puts "TBD"
end

Measured memory_bytes: 3836
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.Nikkei2019
{
    class B
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            string a = Read();
            string b = Read();
            string c = Read();
            int res = 0;
            for(int i = 0; i < n; i++)
            {
                var dict = new Dictionary<char, bool>();
                dict.Add(a[i], true);
                if (!dict.ContainsKey(b[i])) dict.Add(b[i], true);
                if (!dict.ContainsKey(c[i])) dict.Add(c[i], true);
                if (dict.Count == 1) res += 0;
                if (dict.Count == 2) res += 1;
                if (dict.Count == 3) res += 2;
            }
            Console.WriteLine(res);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

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

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  vector<int> n(3);
  rep(i,3) cin >> n[i];
  sort(n.begin(), n.end());
  cout << n[0] << " " << n[1] << " " << n[2] << endl;
}






Measured memory_bytes: 3140
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var a,b,c int
    fmt.Scan(&a,&b,&c)
    ans := abs32(a-b) + abs32(a-c) + abs32(b-c) - max32(abs32(a-b),max32(abs32(a-c),abs32(b-c)))
    fmt.Println(ans)
}





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

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
N = gets.to_i
uvw_list = (N - 1).times.map { gets.split.map(&:to_i) }
g = {}
uvw_list.each do |(u, v, w)|
  u -= 1
  v -= 1
  g[u] ||= []
  g[u].push([v, w])
  g[v] ||= []
  g[v].push([u, w])
end

def bfs(g, v, w_table)
  w_table[v] = 0
  queue = []
  queue.push([v, -1])
  while !queue.empty?
    v, parent = queue.shift
    w = w_table[v]
    g[v].each do |(v2, w2)|
      next if v2 == parent
      w_table[v2] = w + w2
      queue.push([v2, v])
    end
  end
end
w_table = {}
bfs(g, 0, w_table)
N.times do |i|
  puts w_table[i] % 2
end


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

// Union-Find木
struct UnionFind {
  vector<int> par;
  
  // Constructor
  UnionFind(int n): par(n) {
    for (int i = 0; i < n; i++) par[i] = i;
  }
  
  // n要素で初期化
  void init(int n) {
    par.resize(n);
    for (int i = 0; i < n; i++) par[i] = i;
  }
  
  // 根の検索
  int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
  }
  
  // xとyの属する集合を併合
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return false;
    par[x] = y;
    return true;
  }
  
  // xとyが同じ集合に属するか
  bool same(int x, int y) {
    return find(x) == find(y);
  }
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, m;
  cin >> n >> m;
  
  UnionFind UF(n + m + 1);
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int l;
      cin >> l;
      UF.unite(i, n + l);
    }
  }
  
  bool flag = true;
  for (int i = 1; i < n; i++) {
    if (!UF.same(0, i)) flag = false;
  }
  
  if (flag) cout << "YES\n";
  else cout << "NO\n";
}

Measured memory_bytes: 1152
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#include <math.h>
#include <bits/stdc++.h>
#define ull unsigned long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
using namespace std;

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



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

int main() {
    long long int A,B,C,K;
    long long int new_A, new_B, new_C, new_K;
    long long int a, b, c, d, e, f, g, h, i, j, k, l, m, n;

    cin >> a;
    cin >> b;

    if ((a*b)%2 == 1) {
        cout << "Odd" << endl;
    }
    else {
        cout << "Even" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

R = INT()
print(R*2*math.pi)

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

int n, sz[200005], mod = 1e9+7;
vector <int> g[200005];
long long ans[200005], inv[200005];

void build(int x){
    inv[1] = inv[0] = 1;
    for(int i = 2 ; i <= x; i++){
        inv[i] = (mod - mod / i * inv[mod % i] % mod) % mod;
    }
}
int dfs(int x, int pre){
    sz[x] = 1;
    for (int i:g[x]){
        if (i == pre) continue;
        sz[x] += dfs(i, x);
    }
    return sz[x];
}
void dfs2(int x, int pre){
    for (int i:g[x]){
        if (i == pre) continue;
        ans[i] = ans[x]*sz[i]%mod*inv[n-sz[i]]%mod;
        dfs2(i, x);
    }
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    int x, y;
    for (int i = 1; i < n; i++){
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    dfs(1, 0);
    build(n);
    ans[1] = 1;
    for (int i = 1; i <= n; i++){
        ans[1] *= i;
        ans[1] %= mod;
        ans[1] *= inv[sz[i]];
        ans[1] %= mod;
    }
    dfs2(1, 0);
    for (int i = 1; i <= n; i++){
        cout << ans[i] << "\n";
    }
}


Measured memory_bytes: 17908
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

int main()
{
  int a,b,t;
  cin>>a>>b>>t;
  cout<<(t/a)*b<<endl;
}


Measured memory_bytes: 256