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

const int64_t MOD= 1000000007;
const int Nfac= 100037;
#define MEMORY 0 // 1/0: 階乗を配列に格納をする前処理をする/しない
/* 剰余環 Z/nZ */
struct mint{ // Z/nZ に関する演算(n:素数の場合は除算も)をサポートする構造体
  int64_t rep; // 出力すべき代表元 rep \in {0,1,..,MOD- 1}
  mint(int64_t x=0): rep(((x%MOD)+ MOD)% MOD){}
  mint operator-() const { return mint(-rep);}
  mint& operator+=(const mint& x){
    rep+= x.rep; 
    if(rep>= MOD) rep-= MOD;
    return *this;
  }
  mint& operator-=(const mint& x){
    rep-= x.rep;
    if(rep< 0) rep+= MOD;
    return *this;
  }
  mint& operator*=(const mint& x){
    rep*= x.rep; rep%= MOD;
    return *this;
  }
  mint operator+(const mint x) const {
    mint ans(*this);
    ans+= x;
    return ans;
  }
  mint operator-(const mint x) const {
    mint ans(*this);
    ans-= x;
    return ans;
  }
  mint operator*(const mint x) const {
    mint ans(*this);
    ans*= x;
    return ans;
  }

  mint pow(int64_t d) const{ // d \geq 0
    if(d==0) return 1;
    else{
      mint ans= pow(d>>1);
      ans*= ans;
      if(d&1){ ans*= *this; }

      return ans;
    }
  }

  friend ostream& operator << (ostream &os, const mint& x) noexcept{
      return os << x.rep;
  }
  // MOD が素数(<=> Z/nZ が体)のとき
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint& x){
    *this *= x.inv();
    return *this;
  }
  mint operator/(const mint x) const {
    mint ans(*this);
    ans/= x;
    return ans;
  }
};

/* 階乗,二項係数 */
#if (MEMORY==1)
// 前処理として,階乗を配列に格納をするver.
vector<mint> mfac(Nfac+1), ifac(Nfac+1);
void fact_modp_init(int N= Nfac){
  mfac.at(0)= 1;
  mint buf;
  for(int i=1; i<=N; i++){
    buf= i;
    mfac.at(i)= mfac.at(i-1)* buf;
  }

  ifac.at(N)= mfac.at(N).inv();
  for(int i=N; i>0; i--){
    buf= i;
    ifac.at(i-1)= ifac.at(i)* buf;
  }
}
#else
// 前処理を回避するver.
void fact_modp_init(int N= Nfac){}
mint mfac(int N){
  mint ans= 1;
  mint buf;
  for(int i=1; i<=N; i++){
    buf= i;
    ans*= buf;
  }

  return ans;
}
#endif

mint binom_modp(int n, int k){
  if(n < 0 || min(k,n-k) < 0) return 0;
  else{
#if (MEMORY==1)
    return mfac.at(n)* ifac.at(k)* ifac.at(n-k);
#else
    return mfac(n)* mfac(k).inv()* mfac(n-k).inv();
#endif
  }
}
// ^^^ テンプレここまで ^^^

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

  unordered_map<int, int> factors;
  int div= 2;
  while(M > 1){
    int cnt= 0;
    while(M%div==0){
      cnt++;
      M/= div;
    }
    if(cnt > 0){
      factors[div]= cnt;
    }
    div++;
  }

  fact_modp_init(Nfac);
  mint ans= 1;
  for(auto &e:factors){
    int p,d;
    tie(p,d)= e;
    ans*= binom_modp(N+d-1, d);
  }

  cout << ans << endl;
}

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

#define ll long long
const int N = 2e5 + 5;

int A[N];
ll prefix[N];

int main(){
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%d", &A[i]);
		prefix[i] = prefix[i - 1] + A[i];
	}
	ll ans = LLONG_MAX;
	for(int i = 1; i < n; i++){
		ans = min(ans, abs(prefix[i] - (prefix[n] - prefix[i])));
	}
	cout<<ans<<endl;
}

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

int main()
{
    int n, A[200];
    cin >> n;
    for(int i=0; i<n; i++)
        cin >> A[i];
    int flag = 1, i = 0, count = 0;
    while(flag)
    {
        flag = 0;
        for(int j=n-1; j>=i+1; j--)
        {
            if(A[j]<A[j-1])
            {
                int temp = A[j];
                A[j] = A[j-1];
                A[j-1] = temp;
                flag = 1;
                count++;
            }
        }
        i++;
    }
    for(int k=0; k<n-1; k++)
       cout << A[k] << " ";
    cout << A[n-1] << endl;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  1000050LL
#define tmod            998244353
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll SUMD(ll n);
ll BS(vector<ll> &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
bool P[N+1];
void Sieve(int n=N);
ll Powb(ll b,ll n);

int main()
{
fast;
ll q=1,t;
//cin >> q;
while(q--)
{
    ll n,m,k,i,j,l,r,c=0,b,a,g,counter=0,u,v,d,e,p,x,y,flag=1;
    //n=m=i=j=l=r=a=t=b=c=u=v=w=p=x=y=0;
   // char c1;
    cin >> n >> m ;
    ll ans = 0;
    map<int,int> M,M2;
    for(i=0;i<m;i++)
    {
        string s;
        cin >> x >> s;
        if(s=="AC")
        {
            if(M[x]==0)
            {
                c++; M[x]=1;
                ans += M2[x];
            }
        }
        else
        {
            if(M[x]==0)
            {
                M2[x]++;
            }
        }

    }
     cout << c << " " << ans;


}
    return 0;
}

//*****************************************************************************************************************************************

ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;

}
ll BS(vector<ll> &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid]==ser)
    {
        return mid;
    }
    else if(PS[mid] > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

void Sieve(int n)
{
    memset(P,true,sizeof(P));
    P[0] = false;
    P[1]= false;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                P[j]=false;
            }
        }
    }

}



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



