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

int main(){
	ll n; cin >> n;
	vl x(n); vl l(n); rep(i,n)cin >> x[i] >> l[i];
	vector<P> d(n); 
	rep(i,n){
		d[i].first = x[i] + l[i];
		d[i].second = x[i] - l[i];
	}
	sort(d.begin(), d.end());
	ll ans = 1; ll t = d[0].first;
	rep(i,n){
		if(d[i].second >= t){
			ans++;
			t = d[i].first;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328
<?php

class Dice
{
	private $labels;
	public function __construct( $labels )
	{
		$this->labels = $labels;
	}
	public function roll( $cmds )
	{
		$len = strlen( $cmds );
		for( $i=0; $i<$len; $i++ ) {
			if( 'E' == $cmds[$i] ) {
				$this->labels = [ $this->labels[3], $this->labels[1], $this->labels[0],
								$this->labels[5], $this->labels[4], $this->labels[2] ];
			} else if( 'S' == $cmds[$i] ) {
				$this->labels = [ $this->labels[4], $this->labels[0], $this->labels[2],
								$this->labels[3], $this->labels[5], $this->labels[1] ];
			} else if( 'W' == $cmds[$i] ) {
				$this->labels = [ $this->labels[2], $this->labels[1], $this->labels[5],
								$this->labels[0], $this->labels[4], $this->labels[3] ];
			} else if( 'N' == $cmds[$i] ) {
				$this->labels = [ $this->labels[1], $this->labels[5], $this->labels[2],
								$this->labels[3], $this->labels[0], $this->labels[4] ];   
			}
		}
	}
	public function getLabel( $face )
	{
		return $this->labels[ $face ];
	}
}

	$labels = explode( " ", trim( fgets( STDIN ) ) );
	$dice = new Dice( $labels );
	$cmds = trim( fgets( STDIN ) );
	
	$dice->roll( $cmds );
	print $dice->getLabel( 0 );
?>

Measured memory_bytes: 15452
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <ctime>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <iomanip>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define SZ(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define pi acos(-1)
#define mod 1000000007
#define inf 1000000007
#define ll long long
#define ull unsigned long long
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
#define N 100010
#define _DEBUG
template <class U,class T> void Max(U &x, T y){if(x<y)x=y;}
template <class U,class T> void Min(U &x, T y){if(x>y)x=y;}
template <class T> void add(int &a,T b){a=(a+b)%mod;}
inline int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}

int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%mod;
        a=1LL*a*a%mod;b>>=1;
    }
    return ans;
}
int pow(int a,int b,int c){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%c;
        a=1LL*a*a%c;b>>=1;
    }
    return ans;
}

int dp[N],a[N];
int main(){
    //srand(time(NULL)+clock());
    int ca=0,T,k,i,j,m=0,K,n;
    double start=clock();
    scanf("%d",&n);
    rep(i,0,n)scanf("%d",&a[i]);
    rep(i,1,n)dp[i]=inf;
    rep(i,1,n){
        Min(dp[i],dp[i-1]+abs(a[i]-a[i-1]));
        if(i>=2)Min(dp[i],dp[i-2]+abs(a[i]-a[i-2]));
    }
    printf("%d\n",dp[n-1]);
    cerr<<(1.*clock()-start)/CLOCKS_PER_SEC<<"\n";
}


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

int sum(int a, int b) {
    return a + b >= MOD ? a + b - MOD : a + b;
}
int sub(int a, int b) {
    return a - b < 0 ? a - b + MOD : a - b;
}
int mul(int a, int b) {
    return (1LL*a*b)%MOD;
}
int pw(int a, int b) {
	if (!b) return 1;
	int r = pw(a, b/2);
	r = mul(r, r);
	if (b%2) r = mul(r, a);
	return r;
}

const int MAXN = 2e5+7;
vector< int >edg[MAXN];
vector< int >neighbors[MAXN];
int sbtr[MAXN];
int n;

void dfs(int u, int p) {
    sbtr[u] = 1;
    for (int v : edg[u]) {
        if (v==p) continue;
        dfs(v, u);
        sbtr[u] += sbtr[v];
        neighbors[u].push_back(sbtr[v]);
    }
    if (sbtr[u] < n) neighbors[u].push_back(n-sbtr[u]);
}

int p2[MAXN], inv2[MAXN];

int main() {
    p2[0] = 1;
    for (int i = 1; i < MAXN; i++) p2[i] = mul(p2[i-1], 2);
    inv2[MAXN-1] = pw(p2[MAXN-1], MOD-2);
    for (int i = MAXN-2; i >= 0; i--) inv2[i] = mul(inv2[i+1], 2);

    cin >> n;

    for (int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        edg[u].push_back(v);
        edg[v].push_back(u);
    }

    dfs(1, 0);

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int tmp = sub(1, inv2[n-1]);
        for (int x : neighbors[i]) {
            tmp = sub(tmp, mul(inv2[n-1-x], sub(1, inv2[x])));
        }
        ans = sum(ans, tmp);
    }

    ans = mul(ans, inv2[1]);

    cout << ans << endl;


    return 0;
}


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

