akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int n, q;
  cin >> n >> q;
  vector<pair<int, pii>> vp;
  rep(i, n) {
    int s, t, x;
    cin >> s >> t >> x;
    vp.eb(mp(s - x, mp(1, x)));
    vp.eb(mp(t - x, mp(-1, x)));
  }

  sort(all(vp));
  set<int> si;
  int idx = 0;
  rep(i, q) {
    int d;
    cin >> d;
    while (idx < vp.size() && vp[idx].F <= d) {
      if (vp[idx].S.F == 1)
        si.insert(vp[idx].S.S);
      else
        si.erase(vp[idx].S.S);
      idx++;
    }
    if (si.size() == 0)
      cout << "-1" << endl;
    else
      cout << *(si.begin()) << endl;
  }
}


Measured memory_bytes: 16108
package main

import "fmt"

func main() {

	ohouse := make([][][]int, 4)
	for building:=0; building<4; building++ {
		ohouse[building] = make([][]int, 3)
		for floor:=0; floor<3; floor++ {
			ohouse[building][floor] = make([]int, 10)
			for room:=0; room<10; room++ {
				ohouse[building][floor][room] = 0
			}
		}
	}

	var n, b, f, r, v int
	fmt.Scan(&n)
	for m:=0; m<n; m++ {
		fmt.Scan(&b, &f, &r, &v)
		ohouse[b-1][f-1][r-1] += v
	}

	for building:=0; building<4; building++ {
		for floor:=0; floor<3; floor++ {
			for room:=0; room<10; room++ {
				fmt.Print(" ",ohouse[building][floor][room])
			}
			fmt.Println()
		}
		if building != 3 {
			fmt.Println("####################")
		}
	}
}


Measured memory_bytes: 1140
#include <bits/stdc++.h>
using namespace std;
#define N 100001
int a[N], n;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
    sort(a + 1, a + n + 1, greater<int>());
    int add = 1, adds = 1;
    while (add < n && a[add + 1] >= add + 1) add++;
    while (a[adds + 1] >= add) adds++;
    int ans = ((a[add] - add) & 1) || ((adds - add) & 1);
    puts(ans ? "First" : "Second");
    return 0;
}

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

typedef struct {double x,y;}Point;

void koch(int n,Point a,Point b){
  if(n==0) return;

  Point s,t,u;
  double th=M_PI*60.0/180.0;

  s.x=(2.0*a.x+1.0*b.x)/3.0;
  s.y=(2.0*a.y+1.0*b.y)/3.0;
  t.x=(1.0*a.x+2.0*b.x)/3.0;
  t.y=(1.0*a.y+2.0*b.y)/3.0;
  u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
  u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;

  koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,b);
}

int main(){
  Point a,b;
  int n;

  scanf("%d",&n);

  a.x=0;
  a.y=0;
  b.x=100;
  b.y=0;

  printf("%.8f %.8f\n",a.x,b.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);

  return 0;
}



