akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
using namespace std;
typedef unsigned long long ull;
typedef std::pair<ll, ll>P;

ll min(ll a, ll b) {
	if (a >= b)return b;
	else return a;
}
ll max(ll a, ll b) {
	if (a >= b)return a;
	else return b;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true;
bool fl = true;
bool f = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
std::string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
std::vector<edge>v[100010], W[100010];
typedef std::vector<std::vector<int>>ma;

# define FOR(i,a,b)  for(int i=(a);i<(b);i++)
# define RFOR(i,a,b) for(int i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define NREP(i,n)    FOR(i,1,n+1)

int main() {
	ll n, d[100010];
	cin >> n;
	FOR(i, 1, n + 1)d[i] = INF2;
	REP(i, n-1) {
		ll a, b, c;
		std::cin >> a >> b >> c;
		v[a].push_back(edge{ b,c });
		v[b].push_back(edge{ a,c });
	}
	int q, k;
	cin >> q >> k;
	d[k] = 0;
	priority_queue<P, vector<P>, greater<P>>p;
	p.push(P(d[k], k));
	while (!p.empty()) {
		P a = p.top();
		p.pop();
		ll i = a.second;
		if (d[i] < a.first)continue;
		for (int k = 0;k < v[i].size();k++) {
			edge e = v[i][k];
			if (d[e.to] <= d[i] + e.cost)continue;
			d[e.to] = d[i] + e.cost;
			p.push(P(d[e.to], e.to));
		}
	}
	REP(i, q) {
		int x, y;
		std::cin >> x >> y;
		std::cout << d[x] + d[y] << std::endl;
	}
}

Measured memory_bytes: 13424
thp, tak, ahp, aak = map(int, input().split())
judge = 0
while thp > 0 and ahp > 0:
    if judge == 0:
        ahp -= tak
        judge = 1
    else:
        thp -= aak
        judge = 0
if thp <= 0:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 9120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<D,D> P;
#define F first
#define S second
#define PB push_back
#define INF 1000000001
#define INFL 1000000000000000001
#define M 1000000007
#define EPS (1e-10)
#define PI 3.14159265358979323846
struct Point{
	double x,y;
	int id;
	Point(){}
	Point(double a,double b):x(a),y(b){}
	Point operator+(Point p){return Point(x+p.x,y+p.y);}
	Point& operator+=(Point p){x+=p.x; y+=p.y; return *this;}
	Point operator-(Point p){return Point(x-p.x,y-p.y);}
	Point& operator-=(Point p){x-=p.x; y-=p.y; return *this;}
	Point operator*(double k){return Point(k*x,k*y);}
	Point& operator*=(double k){x*=k; y*=k; return *this;}
	Point operator/(double k){return Point(x/k,y/k);}
	Point& operator/=(double k){x/=k; y/=k; return *this;}
	double norm2(){return x*x+y*y;}
	double norm(){return sqrt(norm2());}
};
bool comp_x(const Point &a,const Point &b){
	if(a.x!=b.x)return a.x<b.x;
	return a.y<b.y;
}
bool comp_y(const Point &a,const Point &b){
	if(a.y!=b.y)return a.y<b.y;
	return a.x<b.x;
}
double cross(Point a,Point b){
	return a.x*b.y-a.y*b.x;
}
double dot(Point a,Point b){
	return a.x*b.x+a.y*b.y;
}
int ccw(Point a,Point b,Point c){
	b-=a,c-=a;
	if(cross(b,c)>EPS)return +1;    //COUNTER_CLOCKWISE
	if(cross(b,c)<-EPS)return -1;   //CLOCKWISE
	if(dot(b,c)<-EPS)return +2;     //ONLINE_BACK
	if(b.norm()<c.norm())return -2; //ONLINE_FRONT
	return 0;                       //ON_SEGMENT
}

//a-b-c no kaku de tiisaihou
double get_angle(Point a,Point b,Point c){
	Point p=a-b,q=c-b;
	double v=atan2(p.y,p.x),w=atan2(q.y,q.x);
	double t=fabs(v-w);
	return min(t,2.0*PI-t);
}
vector<Point>convex_hull(vector<Point>p){
	sort(p.begin(),p.end(),comp_x);
	int n=p.size(),k=0;
	vector<Point>res(n*2);
	for(int i=0;i<n;i++){
		while(k>1&&ccw(res[k-2],res[k-1],p[i])<0)k--;
		res[k++]=p[i];
	}
	for(int i=n-2,t=k;i>=0;i--){
		while(k>t&&ccw(res[k-2],res[k-1],p[i])<0)k--;
		res[k++]=p[i];
	}
	res.resize(k-1);
	return res;
}
int n;
double ans[105];
int main(void){
	scanf("%d",&n);
	vector<Point>p(n);
	for(int i=0;i<n;i++){
		scanf("%lf%lf",&p[i].x,&p[i].y);
		p[i].id=i;
	}
	if(n==2){
		printf("0.5\n0.5\n");
		return 0;
	}
	p=convex_hull(p);
	for(int i=0;i<p.size();i++){
		ans[p[i].id]=(PI-get_angle(p[(i-1+p.size())%p.size()],p[i],p[(i+1)%p.size()]))/(2.0*PI);
	}
	for(int i=0;i<n;i++)printf("%0.10lf\n",ans[i]);
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
long long int calc(long long int n,long long int x,long long int t){
    int cur =0;
    //int i =1;
    int time=0;
    while(cur < n){
        cur+=x;
        time +=t;
    }
    return time;
}
int main(){
    long long int n, x, t;
    cin>>n>>x>>t;
    cout << calc(n, x, t);
}

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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    int sum = A + B + C;
    int maxNum = max({A, B, C});
    if (sum % 2 == maxNum % 2) {
        cout << (3 * maxNum - A - B - C) / 2 << endl;
    } else {
        cout << (3 * (maxNum + 1) - A - B - C) / 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
if __name__ == "__main__":

    house = [ [ [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ] ], [ [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ] ], [ [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ] ], [ [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ] ] ]

    n = int(raw_input())

    i = 0
    while i < n:
        x = map(int, raw_input().split())
        b = x[0]
        f = x[1]
        r = x[2]
        v = x[3]
        house[b-1][f-1][r-1] += v
        i += 1

    b = 1
    while b <= 4:
        f = 1
        while f <= 3:
            s = ""
            r = 1
            while r <= 10:
                s += " {0}".format(house[b-1][f-1][r-1])
                r += 1
            print s
            f += 1
        if b != 4:
            print "####################"
        b += 1

Measured memory_bytes: 4348
N,M=map(int, input().split())
S=list(input())
T=S[::-1]
D=[0]*N
if N<=M:
  print(N)
  exit()
renzoku,ma=0,0
for i in range(1,N+1):
  if S[i]=='1':
    renzoku+=1
  else:
    ma=max(ma,renzoku)
    renzoku=0
if ma>=M:
  print(-1)
  exit()
r=0
for i in range(1,M+1):
  if T[i]!='1':
    r=i
ans=[r]

while r+M<N:
  for i in range(M,0,-1):
    if T[r+i]=='0':
      ans.append(i)
      r+=i
      break
  
ans.append(N-r)
print(*ans[::-1])

Measured memory_bytes: 13656
a, b, c, x, y = map(int, input().split())
result = 0
hlf = c*2

if a+b < hlf:  # example 2
    result = a*x + b*y
else:  # example 1, 3
    result = min(x, y)*hlf
    rem = abs(x-y)
    tmp = a*rem if max(x, y) == x else b*rem

    if hlf*rem < tmp:
        tmp = hlf*rem
    result += tmp

print(result)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 1000000007
#define TE 2e5
using namespace std;
using ll = long long;
using ldb = long double;


int main() {
	ll K; cin >> K;
	vector<ll> a(50);
	ll c = K / (ll)50;
	ll r = K % (ll)50;
	cout << 50 << endl;
	for (ll i = 0; i < 50; i++) {
		//cout << c * 49 + (i < r ? 50 : 0) << " ";
		//cout << c + 49 + (i < r) << " ";
		cout << (49 - i) + c + (i < r) << " ";
	}


}



Measured memory_bytes: 3624
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 1
for i in A:
    ans *=i
    if i==0:
        print(0)
        exit()
    elif ans > pow(10,18):
        print(-1)
        exit()
    else:
        continue


print(ans)

Measured memory_bytes: 21752
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n,w,h;
main()
{
	while(cin>>n>>w>>h,w)
	{
		vector<vector<pair<int,int> > >dp(n+1);
		dp[0].push_back(make_pair(w,h));
		for(int i=0;i<n;i++)
		{
			int a,b;cin>>a>>b;
			a--;
			for(int j=0;j<a;j++)dp[i+1].push_back(dp[i][j]);
			for(int j=a+1;j<=i;j++)dp[i+1].push_back(dp[i][j]);
			int c=dp[i][a].first,d=dp[i][a].second;
			int newa,newb,newc,newd;
			b%=2*c+2*d;
			if(b<c)
			{
				newa=b;newc=c-b;
				newb=newd=d;
			}
			else if(b<c+d)
			{
				newb=b-c;newd=c+d-b;
				newa=newc=c;
			}
			else if(b<2*c+d)
			{
				newa=b-c-d;newc=2*c+d-b;
				newb=newd=d;
			}
			else
			{
				newb=b-2*c-d;newd=2*c+2*d-b;
				newa=newc=c;
			}
			if(newa*newb<newc*newd)
			{
				dp[i+1].push_back(make_pair(newa,newb));
				dp[i+1].push_back(make_pair(newc,newd));
			}
			else
			{
				dp[i+1].push_back(make_pair(newc,newd));
				dp[i+1].push_back(make_pair(newa,newb));
			}
		}
		vector<int>ans;
		for(int i=0;i<=n;i++)ans.push_back(dp[n][i].first*dp[n][i].second);
		sort(ans.begin(),ans.end());
		for(int i=0;i<=n;i++)cout<<ans[i]<<(i==n?"\n":" ");
	}
}



Measured memory_bytes: 3168
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int n;
	cin>>n;
	string foo;
	cin>>foo;
	int ans=1000;
	vector<string> s(1000);
	for(int i=0;i<10;i++)
		for(int j=0;j<10;j++)
			for(int k=0;k<10;k++)
			{
				string s;
				s.push_back(i+'0');
				s.push_back(j+'0');
				s.push_back(k+'0');
				int now=0;
				rep(ii,n)
				{
					if(s[now]==foo[ii])now++;
					if(now==3)break;
				}
				if(now!=3)
				ans--;
			}

	cout<<ans<<endl;

	
	



	return 0;
}

Measured memory_bytes: 256
line = input()

count = 0

if 'WB' in line:
    count += line.count('WB')
if 'BW' in line:
    count += line.count('BW')
else:
    pass

if not 'W' in line:
    print(0)
elif not 'B' in line:
    print(0)
else:
    #ans = int((int(count / 2) + 1) * 4 - 3)
    ans = count
    print(ans)


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

struct UnionFind {
	//自身が親であれば、その集合に属する頂点数に-1を掛けたもの
	//そうでなければ親のid
	vector<int> r;

	UnionFind(int N) {
		r = vector<int>(N, -1);
	}

	int root(int x) {
		if (r[x] < 0) return x;
		return root(r[x]);
	}

	bool unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		if (r[x] > r[y]) swap(x, y);
		r[x] += r[y];
		r[y] = x;
		return true;
	}

	int size(int x) {
		return -r[root(x)];
	}
};


int main() {
	int N, M;
	cin >> N >> M;
	
	//友達集合を作る
	UnionFind UF(N);
	for (int i = 0; i < M; i++)
	{
		int A, B;
		cin >> A >> B;
		A -= 1; B -= 1;
		UF.unite(A, B);
	}

	//最大の友達集合を求める
	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		ans = max(ans, UF.size(i));
	}

	cout << ans << endl;
}