int main(void)
{
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> b(m);
    rep(i, m) cin >> b[i];
    int a[n][m];
    rep(i, n)rep(j, m) cin >> a[i][j];
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        int sum = 0;
        for(int j = 0; j < m; j++)
        {
            sum += b[j]*a[i][j];
        }
        if(sum + c > 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<numeric>
#include<cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long int
#define CON 100010
const long long mod=1e9+7;
const int INF=1001001001;
//const int inf=100000;
//const ll ful=1e18;
using namespace std;
//namespace mp = boost::multiprecision;
int main() 
{
	int n;
	cin>>n;
	ll ans=0;
	for(int i=1;i<n;++i)
	{
		for(int j=1;j*j<=n-i;++j)
		{
			int num=n-i;
			if(num%j==0)
			{
				ans++;
				if(num/j!=j)
				{	
					ans++;
				}
			}

		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void){
  cout << std::fixed << std::setprecision(16);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int n;
  cin>>n;
  cout<<n*n*n<<endl;



  return 0;
}


Measured memory_bytes: 892
import itertools


def main():
    # 入力
    n, m = map(int, input().split())

    ablist = []
    for i in range(m):
        a, b = map(int, input().split())
        ablist.append((a, b))

    list = [x for x in range(2, n+1)]
    permutations_lis = itertools.permutations(list)

    count = 0
    for perlist in permutations_lis:
        # 1は特殊
        i_current = 1
        i_already = {1}

        root = []

        countable = True
        for p in perlist:
            i_target = p

            found = False
            for ab in ablist:
                if ab in root:
                    continue
                if ab[0] == i_current and ab[1] == i_target:
                    root.append(ab)
                    i_current = ab[1]
                    found = True
                    break
                elif ab[1] == i_current and ab[0] == i_target:
                    root.append(ab)
                    i_current = ab[0]
                    found = True
                    break

            if not found:
                countable = False
                break

        if countable:
            count += 1

    print(count)


main()


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

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

	int num = a;
	int check = 0;

	while(num <= b){
		if(num%k == 0){
			check = 1;
			break;
		}
		num++;
	}

	if(check==1){
		cout << "OK" << endl;
	}else{
		cout << "NG" << endl;
	}
	
	return 0;
}

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

ans=0
_dict={}

for i in range(1,10):
    for g in range(1,10):
        _dict[str(i)+str(g)]=0

for i in range(1,min(10,n+1)):
    _dict[str(i)*2]+=1

for g in range(10,n+1):
    if g%10!=0:
        _dict[str(g)[0]+str(g)[-1]]+=1

for i,m in _dict.items():
    ans+=m*_dict[i[::-1]]
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;

static const int INFTY = (1<<21);
enum Color{
    WHITE,
    GRAY,
    BLACK
};
int n;

int M[100][100];
Color color[100];
int d[100];

void dijkstra(){
    for(int i=0; i<n; i++){
        d[i] = INFTY;
        color[i] = WHITE;
    }

    d[0] = 0;
    color[0] = GRAY;
    int minv;
    while(true){
        minv = INFTY;
        int u = -1;
        for(int i=0; i<n; i++){
            if(minv > d[i] && color[i]!=BLACK){
                u = i;
                minv = d[i];
            }
        }
        if(u==-1) break;
        color[u] = BLACK;
        for(int v=0; v<n; v++){
            if(color[v]!=BLACK && M[u][v]!=INFTY){
                if(d[v] > d[u] + M[u][v]){
                    d[v] = d[u] + M[u][v];
                    color[v] = GRAY;
                }
            }
        }
    }
        for(int i=0; i<n; i++){
            printf("%d ", i);
            if(d[i]==INFTY) printf("-1");
            else printf("%d", d[i]);
            printf("\n");
        }
}

int main(){

    scanf("%d", &n);

    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            M[i][j] = INFTY;
        }
    }
    int u, k;
    for(int j=0; j<n; j++){
    cin >> u >> k;
    for(int i=0; i<k; i++){
        int v, c;
        cin >> v >> c;
        M[u][v] = c;
    }
    }

    dijkstra();

    return 0;
}


Measured memory_bytes: 3252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B;
    cin >> A >> B;
    for(int i=1;i<=1000000;i++){
        if(i*8/100==A && i*10/100==B){
            cout << i << "\n";
            return 0;
        }
    }
    cout << -1 << "\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define repf(i, x, n) for (int i = (int)(x); i < (int)(n); i++)
#define repfr(i, x, n) for (int i = (int)(x)-1; i >= (int)(n); i--)
#define INF 1e9
using ll = int64_t;
template <class T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b)
{
  if (b < a)
  {
    a = b;
    return true;
  }
  return false;
}

//10^9 + 7
#define yojo 1000000007

std::int64_t gcd(std::int64_t a, std::int64_t b)
{
  // a >= b && b != 0
  std::int64_t c;
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb)
{
  std::int64_t a = max(aa, bb);
  std::int64_t b = min(aa, bb);
  std::int64_t c;
  if (b == 0)
  {
    return -1;
  }
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}
void rle(std::vector<std::pair<char, std::int64_t>> &data, std::string str)
{
  char now = str[0];
  std::int64_t count = 0;
  for (std::int64_t i = 0; i < str.size() + 1; i++)
  {
    if (i == str.size())
    {
      data.push_back(make_pair(str[i - 1], count));
      break;
    }
    else if (now != str[i])
    {
      data.push_back(make_pair(now, count));
      now = str[i];
      count = 0;
    }
    count++;
  }

  return;
}

#define MAX_NUM 200001

void Main()
{
  ll n, m;
  cin >> n >> m;
  priority_queue<ll> a;
  rep(i, n){
    int tmp;
    cin >> tmp;
    a.push(tmp);
  }

  while (m > 0)
  {
    int max_num = a.top() / 2;
    a.pop();
    a.push(max_num);
    m--;    
  }

  ll sum = 0;
  while (!a.empty())
  {
    sum += a.top();
    a.pop();
  }
  
  std::cout << sum << std::endl;

  return;
}