Measured memory_bytes: 2044
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<queue>
#include<set>
#include<cmath>
#include<vector>
#include<cstdio>
#include<cstdlib>
#define ll long long
using namespace std;
const ll mod=998244353;
ll f[300005],c[300005];
ll n,a,b,k,ans;
ll ksm(ll x,ll num){
	if(num==1) return x;
	ll j=ksm(x,num/2);
	if(num&1) return j*j%mod*x%mod;
	else return j*j%mod;
}
ll C(ll x,ll y){
	// c x y
	return c[x]*f[y]%mod*f[x-y]%mod;
}
int main(){
	c[0]=1;ll tmp;
	scanf("%lld%lld%lld%lld",&n,&a,&b,&k);
	if(k==0) {printf("1");return 0;}
	for(int i=1;i<=n;i++) c[i]=c[i-1]*i%mod;
	f[n]=ksm(c[n],mod-2);
	for(int i=n;i>=1;i--) f[i-1]=f[i]*i%mod;
	for(int i=0;i<=n;i++){
		tmp=k-a*i;
		if(tmp<0 || tmp%b) continue;
		tmp=tmp/b;if(tmp>n) continue;
		(ans+=C(n,i)*C(n,tmp)%mod)%=mod;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 1000000001
#define MOD 10000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const ull B=100000007;
int main(){
      string s,t="";
      vector<string> ans;
      getline(cin,s);
      REP(i,s.size()){
            if(s[i]==' '||s[i]==','||s[i]=='.'){
                  if(3<=t.size()&&t.size()<=6)ans.PB(t);
                  t="";
            }else t+=s[i];
      }
      REP(i,ans.size()){
            cout<<ans[i];
            if(i==ans.size()-1)cout<<endl;
            else cout<<" ";
      }
}

Measured memory_bytes: 1184
#include <stdio.h>
#include <stdlib.h>

int main(){
  int L,R;
  scanf("%d %d",&L,&R);
  int x = L % 2019;
  int y = R % 2019;
  int i,j,k;
  int min = 2019;
  if(R-L >= 673){
    printf("0\n");
  }else if(x > y || x == 0 || y == 0){
    printf("0\n");
  }else{
    for(i=x;i<=y-1;i++){
      for(j=i+1;j<=y;j++){
        k = (i*j) % 2019;
        if(k < min) min = k;
      }
    }
    printf("%d\n",min);
  }
  return 0;
}


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

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

using namespace std;

class mint{
	static const int MOD=998244353;
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }
	mint operator-()const{ return mint(-x); }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

mint operator+(long long y,const mint& m){ return m+y; }
mint operator*(long long y,const mint& m){ return m*y; }

mint pow(mint m,long long k){
	mint res=1;
	for(;k>0;k>>=1,m*=m) if(k&1) res*=m;
	return res;
}

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

	// dp[i][j] = [x^j](1+x^a[0])*...*(1+x^a[i-1])
	vector<vector<mint>> dp(n+1,vector<mint>(tar+1));
	dp[0][0]=1;
	rep(i,n){
		dp[i+1]=dp[i];
		// * (1+x^a[i])
		for(int j=tar;j>=a[i];j--) dp[i+1][j]+=dp[i+1][j-a[i]];
	}

	vector<mint> sum(tar+1);
	rep(i,n+1) rep(j,tar+1) sum[j]+=dp[i][j];

	mint ans=sum[tar];
	rep(i,n){
		sum[0]-=1;
		// / (1+x^a[i])
		for(int j=a[i];j<=tar;j++) sum[j]-=sum[j-a[i]];
		ans+=sum[tar];
	}
	cout<<ans<<'\n';

	return 0;
}


Measured memory_bytes: 35584
/**


  ######                                                                     ######   #     #  #######
  #     #    ##    #####   #    #  #    #  #    #  #   ####   #    #  #####  #     #  #     #       #
  #     #   #  #   #    #  #   #   #   #   ##   #  #  #    #  #    #    #    #     #  #     #      #
  #     #  #    #  #    #  ####    ####    # #  #  #  #       ######    #    ######   #######     #
  #     #  ######  #####   #  #    #  #    #  # #  #  #  ###  #    #    #    #   #    #     #    #
  #     #  #    #  #   #   #   #   #   #   #   ##  #  #    #  #    #    #    #    #   #     #   #
  ######   #    #  #    #  #    #  #    #  #    #  #   ####   #    #    #    #     #  #     #  #######



**/
/*

    BismiLLAHIR RAHMANIR RAHIM
    It's not how you look or who you are underneath, it's what you do that defines you

                                ------********-------

    Status : ;
    TC: xxx/xxx;
    DOS: ;
    OJ: ;

*/

#include <bits/stdc++.h>

using namespace std;

#define test        cout<<"thiq ase boss"<<endl;
#define PB          push_back
#define PF          push_front
#define PII         pair <int,int>
#define MII         map <int,int>
#define MSI         map <string,int>
#define MIS         map <int,string>
#define MLI         map <long long int,int>
#define MIL         map <int,long long int>
typedef long long int           LL;
typedef vector <string>         VS;
typedef vector <int>            VI;
typedef vector <char>           VC;
typedef vector <LL>             VLL;

const int INF = 1e9;
const int MX = 1e9;
const double PI = acos(-1);

/* Functions */

int main() {
    #ifdef LU_SERIOUS
        freopen("get.txt","r",stdin);
    #endif // LU_SERIOUS
    string s,a,b,c;
    while (cin >>a>>b>>c) {
    cout << a[0] << b[0] << c[0] << endl;
    }
    return 0;
}



Measured memory_bytes: 764
import math
data = list(map(int, input().split()))

a = data[0]
b = data[1]
h = data[2]
m = data[3]

h = (h+m/60)%12
deg = (h/12-m/60)*2*math.pi
result = math.sqrt(a*a+b*b-2*a*b*math.cos(deg))
print(result)

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

#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector < ll >
#define vvll vector < vll >
#define vld vector < ld >
#define pll pair < ll,ll >
#define ppll pair < ll, pll > 
#define pld pair < ld,ld > 
#define vpll vector < pll >
#define vpld vector < pld >
#define all(X) X.begin(),X.end()
#define rall(X) X.rbegin(),X.rend()
#define endl "\n"
#define sz(x) ((ll)((x).size()))
vll emptyVector;
const ll MAX = 1e6 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884197169399375105;

ll binaryExpo(ll x, ll n)
{
	if(n == 0)
		return 1;
	if(n % 2 == 0)
		return binaryExpo((x*x) % MOD, n/2);
	return (x*binaryExpo((x*x) % MOD, n/2)) % MOD;
}

ll gcd(ll a, ll b)
{
	if(b == 0)
		return a;
	return gcd(b, a % b);
}
/*-------------------------------------------		CODE STARTS FROM HERE		------------------------------------------*/

struct curve{
	ll h, c;

	ll eval(ll x){
		ll d = (x - h);
		return d*d + c;
	}

	ld Xintersect(curve C){
		return (1.0L*(h + C.h) / 2) + ((1.0L*(C.c - c) / (C.h - h)) / 2);
	}
};

void solve(void)
{
	ll n, c;
	cin >> n >> c;

	vector < curve > v;
	
	ll x;	cin >> x;
	curve cc = {x, 0};
	v.pb(cc);

	ll ANS = 0;
	for(int i = 1; i < n; i++)
	{
		ll h;	cin >> h;
		int mn = 0, mx = sz(v) - 1, ans = 0;
		while(mn <= mx)
		{
			int mid = (mn + mx) >> 1;
			if(mid == sz(v) - 1)
			{
				ans = mid;
				break;
			}
			if(v[mid].eval(h) <= v[mid + 1].eval(h))
			{
				ans = mid;
				mx = mid - 1;
			}
			else
				mn = mid + 1;
		}
		
		curve C = {h, v[ans].eval(h) + c};
		ANS = max(ANS, v[ans].eval(h) + c);
		// cout << "ans = " << ans << endl;
		// cout << "h = " << v[ans].h << " c = " << v[ans].c << endl;
		// cout << v[ans].eval(h) + c << endl;

		while(sz(v) > 1 and C.Xintersect(v[sz(v) - 2]) <= v.back().Xintersect(v[sz(v) - 2]))
			v.pop_back();

		v.pb(C);
	}

	cout << ANS << endl;



	

}

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


	// int t;
	// cin >> t;
	// while(t--)
	{
		solve();
	}


	return 0;
}

