akhauriyash/Code-Regression huggingface dataset:
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        N: u64,
        A: u64,
    }
    println!("{}", if N%500<=A{"Yes"}else{"No"});
}

Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cctype>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

int main(int argc, char const *argv[])
{
    int n;
    while(true){
        cin >> n;
        if (n == 0) break;
        int s[n];
        double sum = 0.;
        for(auto &x: s){
            cin >> x;
            sum += x;
        }
        sum /= n;
        double ro = 0;
        for(auto x: s){
            ro += (x - sum) * (x - sum);
        }
        ro /= n;
        ro = sqrt(ro);
        printf("%.5f\n", ro);
    }
    return 0;
}


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

int main(){
	int n;
	scanf("%d", &n);
	set<string> s;
	string str;
	for(int i = 0; i < n; i++) {
		cin >> str;
		s.insert(str);
	}
	printf("%lu\n", s.size());
}


Measured memory_bytes: 19368
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;

int main(){
  ll n,m;cin>>n>>m;
  vb d(10,false);
  rep(i,0,m){
    ll a;cin>>a;
    d[a]=true;
  }
  ll ans;
  rep(i,n,100000){
    string s=to_string(i);
    bool ok=true;
    rep(i,0,s.size()){
      ll t=s[i]-'0';
      if(d[t]){ok=false;}
    }
    if(ok){
      ans=i;break;
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3644
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
p = N%K
if p < K-p:
  print(p)
else:
  print(K-p)

Measured memory_bytes: 5588
#H<=10**12より H<=2**40
H=int(input())
import math
keisuu=[]
i=39

while i>=1:
  if H >= 2**i:
    H -= 2**i
    keisuu.append(1)
  else:
    keisuu.append(0)
  i -=1
  
if H==1:
  keisuu.append(1)
else:
  keisuu.append(0)
  
while keisuu[0]==0:
  keisuu.pop(0)
  
keisuu.reverse()
#print(keisuu)
a=len(keisuu)

if a>=2:
  ans=(2**a)-1
  print(ans)
else:
  print(1)

#ans=0
#print(ans,keisuu)
#while len(keisuu)>1:
#  keisuu[-2] += 2
#  if keisuu[-1]==1:
#    keisuu.pop(-1)
#  else:
#    keisuu[-1] -=1
#  ans+=1
  #print(ans,keisuu)
  
#ans+=keisuu[0]
#print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define fr(i, a, b) for (ll i = a; i <= b; ++ i)
#define rf(i, a, b) for (ll i = a; i >= b; -- i)

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr << "Ready\n";
}

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

int main () {
    to_pray();

    int a, b, c;
    cin >> a >> b >> c;
    
    cout << max(0, c - (a - b));
    cout << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

template <int64_t MOD>
class Modint {
  using Self = Modint<MOD>;

  int64_t m_value;

 public:
  Modint() : m_value(0) {}
  Modint(int64_t value) : m_value((value % MOD + MOD) % MOD) {}
  Self pow(int64_t e) const {
    if (e == 0) {
      return (Self)1;
    } else if (e % 2 == 0) {
      return ((*this) * (*this)).pow(e / 2);
    } else {
      return (*this).pow(e - 1) * (*this);
    }
  }
  Self inv() const { return pow(MOD - 2); }
  Self& operator=(const Self& rh) {
    m_value = rh.m_value;
    return *this;
  }
  Self operator-() const { return Self(-m_value); }
  Self operator+(const Self& other) const {
    return Self(m_value + other.m_value);
  }
  Self operator-(const Self& other) const {
    return Self(m_value - other.m_value);
  }
  Self operator*(const Self& other) const {
    return Self(m_value * other.m_value);
  }
  Self operator/(const Self& other) const { return (*this) * other.inv(); }
  Self& operator+=(const Self& rh) {
    return (*this) = this->value() + rh.value();
  }
  Self& operator-=(const Self& rh) { return (*this) = (*this) - rh; }
  Self& operator*=(const Self& rh) { return (*this) = (*this) * rh; }
  Self& operator/=(const Self& rh) { return (*this) = (*this) / rh; }
  int64_t value() const { return m_value; }
};

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

  vector<int> a(N), b(N);
  rep(i, N) { cin >> a[i] >> b[i]; }

  const int AMAX = 2'000;
  const int M = AMAX * 2 + 1;

  using Mint = Modint<1'000'000'007>;
  vector<vector<Mint>> dp(M, vector<Mint>(M, 0));
  rep(i, N) { dp[AMAX - a[i]][AMAX - b[i]] += 1; }

  rep(i, M) rep(j, M) {
    if (i - 1 >= 0) {
      dp[i][j] += dp[i - 1][j];
    }
    if (j - 1 >= 0) {
      dp[i][j] += dp[i][j - 1];
    }
  }

  Mint result = 0;
  rep(i, N) { result += dp[a[i] + AMAX][b[i] + AMAX]; }

  vector<Mint> fact(AMAX * 4 + 1);
  fact[0] = 1;
  rep(i, AMAX * 4) { fact[i + 1] = fact[i] * (i + 1); }

  rep(i, N) {
    result -= fact[2 * (a[i] + b[i])] / (fact[2 * a[i]] * fact[2 * b[i]]);
  }
  result /= 2;
  cout << result.value() << endl;

  return 0;
}

Measured memory_bytes: 130236
N = int(input())
s = []
t = []
for i in range(N):
    s.append(input())
M = int(input())
for i in range(M):
    t.append(input())

S = set(s)
ans = []
for i in S:
    cnt = 0
    for j in s:
        if i == j:
            cnt += 1
    for h in t:
        if i == h:
            cnt -= 1
    ans.append(cnt)

value = max(ans)

if value < 0:
    print(0)
else:
    print(value)

Measured memory_bytes: 3064
package main

import (
	"fmt"
	"math"
)

func main() {
	var x1, y1, x2, y2 float64

	fmt.Scanf("%f %f %f %f", &x1, &y1, &x2, &y2)
	d := math.Sqrt(math.Pow(x1-x2, 2) + math.Pow(y1-y2, 2))
	fmt.Printf("%.5f\n", d)
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
    using namespace std;
    long long a[1005],b[1005];
    int main()
    {
        long long n;
        scanf("%lld",&n);
        for(long long i=0;i<n;i++)
        {
            scanf("%lld%lld",&a[i],&b[i]);
        }
        for(long long i=1;i<n;i++)
        {
            if(a[i]<a[i-1]||b[i]<b[i-1])
            {
            	long long m1=(a[i-1]+a[i]-1)/a[i];
            	long long m2=(b[i-1]+b[i]-1)/b[i];
            	a[i]=max(m1,m2)*a[i];
            	b[i]=max(m1,m2)*b[i];
    		}
        }
        long long ans=a[n-1]+b[n-1];
        printf("%lld\n",ans);
        return 0;
    }

Measured memory_bytes: 256
//in progress
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fr(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define forn(i,n) for(int i =0; i < (int)(n); i++)
#define rfr(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define PI 3.14159265
ll n,a[100010],store[100010],k;
ll recur(int ind)
{
  if(ind>=n-1)
  return (ll)0;
  for(int i=1;i<=k && i+ind<n;i++)
  {
    if(store[ind+i]==-1)
    store[ind+i]=recur(ind+i);
  }
  ll x=1000000000000000;
  for(int i=1;i<=k && i+ind<n;i++)
    x=min(store[ind+i]+abs(a[ind+i]-a[ind]),x);
  return x;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  //freopen("a.in", "r", stdin);
  //freopen("a.out", "w", stdout);
  cin>>n>>k;
  memset(store,-1,sizeof(store));
  for(int i=0;i<n;i++)
  cin>>a[i];
  cout<<recur(0)<<"\n";
  return 0;
}


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

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

    int a[20];
    int b[20];
    int c[20];
    for (int i = 0; i < n; ++i) 
        cin >> a[i];
    for (int i = 0; i < n; ++i) 
        cin >> b[i];
    for (int i = 0; i < n - 1; ++i) 
        cin >> c[i];

    int score = 0;
    for (int i = 0; i < n - 1; ++i) {
        score += b[a[i] - 1];
        if (a[i + 1] == a[i] + 1) {
            score += c[a[i] - 1];
        }
        // cout << score << endl;
    }
    score += b[a[n - 1] - 1];

    cout << score << endl;
}

#include <string>
void _141() {
    string s;
    cin >> s;
    bool judge = true;
    for (int i = 0; i < s.size(); ++i) {
        if ((i + 1) % 2 == 0 && s[i] == 'R') {
            judge = false;
            break;
        } else if ((i + 1) % 2 == 1 && s[i] == 'L') {
            judge = false;
            break;
        }
    }

    if (judge) 
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void _142() {
    int n, k;
    cin >> n >> k;
    int count = 0;
    int h;
    for (int i = 0; i < n; ++i) {
        cin >> h;
        if (h >= k)
            count++;
    }
    cout << count << endl;
}

int main()
{
    _142();
    return 0;
}



Measured memory_bytes: 256
program prob61
    implicit none
    character(4) :: s
    integer :: c, i
    read(*,*) s
    c = 0

    do i = 1, 4
        if(s(i:i) == '2')then
            c = c + 1
        end if
    end do
    write(*,*) c

    stop
contains
end program prob61

Measured memory_bytes: 2824
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priotity_queue
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ld PI=abs(acos(-1));
int n,a;
deque<int> que;

int main(){
	cin >> n;
	REP(i,0,n){
		cin >> a;
		if(i%2) que.push_front(a);
		else que.push_back(a);
	}
	
	if(n%2) RREP(i,n-1,0) cout << que[i] << " ";
	else REP(i,0,n) cout << que[i] << " ";
	cout << endl;
	return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = (ll)(1000000000000000000);

int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    for(int i=0; i<n; ++i){
        cin >> a[i];
        if(a[i]==0){cout << 0 << endl; return 0;}
    }
    ll res = 1;
    for(ll i=0; i<n; ++i){
        if(a[i]>(ll)(INF/res)){cout << -1 << endl; return 0;}
        else res *= a[i];
    }
    if(res>INF){res = -1;}
    cout << res << endl;
    return 0;
}

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

int main() {
    char b;
    cin >> b;
    if(b=='A') cout << 'T';
    if(b=='G') cout << 'C';
    if(b=='C') cout << 'G';
    if(b=='T') cout << 'A';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
int s[400][400];
int t[2000];
int last[40];
signed main(){
    int d;cin >> d;
    int c[26];
    rep(i,26)cin >> c[i];
    rep(i,d)rep(j,26){
        cin >> s[i][j];
   
    }
    rep(i,d){
        cin >> t[i];
        t[i]--;
    }
    int ret = 0;

    rep(i,d){
        //use t[i];
        ret += s[i][t[i]];
        last[t[i]] = i+1;
        rep(j,26){
            ret -= c[j]*(i+1-last[j]);
        }
        cout << ret << endl;



                
    }
    return 0;
}

Measured memory_bytes: 4772
// C++ includes
#include <bits/stdc++.h>
// 俳句
using namespace std;

// alias templates
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

// alias declaration
using ll = long long;
using str = string;

using vll = V<ll>;
using vvll = V<vll>;
using vs = V<str>;

// loops
#define FOR(i, a, b)  for (ll i = (a); i <= (ll)(b); i++) // [a,b]
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) // [b,a]
#define REP(i, a) FOR((i), 0, (ll)(a)-1) // [0,a-1]

// for debug
#define dbg(a) cerr << "  " << (#a) << ": " << (a) << "\n";

// procon common constants
const ll MOD_BIG = 1e9 + 7;

const ll MOD_VERYBIG = 1e15;
const ll MOD_VERYBIG2 = 1e13;


int main(void){
    ll n,k;
    cin >> n >> k;
    ll a[100]={};
    REP(i,k){
        ll d;
        cin >> d;
        REP(j,d){
            ll aa;
            cin >> aa;
            a[aa-1]++;
        }
    }
    ll ans = 0;
    REP(i,n){
        if(a[i]==0){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
import java.util.*;
 
public class Main {
    public static void main(String args[]) {
       //値の取得
       Scanner sc = new Scanner(System.in);
       long N = sc.nextLong(); //long型で宣言
       double root = Math.sqrt(N);
       long a = 1; //最初の地点
       long b = 1; //最初の地点
       long count = 0; //移動回数
       
      while(a <= root) {
           if(N % a == 0) {
               b = N / a;  
               if(a + b - 2 < count || count == 0) {
                  count = a + b - 2; 
               }
           }
           ++a;
       }
       System.out.println(count);
    }
}
       
       

Measured memory_bytes: 35348
#include <stdio.h>
#define SENTINEL 1000000000;
int A[500000];
int L[500000],R[500000];
int count=0;
void merge(int left,int mid,int right){
  int n1,n2,i,j,k;
  n1=mid-left;
  n2=right-mid;
   
  for(i=0;i<n1;i++)
    {
      L[i]=A[left+i];
    }
  for(i=0;i<n2;i++)
    {
      R[i]=A[mid+i];
    }
  L[n1]=SENTINEL;
  R[n2]=SENTINEL;
  i=0;
  j=0;
  for(k=left;k<right;k++)
    {
      count++;
      if(L[i]<=R[j])
    {
      A[k]=L[i];
      i++;
    }
      else
    {
      A[k]=R[j];
      j++;
    }
    }
}
 
void mergesort(int left,int right){
  int mid;
  if(left+1<right)
    {
      mid=(left+right)/2;
      mergesort(left,mid);
      mergesort(mid,right);
      merge(left,mid,right);
    }
  return 0;
}
 
main(){
  int i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
    }
 
  mergesort(0,n);
 
  for(i=0;i<n;i++)
    {
      printf("%d",A[i]);
      if(i<n-1)
    {
      printf(" ");
    }
    }
  printf("\n");
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 5488
#include <iostream>
#include <atcoder/dsu>

using namespace std;
using namespace atcoder;

int main() {
    int N, Q;
    cin >> N >> Q;
    dsu d(N);
    for (int i = 0; i < Q; i++) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            d.merge(u, v);
        }
        else {
            if (d.same(u, v)) {
                cout << "1\n";
            }
            else {
                cout << "0\n";
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4052
import numpy as np

n=int(input())

Z=np.zeros((n,4))
for i in range(n):
    Z[i][0],Z[i][1]=map(int, input().split())
    Z[i][2]=Z[i][0]+Z[i][1]
    Z[i][3]=Z[i][0]-Z[i][1]
Z2=Z[np.argsort(Z[:,2])]

ans=1
border=Z2[0][2]
for i in range(1,n):
    if Z2[i][3]>=border:
        ans+=1
        border=Z2[i][2]

print(ans)


Measured memory_bytes: 28528
import java.util.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Set;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int sum=0;
        for(int i=0;i<=N;i++){
            sum+=i;
        }
        System.out.println(sum);

        
        
}
        
        
    }


Measured memory_bytes: 21204
#include <iostream>
    using namespace std;
    int main(){
      int a = 0, b = 0, c = 0;
      cin >> a >> b >> c;
      if(a+b==c || a+c==b || b+c==a)
        cout << "Yes" << "\n";
      else
        cout << "No" << "\n";
    }

Measured memory_bytes: 3032
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func main() {
	sc.Split(bufio.ScanWords)
	sc.Scan()

	num, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}

	sc.Scan()
	//numRunes := []rune(sc.Text())
	numRunes := sc.Text()

	rem := 0
	//var pre rune
	var pre byte
	for i := 0; i < num; i++ {
		if numRunes[i] != pre {
			rem++
			pre = numRunes[i]
		}
	}
	fmt.Println(rem)
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int r,g,b,n;
	cin >> r >> g >> b >> n;
	int cnt = 0;
	REP(rr,n+1){
		REP(gg,n+1){
			int bb = (n-rr*r-gg*g)/b;
			if(bb>=0 && rr*r+gg*g+bb*b==n) cnt++;
		}
	}

	cout << cnt << '\n';
	return 0;
}



Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author kessido
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ETree solver = new ETree();
        solver.solve(1, in, out);
        out.close();
    }

    static class ETree {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char[] s = in.next().toCharArray();
            int n = s.length;
            boolean[] comp = new boolean[n];
            for (int i = 0; i < n; i++) {
                comp[i] = (s[i] == '1');
            }
            if (comp[n - 1]) {
                out.println(-1);
                return;
            }
            if (n == 2) {
                if (comp[0]) {
                    out.println("1 2");
                } else {
                    out.println(-1);
                }
                return;
            }
            if (!comp[n - 2] || !comp[0]) {
                out.println(-1);
                return;
            }
            for (int i = 0; i < n - 1; i++) {
                if (comp[i] != comp[n - 2 - i]) {
                    out.println(-1);
                    return;
                }
            }
            int prev = 0;
            out.println("1 2");
            for (int i = 1; i < n - 1; i++) {
                out.print(prev + 2);
                out.print(" ");
                out.println(i + 2);
                if (comp[i]) {
                    prev = i;
                }
            }
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine(), " \t\n\r\f,");
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 37952
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 2e6 + 5;
const int mod = 1e9 + 7;
ll n, s, a[maxn], ss, val, ans;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            a[++s] = i;
            if (i != n / i) a[++s] = n / i;
        }
        if ((n - 1) % i == 0) {
            a[++s] = i;
            if (i != (n - 1) / i) a[++s] = (n - 1) / i;
        }
    }
    sort(a + 1, a + 1 + s);
    int cnt = unique(a + 1, a + 1 + s) - a;
    for (int i = 1; i < cnt; i++) {
        if (a[i] == 1) continue;
        val = n;
        while (val % a[i] == 0) {
            val = val / a[i];
        }
        if (val % a[i] == 1) ss++;
    }
    cout << ss << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
using namespace std;
//using ll = int64_t;
typedef long long ll;

bool check(const int i, const int s[], const int c[],const int n, const int m){
    string num=to_string(i);
    if(num.size()!=n)return false;
    rep(j,0,m){
        if((num[s[j]-1]-'0')!=c[j])return false;
    }
    return true;
}

int main(){
    int n,m;
    cin>>n>>m;
    int s[m],c[m];
    rep(i,0,m){
        cin>>s[i]>>c[i];
    }

    rep(i,0,1000){
        if(check(i,s,c,n,m)){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
#define MAX_NUM 200000
int a[MAX_NUM], b[MAX_NUM];
int N, M;
bool s[MAX_NUM], g[MAX_NUM];
int main() {
	scanf("%d %d", &N, &M);
	for(int i = 0; i < M; i++) {
		scanf("%d %d", a + i, b + i);
		if(a[i] == 1) s[b[i]] = true;
		if(b[i] == N) g[a[i]] = true;
	}
	for(int i = 0; i < N; i++) {
		if(s[i] && g[i]) {
			printf("POSSIBLE\n");
			return 0;
		}
	}
	printf("IMPOSSIBLE\n");
	return 0;
}

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

int main() {
	int a, b;
	while (cin >> a >> b, a, b) {
		int data[1200];

		for (int i = 0;i < b;i++)data[i] = 0;

		for (int i = 0;i < a;i++) {
			for (int j = 0;j < b;j++) {
				int c;
				cin >> c;
				data[j] += c;
			}
		}

		vector<int>ans;

		for (int i = a;i > -1;i--) {
			for (int j = 0;j < b;j++) {
				if (data[j] == i) {
					ans.push_back(j + 1);
				}
			}
		}

		for (int i = 0;i < b;i++) {
			cout << ans[i];
			if (i == b - 1)cout << endl;
			else cout << ' ';
		}

	}
	return 0;
}

Measured memory_bytes: 3000
#include <stdio.h>

int main(){
  int a,b,sum,i,j;
  int count=0;
  while(1){
    count = 1;
    if(scanf("%d%d",&a,&b)==EOF)break;
    sum=a+b;
    while(1){
      if(sum/10==0)break;
      count++;
      sum/=10;
    }
    printf("%d\n",count);
  }
  
  return 0;
}



Measured memory_bytes: 2032
//  __/\\\\____________/\\\\______/\\\\\\\\\______/\\\________/\\\___/\\\\\\\\/\\____/\\\\\\\\\\_|
//   _\/\\\\\\________/\\\\\\____/\\\\\\\\\\\\\___\/\\\________/\\\__\/\\\____\/\\\__\////\\\///__|
//    _\/\\\//\\\____/\\\//\\\___/\\\/////////\\\__\/\\\________/\\\__\/\\\____\/\\\\____\/\\\_____|
//     _\/\\\\///\\\/\\\/_\/\\\__\/\\\_______\/\\\__\/\\\\\\\\\\\\\\\__\/\\\____\/\\\\____\/\\\_____|
//      _\/\\\__\///\\\/___\/\\\__\/\\\\\\\\\\\\\\\__\/\\\/////////\\\__\/\\\____\/\\\\____\/\\\_____|
//       _\/\\\____\///_____\/\\\__\/\\\/////////\\\__\/\\\_______\/\\\__\/\\\____\/\\\_____\/\\\_____|
//        _\/\\\_____________\/\\\__\/\\\_______\/\\\__\/\\\_______\/\\\__\/\\\___/\\\\______\/\\\_____|
//         _\/\\\_____________\/\\\__\/\\\_______\/\\\__\/\\\_______\/\\\__\/\\\\\\/\\_____/\\\\\\\\\\__|
//          _\///______________\///___\///________\///___\///________\///___\/////////_____\//////////___|
#include<bits/stdc++.h>
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef vector< int > vi;
typedef vector< char > vc;
typedef vector< string > vs;
typedef vector< long long > vl;
typedef vector< pair< int , int > > vpi;
typedef pair< int , int > pii;
#define hurry ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define setp setprecision
#define popp pop_back()
#define pb push_back
#define mp make_pair
#define beg begin()
#define en end()
#define sc second
#define sz size()
#define fr first
#define endl '\n'
const int mod=1e9+7;
const long long INF=1e16+10;
const int Nn=1e8;
//=======================================================================================================================
//GLOBAL
//=======================================================================================================================
//FUNCTIONS
//=======================================================================================================================
//STRUCTS
//=======================================================================================================================
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    cout<<c<<' '<<a<<' '<<b;
}
//=======================================================================================================================
//ifstream tin("input.txt");
//ofstream tout("output.txt");


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

int main(){
  int N; cin >> N;
  string S,T;
  cin >> S >> T;
  string k;
  for(int i=0;i<N;i++){
    k+=S[i];
    k+=T[i];
  }
  cout << k << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main (void) {
    string A, B;

    cin >> A >> B;

    if (A.length() > B.length()) {
        cout << "GREATER" << endl;
        return 0;
    }
    else if (A.length() < B.length()) {
        cout << "LESS" << endl;
        return 0;
    }
    else {
        for (int i = 0; i < A.length(); i++) {
            if (A[i] == B[i]) continue;
            else if (A[i] > B[i]) {
                cout << "GREATER" << endl;
                return 0;
            } else {
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 10000000;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem0181 : Persistence **/
int M, N;
int W[100];

bool check(int w)
{
	int cw=0, cm=1;
	rep(i, N) {
		if (W[i]>w) return false;
		
		if (cw+W[i]>w) {
			cm++;
			cw=0;
		}
		cw+=W[i];
	}
		
	return cm<=M;
}

int main()
{
	while (cin>>M>>N, M||N) {
		rep(i, N) {
			cin>>W[i];
		}
		
		int l=0, u=1500000;
		while (u-l>1) {
			int mid = (l+u)/2;
			if (check(mid)) {
				u=mid;
			} else {
				l=mid;
			}
		}
		
		cout << u << endl;
	}
}

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;


vector<int> v[200005];

int main() {
	
	int n;
	cin >> n;
	VI c(n);
	REP(i, n)cin >> c[i];
	VI d;
	REP(i, n - 1) {
		if (c[i] != c[i + 1]) {
			d.push_back(c[i]);
		}
	}
	if (d.size() == 0) {
		d.push_back(c[n - 1]);
	}
	else {
		if (c[n - 1] != d[d.size() - 1]) {
			d.push_back(c[n - 1]);
		}
	}

	int m = d.size();

	VLL dp(m, 1);
	v[d[0]].push_back(0);

	FOR(i, 1, m) {
		ll a = 0;
		if (v[d[i]].size() != 0) {
			a = dp[v[d[i]][v[d[i]].size() - 1]];
		}
		dp[i] = dp[i - 1] + a;
		dp[i] %= mod;
		v[d[i]].push_back(i);
	}

	cout << dp[m - 1] << endl;


}

Measured memory_bytes: 14324
#include <bits/stdc++.h>
#include <random>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using Pt = pair<int, int>;

void ABC173C()
{
	int H, W, K;
	cin >> H >> W >> K;
	vvi grid(H, vi(W));
	for (int i = 0; i < H; ++i)
	{
		string S;
		cin >> S;
		for (int j = 0; j < W; ++j)
		{
			if (S[j] == '.')
				grid[i][j] = 1;
		}
	}
	int ct = 0;
	for (int k = 0; k < (1 << (H + W)); ++k)
	{
		vvi g = grid;
		for (int i = 0; i < H; ++i)
		{
			if ((k >> i) & 1)
			{
				for (int j = 0; j < W; ++j)
				{
					g[i][j] = -1;
				}
			}
		}
		for (int j = 0; j < W; ++j)
		{
			if ((k >> H + j) & 1)
			{
				for (int i = 0; i < H; ++i)
				{
					g[i][j] = -1;
				}
			}
		}
		int c = 0;
		for (int i = 0; i < H; ++i)
			for (int j = 0; j < W; ++j)
				if (g[i][j] == 0)
					++c;
		if (c == K)
			++ct;
	}
	cout << ct << endl;

}
int main()
{
	ABC173C();
	return 0;
}


Measured memory_bytes: 3628
n, m = map(int, input().split())
min_value = min(n, m)
max_value = max(n, m)
ans = 0
if min_value == 1:
    if max_value == 1:
        ans = 1
    elif max_value == 2:
        ans = 0
    else:
        ans = max_value - 2
elif min_value == 2:
    ans = 0
else:
    ans = (min_value-2)*(max_value-2)

print(ans)

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

using namespace std;

int main(){
  string s, ans="yes";
  cin >> s;

  char c = s[0];

  for(int i = 0;i < s.size();i++){
    int t = i;
    for(int j = i+1;j < s.size();j++){
      if(s[i] == s[j]){
	ans = "no";
      }
    }
  } 

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3596
#coding: utf-8
from copy import deepcopy


def main():
    N, M = map(int, input().split())
    p_dict = {}
    for i in range(M):
        p, y = map(int, input().split())
        if p not in p_dict.keys():
            p_dict[p] = [[y, p, i]]
        else:
            #yとp元の順番を入れとく
            p_dict[p].append([y, p, i])
    ans = []
    for p in p_dict.keys():
        p_dict[p].sort()
        for i in range(len(p_dict[p])):
            #昇順で並べたときの順番を入れとく
            p_dict[p][i].append(i+1)
            ans.append(p_dict[p][i])
    #ans = [y, p, input_index, sorted_index]
    ans.sort(key=lambda x: x[2])
    for y, p, oi, si in ans:
        print("{:06d}{:06d}".format(p, si))
if __name__ == "__main__":
    main()

Measured memory_bytes: 48064
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

#define for1(n) for (int i = 0 ; i < n ; i++)
#define for2(n) for (int j = 0 ; j < n ; j++)
#define for3(n) for (int k = 0 ; k < n ; k++)
#define for4(n) for (int l = 0 ; l < n ; l++)
#define forl(n) for (ll i = 0 ; i < n ; i++)

int main() {
    ios::sync_with_stdio(false);
 	int a[3];
 	cin >> a[0] >> a[1] >> a[2];
 	sort(a, a + 3);
 	cout << a[1] - a[0] + a[2] - a[1];
 	
}

Measured memory_bytes: 3628
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class D
{	
	public static void Main()
	{
		int N = Int32.Parse(Console.ReadLine());

		int mod = 1000000007;
		int[,,,] dp = new int[N+1,4,4,4];
		dp[0,3,3,3] = 1;
		for(int i = 0; i < N; i++)
		{
			for(int p3 = 0; p3 < 4; p3++)
			{
				for(int p2 = 0; p2 < 4; p2++)
				{
					for(int p1 = 0; p1 < 4; p1++)
					{
						for(int c = 0; c < 4; c++)
						{							
							if((p2 == 0) && (p1 == 2) && (c == 1))  // AGC
								continue;
							if((p3 == 0) && (p1 == 2) && (c == 1))  // A?GC
								continue;
							if((p2 == 2) && (p1 == 0) && (c == 1))  // GAC
								continue;
							if((p2 == 0) && (p1 == 1) && (c == 2))  // ACG
								continue;
							if((p3 == 0) && (p2 == 2) && (c == 1))  // AG?C
								continue;

							dp[i+1,c,p1,p2] += dp[i,p1,p2,p3];
							dp[i+1,c,p1,p2] %= mod;
						}
					}
				}
			}
		}

		int ans = 0;
		for(int p3 = 0; p3 < 4; p3++)
		{
			for(int p2 = 0; p2 < 4; p2++)
			{
				for(int p1 = 0; p1 < 4; p1++)
				{
					ans += dp[N,p1,p2,p3];
					ans %= mod;
				}
			}
		}

		Console.WriteLine(ans);
	}	
}





Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin>>N;
    int A[N];
    
    for(int S=0; S<N; S++){
        cin>>A[S];
    }
    sort(A,A+N);
    long long ans = fabs(A[N-1]-A[0]);
    cout<<ans<<endl;
    
    
    
    
}

Measured memory_bytes: 256
N, K = map(int, input().split())
x = list(map(int, input().split()))
min_d =  float('inf')

if N == 1:
    min_d = abs(x[0])
else:
    for i ,x_i in enumerate(x[:-(K-1)]):
        d = min(abs(x_i), abs(x[i+(K-1)])) + abs(x_i - x[i+(K-1)])
        if d < min_d:
            min_d = d

print(min_d)

Measured memory_bytes: 14252
#include<iostream>
 
using namespace std;
 
int main(){
  
  int n;
 
  while(cin>>n,n){
    pair<int,bool> treasure[25];
    int bridge[25];
    int total=0;
    bool flag=true;
	
    for(int i=0;i<n;++i){
      cin>>treasure[i].first>>bridge[i];
      treasure[i].second=false;
    }
	
    for(int i=0;i<n;++i){
      int min=1000000;
      int min_in;
      for(int j=0;j<n;++j){
		if(min>bridge[j] && treasure[j].second==false){
		  min=bridge[j];
		  min_in=j;
		}
      }
	  
      total+=treasure[min_in].first;
	  
      if(total>bridge[min_in]){
		flag=false;
		break;
      }
	  
      treasure[min_in].second=true;
    }
    if(flag==true)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  }
}


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

int main() {
    int a[3];
    for(int i=0;i<3;i++){
        cin >> a[i];
    }
    if(a[0]+a[1] == a[2]||a[1]+a[2]==a[0]||a[2]+a[0]==a[1])cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int k,ans;
    cin >> k;
    if(k % 2 == 0){
        ans = (k/2)*(k/2);
    }else if(k % 2 == 1){
        ans = (k/2)*(k-(k/2));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def f(n):
    if n == 1:
        return 14
    return n
a,b = LI()
if f(a) < f(b):
    print("Bob")
elif f(a) == f(b):
    print("Draw")
else:
    print("Alice")
#B

#C
"""
n,m = LI()
v = LIR(m)
p2 = [1]
for i in range(n):
    p2.append(p2[-1]*2)
dp = [[0 for i in range(p2[n])] for j in range(n)]
dp[0][1] = 1
for i in range(1,p2[n]):
    for k in range(n):
        for a,b in v:
            a -= 1
            b -= 1
            if k==a or k == b:
                c = p2[a]
                d = p2[b]
                if i&c and not i&d:
                    dp[b][i|d] += dp[k][i]
                if (not i&c) and i&d:
                    dp[a][i|c] += dp[k][i]
ans = 0
for i in range(1,n):
    ans += dp[i][-1]
print(ans)
"""

#D
"""
n,p,q = LI()
v = [None for j in range(n)]
sa = 0
sb = 0
for i in range(n):
    a,b,c = LI()
    v[i] = [a,b,c]
    sa += a
    sb += b
dp = [[[float("inf") for i in range(sb+1)] for j in range(sa+1)] for k in range(n+1)]
dp[0][0][0] = 0
for i in range(n):
    for a in range(sa):
        for b in range(sb):
            ai,bi,ci = v[i]
            if a + ai <= sa and b + bi <= sb:
                dp[i+1][a+ai][b+bi] = min(dp[i+1][a+ai][b+bi],dp[i][a][b]+ci,dp[i][a+ai][b+bi])
            dp[i+1][a][b] = min(dp[i+1][a][b],dp[i][a][b])
li = [[p,q]]
while li[-1][0] <= sa and li[-1][1] <= sb:
    li.append([li[-1][0]+p,li[-1][1]+q])
li.pop(-1)
ans = float("inf")
for a,b in li:
    ans = min(ans,dp[n][a][b])
if ans == float("inf"):
    print(-1)
else:
    print(ans)
"""
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;

int main(void){
	int ans=0;
	string s;
	cin>>s;
	bool flag=false;
	for(int i=0;i<3;i++){
		if(s[i]==s[i+1])flag=true;
	}
	if(flag)cout<<"Bad"<<endl;
	else cout<<"Good"<<endl;
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d %d", $A, $B, $K);

for ($i=1; $i <= $K; $i++) { 
	if ($i % 2 == 1) {
		if ($A % 2 == 1) {$A--;}
		$B += $A / 2;
		$A /= 2;
	}else{
		if ($B % 2 == 1) {$B--;}
		$A += $B / 2;
		$B /= 2;
	}

}

echo $A." ".$B;


Measured memory_bytes: 4856
#include <iostream>
#include <string>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
ll a,b,c,x;
cin >>a>>b>>c>>x;
ll count=0;
for(ll i=0;i<=a;i++){
for(ll j=0;j<=b;j++){
for(ll k=0;k<=c;k++){
if((500*i+100*j+50*k)==x)
count++;
}
}
}
cout <<count;
return 0;

}

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

using namespace std;

int n, x, minn = 1234567, m; 
int sum = 0;
int Count = 0;

int main() {
	scanf("%d %d", &n, &x);
	Count = n;
	while (n--) {
	 	scanf("%d", &m);
		minn = min(minn, m);
		sum += m;
	}
	printf("%d\n", Count + (x - sum) / minn);
	fprintf(stderr, "Solved time := %d ms\n", clock());
 	return 0;
}

Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]
sys.setrecursionlimit(200000)
N,u,v=map(int,input().split())
s=[[]for i in range(N)]
for i in range(N-1):
    A,B=map(lambda x: int(x)-1,input().split())
    s[A].append(B)
    s[B].append(A)
a=[None]*N
t=[None]*N
t[u-1]=0
a[v-1]=0
def hu(n,c):
    for i in s[n]:
        if a[i]==None:
            a[i]=c
            hu(i,c+1)
hu(v-1,1)
A=0
k=a[u-1]
def hu2(n,c):
    global k
    for i in s[n]:
        if t[i]==None and c<a[i]:
            t[i]=c
            if k<a[i]:
                k=a[i]
            hu2(i,c+1)
hu2(u-1,1)
print(k-1)

Measured memory_bytes: 98348
import sys
input = sys.stdin.readline
dictionary = {"A":"T","T":"A","C":"G","G":"C"}
def print_ans(b):
    """Test Case
    >>> print_ans("A")
    T
    >>> print_ans("G")
    C
    """
    print(dictionary[b])


if __name__ == '__main__':
    b = input().rstrip()
    print_ans(b)




Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ris return *this
template <class c> struct rge {
	c b, e;
};
template <class c> rge<c> range(c i, c j) {
	return rge<c> {i, j};
}
template <class c> auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c> char dud(...);
struct debug {
#ifdef LOCAL
	~debug() {
		cerr << endl;
	}
	template <class c> typename
	enable_if<sizeof dud<c>(0) != 1, debug&>::type operator << (c i) {
		cerr << boolalpha << i;
		ris;
	}
	template <class c> typename
	enable_if<sizeof dud<c>(0) == 1, debug&>::type operator << (c i) {
		ris << range(begin(i), end(i));
	}
	template <class c, class b> debug & operator << (pair <b, c> d) {
		ris << "(" << d.first <<  ", " << d.second << ")";
	}
	template <class c> debug & operator << (rge<c> d) {
		*this << "[";
		for (auto it = d.b; it != d.e; ++it) {
			*this << ", " + 2 * (it == d.b) << *it;
		}
		ris << "]";
	}
#else
	template <class c> debug & operator << (const c&) {
		ris;
	}
#endif
};
#define imie(...) " [" << #__VA_ARGS__" : " << (__VA_ARGS__) << "] "

const ll mod = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n;
	string s;
	cin >> n >> s;
	vector<vector<ll>> dp(n + 1, vector<ll> (n + 1, 0));
	dp[1][1] = 1;
	for (int i = 2; i <= n; i++) {
		vector<ll> pref(i, 0);
		for (int j = 1; j < i; j++) {
			pref[j] = pref[j - 1] + dp[i - 1][j];
			if (pref[j] >= mod) {
				pref[j] -= mod;
			}
		}
		for (int j = 1; j <= i; j++) {
			int l, r;
			if (s[i - 2] == '<') {
				l = 1, r = j - 1;
			} else {
				l = j, r = i - 1;
			}
			if (l <= r) {
				dp[i][j] = pref[r] - pref[l - 1] + mod;
				if (dp[i][j] >= mod) {
					dp[i][j] -= mod;
				}
			}
		}
	}
	ll answer = 0;
	for (int i = 1; i <= n; i++) {
		answer += dp[n][i];
		if (answer >= mod) {
			answer -= mod;
		}
	}
	cout << answer;
	
	return 0;
}


Measured memory_bytes: 74136
#include<bits/stdc++.h>
using namespace std;
string n;
int u[20];
int main()
{
    cin>>n;
    for(int s=2;s<n.size();s++)
    {
        if(n[s]==n[s-1]&&n[s]==n[s-2])
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll a, b;
  cin >> a >> b;
  if ((a + b) % 2 == 0) {
    cout << (a + b) / 2 << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

// index が条件を満たすかどうか

int main() {
	long long int a, b;
	cin >> a >> b;
	long long int k;
	cin >> k;
	if (a + b <= k) {
		cout << 0 << " " << 0;
	}
	else {
		if (k >= a) {
			cout << 0 << " " << b - (k- a );
		}
		else {
			cout << a - k << " " << b;
		}
	}
}

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

 int main() {
   string S, S1, S2, Sr, S1r, S2r;
   cin >> S;
   S1 = S.substr(0, (S.length() - 1)/2);
   S2 = S.substr((S.length() + 1)/2, (S.length() - 1)/2);
   Sr = S;
   S1r = S1;
   S2r = S2;
   reverse(Sr.begin(), Sr.end());
   reverse(S1r.begin(), S1r.end());
   reverse(S2r.begin(), S2r.end());


   if (S == Sr && S1 == S1r && S2 == S2r) cout << "Yes" << endl;
   else cout << "No" << endl;
 }


Measured memory_bytes: 256