int main()
{
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 1400
{-# LANGUAGE TypeApplications #-}
module Main where
import qualified Data.ByteString.Char8         as BS
import qualified Data.ByteString.Lazy.Char8    as BSL
import qualified Data.ByteString.Builder       as BSB
import           Data.Char                      ( isSpace )
import           Data.List
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM
-- see: https://hackage.haskell.org/package/containers-0.6.2.1/docs/Data-Map-Strict.html
import           Data.Map.Strict                ( Map )
import qualified Data.Map.Strict               as Map
import           Data.IntMap                    ( IntMap )
import qualified Data.IntMap                   as IntMap

main :: IO ()
main = do
  n  <- readLn @Int
  as <- VU.unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let xs = histV $ VU.zipWith (-) (VU.enumFromN 1 n) as
  let ys = histV $ VU.zipWith (+) (VU.enumFromN 1 n) as
  print $ solve xs ys
 where
  solve xs ys = go 0 0 0   where
    go cnt i j
      | i >= VU.length xs || j >= VU.length xs = cnt
      | fst (xs VU.! i) < fst (ys VU.! j)      = go cnt (i + 1) j
      | fst (xs VU.! i) > fst (ys VU.! j)      = go cnt i (j + 1)
      | otherwise = go (cnt + snd (xs VU.! i) * snd (ys VU.! j)) (i + 1) (j + 1)

-- create histogram from list
hist :: [Int] -> [(Int, Int)]
hist xs = IntMap.toAscList $ IntMap.fromListWith (+) $ zip xs $ repeat 1

histV :: VU.Vector Int -> VU.Vector (Int, Int)
histV = VU.fromList . hist . VU.toList


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

int main(){
  int n;
  int count = 0;
  cin >> n;
  int A[n];
  for(int i=0;i<n;i++){
    cin >> A[i];
  }


  for(int i=0;i<n;i++){
    int flag =1;
    for(int j=sqrt(A[i]);j>1;j--){
      if(A[i]%j == 0){
        flag =0;
      }
    }
    if(flag){
      count++;
    }
  }
  cout << count << endl;
}



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

using namespace std;

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int main() {
  int N;
  cin >> N;
  int D, X;
  cin >> D >> X;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    X += D / A;
    if (D % A > 0)
      X++;
  }
  cout << X << endl;
}


Measured memory_bytes: 256
/*
ID: dorijan1
TASK: tu napisi ime zadatka molim te molim te ali samo ako si na usaco training
LANG: C++11
*/
#include <bits/stdc++.h>
#define x first
#define y second
#define pii pair<int,int>
#define rand rund
#define pb push_back

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
const int MOD=1000000007;
const int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void yes() {cout<<"YES"<<en; exit(0);}
void no() {cout<<"NO"<<en; exit(0);}
inline int rund() {int x576363482791fuweh=rng();return abs(x576363482791fuweh)%RAND_MAX;}
template<class T>
void prVec(vector<T> w)
{
	cout<<w.size()<<endl;
	for (int i=0;i<int(w.size())-1;++i) cout<<w[i]<<' ';
	if (w.size()) cout<<w[w.size()-1]<<endl;
}

ll raand()
{
	ll a=rand();
	a*=RAND_MAX;
	a+=rand();
    return a;
}

ll raaand()
{
	return raand()*(MOD-7)+raand();
}

string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}

string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

ll sti(string a)
{
	ll k=0;
	for (int i=0;i<(int)a.size();++i)
	{
		k*=10;
		k+=a[i]-'0';
	}
	return k;
}

string its(ll k)
{
	if (k==0) return "0";
	string a;
	while (k)
	{
		a.push_back((k%10)+'0');
		k/=10;
	}
	reverse(a.begin(),a.end());
	return a;
}

ll min(ll a,int b)
{
	if (a<b) return a;
	return b;
}

ll min(int a,ll b)
{
	if (a<b) return a;
	return b;
}

ll max(ll a,int b)
{
	if (a>b) return a;
	return b;
}

ll max(int a,ll b)
{
	if (a>b) return a;
	return b;
}

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

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

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

ll mult(ll a,ll b)
{
	return (a*b)%MOD;
}

