akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        string z = Console.ReadLine();
        char a = z[0];
        char b = z[1];
        char c = z[2];
        char d = z[3];
        if (a == b)
        {
            if(d == c)
            {
                if(a == c)
                {
                    Console.WriteLine("No");
                }
                else
                {
                    Console.WriteLine("Yes");
                }
                    

            }
            else
            {
                Console.WriteLine("No");
            }
            
        }else if (a == c)
        {
            if (b == d)
            {
                if (a == b)
                {
                    Console.WriteLine("No");
                }
                else
                {
                    Console.WriteLine("Yes");
                }
            }
            else
            {
                Console.WriteLine("No");
            }
        }else if(a == d)
        {
            if (b == c)
            {
                if (a == c)
                {
                    Console.WriteLine("No");
                }
                else
                {
                    Console.WriteLine("Yes");
                }
            }
            else
            {
                Console.WriteLine("No");
            }
        }else if(b == c)
        {
            if (a == d)
            {
                if (a == c)
                {
                    Console.WriteLine("No");
                }
                else
                {
                    Console.WriteLine("Yes");
                }
            }
            else
            {
                Console.WriteLine("No");
            }
        }else if (b == d)
        {
            if (a == c)
            {
                if (b == c)
                {
                    Console.WriteLine("No");
                }
                else
                {
                    Console.WriteLine("Yes");
                }
            }
            else
            {
                Console.WriteLine("No");
            }
        }else if(c == d)
        {
            if (a == b)
            {
                if (c == a)
                {
                    Console.WriteLine("No");
                }
                else
                {
                    Console.WriteLine("Yes");
                }
            }
            else
            {
                Console.WriteLine("No");
            }
        }
        else
        {
            Console.WriteLine("No");
        }
        
    }
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;

// ===============================================================================

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

  sort(a.begin(), a.end());
  int t1 = a[a.size() / 2 - 1], t2 = a[a.size() / 2];

  for (int i = 0; i < n; i++) {
    if (v[i] < t2)
      cout << t2 << endl;
    else
      cout << t1 << endl;
  }
}


Measured memory_bytes: 3712
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

ll bur[51], pat[51];

ll solve(int n, ll x){
	if(x < 1){
		return 0;
	}
	if(x == 1){
		if(n == 0) return 1;
		return 0;
	}
	if(x <= 1 + bur[n-1]){
		return solve(n-1, x-1);
	}
	if(x == 2 + bur[n-1]){
		return pat[n-1] + 1;
	}
	if(x <= 2 + 2 * bur[n-1]){
		return solve(n-1, x - 2 - bur[n-1]) + pat[n-1] + 1;
	}
	if(x == 3 + 2 * bur[n-1]){
		return 2 * pat[n-1] + 1;
	}
	return 0;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	ll x;
	cin >> n >> x;
	bur[0] = 1;
	pat[0] = 1;
	for(int i = 1; i <= 50; ++i){
		bur[i] = 3 + 2 * bur[i-1];
		pat[i] = 1 + 2 * pat[i-1];
	}
	ll ans = solve(n, x);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3608
n, m = map(int, input().split())
lis = []
for i in range(m):
    a, b = map(int, input().split())
    lis.append((a, b))

lis.sort(key=lambda x:x[1])

res = [lis[0]]
for i in range(1, m):
    if res[-1][0] < lis[i][1] and lis[i][0] < res[-1][1]:
        continue
    else:
        res.append((lis[i][0], lis[i][1]))
print(len(res))

Measured memory_bytes: 18204
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// Still trying to be normal
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e9 + 15;
ll n,m,x;
vector<int> prod[12+2];
ll p[12+2];
ll solve(int id,vector<int> hab){
    if(id>n)return 0;
    if(id==n){
        bool can=true;
        rep(i,0,sz(hab)){
            if(hab[i]<x)can=false;
        }
        if(can)return 0;
        else return INF;
    }
    vector<int> hab2(m,0);
    rep(i,0,sz(prod[id])){
        hab2[i]=hab[i]+prod[id][i];
    }
    return min(solve(id+1,hab2)+p[id],solve(id+1,hab));
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m>>x;
    rep(i,0,n){
        cin>>p[i];
        rep(j,0,m){
            ll a;
            cin>>a;
            prod[i].push_back(a);
        }
    }
    vector<int> ads(m,0);
    ll ans =solve(0,ads);
    if(ans==INF)cout<<-1<<"\n";
    else cout<<ans<<"\n";
}

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

int main() {
  char table[5][7] = {{'a', 'f', 'k', 'p', 'u', 'z'},
		      {'b', 'g', 'l', 'q', 'v', '.'},
		      {'c', 'h', 'm', 'r', 'w', '?'},
		      {'d', 'i', 'n', 's', 'x', '!'},
		      {'e', 'j', 'o', 't', 'y', ' '}};

  string a = "\0";
  while (getline(cin, a)) {
    int len = 0;
    for (int i = 0; a[i] != '\0'; i++)
      len++;

    if (len % 2) {
      cout << "NA" << endl;
      continue;
    }
    int count = 0;
    int count2 = 0;
    char ans[100] = {'\0'};
    while (count < len) {
      if (a[count] > 6 + '0' || a[count + 1] > 5 + '0' || a[count] < '1'
	  || a[count + 1] < '1') {
	cout << "NA" << endl;
	goto loop_end;
      }
      ans[count2] = table[a[count + 1] - '0' - 1][a[count] - '0' - 1];
      count += 2;
      count2++;
    }
    cout << ans << endl;
  loop_end: ;
    a = "\0";
  }
}

Measured memory_bytes: 2992
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast","no-stack-protector","unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx,tune=naive")
//#pragma GCC diagnostic ignored "-W"
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define getI(a) scanf("%lld", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define INF 2000000000
#define PI 3.1415926535897932384626
const ll MOD=1e9+7;
int main(){
        ll n;
        while(~getI(n)) printf("%lld\n",(n-1)*n/2);
}

Measured memory_bytes: 256
use std::io;
use std::cmp::Ordering;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let mut iter = line.split_whitespace().map(|s| s.parse::<i32>().unwrap());
    let (a, b) = (iter.next().unwrap(), iter.next().unwrap());
    match a.cmp(&b) {
        Ordering::Less      => println!("a < b"),
        Ordering::Greater   => println!("a > b"),
        Ordering::Equal     => println!("a == b"),
    }
}


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

int main()
{
	int N, W;
	cin >> N >> W;
	vector<ll> dp(W + 1);
	for (int i = 0; i < N; i++) {
		int w, v;
		cin >> w >> v;
		for (int j = W; j >= w; j--) {
			dp[j] = max(dp[j], dp[j - w] + v);
		}
	}
	cout << *max_element(dp.begin(), dp.end()) << endl;
	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

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

		int[] data = new int[ 10 ];
	
		for( int i = 0; i < 10; i++ )
			data[ i ] = stdIn.nextInt();

		for ( int i = 0; i < 3; i++ ) {
			int max = i;
			for ( int j = 9; j > i; j-- )
				if ( data[ max ] < data[ j ] )
					max = j;

			int tmp = data[ i ];
			System.out.println( data[ i ] = data[ max ] );
			data[ max ] = tmp;
		}
	}
}

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

