akhauriyash/Code-Regression huggingface dataset:
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,PS[li];
int cev;
string s;
map<int,int> mpp;
vector<int> v;

main(void){
	scanf("%lld %lld",&n,&k);
	FOR{
		scanf("%lld",&a[i]);
		PS[i]=PS[i-1]+a[i];
	}
	mpp[0]++;
	FOR{
		if(i-k>=0){mpp[(PS[i-k]-(i-k))%k]--;}
		cev+=mpp[(PS[i]-i)%k];
		mpp[(PS[i]-i)%k]++;
		//~ cout<<mpp[(PS[i]-i)%k]<<endl;
	}
	printf("%lld\n",cev);
	return 0;
}


Measured memory_bytes: 18432
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = Integer.valueOf(String.valueOf(s.charAt(0)));
		int b = Integer.valueOf(String.valueOf(s.charAt(1)));
		int c = Integer.valueOf(String.valueOf(s.charAt(2)));
		int d = Integer.valueOf(String.valueOf(s.charAt(3)));
		if(a + b + c + d == 7) {
			System.out.println(a + "+" + b + "+" + c + "+" + d + "=" + (a + b + c + d));
			return;
		} else if(a + b + c - d == 7) {
			System.out.println(a + "+" + b + "+" + c + "-" + d + "=" + (a + b + c - d));
			return;
		} else if(a + b - c + d == 7) {
			System.out.println(a + "+" + b + "-" + c + "+" + d + "=" + (a + b - c + d));
			return;
		} else if(a - b + c + d == 7) {
			System.out.println(a + "-" + b + "+" + c + "+" + d + "=" + (a - b + c + d));
			return;
		} else if(a + b - c - d == 7) {
			System.out.println(a + "+" + b + "-" + c + "-" + d + "=" + (a + b - c - d));
			return;
		} else if(a - b + c - d == 7) {
			System.out.println(a + "-" + b + "+" + c + "-" + d + "=" + (a - b + c - d));
			return;
		} else if(a - b - c + d == 7) {
			System.out.println(a + "-" + b + "-" + c + "+" + d + "=" + (a - b - c + d));
			return;
		} else if(a - b - c - d == 7) {
			System.out.println(a + "-" + b + "-" + c + "-" + d + "=" + (a - b - c - d));
			return;
		}
		System.out.println(1);
	}
}

Measured memory_bytes: 23764
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace AtTest.AGC_029
{
    class D
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int[] hwn = ReadInts();
            int h = hwn[0];
            int w = hwn[1];
            int n = hwn[2];
            var obsPos = new int[n][];
            for (int i = 0; i < n; i++)
            {
                obsPos[i] = ReadInts();
            }
            obsPos = obsPos.OrderBy(a => a[0]).ToArray();
            var xList = new List<int>[w];
            for (int i = 0; i < w; i++) xList[i] = new List<int>();
            for (int i = 0; i < n; i++)
            {
                xList[obsPos[i][1] - 1].Add(obsPos[i][0]);
            }
            for (int i = 0; i < w; i++) xList[i].Add(h + 1);

            int res = h;
            int min = 0;
            for (int i = 0; i < w; i++)
            {
                min++;
                int j = 0;
                while (j < xList[i].Count && xList[i][j] <= min)
                {
                    if (xList[i][j] == min) min++;
                    j++;
                }
                if (j < xList[i].Count) res = Math.Min(res, xList[i][j] - 1);
            }
            Console.WriteLine(res);
        }

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


Measured memory_bytes: 50804
#include<bits/stdc++.h>
#define maxn 100010
#define pii pair<int,int>
using namespace std;
int a[maxn],u[maxn],v[maxn];
vector<pii>p,q;
int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(i&1)u[a[i]]++;
        else v[a[i]]++;
    }
    for(int i=0;i<maxn;i++)
    {
        p.push_back({u[i],i});
        q.push_back({v[i],i});
    }
    sort(p.begin(),p.end());
    sort(q.begin(),q.end());
    if(p[maxn-1].second!=q[maxn-1].second)
    {
        cout<<n-(p[maxn-1].first+q[maxn-1].first);
    }
    else
    {
        cout<<n-(p[maxn-1].first+max(p[maxn-2].first,q[maxn-2].first));
    }
return 0;
}


Measured memory_bytes: 3188
N = int(input())            
T,A = 0,0