ll pot(ll n,ll k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

ll divide(ll a,ll b)
{
	return mult(a,pot(b,MOD-2));
}

ll sub(ll a,ll b)
{
	return (a-b+MOD)%MOD;
}

ll add(ll a,ll b)
{
	return (a+b)%MOD;
}

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

ll has(string x)
{
	ll h1=0,h2=0;
	x=to_lower(x);
	for (char a: x)
	{
		h1*=bases[0];
		h1+=a-'a';
		h1%=bases[3];
		h2*=bases[1];
		h2+=a-'a';
		h2%=bases[4];
	}
	return h1*(MOD+13893829)+h2;
}

const int N=300010;
int n,m,k;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	for (int i=0;i<10;++i) bases.push_back(raand()%MOD+13893829);
	cin>>n>>m>>k;
	int re=min(m,k)*2;
	m-=re/2;
	k-=re/2;
	int res=re+min(n,k);
	if (k>n) ++res;
	cout<<res+m;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
#define MM(arr,x) memset(arr,x,sizeof(x))
const int Mod = 1e9 + 7;
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a(n),b(n);
	for(int i=0;i<n;i++)
	{
		int x,y;
		cin>>x>>y;
		a[i]=x+y;
		b[i]=x-y;
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	cout<<max(a.back()-a.front(),b.back()-b.front());
	return 0;
}

Measured memory_bytes: 4804
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;
    for (int x = sx; x < tx; ++x)
    {
        cout << 'R';
    }
    for (int y = sy; y < ty; ++y)
    {
        cout << 'U';
    }
    for (int x = tx; x > sx; --x)
    {
        cout << 'L';
    }
    for (int y = ty; y > sy; --y)
    {
        cout << 'D';
    }
    cout << 'D';
    for (int x = sx; x < tx + 1; ++x)
    {
        cout << 'R';
    }
    for (int y = sy - 1; y < ty; ++y)
    {
        cout << 'U';
    }
    cout << 'L';
    cout << 'U';
    for (int x = tx; x > sx - 1; --x)
    {
        cout << 'L';
    }
    for (int y = ty + 1; y > sy; --y)
    {
        cout << 'D';
    }
    cout << 'R' << endl;
}

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

typedef long long int ll;

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

    ll n,i;
    cin>>n;
    vector<ll> a(n+1),b(n+1);
    for(i=0;i<n+1;++i){
        cin>>a[i];
    }
    for(i=0;i<n;++i)
        cin>>b[i];
    //b.push_back(0);
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());
    ll sum=0;
    for(i=0;i<n;++i){
        if(a[i]>=b[i]+b[i+1]){
            sum+=(b[i]+b[i+1]);
            b[i+1]=0;
        }
        else{
            ll cpy=a[i];
            a[i]=(a[i]-b[i])>0?(a[i]-b[i]):0;
            b[i+1]=b[i+1]-a[i];
            sum+=cpy;
        }
    }
    if(a[n]>=b[n])
        sum+=b[n];
    else{
        sum+=a[n];
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <cstdio>

using namespace std;

const long long INF = 100000000000;
const long long MOD = 1000000007;

long long f(long long N){
  string s = to_string(N);
  long long ret = 0;
  for (int i = 0; i < s.length();i++){
    ret += s[i] - '0';
  }
  return ret;
}

int main()
{
  long long N, A, B;
  cin >> N >> A >> B;
  long long ans = 0;
  for (int i = 1; i <= N; i++)
  {
    if(A<=f(i) && f(i)<=B){
      ans += i;
    }
  }
  cout << ans<< endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;


int s[3];

int main(){
	cin >> s[0] >> s[1] >> s[2];
	
	sort(s, s+3);
	cout << s[2]*10+s[1]+s[0] << endl;
	
	return 0;
}

Measured memory_bytes: 256
s = input()

if s == "hi" or s == "hihi" or s == "hihihi" or s =="hihihihi" or s =="hihihihihi" or s =="hihihihihihihi" or s =="hihihihihihihihi" or s =="hihihihihihihihihi" or s =="hihihihihihihihihihi":
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll t,n,a,b,i,j;
    map<ll,ll>m;
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            m[i*j]=1;
        }
    }
    cin>>n;
    if(m[n]==1)
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
    return 0;
}


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

int d[30];
int now;
int N;


void solve(int n, int m)
{
	if(m == 1){
		for(int i = 0; i < now; i++)
			cout << d[i] << ' ';
		cout << m << endl;
		return;
	}
	// m-n > 1 で再帰が増えていく
	else if(n < m){
		d[now] = n;
		now++;
		solve(n,m-n);
		now--;
	}
	else if(n == m){
		for(int i = 0; i < now; i++)
			cout << d[i] << ' ';
		cout << n << endl;
	}
	if(n > 1){
		solve(n-1,m);
	}
}

int main(void)
{
	while(cin >> N, N){
		fill(d,d+30,0);	
		now = 0;
	
		solve(N,N);
	}
}

Measured memory_bytes: 1160
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main = do
    n<-readLn::IO Int
    xs<-replicateM n $ unfoldr (B.readInt.B.dropWhile(==' '))<$>B.getLine
    print $ f n xs
f n xs = maximum $ foldl' p [0,0,0] xs where
    p [u,v,w] [a,b,c] = [max (v+b) (w+c), max (u+a) (w+c), max (u+a) (v+b)]


Measured memory_bytes: 57852
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>

#define in std::cin
#define out std::cout

int32_t N,MOD;
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> N >> MOD; N -= 2;
	if (N <= 0) { out << 0 << endl; return 0; }
	int64_t RES = 5 * (N / 11);
	N %= 11;
	std::deque<int> list{4,2,0,9,7};
	for (size_t i = 0; i < N; i++)
	{
		if (std::find(list.begin(), list.end(), MOD) != list.end()) {
			++RES;
		}
		for (auto& v : list) { v += 8; if (v >= 11) { v -= 11; } }
	}
	out << RES << endl;

	return 0;
}
#endif