using namespace std;

std::pair<std::vector<bool>, std::vector<int>> primeSieve(int n) {
  std::vector<bool> is_prime(n + 1, true);
  is_prime[0] = is_prime[1] = false;
  std::vector<int> prime_list;
  for (int i = 2; i <= n; i++) {
    if (is_prime[i]) {
      prime_list.push_back(i);
    }
    for (int j = 0; j < prime_list.size() && i * prime_list[j] <= n; j++) {
      is_prime[i * prime_list[j]] = false;
      if (i % prime_list[j] == 0) break;
    }
  }
  return {is_prime, prime_list};
}

int main(int argc, char *argv[]) {
  auto is_prime = primeSieve(100000).first;
  vector<int> vec(100001);
  for (int i = 3; i <= 100000; i++) {
    vec[i] = vec[i - 1];
    if (is_prime[i] && is_prime[(i + 1) / 2]) {
      vec[i]++;
    }
  }
  int Q;
  cin >> Q;
  while (Q--) {
    int l, r;
    cin >> l >> r;
    cout << vec[r] - vec[l - 1] << endl;
  }
  return 0;
}


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

int main() {
    int N; cin >> N;
    int two = 0, four = 0;
    REP(i, 0, N) {
        int a; cin >> a;
        if (a % 4 == 0) {
            four++;
            continue;
        }
        if (a % 2 == 0) {
            two++;
        }
    }

    int one = N - four - two;
    if (two == 0) {
        if (one <= four + 1) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        if (one <= four) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 #include<stdbool.h>
#define N 8
#define FREE -1
#define NOT_FREE 1
  
 int row[N],col[N],dpos[2*N-1],dneg[2*N-1];
bool X[N][N];
  
void initialize(){
  int i;
  for(i=0;i<N;i++){
    row[i]=FREE,col[i]=FREE;
  }
}
  
void printBoard(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(X[i][j]){
    if(row[i]!=j)return;
      }
    }
  }
  for( i=0;i<N;i++){
    for(j=0;j<N;j++){
      printf((row[i]==j)?"Q":".");
    }
    printf("\n");
  }
}
  
 void recursive(int i){
   int j;
   if(i==N){
     printBoard();
     return;
   }
   for(j=0;j<N;j++){
     if(NOT_FREE==col[j] ||NOT_FREE==dpos[i+j] || NOT_FREE==dneg[i-j+N-1] )continue;
  
     row[i]=j;
     col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;
  
     recursive(i+1);
  
     row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
   }
 }
  
 int main(){
   initialize();
   int i,j;
   for(i=0;i<N;i++){
     for(j=0;j<N;j++)X[i][j]=false;
   }
   int k;
   scanf("%d",&k);
   for(i=0;i<k;i++){
     int r,c;
     scanf("%d%d",&r,&c);
     X[r][c]=true;
   }
  
   recursive(0);
   return 0;
 }