Measured memory_bytes: 4056
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,P> pip;
const int inf=(1<<31)-1;

int n;
vector<bool> vec;

int main(){
	while(cin>>n){
		int ans=0;
		vec=vector<bool>(n+1,1);
		for(int i=2;i<=n;i++){
			if(vec[i]){
				ans++;
				for(int j=i;j<=n;j+=i) vec[j]=0;
			}
		}
		cout<<ans<<endl;
	}
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define asort(x) sort(x.begin(),x.end())

int main() {
    string s, t;
    int cnt = 0;
    cin >> s >> t;
    rep(i,s.size()) {
        if(s[i] != t[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3916
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>
#include <functional>
#include <queue>

#define int long long

int inf = (1LL <<  62);

using namespace std;

signed main(){
    string s, t;
    cin >> s;
    cin >> t;
    int size1 = s.size();
    int size2 = t.size();
    bool ch = false;
    string s1 = s;
    for(int i = size1 - size2; i >= 0; i--){
        s1 = s;
        for(int j = 0; j < size2; j++){
            if(!(s1[i + j] == t[j])){
                if(s1[i + j] == '?'){
                    s1[i + j] = t[j];
                }else{
                   break;
                }
            }
            if(j == size2 - 1){
                ch = true;
                break;
            }
        }
        if(ch){
            for(int j = 0; j < size1; j++){
                if(s1[j] == '?'){
                    s1[j] = 'a';
                }
            }
            break;
        }
    }
    if(ch){
        cout << s1;
    }else{
        cout << "UNRESTORABLE";
    }
}

Measured memory_bytes: 256
import sys
from collections import Counter

# sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


n, m = read_int_list()

a = [0] * m
b = [0] * m

for i in range(m):
    a[i], b[i] = read_int_list()

c = Counter()
for i in range(m):
    if a[i] == 1:
        c[b[i]] += 1
    if b[i] == n:
        c[a[i]] += 1

res = 'IMPOSSIBLE'
for i, v in c.items():
    if v == 2:
        res = 'POSSIBLE'
print(res)


Measured memory_bytes: 34536
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<iostream>
#define pb push_back
#define fi first
#define se second
#define sz(x)  x.size()
#define cl(x)  x.clear()
#define all(x)  x.begin() , x.end()
#define r(x)  scanf("%d", &x)
#define rr(x , y)  scanf("%d%d" , &x , &y)
#define rst(s)  scanf("%s" , s)
#define rl(x)  scanf("%lld" , &x)
#define rrl(x , y)  scanf("%lld%lld" , &x , &y)
#define w(x)  printf("%d" , x)
#define ww(x , y)  printf("%d %d" , x , y)
#define wl(x)  printf("%lld" , x)
#define wwl(x , y)  printf("%lld %lld" , x , y)
#define sp()  printf(" ")
#define en()  puts("")
#define rep(i , x , n)  for(int i = x ; i <= n ; i ++) 
#define per(i , n , x)  for(int i = n ; i >= x ; i --) 
#define mem0(x)  memset(x , 0 , sizeof(x))
#define mem_1(x)  memset(x , -1 , sizeof(x))
#define mem_inf(x)  memset(x , inf , sizeof(x))
#define mem__inf(x)  memset(x , -inf , sizeof(x))
#define p_queue priority_queue
#define debug(x)  cout << x << '\n'
#define ddebug(x , y)  cout << x << ' ' << y << '\n'
using namespace std ;
//mt19937  rnd(chrono::high_resolution_clock::now().time_since_epoch().count()) ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int , int> pii ;
typedef pair<ll , ll> pll ;
typedef pair<int , ll> pil ;
typedef pair<ll , int> pli ;
const int inf = 0x3f3f3f3f ;
const int maxn = 1e5 + 5 ;
const int maxm = 30 ;
const ll mod = 1e9 + 7 ;
int n , k ;
ll inv2 ;
ll qpow(ll a , ll b)
{
	if(b < 0)  return 0 ;
	ll ans = 1 ; 
	a %= mod ;
	while(b)
	{
		if(b & 1)  ans = (ans * a) % mod ;
		b >>= 1 , a = (a * a) % mod ;
	}
	return ans % mod ;
}
int cal(int x)
{
	if(x <= 0)  return 0 ;
	return int(ll(x) * (x + 1) % mod * inv2 % mod) ;
}
int sum(int l , int r)
{
	return (cal(r) - cal(l - 1) + mod) % mod ;
}
int solve(int x)
{
	return (sum(n - x + 1 , n) - sum(0 , x - 1) + 1 + mod) % mod ;
}
int main()
{
	rr(n , k) ;
	int ans = 0 ;
	inv2 = qpow(2ll , mod - 2) ;
	rep(i , k , n + 1)	ans += solve(i) , ans %= mod ;
	w(ans) , en() ;
	return 0 ;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    cin >> n;
    vector<ll> lo(n), hi(n);
    REP(i, n){
        cin >> lo[i] >> hi[i];
    }

    sort(all(lo));
    sort(all(hi));

    if(n%2 == 1){
        cout << hi[n/2] - lo[n/2] + 1 << endl;
        return 0;
    }

    ll l = lo[n/2-1] + lo[n/2];
    ll h = hi[n/2-1] + hi[n/2];

    cout << h - l + 1 << endl;

    return 0;
}


Measured memory_bytes: 6428
#include<bits/stdc++.h>
using namespace std;
int main(){
	#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    // string s;
    // cin>>s;
   	// int flag=1;
    // for(int i=0;i<s.size();++i){
    // 	for(int j=i+1;j<s.size();++j){
    // 		if(s[i]==s[j]){
    // 			flag=0;
    // 			break;
    // 		}
    // 	}
    // }
    // cout<<((flag)?"yes":"no");



    // string s;
    // cin>>s;
    // set<char>c;
    // for(char k:s) c.insert(k);
    // cout<<((s.size()==c.size())?"yes":"no");
    


    // string s;
    // cin>>s;
    // map<char,int>m;
    // for(int i=0;i<s.size();++i){
    // 	if(m[s[i]]>0){
    // 		cout<<"no";
    // 		return 0;
    // 	}
    // 	++m[s[i]];
    // }
    // cout<<"yes";

    // int a,b;
    // cin>>a>>b;
    // int ans=a+b;
    // (ans>=10)?cout<<"error":cout<<ans;
    

    // int n;
    // cin>>n;
    // int a,mx=0,mi=1000;
    // for(int i=0;i<n;++i){
    // 	cin>>a;
    // 	if(mx<a) mx=a;
    // 	if(mi>a) mi=a;
    // }


    // int n;
    // cin>>n;
    // int ar[n];
    // for(int i=0;i<n;++i) cin>>ar[i];
   	// cout<<*max_element(ar,ar+n)-*min_element(ar,ar+n);
    

    // int n,m;
    // cin>>n>>m;
    // n+=2;
    // m+=2;
    // for(int i=0;i<n;++i){
    // 	for(int j=0;j<m;++j){
    // 		if(i==0 || i==n-1 || j==0 || j==m-1) cout<<"#";
    // 		else{
    // 			char c;
    // 			cin>>c;
    // 			cout<<c;
    // 		}
    // 	}
    // 	cout<<'\n';
    // }

    // int x,y;
    // cin>>x>>y;
    // int ar[13]={0,1,3,1,2,1,2,1,1,2,1,2,1};
    // cout<<((ar[x]==ar[y])?"Yes":"No");
    

    // string a,b,c;
    // cin>>a>>b>>c;
    // cout<<(((a.back()==b.front()) && (b.back()==c.front()))?"YES":"NO");
    
    // int a,b,c;
    // cin>>a>>b>>c;
    // cout<<((a<=c && c<=b)?"Yes":"No");
   
	string s(3,'0');
	for(int i=0;i<3;++i) cin>>s.at(i);
	int x=stoi(s);
	cout<<((x%4==0)?"YES":"NO");       

    // int a,b,c;
    // cin>>a>>b>>c;
    // cout<<(((b*10+c)%4==0)?"YES":"NO");





    return 0;
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_148
{
    class D
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n= ReadInt();
            int[] array = ReadInts();
            int now = 1;
            int res = 0;
            for(int i = 0; i < n; i++)
            {
                if (array[i] == now) now++;
                else res++;
            }
            if (res == n) WriteLine(-1);
            else WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    while(true){
        string s;
        cin >> s;
        if(s=="0") break;

        const int size=s.size();
        vector<int> nums(size);
        int ans=0,cnt[11][11]={{1}},prev[2]={};
        rep(i,0,size) nums[i]=s[size-i-1]-'0';
        rep(i,0,size){
            const int x=(prev[0]+(i%2?0:nums[i]))%11,y=(prev[1]+(i%2?nums[i]:0))%11;
            if(nums[i]!=0 and i>0) rep(j,0,11) rep(k,0,11) if(((x-j)-(y-k)+22)%11==0) ans+=cnt[j][k];
            ++cnt[x][y];
            prev[i%2]=(prev[i%2]+nums[i])%11;
        }
        cout << ans << endl;
    }
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
// using namespace __gnu_pbds;
// template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;



#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define in insert
#define ld long double


#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << " : " << arg1 << std::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...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =998244353;
const ll MAX_NODES =200001;
const ll MAX_LOG =50;
const ll maxn = 3000000+10;
#define endl '\n'
#define int ll
ll power(ll x, ll n) {
	ll res = 1;
	for (; n > 0; n >>= 1) {
	if (n & 1) res = (res * x) % mod;
	x = (x * x) % mod;
	}
	return res;
}
int w,k;
int evaluate(vector<vector<int>> v)
{	
	for(int i = 0;i<v.size();i++)
	{
		for(int j = 0;j<w;j++)
		{
			if(v[i][j]>k)
			{
				return mod;
			}
		}
	}
	int cur[int(v.size())]={0};
	int ans = 0;
	for(int j = 0;j<w;j++)
		{	
			bool br = false;
			for(int i  = 0;i<v.size();i++)
			{
				if(cur[i]+v[i][j]>k)
				{
					br = true;
				}
			}
			if(br)
			{
				memset(cur,0,sizeof(cur));
				ans++;
			}
			for(int i = 0;i<v.size();i++)
			{
				cur[i]+=v[i][j];
			}
		}
	return ans;
	
}
vector<int> solve(vector<vector<int>> v)
{
	vector<int> sum(w,0);
	for(int i = 0;i<v.size();i++)
	{
		for(int j = 0;j<w;j++)
		{
			sum[j]+=v[i][j];
		}
	}
	return sum;
}
int32_t main()
{   


    IOS 
	int h;
	cin>>h>>w>>k;
	vector<int> a[h];
	for(int i = 0;i<h;i++)
	{
		string s;
		cin>>s;
		for(int j = 0;j<w;j++)
		{
			a[i].pb(ll(s[j]-'0'));
		}
	}
	int fin = (h-1)*(w-1);
	for(int mask = 0;mask<(1<<(h-1));mask++)
	{	
		vector<vector<int>> v,temp;
		v.pb(a[0]);
		int ans = 0;
		for(int i = 1;i<h;i++)
		{
			if(mask>>(i-1)&1ll)
			{	
				temp.pb(solve(v));
				v.clear();
			}
			v.pb(a[i]);
		}
		temp.pb(solve(v));
		v.clear();
		ans = evaluate(temp);
		assert(temp.size()==(__builtin_popcount(mask)+1));
		fin = min(fin,ans + __builtin_popcount(mask));
	}
	cout<<fin<<endl;
	
   
		
	  


    
	
    
    
   
     
       
    

 
}






Measured memory_bytes: 552
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
 
#define pb push_back
#define mk make_pair
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define sf(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pf(a) printf("%d\n",a);
#define pfl(a) printf("%lld\n",a);
#define TEST int test; cin >> test;while(test--)
#define ii pair<int,int>
#define iil pair<ll,ll>
#define loop(i,a,b) for(int i = a ; i < b ; i++)
#define INF 2147483647
 
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const double pi = acos(-1.0);
 
 
void solve()
{
    int n, k, d, x, y;
    cin >> n >> k;
    int a[n+10];
    map<int,int>mp;
 
    for(int i = 1 ; i <= n ; i++)
        cin >> a[i];
 
    for(int j = 0 ; j < k ; j++)
    {
        cin >> x >> y;
        if(a[x] < a[y]) mp[x] = 1;
        else if(a[x] > a[y]) mp[y] = 1;
        else mp[x] = 1, mp[y] = 1;
    }
 
    int c = 0;
    for(int i = 1 ; i <= n ; i++)
    {
        if(mp.find(i) == mp.end())
        {
            c++;
        }
    }
    cout << c << endl;
}
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //TEST
    solve();
    return 0;
}

Measured memory_bytes: 6652
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  string S;
  cin >> N >> S;
  if(N % 2 == 1){
    cout << "No" << endl;
    return 0;
  }
  int flag = 1;
  for(int i = 0; i < (N / 2); i++){
    if(S.at(i) != S.at(i + (N / 2))){
      flag = 0;
    }
  }
  if(flag == 1)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=200005;
const int INF=1000000000;
long long n,a[MAXN],b[MAXN];
long long fet,t=INF;
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&a[i],&b[i]);
		fet=fet+a[i];
		if(a[i]>b[i])t=min(t,b[i]);
	}
	if(t==INF)printf("0\n");
	else printf("%lld\n",fet-t);
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
using namespace std;
int main(){
  string S; cin >> S;

  if(S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) cout << "Yes" << endl;
  else if(S[0] == S[2] && S[1] == S[3] && S[0] != S[1]) cout << "Yes" << endl;
  else if(S[0] == S[3] && S[1] == S[2] && S[0] != S[1]) cout << "Yes" << endl;

  else cout << "No" << endl;
  return 0;
}

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

ll f(ll x){
  if(x==1)return 1;
  return 2*f(x/2)+1;
}

int main() {
  ll h;cin>>h;
  cout<<f(h)<<endl;
}

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

int main(){long A, B;
cin >> A >> B;
string ans = "No";
if(A % 2 == 1 && B % 2 == 1) ans = "Yes";


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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void run() {
		// ??\???
		int n; 
		int[] arr = new int[10];
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
//		int[] ans = new int[n];
		for( int i = 0; i < n; i++ ) {
			// ??± 
			int box1 = 0, box2 = 0;
			for( int j = 0; j < 10; j++ ) {
				arr[j] = scan.nextInt();
			}
			// ??????
			for( int j = 0; j < 10; j++ ) {
				if( arr[j] > box1 ) box1 = arr[j];
				else if( arr[j] > box2 ) box2 = arr[j];
				else {
					System.out.println("NO");
					break;
				}
				if( j == 9 ) {
//					ans[i] = 1;
					System.out.println("YES");
				}
			}
		}
//		for( int i = 0; i < n; i++ ) {
//			if( ans[i] == 1 ) System.out.println("YES");
//			else System.out.println("NO");
//		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 26216
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'
 
class SegTree {
  constexpr static int DEFAULT = INT_MIN;
  int Combine(int l, int r) { return max(l,r); }

  vector<int> seg_tree;
  int n = 0;

  void Build(vector<int>& A, int v, int tl, int tr) {
    if (tl == tr) {
      seg_tree[v] = A[tl];
    } else {
      int tm = tl + (tr - tl) / 2;
      Build(A, v*2, tl, tm);
      Build(A, v*2+1, tm+1, tr);
      seg_tree[v] = Combine(seg_tree[v*2], seg_tree[v*2+1]);
    } 
  }
 public:

  SegTree(vector<int>& A) {
    n = A.size();
    seg_tree.resize(4*n);
    Build(A, 1, 0, n-1);
  }

  SegTree(int _n) : n(_n) {
    //seg_tree.resize(4*n);
    seg_tree.resize(4*n, DEFAULT);
  }

  int Query(int l, int r, int tl, int tr, int v) {
    if (l > r) return DEFAULT;
    if (l == tl && r == tr) return seg_tree[v];
    int tm = tl + (tr - tl) / 2;
    return Combine(Query(l, min(r, tm), tl, tm, v*2), 
                   Query(max(l, tm+1), r, tm+1, tr, v*2+1));
  }

  int Query(int l, int r) {
    return Query(l, r, 0, n-1, 1);
  }

  void Update(int pos, int new_val, int tl, int tr, int v) {
    if (tl == tr) {
      seg_tree[v] = new_val;
      return;
    }

    int tm = tl + (tr - tl) / 2;
    if (pos <= tm) {
      Update(pos, new_val, tl, tm, v*2);
    } else {
      Update(pos, new_val, tm+1, tr, v*2+1);
    }
    seg_tree[v] = Combine(seg_tree[v*2], seg_tree[v*2+1]);
  }

  void Update(int pos, int new_val) {
    Update(pos, new_val, 0, n-1, 1);
  }
};


int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  int n,k;
  cin >> n >> k;
  vector<int> A(n);
  for (auto& _a : A) cin >> _a;
  constexpr int MAXN = 300010;
  SegTree stree(MAXN+2);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int v = stree.Query(max(0,A[i]-k),min(A[i]+k,MAXN));;
    if (v == INT_MIN) {
      stree.Update(A[i], 1);
    } else {
      stree.Update(A[i], v+1);
    }
  }
  int v = stree.Query(0, MAXN);;
  cout << v << endl;
  

}


Measured memory_bytes: 9016
#include <stdio.h>

int main () {
	int point,a,b, distance1, distance2;
	scanf("%d %d %d", &point, &a, &b);
	
	distance1 = point - a;
	distance2 = point - b;
	if (distance1 < 0) {
		distance1 *= -1;
	} 
	if (distance2 < 0) {
		distance2 *= -1;
	}	 
	if (distance1 < distance2) {
		printf("A\n");
	} else {
		printf("B\n");
	}
	return 0;
}

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

int main()
{
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> p(n,0);
    int a;
    for(int i = 0; i < q; i++){
        cin >> a;
        p[a - 1]++;
    }

    for(int i = 0; i < n; i++){
        if(k - q + p[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    
    return 0;

}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = Long.parseLong(sc.next());
    long m = Long.parseLong(sc.next()); 
    
    System.out.println(Math.abs((n - 2) * (m - 2)));
  }
}

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

int main() {
  int n, m; // 人数, 種類
  cin >> n >> m;
  vector<int> cnt(m, 0);
  for(int j = 0; j < n; j++){
    int k; cin >> k;
  	rep(i, k){
      int a; cin >> a;
      a--;
      cnt[a]++;
    }
  }
  int ans = 0;
  rep(i, m){
  	if(cnt[i] == n){
    	ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  rep (i, n) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());

  ll ans = 0;
  rep (i, n - 2) {
    for (int j = i + 1; j < n - 1; j++) {
      int sum = v[i] + v[j];
      for (int k = j + 1; k < n; k++) {
        if (v[k] < sum) {
          ans++;
          // cout << v[i] << " " << v[i + 1] << " " << v[j] << endl;
        } else {
          break;
        }
      }
    }
  }
  P(ans);

  return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <cmath>
using namespace std;
long long gcd(long long a, long long b) {
	if (a < b) gcd(b, a);
	long long  r;
	while ((r = a%b)) {
		a = b;
		b = r;
	}
	return b;
}
long long lcm(long long a, long long b) {
	return a / gcd(a, b) * b;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

long long modinv(long long a, long long mod) {
	long long b = mod, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t*b; swap(a, b);
		u -= t*v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}
namespace NTT {
	const int MOD = 998244353;  // to be set appropriately
	const long long PR = 3;     // to be set appropriately

	void trans(vector<long long> &v, bool inv = false) {
		int n = (int)v.size();
		for (int i = 0, j = 1; j < n - 1; j++) {
			for (int k = n >> 1; k >(i ^= k); k >>= 1);
			if (i > j) swap(v[i], v[j]);
		}
		for (int t = 2; t <= n; t <<= 1) {
			long long bw = modpow(PR, (MOD - 1) / t, MOD);
			if (inv) bw = modinv(bw, MOD);
			for (int i = 0; i < n; i += t) {
				long long w = 1;
				for (int j = 0; j < t / 2; ++j) {
					int j1 = i + j, j2 = i + j + t / 2;
					long long c1 = v[j1], c2 = v[j2] * w % MOD;
					v[j1] = c1 + c2;
					v[j2] = c1 - c2 + MOD;
					while (v[j1] >= MOD) v[j1] -= MOD;
					while (v[j2] >= MOD) v[j2] -= MOD;
					w = w * bw % MOD;
				}
			}
		}
		if (inv) {
			long long inv_n = modinv(n, MOD);
			for (int i = 0; i < n; ++i) v[i] = v[i] * inv_n % MOD;
		}
	}

	// C is A*B
	vector<long long> mult(vector<long long> A, vector<long long> B) {
		int size_a = 1; while (size_a < A.size()) size_a <<= 1;
		int size_b = 1; while (size_b < B.size()) size_b <<= 1;
		int size_fft = max(size_a, size_b) << 1;

		vector<long long> cA(size_fft, 0), cB(size_fft, 0), cC(size_fft, 0);
		for (int i = 0; i < A.size(); ++i) cA[i] = A[i];
		for (int i = 0; i < B.size(); ++i) cB[i] = B[i];

		trans(cA); trans(cB);
		for (int i = 0; i < size_fft; ++i) cC[i] = cA[i] * cB[i] % MOD;
		trans(cC, true);

		vector<long long> res((int)A.size() + (int)B.size() - 1);
		for (int i = 0; i < res.size(); ++i) res[i] = cC[i];
		return res;
	}
};
typedef pair<int, int> p;
typedef pair<int, p> pai;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	long long k, a, b;
	cin >> k >> a >> b;
	long long bis = 1;
	long long en = 0;
	if (a - 1 >= k) { cout << 1 + k; return 0; }
	bis = a;
	k -= a-1;
	if (b - a > 2) {
		cout << a + (b - a)*(k / 2) + (k % 2);
	}
	else cout << bis + k;
}

Measured memory_bytes: 256
V, E = map(int, input().split())
a = [0 for i in range(E)]
b = [0 for i in range(E)]
m = [[0 for i in range(V)] for i in range(V)]
for i in range(E):
    a[i], b[i]=map(int, input().split())
    m[a[i]-1][b[i]-1]+=1
    m[b[i]-1][a[i]-1]+=1
S=0
for n in range(E):
    m[a[n]-1][b[n]-1]-=1
    m[b[n]-1][a[n]-1]-=1
    U=[[] for i in range(V)]
    for i in range(V):
        for j in range(V):
            if m[i][j]!=0:
                U[i].append(j)
    P=[set() for i in range(E+1)]
    P[0].add(0)
    Q=set()
    R=[False for i in range(V)]
    for i in range(1,E+1):
        for u in P[i-1]:
            for v in U[u]:
                if not(R[v]):
                    R[v]=True
                    P[i].add(v)
                    Q.add(v)
        if len(P[i])==0:
            break
    if len(Q)!=V:
        S+=1
    m[a[n]-1][b[n]-1]+=1
    m[b[n]-1][a[n]-1]+=1
print(S)


Measured memory_bytes: 42608
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5,P=1e9+7;
int f[N+N+10],inv[N+N+10];
inline int qpow(int a,int b=P-2){
    int res=1;
    for(;b;b>>=1){
        if(b&1)res=1ll*res*a%P;
        a=1ll*a*a%P;
    }
    return res;
}
inline int C(int n,int m){
    //cout<<"????"<<n<<':'<<m<<' '<<f[n]<<' '<<inv[m]<<' '<<inv[n-m]<<endl;
    return 1ll*f[n]*inv[m]%P*inv[n-m]%P;
}
signed main(){
    f[0]=1;
    for(int i=1;i<=N+N;i++){
        f[i]=1ll*f[i-1]*i%P;
    }
    inv[2*N]=qpow(f[2*N]);
    inv[0]=1;
    for(int i=N+N-1;i>=1;i--){
        inv[i]=1ll*(i+1)*inv[i+1]%P;
    }
    int n,a,b,c;
    cin>>n>>a>>b>>c;
    int ti=qpow(100,P-2);
    a=1ll*a*ti%P;
    b=1ll*b*ti%P;
    c=1ll*c*ti%P;
    int ans=0;
    int p1=qpow(a,n),p2=qpow(b,n);
    int c1=1,c2=1;
    c=(P+1-c);    
    if(c>=P)c-=P;
    c=qpow(c);
    int c3=qpow(c,n+1);
    for(int i=n;i<n+n;i++){
        ans=(ans+(1ll*p1*c1%P+1ll*p2*c2%P)*C(i-1,n-1)%P*c3%P*i%P)%P;
        c1=1ll*c1*b%P;
        c2=1ll*c2*a%P;
        c3=1ll*c3*c%P;
    }
    cout<<ans;
}

Measured memory_bytes: 3328
import collections
n = int(raw_input())
adj = collections.defaultdict(list)
for _ in range(n-1):
	u,v = map(int, raw_input().split())
	adj[u].append(v)
	adj[v].append(u)
def bfs(source, adj):
	q = collections.deque([(source,0)])
	distance = {}
	vis = set([source])
	while(q):
		u,d = q.popleft()
		distance[u] = d
		for v in adj[u]:
			if v not in vis:
				vis.add(v)
				q.append((v,d+1))
	return distance
a,b = bfs(1, adj), bfs(n, adj)
print 'Fennec' if 2* sum([+1 if a[u] <= b[u] else 0 for u in range(1, n+1)]) > n else 'Snuke'

Measured memory_bytes: 141504
main(){float a,b,c,d,e,f,g,h,i,x,y;for(scanf("%*d");~scanf("%f%f%f%f%f%f",&a,&b,&c,&d,&e,&f);printf("%.3f %.3f %.3f\n",x,y,hypot(a-x,b-y)))g=a*a+b*b,h=c*c+d*d,i=e*e+f*f,y=(a*(h-i)+c*(i-g)+e*(g-h))/(x=a*(d-f)+c*(f-b)+e*(b-d))/2,x=(b*(i-h)+d*(g-i)+f*(h-g))/x/2;}

Measured memory_bytes: 0
l=[0]*1000
c=0
s=input().split()
for i in s:
	if i=="+":
		l[c-2]=l[c-2]+l[c-1]
		c=c-1
	elif i=="-":
		l[c-2]=l[c-2]-l[c-1]
		c=c-1
	elif i=="*":
		l[c-2]=l[c-2]*l[c-1]
		c=c-1
	else:
		l[c]=int(i)
		c=c+1
print(l[0])


Measured memory_bytes: 5600
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  string s;
  cin >> s;
  reverse(all(s));
  cout << s << endl;
}

Measured memory_bytes: 3092
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }


/*
 update(s,t,x): [s,t) をxに変更する。
 find(s,t): [s,t) の最小値を出力する。
 */

const ll INIT = INT_MAX;
const ll NIL = LLONG_MAX;
struct SegTree {
    int N;
    ll init_v;
    vector<ll> node, lazy;
    
    SegTree(int _N):init_v(INIT) {
        N = 1;
        while (N < _N) N *= 2;
        node.resize(2 * N - 1, init_v);
        lazy.resize(2 * N - 1, NIL);
    }
    
    void lazy_evaluate(int k) {
        if (lazy[k] == NIL) return;
        node[k] = lazy[k];
        if (k < N - 1) {
            lazy[2 * k + 1] = lazy[k];
            lazy[2 * k + 2] = lazy[k];
        }
        lazy[k] = NIL;
    }
    
    /* [a,b) 引数の範囲に注意!! s~tまでを更新→update(s,t+1,~) */
    ll update(int a, int b, int x) { return update(a, b, 0, 0, N, x); }
    ll update(int a, int b, int k, int l, int r, int x) {
        if (r <= a || b <= l) {
            lazy_evaluate(k); // nodeの値を見るときは必ず遅延評価を更新する
            return node[k]; // updateでは全体の中の最小を見つける必要があるため, [l,r)外になっても値を参照
        }
        if (a <= l && r <= b) {
            lazy[k] = x;
            lazy_evaluate(k);
            return node[k];
        }
        else {
            lazy_evaluate(k);
            ll vl = update(a, b, 2 * k + 1, l, (l + r) / 2, x);
            ll vr = update(a, b, 2 * k + 2, (l + r) / 2, r, x);
            return node[k] = min(vl, vr);
        }
    }
    
    /* [a,b) 引数の範囲に注意!! */
    ll query(int a, int b) { return query(a, b, 0, 0, N); }
    ll query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return init_v;
        if (a <= l && r <= b) {
            lazy_evaluate(k);
            return node[k];
        }
        else {
            lazy_evaluate(k);
            ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
            ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return min(vl, vr);
        }
    }
};


int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int n,q; cin >> n >> q;
    SegTree ST(n);
    while(q--){
        int com; cin >> com;
        if(com == 0){
            int s,t,x; cin >> s >> t >> x;
            ST.update(s,t+1,x);
        }else{
            int i; cin >> i;
            cout << ST.query(i,i+1) << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 7076
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DP
{
    class E
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = int.Parse(s[0]), W = int.Parse(s[1]);
            List<string[]> list = new List<string[]>();
            for(int i = 0; i < N; i++)
            {
                string[] s0 = Console.ReadLine().Split(' ');
                list.Add(s0);
            }

            long vsum = list.Select(x => int.Parse(x[1])).Sum();

            //価値金額毎に最小の重さ
            long[] Weight = Enumerable.Repeat(long.MaxValue, (int)vsum + 1).ToArray();
            Weight[0] = 0;
            for (int i = 0; i < N; i++)
            {
                string[] s0 = list[i];
                int w = int.Parse(s0[0]);
                int v = int.Parse(s0[1]);

                for (int j = Weight.Length - 1; j > 0; j--)
                {
                    if (j < v)
                    {
                        if(w<Weight[j]) Weight[j] = w;
                    }
                    else
                    {
                        if (Weight[j - v] == long.MaxValue)
                        {
                            if (Weight[j] <= v)
                            {
                                Weight[j] = w;
                            }
                            else
                            {
                                continue;
                            }
                        }
                        else
                        {
                            long wcand = Weight[j - v] + w;
                            if (wcand < Weight[j]) Weight[j] = wcand;
                        }
                    }
                }
            }
            long maxV = Weight.Where(x => x <= W).Count() - 1;
            Console.WriteLine(maxV);
        }

    }
}


Measured memory_bytes: 15968