Measured memory_bytes: 6512
<?php
/**
 * @see: https://atcoder.jp/contests/abc051/tasks/abc051_b
 */

function getInput(): array
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}

function calculate(int $K, int $S): int
{
    $numberOfTriples = 0;

    for ($X = 0; $X <= $K; $X++) {
        for ($Y = 0; $Y <= $K; $Y++) {
            $Z = $S - $X - $Y;

            if (0 <= $Z && $Z <= $K) {
                $numberOfTriples++;
            }
        }
    }

    return $numberOfTriples;
}

list($K, $S) = getInput();

$result = calculate($K, $S);

echo $result . PHP_EOL;


Measured memory_bytes: 4984
import java.net.SecureCacheResponse;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x1 = sc.nextInt();
        int y1 = sc.nextInt();
        int x2 = sc.nextInt();
        int y2 = sc.nextInt();

        int x = x2 - x1;
        int y = y2 - y1;

        int x3 = x2 - y;
        int y3 = y2 + x;
        int x4 = x1 - y;
        int y4 = y1 + x;

        System.out.printf("%d %d %d %d", x3, y3, x4, y4);
    }
}


Measured memory_bytes: 21844
n, m = map(int, input().split())
*C, = map(int, input().split())

dp = [n]*(n+1)
dp[0] = 0

for c in C:
    for i in range(n+1):
        if i+c > n:
            break
        dp[i+c] = min(dp[i+c], dp[i] + 1)

print(dp[n])


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

using ll    = long long;
using ull   = unsigned long long;
using veci  = vector<int>;
using vecll = vector<ll>;
#define EPS (1e-7)
#define INF (1e9)
#define PI  (acos(-1))
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define REP(i,n) for(int i= 0;i<(int)(n);++i)
#define pb push_back

veci enum_div(int n){
	veci ret;
	ret.pb(1);
	for(int i=1;i*i<n;i++){
		if(n%i==0){
			ret.pb(i);
			if(i != n/i){ret.pb(n/i);}
		}
	}
	ret.pb(n);
	return ret;
}
int gcb(int a,int b){return ((b == 0)? a : gcb(b,a%b));}
int gcd(int a,int b){return (a*b) / gcb(a,b);}

int main(){
    int n,a;
    cin >> n >> a;
    cout << n*n -a << endl;
	return 0;
}



Measured memory_bytes: 256
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>

#define lint long long
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