Measured memory_bytes: 2112
#!/usr/bin/env python3
x, n = map(int, input().split())
p = sorted(map(int, input().split()))
ok = [True] * 300
for y in p:
    ok[y + 150] = False
for i in range(150):
    if ok[x - i + 150]:
        print(x - i)
        exit()
    if ok[x + i + 150]:
        print(x + i)
        exit()


Measured memory_bytes: 9188
using System;

class Program
{
    static int Main(string[] args)
    {
        //入力
        int inputCount = int.Parse(Console.ReadLine().Trim());

        int[] inputNum = new int[inputCount];
        for (int lp = 0; lp < inputCount; lp++)
        {
            inputNum[lp] = int.Parse(Console.ReadLine().Trim());
        }

        //string str = Console.In.ReadToEnd();
        //var lines = str.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

        // 処理
        int minVal = inputNum[0];
        int profit = Int32.MinValue;

        for (int lp = 1; lp < inputCount; lp++)
        {
            if (profit < inputNum[lp] - minVal)
            {
                profit = inputNum[lp] - minVal;
            }
            if (inputNum[lp] < minVal)
            {
                minVal = inputNum[lp];
            }
        }

        Console.WriteLine(profit);
        return 0;
    }
}



Measured memory_bytes: 22096
arr = input().split(" ")
A = int(arr[0])
B = int(arr[1])

if A == B:
  print(A + B)
elif A > B and (A - B) == 1:
  print(A + (A -1))
elif A > B and (A - B) >= 2:
  print(A + (A - 1))
elif A < B and (B - A) == 1:
  print(A + B)
elif A < B and (B - A) >= 2:
  print(B + (B -1))

Measured memory_bytes: 3064
#include<iostream>
#include<string>
using namespace std;
int main() {
    int n=0, remain=0, player=0;
    int plnum=0;
    string num="";
    while (1) {
        bool bo[1001] = { false };
        plnum = 0;
        cin >> player >> n;
        if (player == 0 && n == 0)break;
        remain = player;
        for (int i = 1; i <= n; ++i) {
            cin >> num;
            if (remain == 1)continue;
            plnum++;
            if (plnum == player + 1)plnum = 1;
            while (bo[plnum]) {
                plnum++;
                if (plnum == player + 1)plnum = 1;
            }
            if (i % 3 == 0 || i % 5 == 0) {
                if (i % 15 == 0 && num != "FizzBuzz") {
                    bo[plnum] = true;
                    remain--;
                }
                else if (i%15!=0&&i % 3 == 0 && num != "Fizz") {
                    bo[plnum] = true;
                    remain--;
                }
                else if (i%15!=0&&i % 5 == 0 && num != "Buzz") {
                    bo[plnum] = true;
                    remain--;
                }
            }
            else if(num[0]<'0'||'9'<num[0]){
                bo[plnum] = true;
                remain--;
            }
            else {
                if (stoi(num) != i) {
                    bo[plnum] = true;
                    remain--;
                }
            }
        }
        bool flag = false;
        for (int i = 1; i <= player; ++i) {
            if (!bo[i]) {
                cout << (flag ? " " : "") << i;
                flag = true;
            }
        }cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3048
#include<iostream>
using namespace std;
using i64 = int_fast64_t;
int main(){
   i64 x,k,d;
   cin >> x >> k >> d;
   x = abs(x);
   if(x / d > k){
       cout << abs(x - k * d) << endl;
       return 0;
   }
   k -= x / d;
   x -= x / d * d;
   cout << (k % 2 == 0 ? abs(x):abs(x - d)) << endl;
}

Measured memory_bytes: 3624
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();

		int prevA = sc.nextInt();
		int state = 0; // prevAまで調べた結果、0 先頭、1単調非減少、2単調非増加

		int ans = 0; //分割回数

		for(int i=1;i<N;i++) {
			int a = sc.nextInt();
			switch(state) {
				case 0:
					if(prevA == a) {
						state = 0; //そのまま
					}else if(prevA < a) {
						state = 1;
					}else {
						state = 2;
					}
					break;
				case 1:
					if(prevA > a) {
						ans++;
						state = 0;
					}

					break;
				case 2:
					if(prevA < a) {
						ans++;
						state = 0;
					}
					break;
			}
			prevA = a;

		}

		out.println(ans+1);

		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 47392
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n, m = LI()
    ans = [[i + 1, None] for i in range(m)]
    v = n
    j = m + 1
    d = defaultdict(int)
    d[0] = 1
    d[n] = 1
    for i in range(m - 1, -1, -1):
        while d[n - (j - ans[i][0])]: j += 1
        if (j - ans[i][0]) * 2 == n: j += 1
        d[j - ans[i][0]] = 1
        ans[i][1] = j
        j += 1
    for a in ans:
        print(*a)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 120656
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int mod = 1000000007;
using ll = long long;
using P = pair<int, int>;

struct mint{
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod){}
  mint operator-() const {
    return mint(-x);
  }

  mint& operator-=(const mint a){
    if((x += mod - a.x) >= mod)x -= mod;
    return *this;
  }
  mint& operator*=(const mint a){
    (x *= a.x) %= mod;
    return *this;
  }

  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }

  mint pow(ll t) const {
    if(t == 0)return 1;
    mint a = pow(t >> 1);
    a *= a;
    if(t & 1)a *= *this;
    return a;
  }
  mint inv() const {
    return pow(mod - 2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint comb(int n, int k){
  mint x = 1, y = 1;
  for(int i = 0; i < k; ++i){
    x *= n - i;
    y *= i + 1;
  }
  return x / y;
}

map<ll, int> prime_factorize(ll m){
  map<ll, int> ans;
  for(int i = 2; i * i <= m; ++i){
    while(m % i == 0){
      if(ans.count(i) == 0)ans[i] = 1;
      else ++ans[i];
      m /= i;
    }
  }
  if(m != 1)ans[m] = 1; 
  return ans;
}

int main(){
  int n;
  cin >> n;
  ll m;
  cin >> m;

  auto factor = prime_factorize(m);
  mint ans = 1;
  for(auto f : factor){
    int k = f.second; 
    ans *= comb(k + n - 1, n - 1);
  }

  cout << ans.x << endl;

  return 0;
}


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

constexpr long long MOD = 998244353;

int main() {
	string S;
	long long K;
	cin >> S >> K;
	vector<int> V = { 0 };
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == '0') V.push_back(0);
		else V[V.size() - 1]++;
	}
	int A = V.size(), B = S.size() - A + 1, N = S.size();
	vector<vector<vector<long long> > > DP(A + 1, vector<vector<long long> >(B + 1, vector<long long>(B + 1, 0)));
	DP[0][0][0] = 1;
	for (int i = 0; i < A; i++) {
		for (int j = 0; j <= B; j++) {
			long long NOW = 0;
			for (int k = 0; k <= B - j; k++) {
				NOW += DP[i][j + k][k];
				NOW %= MOD;
				DP[i + 1][j + k][k] = NOW;
			}
			NOW = 0;
			for (int k = 0; k <= B - j; k++) {
				NOW += DP[i][k][j + k];
				NOW %= MOD;
				DP[i + 1][k][j + k];
			}
		}
		for (int j = 0; j <= B; j++) {
			vector<long long> Cur(B + 2, 0);
			for (int k = B; k >= 0; k--) {
				Cur[k] = (Cur[k + 1] + DP[i][j][k]) % MOD;
				DP[i + 1][j][k] += (Cur[k + 1] - (Cur[min(B + 1, k + 1 + V[i])] % MOD) + MOD) % MOD;
				DP[i + 1][j][k] %= MOD;
			}
		}
		/*
		for (int j = 0; j <= B; j++) {
			for (int k = 0; k <= B; k++) {
				cout << DP[i + 1][j][k] << " ";
			}
			cout << endl;
		}
		cout << endl;
		*/
	}
	long long ANS = 0;
	for (int i = 0; i <= K && i <= B; i++) {
		ANS += DP[A][i][0];
		ANS %= MOD;
	}
	cout << ANS << endl;
}

Measured memory_bytes: 35604
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
ll bpow(ll,ll,ll);
typedef vector<int> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B);
mat pow(mat A,ll n);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};


bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  int xM=-101,ym=101,N,M,X,Y,x[101],y[101];
  cin >> N >> M >> X >> Y;
  REP(i,N)cin >> x[i];
  REP(i,M)cin >> y[i];
  REP(i,N)xM = max(xM,x[i]);
  REP(i,M)ym = min(ym,y[i]);
  for(int i=-100;i<=100;i++){
    if((X < i) && (i <= Y) && (ym >= i) && (xM < i)){
      cout << "No War" << endl;
      return 0;
    }
  }
  cout << ("War") << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

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

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

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

ll bpow(ll a, ll n,ll mod){
  int i = 0;
  ll res=1;
  while(n){
    if(n & 1)
      res = (res*a) % mod;
    a = (a*a) % mod;
    n >>= 1;
  }
  return res;
}
const int MOD = 1000000007;
mat mul(mat &A, mat &B){
  mat C(A.size(),vec(B[0].size()));
    REP(i,A.size())REP(k,B.size())REP(j,B[0].size()){
    C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
  }
  return C;
}

mat pow(mat A,ll n)
{
  mat B(A.size(),vec(A.size()));
  REP(i,A.size()){
    B[i][i] = 1;
  }
  while(n > 0){
    if ( n & 1) B = mul(B,A);
    A = mul(A,A);
    n >>= 1;
  }
  return B;
}


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

using namespace std;

typedef long long ll;

const int N = 1e5;
const int INF = 1e9;
const int MOD = 1e9 + 7;



int main() {
    string s, t;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'B') {
            if (!t.empty())
                t.pop_back();
        }
        else
            t.push_back(s[i]);
    }
    cout << t;
}

Measured memory_bytes: 384
#文字列の入力
S = input()
#listを一文字ずつのlistに
S_list = list(S)

S_list_reverse = list(reversed(S_list))


