akhauriyash/Code-Regression huggingface dataset:
// Problem : A - Table Tennis Training
// Contest : AtCoder - AtCoder Grand Contest 041
// URL : https://atcoder.jp/contests/agc041/tasks/agc041_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a) for (int i=0; i<(a); i++)
#define rep1(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rep(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define imax INT_MAX
#define imin INT_MIN
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
	 
	ios_base::sync_with_stdio(0); cin.tie(0); 
	int t=1;
	while(t--)
	{
		ll n,a,b;
		cin>>n>>a>>b;
		if((b-a)%2==0)
		{
			cout<<(b-a)/2;
		}
		else
		{
			cout<<min(a+(b-a-1)/2,n-b+(b-a+1)/2);
		}
	}
	
    
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3624
import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	void A() {
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		System.out.println(Math.max(0,(H-h)*(W-w)));
	}
	void B() {
		int N = sc.nextInt();
		int M = sc.nextInt();
		int C = sc.nextInt();
		int ans = 0;
		int []  B = new int[M];
		int [] A = new int[M];
		for(int i = 0; i < M; i++) B[i] = sc.nextInt();
		for(int i = 0; i < N; i++) {
			int tmp = C;
			for(int j = 0; j < M; j++) {
				A[j] = sc.nextInt();
				tmp += A[j] * B[j];
			}
			if(tmp>0) ans++;
		}
		System.out.println(ans);
	}
	void C() {
		int N = sc.nextInt();
		long M = sc.nextLong();
		Pair [] data = new Pair[N];
		for(int i = 0; i < N; i++) {
			long a = sc.nextLong(), b = sc.nextLong();
			data[i] = new Pair(a,b);
		}
		Arrays.sort(data);
		long ans = 0;
		for(int i = 0; i < N; i++) {
			if((int)data[i].b <= M) {
				ans  += data[i].a * data[i].b;
			} else {
				ans += (long) M * data[i].a;
			}
			M -= data[i].b;
			//System.out.println(ans + " " + data[i].a + " " + data[i].b + " " + M);
			if(M <=0) break;
		}
		System.out.println(ans);
	}
	class Pair implements Comparable<Pair>{
		long a, b;
		Pair(long a, long b) {
			this.a = a; this.b = b;
		}
		public int compareTo(Pair other) {
			if(this.a < other.a) return -1;
			if(this.a > other.a) return +1;
			if(this.b < other.b) return -1;
			if(this.b > other.b)return +1;
			return 0;
		}
	}
	void D() {
		
	}
	void doIt() {
		C();
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().doIt();
	}

}


Measured memory_bytes: 83868
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	v := make([]int, n)
	for i:=0; i<n;i++ {
		fmt.Scan(&v[i])
	}
	sort.Ints(v)
	var ans float64
	ans = (float64(v[0]) + float64(v[1])) / 2
	for i:=2;i<n;i++ {
		ans = (ans + float64(v[i])) / 2
	}
	fmt.Println(ans)
}

Measured memory_bytes: 512
export class Main {
  static main(input): string {
    const tmp: string[] = input.split("\n");
    const [a, b]: number[] = tmp[0].split(" ").map(int => parseInt(int));
    const c: number = (a + b) / 2;
    return `${Math.floor(c) == c ? c : "IMPOSSIBLE"}`;
  }
}
 console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> vv(100001);
    int Pdata[110000], Ydata[110000];
    for(int i=1; i<=m; i++){
        int p, y;
        cin >> p >> y;
        vv[p].push_back(y);
        Pdata[i] = p;
        Ydata[i] = y;
    }
    for(int i=1; i<=100000; i++){
        if(!(vv[i].empty())) sort(vv[i].begin(), vv[i].end());
    }
    for(int i=1; i<=m; i++){
        int a = lower_bound(vv[Pdata[i]].begin(), vv[Pdata[i]].end(), Ydata[i]) - vv[Pdata[i]].begin();
        printf("%06d%06d\n", Pdata[i], a+1);
    }
    return 0;
}

Measured memory_bytes: 7808
function main(input: string[]): void {
    const n = parseInt(input.shift());
    let min = n * 2;
    let log = Math.ceil(Math.sqrt(n));
    for (let i = 1; i <= log; i++) {
        if (n % i === 0) {
            min = Math.min(min, i + Math.round(n / i));
            //puts(i, i + n / i, min);
        }
    }
    puts(min - 2);
}

// === BEGIN MODULE ===
function puts(...message: any[]): void {
    console.log(message.join(' '));
}
// === END   MODULE ===

import { readFileSync } from 'fs';
if (process.argv[1] == __filename) {
    const path = process.argv[2] || '/dev/stdin';
    const input = readFileSync(path, 'utf-8');
    main(input.split(/\s+/));
}

Measured memory_bytes: 11468
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AOJ_Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var points = new int[2];
            for (int i = 0; i < n; i++)
            {
                var oneLine = Console.ReadLine().Split(' ');

                var result = string.Compare(oneLine[0], oneLine[1]);
                if (result < 0)
                {
                    points[1] += 3;
                }
                else if (result == 0)
                {
                    points[0]++;
                    points[1]++;
                }
                else
                {
                    points[0] += 3;
                }

            }
            Console.WriteLine(string.Join(" ", points));
        }
    }
}



Measured memory_bytes: 16752
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

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

int m, n;
int ba[90][90];