int main() {
    
    int n,t;
    cin>>n>>t;
    vi v(n);
    rep(i,n)cin>>v[i];
    int l=0,r=0;
    int ans=0;
    rep(i,n){
        l=v[i];
        r=v[i]+t;
        int j=i;
        while(j+1<n&&v[j+1]<=r){
            r=v[j+1]+t;
            j++;
        }
        i=j;
        ans+=r-l;
    }
    fin(ans);
}


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

int main(){
  
  int n,m,x;
  
  cin >> n >> m >> x;
  
  map<int,int> a;
  
  for(int i =0; i<m; i++){
    int input;
    cin >> input;
    a[input] = 1;
  }
  
  int lans,rans;
  
  lans = rans = 0;
  
  for(int i =0; i<x; i++){
    lans += a[i];
  }
  
  for(int i =x; i<=n; i++){
    rans += a[i];
  }
  
  cout << min(lans,rans) << endl;
  return 0;
  
}


Measured memory_bytes: 256
#include <cstdio>

int main()
{
  int x, y, res;
  scanf("%d%d", &x, &y);
  if(x > y){
    res = x;
    x--;
  }
  else{
    res = y;
    y--;
  }
  if(x > y){
  	res += x;
  }
  else
    res += y;
  printf("%d\n", res);
  
  
  return 0;
}

Measured memory_bytes: 128
k = 72
kk = k // 4
K = 1<<k
nu = lambda L: int("".join([hex(K+a)[3:] for a in L[::-1]]), 16)
st = lambda n: hex(n)[2:]
li = lambda s, l, r: [int(a, 16) % P if len(a) else 0 for a in [s[-(i+1)*kk:-i*kk] for i in range(l, r)]]

def grow(d, v, h):
    h += [0] * d
    f = [(-1 if (i+d) % 2 else 1) * fainv[i] * fainv[d-i] % P * h[i] % P for i in range(d+1)]
    nuf = nu(f)
    a = d * inv[v] % P
    t = [1] * (3*d+3)
    for i in range(1, 3*d+3): t[i] = t[i-1] * (a - d + i - 1) % P
    ti = [1] * (3*d+3)
    ti[-1] = pow(t[-1], P-2, P)
    for i in range(1, 3*d+3)[::-1]: ti[i-1] = ti[i] * (a - d + i - 1) % P
    iv = [1] * (3*d+3)
    for i in range(1, 3*d+3):
        iv[i] = ti[i] * t[i-1] % P

    ###
    g = [inv[i] for i in range(1, 2*d+2)]
    fg = li(st(nuf * nu(g)), d, d * 2 + 1)
    for i in range(d):
        h[i+d+1] = fg[i] * fa[d+i+1] % P * fainv[i] % P

    ###
    g = [iv[i] for i in range(1, 2*d+2)]
    fg = li(st(nuf * nu(g)), d, d * 2 + 1)
    for i in range(d+1):
        h[i] = h[i] * (fg[i] * t[d+i+1] % P * ti[i] % P) % P

    ###
    g = [iv[i] for i in range(d+2, 3*d+3)]
    fg = li(st(nuf * nu(g)), d, d * 2 + 1)
    for i in range(d):
        h[i+d+1] = h[i+d+1] * (fg[i] * t[2*d+i+2] % P * ti[d+i+1] % P) % P

    return h

# Create a table of the factorial of the first v+2 multiples of v, i.e., [0!, v!, 2v!, ..., (v(v+1))!]
def create_table(v):
    s = 1
    X = [1, v+1]
    while s < v:
        X = grow(s, v, X)
        s *= 2

    table = [1]
    for x in X:
        table.append(table[-1] * x % P)
    return table