Measured memory_bytes: 888
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxd = 64;
const int mod = 1e9+7;
int a[maxd],b[maxd];
long long dp[maxd][2][2][2][2],n,m;
long long dfs(int p,int l,int r,int f,int t)
{
	//位数，是否填过小于m的值，是否填过大于n的值，是否填过a<b,最高位是否都为1
	if(p < 0) return 1;
	long long &ans = dp[p][l][r][f][t];
	// 记忆化搜索
	if(ans) return ans;
	for(int i=0;i<2;i++)  // y
		for(int j=0;j<2;j++) // x
		{
			int nl = l,nr = r,nf = f,nt = t;
			if(!nt && i && i!=j) continue;
			if((j&i)!=j) continue;
			if(!nl && j < a[p]) continue; // 如果值小于n了
			if(!nr && i > b[p]) continue; // 如果值大于m了
			if(!nf && j > i) continue;

			if(j > a[p]) nl = 1;
			if(i < b[p]) nr = 1;
			if(j) nt = 1;
			if(i > j) nf = 1;
			ans += dfs(p-1,nl,nr,nf,nt);
			ans %= mod;
		}
	return ans;
}
int main()
{
	// freopen("a.in","r",stdin);
	// freopen("k.out","w",stdout);
	scanf("%lld %lld",&n,&m);
	for(int i=0;i<=63;i++) a[i] = (n>>i)&1 , b[i] = (m>>i)&1;
	long long ans = dfs(63,0,0,0,0);
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 128
#include <cstdint>
#include <iostream>

template <std::uint_fast64_t Mod>
class ModInt {
  using u64 = std::uint_fast64_t;

 public:
  u64 val;

  constexpr ModInt(const u64 x = 0) noexcept : val(x % Mod) {}
  constexpr ModInt operator+(const ModInt rhs) const noexcept {
    return ModInt(*this) += rhs;
  }
  constexpr ModInt operator-(const ModInt rhs) const noexcept {
    return ModInt(*this) -= rhs;
  }
  constexpr ModInt operator*(const ModInt rhs) const noexcept {
    return ModInt(*this) *= rhs;
  }
  constexpr ModInt operator/(const ModInt rhs) const noexcept {
    return ModInt(*this) /= rhs;
  }
  constexpr ModInt &operator+=(const ModInt rhs) noexcept {
    val += rhs.val;
    if (val >= Mod) {
      val -= Mod;
    }
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt rhs) noexcept {
    if (val < rhs.val) {
      val += Mod;
    }
    val -= rhs.val;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt rhs) noexcept {
    val = val * rhs.val % Mod;
    return *this;
  }
  constexpr ModInt &operator/=(ModInt rhs) noexcept {
    u64 exp = Mod - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

using namespace std;
using ll = long long;

const ll MOD = 1000000007;

ModInt<MOD> nCk(int n, int k) {
  ModInt<MOD> ret = 1;
  for (auto i = 0; i !=min(n-k,k); ++i) {
    ret *= n-i;
    ret /= i+1;
  }
  return ret;
}

template <typename T = ll>
T power(T x, int n) {
  T ans{1};
  while (n) {
    if (n%2) ans *= x;
    x *= x;
    n >>= 1;
  }
  return ans;
}

void solve(ll n, ll a, ll b) {
  const auto cnt = power<ModInt<MOD>>(2,n) - nCk(n,a)- nCk(n,b) - 1;
  cout << cnt.val << endl;
}

int main() {
  ll n;
  cin >> n;
  ll a;
  cin >> a;
  ll b;
  cin >> b;
  solve(n, a, b);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int a[6] = {100, 101, 102, 103, 104, 105};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int X;
    cin >> X;
    vector<int> A(100010, 0);
    A[0] = 1;
    rep(i, 6) {
        rep(j, 100010) {
            if(A[j] && j + A[i] < 100010) {
                A[j + a[i]] = 1;
            }
        }
    }
    if(A[X]) output(1);
    else output(0);
    
    return 0;
}


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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main(int argc, const char * argv[]) {
  int n;
  cin >> n;
  repd(i,1,10)
  {
      repd(j,1,10)
      {
			if(i*j == n)
            {
              cout << "Yes";
              return 0;
            }
      }
  }
  cout << "No";
  
}

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

using namespace std;

struct union_find {
    vector<int> par;

    union_find(int n) : par(n) {
        for(int i = 0; i < n; ++i) {
            par[i] = i;
        }
    }

    void unite(int a, int b) {
        a = find(a);
        b = find(b);
        if(a > b) {
            swap(a, b);
        }
        par[b] = a;
    }

    int find(int a) {
        if(par[a] == a) {
            return a;
        } else {
            return par[a] = find(par[a]);
        }
    }

    bool same(int a, int b) {
        return find(a) == find(b);
    }

    int size(void) {
        return par.size();
    }
};

int main() {

    int n, m;
    int u, v;

    while(cin >> n >> m, n || m) {

        bool is_touched = false;
        union_find uf(n);
        int cnt[n];

        fill(cnt, cnt + n, 0);

        for(int i = 0; i < m; ++i) {
            cin >> u >> v;
            --u;
            --v;
            is_touched = is_touched || uf.same(u, v);
            uf.unite(u, v);
            ++cnt[u];
            ++cnt[v];
        }

        for(int i = 0; i < n; ++i) {
            is_touched = is_touched || cnt[i] >= 3;
        }

        if(is_touched) {
            cout << "no" << endl;
        } else {
            cout << "yes" << endl;
        }

    }

}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<queue>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

typedef long long ll;
const ll INF = 1e17;
const int BIG = 1000000007;



int main() {

	int N, M;
	cin >> N >> M;

	int a[200000] = {};

	for (int i = 1; i <= M; i++) {
		cin >> a[i];
	}

	int ans[200000];
	ans[0] = 1;
	ans[1] = 1;

	int t = 0; //いまatとat+1の間にいる

	if (a[1] == 1) { ans[1] = 0; t = 1; }

	for (int i = 2; i <= N; i++) {
		ans[i] = (ans[i - 1] + ans[i - 2]) % BIG;

		if (i == a[t + 1]) { ans[i] = 0; t++; }
	}

	cout << ans[N];


	system("PAUSE");
}

Measured memory_bytes: 1656
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];

int main() {
    int a;
    int ans=-10;
    cin>>a;
    string s;
    cin>>s;
    rep(i,a){
        vector<int> vec1(30,0);
        vector<int> vec2(30,0);
        int max=0;
        string div1,div2;
        div1=s.substr(0,i);
        div2=s.substr(i,a-i);
        rep(j,div1.size()){
            vec1.at(div1.at(j)-'a')=1;
        }
        rep(j,div2.size()){
            vec2.at(div2.at(j)-'a')=1;
        }
        rep(j,26){
            if(vec1.at(j)==1&&vec2.at(j)==1){
                max++;
            }
        }
        if(ans<=max){
            ans=max;
        }
    }
    cout<<ans<<endl;



}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> A(N+1);
	map<int, int> Nums;
	long long ans = 0;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = 1; i <= N; i++) Nums[A[i] + i]++;
	for (int i = 1; i <= N; i++) ans += Nums[i - A[i]];
	cout << ans << endl;
}


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