int solve(int x, int y, int nest) {
  // cout << string(nest,' ');
  // printf("%d,%d\n",x,y);
  ba[x][y] = 0;
  int res = 0;
  REP(k,4) {
    int xx = x+dx[k];
    int yy = y+dy[k];
    if (xx<0||m<=xx||yy<0||n<=yy) continue;
    if (ba[xx][yy] == 0) continue;
    res = max(res, solve(xx,yy,nest+1));
  }
  ba[x][y] = 1;
  return res + 1;
}

int main() {
  while(cin >> m >> n, m+n) {
    REP(i,n) {
      REP(j,m) {
        cin >> ba[j][i];
      }
    }
    int res = 0;
    REP(y,n)
      REP(x,m)
      if (ba[x][y])
        res = max(res, solve(x, y,0));
    cout << res << endl;
  }
}

Measured memory_bytes: 0
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int x,a,b,c;
	scanf("%d",&x);
	a=x/500;
	c=x%500;
	b=c/5;
	printf("%d\n",a*1000+b*5);
	return 0;
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;



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

    int N,M;
    cin >> N >> M;
    int s[M];
    char c[M];
    rep(i,M) cin >> s[i] >> c[i];
    string ans="-1";
    bool z=false;
    for(int i=0;i<1000;i++){
        string x=to_string(i);
        if(x.size()==N){
            z=true;
            rep(j,M){
                if(x.at(s[j]-1)!=c[j]){
                    z=false;
                    break;
                }
            }
        }
        if(z) {
            ans=x;
            break;
        }
    }
    cout << ans << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 999999999999999999
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define PI 2*acos(0.0)
ll mod(ll B,ll M){ll X=B%M; if(X>=0) return X; else return M+X;}
///cin.ignore();
ll max(ll a,ll b) {if(a>b) return a; else return b;} ll min(ll a,ll b) {if(a<b) return a; else return b;}
ll fx4[]={1,-1,0,0}; ll fy4[]={0,0,1,-1};

int main()
{
    //freopen("C:/Users/Md Faizul Haque/Desktop/Solving/input.txt","r",stdin);
    //freopen("C:/Users/Md Faizul Haque/Desktop/Solving/output.txt","w",stdout);

    ll t,n,m,x,y,w,k,q,r,p,cs;

    string a;
    cin>>a;
    if(a=="Sunny"){
        cout<<"Cloudy"<<endl;
    }
    else if(a=="Cloudy"){
        cout<<"Rainy"<<endl;
    }
    else{
        cout<<"Sunny"<<endl;
    }

    return 0;
}





Measured memory_bytes: 256
from __future__ import print_function

import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd

# def lcm(n,m):
#     return int(n*m/gcd(n,m))

# import re
# import array
# import copy
# import functools
# import operator

# import collections
# import itertools
# import bisect
# import heapq


# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace

# from queue import PriorityQueue as pq

# def reduce(p, q):
#     common = fractions.gcd(p, q)
#     return (p//common , q//common )
# # from itertools import accumulate
# # from collections import deque

# from operator import mul
# from functools import reduce

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

# import random

# def round_lower(n, m_modulo):
#     n % modulo
#     return


def crange(l,r):
    return range(l,r+1)


def main():
    l,r = map(int, input().strip().split())

    if l//2019 < r//2019:
        print(0)
    else:
        l=l % 2019
        r=r%2019
        ans=sys.maxsize
        for i in crange(l,r):
            for j in crange(i+1,r):
                ans=min(ans,(i*j)%2019)
        print(ans)
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 39792
n, m = map(int, input().split())
a = {}
for i in range(m):
    p, s = input().split()
    if p not in a:
        a[p] = {'flag':False, 'wa':0}
    if s == 'AC':
        a[p]['flag'] = True
    elif not a[p]['flag']:
        a[p]['wa'] += 1

ac, wa = 0,0
for k, i in a.items():
    if i['flag']:
        ac += 1
        wa += i['wa']
print(ac, wa)

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

using namespace std ;

#define ll long long

ll ans = 0 , num = 0 ;
int vis[ 11 ] , n , a[ 11 ] ;
char s[ 11 ] ;

void dfs( int x ) {
	if( x == n ) {
		ll sum = a[ 1 ] ;
		for( int i = 1 ; i < n ; i ++ ) {
			if( vis[ i ] == 1 ) {
				ans += sum ;
				sum = a[ i + 1 ] ;
			}else sum *= 10 , sum += a[ i + 1 ] ;
		}
		ans += sum ;
		return ;
	}
	vis[ x ] = 1 ;
	dfs( x + 1 ) ;
	vis[ x ] = 0 ;
	dfs( x + 1 ) ;
}

int main() {
	scanf( "%s" , s + 1 ) ;
	for( int i = 1 , len = strlen( s + 1 ) ; i <= len ; i ++ ) {
		a[ i ] = s[ i ] - '0' ;
	}
	n = strlen( s + 1 ) ;
	dfs( 1 ) ;
	printf( "%lld\n" , ans ) ;
}

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

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> board(H);
	rep(i, H) {
		cin >> board[i];
	}
	vector<int> dx = { 1,1,0,-1,-1,-1,0,1 };
	vector<int> dy = { 0,1,1,1,0,-1,-1,-1 };
	rep(i, H) {
		rep(j, W) {
			if (board[i][j] == '.') {
				int bomb = 0;
				rep(k, 8) {
					int x = j + dx[k];
					int y = i + dy[k];
					if (0 <= x && x < W && 0 <= y && y < H && board[y][x] == '#') {
						bomb++;
					}
				}
				board[i][j] = bomb + '0';
			}
			cout << board[i][j];
		}
		cout << endl;
	}
	return 0;
}

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


