akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <vector>
#include <bitset>
#include <queue>
#include <algorithm>
#include <set>
#include <ctime>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#define LL long long
#define INF 0x3f3f3f3f
using namespace std;

namespace FastIO {
	template<typename tp> inline void read(tp &x) {
		x=0; register char c=getchar(); register bool f=0;
		for(;c<'0'||c>'9';f|=(c=='-'),c = getchar());
		for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0',c = getchar());
		if(f) x=-x;
	}
	template<typename tp> inline void write(tp x) {
		if (x==0) return (void) (putchar('0'));
		if (x<0) putchar('-'),x=-x;
		int pr[20]; register int cnt=0;
		for (;x;x/=10) pr[++cnt]=x%10;
		while (cnt) putchar(pr[cnt--]+'0');
	}
	template<typename tp> inline void writeln(tp x) {
		write(x);
		putchar('\n');
	}
}
using namespace FastIO;

char s[105];

int main() {
    scanf("%s", s);
    int length = strlen(s);
    char last = 0;
    int cnt = 0;
    int boo = 0;
    int ans = 0;
    bool pd = 0;
    for (int i = 0; i < length; ++i) {
        if (s[i] != last) {
            ans += cnt / 2;
            last = s[i];
            if (boo == 1) boo = 2, pd |= !(cnt & 1);
            cnt = 1;
            if (boo == 0) boo = 1;
        }
        else cnt++;
    }
    if (cnt == length) {
        scanf("%d", &cnt);
        printf("%lld\n", (LL)cnt * length / 2);
        return 0;
    }
    ans += cnt / 2;
    pd |= !(cnt & 1);
    pd = !pd;
    if (s[0] != s[length - 1]) pd = 0;
    read(cnt);
    printf("%lld\n", (LL)cnt * ans + pd * (cnt - 1));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int N;
int P[200010];


signed main(){
    cin >> N;
    rep(i, 0, N) cin >> P[i];

    int ans = 0, m = INF;
    rep(i, 0, N) if(m > P[i]) ans++, m = P[i];

    cout << ans << endl;

    return 0;
}

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

int i,n,a,o,k,e,ms[100001],m[100001];
main()
{
  cin>>n;
   for(i=1; i<=n; i++)
	{
  	cin>>ms[i];
  	m[ms[i]]=i;
	}
   for(i=1; i<=n; i++)
   cout<<m[i]<<" "; 
}

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

string query(int n) {
	cout << n << '\n' << flush;
	string s; cin >> s;
	if (s == "Vacant") exit(0);
	return s;
}

int main() {
	int n; cin >> n;
	int l = 0;
	int r = n - 1;
	string L = query(l);
	string R = query(r);

	while (true) {
		int m = (l + r) / 2;
		string M = query(m);
		if (L == M && m % 2) r = m;
		if (L == M && !(m % 2)) l = m;
		if (L != M && m % 2) l = m;
		if (L != M && !(m % 2)) r = m;
	}
	return 0;
}

Measured memory_bytes: 3816
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#define MN 200000
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
vector<int> v[MN+5];
int n,l[MN+5],b[MN+5],r[MN+5],ans=0,m;
priority_queue<int> q;
inline void Move(int&R){for(;R&&b[R];--R);}
int main()
{
	n=read();m=read();
	for(int i=1;i<=n;++i) l[i]=read(),r[i]=read(),v[l[i]].push_back(i);
	for(int i=m;~i;--i)
	{
		for(int j=0;j<v[i].size();++j) q.push(r[v[i][j]]);
		if(i&&q.size()) q.pop(),++ans;	
	}
	int R=m,t=m-ans;
	while(q.size())
	{
		if(q.top()<=R&&t) --t,--R,++ans; 
		q.pop();
	}
	cout<<n-ans;
	return 0;
}



Measured memory_bytes: 10496
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main()
{
    double x1=0 ,y1=0 ;
    double x2=0 ,y2=0 ;
    double x=0 ,y=0 ;
    double z=0 ,z2=0 ;

    scanf("%lf %lf %lf %lf" ,&x1 ,&y1 ,&x2 ,&y2) ;

    x=fabs(x1 - x2) ;
    y=fabs(y1 - y2) ;

    z2=pow(x ,2) + pow(y ,2) ;
    z=sqrt(z2) ;

    printf("%f\n",z) ;

    return 0 ;
}

Measured memory_bytes: 652
# class Map(dict):
#     def __missing__(self, key):
#         # この割当てなしのほうが速い。
#         # self[key] = 0
#         return 0


def main():
    int(input())

    d = {}
    ans = 0
    d_setdefault = d.setdefault
    for i, height in enumerate(input().split()):
        height = int(height)
        # 引き算のほうの i は足し算のよりも大きい。
        # 従って，このように順番に見ていく必要がある。
        d_setdefault(i + height, 0)
        d[i + height] += 1
        ans += d_setdefault(i - height, 0)

    return ans


if __name__ == '__main__':
    print(main())

# 大いに参考にした。
# https://kmjp.hatenablog.jp/entry/2020/05/03/1030


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

using namespace std;

bool is_valid(vector<vector<int>> books, int x, int m) {
    vector<int> sums(m);
    for (auto b : books) {
        for (int i = 1; i < m; ++i) {
            sums[i] += b[i];
        }
    }
    for (int i = 1; i < m; ++i) {
        if (sums[i] < x) {
            return false;
        }
    }
    return true;
}
void get_min_val(vector<vector<int>>& grid, int start, vector<vector<int>> temp, int curr_val, int& min_val, int l) {

    // base case ?
    if (is_valid(temp, l, grid[0].size())) {
        if (curr_val < min_val) {
            min_val = curr_val;
        }
        return;
    }

    int n = grid.size();
    for (int i = start; i < n; ++i) {
        temp.push_back(grid[i]);
        get_min_val(grid, i+1, temp, curr_val + grid[i][0], min_val, l);
        temp.pop_back();
    }
}
int main () {

    int n, m, x;
    cin >> n >> m >> x;
    vector<vector<int>> grid(n, vector<int>(m+1));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m+1; ++j) {
            cin >> grid[i][j];
        }
    }
    int min_val = INT_MAX;
    vector<vector<int>> temp;
    get_min_val(grid, 0, temp, 0, min_val, x);
    if (min_val == INT_MAX) {
        cout << -1 << endl;
    } else {
        cout << min_val << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
map<int,int>mp;
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	int d;
	int hh;
	for(int i = 1;i <= k;i++){
		scanf("%d",&d);
		for(int i = 1;i <= d;i++){
			scanf("%d",&hh);
			mp[hh]++;
		}
	}
	int ans = n - mp.size();
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3828
N,A,B=list(map(int, input().strip().split()))
v=sorted(list(map(int, input().strip().split())))[::-1]

def frac(n):
    ret=1
    for i in range(2,n+1):
        ret*=i
    return ret
def combi(n,a):
    return frac(n)//frac(a)//frac(n-a)

sm=sum(v[:A])
ave=sm/A
ans=0

minA = v[A-1]
ct_mA = v[:A].count(minA)
nmA = v.count(minA)

if ave == minA:
    i=0
    while A+i <=B and i<=nmA-ct_mA:
        ans+=combi(nmA,i+A)
        i+=1
else:
    ans = combi(nmA,ct_mA)
print(ave)
print(ans)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int a = sc.nextInt();
    String op = sc.next();
    int b = sc.nextInt();

    if (op .equals("+")) {
      System.out.println(a + b);
    } else {
      System.out.println(a - b);
    }
  
  }  
}


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

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

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

    int n;cin>>n;

    int ans;cin>>ans;
    for(int i=1;i<n;i++)
    {
        int a;cin>>a;
        ans=gcd(ans,a);
    }

    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll int fre[1002][1002];
