akhauriyash/Code-Regression huggingface dataset:
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func Solve() {
  N := NextLine()
  var K int
  NextInt(&K)
  L := len(N)
  ans := 0
  C := make([][]int, len(N))
  for i := range C {
    C[i] = make([]int, 4)
    C[i][0] = 1
    C[i][1] = 9 * (L - 1 - i)
    C[i][2] = 81 * (L - 1 - i) * (L - 2 - i) / 2
    C[i][3] = 729 * (L - 1 - i) * (L - 2 - i) * (L - 3 - i) / 6
  }
  fixed := 0
  for i, s := range N {
    n := int(s) - int('0')
    if K < fixed { continue }
    if n < 1 { continue }
    ans += C[i][K - fixed]
    if fixed < K { ans += (n - 1) * C[i][K - fixed - 1] }
    fixed++
  }
  if K == fixed { ans++ }
  Write(ans)
  return
}

func main() {
  Solve()
  Output()
}

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

int main() {
  constexpr int n = 3;
  vector<int> a(n);
  for (auto &x : a) cin >> x;
  cout << *max_element(begin(a), end(a)) - *min_element(begin(a), end(a)) << endl;
  return 0;
}


Measured memory_bytes: 256
s=input()
s_rev=s[::-1]

mod_count=[0]*2019
mod_count[0]=1
d=1
num=0

for char in s_rev:
  num=num+int(char)*d
  num=num%2019
  d=d*10
  d=d%2019
  #print(type(num),type(mod_count))
  mod_count[num]=mod_count[num]+1

ans=0
for cnt in mod_count:
  ans=ans+cnt*(cnt-1)/2
  
print(int(ans))

Measured memory_bytes: 9152
#include<stdio.h>
#define N -1
#define MAX 100001

struct Node{
  int p,l,r;
};

struct Node T[MAX];
int A[MAX];

int depth(int);
int sibling(int);
int degree(int);
int height(int);

main(){
  int parent;
  int n;
  int i;
  
  scanf("%d",&n);
  
  for(i=0; i < n; i++){
    T[i].p = T[i].l = T[i].r = N;
  }
  
  for(i = 0; i < n; i++){
    scanf("%d",&parent);
    scanf("%d %d",&T[parent].l,&T[parent].r);
    T[T[parent].l].p = parent;
    T[T[parent].r].p = parent;
  }
  
  for(i = 0; i < n; i++){
    A[i] = depth(i);
  }
  
  for(i = 0; i<n; i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,T[i].p, sibling(i), degree(i),A[i],height(i));    
    if(T[i].p == N) printf("root\n");
    else if(T[i].l != N || T[i].r != N)printf("internal node\n");
    else printf("leaf\n");
  } 
  return 0;
}


int depth(int i){
  int count = 0;
  while(T[i].p !=N){
    count++;
    i = T[i].p;
  }
  return count;
}


int sibling(int i){
  if(T[i].p == N) return N;
  if(T[T[i].p].r == i) return T[T[i].p].l;
  if(T[T[i].p].l == i) return T[T[i].p].r;
}

int degree(int i){
  int count = 0;
  if(T[i].l != N) count++;
  if(T[i].r != N) count++;
  return count;
}

int height(int i){
  int hl = 0;
  int hr = 0;
  if(T[i].l != N) hl = height(T[i].l) + 1;
  if(T[i].r != N) hr = height(T[i].r) + 1;
  
  if(hl < hr) return hr;
  else return hl;
}