int main(){
    int n;
    cin >> n;
    int N = n*n;
    Graph G(N);
    for(int i=0; i<2*n*(n-1); i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    Graph H(n, vector<int>(n, -1));
    vector<int> used(N, 0);
    for(int i=0; i<N; i++){
        if(G[i].size() == 2){
            H[0][0] = i;
            used[i] = 1;
            break;
        }
    }

    for(int i=0; i<n-1; i++){
        for(auto &&k : G[H[0][i]]){
            if(G[k].size() <= 3 && !used[k]){
                H[0][i+1] = k;
                used[k] = 1;
                break;
            }
        }
    }

    for(int j=0; j<n-1; j++){
        for(int i=0; i<n; i++){
            for(auto &&k : G[H[j][i]]){
                if(used[k]) continue;
                H[j+1][i] = k;
                used[k] = 1;
            }
            if(H[j+1][i] == -1){
                cout << "!" << H[j][i] << endl;
            }
        }
    }

    for(int j=0; j<n; j++){
        for(int i=0; i<n; i++){
            cout << H[j][i]+1 << (i==n-1 ? "\n":" ");
        }
    }

}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
	string s;
	cin >> s;
	rep(i,s.size()){
		cout << 'x';
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] md1 = Console.ReadLine().Split(' ');
            string[] md2 = Console.ReadLine().Split(' ');

            Console.WriteLine((md1[0] != md2[0] && md2[1] == "1") ? "1" : "0");
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>	
#define inf INT_MAX
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
double dmax(double a,double b){
	return a>b?a:b;
}

int main(void){
	int r=in(),g=in(),b=in();
	puts((g*10+b)%4?"NO":"YES");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, total = 0, n_pairs;
	cin >> N;
	for(int i = 1; i < N; ++i){
		if(N % i == 0){
			n_pairs = N/i - 1;
		}
		else{
			n_pairs = N/i;
		}
		total += n_pairs;
	}
	cout << total;
}


Measured memory_bytes: 3636
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] primaryNumbers = {
      2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47,
      53, 59, 61, 67 ,71, 73, 79, 83, 89, 97
    };
    
    Map<Integer, Integer> map = new HashMap<>();
    int count = 0;
    
    
    for(int i = 0; i < primaryNumbers.length; i++){
      int n = primaryNumbers[i];
      map.put(n, 0);
      while(n <= N){
        map.put(primaryNumbers[i], N / n + map.get(primaryNumbers[i]));
        n *= primaryNumbers[i];
      }
    }
    
    
    // iとjが4乗、kが2乗
    for(int i = 0; i < primaryNumbers.length; i++){
      if(map.get(primaryNumbers[i]) < 4){
        break;
      }
      for(int j = i + 1; j< primaryNumbers.length; j++){
        if(map.get(primaryNumbers[j]) < 4){
          break;
        }
        for(int k = 0; k < primaryNumbers.length; k++){
          if(map.get(primaryNumbers[k]) < 2){
            break;
          }
          if(j != k && i != k){
            count++;
          }
        }
      }
    }
    
    for(int i = 0; i < primaryNumbers.length; i++){
      if(map.get(primaryNumbers[i]) < 24){
        break;
      }
      for(int j = 0; j < primaryNumbers.length; j++){
        if(map.get(primaryNumbers[j]) < 2){
          break;
        }
        if(i != j){
          count++;
        }
      }
    }
    
    for(int i = 0; i < primaryNumbers.length; i++){
      if(map.get(primaryNumbers[i]) < 14){
        break;
      }
      for(int j = 0; j < primaryNumbers.length; j++){
        if(map.get(primaryNumbers[j]) < 4){
          break;
        }
        if(i != j){
          count++;
        }
      }
    }
    for(int i = 0; i< primaryNumbers.length; i++){
      if(map.get(primaryNumbers[i]) < 74){
        break;
      }
      count++;
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 22996
"use strict";

function Main(input) {
    input = input.trim().split('\n')
    const NM = input.shift().split(' ').map(v => Number(v))
    input = input.map(v => Number(v))

    let ans = new Array(NM[0] + 1).fill(1)
    let broken = -1
    let NG = false

    input.forEach(n => {
        if (broken + 1 === n) { NG = true }
        ans[n] = 0
        broken = n
    })
    if (NG) { console.log(0); return }

    for (let n = 2; n <= NM[0]; n++) {
        ans[n] = ans[n] * (ans[n - 2] + ans[n - 1]) % 1000000007
    }
    console.log(ans[NM[0]])
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 16740
#include<stdio.h>
int main(){
	int b, f, r, v, i, n;
	int str[4][3][10] = { 0 };
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%d%d%d%d", &b, &f, &r, &v);
		str[b-1][f-1][r-1] += v;
	}
	for (b = 0; b < 4; b++){
		for (f = 0; f < 3; f++){
			for (r = 0; r < 10; r++){
				printf(" %d", str[b][f][r]);
			}
			printf("\n");
		}
		if(b<3){printf("####################\n");}
	}
	return 0;
}

Measured memory_bytes: 612
import java.util.*;

public class Main {
  public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int num1 = sc.nextInt();
    	int num2 = sc.nextInt();
		if(num1 < num2) {
          System.out.println(0);
        } else {
          System.out.println(10);
        }
  }
}