int main()
{

    string s;
   cin>>s;
   for(int i=0;i<=s.size();i++)
   {
       if(s[i]=='1')s[i]='9';
       else s[i]='1';
   }
   cout<<s<<endl;

    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define N 200010
using namespace std;
char get(){
	char ch=getchar();
	while (ch<'A'||ch>'Z') ch=getchar();
	return ch;
}
int n,q;
char ch[N];
struct Info{char x,y;}qu[N];
int main(){
	cin>>n>>q;
	for (int i=1;i<=n;i++)ch[i]=get();
	for (int i=1;i<=q;i++){qu[i].x=get();qu[i].y=get();}
	int l=1,r=n;
	for (int i=q;i>=1;i--){
		if (qu[i].y=='L'){
			if (ch[l]==qu[i].x) l++;
			if (r!=n&&ch[r+1]==qu[i].x) r++;
		}else{
			if (ch[r]==qu[i].x) r--;
			if (l!=1&&ch[l-1]==qu[i].x) l--;
		}
	}
	cout<<r-l+1<<endl;
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int costA,costB,costAB,goalA,goalB;
  cin>>costA>>costB>>costAB>>goalA>>goalB;
  int cand1=costA*goalA+costB*goalB;
  int cand2=2*costAB*max(goalA,goalB);
  int cand3;
  if(goalA>goalB){
    cand3=2*costAB*goalB+(goalA-goalB)*costA;
  }else{
    cand3=2*costAB*goalA+(goalB-goalA)*costB;
  }
  cout<<min(cand1,min(cand2,cand3))<<endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: i64 = read();
    let b: i64 = read();
    let c: i64 = read();
    let d: i64 = read();

    if a * b < c * d {
        println!("{}", c * d);
    } else {
        println!("{}", a * b);
    }
}


Measured memory_bytes: 4352
def main():
    high, width = map(int, input().split())
    min_data = min(high, width)
    max_data = max(high, width)

    if min_data == 1:
        if max_data == 1:
            print(1)
        elif max_data == 2:
            print(0)
        else:
            print(max_data - 2)
    elif min_data == 2:
        print(0)
    else:
        print((high - 2) * (width - 2))



if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define nn 65536*4
#define lf double
char s[nn];
int bs;
int main()
{
	scanf("%s",s);int n=strlen(s);
	int ans=0;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='S') bs++;
		else if(bs) bs--,ans-=2;
		else ;
	}cout<<ans+n;
	return 0;
} 