Measured memory_bytes: 616
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn main() {
    let st = readn::<isize>(" ");
    let sx = st[0];
    let sy = st[1];
    let tx = st[2];
    let ty = st[3];

    let mut ans = "".to_string();
    for _ in 0..(ty-sy) {
        ans += "U";
    }
    for _ in 0..(tx-sx) {
        ans += "R";
    }
    for _ in 0..(ty-sy) {
        ans += "D";
    }
    for _ in 0..(tx-sx) {
        ans += "L";
    }
    ans += "L";
    for _ in 0..(ty-sy+1) {
        ans += "U";
    }
    for _ in 0..(tx-sx+1) {
        ans += "R";
    }
    ans += "D";
    ans += "R";
    for _ in 0..(ty-sy+1) {
        ans += "D";
    }
    for _ in 0..(tx-sx+1) {
        ans += "L";
    }
    ans += "U";

    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()

int main() {
  //
  ll x, y;
  cin >> x >> y;
  int ans = 0;
  while (x <= y) {
    x = x << 1;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
public class Eratosthenes
{
	public static void Main(string[] args)
	{
		int count = int.Parse(Console.ReadLine());
		int sum = 0;//?´???°???????¨?
		
		for (int i = 0; i < count; i++)
		{
			//?????????????±????????????????
			int target = int.Parse(Console.ReadLine());
			//????????????
			//target???3??\????????£???????????§??????????????????if?????????????????\????????????
			
			 if ((target > 3) & ((target % 2) != 0)) 
			{
				
				int j = 3;
				do{				
					if (target % j == 0)
					{//?´???°??§?????????
						break;
					}
					
					
					j+=2;
				}while(j<=target/j);
				if (j  > target / j)
					{
						//break?????????????????´????????????????????\???
						sum ++;
						
					}
				
			}
			else if(target==2|target==3)
			{//???????????¶??§????????§??????????????????????????§?????????????????????????????¶???????????????????????§???????????????????????????????????????
				sum++;
			}
		}
		
		Console.WriteLine(sum);
	}
}

Measured memory_bytes: 9092
#include<stdio.h>

	int main(){
		
		long long int x=1;
		int n,i;
		
		scanf("%lld",&n);
		
		for(i=1;i<=n;i++){
			x*=(long long)i;
		}
	
		printf("%lld\n",x);
	
	return 0;
}

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

const ll mod=998244353;
ll mu(ll a,ll b){
  return (ll)a*b%mod;
}
ll ad(ll a,ll b){
  if((a+=b)>=mod)a-=mod;
  return a;
}
ll pw(ll a,ll b,ll c=1LL){
  for(;b;b>>=1,a=mu(a,a))if(b&1)c=mu(c,a);
  return c;
}
ll dv(ll a,ll b){
  return mu(a,pw(b,mod-2));
}

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

  int n;
  cin >> n;
  ll d[n];
  rep(i,n){
    cin >> d[i];
  }
  if(d[0]!=0){
    cout << 0 << endl;
    return 0;
  }
  ll count[n];
  rep(i,n)count[i]=0;
  rep(i,n){
    if(d[i]==0 && i!=0){
      cout << 0 << endl;
      return 0;
    }
    ++count[d[i]];
  }
  bool ok=true;
  bool end=false;
  ll ans=1;
  rep1(i,n-1){
    if(end){
      if(count[i]==0) continue;
      else{
	ok=false;
	break;
      }
    }
    if(i==n-1){
      break;
    }
    else if(count[i+1]==0){
      end=true;
    }
    else{
      ans = mu(ans,pw(count[i],count[i+1]));
    }       
  }
  if(!ok){
    cout << 0 << endl;
  }
  else {
    cout << ans << endl;
  }
  
  return 0;
    

}


Measured memory_bytes: 2300
N, M = map(int, input().split())

v = []
w = []

for i in range(N):
    vv, mm = map(int, input().split())
    v.append(vv); w.append(mm)

"""
つまり、
dp[i][vv][ww] = {max(dp[i+1][vv+v[i]][ww-w[i]] | dp[i+1][vv][ww]}
となる？
価値を保存するから vv が消えると
dp[i][ww] = {max(dp[i+1][ww-w[i]]+v[i] | dp[i+1][ww]}
となる。
これは、実質、価値であるから
"""

def rec(i, vv, ww):
    if i == N:
        return vv
    ans = 0
    # 入れるパターン
    if ww >= w[i]:
        ans = rec(i+1, vv+v[i], ww-w[i])
    # 入れないパターン
    ans = max(ans, rec(i+1, vv, ww))
    return ans

dp = [[0 for j in range(M+1)] for i in range(N+1)]
for i in range(N-1, -1, -1):
    for j in range(M+1):
        if j-w[i] >= 0:
            dp[i][j] = max(dp[i+1][j-w[i]]+v[i], dp[i+1][j])
        else:
            dp[i][j] = dp[i+1][j]
print(dp[0][M])



Measured memory_bytes: 42276
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().run();
	}
	char[][] map;
	int count = 0;
	int w;
	int h;
	public void run(){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			w = scan.nextInt();
			h = scan.nextInt();
			if(w == 0 && h == 0){
				break;
			}
			map = new char[h][w];
			for(int i = 0;i < h;i++){
				map[i] = scan.next().toCharArray();
			}
			count = 0;
			//boolean fl = false;
			for(int i = 0;i < h;i++){
				for(int j = 0;j < w;j++){
					if(map[i][j] == '@'){
						count++;
						map[i][j] = '#';
						if(i != 0){
							searchTile(i-1,j);
						}
						if(i != h-1){
							searchTile(i+1,j);
						}
						if(j != 0){
							searchTile(i,j-1);
						}
						if(j != w-1){
							searchTile(i,j+1);
						}
						//fl = true;
						break;
					}
				}
				//if(fl){
				//	break;
				//}
			}
			System.out.println(count);
		}
	}
	public void searchTile(int y,int x){
		if(map[y][x] == '#'){
			return;
		}
		count++;
		map[y][x] = '#';
		if(y != 0){
			searchTile(y-1,x);
		}
		if(y != h-1){
			searchTile(y+1,x);
		}
		if(x != 0){
			searchTile(y,x-1);
		}
		if(x != w-1){
			searchTile(y,x+1);
		}
	}
}