namespace ABC
{
    class ProgramA
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var x = long.Parse(inputs[0]);
            var a = long.Parse(inputs[1]);
            var b = long.Parse(inputs[2]);

            if (a >= b)
            {
                Console.WriteLine("delicious");
            }
            else if (a + x >= b)
            {
                Console.WriteLine("safe");
            }
            else
            {
                Console.WriteLine("dangerous");
            }
        }
    }
}


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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

const int B = 700;

int a[500005];
pair <pair<int, int>, int> p[500005];
int sol[500005];

int cnt[500005];

bool cmp(pair<pair<int, int>, int> p1, pair<pair<int, int>, int> p2) {
	int l1 = p1.x.x;
	int r1 = p1.x.y;
	int i1 = p1.y;
	int l2 = p2.x.x;
	int r2 = p2.x.y;
	int i2 = p2.y;
	int b1 = l1/B;
	int b2 = l2/B;
	if (b1 < b2) return true;
	if (b1 > b2) return false;
	if (r1 < r2) return true;
	return false;
}

int main() {
	int n, q;
	scanf("%d%d", &n, &q);
	for (int i=0 ; i<n ; i++) {
		scanf("%d", a+i);
	}
	for (int i=0 ; i<q ; i++) {
		int l, r;
		scanf("%d%d", &l, &r);
		p[i] = mp(mp(l-1, r-1), i);
	}
	sort(p, p+q, cmp);
	int l = 0;
	int r = 0;
	cnt[a[0]]++;
	int curr = 1;
	for (int i=0 ; i<q ; i++) {
		int nl = p[i].x.x;
		int nr = p[i].x.y;
		int ind = p[i].y;
		while (l<nl) {
			cnt[a[l]]--;
			if (cnt[a[l]] == 0) curr--;
			l++;
		}
		while (l>nl) {
			l--;
			cnt[a[l]]++;
			if (cnt[a[l]] == 1) curr++;
		}
		while (r<nr) {
			r++;
			cnt[a[r]]++;
			if (cnt[a[r]] == 1) curr++;
		}
		while (r>nr) {
			cnt[a[r]]--;
			if (cnt[a[r]] == 0) curr--;
			r--;
		}
	//	cout <<ind<<"   "<<cnt[1]<<"   "<<cnt[2]<<"   "<<cnt[3]<<endl;
		sol[ind] = curr;
	}
	for (int i=0 ; i<q ; i++) {
		printf("%d\n", sol[i]);
	}
	return 0;
}

Measured memory_bytes: 15480
#include <iostream>
#include<string.h>
using namespace std;
int n;
int a[100005][3];
int mem[100005][3];
int fun(int i,int b){
    if(i == n)
        return 0;
    if(mem[i][b] != -1)
        return mem[i][b];
    int ans;
    if(b == 0){
        ans = a[i][b]+max(fun(i+1,1),fun(i+1,2));
    }
    else if(b == 1){
        ans = a[i][b]+max(fun(i+1,0),fun(i+1,2));
    }
    else
        ans = a[i][b]+max(fun(i+1,1),fun(i+1,0));

    return mem[i][b] = ans;
}
int main() {
	cin>>n;
	for(int i=0;i<n;i++)
	    cin>>a[i][0]>>a[i][1]>>a[i][2];
	memset(mem,-1,sizeof(mem));
	cout<<max(max(fun(0,0),fun(0,1)),fun(0,2));
	return 0;
}

Measured memory_bytes: 7296
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s=sc.next(),res="";
    int w=sc.nextInt();
    for(int i=0;i<s.length();i++) {
    	if(i%w==0)res+=s.substring(i, i+1);
    }
    System.out.println(res);
  }
}


Measured memory_bytes: 25300
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <sstream>