Measured memory_bytes: 384
from collections import deque

queue = deque()

H,W = [int(v) for v in input().split()]
ch,cw = [int(v) for v in input().split()]
dh,dw = [int(v) for v in input().split()]

S = [input() for _ in range(H)]
visited = [[-1 for _ in range (W)] for _ in range(H)]

queue.append((cw-1,ch-1,0))

def check(x,y):
    return x > -1 and x < W and y > -1 and y < H and S[y][x] != "#" and visited[y][x] == -1

while len(queue) != 0:
    x,y,c = queue.popleft()
    if visited[y][x] != -1:
        continue
    visited[y][x] = c

    for d in [1,-1]:
        if check(x+d,y):
            queue.appendleft([x+d,y,c])
        if check(x,y+d):
            queue.appendleft([x,y+d,c])
    
    for dx in [-2,-1,0,1,2]:
        for dy in [-2,-1,0,1,2]:
            if check(x+dx,y+dy):
                queue.append((x+dx,y+dy,c+1))

print(visited[dh-1][dw-1])


Measured memory_bytes: 240980
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;
#define MAXN 2000000
#define MOD 1000000007
#define rint register int
#define gc() getchar()
inline int read(rint ans = 0, rint sgn = ' ', rint ch = gc())
{
	for(; ch < '0' || ch > '9'; sgn = ch, ch = gc());
	for(; ch >='0' && ch <='9';(ans*=10)+=ch-'0', ch = gc());
	return sgn-'-'?ans:-ans;
}
int fac[MAXN+5], e[MAXN+5]; int X1, Y1, X2, Y2, X3, Y3, X4, Y4, X5, Y5, X6, Y6, ans;
inline int fastpow(int s, int n){int a = 1; for(; n; n&1 ? a = 1ll*a*s%MOD : 0, s = 1ll*s*s%MOD, n >>= 1); return a;}
inline int C(int n, int k){if(n<0||k<0||n<k) return 0; if(!k||n==k) return 1; return 1ll*fac[n]*e[k]%MOD*e[n-k]%MOD;}
inline int f(int sx, int sy, int tx, int ty){return C(abs(sx-tx)+abs(sy-ty),abs(sy-ty));}
inline int F(int sx, int sy, int tx1, int ty1, int tx2, int ty2, bool dir)
{
	return (dir ? 0ll+f(sx,sy,tx1,ty1)+f(sx,sy,tx2+1,ty2+1)+MOD-f(sx,sy,tx1,ty2+1)+MOD-f(sx,sy,tx2+1,ty1)
				: 0ll+f(sx,sy,tx2,ty2)+f(sx,sy,tx1-1,ty1-1)+MOD-f(sx,sy,tx2,ty1-1)+MOD-f(sx,sy,tx1-1,ty2)) % MOD;
}
int main()
{
	X1 = read(), X2 = read(), X3 = read(), X4 = read(), X5 = read(), X6 = read(), Y1 = read(), Y2 = read(), Y3 = read(), Y4 = read(), Y5 = read(), Y6 = read();
	fac[0] = 1; for(rint i = 1; i <= MAXN; fac[i] = 1ll*fac[i-1]*i%MOD, i++); e[MAXN] = fastpow(fac[MAXN],MOD-2); for(rint i = MAXN; i; e[i-1] = 1ll*e[i]*i%MOD, i--);
	for(rint x = X3, y = Y4; x <= X4; ans += 	1ll*F(x,y,X1,Y1,X2,Y2,0)*F(x,y+1,X5,Y5,X6,Y6,1)%MOD*(x+y  )%MOD, ans<MOD?:ans-=MOD, x++);
	for(rint x = X3, y = Y3; x <= X4; ans +=MOD-1ll*F(x,y-1,X1,Y1,X2,Y2,0)*F(x,y,X5,Y5,X6,Y6,1)%MOD*(x+y-1)%MOD, ans<MOD?:ans-=MOD, x++);
	for(rint x = X4, y = Y3; y <= Y4; ans += 	1ll*F(x,y,X1,Y1,X2,Y2,0)*F(x+1,y,X5,Y5,X6,Y6,1)%MOD*(x+y  )%MOD, ans<MOD?:ans-=MOD, y++);
	for(rint x = X3, y = Y3; y <= Y4; ans +=MOD-1ll*F(x-1,y,X1,Y1,X2,Y2,0)*F(x,y,X5,Y5,X6,Y6,1)%MOD*(x+y-1)%MOD, ans<MOD?:ans-=MOD, y++); printf("%d\n",ans); return 0;
}

Measured memory_bytes: 15872
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppiii;