Measured memory_bytes: 21716
#include<iostream>
#include<complex>
using namespace std;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    
    if(std::abs(a-c)<=d){
        cout << "Yes" << endl;
    }
    
    else if(std::abs(a-b)<=d && std::abs(b-c)<=d){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

using namespace std;

char sir[200010];
long long vaz[100];

int main()
{
    //freopen("file.in","r",stdin);
    //freopen("file.out","w",stdout);
    long long sol=0;
    scanf("%s",sir+1);
    int l=strlen(sir+1);
    long long rez=1LL*l*(l+1)/2;
    for(int i=1;i<=l;i++)
        vaz[sir[i]-'a']++;
    for(int i=0;i<26;i++)
        sol+=1LL*vaz[i]*(vaz[i]+1)/2;
    printf("%lld",rez-sol+1);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define lg2 std::__lg
#define EB emplace_back

typedef std::pair <int, int> pr;
const int N = 100054;

int n;
std::vector <pr> E;

inline void link(int x, int y) {E.EB(std::minmax(x, y));}

int main() {
	int i, u, v;
	scanf("%d", &n);
	if (n & (n - 1)) puts("Yes");
	else return puts("No"), 0;
	link(n + 1, n + 2);
	for (i = 2; i < n; i += 2) link(1, i), link(1, i + 1), link(i, i + n + 1), link(i + 1, i + n);
	if (!(n & 1)) u = 1 << lg2(n + 1), v = (n + 1) & ~u, link(u, 2 * n), link(v, n);
	std::sort(E.begin(), E.end());
	for (const pr &e : E) printf("%d %d\n", e.first, e.second);
	return 0;
}

Measured memory_bytes: 3952
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
int N = 2e5 + 5;

void solve_test_case(){
	string n;
	cin>>n;
	ll s = 0;
	for(int i = 0;n[i];++i){
		s += (n[i] - '0');
	}
	cout<<((s%9)?"No\n":"Yes\n");
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
	//cin>>t;
	for(int i = 1;i <= t;++i){
		solve_test_case();
	}
}


Measured memory_bytes: 3704
N = int(input())
L = list(map(int,input().split()))
S = [0]
c = 0
for i in range(N):
  c = S[i] + L[i]
  S.append(c)
S.sort()
S.append(S[N]+1)
k = 0
p = 1
ans = 0
while k <= N:
  if S[k] == S[k+1]:
    p += 1
    k += 1
  else:
    ans += p*(p-1)//2
    p = 1
    k += 1
print(ans)

Measured memory_bytes: 26136
#include<bits/stdc++.h> 
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
typedef long long ll;
using namespace std;
inline int read(){
	int n=0,f=1;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if (c=='-') c=getchar(),f=-1;
	for(;c>='0'&&c<='9';c=getchar()) n=n*10+c-48;
	return n*f;
}
const int maxn=1e5+5;
int i,j,n,a[maxn],b[maxn],x,ans;bool p;
int f[maxn],cnt;bool bz[maxn];
map<int,int>d;
map<int,int>c;
int get(int x){return (f[x])?f[x]=get(f[x]):x;}
void hb(int x,int y){
	x=get(d[x]),y=get(d[y]);
	if (x!=y) f[x]=y;
}
int main(){
	n=read();
	fo(i,1,n) x^=(a[i]=read()),c[a[i]]++;
	c[x]++;
	fo(i,1,n) {
		b[i]=read();
		if (!d[b[i]]) d[b[i]]=++cnt;
		if (c[b[i]]) c[b[i]]--;else return puts("-1"),0;
	}
	fo(i,1,n) if (a[i]!=b[i]) hb(a[i],b[i]),p|=b[i]==x,ans++;
	fo(i,1,n) if (a[i]!=b[i]) ans+=!bz[get(d[a[i]])],bz[get(d[a[i]])]=1;
	printf("%d\n",ans-p);
}

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

#define deb(x)        cerr << #x << " = " << x << "\n";
#define deb2(x, y)    cerr << #x << " = " << x << ", " << #y << " = " << y << "\n";
#define deb3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << "\n";

#define pb push_back
#define mp make_pair
#define F  first
#define S  second

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

typedef long long ll;  

void solve() {
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 1LL; i <= n; ++i) {
        ll x = n/i;
        ans += (x * (x + 1) * i) / 2;
    }
    cout << ans;
}

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

//  freopen ("in.txt", "r", stdin);
//  freopen ("err.txt", "w", stderr); 
//  freopen ("out.txt", "w", stdout);

    ll tc = 1;
    //cin >> tc;

    while(tc--) {
        solve();
        cout << '\n';
    }

    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<map>
using namespace std;
int main(){
	int n,m,count=0;
	map<int,int>mp;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>m;
		mp[m]++;
		if(mp[m]==3){
			mp[m]=1;
			count--;
		}
		if(mp[m]==2){
			count++;
		}
	}
	cout<<mp.size()-count%2<<endl;
	return 0;
}

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