for _ in range(N):
    t,a = map(int,input().split())
    if T<=t and A<=a:
        T,A = t,a
    else:
        T,A = t * max((T+t-1)//t,(A+a-1)//a), a * max((T+t-1)//t,(A+a-1)//a)    
print(T+A)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std ;
int main()
{
	int n;
	cin>>n;
	vector<int> p(n), q(n), p0(n);
	for(int i=0; i<n; i++) cin>>p[i];
	for(int i=0; i<n; i++) cin>>q[i];
	vector<vector<int>> v;
	iota(p0.begin(), p0.end(), 1);
	do{
		v.push_back(p0);
	}while(next_permutation(p0.begin(), p0.end()));
	int a=lower_bound(v.begin(), v.end(), p)-v.begin();
	int b=lower_bound(v.begin(), v.end(), q)-v.begin();
	cout<<abs(a-b)<<endl;
	return 0;
}


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

int main() {
	int N;
	cin >> N;
	long long a[N], b[N], c[N];
	for (int i = 0; i < N; i++) cin >> a[i] >> b[i] >> c[i];
	long long dp[3][N] = { -1 };
	dp[0][0] = a[0];
	dp[1][0] = b[0];
	dp[2][0] = c[0];
	if (N > 2) {
		for (int i = 1; i < N; i++) {
			dp[0][i] = max(dp[1][i - 1], dp[2][i - 1]) + a[i];
			dp[1][i] = max(dp[0][i - 1], dp[2][i - 1]) + b[i];
			dp[2][i] = max(dp[0][i - 1], dp[1][i - 1]) + c[i];
		}
	}
	long long x = dp[0][N - 1];
	long long y = dp[1][N - 1];
	long long z = dp[2][N - 1];
	if (x >= y && x >= z) {
		cout << x << endl;
	}
	else if (y > x && y >= z) {
		cout << y << endl;
	}
	else {
		cout << z << endl;
	}
}

Measured memory_bytes: 4992
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)] # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 

def main():
    n = inp()
    x = inpl()
    ans = float('inf')
    for i in range(1,101):
        cnt = 0
        for j in range(n):
            cnt += (i-x[j])**2
        ans = min(ans,cnt)
    print(ans)
    
if __name__ == "__main__":
    main()




Measured memory_bytes: 40940
l=list(input())
if l[0]=="A":
  del l[0]
  c=0
  p=0
  for i in range(1,len(l)-1):
    if l[i]=="C":
      c+=1
      p=i
  if c==1:
    del l[p]
    if str.islower("".join(l)):
      print("AC")
    else:
      print("WA")
  elif c!=1 :
    print("WA")
else:
  print("WA")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long

const ll mod = 1000000007 ;

using namespace std ;

int main()
{
	int n;
	cin>>n;
	int A[n];
	int cnt = 0 ;
	for(int i=0 ; i<n ; i++)
		cin>>A[i];
	for(int i=0 ; i<n ; i++)
	{
		for(int j=i+1 ; j<n ; j++)
		{
			for(int k=j+1 ; k<n ; k++)
			{
				if(A[i]+A[j]>A[k] && A[k]+A[j]>A[i] && A[i]+A[k]>A[j] && A[i]!=A[j] && A[j]!=A[k] && A[k]!=A[i])
					cnt++ ;
			}
		}
	}
	cout<<cnt;
}


Measured memory_bytes: 3640
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

#[derive(PartialEq, Eq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

fn main() {
    let N = read!(usize);
    let T = read![String, i64; N];

    let mut T = T
        .into_iter()
        .enumerate()
        .map(|(i, (city, score))| (city, Rev(score), i))
        .collect::<Vec<_>>();
    T.sort();

    for (_, Rev(_), i) in T {
        println!("{}", i + 1)
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

vector<ll> enum_div(ll n){
  vector<ll> ret;
  for(ll i = 1 ; i*i <= n ; ++i){
      if(n%i == 0){
        if(i != 1) {
          ret.push_back(i);
        }
        if(i*i != n){
          ret.push_back(n/i);
        }
      }
  }
  return ret;
}

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  ll N;
  cin >> N;
  
  auto d = enum_div(N);
  
  ll s = 0;
  for(auto mp : d) {
    if(mp - 1 > N / mp) {
      s += mp - 1;
    }
  }
  
  fin(s);
}

Measured memory_bytes: 384
# include <bits/stdc++.h>
# define fi first
# define se second

using namespace std ;

int vc[4][2];
int us[4], cnt ;

int main() {
    for( int i = 1 ; i <= 3 ; i ++ ) {
        cin >> vc[i][1] >> vc[i][2] ;
        us[vc[i][1]] ++ ;
        us[vc[i][2]] ++ ;
    }
    for( int i = 1 ; i <= 4; i ++ ) {
        if( us[i] == 1 ) cnt ++ ;
    }
    if( cnt > 2 ) cout << "NO" << endl;
    else cout << "YES" << endl;
}


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

int main(){
    int n;
    int x[8], y[8];
    cin >> n;
    for(int i=0;i<n;++i) cin >> x[i] >> y[i];
    double dist[8][8];
    for(int i=0;i<n;++i){
        for(int j=0;j<n;++j){
            dist[i][j] = sqrt(pow(x[i]-x[j], 2.0) + pow(y[i]-y[j], 2.0));
        }
    }

    int idx[8];
    for(int i=0;i<n;++i) idx[i] = i;
    int64_t cnt = 0;
    double sum = 0.0;
    do{
        for(int i=1;i<n;++i){
            sum += dist[idx[i-1]][idx[i]];
        }
        ++cnt;
    }while(next_permutation(idx, idx+n));
    printf("%.12f\n", sum / cnt);
    
    return 0;
}

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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int K, A, B;
  cin >> K >> A >> B;

  if ( A >= K ) {
    cout << 1+K << endl;
  } else if ( A+2 < B ) {
    int ans = 0;
    K -= (A-1);
    K -= 2;
    ans += B;
    if ( K%2 ) {
      ans += (B-A)*(K/2) + 1;      
    } else {
      ans += (B-A)*(K/2);      
    }
    cout << ans << endl;
  } else {
    cout << 1+K << endl;
  }  
  
  return 0;
}