void solve() {
  int n, m;
  cin >> n >> m;
  int lhs = 1;
  int rhs = n;
  while(m--) {
    int a, b;
    cin >> a >> b;
    lhs = max(lhs, a);
    rhs = min(rhs, b);
  }
  cout << max(0, rhs-lhs+1) << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define pii pair<int, int>
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);

  int n, sum = 0;
  cin >> n;
  vi a(n), c(n - 1);
  for (int &x : a) 
    cin >> x;
  for (int i = 0; i < n; i++) {
    int x; cin >> x; sum += x;
  }
  for (int &x : c) {
    cin >> x;
  }
  for (int i = 1; i < n; i++) {
    if (a[i - 1] + 1 == a[i]) {
      sum += c[a[i - 1] - 1];
    }
  }
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 256
/************************************************************
	> File Name: a.cpp
	> Author: TSwiftie
	> Mail: 2224273204@qq.com 
	> Created Time: Sat 04 Apr 2020 04:51:53 PM CST
************************************************************/

#pragma GCC optimize(2)
#include <bits/stdc++.h>
#include <ext/rope>
#define lowbit(x) (x&-x)
#define SZ(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define lc (o<<1)
#define rc (o<<1|1)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF = 0x3f3f3f3f;
const ll INF_ll = 0x3f3f3f3f3f3f3f3fLL;
const double PI = acos(-1.0);
const double EPS = 1e-8;
signed main(void){
	string s;
	cin >> s;
	if(s[2]==s[3]&&s[4]==s[5])
		cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

int main() {
	// your code goes here
	int n, k;
	cin >> n >> k;
	vector<int> v(n, 0), dp(n, INT_MAX);
	dp[0] = 0;
	for(int i = 0; i < n; ++i) cin >> v[i];
	
	for(int i = 1; i < n; ++i){
		for(int j = 1; j <= k && i - j >= 0; ++j){
			dp[i] = min(dp[i], abs(v[i] - v[i-j]) + dp[i-j]);
		}
	}
	cout << dp[n-1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define int long long
#define FILE_IO freopen("input.txt","r",stdin)/#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for (auto &it : t) cout << it << " ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
  string s = "";
  char a, b, c;
  cin >> a >> b >> c;
  s = a;
  s += b;
  s += c;
  int ret = stoll(s);
  cout << (ret % 4 == 0 ? "YES": "NO") << endl;	
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N,K; cin >> N >> K;
    cout << N-K+1 << endl;
}

Measured memory_bytes: 256
/*
Code By: Sai Harsha K
 */

#include <bits/stdc++.h>
using namespace std;
#define lli long long int

int main() {
#ifndef ONLINE_JUDGE
  // these lines to be executed in local machine not online judge
  // get input
  freopen("input.txt", "r", stdin);
  // put output
  freopen("output.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(false); cin.tie(NULL);

  // solution
  int t = 1;
  while(t--) {
    int n;
    cin>>n;
    int a[n], b[n], c[n];
    for(int i = 0; i < n; i++) {
      cin>>a[i]>>b[i]>>c[i];
    }
    int dp[n][3]; // 0 indexed. dp[i][j] indicates max happiness on ith day with jth element
    // base case
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    // populate dp
    for(int i = 1; i < n; i++) {
      dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
      dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
      dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1]);
    }
    cout<<max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
  }

  return 0;
}


Measured memory_bytes: 5924
#include <bits/stdc++.h>
using namespace std ;
 
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int a,b ;
  cin >>a>>b ;
  float ans=0;
  while (ans < 1010){
    if(floor(ans*0.08)==a && floor(ans*0.10)==b) 
      break ;
   ans++; 
  }
 if(ans>1009) cout<<-1;
 else cout<<ans;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <memory.h>
#include <algorithm>
#define ll long long
using namespace std;

const int N = 1e5 + 2;

ll n, p;
map<ll, int> f;

int main() {
    cin >> n >> p;
    // look for m^n such that p % m^n == 0
    for (ll i = 2; i * i <= p; ++i) {
        while(p % i == 0) {
            p /= i;
            f[i]++;
        }
    }
    if (p > 1) {
        f[p]++;
    }
    ll ans = 1;
    for (auto& e : f) {
        while (e.second >= n) {
            ans *= e.first;
            e.second -= n;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<unordered_map>
#include<bits/stdc++.h>
#define ll long long 
#define dd double
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin>>s;
  int i;
  for(i=0;i<s.size();i++){
  	  if(i%2==0){
  	 if(s[i]!='R'&&s[i]!='U'&&s[i]!='D'){
  	 	cout<<"No"<<endl;
  	 	break;
	   }
    }
	  
	  else if(i%2!=0){ 
	  if(s[i]!='L'&&s[i]!='U'&&s[i]!='D'){
	  	cout<<"No"<<endl;
	  	break;
	  } 
	   
	     	
	 }
  }
  
  if(i==s.size()){
  	cout<<"Yes"<<endl;
  }
   
  return 0;
}

Measured memory_bytes: 3580
#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x
using namespace std;

signed main()
{
    if (fopen("input.txt", "r")) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin>>t;
    while (t--) {
        int n;
        cin>>n;
        int arr[n][2];
        for(int i=0;i<n;i++){
            int x,y;
            cin>>x>>y;
            arr[i][0]=x;
            arr[i][1]=y;
        }
        bool flag=false;
        for(int i=2;i<n;i++){
            bool temp=true;
            for(int j=i;j>=i-2;j--){
                if(arr[j][0]!=arr[j][1]){
                    temp=false;
                }
            }
            if(temp){
                flag=true;
            }
        }
        if(flag){
            cout<<"Yes";
        }
        else{
            cout<<"No";
        }
    }   
    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max<R>(x,0.0));}

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

// Problem Specific Parameter:
ll can[10][10],prv[10][10];
string board[10];

int main(void){
	int h,w;
	cin >> h >> w;
	rep(i,h) cin >> board[i];

	if(board[0][0]=='#') can[0][0]=true;
	
	rep(i,h)rep(j,w){
		if(board[i][j]=='.') continue;
		if(i-1>=0 and can[i-1][j]) can[i][j]=true,prv[i][j]=(i-1)*w+(j);
		if(j-1>=0 and can[i][j-1]) can[i][j]=true,prv[i][j]=(i)*w+(j-1);
	}

	int cur=(h*w-1);
	board[cur/w][cur%w]='.';

	while(cur){
		cur=prv[cur/w][cur%w];
		board[cur/w][cur%w]='.';
	}

	bool ok=true;
	rep(i,h)rep(j,w) if(board[i][j]=='#') ok=false;

	if(ok)
		puts("Possible");
	else
		puts("Impossible");

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
struct card {
   char mark;
   char num; 
};
void bubble_sort(struct card[], int);
void selection_sort(struct card[], int);
void print_array(struct card[], int);
int is_stable(struct card[], struct card[], int);
void strCastCard(struct card *, char[]);
int main(void){
    struct card cards_bubble[36];
    struct card cards_select[36];
    int i, N, j;
    char s[3];

    scanf("%d", &N);
    for(i = 0; i < N; i++){
        scanf("%s",s);
        strCastCard(&cards_bubble[i], s);
    }
    for(i = 0; i < N; i++) cards_select[i] = cards_bubble[i];
    
    bubble_sort(cards_bubble, N);
    selection_sort(cards_select, N);

    print_array(cards_bubble, N);
    printf("Stable\n");
    print_array(cards_select, N);
    if(is_stable(cards_bubble, cards_select, N)){
        printf("Stable\n");
    }
    else{
        printf("Not stable\n");
    }

    return 0;
}
void bubble_sort(struct card data[], int N){
    int i, j;
    struct card t;
    for(i = 0; i < N; i++){
        for(j = N - 1; j >= i; j--){
            if(data[j].num < data[j-1].num){
                t = data[j];
                data[j] = data[j-1];
                data[j-1] = t;
            }
        }
    }
}
void selection_sort(struct card A[], int N){
    int i, j, minj;
    struct card t;
    for(i = 0; i < N; i++){
        minj = i;
        for(j = i; j < N; j++){
            if(A[j].num < A[minj].num){
                minj = j;
            }
        }
        t = A[i];
        A[i] = A[minj];
        A[minj] = t;
    }
}
void print_array(struct card a[], int n){
    int i = 0;
    // printf("%c%d", a[0].mark, a[0].num);
    while(i < n){
        if(i > 0) printf(" ");
        printf("%c%d", a[i].mark, a[i].num);
        i++;
    }
    printf("\n");
    return;
}
int is_stable(struct card src[], struct card dst[], int N){
    int i;
    for(i = 0; i < N; i++){
        if(src[i].mark != dst[i].mark || src[i].num != dst[i].num) return 0;
    }
    return 1;
}
void strCastCard(struct card *t, char str[]){
    t->mark = str[0];
    t->num = str[1] - '0';
    return;
}



Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cctype>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) {
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }
int main() {
  int N, K; cin>>N>>K;
  string S; cin>>S;
  K--;
  S[K] = tolower(S[K]);
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<string, string> sP;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

ll n, a, b, c, q, k, x, y;
struct edge { ll to, cost; };
vector<edge>v[100010];
ll d[101011];

void dij(int s) {
	for (int i = 0;i <= n;i++)d[i] = INF2;
	d[s] = 0;
	priority_queue<P, vector<P>, greater<P>>p;
	p.push(P(d[s], s));
	while (!p.empty()) {
		P a = p.top();
		p.pop();
		int i = a.sc;
		if (d[i] < a.fr)continue;
		for (auto u : v[i]) {
			if (d[u.to] <= d[i] + u.cost)continue;
			d[u.to] = d[i] + u.cost;
			p.push(P(d[u.to], u.to));
		}
	}
}

int main() {
	cin >> n;
	for (int i = 0;i < n - 1;i++) {
		cin >> a >> b >> c;
		v[a].pb(edge{ b,c });
		v[b].pb(edge{ a,c });
	}
	cin >> q >> k;
	dij(k);
	for (int i = 0;i < q;i++) {
		cin >> x >> y;
		cout << d[x] + d[y] << endl;
	}
	return 0;
}

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

int main(void)
{
    int n, m, x; cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));

    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
        for (int j = 0; j < m; j++)
        {
            cin >> a[i][j];
        }
    }
    int perms = 1 << n;;
    int ans = 12345678;
    bool flag = true;
    for (int p = 0; p < perms; p++)
    {
        vector<int> level(m, 0);
        int cost = 0; flag = true;
        for (int i = 0; i < n; i++)
        {
            if ((p >> i) & 1)
            {
                cost += c[i];
                for (int j = 0; j < m; j++)
                {
                    level[j] += a[i][j];
                }
            }
        }
        for (int j = 0; j < m; j++)
        {
            if (level[j] < x) flag = false;
        }
        if (flag) ans = min(ans, cost);
    }
    if (ans == 12345678) cout << -1 << endl;
    else cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define each(i,mp) for(auto& i:mp)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  ll a,b,c;cin>>a>>b>>c;
  ll k;cin>>k;
  ll ans=0;
  if(k-a>=0){
    ans+=a;
    k-=a;
    if(k-b>=0){
      k-=b;
      if(k>0)ans+=(-1)*k;
    }else {
      out(ans);
      return 0;
    }


  }else ans+=k;

  out(ans);


  // if(k-a>0)ans+=a;
  // else {
  //   out(a);
  //   return 0;
  // }
  // k-=b;
  // if(k>0)ans+=(-1)*k;
  // // if(k-c>0)ans+=(-1)*c;
  // // else {
  // //   out(ans+(-1)*k);
  // //   return 0;
  // // }
  // out(ans);



  return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <sstream>
#include <iterator>

using namespace std;

#define endl ("\n")
#define pi (3.141592653589)
#define mod 1000000007
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

int32_t main() 
{
    fast;
	int N;
	cin >> N;
	vector<int64_t> x(N);
    for(int i =0; i< N; i++){
        cin >> x.at(i);
    }
    for(int i = 0; i<N; i++){
        if(x.at(i) == 0){
            cout << 0 << endl;
            return 0;
        }
    }

    int64_t res = 1;
    int64_t limit = pow(10.0, 18.0);
    for(int i = 0; i < N; i++){
        
        if(x.at(i)>limit/res){
            res=-1;
            break;
        }
        res *=x.at(i);
    }
    cout << res << endl;
    return 0;
}




Measured memory_bytes: 3980
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
 * 提出用Mainクラス
 */
public class Main {
    public static void main(String args[] ) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Integer[] result = new Integer[2];
        Integer[] N = new Integer[2];
        String[] input = new String[2];
        String readLine = br.readLine();
        input = readLine.split(" ");
        N[0] = Integer.parseInt(input[0]);
        N[1] = Integer.parseInt(input[1]);
        result[0] = N[0] * N[1];
        result[1] = N[0] + N[0] + N[1] + N[1];
        System.out.println(result[0] +" " + result[1]);
    }
}