int main() {
    ll a, b, n;
    cin >> a >> b >> n;

    ll x = min(b-1, n);
    cout << ll(a*x/b) + a*ll(x/b) << endl;

    return 0;
}



Measured memory_bytes: 3604
#include <iostream>
#include <vector>

using namespace std;

int n;
vector<int> A;

bool solve(int i, int m) {
  if (m == 0) {
    return true;
  }
  if (m < 0) {
    return false;
  }
  if (i >= n) {
    return false;
  }
  return solve(i + 1, m - A[i]) || solve(i + 1, m);
}

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

  cin >> n;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    A.push_back(a);
  }

  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int m;
    cin >> m;
    if (solve(0, m)) {
      cout << "yes" << endl;
    } else {
      cout << "no" << endl;
    }
  }
}



Measured memory_bytes: 3144
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>
#include <vector>
#include <iomanip>

using namespace std;

int main(void) {
  int A, B, K;
  cin >> A >> B >> K;
  for (int i = 0; i < K; i++) {
    if (i % 2 == 0) {
      B += A / 2;
      A /= 2;
    } else {
      A += B / 2;
      B /= 2;
    }
  }
  cout << A << " " << B << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <bitset>

bool IsHeisei(int y, int m, int d) {
  if(y < 2019) return true;
  if(y == 2019 && m < 4) return true;
  if(y == 2019 && m == 4 && d <= 30) return true;
  return false;
}

int main() {
  int A, B, C;
  scanf("%d/%d/%d", &A, &B, &C);
  printf("%s\n", IsHeisei(A, B, C) ? "Heisei" : "TBD");
  return 0;
}

Measured memory_bytes: 128
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  a[i]*=-1
heapq.heapify(a)
for i in range(m):
  heapq.heappush(a,(heapq.heappop(a)+1)//2)
print(-sum(a))

Measured memory_bytes: 14180
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))

l = 0
r = 10**9
while r - l > 1:
    m = (l+r) // 2
    cnt = 0
    for i in a:
        cnt += math.ceil(i / m) - 1
    if cnt <= k:
        r = m
    else:
        l = m
print(l+1)


Measured memory_bytes: 31100
#include <string>
#include <time.h>
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <utility>
#include <iostream>
#include <cmath>
#include <deque>

#define pii pair<ll,ll>
#define X first
#define Y second
#define mp make_pair

typedef long long ll;
using namespace std;
#define MAXN 228228
#define MOD 1000000007
ll x, y, n, m, k, R, C;
ll a[MAXN], rsz[MAXN], csz[MAXN];
vector<ll> g;

struct shit {
    ll val;
    ll x;
    ll y;
};

bool operator <(const shit& x, const shit& y) {
    return x.val < y.val;
}

ll p[MAXN], s[MAXN], h[MAXN];

struct DSU {
    DSU(int N) {
        color.resize(N);
        siz.resize(N);
        for (int i = 0; i < N; i++) {
            color[i] = i;
            siz[i] = 1;
        }
    }

    int get(int v) {
        return (v == color[v]) ? v : (color[v] = get(color[v]));
    }

    void unite(int a, int b) {
        a = get(a);
        b = get(b);
        if (siz[a] > siz[b]) {
            swap(a, b);
        }
        if (a != b) {
            color[a] = b;
            siz[b] += siz[a];
          h[b] += h[a];
        }
    }

    int size(int x) {
        return siz[x];
    }

    vector<int> color;
    vector<int> siz;
};

DSU dsu(MAXN);