Measured memory_bytes: 256
/* 166-A.cpp
 *     Created on : May 3, 2020 
 *     Time       : 6:04:06 PM
 *     Author     : null_ptr
 */
#include<iostream>
#include<cstring>

using namespace std;

int main()
{
	string str;
	cin>>str;
	if(str=="ABC")
		cout<<"ARC\n";
	else cout<<"ABC\n";
}


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

int main() {
    int n;
    cin >> n;
    vector<int> ts(n + 1), vs(n + 1);
    for (int i = 1; i <= n; i++) {
        int t;
        cin >> t;
        ts[i] = ts[i - 1] + t;
    }
    for (int i = 1; i <= n; i++) {
        cin >> vs[i];
    }

    auto ok = [&](double v, double t) -> bool {
        for (int i = 1; i <= n; i++) {
            if (ts[i - 1] <= t && t <= ts[i] && v > vs[i]) return false;
        }
        for (int i = 0; i <= n; i++) {
            int va = vs[i], vb = i + 1 <= n ? vs[i + 1] : 0;
            if (va <= v && (v - va) > abs(t - ts[i])) return false;
            if (vb <= v && (v - vb) > abs(t - ts[i])) return false;
        }
        return true;
    };
    
    vector<double> nax = {0};
    for (int i = 1; i < 2 * ts.back(); i++) {
        double t = 0.5 * i;
        assert(ok(0, t));
        for (int j = 200; j >= 0; j--) {
            double v = 0.5 * j;
            if (ok(v, t)) {
                nax.push_back(v);
                break;
            }
        }
    }
    nax.push_back(0);
    double ans = 0;
    for (int i = 1; i < nax.size(); i++) {
        // cout << i / 2.0 << ": " << nax[i] << endl;
        ans += (nax[i - 1] + nax[i]) / 4;
    }
    cout.setf(ios::fixed);
    cout.precision(10);
    cout << ans << endl;
}

Measured memory_bytes: 892
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;

const int N = 1e5 + 10;
int a[N];