Measured memory_bytes: 23928
#include<iostream>

using namespace std;

int main(){

    int a, b, c, k,total;
    cin >> a >> b >> c >> k;

    int xa = min(a,k);
    k -=  xa;
    int xb = min(b,k);
    k -= xb;
    int xc = k;
    int ans = xa - xc;
    cout << ans << endl;


    return 0;
} 

Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
int n;
int a[100005];
string s;
int k;
int ans,times;
int main() {
	cin>>n>>n;
	for(int i=1;i<=n;i++) {
		cin>>k>>s;
		if(s[0]=='W'&&a[k]!=-1) a[k]++;
		if(s[0]=='W'&&a[k]==-1) continue;
		if(s[0]=='A'&&a[k]!=-1) ans++,times+=a[k],a[k]=-1;
		if(s[0]=='A'&&a[k]==-1) continue; 
	}
	cout<<ans<<" "<<times;
	return 0;
}

Measured memory_bytes: 640
N=int(input())
L=list(map(int,input().split()))
ans=0
for i in range(len(L)-2):
    for j in range(i+1,len(L)-1):
        if L[i]!=L[j]:
            for k in range(j+1,len(L)):
                if L[i]!=L[k] and L[j]!=L[k]:
                    M=max([L[i],L[j],L[k]])
                    if M==L[i] and M<L[j]+L[k]:
                        ans+=1
                    elif M==L[j] and M<L[k]+L[i]:
                        ans+=1
                    elif M==L[k] and M<L[i]+L[j]:
                        ans+=1