def fact(i, table):
    a = table[i//v]
    for j in range(i//v*v+1, i+1):
        a = a * j % P
    return a

N, A, B = map(int, input().split())
P = 10**9+7

v = 1 << (N.bit_length() + 1) // 2
fa = [1] * (2*v+2)
fainv = [1] * (2*v+2)
for i in range(2*v+1):
    fa[i+1] = fa[i] * (i+1) % P
fainv[-1] = pow(fa[-1], P-2, P)
for i in range(2*v+1)[::-1]:
    fainv[i] = fainv[i+1] * (i+1) % P
inv = [0] * (2*v+2)
for i in range(1, 2*v+2):
    inv[i] = fainv[i] * fa[i-1] % P

T = create_table(v)
C = lambda n, k: fact(n, T) * pow(fact(k, T) * fact(n-k, T), P-2, P) % P
 
print((pow(2, N, P) - 1 - C(N, A) - C(N, B)) % P)

Measured memory_bytes: 31140
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N,M = inputIL()

roads = defaultdict(int)
for i in range(M):
  a,b = inputIL()
  roads[a] += 1
  roads[b] += 1

for i in range(1,N+1):
  print(roads[i])

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define all(x) (x).begin() , (x).end()
#define in insert
#define REP(i,n) for (int i = 1; i <= n; i++)
#define matrix vector<vector<ll> > 
using namespace std;
 
const ll N = 1e5+2;
const ll MOD = 1e9+7;
const ll INF = 1e16;
const ll LOG = 25;

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
vll adj[N];
vector<pll> cc[N];
ll num=0;
bool vis[N];
ll id[N];
void dfs(ll cur){
	vis[cur]=true;
	cc[num].pb(mp(cur,id[cur]));
	for(auto v:adj[cur]){
		if(!vis[v]){
			dfs(v);
		}
	}
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	

	ll n,m;
	cin>>n>>m;
	ll p[n+1];
	for(int i =1;i<=n;i++)cin>>p[i],id[p[i]]=i;
	for(int i =1;i<=m;i++){
		ll u,v;
		cin >>u>>v;u=p[u];v=p[v];
		adj[u].pb(v);
		adj[v].pb(u);
	}


	for(int i = 1;i<=n;i++){
		if(!vis[i]){
			num++;
			dfs(i);
		}
	}
	ll ans = 0;
	for(int i =1;i<=num;i++){
		
		vector<bool> mark(n+1,false);
		for(int j = 0;j<cc[i].size();j++){
			mark[cc[i][j].s] = true;	
		}
		for(auto j:cc[i]){
			if(mark[j.f]){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 14448
// Problem: A - Takoyaki
// Contest: AtCoder - AtCoder Beginner Contest 176
// URL: https://atcoder.jp/contests/abc176/tasks/abc176_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
 
using namespace std;
#define int long long
#define ll long long
const int N = 2e5+5;
const int mod = 1e9;
#define ld long double
#define PI 3.14159265358979323846
const int INF = 10000000;
 
void flash()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(9);
}
 
//3. Structure or classes
//3. Ends here
 
//1. Data structures declaration here
//1. Ends here
 
//2. Extra Functions here
//2. Ends here
 
 
void solve();
int32_t main()
{
    flash();
    int t;
    t = 1;
    //cin>>t;
    while(t--){
        solve();
        //cout<<"\n";
    }
    return 0;
}
 
 
 
void solve()
{
	int n,x,t;
	cin>>n>>x>>t;
	
	int a = (n/x)+((n%x)>=1);
	
	int ans = a*t;
	
	cout<<ans<<"\n";
    return;
}
// how r u bro

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using i64 = long long;

constexpr i64 inf = 10000000000000;

i64 dp[5010][5010][2];
std::vector<i64> a;
std::vector<std::deque<int>> g;

int dfs(int v, int p) {
    if (a[v] > 0) dp[v][0][0] = a[v];
    else dp[v][0][1] = a[v];

    int ret = 1;

    for (auto c : g[v]) {
        if (c == p) continue;
        int ss = dfs(c, v);

        std::vector<std::vector<i64>> tmp(ret + ss, std::vector<i64>(2, inf));

        for (int i = 0; i < ret; i++) {
            for (int j = 0; j < ss; j++) {
                tmp[i + j][0] = std::min(tmp[i + j][0], dp[v][i][0] + dp[c][j][0]);
                tmp[i + j][1] = std::min({ tmp[i + j][1], dp[v][i][0] + dp[c][j][1], dp[v][i][1] + dp[c][j][0], dp[v][i][1] + dp[c][j][1] });

                if (dp[c][j][0] >= inf && dp[c][j][1] >= 0) continue;

                tmp[i + j + 1][0] = std::min(tmp[i + j + 1][0], dp[v][i][0]);
                tmp[i + j + 1][1] = std::min(tmp[i + j + 1][1], dp[v][i][1]);
            }
        }

        ret += ss;

        for (int i = 0; i < ret; i++) {
            dp[v][i][0] = tmp[i][0];
            dp[v][i][1] = tmp[i][1];
            tmp[i][0] = inf;
            tmp[i][1] = inf;
        }
    }

    // for (int i = 0; i < ret; i++) {
    //     printf("dp[%d][%d] = { %lld, %lld }\n", v + 1, i, dp[v][i][0], dp[v][i][1]);
    // }

    return ret;
}

int main() {
    int n;
    std::cin >> n;
    a.resize(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    g.resize(n);
    for (int i = 0; i < n - 1; i++) {
        int u, v;
        std::cin >> u >> v;
        u--; v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
        dp[i][j][0] = inf;
        dp[i][j][1] = inf;
    }

    dfs(0, -1);

    int ret = 0;
    while (dp[0][ret][0] >= inf && dp[0][ret][1] >= 0) ret++;
    std::cout << ret << std::endl;

    return 0;
}

Measured memory_bytes: 396200
n = int(input())

def checkIfDuplicates(listOfElems):
    if len(listOfElems) == len(set(listOfElems)):
        return False
    else:
        return True

listOfElems = list(map(int, input().split()))
result = checkIfDuplicates(listOfElems)
if result:
    print('NO')
else:
    print('YES')

Measured memory_bytes: 26808
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<ll> numbers(n);
    for (int i = 0;i < n;i++) {
        cin >> numbers[i];
    }
    sort(numbers.begin(),numbers.end(),greater<ll>());
    unordered_map<ll,ll> freq;
    for (int i = 0;i < n;i++) {
        freq[numbers[i]]++;
    }
    ll area = 0;
    ll firstnum = -1,secondnum = -1;
    for (int i = 0;i < n;i++) {
        if (freq[numbers[i]] >= 4) {
            if (firstnum == -1) {
                area = numbers[i] * numbers[i];
            } else {
                area = firstnum * numbers[i];
            }
            break;
        } else if (freq[numbers[i]] >= 2) {
            if (firstnum == -1) {
                firstnum = numbers[i];
                freq[numbers[i]] -= 2;
            } else {
                secondnum = numbers[i];
                freq[numbers[i]] -= 2;
            }
        }
        if (firstnum != -1 && secondnum != -1) {
            area = firstnum * secondnum;
            break;
        }
    }
    cout << area << "\n";
}


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

int gcd(int m, int n) {
    int a, b, c;
    a = max(m, n);
    b = min(m, n);
    c = a%b;
    while (c > 1) {
        a = b;
        b = c;
        c = a%b;
    }
    if (c == 1) return 1;
    else return b;
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (c % gcd(a, b) == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 3608
import org.jetbrains.annotations.Mutable
import java.io.*
import java.util.InputMismatchException
import java.io.IOException
import javax.swing.text.MutableAttributeSet
import kotlin.system.measureTimeMillis
var out = PrintWriter(System.out)
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/


fun solve() {
    var R = ni()
    var G = ni()
    var B = ni()

    var x = R * 100 + G * 10 + B
    out.println(if(x % 4 == 0) "YES" else "NO")
}









//---------------------------------------------------------------------------------------------------
fun main(args: Array<String>) {
    var time = measureTimeMillis {
        solve()
        out.flush()
    }
    //println("$time ms")
}
//---------------------------------------------------------------------------------------------------
private var inbuf = ByteArray(1024)
private var lenbuf = 0
var ptrbuf = 0

var `is` = System.`in`

fun readByte(): Byte {
    if (lenbuf === -1) throw InputMismatchException()
    if (ptrbuf >= lenbuf) {
        ptrbuf = 0
        try {
            lenbuf = `is`.read(inbuf)
        } catch (e: IOException) {
            throw InputMismatchException()
        }

        if (lenbuf <= 0) return -1
    }
    return inbuf[ptrbuf++]
}


private fun isSpaceChar(c: Byte): Boolean {
    return !(c >= 33 && c <= 126)
}

private fun skip(): Byte {
    var b: Byte
    while (true) {
        b = readByte()
        if(b < 0 && isSpaceChar(b)) break
    }
    return b
}

private fun ns(): String {
    var b = skip()
    val sb = StringBuilder()
    while (!isSpaceChar(b)) {
        sb.appendCodePoint(b.toInt())
        b = readByte()
    }
    return sb.toString()
}

fun na(n: Int) = IntArray(n, {ni()})

fun ni(): Int {
    var num = 0
    var b: Byte
    var minus = false
    while (true) {
        b = readByte()
        if(b < 0) break
        if(b >= '0'.toByte() && b <= '9'.toByte() || b == '-'.toByte()) break

        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
    }

    while (true) {
        if (b >= '0'.toByte() && b <= '9'.toByte()) {
            num = num * 10 + (b - '0'.toByte())
        } else {
            return if (minus) -num else num
        }
        b = readByte()
    }
}

Measured memory_bytes: 31012
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;

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

int h, w;

vector<vector<char>> grid;
vector<vector<bool>> chk;

void dfs(int i, int j, long& wcnt, long& bcnt) {
  chk[i][j] = true;
  if (grid[i][j] == '.') {
    wcnt++;
    for (int k = 0; k < 4; k++)
      if (grid[i + dx[k]][j + dy[k]] == '#')
        if (!chk[i + dx[k]][j + dy[k]]) dfs(i + dx[k], j + dy[k], wcnt, bcnt);
  } else if (grid[i][j] == '#') {
    grid[i][j] = '/';
    bcnt++;
    for (int k = 0; k < 4; k++)
      if (grid[i + dx[k]][j + dy[k]] == '.')
        if (!chk[i + dx[k]][j + dy[k]]) dfs(i + dx[k], j + dy[k], wcnt, bcnt);
  }
  return;
}

long count(int i, int j) {
  long wcnt = 0, bcnt = 0;
  dfs(i, j, wcnt, bcnt);
  return wcnt * bcnt;
}

int main() {
  cin >> h >> w;
  grid.resize(h + 2, vector<char>(w + 2, '/'));
  chk.resize(h + 2, vector<bool>(w + 2, false));
  for (int i = 1; i <= h; i++)
    for (int j = 1; j <= w; j++) cin >> grid[i][j];
  long ret = 0;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (grid[i][j] == '#') ret += count(i, j);
    }
  }
  cout << ret;
  return 0;
}

Measured memory_bytes: 12928
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

const int INF = 1e+9;
const int MAX_V = 101;
struct edge{ int to, cost; };
typedef pair<int,int> P;

int n, k;

vector<edge> G[MAX_V];
int d[MAX_V];

void init(){
	for(int i=0 ; i < MAX_V ; i++ ){
		G[i].clear();
	}
}

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

void add_edge(int u, int v, int cost){
	edge e;
	e.cost = cost;
	e.to = v;
	G[u].push_back( e );
	e.to = u;
	G[v].push_back( e );
}

int main(){
	while( cin >> n >> k , n || k ){
		init();
		for(int i=0 ; i < k ; i++ ){
			int a;
			cin >> a;
			if( a == 0 ){
				int s, g;
				cin >> s >> g;
				s--;
				g--;
				dijkstra( s );
				if( d[g] == INF )
					cout << -1 << endl;
				else
					cout << d[g] << endl;
			}else{
				int u, v, cost;
				cin >> u >> v >> cost;
				u--;
				v--;
				add_edge( u , v , cost );
			}
		}
	}
}

Measured memory_bytes: 940
#include <map>
#include <vector>
#include <tuple>
#include <cstdio>
#include <algorithm>
#include <set>
#include <iostream>
using namespace std;
typedef long long ll;

const int maxn = 300005;

tuple<ll, ll> bombs[maxn];
map<ll, ll> cnt;
vector<tuple<ll, ll>  > c;
set<ll> my;

int main() {
  int H, W, M; scanf("%d%d%d", &H,&W,&M);
  ll xx, yy;
  for(int i = 0; i < M; i++) {
    scanf("%lld%lld", &xx, &yy);
    bombs[i] = {xx, yy};
    ll sss = cnt[yy];
    cnt[yy] = sss + 1;
  }
  for(auto [k, v] : cnt) {
    c.push_back({v, k});
  }
  sort(c.begin(), c.end());
  sort(bombs, bombs + M);
  int left = 0, right = 0;
  ll ans = -1;
  ll mcnt = get<0>(c.back());
  for(auto [k, v] : cnt) {
    if(v == mcnt) {
      my.insert(k);
    }
  }
  while(left != M) {
    auto [cur_x, cur_y] = bombs[0];
    auto [x, y] = bombs[right];
    int ccc = 0;
    while(x == get<0>(bombs[left]) && right < M) {
      if(my.find(y) != my.end()) ccc += 1;
      right++;
      if(right < M) {
        std::tie(x, y) = bombs[right];
      }
    }
    if(ccc == my.size()) {
      ans = max(ans, right - left + mcnt - 1);
    } else {
      ans = max(ans, right - left + mcnt);
    }
    left = right;
  }
  printf("%lld\n", ans);
  return 0;
}

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

using namespace std;

int calc_height(int h, int cx, int cy, int x, int y){
    return max(h-abs(x-cx)-abs(y-cy), 0);
}

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

    int n;
    cin >> n;
    vector<int> x(n), y(n), h(n);
    for(int i = 0; i < n; ++i) cin >> x[i] >> y[i] >> h[i];
    int ptr = 0;
    while(h[ptr] == 0) ++ptr;

    for(int cx = ptr; cx <= 100; ++cx){
        for(int cy = ptr; cy <= 100; ++cy){
            int h_cand = h[ptr] + abs(cx-x[ptr]) + abs(cy-y[ptr]);
            
            bool flg = true;
            for(int i = 0; i < n; ++i){
                if(calc_height(h_cand, cx, cy, x[i], y[i]) != h[i]){
                    flg = false;
                    break;
                }
            }


            if(flg){
                cout << cx << " " << cy << " " << h_cand << endl;
                return 0;
            }
        }
    }



}

Measured memory_bytes: 3576
N = int(input())

cnt = 0
cnt2 = 0
for i in range(1, N+1, 2):
    cnt = 0
    for j in range(1, N+1):
        if j > i:
            break
        if i % j == 0:
            cnt += 1

    if cnt == 8:
        cnt2 += 1


print(cnt2)


Measured memory_bytes: 2940
/*
https://atcoder.jp/contests/dp/tasks/dp_m
*/

#include <bits/stdc++.h>
using namespace std;
const int N = 100, K = 1e5+1,mod=1e9+7;
int dp[K][N],pre[K+1][N];
int a[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int n,k;
  cin >> n >> k;
  for(int i=0;i<n;i++) cin >> a[i];
  dp[0][0] = 1;
  for(int c=0;c<n;c++) {
    for(int r=0;r<=k;r++) {
      if (c==0) {
        if (r <= a[c]) dp[r][c] = 1;
        pre[r+1][c] = (pre[r][c] + dp[r][c])%mod;
        continue;
      }
      dp[r][c] = (pre[r+1][c-1] - pre[max(0,r-a[c])][c-1] + mod)%mod;
      // for(int i=r;i>=max(0,r-a[c]);i--) {
      //   dp[r][c] += dp[i][c-1];
      //   dp[r][c] %= mod;
      // }
      pre[r+1][c] = (pre[r][c] + dp[r][c])%mod;
    }
  }
  cout << dp[k][n-1] << '\n';
  return 0;
}

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

int main()
{
    int N;
    cin >> N;
    int a = N % 10;
    int b = ((N-a) % 100) / 10;
    int c = ((N-b*10) % 1000) / 100;
    if (a == 7 | b == 7 | c == 7) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }
}


Measured memory_bytes: 3604
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func stringLineScan() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)
	h, _ := strconv.Atoi(stringLineScan())
	w, _ := strconv.Atoi(stringLineScan())
	a := make([][]int, h)
	for i := 0; i < h; i++ {
		b := make([]int, w)
		for j := 0; j < w; j++ {
			b[j], _ = strconv.Atoi(stringLineScan())
			b[j] %= 2
		}
		a[i] = b
	}
	ans := make([]string, 0)
	i, j := 0, 0
	for {
		i2 := i % 2
		if i2 == 0 && j == w-1 && i == h-1 {
			break
		} else if i2 == 0 && j == w-1 {
			if a[i][j] == 1 {
				a[i][j] = 0
				a[i+1][j] = (a[i+1][j] + 1) % 2
				ans = append(ans, (fmt.Sprint(i+1, j+1, i+2, j+1)))
			}
			i++
		} else if i2 == 0 {
			if a[i][j] == 1 {
				a[i][j] = 0
				a[i][j+1] = (a[i][j+1] + 1) % 2
				ans = append(ans, (fmt.Sprint(i+1, j+1, i+1, j+2)))
			}
			j++
		} else if i2 == 1 && j == 0 && i == h-1 {
			break
		} else if i2 == 1 && j == 0 {
			if a[i][j] == 1 {
				a[i][j] = 0
				a[i+1][j] = (a[i+1][j] + 1) % 2
				ans = append(ans, (fmt.Sprint(i+1, j+1, i+2, j+1)))
			}
			i++
		} else if i2 == 1 {
			if a[i][j] == 1 {
				a[i][j] = 0
				a[i][j-1] = (a[i][j-1] + 1) % 2
				ans = append(ans, (fmt.Sprint(i+1, j+1, i+1, j)))
			}
			j--
		}
	}
	fmt.Println(len(ans))
	for _, s := range ans {
		fmt.Println(s)
	}
}


Measured memory_bytes: 14620
def make_line(line_str):
    x1, y1, x2, y2 = map(int, line_str.split())
    return (x1 + 1j * y1, x2 + 1j * y2)


def cross_point(l1, l2):
    (p1, p2), (p3, p4) = l1, l2
    v34, v12, v23, v31 = p4 - p3, p2 - p1, p3 - p2, p1 - p3
    s1 = v34.real * v31.imag - v34.imag * v31.real
    s2 = v34.real * v23.imag - v34.imag * v23.real
    if s1 + s2 == 0:
        return None
    rt = s1 / (s1 + s2)
    if 0 < rt < 1:
        cp = (p1 + v12 * rt) * 1e10
        return (int(cp.real), int(cp.imag))
    else:
        return None


while True:
    n = int(input())
    if not n: break
    lines = [make_line(input()) for _ in range(n)]

    num_crossed = 0
    for i, line in enumerate(lines):
        crossed = set(cross_point(line, l) for l in lines[:i])
        crossed.discard(None)
        num_crossed += len(crossed)

    print(1 + n + num_crossed)

Measured memory_bytes: 7664
import java.util.*

fun main() {
    val n = readLine()?.toInt() ?: return
    val c = readLine() ?: return
    val w = LinkedList<Int>()
    val r = LinkedList<Int>()
    c.forEachIndexed { i, v ->
        when (v) {
            'W' -> {
                w.add(i)
            }
            'R' -> {
                r.add(i)
            }
        }
    }
    var count = 0
    while (true) {
        if (w.isNotEmpty() && r.isNotEmpty()) {
            val a = w.first
            val b = r.last
            if (a < b) {
                count++
                w.removeFirst()
                r.removeLast()
            } else {
                break
            }
        } else {
            break
        }
    }
    println(count.toString())
}

Measured memory_bytes: 47484
# coding: utf-8
def manhattan(x1, y1, x2, y2):
    return abs(x1-x2) + abs(y1-y2)

N, M = map(int, input().split())
students = [input() for _ in range(N)]
c_points = [input() for _ in range(M)]

for s in students:
    val = 400000001
    ans = 0
    a, b = map(int, s.split())
    for j, c in enumerate(c_points):
        c, d = map(int, c.split())
        m_dis = manhattan(a,b,c,d)
        if m_dis < val:
            val = m_dis
            ans = j+1
    print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    int A,B,K;
    cin >> A >> B >>K;
    if(K>=A){
        K-=A;
      	A=0;
        B-=K;
    }
    else{
        A-=K;
    }
    if(B<0){
        B=0;
    }
    cout << A <<" " << B <<endl;
}

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