vector<shit> f;
int main() {
    cin >> n >> R >> C;
    for (int i = 0; i < n; i++ ){
        ll x, y, z;
        cin >> x >> y >> z;
        f.push_back({z, x, y + R});
    }
    sort(f.begin(), f.end());
    reverse(f.begin(), f.end());
    for (int i = 1; i <= R+C; i++) {
        h[i] = 1;
    }

    ll ans = 0;
    for (auto v : f) {
        ll x = dsu.get(v.x);
        ll y = dsu.get(v.y);
        ll val = v.val;
        if (x == y) {
            if (h[x] == dsu.size(x)) {
                h[x]++;
                ans += val;
            }
        } else {
            if (h[x] + h[y] <= dsu.size(x) + dsu.size(y) + 1) {
                dsu.unite(x, y);
                ans += val;
            }
        }
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 8820
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;

typedef long long ll;
const int N = 1e5 + 1;

int x[N], y[N], t[N];

int main()
{
    //ifstream cin("input.txt");

    int n, dr, dt;
    cin >> n;
    t[0] = x[0] = y[0] = 0;
    for (int i = 1; i <= n; ++i)
        cin >> t[i] >> x[i] >> y[i];

    for (int i = 1; i <= n; ++i)
    {
        dr = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
        dt = t[i] - t[i - 1];
        if ((dr > dt) || ((dr & 1) != (dt & 1)))
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}


Measured memory_bytes: 1408
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <array>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define all(c) begin(c), end(c)
#define dump(c) cerr << "> " << #c << " = " << (c) << endl
#define tr(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef pair<int,int> pii;

const int INF = 1 << 29;
const double EPS = 1e-10;


int main() {
  for (int A, L; cin >> A >> L, (A | L) != 0; ) {
    string a = to_string(A);
    a = string(L - a.size(), '0') + a;
    array<int, 1000000> table;
    fill(all(table), -1);
    table[A] = 0;
    rep(i, INF) {
      string mi = a;
      sort(all(mi));
      string ma = mi;
      reverse(all(ma));
      int next = stoi(ma) - stoi(mi);
      if (table[next] != -1) {
        printf("%d %d %d\n", table[next], next, i + 1 - table[next]);
        break;
      }
      table[next] = i + 1;
      a = to_string(next);
      a = string(L - a.size(), '0') + a;
    }
  }
  
  
  return 0;
}

Measured memory_bytes: 5140
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
A.sort()
BC.sort(key = lambda x:-x[1])
i = 0
for b, c in BC:
    for j in range(b):
        if A[i] < c:
            A[i] = c
            i += 1
        else:
            break
        if i >= N:
            break
    if i >= N:
        break
print(sum(A))

Measured memory_bytes: 36076
#include<stdio.h>
 
int main(){
  int i, j, a, num; 
  int y=0;
  int l, h, key;
  
  scanf("%d", &a);
  
  int list[a];
  char input[12];

  for(i=0;i<a;i++){
    scanf("%s %d",input,&num);
    
    if(input[0]=='i'){
      list[i]=num;
    }
    
    else if(input[6]=='F'){
      i-=2;a-=2;
    }
    
    else if(input[6]=='L'){
      i--;a--;y++;
    }
    
    else{
      i--;a--;l=0;
      for(j=i;j>=0;j--){
	if(l>0) break;
	if(num==list[j]){
	  key=0;
	  h=i-j;
	  l++;
	  
	  while(h!=key++){
	    list[j+key-1]=list[j+1+key-1];
	  }
	  i--;a--;
        }  
      }
    }
  }
  
  for(i=0;i<a-y;i++){
    if(i==a-y-1) printf("%d\n",list[a-1-i]);
    else printf("%d ",list[a-1-i]);
  }
  return 0;
}



Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using vs=vector<string>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    	((ll)1ll<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.141592653589793

template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n;cin>>n;
  	int p=-1,l=0,a=0;
  	rep(i,n){
      	int t;
    	cin>>t;
      	if(p!=t){
          	a+=l/2;
          	l=1;
        }else l++;
      	p=t;
    }
  	cout<<a+l/2<<endl;
  	
	return 0;
}


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

vector<ll> solve(vector<ll> a,vector<ll> b,ll m) {
  vector<ll> c(m,0);
  for(int i=0; i<m; i++) {
    for(int j=0; j<m; j++) {
      c[(i+j)%m]+=a[i]*b[j];
      c[(i+j)%m]%=mod;
    }
  }
  return c;
}

vector<ll> mod_pow(vector<ll> a,ll n,ll m){
  if(n==0) {
    vector<ll> v(m,0);
    v[0]=1;
    return v;
  }
  if(n==1) return a;
  vector<ll> b=mod_pow(solve(a,a,m),n/2,m);
  if(n&1) b=solve(b,a,m);
  return b;
}

int main() {
  ll n,m,k;
  cin >> n >> m >> k;
  vector<ll> a(n,0);
  a[0]++;
  for(int i=0; i<m; i++) {
    int x;
    cin >> x;
    a[x%n]++;
  }
  a=mod_pow(a,k,n);
  for(int i=0; i<n; i++) cout << a[i] << endl;
  return 0;
}


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

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

    double win;
    win += max((double)0, (double)(N - K + 1) / N);
    int end;
    if(N < K) end = N + 1;
    else end = K;
    for (int i = 1; i < end; i++)
    {
        int c = 1;
        while (true)
        {
            if(i * pow(2, c) >= K) break;
            c++;
        }

        win += pow(0.5, c) / N;
    }

    cout << fixed << setprecision(10) << win << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();
			String[] s = str.split(" ",0);
			int N = Integer.parseInt(s[0]);
			int M = Integer.parseInt(s[1]);
			long max  = 1000000007;
			long count = 0;
			if(Math.abs(N-M)< 2) {
				count = 1;
				for(int i = 1; i < N+1;i++) {
					count = (((long)i%max) * count) %max;
				}
				for(int i = 1; i < M+1;i++) {
					count = (((long)i%max) * count) %max;
				}
			}
			if(N==M) {
				count = ((long)2 * count)%max;
			}

			System.out.println(count);
		}catch (Exception e) {
			System.exit(0);
		}
	}
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) a>b?a:b
long long n;
char s;
long long num=0,ans=0;

