akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

int h, w, ans = 0;
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
char a[1919][1919];
queue<P>que;

void bfs() {
	cin >> h >> w;
	rep(i, h) {
		rep(j, w) {
			cin >> a[j][i];
			if (a[j][i] == '#') que.push(P(j, i));
		}
	}
	que.push(P(inf, inf));
	while (!que.empty()) {
		P x = que.front();
		que.pop();
		if (x.first == inf && x.second == inf) {
			que.push(P(inf, inf));
			P y = que.front();
			ans++;
			if (y.first == inf && y.second == inf) break;
			continue;
		}
		rep(i, 4) {
			int nx = dx[i] + x.first, ny = dy[i] + x.second;
			if (nx >= 0 && ny >= 0 && nx < w && ny < h && a[nx][ny] == '.') {
				que.push(P(nx, ny));
				a[nx][ny] = '#';
			}
		}
		
	}
	cout << ans - 1 << endl;
}

signed main() {
	bfs();

	return 0;
}


Measured memory_bytes: 18484
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
using namespace std;

string bubble(string s) {
	int n = s.size();
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n - i - 1; j++) {
			if (s[j] > s[j + 1]) {
				swap(s[j], s[j + 1]);
			}
		}
	}
	return s;
}

string reverse(string s) {
	int n = s.size();
	for (int i = 0; i < n / 2; i++) {
		swap(s[i], s[n - i - 1]);
	}
	return s;

}

int main()
{
	string s, t;
	cin >> s;
	cin >> t;
	s = bubble(s);
	t = bubble(t);
	t = reverse(t);
	int m, n;
	m = s.size();
	n = t.size();
	int N;
	N = max(m, n);
	bool f = true;
	if (s[0] >= t[0]) {
		for (int i = 0; i < N; i++) {
			if (s[i] > t[i]) {
				f = false;
				break;
			}
		}
		if (t == s) {
			f = false;
		}
	}
	if (f) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  string s; cin >> s;
  int n = (int)s.size();
  bool f = s == "keyence";
  for(int i = 0; i < n; ++i){
    for(int j = i; j <= n; ++j){
      string t;
      for(int k = 0; k < n; ++k){
	if(i > k || k >= j)t += s[k];
      }
      f |= t == "keyence";
    }
  }
  cout << (f?"YES":"NO") << endl;
  return 0;
}


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

int main(){
    int a, b, n = 0;
    cin >> a >> b;
    for(int i= 0; i < 2; i++){
      if(a >= b){
        n += a;
        --a;
      }else{
        n +=b;
        --b;
      }
    }
    cout << n << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var n = sc.nextInt();
		var m = sc.nextInt();
		var numbers = new ArrayList<Integer>();
		for (var i = 0; i < n; i++) {
			numbers.add(i + 1);
		}
		var uf = new Main().new UnionFind(numbers);
		for (var i = 0; i < m; i++) {
			uf.union(sc.nextInt(), sc.nextInt());
		}
		sc.close();

		var hashMap = new HashMap<Integer, Integer>();
		for (var i = 0; i < n; i++) {
			var root = uf.find(i + 1);
			if (!hashMap.containsKey(root)) {
				hashMap.put(root, 0);
			}
			hashMap.put(root, hashMap.get(root) + 1);
		}

		var max = 0;
		for (var v : hashMap.values()) {
			max = Math.max(max, v);
		}
		System.out.println(max);
	}

	public class UnionFind {
		public HashMap<Integer, Integer> parents = new HashMap<Integer, Integer>();
		public HashMap<Integer, Integer> ranks = new HashMap<Integer, Integer>();

		public UnionFind(List<Integer> numbers) {
			for (var number : numbers) {
				parents.put(number, number);
				ranks.put(number, 0);
			}
		}

		public void union(int number1, int number2) {
			var root1 = find(number1);
			var root2 = find(number2);
			if (root1 != root2) {
				if (ranks.get(root1) < ranks.get(root2)) {
					parents.put(root1, root2);
				} else {
					parents.put(root2, root1);
					if (ranks.get(root1) == ranks.get(root2)) {
						ranks.put(root1, ranks.get(root1) + 1);
					}
				}
			}
		}

		public int find(int number) {
			var parent = parents.get(number);
			if (number == parent) {
				return number;
			}
			var find = find(parent);
			parents.put(number, find);
			return find;
		}
	}
}


Measured memory_bytes: 91904
import java.io.DataInputStream
import java.lang.StringBuilder
import java.math.BigInteger
import kotlin.math.absoluteValue

private fun readInts() = readLine()!!.split(' ').map { it.toInt() }

internal class FastReaderdsds() {
    private val inStream: DataInputStream = DataInputStream(System.`in`)
    private val bufferSize = 1024
    private var buffer = ByteArray(bufferSize)
    private var bufferPointer = 0
    private var bytesread = 0


    fun getNextDigit(): Int {
        var ret: Byte = readByte()
        while (ret <= ' '.toByte()) ret = readByte()
        return ret - '0'.toInt()
    }

    fun getDigitOrNegativeOne(): Int {
        var ret: Byte = readByte()
        if (ret <= ' '.toByte()) {
            return -1
        } else {
            return ret - '0'.toInt()
        }
    }


