akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int N,M,X;

int main(){

	cin >> N >> M >> X;
  	int A[M];
    for(int i = 0 ; i < M ; i++ ) cin >> A[i];
    
  	int leftSearch = 0;
  	int rightSearch = 0;
  	
	for(int i = 0; i < M ; i++){
      
    	if(A[i] < X) leftSearch +=1;
        else rightSearch +=1;
      
    }
  
  	if(leftSearch >= rightSearch) cout << rightSearch << endl;
  	else cout << leftSearch << endl;
  	      
}

Measured memory_bytes: 256
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let k = v[0];
	let s = v[1];
	let mut cnt = 0;
	for x in 0..(k+1) {
		for y in 0..(k+1) {
			if s - x - y <= k && s - x - y >= 0 {
				cnt += 1;
			}
		}
	}
	println!("{}", cnt);
}

Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int H = scan.nextInt();
        int W = scan.nextInt();
        int D = scan.nextInt();
        int[][] original = new int[H*W+1][2];
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                int A = scan.nextInt();
                original[A][0] = i;
                original[A][1] = j;
            }
        }
        int[] s = new int[H*W+1];
        for (int i = 1; i <= H * W - D; i++) {
            int[] o1 = original[i+D];
            int[] o2 = original[i];
            s[i+D] = s[i]
                    + Math.abs(o1[0]-o2[0])
                    + Math.abs(o1[1]-o2[1]);
        }
        int Q = scan.nextInt();
        for (int i = 0; i < Q; i++) {
            int L = scan.nextInt();
            int R = scan.nextInt();
            System.out.println(s[R]-s[L]);
        }
    }
}


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

int main(){
  int n,k;
  vector<int> v;
  cin>>n>>k;

  int min=1000000000;

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

  sort(v.begin(), v.end());

  for(int i=0;i<n-k+1;i++){
    if(min>(int)abs(v[i]-v[i+k-1])) min=(int)abs(v[i]-v[i+k-1]);
  }

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


Measured memory_bytes: 892
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

h1,m1,h2,m2,k = mi()

s = 60 * h1 + m1
f = 60 * h2 + m2

ans = f-s-k

print(ans)

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

a = [0] * N
b = [0] * N
for i in range(N):
    a[i],b[i] = map(int,input().split())
c = [0] * M
d = [0] * M
for i in range(M):
    c[i],d[i] = map(int,input().split())

for i in range(N):
    MIN = 10**9
    for j in range(M):
        if abs(a[i]-c[j])+abs(b[i]-d[j]) < MIN:
            MIN = abs(a[i]-c[j])+abs(b[i]-d[j])
            cnt = j+1
    print(cnt)


Measured memory_bytes: 3064
from collections import defaultdict
 
n, m = map(int, input().split())
ac = 0
wa = defaultdict(lambda: 0) # wa = {} だと 存在しないkeyにおいて wa[key] = ○ で代入できない
already = set()
for line in range(m):
    p, s = input().split() # forでその都度入力を受け取る
    p = int(p)
    if p in already: # acを見つけたときのみalreadyにpをいれすので、ac後のwaのカウントを避けている。
        continue
    if s == 'AC':
        ac += 1
        already.add(p) # acするとalreadyにpを追加 集合への値追加はaddを用いる。
    else:
        wa[p] += 1 #{1: 3, 2: 2, 3: 0, 4: 5 ...}のように辞書が作られていく。
# print(ac, sum(wa[i] for i in wa.keys())) のようにするとac出来ていないwaについても数えてしまうので×
print(ac, sum(wa[i] for i in already))

Measured memory_bytes: 22888
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int dp[100010][2];
signed main() {
    int N; cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) {
        cin >> A[i];
    }

    fill(dp[0], dp[N+1], -INF);
    dp[0][0] = 0;
    for(int i=0; i<N; i++) {
        // 操作を行う
        {
            // 前で行ってた場合
            chmax(dp[i+1][1], dp[i][1] + A[i]);
            
            // 行ってない場合
            chmax(dp[i+1][1], dp[i][0] - A[i]);
        }

        // 行わない
        {
            // 前で行ってた場合
            chmax(dp[i+1][0], dp[i][1] - A[i]);

            // 行ってない場合
            chmax(dp[i+1][0], dp[i][0] + A[i]);
        }
    }

    /*
    for(int i=0; i<=N; i++) {
        fprintf(stderr, "dp[%lld]: %lld, %lld\n", i, dp[i][0], dp[i][1]);
    }
    */
    
    cout << dp[N][0] << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  string S;
  int N;
  std::cin >> S;
  N = S.size();
  std::vector<char> kuro(N);
  std::vector<char> siro(N);
  range(i, N){
    if(i%2==0){
      kuro[i] = '0';
      siro[i] = '1';
    }else{
      kuro[i] = '1';
      siro[i] = '0';
    }
  }
  int kcount=0, scount=0;
  range(i, N){
    if(S[i] == kuro[i]){
      kcount++;
    }
    if(S[i] == siro[i]){
      scount++;
    }
  }
  std::cout << min(scount, kcount) << '\n';
  return 0;
}


Measured memory_bytes: 576
#include<stdio.h>
#include<math.h>