int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)
	{
      cin>>s;
      if(s=='I')  num++;
      if(s=='D')  num--;
      ans=max(ans,num);
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 256
s = input()
aidx = -1
zidx = -1
for i in range(len(s)):
  if aidx == -1 and s[i] == 'A':
    aidx = i
  if zidx == -1 and s[len(s)-1-i] == 'Z':
    zidx = len(s)-1-i
  if aidx != -1 and zidx != -1:
    break
print(zidx-aidx+1)


Measured memory_bytes: 3512
from itertools import permutations
from math import sqrt

N = int(input())

town = []

for i in range(N):
    town.append(tuple([int(x) for x in input().split()]))

route_list = list(permutations(range(N)))

result = 0
for route in route_list:
    for i in range(1, N):
        x = (town[route[i-1]][0] - town[route[i]][0])**2
        y = (town[route[i-1]][1] - town[route[i]][1])**2

        result += sqrt(x + y)

print(result / len(route_list))


Measured memory_bytes: 13972
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
void solve(){
	vector<ll> v(5);
	for(ll i=0;i<5;i++){
		cin>>v[i];
		if(v[i]==0){
			cout<<i+1;
			exit(0);
		}
	}
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll qc=1;
    for(ll i=1;i<=qc;i++)
    solve();
}


Measured memory_bytes: 3640
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
import java.io.InputStream;
import java.io.IOException;


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

    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] heights = new int[n + 1];
    int[] dp = new int[n + 1];
    for(int i = 1; i <= n; i++){
      heights[i] = sc.nextInt();
      dp[i] = Integer.MAX_VALUE;
    }
    dp[0] = 0;
    dp[1] = 0;
    dp[2] = Math.abs(heights[2] - heights[1]);
    for (int i = 3; i <= n; i++) {
        for (int j = i - k; j < i; j++) {
            if (j >= 1) {
                dp[i] = Math.min(dp[i], dp[j] + Math.abs(heights[i] - heights[j]));
            }
        }
    }
    System.out.println(dp[n]);
  }
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;

      public InputReader(InputStream stream) {
          this.stream = stream;
      }

      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }

      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }

      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }

      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }

      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }

      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}


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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }

int sz[100001];
int depth[100001];
int N;
int T;

int dfs(int v, int p, vector<vector<int>> &G, int d) {
  int ret = 1;
  depth[v] = d;
  for (int i = 0; i < G[v].size(); i++) {
    if (G[v][i] == p) continue;
    ret += dfs(G[v][i], v, G, d + 1);
  }
  return sz[v] = ret;
}

int dfs2(int v, int p, vector<vector<int>> &G, int d, int d_search) {
  if (v == N - 1) return 1;

  int ret = 0;
  for (int i = 0; i < G[v].size(); i++) {
    if (G[v][i] == p) continue;
    int r = dfs2(G[v][i], v, G, d + 1, d_search);
    ret |= r;
    if (r == 1 && d + 1 == d_search) {
      T = G[v][i];
    }
  }
  return ret;
}

void solve() {
  cin >> N;
  vector<vector<int>> G(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(0, -1, G, 0);
  dfs2(0, -1, G, 0, depth[N - 1] / 2 + 1);
  int szB = sz[T];
  int szA = N - szB;
  if (szA > szB) {
    cout << "Fennec" << endl;
  } else {
    cout << "Snuke" << endl;
  }
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}

Measured memory_bytes: 14336
using System;
using System.Linq;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class program{
  static void Main(string[] args){
    program p = new program();
    p.Run();
  }
  void Run(){
	int N = Readint()[0];
    int[] H= Readint();
    int max=0,count=0;
    for(int i=0;i<N-1;i++){
      if(H[i]>=H[i+1])
       	count++;
      else{
        if(max<count)
          max=count;
        count=0;
      }
    }
    if(max<count)
          max=count;
    WriteLine(max.ToString());
  }

  int[] Readint(){
    string[] s = ReadLine().Split();
    int[] res=new int[s.Length];
    Parallel.For(0,s.Length,i=>{
      res[i]=int.Parse(s[i]);
    });
    return res;
  }
}

Measured memory_bytes: 29656
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int x,y;
	cin >> x >> y;
	bool flg=false;
	for(int i=0;i<=x;i++)
	{
		int j=x-i;
		if(i*2+j*4==y)
			flg=true;
	}
	cout << (flg ? "Yes":"No") << endl;
		




}

Measured memory_bytes: 3040
import math
a, b, x = map(int, input().split())
A = b / a
B = 2 / a * (b - x / a**2)
C = (a * b**2) / (2 * x)
if A > B:
    print(math.degrees(math.atan(B)))
else:
    print(math.degrees(math.atan(C)))


Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
int main() {
	int i, j, k, f = 0, n, t, m, a, b, c;

	scanf("%d %d %d", &a, &b, &c);
	if (a == b) {
		if (b == c) {
			f = 1;
		}
	}
	if (f == 1) {
		printf("Yes");
	}
	else {
		printf("No");
	}
	return 0;
}

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

typedef long long ll;