    fun getNextInt(): Int {
        var ret = 0
        var c: Byte = readByte()
        while (c <= ' '.toByte()) c = readByte()
        val neg = c == '-'.toByte()
        if (neg) c = readByte()
        do {
            ret = ret * 10 + c - '0'.toInt()
        } while (readByte().also({ c = it }) >= '0'.toByte() && c <= '9'.toByte())
        return if (neg) -ret else ret
    }

    private fun fillBuffer() {
        bytesread = inStream.read(buffer, 0, bufferSize)
        bufferPointer = 0
    }

    fun readByte(): Byte {
        if (bufferPointer == bytesread) {
            fillBuffer()
        }
        return buffer[bufferPointer++]
    }

    fun close() {
        inStream.close()
    }
}


fun main() {
    val rd = FastReaderdsds()


    val h = rd.getNextInt()
    val w = rd.getNextInt()

    if (h==1 || w == 1){
        print(1)
        return
    }

    val res = (h.toBigInteger() * w.toBigInteger() - BigInteger.ONE).divide(2.toBigInteger()) + BigInteger.ONE


    print(res)
}


Measured memory_bytes: 34352
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int
struct edge { int to, cost; };
typedef pair<int, int> P;

int V;
vector<edge> G[2010];
int d[2010][2010];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    d[s][s] = 0;
    que.push(P(0, s));
    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[s][v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++){
            edge e = G[v][i];
            if (d[s][e.to] > d[s][v] + e.cost) {
                d[s][e.to] = d[s][v] + e.cost;
                que.push(P(d[s][e.to], e.to));
            }
        }
    }
}


signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, x, y;
    cin >> n >> x >> y;
    x--; y--;
    G[x].push_back({y, 1});
    G[y].push_back({x, 1});
    rep(i, n - 1) {
        G[i].push_back({i + 1, 1});
        G[i + 1].push_back({i, 1});
    }
    rep(i, 2010) rep(j, 2010) d[i][j] = INF2;
    rep(i, n) dijkstra(i);
    int cnt[2010] = {};
    rep(i, n) {
        rep(j, n) {
            cnt[d[i][j]]++;
        }
    }
    rep(i, n - 1) {
        cout << cnt[i + 1] / 2 << endl;
    }

    return 0;
}


Measured memory_bytes: 32000
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

ll gcd(ll a, ll b);
ll power(ll n, ll k);
ll inv(ll n);
ll genfact(ll n, ll k);
ll fact(ll n);
ll nck(ll n, ll k);


bool ok(int i){
  int a[10] = {};
  while (i > 0){
    a[i % 10]++;
    i /= 10;
  }
  if (a[3]*a[5]*a[7] > 0)
    return 1;
  else
    return 0;
}

int main(void){
  int s;
  cin >> s;

  vector<int> sft(0);

  sft.push_back(3);
  sft.push_back(5);
  sft.push_back(7);
  int t = sft.size(), r = 0;
  for (int i = 0; i < 8; i++){
    t = sft.size();
    for (int j = r; j < t; j++){
      sft.push_back(sft[j]*10 + 3);
      sft.push_back(sft[j]*10 + 5);
      sft.push_back(sft[j]*10 + 7);
    }
    r = t;
  }


  int ret = 0;
  for (int i = 0; i < sft.size(); i++){
    if (sft[i] <= s && ok(sft[i])){
      ret++;
    }
  }
  cout << ret << endl;

  return 0;
}

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

ll power(ll n, ll k){
  ll res = 1;
  while(k > 0){
    if (k & 1) 
      res = res * n % MOD;
    n = n * n % MOD;
    k >>= 1;
  }
  return res;
}

ll genfact(ll n, ll k){

  ll res = 1;
  while (k >= 0){
    res = (res * (n - k)) % MOD;
    k--;
  }

  return res;
}

ll inv(ll n){
  return power(n, MOD - 2);
}

ll fact(ll n){
  return genfact(n, n - 1);
}

ll nck(ll n, ll k){
  if (k == 0)
    return 1;
  if (n <= 0)
    return 0;

  return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD;
}