#print(S_list_reverse)
#print(S_list)

if(S_list != S_list_reverse):
  print("No")
else:
  S_list_new = S_list
  del S_list_new[int(len(S_list)/2):]
  S_list_new_reverse =  list(reversed(S_list_new))
  if(S_list_new != S_list_new_reverse):
    print("No")
  else:
    print("Yes")

Measured memory_bytes: 3060
/* be name khoda */

// #define stream_enable
#define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;

#ifdef stream_enable
#define cin sss
#endif
#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

const ll MOD = 1000000007;
const long long BIG = 1446803456761533460;
const int Big = 336860180;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()

#define debug(x) cout << #x << " -> " << (x) << endl;
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl;
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl;
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl;
#define debugp(x) cout << #x << " -> " << "(" << (x).F << ", " << (x).S << ")" << endl;
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugap(x, n) cout << #x << " ->\n"; fori (i1_dap, n) { cout << "(" << (x)[i1_dap].F << ", " << (x)[i1_dap].S << ")\n"; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
#define debugav(x, n) cout << #x << " ->\n"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_dav].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\n'; } cout << endl
#define debugia(x, n) cout << #x << " ->\n"; fori (i1_dia, n) { cout << i1_dia << " : " << (x)[i1_dia] << '\n'; } cout << endl

#define forifrom(i, s, n) for(ll i = (s); i < (n); ++i)
#define forirto(i, n, e) for(ll i = (n) - 1; i >= (e); --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define Add(a, b) a = (a + (b)) % MOD
#define Mul(a, b) a = (a * (b)) % MOD

stringstream sss;

// -----------------------------------------------------------------------

const ll maxn = 100010;

void MAIN() {

    ll n, m;
    cin >> n >> m;
    cout << (n == m ? "Yes\n" : "No\n");

}

// -----------------------------------------------------------------------

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(10);
    sss << R"(

    )";
    MAIN();
    return 0;
}


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

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2")

using namespace std;

#define f first
#define s second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define up(x, v) upper_bound(all(x), v)
#define low(x, v) lower_bound(all(x), v)
#define bin(x, v) binary_search(all(x), v)
#define FOR(k, a, b) for(int k = (a); k < (b); ++k)
#define ROF(k, a, b) for(int k = (a); k > (b); --k)
#define fn(k, n) for(int k = 0; k < n; ++k)

#define EPS 1.0e-9

#define X real()
#define Y imag()

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

using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using point = pair<double, double>;
using Vector = complex<double>;

#define MAXN 20001

int main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int N, H;

	cin >> H >> N;

	vii S(N);

	FOR(k, 0, N) cin >> S[k].f >> S[k].s;

	int dp[MAXN];
	
	FOR(k, 0, MAXN)
		dp[k] = INT_MAX;

	dp[0] = 0;

	FOR(i, 0, N) {

		FOR(k, 0, MAXN) {

			if(S[i].f + k > MAXN - 1)
				break;

			dp[S[i].f + k] = min(0LL + dp[k] + S[i].s, 0LL + dp[S[i].f + k]);
		}
	}

	int amin = INT_MAX;

	FOR(k, H, MAXN)
		amin = min(amin, dp[k]);

	cout << amin << '\n';

    return 0;
}


Measured memory_bytes: 384
using System;

namespace KPC2019
{
    class C
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var s = "keyence";

            if (S.Substring(0, s.Length) == s) { Console.WriteLine("YES"); return; }
            if (S.Substring((S.Length - s.Length) - 1, s.Length) == s) { Console.WriteLine("YES"); return; }


            int res = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (S[i] != s[i]) break;
                res++;
            }

            for (int i = 0; i < s.Length; i++)
            {
                if (S[S.Length - 1 - i] != s[s.Length - 1 - i]) break;
                res++;
            }

            if (s.Length <= res)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }

        }
    }
}


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

int main() {
  int x, y, a, b, c;
  cin>>x>>y>>a>>b>>c;
  long long p[a], q[b], r[c];
  for (int i=0; i<a; i++) cin>>p[i];
  for (int i=0; i<b; i++) cin>>q[i];
  for (int i=0; i<c; i++) cin>>r[i];
  sort(p, p + a);
  reverse(p, p + a);
  sort(q, q + b);
  reverse(q, q + b);
  sort(r, r + c);
  reverse(r, r + c);

  long long ans = 0;
  int i = 0, j = 0, k = 0;
  while (true) {
    long long pv = -1, qv = -1, rv = -1;
    if (i < a && x > 0) pv = p[i];
    if (j < b && y > 0) qv = q[j];
    if (k < c) rv = r[k];
    if (pv >= qv && pv >= rv) {
      ans += pv;
      ++i;
      --x;
    } else if (qv >= pv && qv >= rv) {
      ans += qv;
      ++j;
      --y;
    } else {
      ans += rv;
      ++k;
    }
    if (x + y - k == 0) {
      break;
    }
  }
  cout<<ans<<endl;
}

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