int main(){
    lint n, k;
    cin >> n >> k;
    lint ans = 0;
    rep(a, k){
        lint b = (k-(a%k))%k;
        lint c1 = (k-(a%k))%k, c2 = (k-(b%k))%k;
        lint MAX = max({a, b, c1});
        if(c1 == c2 && MAX <= n){
            if(a == 0){
                a = k;
            }
            if(b == 0){
                b = k;
            }
            if(c1 == 0){
                c1 = k;
            }
            ans += ((n+k-a)/k)*((n+k-b)/k)*((n+k-c1)/k);
            if(a == k){
                a = 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
[n,m]=[int(i) for i in input().split()]
a=[]
b=[]
c=[]
d=[]
for _ in range(n):
  [x,y]=[int(i) for i in input().split()]
  a.append(x)
  b.append(y)
for _ in range(m):
  [x,y]=[int(i) for i in input().split()]
  c.append(x)
  d.append(y)

e=[[0 for j in range(m)] for i in range(n)]
for i in range(n):
  for j in range(m):
    e[i][j]=abs(a[i]-c[j])+abs(b[i]-d[j])
for i in range(n):
  print(e[i].index(min(e[i]))+1)

Measured memory_bytes: 3064
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


h, w = LI()
grid = SRL(h)
visited = [[0] * w for _ in range(h)]

def solve(sy, sx):
    dq = deque([(sy, sx)])
    visited[sy][sx] = 1
    bi = [0, 1]
    while dq:
        cy, cx = dq.popleft()
        for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            ny = cy + i
            nx = cx + j
            if 0 <= ny < h and 0 <= nx < w and not visited[ny][nx]:
                if grid[ny][nx] != grid[cy][cx]:
                    bi[int(grid[sy][sx] == grid[ny][nx])] += 1
                    dq += [(ny, nx)]
                    visited[ny][nx] = 1
    return bi[0] * bi[1]

ans = 0
for y in range(h):
    for x in range(w):
        if visited[y][x]:
            continue
        else:
            ans += solve(y, x)


print(ans)

Measured memory_bytes: 55644
'use strict'
 
function Main(input) {
    var params = input.split('\n');
    const n = params[0];
    
    let minScore = 0;
    let lowest = 0;
    for (let i = 1; i < params.length; i++) {
        const arg = params[i].split(' ');
        if (arg[0] > lowest) {
            lowest = parseInt(arg[0], 10);
            minScore = parseInt(arg[1], 10);
        }
    }
    console.log(lowest + minScore);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 37420
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

struct Node {
	int d, c, k;
	int v[101];
};

struct Node node[101];

#define LEN 100000

struct Process
{
	char name[11];
	int time;
};

int que[LEN];
int head = 0, tail = 0;

void enqueue(int a) {
	que[tail] = a;
	if (tail == LEN - 1)
		tail = 0;
	else
		tail++;
}

int dequeue() {
	int n = head;
	if (head == LEN - 1)
		head = 0;
	else
		head++;
	return que[n];
}

void breadth_first() {
	int u, v;
	while (head != tail) {
		u = dequeue();
		for (int i = 0; i < node[u].k; i++) {
			v = node[u].v[i];
			if (node[v].c != 1) {
				node[v].d = node[u].d + 1;
				enqueue(v);
			}
			node[v].c = 1;
		}
	}
}

int main(void) {
	int n, u, k, v;

	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%d", &u);
		scanf("%d", &k);
		node[u].k = k;
		node[u].c = 0;
		node[u].d = -1;
		for (int j = 0; j < k; j++) {
			scanf("%d", &v);
			node[u].v[j] = v;
		}
	}

	enqueue(1);
	node[1].d = 0;
        node[1].c = 1;
	breadth_first();

	for (int i = 1; i <= n; i++) {
		printf("%d %d\n", i, node[i].d);
	}

	
	return 0;
}


Measured memory_bytes: 2148
import sys

sys.setrecursionlimit(10**6)

input = sys.stdin.readline

n = int(input())
ls = [list(map(int, input().split())) for _ in range(n - 1)]

es = [[] for _ in range(n + 1)]
for a, b, c in ls:
    es[a].append((b, c))
    es[b].append((a, c))
ds = [0] * (n + 1)


def dfs(cur, prev, c):
    ds[cur] = ds[prev] + c
    for e, c in es[cur]:
        if e != prev:
            dfs(e, cur, c)


q, k = map(int, input().split())
qs = [list(map(int, input().split())) for _ in range(q)]

dfs(k, k, 0)
for x, y in qs:
    print(ds[x] + ds[y])

Measured memory_bytes: 169512
import java.math.BigDecimal;
import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);

    static int ans = 0;

    public static void main(String[] args) {
        int N = sc.nextInt();
        int M = sc.nextInt();

        boolean[] visited = new boolean[N];
        boolean[][] bridges = new boolean[N][N];

        for (int i = 0; i < M; i++) {
            int from = sc.nextInt() - 1;
            int to = sc.nextInt() - 1;
            bridges[from][to] = bridges[to][from] = true;
        }

        visited[0] = true;
        dfs(N, 0, bridges, visited);
        System.out.println(ans);
    }

    private static void dfs(int N, int from, boolean[][] bridges, boolean[] visited) {
        boolean allVisit = true;
        for (int i = 0; i < N; i++) {
            allVisit &= visited[i];
        }
        if (allVisit) {
            ans++;
            return;
        }

        for (int i = 0; i < N; i++) {
            if (bridges[from][i] && !visited[i]) {
                visited[i] = true;
                dfs(N, i, bridges, visited);
                visited[i] = false;
            }
        }
    }
}

Measured memory_bytes: 23764
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    a = LI()
    c = collections.Counter(a)
    if len(c) == 2:
        return "Yes"

    return "No"


print(main())





Measured memory_bytes: 6336
import java.io.*;
import java.util.*;

public class Main {
    static BufferedReader in;

    public static void solve() throws IOException {
        int n = nextInt();
        Integer[] h = nextArray(n);

        int[] dp = new int[n];

        dp[0] = 0;
        dp[1] = calc(h,1,0);

        for(int i = 2;i<n;i++){
            dp[i] = Math.min(dp[i-1]+calc(h,i,i-1), dp[i-2]+calc(h,i,i-2));
        }

//        System.out.println(Arrays.toString(dp));

        System.out.println(dp[n-1]);



    }
    static int calc(Integer[] arr, int i , int j){
        return Math.abs(arr[i] - arr[j]);
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        solve();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(in.readLine().trim());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(in.readLine().trim());
    }

    static Integer[] nextArray(int n) throws IOException {
        StringTokenizer st = new StringTokenizer(in.readLine());
        Integer[] tmp = new Integer[n];
        for (int i = 0; i < tmp.length; i++) {
            tmp[i] = Integer.parseInt(st.nextToken());
        }

        return tmp;
    }

}



Measured memory_bytes: 33648
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())
A = []
for _ in range(5) :
  A.append(int(input()))

pmax = 0
sumA = 0
for i in range(5) :
  p = 0
  while A[i]%10 != 0 :
    A[i] += 1
    p += 1
  sumA += A[i]
  pmax = max(pmax, p)

print (sumA - pmax)
  
  

Measured memory_bytes: 38256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int toInt(string s){
  stringstream buf(s);
  int ret;
  buf >> ret;
  return ret;
}

int dfs(string s){
  //  cout << s << endl;
  if(s[0]!='[') return (toInt(s)+1)/2;

  vector<int>v;
  int f = 1;
  int pr=0;
  rep(i,s.size()){
    if(s[i]=='[') pr++;
    else if(s[i]==']') pr--;
    if(!pr){
      v.push_back(dfs(s.substr(f, i-f)));
      f = i+2;
    }
  }
  sort(v.begin(), v.end());
  int res = 0;
  rep(i,(v.size()+1)/2){
    res += v[i];
  }
  return res;
}

int main(){
  int N;
  cin >> N;
  while(N--){
    string s;
    cin >> s;
    cout << dfs(s) << endl;
  }
  return 0;
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define INF             1e9
#define INFL            8e18
#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define READ            freopen("D:\\moidda CPP\\alu.txt", "r", stdin)
#define WRITE           freopen("D:\\moidda CPP\\vorta.txt", "w", stdout)
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MASK(x)         for(int i = 0; i < 8; i++){ if(x&(1<<i)){ cout << i << " "; } } cout << endl;

typedef long long ll;
typedef pair<int, int > pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pff;

const int MAX = 1e5 + 10;
const int MAX_VALUE = 2e6 + 10;
const int MAXLOG = log2(MAX) + 2;
const int MOD = 10007;
const double PY = acos(-1.0);
const double EPS = 1E-9;

int n, m;
vector<int> G[MAX];
int dis[MAX];
int par[MAX];

int32_t main()
{
#ifndef ONLINE_JUDGE
//    READ;
//    WRITE;
#endif

    FASTIO;

    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int u, v;
        cin >> u >> v;
        G[u].PB(v);
        G[v].PB(u);
    }

    for(int i = 0; i < MAX; i++)
        dis[i] = INF;
    memset(par, -1, sizeof par);

    queue<int> Q;
    dis[1] = 0;
    Q.push(1);
    while(!Q.empty()){
        int u = Q.front();
        Q.pop();
        for(int v: G[u]){
            if(dis[v] > dis[u]+1){
                dis[v] = dis[u]+1;
                par[v] = u;
                Q.push(v);
            }
        }
    }

    for(int i = 1; i <= n; i++){
        if(dis[i]>=INF){
            cout << "No";
            return 0;
        }
    }

    cout << "Yes\n";
    for(int i = 2; i <= n; i++)
        cout << par[i] << "\n";

    return 0;
}



Measured memory_bytes: 10820
a, b, c, d = map(int, list(raw_input()))

ppp = lambda a,b,c,d: (a+b+c+d == 7, "%d+%d+%d+%d=7" % (a,b,c,d))
pps = lambda a,b,c,d: (a+b+c-d == 7, "%d+%d+%d-%d=7" % (a,b,c,d))
psp = lambda a,b,c,d: (a+b-c+d == 7, "%d+%d-%d+%d=7" % (a,b,c,d))
pss = lambda a,b,c,d: (a+b-c-d == 7, "%d+%d-%d-%d=7" % (a,b,c,d))
spp = lambda a,b,c,d: (a-b+c+d == 7, "%d-%d+%d+%d=7" % (a,b,c,d))
sps = lambda a,b,c,d: (a-b+c-d == 7, "%d-%d+%d-%d=7" % (a,b,c,d))
ssp = lambda a,b,c,d: (a-b-c+d == 7, "%d-%d-%d+%d=7" % (a,b,c,d))
sss = lambda a,b,c,d: (a-b-c-d == 7, "%d-%d-%d-%d=7" % (a,b,c,d))

li = [ppp, pps, psp, pss, spp, sps, ssp, sss]
for l in li:
    if l(a, b, c, d)[0]:
        print l(a,b,c,d)[1]
        break




Measured memory_bytes: 2696
N, A, B = map(int, input().split())
ans = 0
for n in range(1, N+1):
  tmp = n
  i = 4
  s = 0
  while i > -1:
    keta = tmp // (10 ** i)
    tmp -=  keta * (10 ** i)
    s += keta
    i -= 1
  if s >= A and s <= B:
    ans += n
print(ans)



Measured memory_bytes: 3060
MOD=10**9+7
INF=float('inf')
N,M=map(int,input().split())
S=list(map(int,input().split()))
T=list(map(int,input().split()))
dp=[[-INF]*(M+1) for i in range(N+1)]
dp[0][0]=1
for i in range(N+1):
    dp[i][0]=1
for j in range(M+1):
    dp[0][j]=1
for i in range(N):
    for j in range(M):
        if S[i]==T[j]:
            dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j])%MOD
        else:
            dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j]-dp[i][j]+MOD)%MOD