int main () {
    ll a,b,c;
    ll sum = 0;
    cin >> a >> b >> c;

    for(int i=0; i<100000; i++) {
	sum += a;
	if( sum%b == c ) {
	    cout << "YES" << endl;
	    return 0;
	}
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int n,a[1000005],ans=1;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    for(int i=a[2];i>=2;i--)
    {
        int t=0;
        for(int j=1;j<=n;j++)
        {
            if(a[j]%i!=0) t++;
            if(t>=2) break;
        }
        if(t<=1)
        {
            ans=i;
            break;
        }
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 512
n,m=map(int,input().split())
l=[[] for _ in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)
queue=[0]
visit=[0]*n
visit[0]=1
ans=[0]*n

while len(queue)>0: 
  now=queue.pop(0)
  for p in l[now]:
    if visit[p]==0:
      visit[p]+=1
      queue.append(p)
      ans[p]=now+1
k=ans[1:]
if not all(kk!=0 for kk in k):
  print('No')
  exit()
print('Yes')
for kk in k:
  print(kk)

Measured memory_bytes: 38120
#include<bits/stdc++.h>
using namespace std;
int calc(char c){
  if(isdigit(c)) return c-'0';
  return 0;
}
string s[5];
int q,fff;
double win(){
  //cout<<s[0]<<endl<<s[1]<<endl<<s[2]<<endl<<s[3]<<endl<<s[4]<<endl;
  int pe,pf;
  int e=0,f=0;
  vector<int> u(4,1);
  u[q]=0;
  while(1){
    pe=e;pf=f;
    vector<int> p(4),w(4),g(4);
    
    for(int i=0;i<4;i++){
      p[i]=w[i]=g[i]=0;
      if(i!=q&&!u[i]) continue;
      for(int j=0;j<i;j++){
	if(j!=q&&!u[j]) continue;
	int t=s[j+1][8+i*5]-s[j+1][6+i*5];
	g[i]+=s[j+1][8+i*5];
	p[i]+=t;
	if(t>0) w[i]+=3;
	if(t==0) w[i]++;
      }
      for(int j=i+1;j<4;j++){
	if(j!=q&&!u[j]) continue;
	int t=s[i+1][6+j*5]-s[i+1][8+j*5];
	g[i]+=s[i+1][6+j*5];
	p[i]+=t;
	if(t>0) w[i]+=3;
	if(t==0) w[i]++;
      }
    }
    for(int i=0;i<4;i++){
      if(!u[i]) continue;
      e+=w[i]<w[q];
      f+=w[i]>w[q];
      u[i]=w[i]==w[q];
    }
    if(e>1) return 1.0;
    if(f>1) return 0.0;
    for(int i=0;i<4;i++){
      if(!u[i]) continue;
      e+=p[i]<p[q];
      f+=p[i]>p[q];
      u[i]=p[i]==p[q];
    }
    if(e>1) return 1.0;
    if(f>1) return 0.0;
    for(int i=0;i<4;i++){
      if(!u[i]) continue;
      e+=g[i]<g[q];
      f+=g[i]>g[q];
      u[i]=g[i]==g[q];
    }
    if(e>1) return 1.0;
    if(f>1) return 0.0;
    if(pe==e&&pf==f) break;
  }
  //cout<<e<<f<<":"<<(2.0-f)/(4-e-f)<<endl;
  if(e>1) return 1.0;
  if(f>1) return 0.0;
  fff=1;
  return (2.0-f)/(4-e-f);
}
typedef pair<int,int> P;
int main(){
  int N;
  cin>>N;
  double x[9],r[9],r2[9],pr[9];
  x[0]=r[0]=r2[0]=1.0;
  for(int i=1;i<=8;i++){
    x[i]=x[i-1]*i;
    r[i]=r[i-1]*0.25;
    r2[i]=r2[i-1]*0.75;
  }
  for(int i=0;i<=8;i++)
    pr[i]=x[8]/(x[i]*x[8-i])*r[i]*r2[8-i];
  while(N--){
    for(int i=0;i<5;i++) cin>>s[i];
    for(int i=0;i<4;i++)
      if(s[0][5+i*5]=='*') q=i;
    P p[4];
    for(int i=1,k=0;i<5;i++){
      for(int j=i;j<4;j++){
	if(s[i][6+j*5]=='_') p[k++]=P(i,6+j*5);
	if(s[i][8+j*5]=='_') p[k++]=P(i,8+j*5);
      }
    }
    double ans=0;
    for(int i=0;i<=8;i++){
      for(int j=0;j<=8;j++){
	for(int k=0;k<=8;k++){
	  for(int l=0;l<=8;l++){
	    s[p[0].first][p[0].second]=i+'0';
	    s[p[1].first][p[1].second]=j+'0';
	    s[p[2].first][p[2].second]=k+'0';
	    s[p[3].first][p[3].second]=l+'0';
	    //fff=0;win();if(fff)cout<<i<<j<<k<<l<<endl;
	    ans+=pr[i]*pr[j]*pr[k]*pr[l]*win();
	  }
	}
      }
    }
    printf("%.12lf\n",ans);
  }
  return 0;
}

Measured memory_bytes: 3128
#include<stdio.h>
using namespace std;
const int maxn=1<<21;
int n;
int a[105][105];
void dan()
{
    int minx;
    int d[105],color[105];
    for(int i=0;i<n;i++)
    {
        d[i]=maxn;
        color[i]=0;
    }
    d[0]=0;
    while(1)
    {
        minx=maxn;
        int u=-1;
        for(int i=0;i<n;i++)
        {
            if(d[i]<minx&&color[i]!=1)
            {
                minx=d[i];
                u=i;
            }
        }
        if(u==-1) break;
        color[u]=1;
        for(int i=0;i<n;i++)
        {
            if(color[i]==1||a[u][i]==maxn) continue;
            if(d[i]>d[u]+a[u][i])
            {
                d[i]=d[u]+a[u][i];

            }
        }
    }
    for(int i=0;i<n;i++)
    {
        printf("%d ",i);
        printf("%d\n",(d[i]==maxn)?-1:d[i]);
    }
}
int main()
{
    scanf("%d",&n);
    for(int i=0;i<105;i++)
    {
        for(int j=0;j<105;j++)
        {
            a[i][j]=maxn;
        }
    }
    int k,c,u,v;
    for(int i=0;i<n;i++)
    {
        scanf("%d%d",&k,&c);
        for(int j=0;j<c;j++)
        {
            scanf("%d%d",&u,&v);
            a[k][u]=v;
        }
    }
    dan();
    return 0;
}

Measured memory_bytes: 2756