using namespace std;

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

    int H[N];
    for(int i=0; i<N; i++){
        cin >> H[i];
    }

    sort(H, H+N);

    long sum = 0;
    for(int i=N-1; i>=0; i--){
        if(K>0){
            K--;
        }else{
            sum += H[i];
        }

    }

    cout << sum;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mii map<int,int>
#define msi map<string,int>
#define pb push_back
#define mp make_pair
#define M 1101
#define MOD 1000000007
#define fi first
#define se second
#define vi vector<int>
#define vl vector<ll>
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define repl(i,l,r) for(long long i=l;i<=r;++i)
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define ins insert
#define inf INT_MAX
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define eps 0.00000001

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll W, H, X, Y;
	cin >> W >> H >> X >> Y;
	int res = 0;

	if (X * 2 == W && 2 * Y == H) {
		res = 1;
	}

	cout << fixed << setprecision(15) << (W*H / 2.0) << " " << res << endl;



    return 0;
    // check for long long or int
}


Measured memory_bytes: 256
<?php

ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING);
ini_set('display_errors', 'Off');

// define('DEBUG', true);
define('DEBUG', false);

$map = array(array());
fscanf(STDIN, "%d %d", $H, $W);
for ($i = 1; $i <= $H; $i++) {
    fscanf(STDIN, "%s", $S);
    $map[$i] = str_split(" " . $S);
}
// var_dump($map);