Measured memory_bytes: 39224
import java.util.Scanner;

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

      while(true){

        int h = sc.nextInt();
        int w = sc.nextInt();

        if(h==0&&w==0){
          break;
        }

        for(int j = 0; j<h;j++){
          for(int i = 0; i<w;i++){
              if((i%2+j)%2==0){
                System.out.print("#");
              }else{
                System.out.print(".");
              }
          }

          System.out.println("");
        }

        System.out.println("");

      }

    } 
}


Measured memory_bytes: 35152
/*
  B - Checkpoints
  Contest 057
  Rakesh Kumar --> 20/08/2020
 */

#include <bits/stdc++.h>

using ll = long long int;

struct Point {
    Point(ll a, ll b) : x(a), y(b) {}
    ll x = 0;
    ll y = 0;
};

inline ll dist(const std::shared_ptr<Point>& a,
               const std::shared_ptr<Point>& b) {
    return std::abs(a->x - b->x) + std::abs(a->y - b->y);
}

inline int pos(const std::shared_ptr<Point>& pos,
               const std::vector<std::shared_ptr<Point>>& checkpoints) {
    ll min = dist(pos, checkpoints[0]);
    int p = 1;
    for (std::size_t i = 1; i < checkpoints.size(); ++i) {
        const ll d = dist(pos, checkpoints[i]);
        if (d < min) {
            p = i + 1;
            min = d;
        }
    }
    return p;
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0); std::cout.tie(0);

    int n = 0, m = 0;
    std::cin >> n >> m;
    std::vector<std::shared_ptr<Point>> students;
    while (n--) {
        ll a = 0, b = 0;
        std::cin >> a >> b;
        students.emplace_back(new Point(a, b));
    }
    std::vector<std::shared_ptr<Point>> checkpoints;
    while (m--) {
        ll a = 0, b = 0;
        std::cin >> a >> b;
        checkpoints.emplace_back(new Point(a, b));
    }

    for (const std::shared_ptr<Point>& p : students)
        std::cout << pos(p, checkpoints) << std::endl;

    return 0;
}


Measured memory_bytes: 3640
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, N = MAP()

def f(x):
	return (A*x)//B-A*(x//B)

if N < B:
	print(f(N))
else:
	k = (N-B+1)//B
	print(f(B-1+k*B))