print(ans)






        



















    

                
            





    









        

    









    

        




    















    



    





    






        






    
















        


























            
    


    


    
    














    


    














Measured memory_bytes: 9216
n, k = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]

ans = sum([b for a, b in ab if k & a == a])

for i in range(30):
    if k >> i & 1:
        nk = 1 << i ^ k
        for j in range(i):
            nk |= 1 << j
        ans = max(ans, sum([b for a, b in ab if nk & a == a]))
print(ans)


Measured memory_bytes: 23488
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;
ll dp[20000];
ll solve(ll s)
{
    if(s<0 or s==1 or s==2) return 0;
    if(s==0) return 1;

    if(dp[s] != -1) return dp[s];
    ll ans=0;
   
	for(ll i=3;i<=s;i++)
	{
		ans = (ans + solve(s-i)%mod)%mod;
	}
	return dp[s] = ans;
}
signed main()
{
    fast;
   
    ll n;
    cin>>n;
    memset(dp,-1,sizeof dp);
    cout<<solve(n);

}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define MODNum 1000000007
#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    string S, T;
    cin >> S;
    cin >> T;
    cout << T << S << endl;
    return 0;
}

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

using namespace std;

int getScore[100000];

void hawawa()
{
	int n;
	cin >> n;
	vector<int> p(n);
	for (auto&& i : p) {
		cin >> i;
		i--;
	}
	int ans = 0;
	for (int i = 0; i < n - 1; i++) {
		if (p[i] == i) {
			swap(p[i], p[i + 1]);
			ans++;
		}
	}
	if (p[n - 1] == n - 1) ans++;
	cout << ans << "\n";
}

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


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,a=0,c=0,m=0;
    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        cin>>a;
        if(a!=i)c++;
    }
    if(c>2)cout<<"NO"<<endl;

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

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