int main()
{
	int n,x;
	scanf("%d%d",&n,&x);
	for (int i = 0;i < n;i++)
	{
		scanf("%d",&a[i]);
	}
	long long ans = 0;
	for (int i = 1;i < n;i++)
	{
		if (a[i-1] + a[i] > x)
		{
			int tmp = (a[i-1] + a[i]) - x;
			ans += tmp;
			if (tmp >= a[i])
			{
				a[i] = 0;
			}
			else
			{
				a[i] -= tmp;
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 640
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

int N;

int main() {
    cin >> N;
    vector<long long> A(1 << N);
    for (int i = 0; i < (1 << N); i++) {
        cin >> A[i];
    }
    int size = (1 << N);
    vector<vector<pair<long long, int>>> z(size);

    long long idx;
    for (int j = 0; j < (1 << N); j++) {
        z[j].push_back({A[j], j});
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < (1 << N); j++) {
            if (!(j & (1 << i))) {
                idx = j | (1 << i);
                for (auto p : z[j]) {
                    z[idx].push_back(p);
                }
                if (z[idx].size() > 2) {
                    sort(z[idx].begin(), z[idx].end());
                    z[idx].erase(z[idx].begin(), z[idx].end() - 2);
                }
            }
        }
    }

    long long ans = 0;
    for (int k = 1; k < (1 << N); k++) {
        long long value = 0;
        for (auto p : z[k]) {
            value += p.first;
        }
        ans = max(ans, value);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 35840
N = int(input())
a = map(int, input().split())
b = map(int, input().split())
ca, cb = 0, 0
for i, j in zip(a, b):
    if i > j:
        cb += i - j
    else:
        ca += (j - i) // 2
if ca >= cb:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 4652
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int m,f,r;
        while(true){
            m=sc.nextInt();
            f=sc.nextInt();
            r=sc.nextInt();
            if(m!=-1||f!=-1||r!=-1){
                if(m==-1||f==-1||m+f<30){
                    System.out.println("F");
                }
                else if(m+f>=80){
                    System.out.println("A");
                }
                else if(m+f>=65){
                    System.out.println("B");
                }
                else if(m+f>=50||r>=50){
                    System.out.println("C");
                }
                else{
                    System.out.println("D");
                }
            }
            else{
                break;
            }
        }
    }
}





Measured memory_bytes: 26408
#include <bits/stdc++.h>
#define N 400100
using namespace std;
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
struct edge
{
	int v,next;
}vs[N<<1];
int ee,st[N],fa[N];
inline void addedge(int u,int v)
{
	vs[++ee].v=v;vs[ee].next=st[u];st[u]=ee;
}
int n,size[N],dis[N];
inline void dfs(int rt,int pr)
{
	size[rt]=1;
	for(int i=st[rt];i;i=vs[i].next)
	{
		if(vs[i].v==pr) continue;
		dis[vs[i].v]=dis[rt]+1; 
		fa[vs[i].v]=rt;
		dfs(vs[i].v,rt);
		size[rt]+=size[vs[i].v];
	}
}
int main()
{
	n=read(); for(int i=1;i<n;i++)
	{
		int u=read(), v=read();
		addedge(u,v); addedge(v,u);
	}
	dfs(1,0); dis[n]--;
	int x=n; int dd=(dis[n]/2);
	while(dd--) x=fa[x];
	if(size[x]>=n-size[x]) printf("Snuke\n");
	else printf("Fennec\n");
	return 0;
}

Measured memory_bytes: 9600
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
	int N;
	vector<ll> vec(110);

	ll min = 1e9;
	ll max = 1;
		
	cin >> N;
	rep(i, N) { cin >> vec.at(i); }

	rep(i, N)
	{
		if (vec.at(i) > max) { max = vec.at(i); }
		if (vec.at(i) < min) { min = vec.at(i); }
	}

	cout << max - min << endl;
	return 0;
}

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

namespace ABC118A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a;
            var word = Console.ReadLine().Split(' ');
            int b = int.Parse(word[0]);
            int c = int.Parse(word[1]);
            int m = 0;
           
            if (c % b == 0)
                m = b + c;
            else
                m = c - b;

            Console.WriteLine(m);
            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int a,b;
	cin>>a>>b;
	if(a>=10||b>=10)
		cout<<-1;
	else
		cout<<a*b;
	return 0;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n;i++)
using namespace std;
using ll = long long;
#define int ll
int INF = -LONG_MAX/100;
signed main(){
    using pii = pair<int,int>;
    using piii  = pair<pii,int>;
    vector<piii>edge;
    int n,m; cin>>n>>m;
    rep(i,m){
        piii hoge; cin>>hoge.first.first>>hoge.first.second>>hoge.second;
        edge.push_back(hoge);
    }
    vector<int>d(n,INF);
    d[0]=0;
    for(int v=0; v<n*3;v++){
        bool update=false;
        rep(i,edge.size()){
            int from=edge[i].first.first-1;
            int to=edge[i].first.second-1;
            int cost=edge[i].second;
            if(d[from]==INF)continue;
            if(d[to]<d[from]+cost){
                d[to]=d[from]+cost;
                if(to==n-1)update=true;
            }
        }
        if(update&&v>2*n)return puts("inf")*0;
    }
    cout<<d[--n]<<endl;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdbool.h>

//????????????????????£?¨?.
bool ok(int n, int m, int k);

//??°?????????????????°.
int w[100000] = {};			//???????????????.

int main(void) {
	int n = 0;				//???????????°.
	int k = 0;				//?????????????????°??°.

	int l = 0;				//??????.
	int h = 0;				//??????.
	int m = 0;				//?????????.

	int i = 0;

	scanf("%d %d", &n, &k);

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

	while (l < h) {
		m = (l + h) / 2;

		if (ok(n, m, k))
			h = m;
		else
			l = m + 1;
	}

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

	return 0;
}

bool ok(int n, int m, int k) {
	int i = 0;
	int sum = 0;			//???????????????????????§????????????.
	int num = 1;			//?????£????????????????????°??°.

	for (i = 0; i < n; i++) {
		if (w[i] > m)
			return false;

		sum += w[i];

		if (sum > m)
			sum = w[i], num++;
	}

	if (num <= k)
		return true;
	else
		return false;
}

Measured memory_bytes: 984
#include<bits/stdc++.h>
    #define ll long long
    #define f   first
    #define s   second
    #define pb          push_back
    #define mod         1000000007
    #define hell        998244353
    #define inf         1000000000000000000LL
    using namespace std;
    ll n,k,m,l,mx,sum,q;

    void solve()
    {   ll a,b,x,y,c;
        string s;
        cin>>n>>k>>c;
        cin>>s;
        ll L[k],R[k];
        x=0;
        ll ini=0;
        while(x<k && ini<n)
        {
            if(s[ini]=='x') {ini++;continue;}
            {
                L[x]=ini+1;
                ini+=(c+1);
                x++;
            }
        }
        reverse(s.begin(),s.end());
        ini=0;
        x=0;
        while(x<k && ini<n)
        {
            if(s[ini]=='x') {ini++;continue;}
            {
                R[x]=n-ini;
                ini+=(c+1);
                x++;
            }
        }
        reverse(R,R+k);
        for(int i=0;i<k;i++)
        {   //cout<<L[i]<<" "<<R[i]<<"\n";
            if(L[i]==R[i]) cout<<L[i]<<"\n";
        }

    }    
    int main()
    {  
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
        //cout<<primes.size();
        
        ll t=1;
        //cin>>t;
        while(t--)
            solve();

    }


Measured memory_bytes: 5012
#include<stdio.h>
#include<stdlib.h>
#define MAX 1000005
int P[MAX],F[MAX]={1,1},i,j,k,l,p=0,r,N,M,A[1500];
int c(const void *a,const void *b)
{
	return *(int*)a-*(int*)b;
}
int main()
{
	for (i=2;i<MAX;i++)
		if (!F[i])
		{
			P[p++]=i;
			for (j=i*2;j<MAX;j+=i)
			F[j]=1;
		}
	for(;scanf("%d%d",&N,&M),M>0;)
	{
		for(i=0;P[i]<=N;i++);
		for(j=i,l=0;j<i+50;j++)
			for(k=j;k<i+50;k++,l++)
				A[l]=P[j]+P[k];
		qsort(A,1275,sizeof(int),c);
		printf("%d\n",A[M-1]);
	}
	return 0;
}

Measured memory_bytes: 6792
n, m, x, y = map(int, input().split())
l = [list(map(int, input().split())) for i in range(2)]
if min(l[1]) - max(l[0])> 0 and max(l[0]) < y and x < min(l[1]):
    print('No War')
else:
    print('War')

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

char a[51][51];

signed main(){

  int h,w; cin >> h >> w;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> a[i][j];
    }
  }

  int flag = 1;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(a[i][j] == '#'){
        if(a[i+1][j] != '#' && a[i][j-1] != '#' && a[i-1][j] != '#' && a[i][j+1] != '#') flag = 0;
      }
    }
  }
  cout << (flag ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long k = sc.nextInt();
		long a = sc.nextInt();
		long b = sc.nextInt();
		long ans = 1;
		long count = 0;
		if(a >= b) {
			ans = ans + k;
		} else {
			long hitNum = ans + k;
			ans = a;
			count = a - 1;
			while(count <= k-2) {
				ans += b-a;
				count += 2;
			}
			while(count < k) {
				ans++;
				count++;
			}
			ans = Math.max(ans, hitNum);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23764
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        a: [isize; n],
    }

    let mut hash = HashMap::new();
    for i in 0..n {
        *hash.entry(a[i] - i as isize - 1).or_insert(0) += 1;
    }
    let mut ans = 0usize;
    for i in 0..n {
        ans += *hash.entry(-a[i] - i as isize - 1).or_insert(0);
        *hash.entry(a[i] - i as isize - 1).or_insert(0) -= 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 16584
#include<bits/stdc++.h>
#define ford(i,a,b) for(int i=(a);i>=b;i--)
#define rep1(i,a,b) for(int i=(a);(i)<=(b);(i)++)
#define rep(i,a,b) for(int i=(a);(i)<(b);(i)++)
#define LL long long
#define N 105
#define pql priority_queue<ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define rev(a,n) reverse(a,a+n)
#define forv(v) for(vector <int> :: iterator iter=v.begin();iter!=v.end();++iter)
#define form(v) for(map<int,int> :: iterator iter=v.begin();iter!=v.end();++iter)
using namespace std;
LL x,k,d; 
int main() {
	cin>>x>>k>>d;
	if(x<0) x*=-1;
	if(x/d>=k) {
		cout<<x-d*k;
		return 0;
	}
	if((k-x/d)%2==0) cout<<x-x/d*d;
	else cout<<(x/d+1)*d-x; 
	return 0;
}


Measured memory_bytes: 3608
function main(input) {
    var line = input.split(/\r?\n/g);
    var arr = line[0].split(" ");
    const H = arr[0], N = arr[1];
    var A = line[1].split(" ").map(Number);
    var accum = 0;
    for (var i = 0; i < A.length; i++)
        accum += A[i];
    console.log(1 < Math.ceil(H / accum) ? "No" : "Yes");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 16716
S = list(input())
N = len(S)
A = int((N-1)/2)
B = int((N+3)/2)

S_A = S[:A]
S_B = S[B-1:]

ans = 0
S_R = list(reversed(S))
if S != S_R:
    ans += 1
    
S_A_R = list(reversed(S_A))
if S_A != S_A_R:
    ans += 1
    
S_B_R = list(reversed(S_B))
if S_B != S_B_R:
    ans += 1

if ans == 0:
    print("Yes")
else:
    print("No")

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

int const N = 1e5 + 7;

long long ar[N];
int main()
{
	int n;
	cin >> n;

	long long x, y;
	long long sum = 0;
	for (int i = 0; i < n; ++i)
	{
		cin >> x;
		ar[x] ++;

		sum += x;
	}

	int q;
	cin >> q;

	for (int i = 0; i < q; ++i)
	{
		cin >> x >> y;

		sum += ar[x] * (y - x);
		ar[y] += ar[x];
		ar[x] = 0;

		cout << sum << '\n';
	}
	return 0;
}

Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
#define MAX 2000000
#define ll long long
int p[MAX];

void Eratosthenes(){
	for(int i = 0; i < MAX; i++){
		p[i] = 1;
	}
	p[0] = 0; p[1] = 0;
	for(int i = 2; (long)i < sqrt(MAX); i++){
		if(p[i]){
			for(int j = 0; i * (j + 2) < MAX; j++){
				p[i *(j + 2)] = 0;
			}
		}
	}
}
map<ll,ll> prime_factor(ll n){
	map<ll,ll> res;
	for(ll i=2;i*i<=n;i++){
		while(n%i==0){
			res[i]++;
			n/=i;
		}
	}
	if(n!=1)res[n]=1;
	return res;
}

int main(void){
	long long N;
	long long a = 0, b = 1;
	cin >> N;
	map<ll, ll> mp = prime_factor(N);
	for(auto x: mp){
		a++;
		b *= (x.second + 1);
	}
	// Eratosthenes();
	// int sq = sqrt(N);
	// for(int i = 0; i <= sq; ++i){
	// 	if(!p[i]) continue;
	// 	if(N % (long long)i == 0LL){
	// 		a++;
	// 		long long tmp = 1;
	// 		while(N % (long long)i == 0LL){
	// 			tmp++;
	// 			N /= i;
	// 		}
	// 		b *= tmp;
	// 	}
	// 	if(i > sq && a == 0) break;
	// }
	if(a == 0){
		cout << 1 << " " << 1 << endl;
	}else{
		cout << a << " " << b-1 << endl;
	}
	return 0;
}


Measured memory_bytes: 3104
"""
- N個の島とN-1個の橋
- i番目の橋は島iと島i+1を接続する
- ai番目とbi番目の島の間での諍いを止めたい
    - aiとbi番目の島を隔離する
- こんな要望がM個

始点と終点が必要そうだから、2次元に値を保存してみる⇨遅い。ダメ
"""
import heapq
N,M = map(int, input().split())

# たくさん値を持っておく必要はない
# 左端を固定しながら、右端の一番近いところを算出していく
# 一番近いところを切れれば、それより遠いところも自ずと切れる
dic = {}
for i in range(M):
    a, b = map(int, input().split())
    if a not in dic or dic[a] > b:
        dic[a] = b

# 条件が厳しい右から考えていくパターン
# a,bで考えて,まだ着られていない(最後に切られたposより右にある)なら、aで切る(最も左端)
# 切った左端よりも左側にあるならもう一回切る必要がある。そうじゃないなら切る必要なし
cnt = 0
pos = 1000000000000
for j in sorted(dic.keys(),reverse=True): # 降順に並べる(右側から)
    if dic[j] <= pos:
        cnt += 1
        pos = j
print(cnt)


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)            \
    cerr << #v << ": ";         \
    REP(__i, (v).size())        \
    cerr << ((v)[__i]) << ", "; \
    cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()
#define MM << " " <<
int main()
{
    int N, D;
    cin >> N >> D;
    int sum = 0;
    for (int i = 0; i < N; i++)
    {
        ll x, y;
        cin >> x >> y;
        if (sqrt(x * x + y * y) <= D)
            sum++;
    }

    cout << sum << endl;
}


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

int main(){
  	int N,M,K,F,ans(0);
  	cin >> N >> M;
 	vector<int> fav(M,0);
  	for(int i = 0 ; i < N ; i ++){
    	cin >> K;
      	for(int I = 0 ; I < K ; I ++){
         	cin >> F;
          	fav[F - 1] ++;
        }
    }
  	for(int i = 0 ; i < M ; i ++){
     	if(fav[i] == N) ans ++;
    }
  	cout << ans << endl;
}

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> image(H, vector<char>(W));
    for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
            cin >> image[y][x];
        }
    }
    for (int y = 0; y < H * 2; y++) {
        for (int x = 0; x < W; x++) {
            cout << image[y / 2][x];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
(defparameter mod-number 1000000007)

(defun unfold (p f g seed &optional (tail-gen (lambda () '())))
  (if (p seed)
      (tail-gen seed)
	  (cons (f seed)
	        (unfold p f g (g seed) tail-gen))))
  
(defun iota (c &optional (s 0) (step 1) (acc nil))
  (if (zerop c)
      (reverse acc)
      (iota (1- c) (+ s step) step (cons s acc))))
 
(defun sum (list &optional (init 0))
  (reduce #'+ list :initial-value init))
 
(defmacro debug-print (x)
  `(let ((y ,x))
    (format t "~A: ~A~%" ',x y)
	y))

(defparameter n (read))
(defparameter m (read))

(defparameter l nil)
(defparameter r nil)

(dotimes (i m)
  (push (read) l)
  (push (read) r))

(let ((l-max (apply #'max l))
      (r-min (apply #'min r)))
  (format t "~A~%" (max 0 (1+ (- r-min l-max)))))


Measured memory_bytes: 61928
#include <iostream> 
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <= n;i++)
typedef long long int ll;
const ll MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main(void) {
    int n; cin >> n; vector<vector<ll>> dp(n + 10, vector<ll>(5,0));
    string s = "ACGT";
    rep(i, 4) dp[0][i] = 1;
    req(i, n - 1) {
        rep(j, 4) rep(k, 4) {
            dp[i][j] += dp[i - 1][k];
            dp[i][j] %= MOD;
        }if (i >= 2) {
            dp[i][1] -= (dp[i - 2][0] + dp[i - 2][2]);
            dp[i][1] = (dp[i][1] + MOD * 2) % MOD;
            dp[i][2] -= dp[i - 2][0];
            dp[i][2] = (dp[i][2] + MOD) % MOD;
        }if (i >= 3) {
            dp[i][1] -= dp[i - 3][0] * 3;
            dp[i][1] = (dp[i][1] + MOD * 3) % MOD;
            dp[i][2] += dp[i - 3][2];
            dp[i][2] %= MOD;
        }
    }ll ans = 0;
    rep(i, 4) ans += dp[n - 1][i];
    ans %= MOD;
    cout << ans << endl;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	int N;
	cin >> N;
	int ans = 0;
	fx(N) {
		int a;
		cin >> a;
		if (x%2==0&&a%2==1) {
			ans++;
		}
	}

	ce(ans)
    return 0;
}



Measured memory_bytes: 3592
N, M = map(int, input().split())
E1 = [1] + [0 for _ in range(N - 1)]
EN = [0 for _ in range(N - 1)] + [1]
for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        E1[b - 1] = 1
    elif b == N:
        EN[a - 1] = 1
for i in range(N):
    if E1[i] * EN[i] == 1:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')


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

bool uru(int y){
  if(!(y%400))return true;
  if(!(y%100))return false;
  if(!(y%4))return true;
  return false;
}

int day(int y, int m, int d){
  int res = 0;
  int month[] = {31,0,31,30,31,30,31,31,30,31,30};

  for(int i=0;i<y;i++){
    if(uru(i))res += 366;
    else res += 365;
  }

  for(int i=0;i<m-1;i++)res += month[i];
  if(m>2){
    if(uru(y))res += 29;
    else res += 28;
  }

  res += d;
  return res;
}

  

int main(){
  int y1,y2,m1,m2,d1,d2;

  while(1){
    cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
    if(y1<0 || m1<0 || d1<0 || y2<0 || m2<0 || d2<0)break;

    int s1,s2;
    s1 = day(y1,m1,d1);
    s2 = day(y2,m2,d2);
    cout << s2 - s1 << endl;
  }
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int X;
  cin >> X;
  if(X>=400&&X<=599){
    cout << 8 << endl;
  }
  else if(X>=600&&X<=799){
    cout << 7 << endl;
  }
  else if(X>=800&&X<=999){
    cout << 6 << endl;
  }
  else if(X>=1000&&X<=1199){
    cout << 5 << endl;
  }
  else if(X>=1200&&X<=1399){
    cout << 4 << endl;
  }
  else if(X>=1400&&X<=1599){
    cout << 3 << endl;
  }
  else if(X>=1600&&X<=1799){
    cout << 2 << endl;
  }
  else if(X>=1800&&X<=1999){
    cout << 1 << endl;
  }
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> res(H, vector<char>(W));

  for (int i = 0; i < H; i++)
    for (int j = 0; j < W; j++) cin >> res.at(i).at(j);
    
  vector<bool> A(H,false),B(W,false) ;

  for (int j = 0; j < W; j++){
    int cnt1 = 0;
    for (int i = 0; i < H; i++){
      if (res.at(i).at(j) == '.') cnt1++;
    }
    if (cnt1 == H) B.at(j) = true;
  }

  for (int i = 0; i < H; i++){
    int cnt2 = 0;
    for (int j = 0; j < W; j++){
      if (res.at(i).at(j) == '.') cnt2++;
    }
    if (cnt2 == W) A.at(i) = true;
  }

//  for (int i=0;i<H;i++) cout << A.at(i);
//  cout << endl;

//  for (int j=0;j<W;j++) cout << B.at(j);
//  cout << endl;
   
  for (int i = 0; i < H; i++){
      if (A.at(i) == true) continue;
    for (int j = 0; j < W; j++){
      if (B.at(j) == true) continue;
      cout << res.at(i).at(j);
    }
    cout << endl;
  }
}



Measured memory_bytes: 256
A,B,C,D,E,F=map(int,input().split())
W=set()
for a in range(0,F+1,100*A):
    for b in range(0,F+1-a,100*B):
        W.add(a+b)
S=set()
for c in range(0,F+1,C):
    for d in range(0,F+1-c,D):
        S.add(c+d)
mx=-1
for w in W:
    for s in S:
        if 0<w+s<=F and s<=w*E//100:
            if mx<s/(w+s):
                ans=w+s,s
                mx=s/(w+s)
print(ans[0],ans[1])

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/fenwicktree>
using namespace atcoder;
using ll = long long;
#define rep(CNT, GOAL) for (int CNT = 0; CNT < (int)(GOAL); CNT++)

int main() {
  int N, Q; cin >> N >> Q;
  fenwick_tree<ll> fw(N);
	rep(i, N) {
		ll a; cin >> a;
		fw.add(i, a);
	}
  while (Q--) {
    int q; cin >> q;
    if (q == 0) {
      int p; ll x; cin >> p >> x;
      fw.add(p, x);
    } else {
      int l, r; cin >> l >> r;
      cout << fw.sum(l, r) << endl;
    }
  }
}

Measured memory_bytes: 8212
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <queue>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstring>
#include <cstdio>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

int main(void){
  int a, b;
  cin >> a >> b;

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

  return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	a := map[int]struct{}{}
	b := map[int]struct{}{}
	c := map[int]struct{}{}

	for _, v := range []int{1, 3, 5, 7, 8, 10, 12} {
		a[v] = struct{}{}
	}
	for _, v := range []int{4, 6, 9, 11} {
		b[v] = struct{}{}
	}
	for _, v := range []int{2} {
		c[v] = struct{}{}
	}

	var x, y int
	fmt.Scanf("%d %d", &x, &y)
	for _, v := range []map[int]struct{}{a, b, c} {
		_, okx := v[x]
		_, oky := v[y]
		if okx && oky {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


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

namespace _0024
{
    class Program
    {
        const double _floorHeight = 5;
        static void Main(string[] args)
        {
            string velocity = "";
            while ((velocity = Console.ReadLine()) != null)
            {
                double needTimeForBreak = Derivation.TimeFromVelocity(double.Parse(velocity));
                double needDistanceForBreak = Derivation.DistanceFromTime(needTimeForBreak);
                int needFloorForBreak = Derivation.FloorFromDistance(needDistanceForBreak, _floorHeight);
                Console.WriteLine(needFloorForBreak);
            }
        }
    }
    class Derivation
    {
        internal static double TimeFromVelocity(double velocity)
        {
            double time = velocity / 9.8;
            return time;
        }
        internal static double DistanceFromTime(double time)
        {
            double distance = 4.9 * Math.Pow(time, 2);
            return distance;
        }
        internal static int FloorFromDistance(double distance, double floorHeight)
        {
            int floor = 0;
            if (distance % floorHeight == 0)
            {
                floor = (int)(distance / floorHeight + 1);
            }
            else
            {
                floor = (int)(distance / floorHeight + 2);
            }
            return floor;
        }
    }
}



Measured memory_bytes: 13952
# include <bits/stdc++.h>
using namespace std;
namespace Base{
	# define mr make_pair
	typedef long long ll;
	typedef double db;
	const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
	const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
	template<typename T> void read(T &x){
    	x = 0; int fh = 1; double num = 1.0; char ch = getchar();
		while (!isdigit(ch)){ if (ch == '-') fh = -1; ch = getchar(); }
		while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	    if (ch == '.'){
	    	ch = getchar();
	    	while (isdigit(ch)){num /= 10; x = x + num * (ch - '0'); ch = getchar();}
		}
		x = x * fh;
	}
	template<typename T> void chmax(T &x, T y){x = x < y ? y : x;}
	template<typename T> void chmin(T &x, T y){x = x > y ? y : x;}
}
using namespace Base;
const int N = 3010, P = 998244353;
int a, b, c, d;
int f[N][N];
int main(){
	read(a); read(b); read(c); read(d);
	f[a][b] = 1;
	for (int i = a + 1; i <= c; i++)
		f[i][b] = (1ll * f[i - 1][b] * b) % P;
	for (int i = b + 1; i <= d; i++)
		f[a][i] = (1ll * f[a][i - 1] * a) % P;
	for (int i = a + 1; i <= c; i++)
		for (int j = b + 1; j <= d; j++){
			f[i][j] = (1ll * f[i - 1][j] * j + 1ll * f[i][j - 1] * i) % P;
			f[i][j] = (f[i][j] - 1ll * f[i - 1][j - 1] * (i - 1ll) % P * (j - 1ll)% P + P) % P;
		}
	cout << f[c][d] << endl;
    return 0;
}


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

int main()
{
    int c[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> c[i][j];
        }
    }
    
    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            for(int k=0;k<=100;k++){
                if(c[0][1]==c[0][0]-i+j &&
                   c[0][2]==c[0][0]-i+k &&
                   c[1][2]==c[1][1]-j+k &&
                   
                   c[1][0]==c[1][1]-j+i &&
                   c[2][0]==c[2][2]-k+i &&
                   c[2][1]==c[2][2]-k+j){
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    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>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
#define itn int
#define all(c) c.begin(),c.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define ll long long
#define ull unsigned long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
using namespace std;
 
const ll MAX_N = 2e5 + 5, inf = 1e18, mod = 1000000007;
const double PI = 3.1415926536;
int days[13] = {0, 31, 28, 31, 30, 31,30, 31, 31, 30, 31, 30, 31};
 
template<typename T>
ostream& operator <<(ostream& out, const vector<T>& mas) {
    for (const auto& x : mas) {
        out << x << ' ';
    }
    return out;
}
 
void ok() {
    cout << "OK" << '\n';
}
 
void no() {
    cout << "NG" << '\n';
}
 
inline ll nxt() {
    ll x;
    cin >> x;
    return x;
} 
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    int k = nxt();
    int a = nxt(), b = nxt();
    for (int i = a; i <= b; i++) {
        if (i % k == 0) {
            ok();
            return 0;
        }
    }
    no();
    return 0;

}

Measured memory_bytes: 3600
n,m=map(int,input().split())
A=set()
B=set()

for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    A.add(b)
  if b==n:
    B.add(a)
if len(A&B)==0:
  print("IMPOSSIBLE")
else:
  print("POSSIBLE")



Measured memory_bytes: 102508