print(dp[N][M])

Measured memory_bytes: 134592
def main():
    s = input()
    t = input()

    if not set(t) <= set(s):
        print(-1)
        return

    s_indexes = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"}
    for i, s_c in enumerate(s):
        s_indexes[s_c].append(i)
    s_pointer = {c: 0 for c in "abcdefghijklmnopqrstuvwxyz"}
    s_length = {c: len(s_indexes[c]) for c in "abcdefghijklmnopqrstuvwxyz"}

    power = 0
    last_index = -1
    for i, t_c in enumerate(t):
        if s_length[t_c] <= s_pointer[t_c]:
            # reset
            s_pointer = {c: 0 for c in "abcdefghijklmnopqrstuvwxyz"}
            power += 1
        elif s_indexes[t_c][s_pointer[t_c]] <= last_index:
            for j in range(s_pointer[t_c], s_length[t_c]):
                if last_index < s_indexes[t_c][j]:
                    s_pointer[t_c] = j
                    break
            else:
                # reset
                s_pointer = {c: 0 for c in "abcdefghijklmnopqrstuvwxyz"}
                power += 1

        last_index = s_indexes[t_c][s_pointer[t_c]]
        s_pointer[t_c] += 1

    print(len(s) * power + last_index + 1)


main()


Measured memory_bytes: 7796
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;

const int INF = 1 << 29;
const int MAX_W = 30;
const int MAX_H = 60;
const int FOOT = 2;
const int MAX_D = 9;