int N;
vector<int> A;
int S;
vector<int> dA, B;

void init_data(void) {
	cin >> N;
	A.resize(N + 2, 0);
	dA.resize(N + 2, 0);
	S = 0;
	for (int i = 1; i <= N; ++i) {
		cin >> A[i];
		dA[i] = abs(A[i] - A[i - 1]);
		S += dA[i];
	}
	B.resize(N + 1, 0);
	for (int i = 1; i <= N; ++i)
		B[i] = abs(A[i + 1] - A[i - 1]);
}

void solve(void) {
	for (int i = 1; i <= N; ++i) {
		int ans = S - (dA[i] + dA[i + 1]) + B[i];
		if (i != N)
			ans += abs(A[N]);
		cout << ans << '\n';
	}
}

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

	init_data();
	solve();

	return 0;
}


Measured memory_bytes: 2432
import java.io.*;

public class Main{
    public static void main(String[] arg){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  
        try{
            String x ;
            x = reader.readLine();
            int A ;
            while(x != null){
            int sum = 0;
            for(int i = 0;i < x.length() ; i++){
                A = x.charAt(i) - '0';
                sum += A;
            }
            if(sum != 0){
                System.out.println(sum);
            }
            x = reader.readLine();
        }
    }catch(IOException e){
        System.out.println(e);
    }
    }       
}


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

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;

const int mod = 998244353;
const ll inf = 3e18 + 5;

int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }  

const int n = 1e9;

int main(){
    string s;
    cin >> s;
    int n = (int) s.size();
    int a=0,b=0;
    for(int i=0; i<n; i++){
        if(s[i] == '0')
            a++;
        else
            b++;
    }
    cout << n - abs(a-b);
}

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

int main() {
	int h, w; cin >> h >> w;
	int a[h][w];
	vector<int> y, x, yd, xd;
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			if(j != w - 1) {
				if(a[i][j] % 2 == 1) {
					a[i][j]--;
					a[i][j+1]++;
					y.push_back(i+1), x.push_back(j+1);
					yd.push_back(i+1), xd.push_back(j+2);
				}
			}
			else {
				if(i != h - 1) {
					if(a[i][j] % 2 == 1) {
						a[i][j]--;
						a[i+1][j]++;
						y.push_back(i+1), x.push_back(j+1);
						yd.push_back(i+2), xd.push_back(j+1);
					}
				}
			}
		}
	}

	cout << y.size() << endl;
	for (int i = 0; i < y.size(); i++)
	{
		cout << y[i] << " " << x[i] << " ";
		cout << yd[i] << " " << xd[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 5220
import java.util.*;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;

public class Main {
	
	public static HashMap<String,String> map = new HashMap<>();


	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int H = sc.nextInt();
		int W = sc.nextInt();
		
		int[][] map = new int[H][W];
		int[] x = new int[H * W];
		int[] y = new int[H * W];
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				map[i][j] = sc.nextInt()-1;
				x[map[i][j]] = j;
				y[map[i][j]] = i;
			}
		}
		boolean[][] ok = new boolean[H][W];
		int[][] last   = new int[H][W];
		int[] vx = {1,0,-1,0};
		int[] vy = {0,1,0,-1};
		int ans = 0;
		for(int i = 0; i < H * W; i++) {
			int X = x[i];
			int Y = y[i];
			int pre = -1;
			boolean isOk = false;
			for(int j = 0; j < 4; j++) {
				int tx = X + vx[j];
				int ty = Y + vy[j];
				if(ty < 0 || tx < 0 || tx >= W || ty >= H) continue;
				if(map[ty][tx] < map[Y][X]) {
					isOk |= ok[ty][tx];
					if(pre != -1 && pre != last[ty][tx]) isOk = true;
					else pre = last[ty][tx];
				} 
			}
			if(isOk) ok[Y][X] = true;
			if(pre == -1) last[Y][X] = i;
			else last[Y][X] = pre;
			if(ok[Y][X]) ans++;
		}
		System.out.println(ans);
		
		
	}
}