int main() {
  ll a,b,c,d;
  cin >> a >> b >> c;
  d = c-a-b;
  if(d*d > 4*a*b && d > 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3572
X = int(input())

s = [0,1,2,3]

if (X == 9-7-1):
 print('fri')
elif (X == 9-7):
 print('sat')
elif (X == 9-7+1):
 print('sun')
elif (X == 9-7+2):
 print('mon')
elif (X == 9-7+3):
 print('tue')
elif (X == 9-7+4):
 print('wed')
elif (X == 9-7+5):
 print('thu')
elif (X == 9-7+6):
 print('fri')

for i in s:
 if(X == 9+7*i):
   print('sat')
 elif (X == (9+7*i)+1):
   print('sun')
 elif (X == (9+7*i)+2):
   print('mon')
 elif (X == (9+7*i)+3):
   print('tue')
 elif (X == (9+7*i)+4):
   print('wed')
 elif (X == (9+7*i)+5):
   print('thu')
 elif (X == (9+7*i)+6):
   print('fri')


Measured memory_bytes: 5608
#include<stdio.h>
int n,m,a[10000],b[10000],c[10000],d[10010],i,j,r[10010],t,s;
int main(){
  while(scanf("%d",&n),n){
    scanf("%d",&m);
    for(i=0;i<m;i++){
      r[i]=i;
      scanf("%d,%d,%d",&a[i],&b[i],&c[i]);
      a[i]++;
      b[i]++;
      for(j=i;j;j--){
	if(c[r[j-1]]>c[r[j]]){
	  t=r[j-1];
	  r[j-1]=r[j];
	  r[j]=t;
	}
      }
    }
    int p[10010]={0};
    for(i=s=0;i<m;i++){
      for(;p[a[r[i]]];a[r[i]]=p[a[r[i]]]);
      for(;p[b[r[i]]];b[r[i]]=p[b[r[i]]]);
      if(b[r[i]]-a[r[i]]){
	if(d[a[r[i]]]< d[b[r[i]]])p[a[r[i]]]=b[r[i]];
	if(d[b[r[i]]]<=d[a[r[i]]])p[b[r[i]]]=a[r[i]];
	if(d[a[r[i]]]==d[b[r[i]]])d[b[r[i]]]++;
	s+=c[r[i]]-100;//printf("%d",
      }
    }
    printf("%d\n",s/100);
  }
  return 0;
}

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

int main(){

  string s;
  int sum = 0;

  //入力値の代入
  cin >> s;
  //1が入っている個数のカウント  
  for (int i=0; i < 4; i++){
      if( s[i] == '1'){
          sum++;
      }
  }
  //集計結果の出力
  cout << sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    string in; cin >> in;
    int n = in.size();

    int res = 0;
    rep(i, n / 2){
        if(in[i] != in[n - 1 - i]){
            res++;
        }
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;

long long a, b;

long long Calc(long long x)
{
    return a * x / b - x / b * a;
}

int main(void)
{
    long long n;
    int i;

    cin >> a >> b >> n;
    cout << Calc(min(n, b - 1)) << endl;
    // for(i = 0; i <= n; i ++)
    //     cout << Calc(i) << ' ';
    // for(i = 0, o = -100000000000000000LL; i <= a && i <= n && i <= 50000000; i ++)
    // {
    //     o = max(o, a * i / b - i / b * a);
    //     o = max(o, a * (n - i) / b - (n - i) / b * a);
    // }
    // cout << o << endl;

    return 0;
}


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

using namespace std;

const int maxn = 410;

typedef long long ll;

int num[maxn];

ll soma[maxn], dp[maxn][maxn];

ll solve(int l, int r)
{
	if (l >= r) return 0;
	if (dp[l][r] != -1) return dp[l][r];

	ll ans = 2e18+10;
	for (int i = l; i < r; i++)
		ans = min(ans, solve(l, i)+solve(i+1, r));

	return dp[l][r] = (soma[r]-soma[l-1]) + ans;
}

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

	for (int i = 1; i <= n; i++)
	{
		cin >> num[i];
		soma[i] = soma[i-1] + 1LL*num[i];
	}

	memset(dp, -1, sizeof dp);

	cout << solve(1, n) << "\n";
}

Measured memory_bytes: 1536
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
 
sieve :: Int -> V.Vector Bool
sieve sup = runST $ do
    s <- VM.replicate (sup+1) True
    VM.write s 0 False
    VM.write s 1 False
    forM_ [2..(ceiling.sqrt.fromIntegral $ sup)] $ \i -> do
        isP <- VM.read s i
        when isP $ forM_ [i*i, i*i+i..sup] (\n -> VM.write s n False)
    V.unsafeFreeze s
 
primes :: Int -> V.Vector Int
primes = V.map fst . V.filter snd . V.imap (,) . sieve
 
main = do
    nums <- map read . lines <$> getContents
    let ps = primes (maximum nums)
    mapM_ (\i -> print . V.length $ V.takeWhile (<= i) ps) nums

Measured memory_bytes: 16192
#include<bits/stdc++.h>
using namespace std;
int mod=1e9+7;

int main()
{
	int r,c;
	cin>>r>>c;
	char mat[r][c];
	int dp[r][c];
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
		{
			cin>>mat[i][j];
			dp[i][j]=0;
		}
	}
	dp[0][0]=1;
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c;j++)
		{
			if(mat[i][j]!='#')
			{
				if(i>0 && mat[i-1][j]!='#')
					dp[i][j]=(dp[i-1][j]+dp[i][j])%mod;
				if(j>0 && mat[i][j-1]!='#')
					dp[i][j]=(dp[i][j-1]+dp[i][j])%mod;
			}
		}
	} 
	cout<<dp[r-1][c-1];
	return 0;
}