enum { L, R };
struct foot {
	int x, y, cost, type;
	foot ( int ix, int iy, int ic, int it ): x(ix), y(iy), cost(ic), type(it) {}
	bool operator > ( const foot &e ) const { return cost > e.cost; }
};

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

int solve ( int w, int h )
{
	vector<foot> goal;
	VVI fd(h, VI(w));
	priority_queue<foot, vector<foot>, greater<foot> > que;
	VVVI d(FOOT, VVI(h, VI(w, INF)));
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			char c; cin >> c;
			if (c == 'X') {
				fd[i][j] = INF;
				d[L][i][j] = d[R][i][j] = -1;
			}
			else if (c == 'T') {
				fd[i][j] = 0;
				goal.push_back(foot(j, i, 0, 0));
			}
			else if (c == 'S') {
				fd[i][j] =   0;
				que.push(foot(j, i, 0, L));
				que.push(foot(j, i, 0, R));
				d[L][i][j] = d[R][i][j] = 0;
			}
			else {
				fd[i][j] = c - '0';
			}
		}
	}
	while (!que.empty()) {
		foot f = que.top(); que.pop();
		if (d[f.type][f.y][f.x] < f.cost) { continue; }
		int k = (f.type == R ? -1 : 1);
		for (int i = 0; i < MAX_D; ++i) {
			int mx = f.x + k * dx[i];
			int my = f.y +     dy[i];
			if (mx < 0 || w <= mx || my < 0 || h <= my) { continue; }
			int tofoot = (f.type + 1) % FOOT;
			if (d[tofoot][my][mx] > d[f.type][f.y][f.x] + fd[my][mx]) {
				d[tofoot][my][mx] = d[f.type][f.y][f.x] + fd[my][mx];
				que.push(foot(mx, my, d[tofoot][my][mx], tofoot));
			}
		}
	}
	int res = INF;
	for (int i = 0, I = goal.size(); i < I; ++i) {
		foot f = goal[i];
		res = min(res, min(d[L][f.y][f.x], d[R][f.y][f.x]));
	}
	if (res == INF) { res = -1; }
	return res;
}

int main ( void )
{
	int w, h;
	while (cin >> w >> h, w|h) {
		cout << solve(w, h) << endl;
	}
	return 0;
}

Measured memory_bytes: 1264
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>

using namespace std;

int main(void) {
  long A, B, K;
  cin >> A >> B >> K;
  long a, b;
  a = 0;
  if (A - K > 0) {
    a = A - K;
  }
  b = B;
  if (a == 0) {
    b = 0;
    if (B - (K - A) > 0) {
      b = B - (K - A);
    }
  }
  cout << a << " " << b;
  return 0;
}

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

const int RLEN=1<<18|1;
inline char nc() {
	static char ibuf[RLEN],*ib,*ob;
	(ib==ob) && (ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
	return (ib==ob) ? -1 : *ib++;
}
inline int rd() {
	char ch=nc(); int i=0,f=1;
	while(!isdigit(ch)) {if(ch=='-')f=-1; ch=nc();}
	while(isdigit(ch)) {i=(i<<1)+(i<<3)+ch-'0'; ch=nc();}
	return i*f;
}

const int N=2e5+50;

int n,m,inq[N];
vector <int> edge[N];
deque <int> q;

inline void F(int x) {q.push_front(x); inq[x]=1;}
inline void T(int x) {q.push_back(x); inq[x]=1;}
inline bool CF(int x) {
	for(auto v:edge[x]) if(!inq[v]) {F(v); return true;}
	return false;
}
inline bool CT(int x) {
	for(auto v:edge[x]) if(!inq[v]) {T(v); return true;}
	return false;
}
int main() {
	n=rd(), m=rd();
	for(int i=1;i<=m;i++) {
		int x=rd(), y=rd();
		edge[x].push_back(y);
		edge[y].push_back(x);
	} 
	for(int i=1;i<=n;i++) if(edge[i].size()) {F(i), T(edge[i].front()); break;}
	while(CF(q.front())); while(CT(q.back()));
	printf("%d\n",q.size());
	for(auto v:q) printf("%d ",v);
}

Measured memory_bytes: 9728
#!/usr/bin/env python3
import sys


def solve(N: int, S: "List[str]"):
    ac = 0
    wa = 0
    tle = 0
    re = 0
    for s in S:
        if s == "AC":
            ac += 1
        elif s == "WA":
            wa += 1
        elif s == "TLE":
            tle += 1
        else:
            re += 1
    print("AC x {0}".format(ac))
    print("WA x {0}".format(wa))
    print("TLE x {0}".format(tle))
    print("RE x {0}".format(re))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, S)

if __name__ == '__main__':
    main()

Measured memory_bytes: 75480
import sys
n = int(sys.stdin.readline())
plist = [int(a) for a in sys.stdin.readline().split()]
ans = 0
for i in range(1, n-1):
  tmp_plist = sorted(plist[i-1:i+2])
  if tmp_plist[1] == plist[i]:
    ans += 1
print(ans)

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

using namespace std;

int main(){
	while(true){
		int n;
		cin >> n;
		if(n == 0){ break; }
		int w, h;
		cin >> w >> h;
		vector< vector<int> > field(h + 1, vector<int>(w + 1));
		while(n--){
			int x, y;
			cin >> x >> y;
			++field[y][x];
		}
		for(int i = 1; i <= h; ++i){
			int sum = 0;
			for(int j = 0; j <= w; ++j){
				sum += field[i][j];
				field[i][j] = sum + field[i - 1][j];
			}
		}
		int s, t;
		cin >> s >> t;
		int answer = 0;
		for(int i = 0; i + t <= h; ++i){
			for(int j = 0; j + s <= w; ++j){
				int a = i + t, b = j + s;
				answer = max(
					answer, field[a][b] + field[i][j] - field[a][j] - field[i][b]);
			}
		}
		cout << answer << endl;
	}
	return 0;
}

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

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