Measured memory_bytes: 512
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<limits>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1000000000 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main() {
	int n,k,ans=0,sp=0,count_sp=0;
	cin >> n >> k;

	VI a(n),cnt(200010);
	rep(i, n) {
		cin >> a[i];
	}

	sort(all(a));
	rep(i, n) cnt[a[i]]++;
	sort(all(cnt));

	rep(i, 200010) {
		if (cnt[i] > 0) sp++;
	}


	rep(i, 200010) {
		if (sp > k && cnt[i]>0) {
			ans += cnt[i];
			sp--;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<utility>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
int main(){
    ll n,m;
    long long a,c,ans=0,b;
    vector<pair<ll,ll> >in;
    scanf("%lld %lld",&n,&m);
    for(int i=0;i<n;i++){
        scanf("%lld",&a);
        in.push_back(make_pair(a,1));
    }
    for(int i=0;i<m;i++){
        scanf("%lld %lld",&b,&c);
        in.push_back(make_pair(c,b));
    }
    sort(in.begin(),in.end());
    for(int i=in.size()-1;i>=0;i--){
        if(in[i].second<=n){
            ans+=in[i].first*in[i].second;
            n-=in[i].second;
        }
        else{
            ans+=in[i].first*n;
            n=0;
        }
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 6384
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N,K;
    cin >> N >> K;
    map<char ,bool> mp;
    ll i,j;
    string s;
    for(i=0;i<=9;i++){
        s=to_string(i);
        mp[s[0]]=0;
    }
    for(i=0;i<K;i++){
        cin >> s;
        mp[s[0]]=1;
    }
    bool flag;
    for(i=N;i<100000;i++){
        s=to_string(i);
        flag=1;
        for(j=0;j<s.size();j++){
            if(mp[s[j]]==1)flag=0;
        }
        if(flag){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int INF = 1000000007;
 
int main(){
  string S, T;
  cin >> S >> T;
  bool ans = false;
  for(int i=0;i<S.size();i++){
    if(S == T){
      ans = true;
      break;
    }
    char c = S[S.size()-1];
    for(int j=S.size()-1;j>0;j--){
      S[j] = S[j-1];
    }
    S[0] = c;
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();

    println!("{} {}", a * b, 2 * (a + b));
}


Measured memory_bytes: 5036
def allocation(A, k):
    def C(P):
        i = 0
        for j in range(k):
            s = 0  # current load for jth car
            while s + A[i] <= P:
                s += A[i]
                i += 1
                if i == len(A): return True
        return False

    l = 0
    r = 100000*10000  # [0..]
    while l !=r:
        mid = int((l + r) / 2)
        if C(mid):
            r = mid
        else:
            l = mid +1 
    return l

def main():
    N, k = (int(x) for x in input().split())
    A = [int(input()) for i in range(N)]
    print(allocation(A,k))


main()


Measured memory_bytes: 9564
n,m,k = map(int,input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
A,B = [0],[0]
 
for i in range(n):
  A.append(a[i] + A[i])
for i in range(m):
  B.append(b[i] + B[i])
 
num,x = 0,m
 
for i in range(len(a)+1):
  if A[i] > k:
    break
  while A[i] + B[x] > k:
    x -= 1
  num = max(num, i + x)
  
print(num)
 
 

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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)

        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();
            var ans = 0;

            for(int i = 0; i < 3; i++)
            {
                if (s[i] == t[i]) ans++;
            }
            Console.WriteLine(ans);


        }

       
        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }

        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>

int main(void)
{
    int a, b, c, d;
    int p;
    int x, y;

    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    scanf("%d", &d);
    scanf("%d", &p);

    x = a * p;
    y = b;
    if (p > c){
        y += (p - c) * d;
    }

    if (x < y){
        printf("%d\n", x);
    }
    else {
        printf("%d\n", y);
    }

    return (0);
}

Measured memory_bytes: 596
import java.util.Scanner;
public class Main {
 
	public static void main(String[] args) {
 
		Scanner scan = new Scanner(System.in);
 
		int N = scan.nextInt();
		int M = scan.nextInt();
 
		System.out.println(N * (N -1)/2 + M * (M -1)/2);
 
	}
}

Measured memory_bytes: 23764
import bisect
n=int(input())
a=list(map(int,input().split()))
print(' '.join(map(str,a)))
for i in range(1,n):
    a_n=a.pop(i)
    insert_index = bisect.bisect_left(a[:i],a_n)
    a.insert(insert_index,a_n)
    print(' '.join(map(str,a)))


Measured memory_bytes: 5632
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll a, b;
	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
}

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

#define st first
#define nd second
#define pb push_back

typedef long long   ll;
typedef double      db;
typedef long double ldb;

typedef pair <int, int> pii;
typedef pair <ll,  ll>  pll;
typedef pair <ll,  db>  pdb;
typedef pair <ldb, ldb> pldb;

template <typename T>
void   Debug (T begin, T end);
int    si    ();
ll     sl    ();
string ss    (int); 
db     sf    ();
ldb    slf   ();
void   pi    (int, char = '\n');
void   pl    (ll, char = '\n');
void   pf    (db, char = '\n');
void   plf   (ldb, char = '\n');
void   ps    (string, char = '\n');

ll russian(ll, ll, ll);
ll fast_power(ll, ll, ll);
ll slow_power(ll, ll, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);

const int INF  = 1e9;
const ll  LINF = 1e18;

int main()
{
    int n = si(), k = si();
    int result = 0;
    for (int i = 0; i < n; ++i)
        if (si() >= k)
            ++result;

    pi(result);

    return 0;
}

template <typename T>
void Debug(T begin, T end)
{
    printf("\nDEBUG:\n");
    while (begin != end)
        printf("%d ", *begin),
        begin++;
    printf("\n\n");
}

template <typename T>
T scanf_t(string s)
{
    T a;
    scanf(s.c_str(), &a);
    return a;
}

template <typename T>
void printf_t(T a, string s, char end_l)
{
    s.push_back(end_l);
    printf(s.c_str(), a);
}

int si() { return scanf_t<int>("%d"); }
ll sl() { return scanf_t<ll>("%lld"); }
db sf() { return scanf_t<db>("%f"); }
ldb slf() { return scanf_t<ldb>("%Lf"); }

void pi(int a, char end_l) { printf_t<int>(a, "%d", end_l); }
void pl(ll a, char end_l) { printf_t<ll>(a, "%lld", end_l); }
void pf(db a, char end_l) { printf_t<db>(a, "%lf", end_l); }
void plf(ldb a, char end_l) { printf_t<ldb>(a, "%Lf", end_l); }

void ps(string a, char end_l)
{
    string s = "%s";
    s.push_back(end_l);
    printf(s.c_str(), a.c_str());
}

string ss(int NN)
{
    char T[NN];
    scanf("%s", T);
    return (string)T;
}

ll fast_power(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = (r * a) % m;
        a = (a * a) % m;
        k >>= 1LL;
    }
    return r;
}

ll slow_power(ll a, ll k, ll m)
{
    ll r = 1LL;
    while (k)
    {
        if (k & 1LL)
            r = russian(r, a, m);
        a = russian(a, a, m);
        k >>= 1LL;
    }
    return r;
}

ll russian(ll a, ll k, ll m)
{
    ll r = 0LL;
    while (k)
    {
        if (k & 1LL)
            r = (r + a) % m;
        a = (a + a) % m;
        k >>= 1LL;
    }
    return r;
}

ll gcd(ll a, ll b)
{
    while (b)
        swap(a %= b, b);
    return a;
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}


Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=1e5+5;
struct eg{int v,nx;}e[N<<1];int head[N],tot;
inline void add(R int u,R int v){e[++tot]={v,head[u]},head[u]=tot;}
ll f[N];int deg[N],a[N],rt,n;
void dfs(int u,int fa){
	if(deg[u]==1)return f[u]=a[u],void();
	R ll sum=0,mx=0;
	go(u)if(v!=fa)dfs(v,u),cmax(mx,f[v]),sum+=f[v];
	R ll cnt=((mx<<1)<=sum?sum>>1:sum-mx);
	if(sum<a[u]||sum-a[u]>cnt){puts("NO");exit(0);}
	f[u]=sum-((sum-a[u])<<1);
}
int main(){
	scanf("%d",&n);
	fp(i,1,n)scanf("%d",&a[i]);
	for(R int i=1,u,v;i<n;++i)scanf("%d%d",&u,&v),add(u,v),add(v,u),++deg[u],++deg[v]; 
	if(n==2)return puts(a[1]==a[2]?"YES":"NO"),0;
	fp(i,1,n)if(deg[i]!=1){rt=i;break;}
	dfs(rt,0);
	puts(f[rt]?"NO":"YES");
	return 0;
}

Measured memory_bytes: 10368
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int k = sc.nextInt();
		String a = sc.next();
		String b="";
		if (a.length() > k){
			b=a.substring(0,k);
			b+="...";
		}else{
			b=a;
		}
		System.out.println(b);
	}
}


Measured memory_bytes: 38576
#include <stdio.h>
#include <string.h>

int main() {
    char palavra[3][3];
    for (int i = 0; i < 3; i++) {
        scanf("%s", palavra[i]);
    }
    for (int i = 0; i < 3; i++) {
        printf("%c", palavra[i][i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 128
from itertools import accumulate
import sys
N, Q = map(int, input().split())
S = input()
rs = [0] * N

for i in range(N - 1):
    if S[i] + S[i + 1] == "AC":
        rs[i + 1] = 1

rm = [0] + list(accumulate(rs))

for i in range(Q):
    ans = 0
    l, r = map(int, sys.stdin.readline().split())
    if S[l] == "C":
        ans -= 1
    ans = rm[r] - rm[l]
    print(ans)

Measured memory_bytes: 8948
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

double func(int x) {
  double ret = 0;
  for (int i = 1; i <= x; i++) {
    ret += i;
  }
  return ret / x;
}

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  vector<double> s(n + 1, 0);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (int i = 0; i < n; i++) {
    s[i + 1] = s[i] + func(p[i]);
  }
  double ans = 0;
  int right = 0;
  for (int left = 0; left < n; left++) {
    while (right < n && (right + 1 - left <= k)) {
      ++right;
    }
    ans = max(ans, s[right] - s[left]);
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e18 + 3)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}


struct UnionFind{
    int par[MAX];
    int kosuu[MAX];
    UnionFind(int n){
        REP(i,n) par[i]=i;
        REP(i,n) kosuu[i] = 1;
    }

    int root(int x){
        int tmp;
        if(par[x]==x) return x;
        else{
            tmp=root(par[x]);
            par[x]=tmp;
            return tmp;
        }
    }

    bool same(int x,int y){
        return root(x) == root(y);
    }

    void unite(int x,int y){
        if(not same(x,y)){ 
        kosuu[root(y)] += kosuu[root(x)];
        par[root(x)] = root(y);
        }
    }

    int renketu_kosuu(int x){
        return kosuu[root(x)];
    }
};

signed main(){
    int n,m;
    cin >> n >> m;
    UnionFind U(n);
    REP(i,m){
        int a,b,c;
        cin >> a >> b>>c;
        a --;
        b --;
        U.unite(a,b);
    }

    set<int> S;
    REP(i,n){
        S.insert(U.root(i));
    }
    cout << S.size() << endl;

}

Measured memory_bytes: 7808
// ========================================================================================================
// Library
// ========================================================================================================
#define _CRT_SECURE_NO_WARNINGS

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

// competitive macro
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i ,n) for (int i = (n) - 1; i >= 0; i--)
#define LL long long
#define ULL unsigned long long

void fastIOS()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}
// ========================================================================================================
// ========================================================================================================

int main()
{
	fastIOS();

	string s; cin >> s;
    
    int index = 0 , c = 0;
    char x = s[0];
    int i = 0;
    
    if(s.size()==2 && s[0] == s[1]){
        cout<< 1 << " " << 2;
        return 0;
    }
    if(s.size()>=2){
        while(i<s.size()){
//            printf("First : i = %d\tindex = %d\tc = %d\tx = %c\n" , i , index,c,x);

            if(s[i]==x){
                c++;
            }
            else{
                c--;
            }

            if(c<0)
            {
                c = 1;
                i--;
                x = s[i];
                index = i;
            }
            
            if(i-index>=2){
                cout << index+1 << " " << i+1 << endl;
                return 0;
            }
            
            i++;
            
//            printf("Last : i = %d\tindex = %d\tc = %d\tx = %c\n" , i , index,c,x);
        }
    }
    
    cout << -1 << " " << -1 << endl;
    
    return 0;
}

Measured memory_bytes: 512
{
  const main = (
    input: string
  ): void | string | number | string[] | number[] => {
    const r = _reader(input)
    const [N] = r.nn()
    const [S] = r.ss()

    let res = 0

    for (let i = 0; i < N - 2; i++) {
      if (S[i + 0] + S[i + 1] + S[i + 2] === 'ABC') {
        res++
      }
    }

    return res
  }

  const _reader = (str: string, i = 0) => {
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')
    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map(v => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  const _getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  const _res = main(_getInput())

  if (typeof _res === 'number' || typeof _res === 'string') console.log(_res)
  if (typeof _res === 'object') console.log(_res.join(' '))
}


Measured memory_bytes: 7372
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)

leftest_val = A[0]
rightest_val = A[-1]
left_idx = 1
right_idx = N - 2
history = []
for i in range(N - 1):
    left_val = A[left_idx]
    right_val = A[right_idx]
    if i == N - 2:
        history.append("{} {}".format(rightest_val, leftest_val))
        print(rightest_val - leftest_val)
    elif left_val < 0:
        history.append("{} {}".format(rightest_val, left_val))
        rightest_val -= left_val
        left_idx += 1
    else:
        history.append("{} {}".format(leftest_val, right_val))
        leftest_val -= right_val
        right_idx -= 1

for h in history:
    print(h)

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

using namespace std;

int main() {
    int n = 3;
    vector<int> a(n);
    for (auto &e: a) {
        cin >> e;
    }
    sort(a.begin(), a.end());
    int ans = 0;
    for (int i = n - 1; i > 0; --i) {
        ans += a[i] - a[i-1];
    }
    cout << ans;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

alias E = Tuple!(int, "from", int, "to", long, "c");

E[5000] T;
long[2500] CS;

void main()
{
    auto nmp = readln.split.to!(int[]);
    auto N = nmp[0];
    auto M = nmp[1];
    auto P = nmp[2].to!long;

    foreach (i; 0..M) {
        auto abc = readln.split.to!(int[]);
        T[i] = E(abc[0]-1, abc[1]-1, abc[2] - P);
    }

    foreach (i; 1..N) CS[i] = long.min / 2;

    foreach (i; 0..N) {
        foreach (j; 0..M) {
            auto e = T[j];
            if (CS[e.to] < CS[e.from] + e.c) {
                CS[e.to] = CS[e.from] + e.c;
            }
        }
    }

    auto r = CS[N-1];

    foreach (i; 0..N) {
        foreach (j; 0..M) {
            auto e = T[j];
            if (CS[e.to] < CS[e.from] + e.c) {
                CS[e.to] = CS[e.from] + e.c;
            }
        }
    }

    writeln(r == CS[N-1] ? max(0, r) : -1);
}

Measured memory_bytes: 1276
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
l = [0, 26]

for i in range(30):
    l.append(l[-1]*26)

for i in range(len(l)):
    if N-l[i]>0:
        N -= l[i]
    else:
        keta = i
        break

ans = []
alpha = 'abcdefghijklmnopqrstuvwxyz'

for i in range(keta):
    for j in range(26):
        if N-pow(26, keta-1-i)>0:
            N -= pow(26, keta-1-i)
        else:
            ans.append(j)
            break

ans2 = []

for i in ans:
    ans2.append(alpha[i])

print(''.join(ans2))

Measured memory_bytes: 65128
from math import factorial


N = int(input())

# N! を素因数分解
fact = factorial(N)
e = [0] * (N+1)
for i in range(2, N+1):
    while fact % i == 0:
        e[i] += 1
        fact //= i


def num(m):
    return len(list(filter(lambda x: x >= m-1, e)))


ans = 0
ans += num(75)
ans += num(25) * (num(3) - 1)
ans += num(15) * (num(5) - 1)
ans += num(5) * (num(5) - 1) * (num(3) - 2) // 2

print(ans)


Measured memory_bytes: 3064
N, M = map(int, input().split())
Alist = list(map(int, input().split()))
Alist.sort()
dic = [2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [-1]*(N+1)
dp[0] = 0

for i in range(N):
    tmp = []
    for A in Alist:
        if (i+1 - dic[A-1]) < 0:
            tmp.append(-1)
        else:
            if dp[i+1 - dic[A-1]] != -1:
                tmp.append(dp[i+1 - dic[A-1]] + 1)
            else:
                tmp.append(-1)
        dp[i+1] = max(tmp)


output = []
output_dic = []
for i in range(dp[N]):
    for A in Alist[::-1]:
        if N - sum(output_dic) - dic[A-1] >= 0:
            if dp[N - sum(output_dic) - dic[A-1]] == (dp[N - sum(output_dic)] - 1):
                output.append(A)
                output_dic.append(dic[A-1])
                break

out = ''
for i in range(len(output)):
    out += str(output[i])

print(out)


Measured memory_bytes: 43996
#include<cstdio>

int main(){
        int W,H,x,y,r;
        scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
        if(0<=x-r && x+r<=W && 0<=y-r && y+r<=H)
                puts("Yes");
        else puts("No");
        return 0;
}

Measured memory_bytes: 2684
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>

// Remove GCC optimizer for codechef
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 1000005;

vector<int> freq(N,0);
vector<bool> mark(N,true);


int32_t main()
{



    IOS


    int n;
    cin >> n;

    vector<int> v(n);

    for(int i = 0; i < n; i++)
    {
    	cin >> v[i];
    	freq[v[i]]++;
    }

    int ans = 0;

    for(int i = 1; i < N; i++)
    {
    	if(freq[i])
    	{
    		if(freq[i] > 1)mark[i] = false;
    		for(int j = 2*i; j < N; j+= i)mark[j] = false;
    	}
    }


    for(auto i : v)ans += mark[i];


   	cout << ans;





    return 0;
}


Measured memory_bytes: 12704
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
T = input()

print(sum(x==y for x, y in zip(S, T)))


Measured memory_bytes: 5708
#include<bits/stdc++.h>
#define eps 1e-8
#define pi 3.14159265358979
#define LL long long
#define MP make_pair
#define PH push
#define PB push_back
#define PII pair<int,int>
#define VI vector<int>
#define X first
#define Y second
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
#define sqr(x) ((x)*(x))
#define CL(a) memset(a,0,sizeof a)
#define fr(i,n) for(int i=1;i<=n;i++)
#define FR(i,S,n) for(int i=S;i<=n;i++)
#define dr(i,n) for(int i=n;i;i--)
#define DR(i,n,S) for(int i=n;i>=S;i--)
#define SZ(x) ((int)(x).size())
#define rd(x) scanf("%d",&x)
#define pr(x) printf("%d",x)
const int N=222222;
const int M=100000007;
LL Pw(LL a,LL b,LL p){LL v=1;for(;b;b>>=1,a=a*a%p)if(b&1)v=v*a%p;return v;}
using namespace std;
int n,t,X[N],Y[N];
double an,nv;
struct P{
	double x,y;
}q[N];
bool cmp(P a,P b){return a.x<b.x;}
int main(){
	rd(n);
	fr(i,n)rd(X[i]),rd(Y[i]);
	fr(i,n){
		t=0;
		fr(j,n)if(i!=j){
			double x=atan2(Y[j]-Y[i],X[j]-X[i]);
			if(x>pi)x-=pi*2;
			if(x<0){
				q[++t]=P{x+pi*2,pi*2};
				q[++t]=P{0,x+pi};
			}else{
				q[++t]=P{x,x+pi};
			}
		}
		sort(q+1,q+t+1,cmp);
		nv=0;an=0;
		fr(i,t){
			if(q[i].x>nv)an+=q[i].x-nv;
			nv=max(nv,q[i].y);
		}
		an+=pi*2-nv;
		printf("%.8f\n",an/pi/2);
	}
}

Measured memory_bytes: 2432
import sys
from collections import Counter
input = sys.stdin.buffer.readline


def grouping(adj):
    "0-indexed の無向グラフを連結成分に分解する。"
    n = len(adj)
    ret = [-1] * n
    g = 0
    for v in range(n):
        if ret[v] == -1:
            ret[v] = g
            stack = [v]
            while stack:
                v = stack.pop()
                for nv in adj[v]:
                    if ret[nv] == -1:
                        ret[nv] = ret[v]
                        stack.append(nv)
            g += 1
    return ret


N, K, L = map(int, input().split())

pq_adj = [[] for _ in range(N)]
for _ in range(K):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    pq_adj[p].append(q)
    pq_adj[q].append(p)

rs_adj = [[] for _ in range(N)]
for _ in range(L):
    r, s = map(int, input().split())
    r -= 1
    s -= 1
    rs_adj[r].append(s)
    rs_adj[s].append(r)


group = [(g1 << 32) + g2 for g1, g2 in zip(grouping(pq_adj), grouping(rs_adj))]
c = Counter(group)
for v in range(N):
    print(c[group[v]])

Measured memory_bytes: 150728
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int main(){
IOS;
int x;
cin>>x;
if(x>=400&&x<600)cout<<8;
else if(x>=600&&x<800)cout<<7;
else if(x>=800&&x<1000)cout<<6;
else if(x>=1000&&x<1200)cout<<5;
else if(x>=1200&&x<1400)cout<<4;
else if(x>=1400&&x<1600)cout<<3;
else if(x>=1600&&x<1800)cout<<2;
else if(x>=1800&&x<2000)cout<<1;
return 0;
}


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

int main() {
  long long x, ans = 0;
  cin >> x;
  if (!(x % 11)) {
    ans = (x / 11) * 2;
  } else {
    if (x % 11 <= 6) {
      ans = (x / 11) * 2 + 1;
    } else if (x % 11 > 6) {
      ans = (x / 11) * 2 + 2;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
import java.io.{BufferedReader, InputStream, InputStreamReader, PrintWriter}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.reflect.ClassTag

object Main {
  val MOD = 1000000007
  val out = new PrintWriter(System.out)
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N = sc.nextInt()
    val A = map(N)(_ => sc.nextInt())
    rep(N){ i =>
      if (i > 0) out.print(' ')
      val j = if (i <= (N - 1) / 2) {
        N - 1 - 2 * i
      } else {
        2 * i - N
      }
      out.print(A(j))
    }
    out.println()
  }


  def main(args: Array[String]): Unit = {
    solve()
    out.flush()
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }

  private def rep(n: Int)(f: Int => Unit): Unit = (0 until n) foreach f

  private def map[@specialized A: ClassTag](n: Int)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    (0 until n) foreach (i => res(i) = f(i))
    res
  }

  private implicit class ArrayOpts[A](val as: Array[A]) extends AnyVal {
    def maxByOpt[B: Ordering](f: A => B): Option[A] = {
      if (as.nonEmpty) Some(as.maxBy(f)) else None
    }

    def grpBy[K](f: A => K): mutable.Map[K, ArrayBuffer[A]] = {
      val map = mutable.Map.empty[K, ArrayBuffer[A]]
      rep(a => map.getOrElseUpdate(f(a), ArrayBuffer()) += a)
      map
    }

    def rep(f: A => Unit): Unit = {
      as.indices foreach (i => f(as(i)))
    }

    def sumBy[B](f: A => B)(implicit num: Numeric[B]): B = {
      var sum = num.zero
      rep(a => sum = num.plus(sum, f(a)))
      sum
    }

    def minByEx[B](f: A => B, ixRange: Range = as.indices)(implicit cmp: Ordering[B]): (A, B) = {
      limit(f, ixRange)(cmp.lt)
    }

    def maxByEx[B](f: A => B, ixRange: Range = as.indices)(implicit cmp: Ordering[B]): (A, B) = {
      limit(f, ixRange)(cmp.gt)
    }

    private def limit[B](f: A => B, ixRange: Range)(cmp: (B, B) => Boolean): (A, B) = {
      var limA = as(ixRange.head)
      var limB = f(limA)

      for (i <- ixRange.tail) {
        val a = as(i)
        val b = f(a)
        if (cmp(b, limB)) {
          limA = a
          limB = b
        }
      }
      (limA, limB)
    }
  }

  private implicit class IterableOpts[A](val as: Iterable[A]) extends AnyVal {
    def sumBy[B](f: A => B)(implicit num: Numeric[B]): B = {
      as.foldLeft(num.zero)((acc, a) => num.plus(acc, f(a)))
    }
  }
}


Measured memory_bytes: 54572
#include<iostream>
#include<string>
#include<stdio.h>
#include<vector>
using namespace std;

int main(){
  int N,X;
  cin >> N >> X;
  int ans = 1;
  int sum = 0;
  int L = 0;

  for(int  i = 1; i <= N; i++)
  {
    /* code */
      cin >> L;
      
      sum += L;
      //cout <<"te:" << sum << endl;

      //cout << "te:" << sum << endl;
      if(sum <= X){
          ans++;
      }
    }

  cout << ans << endl;
}

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

int main()
{
  int A,B,C,D;
  cin>> A >> B >> C >> D;
  
  if(A + B == C + D) {
	cout << "Balanced" <<endl;
  }
  
  else if(A + B > C + D) {
	cout << "Left" <<endl;
  }
  
  else{
    cout << "Right" <<endl;
  }
  return 0;
}


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

int m[110];

int main(void)
{
    int N,X, msum = 0;
    int sm = 10000;
    int idx;
    cin >> N >> X;
    
    for(int i = 0; i < N; i++)
    {
        cin >> m[i];
    }

    for(int i = 0; i < N; i++)
    {
       msum += m[i];
       if(m[i] < sm)
       {
           sm = m[i];
           idx = i;
       } 
    }

    int amari = X - msum; 
    cout  <<  N + amari / m[idx] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
     ordered_set s;
     s.insert(1);
     cout<<*s.find_by_order(1); //print kth smallest element
     cout<<s.order_of_key(3);  //print number of strictly smaller element of 3;
*/
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
#define pi acos(-1)
#define bp __builtin_popcount
#define ll long long int
#define ld long double
#define endl '\n'
#define pii pair<ll , ll>
#define tii tuple<ll,ll,ll>
//aaaccess element of tuple ex. 3rd element(index 2) cout<< get<2>(tuppleName);

#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define minQueue priority_queue<pii,vector<pii>,greater<pii> >
#define minq priority_queue <int, vector<int>, greater<int> >
#define maxQueue priority_queue<ll>
#define pb push_back
#define mx3(a,b,c) max(a,max(b,c))
#define pf push_front
#define ff first
#define ss second
#define FILL(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
const ll N = 1000005;
const ll M = 1e6 + 10;
const ll mod = 998244353;

ll power(ll x, ll y, ll p)
{
	ll res = 1;
	x = x % p;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}
ll modinv(ll n, ll p)
{
	return power(n, p - 2, p);
}
ll ncr(ll n, ll r, ll p)
{
	if (r == 0)
		return 1;
	int n1 = n;
	ll fac[n1 + 1];
	fac[0] = 1;
	for (int i = 1 ; i <= n; i++)
		fac[i] = fac[i - 1] * i % p;

	return (fac[n] * modinv(fac[r], p) % p *
	        modinv(fac[n - r], p) % p) % p;
}
/*vector<bool> prime(N, true);
void sieve()
{
	for (int i = 2; i <= sqrt(N); ++i) {
		if (prime[i]) {
			for (int j = i * i; j <= N; j += i) {
				prime[j] = false;
			}
		}
	}
}/*

/*int Prime[M];
void MinPrimeFactor()
{
	for (ll i = 1; i < M; i++) Prime[i] = i;
	for (int p = 2; p * p <= M; p++)
	{
		if (Prime[p] == p)
		{
			for (int i = 2 * p; i <= M; i += p)
			{
				Prime[i] = min(p, Prime[i]);
			}
		}
	}
}*/

/*vector<int> getFactorization(int x)
{
	vector<int> ret;
	while (x != 1)
	{
		ret.push_back(Prime[x]);
		x = x / Prime[x];
	}
	return ret;
}


ll find(vector<ll> &parent,ll i)
{
    while(parent[i] != i)
    {
        //parent[i]=parent[parent[i]];
        i=parent[i];
    }
    return parent[i];


}

void Union(vector<ll> &parent,ll i, ll j)
{
    ll x=find(parent,i);
    ll y=find(parent,j);

    parent[x]=y;
}
*/
bool isPowerOfTwo(int x)
{
	return (x && !(x & (x - 1)));
}



int main()
{
	FAST;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int x = 0, a, b, c, k, n, i;
	cin >> n >> k;
	int arr[n];
	for (i = 0; i < n; i++) cin >> arr[i];
	for (i = k; i < n; i++)
	{
		if (arr[i] > arr[i - k])
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 4428
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <unistd.h>
#include <map>

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


typedef long long ll;
static const ll INF = 1000000000000000000LL;
static const ll MOD = 1000000007;

//人aは人bの「友達候補」であると定義します
//各人の友達候補の数

// unionfindのあとに友達の人数をへらす?
// ブロックは、isSameがtrueならへらす

class UnionFind 
{
public:
    int n;
    vector <int> par;//親
    vector <int> rank;//木の深さ
    vector <int> num;//要素数
    int g; //グループ数

    UnionFind(int _n)
    {
        n = _n;
        g = n;
        par.resize(n);
        rank.resize(n);
        num.resize(n);

        for(int i = 0; i < n; ++i)
        {
            par[i] = i; //自分自身を親に
            rank[i] = 0;
            num[i] = 1;
        }
    }


    //木の根を求める
    int find(int x)
    {
        if(par[x] == x)
        {
            return x;
        }
        else
        {
            return par[x] = find(par[x]);
        }
    }

    //xとyの属する集合を併合
    void unite(int x, int y)
    {
        x = find(x);
        y = find(y);

        int numSum = num[x] + num[y];
        if(x == y)return;
        if(rank[x] < rank[y])
        {
            par[x] = y;
        }
        else
        {
            par[y] = x;
            if(rank[x] == rank[y])
            {
                //findしたあとの深さを変更で良い?
                rank[x]++;
            }
        }
        num[x] = num[y] = numSum;
        --g;
    }

    //xとyが同じ集合に属するか
    bool same(int x, int y)
    {
        return find(x) == find(y);
    }

    int size(int x)
    {
        return num[find(x)];
    }

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

    vector <int> tomo(N, 0);
    vector <vector<int>> bro(N);

    UnionFind uf(N);

    //友達関係
    REP(i,M)
    {
        int a,b;
        cin >> a >> b;
        --a;--b;
        uf.unite(a, b);
        tomo[a]++;
        tomo[b]++;
    }

    //ブロック関係
    REP(i,K)
    {
        int c,d;
        cin >> c >> d;
        --c;--d;
        bro[c].push_back(d);
        bro[d].push_back(c);
    }

    REP(i, N)
    {
        int res;

        res = (uf.size(i)-1) - tomo[i];

        for(auto t:bro[i])
        {
            if(uf.same(i,t))--res;
        }
        
        if(res < 0)res = 0;
        
        
        //cout << uf.size(i) << ":";
        //cout << tomo[i] << ":";
        //cout << bro[i] << ":";

        cout << res << endl;
    }

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;

void print(vector<int> &A) {
	for (int i = 0; i < A.size(); i++)
		printf("%d ", A[i]);
	printf("\n");
}

void print_matrix(vector< vector<int> > &m) {
	for (int i = 0; i < m.size(); i++)
		print(m[i]);
}

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

	double theta;

	if (x == a*a*b / 2)
		theta = 45.0;
	else if (x > a*a*b / 2) {
		theta = atan((double)(a*a*a) / (double)(2.0*(a*a*b - x))) * 180.0 / M_PI;
	}
	else {
		theta = atan(2.0*(double)x / (double)(a*b*b)) * 180.0 / M_PI;
	}

	printf("%.6lf\n", 90.0 - theta);

	return 0;
}

Measured memory_bytes: 512