using namespace std;
int main() {
	while (true) {
		vector<int>x(3);
		for (int i = 0; i < 3; i++)cin >> x[i];
		if (x[0] == -1 && x[1] == -1 && x[2] == -1)break;
		int sum = x[0] + x[1];
		if (x[0] < 0 || x[1] < 0)cout << "F";
		else if (sum >= 80)cout << "A";
		else if (sum >= 65)cout << "B";
		else if (sum >= 50)cout << "C";
		else if (sum >= 30) {
			if (x[2] >= 50)cout << "C";
			else cout << "D";
		}
		else cout << "F";
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3112
#include<stdio.h>

int main(void)
{

	int a,b;
	
	scanf("%d %d",&a,&b);
	
	if(a*b==15)
	{
		printf("*");
	}
	else if(a+b==15)
	{
		printf("+");
	}
	else
	{
		printf("x");
	}
	
	return 0;

}

Measured memory_bytes: 128
#include <iostream>

using namespace std;
typedef long long ll;

ll calc(ll x) { return x * x * x * x * x; }

int main() {
    ll x;
    cin >> x;
    for (int i = -1000; i <= 1000; i++) {
        for (int j = -1000; j <= 1000; j++) {
            if (calc(i) - calc(j) == x) {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3592
N, MOD = int(input()), 10 ** 9 + 7
memo = [{} for i in range(N + 1)]


def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i - 1], t[i] = t[i], t[i - 1]
        if ''.join(t).count('AGC') >= 1:
            return False
    return True


def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in 'ACGT':
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret


print(dfs(0, 'TTT'))


Measured memory_bytes: 3872
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
x = 0

for i in range(n):
    if d[i][0] == d[i][1]:
        x += 1
    else:
        x = 0
    if x == 3:
        print("Yes")
        exit()
print("No")

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

int main(){
  int n, m;
  cin>>n;
  
  m=n;
  int f=0;
  while(n!=0){
    f+=n%10;
    n/=10;
  }

  if(m%f==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
def cross(c1, c2):
    return c1.real * c2.imag - c1.imag * c2.real

def dot(c1, c2):
    return c1.real * c2.real + c1.imag * c2.imag

def ccw(p0, p1, p2):
    a = p1 - p0
    b = p2 - p0
    cross_ab = cross(a, b)
    if cross_ab > 0:
        return 1
    elif cross_ab < 0:
        return -1
    elif dot(a, b) < 0:
        return 1
    elif abs(a) < abs(b):
        return -1
    else:
        return 0

def intersect(p1, p2, p3, p4):
    # p1 and p2 are end points of a segment.
    # p3 and p4 are end points of the other segment.
    if (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0) and \
       (ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0):
        return True
    else:
        return False

def get_distance_sp(sp1, sp2, p):
    a = sp2 - sp1
    b = p - sp1
    if dot(a, b) < 0:
        return abs(b)
    c = sp1 - sp2
    d = p - sp2
    if dot(c, d) < 0:
        return abs(d)
    return abs(cross(a, b)) / abs(a)

def print_distance(p1, p2, p3, p4):
    # parameters are the same as intersect.
    if intersect(p1, p2, p3, p4):
        print("0.0000000000")
    else:
        d = min(get_distance_sp(p1, p2, p3), get_distance_sp(p1, p2, p4),
                get_distance_sp(p3, p4, p1), get_distance_sp(p3, p4, p2))
        print("{0:.10f}".format(d))


import sys

file_input = sys.stdin

sq = file_input.readline()

for line in file_input:
    x_p0, y_p0, x_p1, y_p1, x_p2, y_p2, x_p3, y_p3 = map(int, line.split())
    p0 = x_p0 + y_p0 * 1j
    p1 = x_p1 + y_p1 * 1j
    p2 = x_p2 + y_p2 * 1j
    p3 = x_p3 + y_p3 * 1j
    print_distance(p0, p1, p2, p3)

Measured memory_bytes: 7940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll n, m;
	cin >> n >> m;
	vll cnt(n, 0);
	for (ll i = 0; i < m; i++) {
		ll a, b;
		cin >> a >> b;
		a--;
		b--;
		cnt[a]++;
		cnt[b]++;
	}
	for (ll i = 0; i < n; i++) {
		if (cnt[i] % 2) {
			NO();
			return 0;
		}
	}
	YES();
}


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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int A, B, C;
  cin >> A >> B >> C;

  cout << std::min(B / A, C) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
typedef long long ll;
int field[3010][3010];
ll dp[4000][4000][4];

int main()
{
   int R, C, K;
   cin >> R >> C >> K;

   for (int i = 0; i < R + 1; i++)
   {
      for (int j = 0; j < C + 1; j++)
      {
         field[i][j] = 0;
      }
   }

   for (int i = 0; i < K; i++)
   {
      int r, c, v;
      cin >> r >> c >> v;
      r--;
      c--;
      field[r][c] = v;
   }
   for (int i = 0; i < R + 1; i++)
   {
      for (int j = 0; j < C + 1; j++)
      {
         for (int k = 0; k < 4; k++)
            dp[i][j][k] = 0;
      }
   }
   ll ans = 0;
   for (int i = 0; i < R; i++)
   {
      for (int j = 0; j < C; j++)
      {
         for (int k = 0; k < 4; k++)
         {
            if (k + 1 < 4)
            {
               dp[i][j + 1][k + 1] = max(dp[i][j + 1][k + 1], dp[i][j][k] + field[i][j]);
               dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][k] + field[i][j]);
            }
            dp[i][j + 1][k] = max(dp[i][j + 1][k], dp[i][j][k]);
            dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][k]);
         }
      }
   }
   for (int i = 0; i <= R; i++)
   {
      for (int j = 0; j <= C; j++)
      {
         for (int k = 0; k < 4; k++)
         {
            //cout << i << " " << j << " " << k << " " << dp[i][j][k] << endl;
            ans = max(ans, dp[i][j][k]);
         }
      }
   }
   cout << ans << endl;
   return 0;
}


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

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

  double ans = 0;

  for (int i = 0; i < N; i++) {
    double x;
    string u;
    cin >> x >> u;
    if (u == "JPY") ans += x;
    else ans += x * 380000.0;
  }

  cout << ans << "\n";
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}
vector<ll> coloring(const vector<vector<ll>>& G) {
    const ll n = G.size();
    vector<ll> color(n, -1);
    queue<ll> Q;
    Q.push(0);
    color[0] = 0;
    while ( !Q.empty() ) {
        ll v = Q.front(); Q.pop();
        each(to, G[v]) {
            if (color[to] < 0) {
                color[to] = 1-color[v];
                Q.push(to);
            }
            else if (color[to] != 1-color[v]) {
                throw -1;
            }
        }
    }
    return color;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, m; cin >> n >> m;
    vector<vector<ll>> G(n);
    rep(i, m) {
        ll a, b; cin >> a >> b; --a, --b;
        G[a].pb(b);
        G[b].pb(a);
    }
    ll ans = 0;
    try { // 二部グラフ
        vector<ll> color = coloring(G);
        vector<ll> cnt(2);
        rep(i, n) cnt[color[i]]++;
        ans = cnt[0] * cnt[1] - m;
    }
    catch (int err) { // 二部グラフでない
        // 完全グラフにできる
        ans = n * (n-1) / 2 - m;
    }
    cout << ans << endl;
}


Measured memory_bytes: 7168
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int  a, b;
    while(cin >> a >> b){
        cout << a + b << endl;
    }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ar array
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);
  int ans = 0;
  ans += a[2]-a[1];
  a[0] += ans;
  a[1] += ans;
  ans += ((a[2]-a[0])/2)+((a[2]-a[0])%2)+((a[2]-a[0])%2);
  cout << ans << '\n';
  return 0;
}


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