int main(){
  int r, c, sy, sx, gy, gx; cin >> r >> c;
  vector<string> field(r);
  for(int i = 0; i < r; i++) cin >> field[i];
  
  sy = 0; sx = 0; gy = r-1; gx = c-1;
  
  int cnt_dot = 0;
  for(int i = 0; i < r; i++){
    for(int j = 0; j < c; j++){
      
      if (field[i][j] == '.') {cnt_dot++;}
      
    }
  }
  
  int ans = 0;

  queue<pair<int, int>> que;
    
  vector<vector<int>> step(r, vector<int> (c, -1));
    
  step[sy][sx] = 0;
  que.push(make_pair(sy, sx));
    
  while(!que.empty()){
    pair<int, int> v = que.front();
    int y = v.first;
    int x = v.second;
    que.pop();
    
    for(int dist = 0; dist < 4; dist++){
      int yn = y + dy[dist];
      int xn = x + dx[dist];
      if(yn < 0 || yn >= r || xn < 0 || xn >= c) continue;
      if(field[yn][xn] == '#') continue;
      if(step[yn][xn] != -1) continue;
      
      step[yn][xn] = step[y][x] + 1;
      
      que.push(make_pair(yn, xn));
    }
  }
  ans = step[gy][gx];
  
  if (ans == -1) cout << -1 << endl;
  else cout << cnt_dot - ans - 1 << endl;

}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int d = ri();
	int res = 0;
	for (int i = 0; i < n; i++) {
		int x = ri();
		int y = ri();
		if ((int64_t) x * x + (int64_t) y * y <= (int64_t) d * d) res++;
	}
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;

vector<bool> sieve(int n) {
    int p = 0;
    vector<bool> is_prime(n + 1, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i < n; i++) {
        if (is_prime[i]) {
            for (int j = i * 2; j < n; j += i) is_prime[j] = false;
        }
    }

    return is_prime;
}

int main()
{
    int X;
    cin >> X;
    vector<bool> is_prime = sieve(1e6);
    int s = X;
    while (1) {
        if (is_prime[s]) {
            cout << s << endl;
            break;
        }
        s++;
    }

    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int a,b,c;
  char t[10];
  a=c=0;
  while(1){
    scanf("%c",&t[a]);
    if(t[a]=='\n')break;
    a++;
  }
  for(int i=0;i<a/2;i++){
    b=a-i-1;
    //cout<<t[i]<<t[b]<<endl;
    if(t[i]=='('&&t[b]=='('){
      c++;
    }else if(t[i]==')'&&t[b]==')'){
      c++;
    }else if(t[i]=='('&&t[b]==')'){
      continue;
    }else if(t[i]==')'&&t[b]=='('){
      continue;
    }else if(t[i]==t[b]){
      continue;
    }else{
      c++;
    }
  }
  if(a%2==1){
    if(t[a/2]=='('||t[a/2]==')')c++;
  }
 
  cout<<c<<endl;
  return 0;
}

Measured memory_bytes: 1156
N,M = map(int,input().split())
A = [input().strip() for _ in range(N)]
B = [input().strip() for _ in range(M)]
for i in range(N-M+1):
    for j in range(N-M+1):
        flag = 0
        for k in range(M):
            for l in range(M):
                if B[k][l] != A[i+k][j+l]:
                    flag=1
                    break
            if flag==1:break
        if flag==0:break
    if flag==0:break
if flag==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
#include <stdio.h>
#include <math.h> 
#include <string.h>
int w[501][501];
int a[501][501];
int s[501];
int main(){
int n,i,j,k,l,m,q;
scanf("%d%d%d",&n,&m,&q);
while(m--){
	scanf("%d%d",&i,&j);
	a[i][j]++;
}
for(i=1;i<=n;i++){
	s[i]=w[i][i]=a[i][i];
 for(j=i+1;j<=n;j++){ 
w[i][j]=w[i][j-1];
for(k=i;k<=j;k++)w[i][j]+=a[k][j];
 
 }
}
while(q--){
scanf("%d%d",&i,&j);
printf("%d\n",w[i][j]);
}
return 0;
}

Measured memory_bytes: 2816
use proconio::input;

fn main() {
    input! {
        a: usize,
        b: usize,
    }

    solve(a, b);
}

fn solve(a: usize, b: usize) {
    for i in 1..4 {
        if i == a || i == b {
            continue;
        } else {
            println!("{}", i);
            return;
        }
    }
}


Measured memory_bytes: 2080
//auto 関数名 = [(&:ラムダ外の引数をとる時))](引数の型1 引数名1, 引数の型2, 引数名2, ...) { 関数の処理 }; //inside main() define function. take care of };
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//   bitset<ビット数> s(tmp);
//   // (ビット列sに対する処理)
// }
// sort(配列変数.begin(), 配列変数.end());
// do {
//   // 順列に対する処理
// } while (next_permutation(配列変数.begin(), 配列変数.end()));
//const double PI = acos(-1); M_PI
// cout << fixed << setprecision(10);
// set<int>st{ 3,1,4,1,5,9,2,6,5,3,5 };
//     for (auto itr = st.begin(); itr != st.end(); ++itr) {
//         cout << *itr;
//     }
#include <bits/stdc++.h>
#include <regex>
using namespace std;
#define _GLIBCXX_DEBUG 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end() //sort(all(vec)); ,reverse(all(vec));etc
int main(){
  int k,n;
  cin>>k>>n;
  vector<int>vec(n);
  int d=0;
  rep(i,n){
    cin>>vec.at(i);
    if(i>=1){
      if(vec.at(i)-vec.at(i-1)>d){
        d=vec.at(i)-vec.at(i-1);
      }
    }
    if(i==n-1){
     if(k-vec.at(i)+vec.at(0)>d){
       d=k-vec.at(i)+vec.at(0);
     }
    }
  }
  cout<<k-d<<endl;
}

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