Measured memory_bytes: 298344
using System;

namespace AOJ.intro
{
    namespace AOJ_1_2_B
    {
        public static class Range
        {
            public static void Main(string[] args)
            {
                string[] threeNum = Console.ReadLine().Split();
                
                int firstNum, secondNum, thirdNum;
                firstNum  = int.Parse(threeNum[0]);
                secondNum = int.Parse(threeNum[1]);
                thirdNum  = int.Parse(threeNum[2]);

                if(firstNum < secondNum && secondNum < thirdNum)
                {
                    Console.WriteLine("Yes");
                }
                else
                {
                    Console.WriteLine("No");
                }
            }
        }
    }
}


Measured memory_bytes: 8904
fn main() {
    proconio::input! {
        n: usize,
        h: usize,
        abs: [(usize, usize); n],
    }
    let maxa = abs.iter().max_by_key(|(a, _)| a).unwrap().0;
    let mut bs_over_maxa = abs
        .iter()
        .filter(|(_, b)| *b > maxa)
        .map(|(_, b)| *b)
        .collect::<Vec<_>>();
    bs_over_maxa.sort();
    bs_over_maxa.reverse();
    let mut count = 0usize;
    let mut damage = 0usize;
    for b in bs_over_maxa {
        damage += b;
        count += 1;
        if damage >= h {
            break;
        }
    }
    let ans = if damage >= h {
        count
    } else {
        count + (h - damage + maxa - 1) / maxa
    };
    println!("{}", ans);
}


Measured memory_bytes: 5688
#include<bits/stdc++.h>
using namespace std;
//typedef __int128 lll;
typedef long long ll;
int main() {
	ll n,k;
	cin >> n >> k;
	if(k == 0) {
		cout << n*n;
		return 0;
	}//printf("%lld",n*n);
	ll ans = 0;
	// b > k
	for(int i = k + 1;i <= n ;i++)
	{
		ans += (n/i) * (i - k);
		if(n%i >= k) ans += n%i - k + 1; 
	}
	printf("%lld",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int h, w;
	cin >> h >> w;
	string s[50];
	for (int i = 0; i < h; i++) cin >> s[i];
	const int dx[8] = { -1,0,1,-1,1,-1,0,1 };
	const int dy[8] = { -1,-1,-1,0,0,1,1,1 };
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') continue;
			int num = 0;
			for (int d = 0; d < 8; d++) {
				const int di = i + dy[d];
				const int dj = j + dx[d];
				if (di < 0 || h <= di) continue;
				if (dj < 0 || w <= dj) continue;
				if (s[di][dj] == '#') num++;
			}
			s[i][j] = char('0' + num);
		}
	}
	for (int i = 0; i < h; i++) cout << s[i] << endl;
	return 0;
}

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

isok = False
SUM = 0
e = 0
for i in range(1,100001):
    SUM += i
    if SUM==N:
        isok = True
        e = i
        break
    elif SUM>N:
        break
        
if isok:
    print("Yes")
    print(e+1)
    OUTPUT = [[i for i in range(1,e+1)] for j in range(e+1)]
    DIFF_SUM = e-1
    DIFF = e-1
    for j in range(1,e+1):
        for i in range(e+1-j): OUTPUT[j+i][j-1] = OUTPUT[j-1][i+j-1]
        #print(OUTPUT)
        for i in range(j,e): OUTPUT[j][i] += DIFF_SUM
        DIFF -= 1
        DIFF_SUM += DIFF
        #print(OUTPUT)
    for o in OUTPUT:
        print(e," ".join([str(i) for i in o]))
    
else:
    print("No")

Measured memory_bytes: 9596
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (3e15)

using namespace std;

int N, T[100005], A[100005];
int mod = 1e9 + 7;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> N;
    REP(i, N) cin >> T[i];
    REP(i, N) cin >> A[i];

    if (T[N - 1] != A[0]) {
        cout << 0 << endl;
        return 0;
    }

    int ans = 1;
    FOR(i, 1, N - 2) {
        if (T[i] != T[i - 1] && T[i] > A[i]) {
            cout << 0 << endl;
            return 0;
        }
        if (A[i] != A[i + 1] && A[i] > T[i]) {
            cout << 0 << endl;
            return 0;
        }

        if (T[i] != T[i - 1]) continue;
        if (A[i] != A[i + 1]) continue;

        int t = min(T[i], A[i]);
        ans = (ans * t) % mod;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
S = input()
lis_S = list(S)
Ans = []
index = 0
n = 0
for char in lis_S:
    Ans.append(0)
    if char=="A" or char=="C" or char=="G" or char=="T":
        Ans[n] += 1
        index += 1
    elif index < len(lis_S):
        index += 1
        n += 1
        continue
    else:
        break
print(max(Ans))

Measured memory_bytes: 3060
def resolve():
    import sys
    input = sys.stdin.readline
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    l, r, d = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    cnt = 0

    for i in range(l, r+1):
        if i % d ==0:
            cnt += 1

    print(cnt)
resolve()

Measured memory_bytes: 61676