for ($i = 1; $i <= $H; $i++) {
    for ($j = 1; $j <= $W; $j++) {
        $x = 0;
        if ($map[$i][$j] == ".") {
            if ($map[$i-1][$j-1] == "#") {
                $x++;
            }
            if ($map[$i-1][$j  ] == "#") {
                $x++;
            }
            if ($map[$i-1][$j+1] == "#") {
                $x++;
            }
            if ($map[$i  ][$j-1] == "#") {
                $x++;
            }
            if ($map[$i  ][$j+1] == "#") {
                $x++;
            }
            if ($map[$i+1][$j-1] == "#") {
                $x++;
            }
            if ($map[$i+1][$j  ] == "#") {
                $x++;
            }
            if ($map[$i+1][$j+1] == "#") {
                $x++;
            }
            echo $x;
        } else {
            echo $map[$i][$j];
        }
    }
    echo PHP_EOL;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

vector<string> parse(string s) {
  vector<string> ret;
  string now = "";
  REP(i, s.size()) {
    if (s[i] == '\"') {
      ret.push_back(now);
      now = "";
    } else {
      now += s[i];
    }
  }
  ret.push_back(now);
  return ret;
}

int main(void) {
  string s, t;
  while (cin >> s && s != ".") {
    cin >> t;
    auto s1 = parse(s), s2 = parse(t);
    int64 cnt = 0;
    bool ok = 1;
    if (s1.size() != s2.size()) {
      ok = 0;
    } else {
      REP(i, s1.size()) {
        if (i % 2 == 0) {
          if (s1[i] != s2[i]) ok = 0;
        } else {
          if (s1[i] != s2[i]) cnt++;
        }
      }
    }
    if (!ok || cnt >= 2) {
      cout << "DIFFERENT" << endl;
    } else if (cnt == 1) {
      cout << "CLOSE" << endl;
    } else {
      cout << "IDENTICAL" << endl;
    }
  }
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
using namespace std;

long long int gcd(long long int x,long long int y) {
	if (y > x) {
		int tmp =  x;
		x = y;
		y = tmp;
	}

	long long int r = x % y;
	while (r != 0) {
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}

int main(){
	long long int A, B;
	cin >> A >> B;
	long long int lcm = A * B / gcd(A,B);

	cout << lcm << endl;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
	int[] B=new int[4];
	void aa(){
		Scanner sc=new Scanner(System.in);
		while(true){
			boolean YN=false;
			int A=sc.nextInt();
			B[0]=A/1000;
			B[1]=(A-B[0]*1000)/100;
			B[2]=(A-B[0]*1000-B[1]*100)/10;
			B[3]=A%10;
			if(B[0]==0&&B[1]==0&&B[2]==0&&B[3]==0)break;
			int Ans=0;
			while(true){
				if(B[0]==B[1]&&B[1]==B[2]&&B[2]==B[3]){
					YN=true;
					break;
				}
				if(A==6174)break;
				Ans++;
				A=bb(A);
			}
			if(!YN)System.out.println(Ans);
			else System.out.println("NA");
		}
	}
	int bb(int A){
		B[0]=A/1000;
		B[1]=(A-B[0]*1000)/100;
		B[2]=(A-B[0]*1000-B[1]*100)/10;
		B[3]=A%10;
		int max;
		int min;
		for(int i=0;i<3;i++){
			for(int j=i+1;j<4;j++){
				if(B[i]<B[j]){
					int y=B[i];
					B[i]=B[j];
					B[j]=y;
				}
			}
		}
		max=B[0]*1000+B[1]*100+B[2]*10+B[3];
		min=B[3]*1000+B[2]*100+B[1]*10+B[0];
		return max-min;
	}
	public static void main(String[]arg){
		new Main().aa();
	}
}

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

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

int main() {
    int n;
    cin >> n;
    int cnt = 0;
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        if (a == b) {
            cnt++;
        } else {
            cnt = 0;
        }
        if (cnt >= 3) {
            break;
        }
    }
    if (cnt >= 3) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main()
{
	int n, a[26], s, t, p;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		for(int i = 0; i < n; i++){
			cin >> a[i];
		}
		s = 32;
		p = 0;
		while(s > 0){
			t = (s-1)%5;
			s -= t;
			cout << s << endl;
			
			s -= a[p%n];
			p++;
			if(s < 0){
				s = 0;
			}
			cout << s << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define INF 1234567891
#define MAXS 100007

#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define INP freopen("input.txt", "r", stdin)
#define OUT freopen("out.txt", "w", stdout)

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main(){
  int a, b;
  cin >> a >> b;
  if(a <= 5) cout << 0 <<endl;
  else if(a <=12) cout << b/2 <<endl;
  else cout << b;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();
vector<pair<ll, ll>> prime_fac(ll N) {
	vector<pair<ll, ll>> res;
	for (ll i=2; i*i<= N; i++) {
		if (N%i != 0) continue;
		ll ex = 0;
		while (N%i==0) {
			ex++;
			N /= i;
		}
		res.push_back({i, ex});
	}
	if (N != 1) res.push_back({N, 1});
	return res;
}

int main(int, char**) {
	ll n; cin >> n;
	vector<ll> mem(n+1, 0);
	for (ll i=2; i<=n; i++) {
		const auto &res = prime_fac(i);
		for (auto p : res) {
			mem[p.first] += p.second;
		}
	}
	ll ret = 1;
	for (int i=2; i<=n; i++) {
		ret *= mem[i] + 1;
		ret %= MOD;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
program main
implicit none
character(100) ::S
integer :: count = 0
integer :: n

read *,S
n = len_trim(S)

if(S(1:1)=="k")      count = count + 1
if(S(1:2)=="ke")     count = count + 1
if(S(1:3)=="key")    count = count + 1
if(S(1:4)=="keye")   count = count + 1
if(S(1:5)=="keyen")  count = count + 1
if(S(1:6)=="keyenc") count = count + 1
if(S(1:7)=="keyence")count = count + 1

if(S(n-0:n)==      "e")count = count + 1
if(S(n-1:n)==     "ce")count = count + 1
if(S(n-2:n)==    "nce")count = count + 1
if(S(n-3:n)==   "ence")count = count + 1
if(S(n-4:n)==  "yence")count = count + 1
if(S(n-5:n)== "eyence")count = count + 1
if(S(n-6:n)=="keyence")count = count + 1

if ( count >= 7 ) then
print *, "YES"
else
print *, "NO"
end if

end program main

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f, MOD = 1000000007;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*-----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  long long ans = 0;
  int now; cin >> now;
  if (now != 0) {
    cout << -1 << '\n';
    return 0;
  }
  FOR(i, 1, n) {
    int a; cin >> a;
    if (now == a) {
      ans += now;
    } else if (now < a) {
      if (a != now + 1) {
        cout << -1 << '\n';
        return 0;
      }
    } else {
      ans += now;
    }
    now = a;
  }
  ans += now;
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N,M,count;
        int L;
        int R;
        int A,B;

        count = 0;
        N = sc.nextInt();
        M = sc.nextInt();
        L = sc.nextInt();
        R = sc.nextInt();
        
        for(int i = 0; i < M - 1; i++) {
           A = sc.nextInt();
           B = sc.nextInt();
           if(L < A) {
              L = A;
           }
           if(R > B) {
              R = B;
           }   
        }
        if(R >= L) {
          count = R - L + 1;
        }else { 
          count = 0;
        }
        
      

        System.out.println(count);
    }
}

Measured memory_bytes: 63164
n = gets.to_i
a = gets.split.map &:to_i
dp = Array.new(n+2){ 10**12 }
dp[0] = 0
 
(n-1).times do |i|
  if dp[i+1] > dp[i] + (a[i+1] - a[i]).abs
    dp[i+1] = dp[i] + (a[i+1] - a[i]).abs
  end
  next if i+2 >= n
  if dp[i+2] > dp[i] + (a[i+2] - a[i]).abs
    dp[i+2] = dp[i] + (a[i+2] - a[i]).abs
  end
end
 
puts dp[n-1]

Measured memory_bytes: 8844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin>>n;
    vector<ll >v;
    vector<ll >vp;

    ll i,j,k;
    ll a,b;
    for(i=0; i<n; i++)
    {
        cin>>a;
        v.push_back(a);

    }
    for(i=0; i<n; i++)
    {
        cin>>a;
        vp.push_back(a);

    }
    reverse(vp.begin(),vp.end());
    ll f=0;

    ll l=0,r=n-1;
    for(i=0; i<n; i++)
    {
        if(v[i]==vp[i])
        {
            if(v[l]!=vp[i]&&v[i]!=vp[l])
            {
                //  cout<<l<<"  f "<<i<<endl;

                swap(vp[l],vp[i]);
                  l++;
            }
            else if(v[r]!=vp[i]&&v[i]!=vp[r] )
            {
                  //   cout<<l<<"  s "<<endl;
                f=0;
                swap(vp[r],vp[i]);
                r--;
            }
            else
            {
                f=1;
                break;
            }
        }
    }

    if(f)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<< "Yes"<<endl;
        for(ll i=0; i<n; i++)
        {
            cout<<vp[i]<<" ";
        }
        cout<<endl;
    }
    return 0;
}



Measured memory_bytes: 7936
s=list(input())
a=[0]*(len(s)+1)
if s[0]=='<':
    a[0]=0
    l=0
    while s[l]=='<':
        a[l+1]=a[l]+1
        l+=1
        if l>len(s)-1:
          break
if s[len(s)-1]=='>':
    a[len(s)]=0
    m=len(s)-1
    while s[m]=='>':
        a[m]=a[m+1]+1
        m-=1
        if m<0:
          break
for i in range(len(s)-1):
    if s[i]=='>' and s[i+1]=='<':
        a[i+1]=0
        k=i
        t=i+1
        while s[k]=='>':
            a[k]=a[k+1]+1
            k-=1
            if k<0 or k>len(s)-1:
                break
        while s[t]=='<':
            a[t+1]=a[t]+1
            t+=1
            if t<0 or t>len(s)-1:
                break
for i in range(len(s)-1):
    if s[i]=='<' and s[i+1]=='>':
        a[i+1]=max(a[i],a[i+2])+1
print(sum(a))

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

int main(){
    int N;
    int A, B, C, D[1001];
    scanf("%d", &N);
    scanf("%d%d%d", &A, &B, &C);
    D[0] = 0;
    for(int i = 1; i <= N; i++){
        scanf("%d", D + i);
    }
    sort(D + 1, D + N + 1, greater<int>());
    for(int i = 1; i <= N; i++){
        D[i] += D[i-1];
    }
    double ans = (double)C / A;
    for(int i = 1; i <= N; i++){
        ans = max(ans, (double)(C + D[i]) / (A + i * B));
    }
    printf("%d\n", (int)(floor(ans) + 1e-5));
    return 0;
}

Measured memory_bytes: 1208
#include<cstdio>
#include<vector>
using namespace std;
#define ll long long
inline char tc(void){
	static char fl[10000],*A=fl,*B=fl;
	return A==B&&(B=(A=fl)+fread(fl,1,10000,stdin),A==B)?EOF:*A++;
}
inline int read(void){
	int a=0;static char c;
	while((c=tc())<'0'||c>'9');
	while(c>='0'&&c<='9')a=a*10+c-'0',c=tc();
	return a;
}
int n,m;
vector<int>a[100001];
char b[100001][2];
ll ans,sum[3];
void DFS(int x,int d){
	b[x][d]=1;
	for(int i=0;i<a[x].size();++i)
		if(b[a[x][i]][d^1]==0)
			DFS(a[x][i],d^1);
	return ;
}
int main(void){
	register int i,x,y;
	n=read(),m=read();
	for(i=1;i<=m;++i)
		x=read(),y=read(),a[x].push_back(y),a[y].push_back(x);
	DFS(1,0);
	for(i=2;i<=n;++i){
		if(b[i][0]&&!b[i][1])
			++sum[0];
		if(b[i][1]&&!b[i][0])
			++sum[1];
		if(b[i][1]&&b[i][0])
			++sum[2];
	}
	ans=sum[1]+sum[2];
	ans+=sum[2]*(sum[2]-1)>>1;
	ans+=sum[2]*sum[1];
	ans+=sum[2]*sum[0];
	ans+=sum[0]*sum[1];
	printf("%lld",ans-m);
	return 0;
}

Measured memory_bytes: 7808