Measured memory_bytes: 5120
/**Bismillahir Rahmanir Rahim.**/

/**
 *    author:  nasimnoob
**/

#include<bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<cstring>
#include<cstdio>

using namespace std;

//----------------------------------------------------------//

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

//-----------------------------------------------------------//
#define      test                       int t; cin>>t;  while(t--)

#define      cube(x)                    (x*x*x)
#define      sqr(x)                     (x*x)

#define      INPUT                      freopen("input.txt", "r", stdin)
#define      OUTPUT                     freopen("output.txt", "w", stdout)

#define      srev                       reverse(s.begin(),s.end())
#define      sortstr                    sort(s.begin(), s.end());
#define      gtl(x)                     getline(cin, (x))
#define      dot(x)                     fixed << setprecision(x)

#define      Case                       cout << "Case " << ++tt << ": " ;

#define      PI                         acos(-1) // 3.1415926535897932
#define      MIN                        9999999

#define      Faster                     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);




//scanf("%[^\n]%*c", str);
//sort(s,s+n,greater<int>());
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);


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

int main()
{
    Faster;


    int tt = 0 ;

    double d , t , s ;

    cin >> d >> t >> s;

    double res = d / s;

    if (res <= t)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;



    return 0 ;
}







Measured memory_bytes: 3720
include Math

$<.each_line do |line|
	points = line.split.map(&:to_f).each_slice(2).to_a
	xp, yp = points.pop

	sum = points.cycle.each_cons(2).take(3).map {|p1, p2|
		a = ((p1[0] - xp) ** 2 + (p1[1] - yp) ** 2) ** 0.5
		b = ((p2[0] - xp) ** 2 + (p2[1] - yp) ** 2) ** 0.5
		c = ((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2) ** 0.5

		acos((a ** 2 + b ** 2 - c ** 2) / (2 * a * b))
	}.inject(&:+)

	puts sum.round(7) == (2 * PI).round(7) ? 'YES' : 'NO'
end

Measured memory_bytes: 6260
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int p = sc.nextInt();
        int q = sc.nextInt();
        int r = sc.nextInt();
        System.out.println(p+q+r-Math.max(Math.max(p,q),r));
    }
}


Measured memory_bytes: 35628
#include <stdio.h>
int main(void);

int main(void){

    /*Wは横、Hは高さ、円の原点(x, y)、rは円の半径*/
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);   
    
    if(x <= (W - r) && y <= (H - r) && x >= (0 + r) && y >= (0 + r)){
        
        printf("Yes\n");

    } else {
        
        printf("No\n");
    
    }

    return 0;

}



Measured memory_bytes: 2100
// IOI 2021
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll MOD = 924844033;
 
////////////////////////////////////////////////////////////////////
 
const int N = 1e5 + 5;

int main() {
 
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));

	string S; cin >> S;
	int n = sz(S);
	for (int i = n - 2; i >= 0; i -= 2) if (S.substr(0, i / 2) == S.substr(i / 2, i / 2)) die(i);

	return 0;
}


Measured memory_bytes: 3632
N, K = map(int, input().split())
h = list(map(int, input().split()))
 
def cost(a, b):
    return abs(h[a] - h[b])
 
c = [0] * N
for i in range(1, N):
    c[i] = min(cost(i, i-k)+c[i-k] for k in range(1, min(K, i)+1))
 
print(c[-1])
 


Measured memory_bytes: 54496
#include <stdio.h>

void screen(int[] ,int);

#define N 100
int main()
{
  int i,j,count=0,flag;
  int n,A[N];
  int temp;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)//scan A[]
    {
      scanf("%d",&A[i]);
    }

  /*for(i=n-1;i>0;i--)//bubble sort
    {
    for(j=i-1;j>=0;j--)
    {
    if(A[j]>A[j+1])
    {
    temp = A[j+1];
    A[j+1]=A[j];
    A[j]=temp;
    count++;
    screen(A,n);
    }
    else break;
    }
    }*/
  while(1)
    {
      flag=0;
      for(j=n-1;j>0;j--)
	{
	  
	  if(A[j-1]>A[j])
	    {
	      temp = A[j];
	      A[j] = A[j-1];
	      A[j-1] = temp;
	      count++;
	      flag++;
	      //screen(A,n);
	    }
	}
      if(flag==0)
	{
	  break;
	}
    }
  screen(A,n);
  printf("%d\n",count);
  return 0;
}