int main()
{
  int n,m,sum=0;
  cin>>n;
  m=n;
  while(m)
  {
    sum+=m%10;
    m/=10;
  }
  if(n%sum==0)
    cout<<"Yes\n";
  else
    cout<<"No\n";
 return 0; 
}

Measured memory_bytes: 256
A,B,C = map(int, input().split())
result = 0

if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
  result = 0
elif A == B == C:
  result = -1
else:
  while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    result += 1
    a = A/2
    b = B/2
    c = C/2
    A = b + c
    B = a + c
    C = b + a
   
print(result)

Measured memory_bytes: 3064
// Problem : A - ∴ (Therefore)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005


int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        string s;
        cin >> s;
        
        int n=s.back()-'0';
        if(n==3){
        	cout << "bon";
        }
        else if(n==0 || n==1 || n==6 || n==8) cout << "pon";
        else cout << "hon";
        
        
        
        

}

Measured memory_bytes: 3588
// khodaya khodet komak kon
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vpl;

const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll N = 2e5 + 10;
const ll INF = 1e18;
const ll LOG = 20;
ll n, H[N];
ll Max = -INF;
int main(){
	IOS;
	cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> H[i];
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++){
		if (Max <= H[i]) ans ++;
		Max = max(Max, H[i]);
	}
	cout << ans;
	
	
	
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#define int long long
typedef long long ll;
#define sqr(x) ((x)*(x))
#define pb push_back 
const int N=1000002,M=998244353;
int pw(int x,int y){int z=1;for(;y;y>>=1,x=1ll*x*x%M)if(y&1)z=1ll*z*x%M;return z;}
void inc(int &x,int y){x+=y;if(x>=M)x-=M;}void dec(int &x,int y){x-=y;if(x<0)x+=M;}
void Max(int &x,int y){if(y>x)x=y;}void Min(int &x,int y){if(y<x)x=y;}
//struct node{int to,ne;}e[];
//void add(int x,int y){e[++tot]=(node){y,h[x]},h[x]=tot;}
double s;
int n,x,i;
signed main(){
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&x),s+=1.0/x;
	printf("%.6lf",1/s);
}

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

using namespace std;

const int INF = 1<<29;
 
int main()
{
    int n;
    int dp[51];
    int c[6] = {380, 550, 850, 1520, 1870, 2244};
    int d[6] = {2, 3, 5, 10, 12, 15};
 
    fill(dp, dp+51, INF);
    dp[0] = 0;
    for (int i = 0; i < 51; i++) {
	for (int j = 0; j < 6; j++) {
	    if (d[j] <= i) {
		dp[i] = min(dp[i], dp[i-d[j]]+c[j]);
	    }
	}
    }  
    while (cin >> n, n) {
	n /= 100;
	cout << dp[n] << endl;
    }
    return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include <limits>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    uint X, t;
    cin >> X >> t;
    if (t>X){
        cout << 0;
    } else {
        cout<< X-t;
    }
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

using vi = vector<int>;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define show(x) cout << #x << " = " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define YesNo {cout<<"Yes";}else{cout<<"No";}
#define YESNO {cout<<"YES";}else{cout<<"NO";}
#define v(T) vector<T>

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> bool lcmp(const pair<T, T>& l, const pair<T, T>& r) {
  return l.first < r.first;
}
template<class T> istream& operator>>(istream& i, v(T)& v) {
  F0R(j, sz(v)) i >> v[j];
  return i;
}
template<class T> ostream& operator<<(ostream& o, const vector<T>& v) {
  F0R(i, v.size()) {
    o << v[i] << ' ';
  }
  o << newl;
  return o;
}
template<class T1, class T2> ostream& operator<<(ostream& o, const map<T1, T2>& m) {
  for (auto& p : m) {
    o << p.first << ": " << p.second << newl;
  }
  o << newl;
  return o;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;
  if (n == 1) {
    cout << "Hello World";
  }
  else {
    int a, b;
    cin >> a >> b;
    cout << (a + b);
  }
}
#endif


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

int main()
{

    int x,y,i,r,c,k=0;
     string n,m;
    cin>>n>>m;
    x = n.length();
    y = m.length();
    if(x>y)
    {
        cout<<"GREATER"<<endl;
    }
    else if(x<y)
    {
        cout<<"LESS"<<endl;
    }
    else if(x==y)
    {
        for(i=0;i<x;i++)
        {
            if(n[i]!=m[i])
            {
               k++;
               r = n[i];
               c = m[i];
               break;
            }
        }
        if(k==0)
        {
            cout<<"EQUAL"<<endl;
        }
        else if(c>r)
        {
            cout<<"LESS"<<endl;
        }
        else
            cout<<"GREATER"<<endl;

    }


    return 0;
}


Measured memory_bytes: 256