Measured memory_bytes: 10048
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main(){
  int n,a[100000],b[100000];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    b[n-1-i]=a[i];
  }
  map <int,int> x,y;
  vector <int> re;
  for(int i=0;i<n;i++){
    x[a[i]]++;
    y[b[i]]++;
    if(x==y) re.push_back(i+1);
  }
  for(int i=0;i<(int)re.size();i++){
    if(i) cout<<" ";
    cout<<re[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 8620
// AtCoder ABC125: D - Flipping Signs
// 2019.9.9 bal4u

#include <stdio.h>

typedef long long ll;

#if 1
int getchar_unlocked(void);
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {  // 整数の入力
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

#define INF 0x7fffffff

int main()
{
	int i, minus, mi, A, N; ll ans;
	
	N = in(); 
	minus = 0, ans = 0, mi = INF;
	for (i = 0; i < N; i++) {
		A = in();
		if (A < 0) minus++, A = -A;
		if (A < mi) mi = A;
		ans += A;
	}
	if (minus & 1) ans -= 2*mi;
	printf("%lld\n", ans);
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
	ll N, K; cin >> N >> K;
	vector<ll> A(N);
	for(int i = 0; i < N; i++) cin >> A[i];
	sort(A.begin(), A.end());
	ll left = 0, right = A[N - 1] + 1;
	ll centre, ans;
	while(right - left > 1) {
		centre = (left + right) / 2;
		ll cnt = 0;
		for(int i = 0; i < N; i++) cnt += ceil((double)A[i] / (double)centre) - 1;
		if(cnt > K) left = centre;
		else {
			ans = centre;
			right = centre;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4724
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int N,M;
  cin >> N >> M;
  vector<string> A(N);
  REP(i, N) cin >> A[i];
  vector<string> B(M);
  REP(i, M) cin >> B[i];
  
  int flag2 = 0;
  REP(i,N-M+1){
    REP(j,N-M+1){
      int flag=0;
      REP(k,M){
        REP(l,M){
          if(B.at(k).at(l)!=A.at(i+k).at(j+l)){
            flag=1;
          }
        }
      }
      if(flag==0){
        flag2 = 1;
        break;
      }
    }
    if(flag2==1){
      break;
    }
  }
  if(flag2==1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
n,a,b=map(int,input().split())
s=input()
ans=0
count=0
for i in range(n):
    if s[i]=="c":
        print("No")
        continue
    elif s[i]=="b":
        if count<b and ans<a+b:
            print("Yes")
            ans+=1
            count+=1
        else:
            print("No")
    else:
        if ans<a+b:
            print("Yes")
            ans+=1
        else:
            print("No")

Measured memory_bytes: 9304
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}

vector<ll> pw2(51,1);vector<ll> pw10(19,1);
ll high_order_bit(ll n){
    ll tmp=1,i=-1;
    while(tmp<=n){
        tmp*=2;
        i++;
    }
    if(n==0) return 0;
    else return i;
}
vector<ll> binary_expansion(ll n){
    vector<ll> B(high_order_bit(n)+1);
    ll tmp=n;
    for(ll i=high_order_bit(n);i>=0;i--){
        B[i]=tmp/pw2[i];
        tmp%=pw2[i];
    }
    return B;
}
vector<ll> divisor(ll x){
    vector<ll> div;
    for(int i=1;i*i<=x;i++){
        if(i*i!=x && x%i==0){
            div.pb(i);
            div.pb(x/i);
        }
        else if(x%i==0) div.pb(i);
    }
    return div;
}
vector<ll> vectorprime(ll x){
    vector<bool> is_prime(x+1);
    vector<ll> prime;
    rep(i,x+1) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    for(int i=2;i<=x;i++){
        if(is_prime[i]){
            prime.pb(i);
        }
        for(int j=i*2;j<=x;j+=i) is_prime[j]=false;
    }
    return prime;
}

int main(){
    {rep1(i,50) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    ll K; cin>>K;
    int A[33]={0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout<<A[K];
    
}

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

namespace ABC074A
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, A, s;

            N = int.Parse(Console.ReadLine());
            A = int.Parse(Console.ReadLine());

            s = N * N - A;

            Console.WriteLine(s);

            Console.ReadKey();
        }
    }
}


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

int main(){
  string s;
  cin >> s;
  int n=s.size();
  int c=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<i;j++){
      if(s.at(i)==s.at(j)){
        c++;
      }
    }
  }
  if(c==0){
    cout << "yes" << endl;
  }
  else{
    cout << "no" << endl;
  }
}

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

using namespace std;

struct Edge {
  int t,next;
  Edge() {}
  Edge(int a,int b):t(a),next(b) {}
};

Edge e[200005];
int head[100005],d[100005],rt1,rt2;

void dfs(int x,int fa) {
  for(int i=head[x];i;i=e[i].next)
    if (e[i].t!=fa) {
    	int u=e[i].t;
    	if (d[u]==2) dfs(u,x);
    	else if (u==rt1) {
    		puts("Yes");
    		exit(0);
		}
	}
}

int main() {
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=1;i<=m;i++) {
  	int x,y;
  	scanf("%d%d",&x,&y);
  	e[2*i-1]=Edge(y,head[x]);
  	head[x]=2*i-1;
  	e[2*i]=Edge(x,head[y]);
  	head[y]=2*i;
  	d[x]++;d[y]++;
  }
  for(int i=1;i<=n;i++)
    if (d[i]&1) {
    	puts("No");
    	return 0;
	}
  int cnt=0;
  for(int i=1;i<=n;i++)
    if (d[i]>=6) {
    	puts("Yes");
    	return 0;
	}
	else if (d[i]==4) cnt++;
  if (cnt<2) {
  	puts("No");
  	return 0;
  }
  if (cnt>2) {
  	puts("Yes");
  	return 0;
  }
  for(int i=1;i<=n;i++)
    if (d[i]==4) {
    	if (!rt1) rt1=i; else rt2=i;
	}
  dfs(rt1,0);
  puts("No");
  return 0;
}

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

int main(){
  string s;
  cin >> s;
  bool ans = true;
  if(s.size()%2 == 1) cout << "No" << endl;
  else{
    for(int i = 0; i < s.size(); i++){
      if(i%2 == 0 && s[i] != 'h') ans = false;
      if(i%2 == 1 && s[i] != 'i') ans = false;
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import math
import itertools
n = int(input())
x = list() 
y = list()
for i in range(n):
    a,b = map(int, input().split())
    x.append(a)
    y.append(b)
its = list()
for val in range(n):
    its.append(val)
it = list(itertools.permutations(its))
all = 0
for i in it:
    for j in range(1, len(i)):
        c = math.sqrt((x[i[j-1]]-x[i[j]])**2 + (y[i[j-1]]-y[i[j]])**2)
        all += c
all /= len(it)
print(all)



Measured memory_bytes: 8052
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>

int main()
{
	std::string S;
	
	std::cin >> S;
	
	int A = atoi(S.substr(0, 2).c_str());
	int B = atoi(S.substr(2, 2).c_str());

	bool yymm = (A >= 0 && A <= 99 && B >= 1 && B <= 12);
	bool mmyy = (B >= 0 && B <= 99 && A >= 1 && A <= 12);
	
	if (yymm && !mmyy)
		std::cout << "YYMM\n";
	else if (!yymm && mmyy)
		std::cout << "MMYY\n";
	else if (yymm && mmyy)
		std::cout << "AMBIGUOUS\n";
	else
		std::cout << "NA\n";
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int A[4];
	int B[2];
	int i;
	for(i=0;i<4;i++){
		scanf("%d", &A[i]);
	}
	for(i=0;i<2;i++){
		scanf("%d", &B[i]);
	}
	int m= 100;
	int x = 0;
	for(i=0;i<4;i++){
		if(m> A[i]){
			m= A[i];
			x= i;
		}
	} 
	int sum = 0;
	for(i=0;i<4;i++){
		if(i == x)continue;
		sum += A[i];
	}
	
	if(B[0] < B[1]){
		sum += B[1];
	}else{
		sum += B[0];
	} 
	printf("%d\n", sum); 
	return 0;
}


Measured memory_bytes: 2044
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

a,b=map(int,input().split())
s=input()
for i in range(a):
    if s[i]=="-":
        print("No")
        exit()
if s[a]!="-":
    print("No")
    exit()
for i in range(a+1,a+b+1):
    if s[i] == "-":
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3808
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef pair<int,int> P;

vector<P> ans;
int out[100005];
vector<int> g[100005];

int p[100005];
int ra[100005];


void dfs(int v, int prev) {
  for(int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    if(u != prev) {
      dfs(u,v);
      if(out[u] & 1) {
	ans.push_back(P(u,v));
	out[u]++;
      }
      else {
	ans.push_back(P(v,u));
	out[v]++;
      }
    }
  }
  return;
}

void init(int n) {
  for(int i = 0; i < n; i++) {
    p[i] = i;
    ra[i] = 0;
  }
}

int f(int x) {
  return p[x] == x ? x : (p[x] = f(p[x]));
}

bool un(int a, int b) {
  int x = f(a);
  int y = f(b);
  if(x == y) return false;

  if(ra[x] > ra[y]) {
    p[x] = y;
  }
  else {
    p[y] = x;
    if(ra[x] == ra[y]) ra[x]++;
  }
  return true;
}


int main() {
  int n,m;
  cin >> n >> m;
  init(n);
  vector<P> e(m);
  
  for(int i = 0; i < m; i++) {
    int a,b;
    cin >> a >> b;
    a--;b--;
    e[i] = P(a,b);
  }

  for(int i = 0; i < m; i++) {
    int v = e[i].first;
    int u = e[i].second;
    if(un(v,u)) {
      g[v].push_back(u);
      g[u].push_back(v);
    }
    else {
      ans.push_back(P(v,u));
      out[v]++;
    }
  }

  dfs(0,-1);

  for(int i = 0; i < n; i++) {
    if(out[i] & 1) {
      cout << -1 << endl;
      return 0;
    }
  }

  for(int i = 0; i < ans.size(); i++) {
    cout << ans[i].first + 1 <<" "<<ans[i].second + 1 << endl;
  }
}
    


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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; }

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

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

  char a;
  cin >> a;
  if(a >= 'a' && a <= 'z'){
    cout << "a" << endl;
  }else{
    cout << "A" << endl;
  }

  return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>

int main(void){
  int n;
  char s[101],t[101];
  scanf("%d\n",&n);
  scanf("%s %s",s,t);
  
  int i;
  for(i=0;i<=n-1;i++){
    printf("%c%c",s[i],t[i]);
  }
  
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main()
{
	ll n,a,b;
	cin>>n>>a>>b;
	ll ans=0;
	ans=n/(a+b)*a;
	ll p=n%(a+b);
	if(p<=a)
	ans+=p;
	else
	ans+=a;
	cout<<ans;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int dig(ll n){
	int ret = 0;
	while(n){
		ret++; n /= 10;
	}
	return ret;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	ll n; cin>>n;
	int ans = dig(n);
	for(ll a = 1; a*a <= n; a++){
		if(n%a == 0){
			ans = min(ans, max(dig(a), dig(n/a)));
		}
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int a, b, result;
  char s[101];
  scanf("%d %d", &a, &b);
  result = a*b;
  if(result%2==0){
      printf("Even\n");
  }else{
      printf("Odd\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 500005;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    ll n = s.length();
    PRINT(s.substr(0,n-8));
}


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

ll factorial_of(ll num){
    ll sum=1;
    for(int i=1;i<=num;i++){
        sum*=i;
    }
    return sum;
}

int main(){
    ll h,w;
    cin >> h >> w;
    ll ans;
    if((w==1)||(h==1)){
        cout << 1 << endl;
        return 0;
    }
    if(h%2==0){
        ans=h*w/2;
    }else{
        ll tmp;
        if(w%2==0){
            tmp=w/2;
        }else{
            tmp=w/2+1;
        }
        ans=(h-1)*w/2 + tmp;
        }
    cout << ans << endl;
}

Measured memory_bytes: 256
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):string|string[]=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):string|string[]=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let a = t.n()-t.n();
  t.o(a<0?0:a)
}
main()

Measured memory_bytes: 9420
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define Fi first
#define Se second
signed main(){
    int n;
    cin>>n;
    string s[200];
    int p[200];
    vector<pair<pair<string,int>,int>>vec;
    rep(i,n){
        cin>>s[i]>>p[i];
        vec.push_back(make_pair(make_pair(s[i],200-p[i]),i+1));
    }
    sort(vec.begin(),vec.end());
    rep(i,n){
        cout<<vec[i].Se<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
using namespace std;
int main(){
	int num, count = 0;
	int n, i;
	set<int> s;
	cin >> n;
	for(i = 0; i < n; i++){
		cin >> num;
		if(num>=1&&num<400){
			s.insert(s.begin(),1);
		}else if(num<800){
			s.insert(s.begin(),2);
		}else if(num<1200){
			s.insert(s.begin(),3);
		}
		else if(num<1600){
			s.insert(s.begin(),4);
		}
		else if(num<2000){
			s.insert(s.begin(),5);
		}
		else if(num<2400){
			s.insert(s.begin(),6);
		}
		else if(num<2800){
			s.insert(s.begin(),7);
		}
		else if(num<3200){
			s.insert(s.begin(),8);
		}else{
			count++;
		}
		
	} 
	if(s.size()==0){
		cout << 1 <<" " <<  count << endl;
	}else{
		cout << s.size() << " "<<  s.size()+count << endl;
	}
	return 0;
} 

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

        final char[] S = sc.next().toCharArray();
        final char[] T = sc.next().toCharArray();

        Arrays.sort(S);
        Arrays.sort(T);

        final String sAsc = new String(S);
        final String tDesc = new StringBuilder(new String(T)).reverse().toString();
        
        System.out.println(sAsc.compareTo(tDesc) < 0 ? "Yes" : "No");
    }
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<tuple<int, int, int>> v;
    int x, y, h;
    int m;
    REP(i, n) {
        cin >> x >> y >> h;
        v.emplace_back(x, y, h);
        if (h > 0) {
            m = i;
        }
    }

    REP(i, 101) REP(j, 101) {
        bool ok = true;

        tie(x, y, h) = v[m];
        int p = h + abs(i - x) + abs(j - y);
        for (auto t : v) {
            tie(x, y, h) = t;
            if (h != max(0, p - abs(i - x) - abs(j - y))) {
                ok = false;
                break;
            }
        }
        if (ok) {
            cout << i << " " << j << " " << p << endl;
            return 0;
        }
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};

#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)

#define mp make_pair
#define fi first
#define se second

#define bit(n) (1LL<<(n))

i64 H,W,N;

void Main()
{
  cin >> H >> W >> N;
  cout << ((N+max(H,W)-1)/max(H,W)) << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

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

const ll mod = 1000000007;

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

  int x;
  cin >> x;

  int ans = 0;
  int deg = 0;
  while (true) {
    deg = (deg + x) % 360;
    ans++;
    if (deg == 0) break;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

using namespace std;

int ans = 1000000005;
int N, K;
int h[100005];

int main(void) {
    scanf("%d %d", &N, &K);
    REP(i, 0, N) scanf("%d", &h[i]);
    sort(h, h+N);

    for ( int i = 0; i + K - 1 < N; i++ ) {
    	ans = min(ans, h[i+K-1] - h[i]);
    }
    
    printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 640
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		
		// 入出力高速化 java.io.* とthrows IOExceptionを忘れずに
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] HW = br.readLine().split(" ") ; 
		int H = Integer.parseInt(HW[0]);
		int W = Integer.parseInt(HW[1]);
		
		String[][] masu = new String[H+2][W+2];
		for(int i=0;i<H+2;i++) {
			Arrays.fill(masu[i], "a");
		}
		for(int Hin=0; Hin<H; Hin++) {
			String[] IN =br.readLine().split("") ; 
			for(int Win=0; Win<W; Win++) {
				masu[Hin+1][Win+1] = IN[Win];
			}
		}
		
		String[][] ans = new String[H+2][W+2];
		for(int h=0; h<H; h++) {
			for(int w=0; w<W; w++) {
				if(!masu[h+1][w+1].equals("#")) {
					int count = 0;
					if(masu[h][w].equals("#")) {count++;}//左上
					if(masu[h][w+1].equals("#")) {count++;}//上
					if(masu[h][w+2].equals("#")) {count++;}//右上
					if(masu[h+1][w].equals("#")) {count++;}//左
					if(masu[h+1][w+2].equals("#")) {count++;}//右
					if(masu[h+2][w].equals("#")) {count++;}//左下
					if(masu[h+2][w+1].equals("#")) {count++;}//下
					if(masu[h+2][w+2].equals("#")) {count++;}//右下
					ans[h+1][w+1] = Integer.toString(count);
				}else {
					ans[h+1][w+1] = "#";
				}
			}
		}
		
		for(int Hout=0; Hout<H;Hout++) {
			for(int Wout=0; Wout<W; Wout++) {
				System.out.print(ans[Hout+1][Wout+1]);	
			}
			System.out.println();	
		}
		
	}
}

Measured memory_bytes: 34260
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;

bool graph[10][10];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m; cin >> n >> m;
	int ans = 0;
	rep(i, m) {
		int a, b; cin >> a >> b; a--; b--;
		graph[a][b] = true; graph[b][a] = true;
	}
	VE tmp;
	rep(i, n - 1) {
		tmp.push_back(i + 1);
	}
	do {
		int now = 0;
		bool ok = true;
		rep(i, n - 1) {
			if (!graph[now][tmp[i]])ok = false;
			now = tmp[i];
		}
		if (ok)ans++;
	} while (next_permutation(ALL(tmp)));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>	// upper_bound(A, A+N, num):>, lower_bound(A, A+N, num):>=
#include <functional>
#include <string>
#include <sstream>
#include <complex>
#include <vector>	// V[i],  push_back(x), pop_back(), insert(index, x), erase(index), sort(v.begin(), v.end(), greater<int>())
#include <list>		// push_front(x), push_back(x), pop_front(), pop_back(), insert(index, x)
#include <queue>	// push(x), front(), pop()
#include <deque>
#include <stack>	// push(x), top(), pop()
#include <map>		// M[key],  insert(key, val), erase(key), find(key), 
#include <set>		// insert(key), erase(key), find(key)

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define pi 3.141592653589793)
#define mod 1000000007

int N, Ma, Mb;

void solve() {
	cin >> N >> Ma >> Mb;
	vector<int> a(N), b(N), c(N);
	for (int i = 0; i < N; i++) cin >> a[i] >> b[i] >> c[i];

	map<P, int>x;
	for (int i = 0; i < (1<<(N / 2)); i++) {
		int ta = 0, tb = 0, tc = 0;
		for (int j = 0; j < N / 2; j++) {
			if ((i&(1<<j)) != 0) {
				ta += a[j];
				tb += b[j];
				tc += c[j];
			}
		}
		if (x.count(P(ta, tb)))
			x[P(ta, tb)] = min(x[P(ta, tb)], tc);
		else
			x[P(ta, tb)] = tc;
	}

	map<P, int>y;
	for (int i = 0; i < (1<<(N-N/2)); i++) {
		int ta = 0, tb = 0, tc = 0;
		for (int j = 0; j < N - N / 2; j++) {
			if ((i&(1 << j)) != 0) {
				ta += a[j + N / 2];
				tb += b[j + N / 2];
				tc += c[j + N / 2];
			}
		}
		if (y.count(P(ta, tb)))
			y[P(ta, tb)] = min(y[P(ta, tb)], tc);
		else
			y[P(ta, tb)] = tc;
	}

	int ans = 1000000000;
	for (map < P, int>::iterator itr = x.begin(); itr != x.end(); itr++) {
		int ta = (*itr).first.first;	//*itrの要素はキーと値のペアである
		int tb = (*itr).first.second;
		for (int i = 1; i*max(Ma, Mb) < 405; i++) {
			if (y.count(P(i*Ma - ta, i*Mb - tb)))
				ans = min(ans, (*itr).second + y[P(i*Ma - ta, i*Mb - tb)]);
		}
	}
	if (ans < 1000000000) cout << ans << endl;
	else cout << -1 << endl;
}

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

Measured memory_bytes: 896
#include <stdio.h>

int main(void)
{
    double n;
    double max,min;

    scanf("%lf", &n);
    max = min = n;
    while (scanf("%lf", &n) != EOF){
        if (n < min){
            min = n;
        }
        if (n > max){
            max = n;
        }
    }
    printf("%.1lf\n", max - min);

    return (0);
}


Measured memory_bytes: 1912
#include"bits/stdc++.h"
using namespace std;


int main() {
	int w, h, n;
	cin >> w >> h >> n;
	int xo=0, yo=0, xx=w, yy=h;
	int x[1000], y[1000], a[1000];
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i] >> a[i];
		if (a[i] == 1 && x[i]>=xo) xo = x[i];
		else if (a[i] == 2 && x[i]<=xx) xx = x[i];
		else if (a[i] == 3 && y[i]>=yo) yo = y[i];
		else if (a[i] == 4 && y[i]<=yy) yy = y[i];
	}
	if (((xx - xo)*(yy - yo)) <= 0) cout << 0 << endl;
	else if (xx - xo < 0) cout << 0 << endl;
	else if (yy - yo < 0) cout << 0 << endl;
	else cout << (xx - xo)*(yy - yo) << endl;
}

Measured memory_bytes: 256
///HELLO THERE~!
///CREATED BY MD SADMAN MEHEDI SIVAN(IUT CSE-SWE^19)

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;

int main()
{
    fastio;

    string sivan;
    cin>>sivan;
    if((sivan[2]==sivan[3]) && sivan[4]==sivan[5])
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
 
// Remove GCC optimizer for codechef
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
 
using namespace std;
using namespace __gnu_pbds;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
const int INF = 1e16;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 998244353;

const int maxn = 3000 + 7;
int dp[maxn][maxn];

string s, t;
pair<int, int> mp[maxn][maxn];
vector<pair<int, int>> v = {{1, 0}, {0, 1}, {1, 1}};

int solve(int i, int j)
{
    if(i == s.size() || j == t.size())
        return 0;
    int &res = dp[i][j];
    if(res != -1)
        return dp[i][j];
    int tmp[3] = {-1, -1, -1};
    tmp[0] = solve(i + 1, j);
    res = tmp[0];
    tmp[1] = solve(i, j + 1);
    res = max(res, tmp[1]);
    if(s[i] == t[j])
    {
        tmp[2] = solve(i + 1, j + 1) + 1;
        res = max(res, tmp[2]);
    }
    for(int k = 0; k < 3; k++)
    {
        if(res == tmp[k])
        {
            mp[i][j] = {i + v[k].first, j + v[k].second};
            break;
        }
    }
    return res;
}

int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    cin >> s >> t;
    memset(dp, -1, sizeof(dp));
    for(int i = 0; i <= s.size(); i++)
        for(int j = 0; j <= t.size(); j++)
            mp[i][j] = {-1, -1};
    solve(0, 0);
    pair<int, int> p = {0, 0};
    while(mp[p.first][p.second].first != -1)
    {
        auto np = mp[p.first][p.second];
        if(np.first == p.first + 1 && np.second == p.second + 1)
            cout << s[p.first];
        p = np;
    }
    return 0;
}

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

def main():
     n, m = map(int, input().split())
     a = list(map(int, input().split()))

     s = sum(a)
     line = s / (4 * m)

     a = sorted(a, reverse=True)
     # print(a)
     if a[m-1] >= line:
          print('Yes')
     else:
          print('No')

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int N=200010;
int maxn,maxn2,maxwz,maxwz2;
int d[N];
int n;
int main()
{
	scanf("%d",&n);
	for(int k=1;k<=n;k++)
	{
		scanf("%d",&d[k]);
		if(d[k]>maxn)
			maxwz2=maxwz,maxn2=maxn,maxn=d[k],maxwz=k;
		else if(d[k]>maxn2)
			maxwz2=k,maxn2=d[k];
	}
	for(int k=1;k<=n;k++)
	{
		if(k==maxwz)
			printf("%d\n",maxn2);
		else
			printf("%d\n",maxn);
	}
	return 0;
}

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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/b.in", "r", stdin);
//  freopen("../IO/b.in", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}


void solve(std::istream &in, std::ostream &out) {
  int64_t x;
  in >> x;
  int64_t start = 100;
  int count = 0;
  while (start < x) {
    start *= 1.01;
    ++count;
  }
  cout << count << '\n';
}


Measured memory_bytes: 3620
n = int(input())

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

suffix_sum = [0]*n
suffix_sum[-1] = a[-1]
res = 0
for i in range(n-2, -1, -1):
	res += a[i]*suffix_sum[i+1]
	suffix_sum[i] = suffix_sum[i+1] + a[i]
print(res)

Measured memory_bytes: 3064
tak_health, tak_attack, aoki_health, aoki_attack = list(map(int, input().split()))

game = True

while game:
    if aoki_health > 0:
        aoki_health -= tak_attack
    if tak_health > 0:
        tak_health -= aoki_attack
    if aoki_health <= 0:
        print("Yes")
        game = False
    elif tak_health <= 0:
        print("No")
        game = False

        


Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>
#include <fstream>

using namespace std;
typedef long long ll;

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) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;

int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	
	int n, m, L; cin >> n >> m >> L;
	vector<vector<int>> d1(n, vector<int>(n, inf));
	for (int i = 0; i < m; i++) {
		int a, b, c; cin >> a >> b >> c;
		a--; b--;
		chmin(d1[a][b], c);
		chmin(d1[b][a], c);
	}
	for (int i = 0; i < n; i++) d1[i][i] = 0;
	for (int k = 0; k < n; k++) for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) chmin(d1[i][j], d1[i][k] + d1[k][j]);

	vector<vector<int>> d2(n, vector<int>(n, inf));
	for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
		if (d1[i][j] <= L) d2[i][j] = 1;
	}
	for (int i = 0; i < n; i++) d2[i][i] = 0;
	for (int k = 0; k < n; k++) for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) chmin(d2[i][j], d2[i][k] + d2[k][j]);

	int kkt; cin >> kkt;
	while (kkt--) {
		int s, t; cin >> s >> t;
		s--; t--;
		cout << ((d2[s][t] == inf) ? -1 : d2[s][t] - 1) << "\n";
	}

	return 0;
}

Measured memory_bytes: 3992