void screen (int A[], int n)
{
  int i;
  for(i=0;i<n;i++)
    {
      if(i<n-1)
	{
	  printf("%d ",A[i]);
	}
      else if(i==(n-1))
	{
	  printf("%d",A[i]);
	  break;
	}
    }
  printf("\n");
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

struct unionfind{
    vector<ll> root,siz;

    void init(ll n){
        for(int i=0;i<n;i++){
            root.push_back(i);
        }
        siz.assign(n,1);
    }

    ll find(ll x){
        if(root[x]==x){
            return x;
        }
        return find(root[x]);
    }

    void unite(ll x,ll y){
            x=find(x);
            y=find(y);
            if(x==y){
                return;
            }
            if(siz[x]<siz[y]){
                swap(x,y);
            }
            siz[x]+=siz[y];
            root[y]=x;
            return;
    }

    bool check(ll x,ll y){
        return find(x)==find(y);
    }

    ll size(ll x){
        return siz[find(x)];
    }

};

int main(){

    ll n,m;
    cin>>n>>m;
    unionfind uf;
    uf.init(n);
    vector<pair<ll,ll>> edge(m);
    for(ll i=0;i<m;i++){
        cin>>edge[i].first>>edge[i].second;
        edge[i].first--;
        edge[i].second--;
    }
    vector<ll> ans(m);
    ans[m-1]=(n*(n-1))/2;
    for(ll i=m-2;i>-1;i--){
        ll a=edge[i+1].first;
        ll b=edge[i+1].second;
        if(uf.check(a,b)){
            ans[i]=ans[i+1];
            continue;
        }
        ans[i]=max(0ll,ans[i+1]-(uf.size(a)*uf.size(b)));
        uf.unite(a,b);
    }
    for(ll i=0;i<m;i++){
        cout<<ans[i]<<endl;
    }


return 0;
}


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

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N;
	long double ans = 0, A;
	
	cin>>N;
	
	for(int i = 0; i < N; i++){
		cin>>A;
		ans += 1.0/A;
	}
	
	cout<<1/ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
vector<pair<long long,long long> > x;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		long long a,b;
		cin>>a>>b;
		x.push_back(make_pair(a-b,a+b));
	}
	if(n==1){
		cout<<1<<endl;
		return 0;
	}
	sort(x.begin(),x.end());
	int cnt=n;
	long long last2=x[0].second;
	for(int i=1;i<x.size();i++){
		if(last2>x[i].first){
			cnt--;
		}
		else{
			last2=x[i].second;
		}
	}
	int ans=n;
	last2=x[x.size()-1].first;
	for(int i=x.size()-2;i>=0;i--){
		if(last2<x[i].second){
			ans--;
		}
		else{
			last2=x[i].first;
		}
	} 
	cout<<max(cnt,ans)<<endl;
	return 0;
}

Measured memory_bytes: 2420
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
typedef long long LL;
const int MaxN = 1e5;
const int Pt = 1e9 + 7;
using namespace std;

LL n , m;
LL a[MaxN + 5] , b[MaxN + 5];
int main()
{
	while(~scanf("%lld%lld" , &n , &m)){
		for(int i = 1;i <= n;i++) scanf("%lld" , &a[i]);
		for(int i = 1;i <= m;i++) scanf("%lld" , &b[i]);
		sort(a + 1 , a + n + 1);
		sort(b + 1 , b + m + 1);
		LL ans_x = 0 , ans_y = 0;
		for(int i = 2;i <= n;i++){
			LL t = a[i] - a[i - 1];
			ans_x = (ans_x + t * (n - i + 1) * (i - 1)) % Pt;
		}
		for(int i = 2;i <= m;i++){
			LL t = b[i] - b[i - 1];
			ans_y = (ans_y + t * (m - i + 1) * (i - 1)) % Pt;
		}
		printf("%lld\n" , ans_x * ans_y % Pt);
	}
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int main(){
    int a,b ; cin >> a >> b;
    repi(i,1,4){
        if (a != i && b != i) cout << i << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    string n;
    cin >> n;
    if ((n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3]))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;
const int mod= 1e+9+7;

int main() {
    string s; cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
 



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<int,int>;

ll f(ll x,ll c,ll d){
    ll res =x;
    res -=x/c;
    res -=x/d;
    res+= x/lcm(c,d);
    return res;
}

int main(){
    ll a,b;
    cin>>a>>b;
    map<ll,vector<ll>>mp;
    ll tmp;
    ll c;
    rep(i,b){
        cin>>tmp;
        vector<ll>v(a);
        rep(j,tmp){
            cin>>c;
            v[c-1]=1;
        }
            mp[i]=v;
    }
    vector<ll>s(b);
    rep(i,b){
        cin>>s[i];
    }
    ll ans=0;
    for(ll i=0;i<(1<<a);i++){
        for(ll l=0;l<b;l++){
        tmp=0;    
            for(ll j=0;j<a;j++){
                    if(i>>j&1){
                    tmp+=mp[l][j];
                    }
            }
        if(tmp%2!=s[l])break;
        if(l==b-1)ans++;
        }    
    }
        cout<<ans<<endl;
}


Measured memory_bytes: 3596