const int DAY = 86400;
const int RANGE = 10801;

int N;

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

  int memo[100000];

  int sec = 0;
  for (int j = 0; j < N; ++j) {
    int a, b;
    cin >> a >> b;
    sec = (sec + a) % DAY;
    ++memo[sec];
    sec = (sec + b) % DAY;
  }

  for (int j = 1; j < DAY; ++j) {
    memo[j] += memo[j-1];
  }
  
  int ret = 0;
  for (int j = RANGE; j < DAY; ++j) {
    ret = max(ret, memo[j] - memo[j-RANGE]);
  }
  for (int j = DAY; j < DAY+RANGE; ++j) {
    ret = max(ret, memo[DAY-1]-memo[j-RANGE] + memo[j-DAY]);
  }
  cout << ret << endl;

  return 0;
}

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

using namespace std;

int n, a[100005], st[100], top;
map<int, int> mp;

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) scanf("%d", a + i);
	if (n % 3) {
		for (int i = 1; i <= n; ++i) if (a[i]) {
			puts("No");
			return 0;
		}
		puts("Yes");
		return 0;
	}
	int flag = 1;
	for (int i = 1; i <= n; ++i) if(a[i]) flag = 0;
	if (flag) {
		puts("Yes");
		return 0;
	}
	else {
		sort(a + 1, a + n + 1);
		for (int i = 2; i <= n / 3; ++i)
			if (a[i] != a[i - 1]) { puts("No"); return 0; }
		for (int i = n / 3 + 2; i <= n * 2 / 3; ++i)
			if (a[i] != a[i - 1]) { puts("No"); return 0; }
		for (int i = n * 2 / 3 + 2; i <= n; ++i)
			if (a[i] != a[i - 1]) { puts("No"); return 0; }
		if (a[1] ^ a[n / 3 + 1] ^ a[n * 2 / 3 + 1]) { puts("No"); return 0; }
		puts("Yes");
	}
	return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N (510)
//n<=500

int main(void) {
	int n;
	int x, y;
	bool v;
	int ans = 0;
	char a[N][N];
	f(i, N) {
		f(j, N)a[i][j] = 0;
	}
	scanf("%d", &n);
	f(i, n) {
		scanf("%s", a[i]);
	}
	f(ii, n) {
		v = true;
		f(i, n) {
			f(j, n) {
				x = (i + ii) % n;
				y = (j + ii) % n;
				if (a[x][j] != a[y][i])v = false;
			}
			if (!v)break;
		}
		if (v)ans += n;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 384
public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			String input = sc.nextLine();
			StringBuilder sb = new StringBuilder();

			for (char c : input.toCharArray()) {
				int num = c;
				if (num >= 65 && num <= 90) {
					num += 32;// to Lower
				} else if (num >= 97 && num <= 122) {
					num -= 32;// to Upper
				}
				sb.append((char) num);
			}

			System.out.println(sb);
		}
	}
}


Measured memory_bytes: 26204
#include<iostream>

using namespace std;

int main(){

    int n; cin >> n;
    long int l[n];
    int cnt=0;

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

    if(n < 3){
        cout << '0' << endl;
        return 0;
    }

    for(int i=0; i<n-2; i++){
        for(int j=i+1; j<n-1; j++){
            for(int k=j+1; k<n; k++){
                if(l[i] == l[j] || l[j] == l[k] || l[i] == l[k]){
                    continue;
                }
                else{
                    if(l[i]+l[j] > l[k] && l[j]+l[k] > l[i] && l[k]+l[i] > l[j]){
                        cnt++;
                    }

                }

            }
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3620