int main(void)
{
  double x,h,a;
  double S;

  while(1){
    scanf("%lf",&x);
    scanf("%lf",&h);

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

    S = x * x + 4 * x * sqrt(x * x / 4 + h * h) / 2;

    printf("%f\n",S);

  }

  return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////
#define R(i,n) for(int i=0;i<(n);++i)
/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void chmin(T& a, T b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////

void solve() {
	int N, M;
	cin >> N >> M;
	vector<int> H(N);
	IN(H);
	vector<bool> ans(N, true);
	R(i, M) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		if (H[a] <= H[b]) {
			ans[a] = false;
		}
		if (H[b] <= H[a]) {
			ans[b] = false;
		}
	}
	int cnt = 0;
	R(i, N) {
		cnt += ans[i];
	}
	cout << cnt << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}

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

int main() {
    ll n, m;
    cin >> n >> m;
    ll mod = 1e9 + 7;
    if (abs(m - n) >= 2) {
        cout << 0 << endl;
        return 0;
    }
    ll r1 = 1, r2 = 1;
    for (ll i = 1; i <= n; i++) {
        r1 *= i;
        r1 %= mod;
    }
    for (ll i = 1; i <= m; i++) {
        r2 *= i;
        r2 %= mod;
    }
    if (n == m) {
        cout << (r1 * r2 * 2) % mod << endl;
    } else {
        cout << (r1 * r2) % mod << endl;
    }
    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <map>
#include <list>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <random>
#include <queue>
#include <fstream>
#include <iterator> // std::back_inserter
#include <chrono>
#include <string>
#include <stdio.h>
#include <iomanip>
#include <float.h>
#include <cassert>
#include <functional>

using namespace std;

int main(int argc, char *argv[])
{
    int N, K;
    int ans;

    cin >> N >> K;

    if(N > 9) ans = K;
    else ans = K + 100*(10-N);

    cout << ans;
    
    return 0;
}

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

class Program
{
  static void Main()
  {
    string S = Console.ReadLine();
    int[] d = Divide(S);
    
    int c = d.Length / 2;
    var result = new List<int>();
    for (int i = 0; i < c; i++)
    {
      int R = d[i * 2];
      int L = d[i * 2 + 1];
      
      for (int r = 0; r < R - 1; r++)
        result.Add(0);
      
      if ((R+L) % 2 == 0) // R+L is EVEN
      {
        result.Add((R+L) / 2);
        result.Add((R+L) / 2);
      }
      else if (R % 2 == 0) // R+L is ODD, R is EVEN
      {
        result.Add((R+L-1) / 2);
        result.Add((R+L+1) / 2);
      }
      else // R+L is ODD, R is ODD
      {
        result.Add((R+L+1) / 2);
        result.Add((R+L-1) / 2);
      }
      
     for (int l = 0; l < L - 1; l++)
        result.Add(0);
    }
    
    Console.WriteLine(string.Join(" ", result));
  }
  
  static int[] Divide(string S)
  {
    var list = new List<int>();
    int lng = 0;
    string str = "";
    
    for (int i = 0; i < S.Length; i++)
    {
      string s = S.Substring(i, 1);
      if (lng == 0) //最初
      {
        str = s;
        lng = 1;
      }
      else if (str == s) //前の文字と一致
        lng++;
      else //前の文字と不一致
      {
        list.Add(lng);
        str = s;
        lng = 1;
      }
    }
    // 最後
    list.Add(lng);
    return list.ToArray();
  }
}

Measured memory_bytes: 19292
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <cstdio>

using namespace std;

int main()
{
    int N, A, B;
    cin >> N;
    if (N == 1)
    {
        cout << "Hello World" << endl;
    }
    else
    {
        cin >> A >> B;
        cout << A + B << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left

#======================================================#

def main():
    n = II()
    x = divc((n*100),108)
    if divf(x*108,100) == n:
        print(x)
    else:
        print(':(')
 

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int N=1e5+5;
queue<int>q;
int n,m,dp[N],in[N],ans=-1;;
vector<int>v[N];
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		a--,b--;
		v[a].pb(b);
		in[b]++;
	}
	for(int i=0;i<n;i++)
		if(in[i]==0)
			q.push(i);
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		for(int i=0;i<v[x].size();i++)
		{
			in[v[x][i]]--;
			if(in[v[x][i]]==0)
				q.push(v[x][i]);
			dp[v[x][i]]=max(dp[v[x][i]],dp[x]+1);
			ans=max(ans,dp[v[x][i]]);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 6528
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

		String s=getString(sc);
      System.out.println(s.replace("?","D"));
      

	}

	/**
	 * *汎用メソッド<br>
	 * 入力した配列に対する順列を取得
	 *
	 * @param numArray
	 * @return
	 */
	private static List<Integer[]> getPermutation(int[] numArray) {
		List<Integer[]> permutation = new ArrayList<>();
		Integer[] ans = new Integer[numArray.length];
		boolean[] used = new boolean[numArray.length];

		return buildPermutaion(permutation, numArray, ans, used, 0);
	}

	/**
	 * *汎用メソッド(内部)<br>
	 * 入力した配列に対する順列を作成
	 *
	 * @param list
	 * @param numArray
	 * @param ans
	 * @param used
	 * @param depth
	 * @return
	 */
	private static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,
			int depth) {

		// 全部使い切った時=>できた順列を返す
		if (depth == numArray.length) {
			list.add(ans.clone());
			return list;
		}
		// 使い切っていない場合

		for (int i = 0; i < numArray.length; i++) {
			if (used[i]) {
				continue;
			}
			ans[depth] = numArray[i];
			used[i] = true;
			list = buildPermutaion(list, numArray, ans, used, depth + 1);

			used[i] = false;
		}

		return list;
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int main(){
	int n; scanf("%d",&n);
	vector<lint> a(n);
	rep(i,n) scanf("%lld",&a[i]);

	bool ok=(a[0]==0);
	rep(i,n-1) if(a[i+1]-a[i]>=2) ok=false;
	if(!ok){
		puts("-1");
		return 0;
	}

	lint ans=0;
	int pre=0;
	for(int i=1;i<=n;i++){
		if(i==n || a[i-1]+1!=a[i]){
			ans+=a[i-1];
			pre=i;
		}
	}
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 4868
package main

import (
    "fmt"
    "math"
    "os"
)

func main() {

    var N int
    fmt.Fscanf(os.Stdin, "%v\n", &N)
    var t, x, y []int
    for i := 0; i < N; i++ {
        var ti, xi, yi int
        fmt.Fscanf(os.Stdin, "%d %d %d\n", &ti, &xi, &yi)
        t = append(t, ti)
        x = append(x, xi)
        y = append(y, yi)
    }

    curx := 0
    cury := 0
    curt := 0
    for i := 0; i < N; i++ {
        dt := int(math.Abs(float64(curt) - float64(t[i])))
        dx := int(math.Abs(float64(curx) - float64(x[i])))
        dy := int(math.Abs(float64(cury) - float64(y[i])))
        if dx+dy > dt {
            fmt.Println("No")
            return
        }
        if dt%2 != (dx+dy)%2 {
            fmt.Println("No")
            return
        }
        curt = t[i]
        curx = x[i]
        cury = y[i]
    }

    fmt.Println("Yes")
}

Measured memory_bytes: 6528
#include<iostream>
#include<algorithm>
using namespace std;
int func(int a,int b){
    while(b){
        a%=b;
        swap(a,b);
    }
    return a*a;
}
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<a*b/func(a,b)*c<<endl;
    return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
#include<cstring>
#include<cmath>
#include<iterator>
#include<cstdlib>
#define IOS   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ses   "\n"
#define whp   " "
#define mxi 99999
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define PI acos(-1)
#define sz(a) long long(a.size())
#define ff first
#define ss second
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep0(i,a,b) for(int i=a; i<b; i++)
#define rep1(i,a,b) for(int i=a; i<=b; i++)
#define rep0in(i,a,b) for(int i=a-1; i>=b; i--)
#define rep1in(i,a,b) for(int i=a; i>b; i--)
#define repv(i,a) for(auto i=a.begin(); i!=a.end();++i)

///priority_queue <int, vector<int>, greater<int>> g
#define MS(a,b) memset(a,b,sizeof(a));

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll fx[4]= {1,-1,0,0};
ll fy[4]= {0,0,1,-1};

typedef vector<ll> vll;
typedef vector<string> vss;
typedef vector<pair<ll,ll > > vpr;
typedef vector<pair<string,ll > > vspr;
typedef list<ll> li;
typedef list<string> ls;
typedef list<pair<ll,ll> > lpr;
typedef list<pair<string,ll> > lspr;

bool rs(ll a, ll b){return(a>b);}
ll spd(ll n){ if(n%2==0)return 2; for(ll i=3; i*i<=n; i++){if(n%i==0)return i;}return n;}

int main(){
double n,d; cin>>n>>d;
ll c=0;
while(n--){
    double x,y; cin>>x>>y;
    double k=sqrt(x*x+y*y);
    if(k<=d)c++;
}
cout<<c<<endl;


return 0;
}


Measured memory_bytes: 3836
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int main(){

	int N;
    scanf("%d",&N);

    int* table = new int[N];
    for(int i = 0; i < N; i++){
    	scanf("%d",&table[i]);
    }

    bool FLG;
    int num;

    for(num = 1; num < N; num++){
    	if(N%num != 0)continue;
    	FLG = true;
    	for(int loc = 0; loc + num < N; loc++){
    		if(table[loc] != table[loc+num]){
    			FLG = false;
    			break;
    		}
    	}
    	if(FLG)break;
    }

    printf("%d\n",N/num);

    return 0;
}

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

int main()
{
	
	int N, ans;
	cin >> N;
	
	if(N < 4){
		ans = 0;
	}else{
		ans = (N+1) / 2-1;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)


int main(){

    int n,a,b;
    cin >> n >> a >> b;
    if((b-a)%2){
        cout << "Borys" << endl;
    }else{
        cout << "Alice" << endl;
    }
    return 0;
}

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

const int CN = 1e5+5;
const int P = 1e9+7;

int read(){
    int s = 0,ne = 1; char c = getchar();
    while(c < '0' || c > '9') ne = c == '-' ? -1 : 1, c = getchar();
    while(c >= '0' && c <= '9') s = (s << 1) + (s << 3) + c - '0', c = getchar();
    return s * ne;
}

int qp(int a,int b) {int r = 1; while(b) {if(b & 1) r = 1ll * r * a % P; a = 1ll * a * a % P; b >>= 1;} return r;}
int bits(int S) {int r = 0; while(S) {r += (S & 1); S >>= 1;} return r;}

int n, m, A[20], f[20][1 << 17], fac[CN], ifac[CN];

int C(int N,int M){
    if(N < M || N < 0 || M < 0) return 0;
    int r = 1ll * fac[N] * ifac[M] % P;
    r = 1ll * r * ifac[N - M] % P;
    return r;
}

int main()
{
    // freopen("_in.in", "r", stdin);

    n = read(), m = read();
    for(int i = 1;i <= m;i++) A[i] = read();

    fac[1] = 1; for(int i = 2;i <= (1 << n);i++) fac[i] = 1ll * fac[i - 1] * i % P;
    ifac[1 << n] = qp(fac[1 << n], P - 2); ifac[0] = fac[0] = 1;
    for(int i = (1 << n) - 1; i; i--) ifac[i] = 1ll * (i + 1) * ifac[i + 1] % P;

    sort(A + 1, A + m + 1);
    f[m + 1][0] = 1;
    for(int i = m; i; i--)
        for(int S = 0; S < (1 << n); S++){
            f[i][S] = (f[i][S] + f[i + 1][S]) % P;
            for(int k = 0; k < n; k++)
                if(!(S & (1 << k)))
                f[i][S | (1 << k)] = (1ll * (1ll * f[i + 1][S] * C((1 << n) - A[i] - S, (1 << k) - 1) % P)
                                          * fac[1 << k] % P
                                     + f[i][S | (1 << k)]) % P;
        }

    int ans = 0;
    for(int S = 0; S < (1 << n); S++){
        int p = bits(S) & 1 ? -1 : 1;
        ans += 1ll * p * f[1][S] * fac[(1 << n) - 1 - S] % P;
        ans = (ans % P + P) % P;
    }
    ans = 1ll * ans * (1 << n) % P;

    printf("%d", ans);
}

Measured memory_bytes: 7856
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin>>a.at(i);
  vector<vector<int64_t>> dp(n+2,vector<int64_t>(n+2,0));
  for(int d=0;d<n;d++){
    for(int i=1;i+d<=n;i++){
      if((n-d)%2==1)
        dp[i][i+d]=max(dp[i+1][i+d]+a.at(i-1),dp[i][i+d-1]+a.at(i+d-1));
      else
        dp[i][i+d]=min(dp[i+1][i+d]-a.at(i-1),dp[i][i+d-1]-a.at(i+d-1));
    }
  }
  cout<<dp[1][n]<<endl;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define pp pair<ll, ll>
#define mp make_pair
#define PI acos(-1.0)
#define all(v) v.begin(), v.end()
#define pb push_back
#define foo(n) for (int i = 0; i <n; i++)
#define FREV(i, a, b) for (i = a; i >= b; i--)
#define READ(a, i, n) \
	FOR(i, 0, n) { a[i] = read_ll(); }
#define DEBUG(x) cerr << "In file " << __FILE__ << " at line " << __LINE__ << " :: " << #x << " = " << x << endl
#define S(n) scanf("%lld", &n)
#define INF 1e18
#define MOD 1000000007

// #ifndef ONLINE_JUDGE
// #define gc getchar
// #define pc putchar
// #else
// #define gc getchar_unlocked
// #define pc putchar_unlocked
// #endif




using namespace std;
int main()
{
	ll n,d,c=0,k;
	ll x,y,m;
	cin>>n>>d;
	for (int i=0;i<n;i++)
	{
		cin>>x>>y;
		k=pow(x,2)+pow(y,2);
		
		m=d*d;
		if(k<=m)
		c++;
		else
		continue;

	}
	
	cout<<c;



	return 0;
}


Measured memory_bytes: 3568
import itertools
import math

n = int(input())
x_y = list(input().split() for i in range(n))
all = list(itertools.permutations(x_y))
l = 0
for i in all:
    for j in range(n-1):
        tmp = math.sqrt(math.pow(int(i[j][0])-int(i[j+1][0]), 2) + math.pow(int(i[j][1])-int(i[j+1][1]), 2))
        l += tmp

print(l/len(all))

Measured memory_bytes: 10020
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}
 
vector<pair<ll,int>> factorize(ll n) {
  vector<pair<ll,int>> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n%i) continue;
    res.emplace_back(i,0);
    while (n%i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n,1);
  return res;
}
 
int main() {
  ll a, b;
  cin >> a >> b;
  ll g = gcd(a,b);
  auto f = factorize(g);
  int ans = f.size() + 1;
  cout << ans << endl;
  return 0;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;
  VL xs(N);
  cin >> xs;

  LL l = 2, r = 2;
  for(int i=N-1;i>=0;--i){
	LL l_ = (l + xs[i] - 1) / xs[i] * xs[i];
	LL r_ = r / xs[i] * xs[i] + xs[i] - 1;
	l = l_, r = r_;

	if(l > r) break;
  }

  if(l > r) cout << -1 << endl;
  else cout << l << " " << r << endl;

  return 0;
}


Measured memory_bytes: 1024
N = gets.to_i
T, A = [], []
N.times{t, a = gets.split.map(&:to_i); T << t; A << a}

votes = (0 ... N).inject([0, 0]) do |(t, a), i|
  if T[i] >= t && A[i] >= a
    [T[i], A[i]]
  else
    m = [(t + T[i] - 1)/T[i], (a + A[i] - 1)/A[i]].max
    [m*T[i], m*A[i]]
  end
end
puts votes.inject(:+)

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

using namespace std;

int main() {
	string O, E;
	int i;
	cin >> O >> E;
	for (i = 0; i < E.size(); i++) {
		cout << O[i] << E[i];
	}
	if (O.size() > E.size()) cout << O[i];
	cout << '\n';
	return 0;
}

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

int main(){
  char a[6];
  for(int i=0;i<6;i++){
    cin >> a[i];
  }
  if(a[0]==a[5]&&a[1]==a[4]&&a[2]==a[3]){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define fi first
#define se second
#define pb push_back 
using namespace std;

int ans[100],len,l,r,y,cnt,mid,sum;
char ok;
long long x;

int main(){
	l=1;r=9;y=11;cnt=0;
	x=1;
	while (1) {
		printf("? %lld\n",x);
		fflush(stdout);
		cin>>ok;
		if (ok=='N')break;
		len++;
		if (len>11) break;
		x*=10;
	}
	x=1;
	if (len>11) {
		while (1) {
			printf("? ");
			rep(i,0,x) printf("9");
			printf("\n");
			fflush(stdout);
			cin>>ok;
			if (ok=='Y') break;
			x++;
		}
		printf("! 1");
		rep(i,1,x) printf("0");
		fflush(stdout);
		return 0;	
	}
	while (1){
		sum++;
		mid=(l+r)>>1;
		printf("? ");
		rep(i,1,cnt+1) printf("%d",ans[i]);
		printf("%d",mid);
		rep(i,0,y) printf("9");
		printf("\n");
		fflush(stdout);
		cin>>ok;
		if (ok=='Y') {
			r=mid;
			if (l==r) {
				cnt++;ans[cnt]=l;y--;l=0;r=9;sum=0;
				if (cnt==len) break;
			}
		}else{
			l=mid+1;
		}
	}	
	printf("! ");
	rep(i,1,cnt+1) printf("%d",ans[i]);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 596
# C問題

from itertools import combinations
import numpy as np
N = int(input())

A = []
x = []
y = []
for i in range(N):
	# 人iの証言を格納する
	Ai = int(input())
	A.append(Ai)
	x.append([])
	y.append([])
	for j in range(Ai):
		xyij = input().split(" ")
		x[i].append(int(xyij[0]) - 1)
		y[i].append(int(xyij[1]))

def judge_contradiction(honest_index, N, A, x, y):
	# 大丈夫ならTrue、矛盾ならFalse
	all_people_judge = np.zeros(N, dtype="int")
	all_people_judge[:] = -1
	for i in honest_index:
		all_people_judge[i] = 1
	for ind in honest_index:
		# 人indは正直者。
		# この人の証言をもとに、all_people_judgeを完成させる
		for i in range(A[ind]):
			# 証言： 人x[ind][i]は、y[ind][i]である
			target, testimony = x[ind][i], y[ind][i]
			if all_people_judge[target] == -1:
				all_people_judge[target] = testimony
				continue
			elif all_people_judge[target] == testimony:
				continue
			else:
				# 矛盾が発生！
				return False
	# all_people_judgeで正直者と判定された人が、honest_indexでもそうなっているか判定
	for i in range(N):
		if all_people_judge[i] == 1:
			if np.any(np.array(honest_index) == i):
				continue
			else:
				return False
	return True

def doit(N, A, x, y):
	for numHonest in range(N, 0-1, -1):
		# numHonest 人が正直者であるとき
		for honest_index in combinations(np.arange(N), numHonest):
			# N人の正直者は、honest_indexに記載されたN人である
			# それで矛盾が生じないか、確かめる
			# import pdb; pdb.set_trace()
			if judge_contradiction(honest_index, N, A, x, y) == True:
				return numHonest
			else:
				continue
	return "hey"

print(doit(N, A, x, y))



Measured memory_bytes: 14444
#include<cstdio>
int n,k;
double ans=0;
int main()
{
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        int x=i;
        double t=1.0;
        while(x<k)
        {
            x*=2;t/=2;
        }
        ans+=t;
    }
    printf("%.012lf\n",ans/n);
}


Measured memory_bytes: 128
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include <random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
// #define pii pll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 510000;
const double pi = acos(-1);
const double eps = 1e-9;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


struct edge{
    ll to,cost;
};
ll n;
vector<edge>  G[100010];
ll d[100010];

void  dijkstra(int s){
    priority_queue<pll,vector<pll>,greater<pll>> que;
    fill(d,d+n+1,LLINF);
    d[s]=0;
    que.push(pii(0,s));

    while(!que.empty()){
        pll p=que.top();que.pop();
        int v=p.second;
        if(d[v]<p.first) continue;
        rep(i,G[v].size()){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(pll(d[e.to],e.to));
            }
        }
    } 
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll m;
    pair<pll,ll> s[100010];
    cin>>n>>m;
    rep(i,m){
        ll l,r,c;
        cin>>l>>r>>c;
        G[l].pb({r,c});
    }
    rep2(i,2,n+1){
        G[i].pb({i-1,0});
    }
    dijkstra(1);
    if(d[n]==LLINF){
        cout<<-1<<endl;
    }
    else cout<<d[n]<<endl;
    return 0;
}


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

using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)

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

	ll count = K;
	rep(i, 0, N - 1) {
		count *= (K - 1);
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
typedef long long ll;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int main () {

    int n,k; cin >>n>>k;
    string s; cin >> s;

    if(n == 1) {
        cout << 1 << endl;
        return 0;
    } 

    vector<int> nums;
    if(s[0] == '0') {
        nums.push_back(0);
    } 
    for (int i = 0; i < n;) {
        int j = i;
        while (j < n && s[i] == s[j]) {
            j++;
        }
        nums.push_back(j-i);
        i = j;
    }
    if(s[n-1] == '0') {
        nums.push_back(0);
    } 

    vector<int> cums((int)nums.size()+1, 0);
    for (int i = 0; i < (int)nums.size(); i++) {
        cums[i+1] = cums[i] + nums[i];
    }

    int res = 0;
    for (int left = 0; left < (int)cums.size(); left += 2) {
        int right = left + k*2+1;
        if (right >= (int)cums.size()) right = (int)cums.size() - 1;
        res = max(res, cums[right] - cums[left]);
    }

    cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 1272
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;

int main()
{

  int K;
  cin >> K;
  int L[33] = {1,
               1,
               1,
               2,
               1,
               2,
               1,
               5,
               2,
               2,
               1,
               5,
               1,
               2,
               1,
               14,
               1,
               5,
               1,
               5,
               2,
               2,
               1,
               15,
               2,
               2,
               5,
               4,
               1,
               4,
               1,
               51};
  cout << L[K - 1] << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

    private Scanner scan = new Scanner(System.in);
    private final int N;
    private int ans = 0;

    public Main() {
	N = Integer.parseInt(scan.next());
	
	for (int i = 0; i < N; i++) {
	    int l = Integer.parseInt(scan.next());
	    int r = Integer.parseInt(scan.next());

	    ans += r-l+1;
	}

	scan.close();
    }

    public final void answer() {
	System.out.println(ans);
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <algorithm>
#include<string>

using namespace std;


class Dice{
private:
	int yoko;
	int tate;
	int round;

public:
	string face[3][4];

	string getFace(int i,int j)const{
		return face[i][j];
	}

	Dice(vector<string> &v){
		init();
		face[1][1]=v[0];
		face[2][1]=v[1];
		face[1][2]=v[2];
		face[1][0]=v[3];
		face[0][1]=v[4];
		face[1][3]=v[5];
	}

	void init(){
		for(int i = 0; i < 3; i++){
			for(int j = 0; j < 4; j++){
				face[i][j]="";
			}
		}
		yoko=0;
		tate=0;
		round=0;
	}

	void rotate(){
		if(round<4){
			string tmp = face[2][1];
			face[2][1]=face[1][2];
			face[1][2]=face[0][1];
			face[0][1]=face[1][0];
			face[1][0]=tmp;
			round++;
		}
		if(round>=4){
			round=0;
			// àÇÁÄ«½çA¡ÌXbgðñ]³¹é
			if(yoko<4){
				string tmp = face[1][3];
				for(int i = 2; i >= 0; i--){
					face[1][i+1]=face[1][i];
				}
				face[1][0]=tmp;
				yoko++;
			}
			// àÇÁÄ«½çAcÌXbgðñ]³¹é
			if(yoko>=4){
				if(tate<4){
					tate++;
					string tmp = face[1][3];
					face[1][3]=face[0][1];
					for(int i = 0; i < 2; i++){
						face[i][1]=face[i+1][1];
					}
					face[2][1]=tmp;
				}
				if(tate>=4){
					round=0;
					tate=0;
					yoko=0;
				}
			}
		}
	};
};

int main(){

	int n;
	while(cin>>n&&n!=0){
		vector<Dice> ds;
		for(int i = 0; i < n; i++){
			vector<string> v;
			for(int j = 0; j < 6; j++){
				string str;
				cin>>str;
				v.push_back(str);
			}
			ds.push_back(Dice(v));
		}

		vector<Dice> used;
		used.push_back(ds[0]);
		for(int i = 1; i < n; i++){
			bool t=false;
			// ÇêðÝé©
			bool f=false;
			for(int j = 0; j < used.size(); j++){
				// ÇÌûü©
				for(int k = 0; k < 28; k++){
					// ½ÄÆæ±
					for(int l = 0; l < 3; l++){
						for(int m = 0; m < 4; m++){
							if(used[j].face[l][m]!=ds[i].face[l][m]){
								t=true;
								break;
							}
						}
						if(t)
							break;
					}
					if(!t){
						f=true;
					}
					//if(k==3){
					//	cout<<endl;
					//}
					used[j].rotate();
					t=false;
				}
				// àµÇÌûüÅàêvµÈ©Á½çAXgÉÁ¦é
	/*			for(int l = 0; l < 3; l++){
					for(int k = 0; k < 4; k++){
						cout<<used[j].face[l][k]<<" ";
					}
					cout<<endl;
				}
				cout<<endl;*/

				if(f)
					break;
			}
			if(!f){
				used.push_back(ds[i]);
			}
		}
		cout<<n-used.size()<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
import numpy as np


N, M = map(int, input().split())

X = [None] * N
Y = [None] * N
Z = [None] * N

for i in range(N):
    X[i], Y[i], Z[i] = list(map(int, input().split()))

S = [None] * N
F = [[1, 1, 1], [1, 1, -1], [1, -1, 1], [1, -1, -1], [-1, 1, 1], [-1, 1, -1], [-1, -1, 1], [-1, -1, -1]]
R = []

for f in F:
    p = f[0]
    q = f[1]
    r = f[2]
    T = np.array([X[i] * p + Y[i] * q + Z[i] * r for i in range(N)], dtype=int)
    T.sort()
    R.append(T[N-M:].sum())

print(max(R))


Measured memory_bytes: 12536
#include<iostream>
using namespace std;
int main()
{
	long long a,b,sum;
	cin>>a>>b;
	sum=b-a+1;
	if(a<b)
	{
		if(a>0&&b>0)
		{
			cout<<"Positive"<<endl;
		}
		else
		{
			if(a<=0&&b>0)
			{
				cout<<"Zero"<<endl;
			}
			else
			{
				if(a<0&&b<=0)
				{
					if(b==0)
					{
						cout<<"Zero"<<endl;
					}
					else
					{
						if(sum%2==0)
						{
							cout<<"Positive"<<endl;
						}
						else
						{
							cout<<"Negative"<<endl;
						}
					}
				}
			}
		}
	}
	else
	{
		return 0;
	}
	return 0;	
}

Measured memory_bytes: 256
import java.util.Scanner;

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

	public static void solve(Scanner s) {
		int a = s.nextInt();
		int b = s.nextInt();
		int c = s.nextInt();

		if (a + b == c || a + c == b || b + c == a) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 10184
table[9999][9999],j;
main(p,W,a,b,c){
	for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,table[0][W],j)){
		for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--){
			for(j=0;j<=W;j++){
				table[c-1][j]=(j<a)?table[c][j]:(table[c][j]>table[c][j-a]+b)?table[c][j]:(table[c][j-a]+b);
			}
		}
		for(j=0;table[0][j]!=table[0][W];j++);
	}
return 0;
}                

Measured memory_bytes: 0
# -*- coding: utf-8 -*-
"""
A - Two Rectangles
https://atcoder.jp/contests/abc052/tasks/abc052_a

"""
import sys


def solve(A, B, C, D):
    return max(A*B, C*D)


def main(args):
    A, B, C, D = map(int, input().split())
    ans = solve(A, B, C, D)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 3064
import sys
n = int(sys.stdin.readline().strip())
list = [''.join(sorted(sys.stdin.readline().strip())) for i in range(n)]
d = {}
ans = 0
for x in list:
  if x in d:
    ans += d[x]
    d[x] += 1
  else:
    d[x] = 1
print(ans)

Measured memory_bytes: 19400
// BEFORE SUBMITTING CHECK
    // Overflows - lli - int - typecasting
    // MM-constraints - runtime array bounds [imp]
	// if MM is large check cin/cout PLEASE 
    // return 0;
    // output format
    // mod
    // *******************************
    // WHILE DEBUGGING
    // Check if you've changed correctly while copy pasting within the code [imp.]
    // local/global var
#include <cmath>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <vector>
#include <cassert>
#include <deque>
#include <queue>
#include <map>
#include <utility>
#include <unordered_map>
#include <set>
// g++ -std=c++11 <filename>
#define FOR(j,k,n) for (int j = k; j < (int)(n); j++)
#define MAXN 10000000000000000
#define realMAXN 1000000000000000000
#define newl printf("\n")
#define fi first
#define se second
#define pb push_back
#define test(t)  int t; cin>>t; for(int tes = 0; tes < t; tes++)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long int lli;
typedef pair<lli,lli> plli;
void inn(long long int &ix) {scanf("%lld",&ix);}
void inn(long long int &ix,long long int &iy) {scanf("%lld%lld",&ix,&iy);}
void inn(int &ix) {scanf("%d",&ix);}
void inn(int &ix,int &iy) {scanf("%d%d",&ix,&iy);}
void inn(long double & ix) {scanf("%Lf",&ix);}
void outt(long long int ix) {printf("%lld",ix);}
void outt(long long int ix, char cx) {printf("%lld%c",ix,cx);}
void outt(int ix) {printf("%d",ix);}
void outt(int ix, char cx) {printf("%d%c",ix,cx);}
void outt(long double ix, char cx){printf("%.9Lf%c",ix,cx);}
void outt(long double ix){printf("%.9Lf",ix);}
void pline() {printf("\n");}
const int MM = 2100;
lli m,n,k,p1,p2,p3,p,f;
string s[MM];
int cumri[MM][MM],cumup[MM][MM],ri[MM][MM],up[MM][MM],tot[MM][MM];
int main(){
	int q;
	// Have you solved the problem completely?    
 	cin>>n>>m>>q;
 	for(int i=0; i<n; i++)
 		cin>>s[i];

 	for(int i=0; i<n; i++)
 	{
 		for(int j=0; j<m; j++)
 		{
 			if(i > 0)
 				up[i+1][j+1] = (s[i][j]==s[i-1][j] && s[i][j]=='1');
 			if(j > 0)
 				ri[i+1][j+1] = (s[i][j]==s[i][j-1] && s[i][j]=='1');
 		}
 	}
 	// cout<<endl<<endl;
 	for(int i=1; i<=n; i++)
 		for(int j=1; j<=m; j++)
 		{
 			cumri[i][j] = cumri[i][j-1]+cumri[i-1][j]-cumri[i-1][j-1]+ri[i][j]; 
 			cumup[i][j] = cumup[i][j-1]+cumup[i-1][j]-cumup[i-1][j-1]+up[i][j];
  			tot[i][j] = tot[i][j-1]+tot[i-1][j]-tot[i-1][j-1]+(s[i-1][j-1]=='1');
  			// cout<<cumri[i][j]<<" "<<i<<" "<<j<<endl;
  		}
  	// q = 0;
  		 	// cout<<endl<<endl;
  	while(q--)
  	{
  		lli p4;
  		cin>>p1>>p3>>p2>>p4;
  		if(p1 > p2)
  			swap(p1,p2);
  		if(p3 > p4)
  			swap(p3,p4);

  		lli edges = cumri[p2][p4] - cumri[p2][p3]-cumri[p1-1][p4]+cumri[p1-1][p3];
  		
  		edges +=  cumup[p2][p4] - cumup[p2][p3-1]-cumup[p1][p4]+cumup[p1][p3-1];
  		// cout<<edges<<endl;
  		lli vert = tot[p2][p4] - tot[p2][p3-1] - tot[p1-1][p4] + tot[p1-1][p3-1];
  		cout<<vert-edges<<endl;
  	}
 	return 0;
}







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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void answer1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void answer2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void answer3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void answer(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}  

int main(){
  ll i, j;
  ll h, w;
  cin >> h >> w;
  //ll a, b, c;
  //cin >> a >> b;
  string s[h];
  for(i=0;i<h;i++)
  cin >> s[i];

  char a[h][w];
  for(i = 0;i < h; i++){
      for(j=0;j<w;j++){
          a[i][j] = s[i][j];
      }
  }


  ll result = 0;
  bool judge = true;
  deque<pair<ll, ll>> dq;
  for(i=0;i<h;i++)
  for(j=0;j<w;j++)
  if(a[i][j]=='#'){

      //cout << a[i][j] << endl;
  dq.push_back(make_pair(i,j));
  }
  ll buf;
  ll x, y;
  //cout << dq.size() << endl;
  for(i=0;dq.size() != 0;i++){
      buf = dq.size();
      //cout << buf << endl;
      for(j=0;j<buf;j++){
          x = dq.front().first;
          y = dq.front().second;
          dq.pop_front();
          if(x-1>=0&&a[x-1][y]!='#'){
              a[x-1][y] = '#';
              dq.push_back(make_pair(x-1,y));
          }
          if(y-1>=0&&a[x][y-1]!='#'){
              a[x][y-1] = '#';
              dq.push_back(make_pair(x,y-1));
          }
          if(x+1<h&&a[x+1][y]!='#'){
              a[x+1][y] = '#';
              dq.push_back(make_pair(x+1,y));
          }
          if(y+1<w&&a[x][y+1]!='#'){
              a[x][y+1] = '#';
              dq.push_back(make_pair(x,y+1));
          }

      }

  }
  cout << i-1 << endl;

  /*
  vector<ll> a(n);
  for(i = 0; i < n; i++)
    cin >> a[i];
  //for(i = 0; i < n; i++)
  */

  return 0;
}

Measured memory_bytes: 18612
#include<bits/stdc++.h>
using namespace std;
#define N 200003
#define LL long long
#define mod 998244353

int T;
LL A,B,C,D;

inline int read(){
	int X=0,w=0;
	char ch=0;
	while (ch<'0' || ch>'9')
	  w|=ch=='-',ch=getchar();
	while (ch>='0' && ch<='9')
	  X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
	return w ? -X : X;
}

inline LL gcd(LL a,LL b){
	return !b ? a : gcd(b,a%b);
}

inline int solve(){
	if (A<B) return 0;
	if (A<C && B>D) return 0;
	if (A<C && B==D) return 1;
	LL res=gcd(B,D),res2=(A-C)/res;
	if (A<C) res2=(A-C+1)/res-1;
	LL res3=A-res*res2;
	if (B>=C){
		if (res3-B+D<B) return 0;
		  else if (res3>=B) return 1;
		    else return 0;
	}
	else{
		if (B<=D) return 1;
		  else if (res3-B+D>=C) return 1;
		    else return 0;
	}
}

int main(){
	T=read();
	while (T--){
		scanf("%lld%lld%lld%lld",&A,&B,&C,&D);
		C++;
		if (solve()) puts("Yes");
		  else puts("No");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <queue>
using namespace std;
int main(){
	int N; cin >> N; 
	vector<int> E[200010] = {}; 
	for(int i = 0; i < N-1; i++){
		int a, b; cin >> a >> b; 
		a--; b--; 
		E[a].push_back(b); 
		E[b].push_back(a); 
	}
	int D[200010] = {}; 
	queue<int> que;
	que.push(0); 
	while(que.size()){
		int p = que.front(); que.pop(); 
		for(int i = 0; i < E[p].size(); i++){
			if(D[E[p].at(i)] == 0){
				D[E[p].at(i)] = D[p] + 1; 
				que.push(E[p].at(i)); 
			}
		}
	}
	int mx = 0; int index = 0; 
	for(int i = 0; i < N; i++){
		if(D[i] > mx){
			index = i; mx = D[i]; 
		}
	}
	int D2[200010] = {}; 
	queue<int> que2;
	que2.push(index); 
	while(que2.size()){
		int p = que2.front(); que2.pop(); 
		for(int i = 0; i < E[p].size(); i++){
			if(D2[E[p].at(i)] == 0){
				D2[E[p].at(i)] = D2[p] + 1; 
				que2.push(E[p].at(i)); 
			}
		}
	}
	int diameter = 0; 
	for(int i = 0; i < N; i++){
		diameter = max(diameter, D2[i]); 
	}
	if(diameter % 3 == 1) cout << "Second" << endl; 
	else cout << "First" << endl; 
}

Measured memory_bytes: 14324
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))

x1 = (c1[1]-c1[0] == c2[1]-c2[0] == c3[1]-c3[0])
x2 = (c1[2]-c1[1] == c2[2]-c2[1] == c3[2]-c3[1])
x3 = (c2[0]-c1[0] == c2[1]-c1[1] == c2[2]-c1[2])
x4 = (c3[0]-c2[0] == c3[1]-c2[1] == c3[2]-c2[2])

if x1 and x2 and x3 and x4:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064