akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int N, K, d;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        K = sc.nextInt();
        int[] count = new int[N];
        for(int i = 0 ; i < K ; i++)
        {
            d = sc.nextInt();
            int a[] = new int[d];
            for(int j = 0 ; j < d ; j++)
            {
                a[j] = sc.nextInt();
                count[a[j]-1] = 1;
            }
        }
        int dem = 0;
        for(int i = 0 ; i < N ; i++)
        {
            dem += count[i] == 1 ? 1 : 0;
        }
        System.out.println(N - dem);
    }
}


Measured memory_bytes: 46396
M, D = map(int, input().split())
ans=0
for m in range(1,M+1,1):
  for d in range(22,D+1,1):
    d1=d%10
    d10=d//10
    if d1>1 and d10>1:
      if m==d1*d10:
        ans+=1
        
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
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; }
const ll INF = 1e18;




int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    vector<bool>dp(k+1,false);
    for(int i=1;i<=k;i++){
        rep(j,n){
            if(i-a[j]<0)continue;
            if(!dp[i-a[j]]){
                dp[i]=true;
            }
        }
    }
    if(dp[k])cout << "First" << endl;
    else cout << "Second" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;

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

  sort(L.rbegin(), L.rend());

  int ret = 0;
  for (int i = 0; i < N - 2; ++i) {
    int a = L[i];
    for (int j = i + 1; j < N - 1; ++j) {
      int b = L[j];
      for (int k = j + 1; k < N; ++k) {
        int c = L[k];
        if( b + c > a) {
          ++ret;
//          cout << a <<  " " << b << " " << c << endl;
        } else {
          break;
        }
      }
    }
  }

  cout << ret << endl;

  return 0;
}


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

using namespace std;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define ll long long
#define lson node<<1
#define rson (node<<1)+1

const int maxn=1e6+10;
const ll mod=1e9+7;
const double pi=acos(-1);


int main()
{
    char c;
    cin>>c;
    if('A'<=c&&c<='Z')
        cout<<"A";
    else
        cout<<"a";
    return 0;
}



Measured memory_bytes: 3668
import java.util.*;
import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String[] A = S.split("/");
		int year = Integer.parseInt(A[0]);
		int month = Integer.parseInt(A[1]);
		int day = Integer.parseInt(A[2]);
		if(month <= 4) {
			System.out.println("Heisei");
			
		}
		else {
			System.out.println("TBD");
			
		}
		
		
		
	}

	
}

Measured memory_bytes: 21844
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}";
  return o;
}



int main() {
  int N,A,B,C,D;
  cin >> N >> A >> B >> C >> D;
  A--;B--;C--;D--;
  vector<char> S(N);
  rep(i,N) cin >> S[i];
  bool e=true;
  rep2(i,A,max(C,D)){
    if (S[i+1]=='#'&&S[i]=='#') {
      e = false; break;
    }
  }

  bool f=false;
  if (C>D) rep2(i,B-1,min(C,D)){
    if (S[i]=='.' && S[i+1]=='.' && S[i+2]=='.') {
      f = true; break;
    }
  }
  if (e&&(C<D||f)) cout << "Yes\n";
  else cout << "No\n";
  
  return 0;
}

Measured memory_bytes: 384
// Problem : C - XYZ Triplets
// Contest : AtCoder - AIsing Programming Contest 2020
// URL : https://atcoder.jp/contests/aising2020/tasks/aising2020_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

void solve(){
    int n;
    cin>>n;
    vi ans(n+1);
    for(int x=1;x<=100;x++){
        for(int y=1;y<=100;y++){
            for(int z=1;z<=100;z++){
                int val = x*x+y*y+z*z+x*y+y*z+z*x;
                if(val > n) continue;
                ans[val]++;
            }
        }
    }
    for(int i=1;i<=n;i++) cout<<ans[i]<<'\n';
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3580
//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define mp make_pair

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

inline void scani(int& x){
	scanf("%d",&x);
}

//end of macro

const ll MOD = 1e9 + 7;
inline ll addmod(ll a, ll b){
    if(a+b<MOD)return a+b;
    return a+b-MOD;
}
inline ll submod(ll a, ll b){
    return addmod(a, MOD-b);
}
inline ll mulmod(ll a, ll b){
    return (a*b)%MOD;
}
inline ll expmod(ll a, ll e){
    ll ret = 1;
    while(e){
        if(e&1)ret = mulmod(ret, a);
        a = mulmod(a, a);
        e >>= 1;
    }
    return ret;
}
inline ll divmod(ll a, ll b){
    return mulmod(a, expmod(b, MOD-2));
}

int n;
int x,y,z;
int erasingMask;
int validatingMask;

int memo[45][1<<18][2];
int dp(int now, int mask, bool lolos){
    if(now > n)return lolos ? 1 : 0;
    int& ret = memo[now][mask][lolos];
    if(ret != -1)return ret;
    
    ret = 0;
    mask <<= 1;
    mask &= erasingMask;
    REP(i,1,10){
        bool nlolos = lolos;
        if(!(mask&validatingMask))nlolos = true;
        ret = addmod(ret, dp(now+1, mask, nlolos));
        mask <<= 1;
        mask |= 1;
        mask &= erasingMask;
    }
    return ret;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);
    
    memset(memo, -1, sizeof memo);
    
    cin>>n>>x>>y>>z;
    erasingMask = ~(1<<(x+y+z));
    validatingMask = (1<<(x+y+z-1)) | (1<<(y+z-1)) | (1<<(z-1));
    
    cout << dp(1, (1<<(x+y+z))-1, 0) << endl;
    
    return 0;
}

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

using namespace std;
const static int INT_INF = 2147483647;
const static int MOD_NUM = 1000000007;
static string S[2005] = { "" };

int main()
{
	long long W, H, x, y;
	cin >> W >> H >> x >> y;

	double square = W * H / 2.0;

	int check = 0;

	if (x == W / 2.0 && y == H / 2.0) check = 1;
	cout << square << " " << check << endl;

}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,m=LI()
  
  l=[]
  for _ in range(m):
    a,b=LI()

    if a==1:
      l.append(b)
    elif a==n:
      l.append(b)
    elif b==n:
      l.append(a)

  if len(l)!=len(list(set(l))):
    return 'POSSIBLE'

  return 'IMPOSSIBLE'

print(main())


Measured memory_bytes: 25856
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	int a=0,b=0;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='0') a++;
		if(s[i]=='1') b++;
	}
	printf("%d",min(a,b)*2);
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <string>
using namespace std;
int a[100010];
int main ()
{
    int n, k;
    while(~scanf("%d %d", &n, &k))
    {
        for(int i = 0;i < n;i++)
            scanf("%d", &a[i]);
        int pre;
        long long ans = 0;
        if(k > a[0])
        pre = k - a[0];
        else ans += a[0] - k, pre = 0;
        for(int i = 1;i < n;i++)
        {
            if(a[i] > pre)
                ans += a[i]-pre, pre = k - pre;
            else pre = k - a[i];
        }
        printf("%lld\n", ans);
    }
}


Measured memory_bytes: 640
#include <bits/stdc++.h> 
using namespace std; 
int main() { 
    
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a==0)
      cout<<1;
      else if(b==0)
      cout<<2;
      else if(c==0)
      cout<<3;
      else if(d==0)
      cout<<4;
      else if(e==0)
      cout<<5;
      else 
       
    
	return 0; 
} 


Measured memory_bytes: 3636
using System;

public class ABC0126_A2 {
    private static void Main(string[] args) {
        var input = Console.ReadLine().Trim();
        Prepare(input);
    }

    private static void Prepare(string input) {
        var numbers = new int[] {
            int.Parse(input) / 100,
            int.Parse(input) % 100,
        };

        Compute(numbers);
    }

    private static void Compute(int[] numbers) {
        if (IsYYMM(numbers) && IsMMYY(numbers))
            OutputAnswer("AMBIGUOUS");

        else if (IsYYMM(numbers))
            OutputAnswer("YYMM");

        else if (IsMMYY(numbers))
            OutputAnswer("MMYY");

        else
            OutputAnswer("NA");
    }

    private static void OutputAnswer(string text) => Console.WriteLine(text);
    private static bool IsYYMM(int[] numbers) => (1 <= numbers[1]) && (numbers[1] <= 12);
    private static bool IsMMYY(int[] numbers) => (1 <= numbers[0]) && (numbers[0] <= 12);
}

Measured memory_bytes: 11092
n,m = map(int,input().split())
l=1
if n%2==1:
    r=n
    for i in range(m):
        d=min(abs(l-r),n-abs(l-r))
        print(l,r)
        l+=1
        r-=1
else:
    if n%4==0:
        r=n-1
    else:
        r=n
    rev=False
    for i in range(m):
        d=min(abs(l-r),n-abs(l-r))
        if d == n//2:
            rev=True
            l+=1
            print(l,r)
        else:
            print(l,r)
        l+=1
        r-=1

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

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]]]
for i in range(n):
    b, f, r, v = [int(x) for x in input().split()]
    if house[b-1][f-1][r-1] == 0:
        house[b-1][f-1][r-1] = v
    else:
        house[b-1][f-1][r-1] += v
        
for b in range(4):
    for f in range(3):
        for r in range(10):
            print(' ', end='')
            print(house[b][f][r], end='')
        print()
    if b != 3: print('#'*20)


Measured memory_bytes: 5644
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
const ll maxn = 1e5 + 5;
const ll maxm = 105;
ll dp[maxn][maxm];
ll weight[maxm],value[maxm];
int main(int argc, char const *argv[])
{
	ll n,w;
	cin>>n>>w;
	for(ll i = 1;i <= n; ++i)
	{
		scanf("%lld %lld",weight + i,value + i);
	}
	for(ll i = 0;i <= w; ++i)
	{
		for(ll j = 1;j <= n; ++j)
		{
			if(i >= weight[j])
			{
				dp[i][j] = max(dp[i - weight[j]][j - 1] + value[j],dp[i][j - 1]);
			}
			else
			{
				dp[i][j] = dp[i][j - 1];
			}
		}
	}
	printf("%lld\n",dp[w][n]);
	return 0;
}

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

bool is_diff(ll a, ll b) {
	if ((a>0 && b<0) || (a<0 && b>0)) return true;
	else return false;
}

ll f(vector<ll> a, bool flag_first, ll n) {
	ll ans = 0;
	ll total = a[0];

	if (flag_first && a[0]<=0) {ans+=(-a[0])+1;total=1;}
	else if (!flag_first && a[0]>=0) {ans+=(a[0]+1);total=-1;}

	rep(i,n-1) {
		ll next_total = total + a[i+1];
		if (next_total == 0) {
			if (total>0) next_total = -1;
			else next_total = 1;
			ans++;
		}
		else {
			if (is_diff(total, next_total)) total = next_total;
			else {
				if (next_total>0) {total = -1; ans += next_total+1;}
				else {total = 1; ans += (-next_total) + 1;}
			}
		}
	}
	return ans;
}

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	ll ans = min(f(a,true,n), f(a,false,n));
	cout << ans << endl;
	return 0;
}


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

int main() {
  int h, w, count = 0;
  cin >> h >> w;
  char a[h][w];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> a[i][j];
      if (a[i][j] == '#')
        count++;
    }
  }
  if (count == h+w-1)
    cout << "Possible" << endl;
  else
    cout << "Impossible" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}



int main(void) {

  int n, q;
  string s;
  cin >> n >> s >> q;

  set<int> ch[30];
  for (int i = 0; i <= 'z' - 'a'; i++) ch[i].insert(INT_MAX);
  for (int i = 0; i < n; i++) {
    ch[s[i] - 'a'].insert(i);
  }

  rep(query, q) {
    int z; scanf("%d", &z);
    if (z == 1) {
      int i; char c;
      scanf("%d %c", &i, &c);
      i--;
      int a = c - 'a';
      int b = s[i] - 'a';
      if (a != b) {
	ch[a].insert(i);
	ch[b].erase(i);
      }
      s[i] = c;
    } else {
      int l, r, ans = 0;
      scanf("%d %d", &l, &r);
      l--; r--;
      for (int j = 0; j <= 'z' - 'a'; j++) {
	int x, y;
	x = *ch[j].lower_bound(l);
	y = *ch[j].upper_bound(r);
	if (x != y) ans++;
      }
      printf("%d\n", ans);
    }
  }

  return 0;

}

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

const int N = 80;
const int OFFSET = (80 + 80) * 80;

int dat[N+5][N+5];
bitset<2*OFFSET+5> dp[N+5][N+5];

int main() {
    for (int i=0; i<N+3; i++) for (int j=0; j<N+3; j++) {
        dp[i][j].reset();
    }

    dp[1][0].set(OFFSET);
    dp[0][1].set(OFFSET);

    int n,m; scanf("%d %d", &n, &m);
    for (int i=1; i<=n; i++) for (int j=1; j<=m; j++) {
        scanf("%d", &dat[i][j]);
    }

    for (int i=1; i<=n; i++) for (int j=1; j<=m; j++) {
        int a; scanf("%d", &a);
        a = abs(a - dat[i][j]);

        dp[i][j] = (
            (dp[i-1][j] << a) | (dp[i-1][j] >> a)
            | (dp[i][j-1] << a) | (dp[i][j-1] >> a)
        );
    }

    for (int i=0; i<OFFSET+2; i++) {
        if (dp[n][m][OFFSET+i] || dp[n][m][OFFSET-i]) {
            printf("%d\n", i);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 22784
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
#include <unordered_set>
using namespace std;


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

  int32_t N;
  cin >> N;
  unordered_set<int> set;
  for (int i = 0; i < N; i++) {
    int tmp = 0;
    cin >> tmp;
    if (set.count(tmp) != 0) {
      cout << "NO" << endl;
      return 0;
    } else {
      set.insert(tmp);
    }
  }
  cout << "YES" << endl;

  return 0;
}


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

int main() {
  const int H = 2;
  int W;
  cin >> W;
  vector<vector<int>> A(2+1, vector<int>(W+1));
  for(auto i = 1; i <= H; ++i) for(auto j = 1; j <= W; ++j) cin >> A[i][j];

  auto dp = A;
  for(auto j = 1; j <= W; ++j) dp[1][j] += dp[1][j-1];
  for(auto j = 1; j <= W; ++j) dp[2][j] += max(dp[1][j], dp[2][j-1]);

  cout << dp.back().back() << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N;
	string S;
	cin >> N >> S;
	if(N%2 == 1){
		cout << "No" << endl;
	}else{
		if(S.substr(0, N/2) == S.substr(N/2, N)){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cctype>
#include<utility>

using namespace std;
int main()
{
    int c,i,a;
    char s[100];
    scanf("%s",s);
    for(i=0,a=0,c=0;s[i];i++)
    {
        c=c*10+s[i]-'0';
        a=a+(s[i]-'0');
    }
    if(c%a==0)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
    bool res = false;
  for(int a=0; a<=25; a++){
    for(int b=0; b<=13; b++){
        int total = 4*a+7*b;
        if(total == n)res = true;
    }
  }
  if(res){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
          

Measured memory_bytes: 256
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//vector
using vi = vector<int>;
using vii = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

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




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

ll f(ll x, ll y, ll z){
    return x * x + y * y + z * z + x * y + y * z + z * x;
}

int main(){

    int N;
    cin >> N;

    vll cnt(N + 1, 0);

    FOR(x, 1, 101) FOR(y, 1, 101) FOR(z, 1, 101){
        ll ans = f(x, y, z);
        if (ans <= N) cnt[ans]++;
    }

    FOR(i, 1, N + 1) cout << cnt[i] << endl;

    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
using namespace std;
main(){
	int n;
	string s;
	while(cin>>n,n+1){
		s="";
		do{
			s = (char)('0'+n%4) + s;
			n = (n - (n%4)) / 4;
		}while(n);
		cout<<s<<endl;
	}
}

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

using namespace std;
long long f[200005][3][2];
bool memo[200005][3][2];
int a[200005];
int n;
long long calc(int i, int j, int last) {
    if (j <= -2) return -1e18;
    if (i > n) return (i / 2 + j == n / 2 ? 0: -1e18);
    long long &res = f[i][j + 1][last];
    if (memo[i][j + 1][last])
        return res;
    memo[i][j + 1][last] = 1;
    res = calc(i + 1, (i / 2 + j) - (i + 1) / 2, 0);
    if (last) return res;
    res = max(res, calc(i + 1, (i / 2 + j + 1) - (i + 1) / 2, 1) + a[i]);
    return res;
}
int main() {
#ifdef LDT
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    //f[i][j] = max when choose (i / 2 + j) element
    cout << calc(1, 0, 0);
    return 0;
}

Measured memory_bytes: 30548
#include<set>
#include<map>
#include<ctime>
#include<queue>
#include<cmath>
#include<climits>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
int read(){
    int f=1,x=0;char s=getchar();   
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}  
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
    return x*f;
}
#define MAXN 50000
#define INF 0x3f3f3f3f
map<string,bool>Map;
int main(){
	string Re;char tmp;
	int n=read(),f=0;
	cin>>Re,tmp=Re[Re.size()-1],Map[Re]=1;
	for(int i=2;i<=n;i++){
		cin>>Re;
		if(tmp!=Re[0]||Map[Re])
			f=1;
		tmp=Re[Re.size()-1],Map[Re]=1;
	}
	puts(f?"No":"Yes");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> vec(n, 0);
  for(int i = 0; i < n; ++i){
    cin>>vec[i];
  }
  int res = 0;
  int cnt = 1;
  for(int i = 0; i < n; ++i){
    if(vec[i] == cnt){
      cnt++;
    }
    else res++;
  }
  if(res == n)cout<<-1<<endl;
  else cout<<res<<endl;  
  return 0;
}


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

int main() {
    int d[3];
    cin>>d[0]>>d[1]>>d[2];

    string ans = "Yes";
    if (d[0] == d[1] && d[1] == d[2] && d[0] == d[2]) {
        ans = "No";
    } else if (d[0] != d[1] && d[0] != d[2] && d[1] != d[2]) {
        ans = "No";
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int N, M;
int A[3];
vector<int> G[51];
bool used[51];
bool dp[101][51][51];  // a step, b start, c goal
 
int main(){
 
  cin>>N>>M;
  for(int i=0;i<3;i++)cin>>A[i];
  for(int i=0;i<M;i++){
    int f,t;
    cin>>f>>t;
    f--;t--;
    G[f].push_back(t);
  }
 
  for(int i=0;i<N;i++)
    dp[0][i][i] = true;
  for(int i=1;i<101;i++){
    for(int j=0;j<N;j++){
      for(int k=0;k<N;k++){
        if(dp[i-1][j][k]){
          for(int to : G[k]){
            dp[i][j][to] = true;
          }
        }
      }
    }
  }
   
  used[N-1] = true;
  for(int ite=1;;ite++){
    vector<int> idx;
    for(int i=0;i<N;i++){
      if(used[i])continue;
      int cnt = 0;
      for(int j=0;j<3;j++){
        for(int k=0;k<N;k++){
          if(dp[A[j]][i][k] && used[k]){
              cnt++;
              break;
          }
        }
      }
      // OK
      if(cnt == 3){
        idx.push_back(i);
      }
    }
    if(idx.size()){
      for(int i : idx) used[i]=true;
      if(used[0]){
        cout<<ite<<endl;
        return 0;
      }
    }
    else{
        cout<<"IMPOSSIBLE"<<endl;
        return 0;
    }
  }
}

Measured memory_bytes: 3412
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define pii pair<int,int>
#define inf 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define drep(i,a,b) for(int i=(a); i>=(b);i--) 

const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7;


int n,m;
vector<int>v[maxn];

priority_queue <int>q;

int main()
{
   ios::sync_with_stdio(false); cin.tie(0);cout.tie(0);
   cin >> n >> m;
   rep(i,1,n) {
        int a,b;
        cin >> a >> b;
        v[a].push_back(b);
   }
   ll ans = 0;
   rep(i,1,m){
       int sz = v[i].size() - 1;
       rep(j,0,sz) q.push(v[i][j]);
       if(!q.empty()){
            ans += q.top();
            q.pop();
       }
   }
   cout << ans;
  
}


Measured memory_bytes: 5632
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	s := make([][]int, m)

	for i := 0; i < m; i++ {
		k := 0
		fmt.Scan(&k)
		s[i] = make([]int, k)
		for j := 0; j < k; j++ {
			fmt.Scan(&s[i][j])
			s[i][j]--
		}
	}
	p := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&p[i])
	}

	ans := 0

	// 2^n通り試す
	for i := 0; i < 1<<uint(n); i++ {
		ok := true
		for j := 0; j < m; j++ {
			on := 0
			for _, num := range s[j] {
				// num個目のフラグが立ってたらon
				if ((i >> uint(num)) & 1) == 1 {
					on++
				}
			}

			if on%2 != p[j] {
				ok = false
			}
		}
		if ok {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int dp[301][301];

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


	int N, M;
	scanf("%d %d", &N, &M);

	int xm[301][4], xM[301][4];
	bool aru[301] = {};
	rep1(i, N) {
		xm[i][1] = 1000;
		xm[i][2] = 1000;
		xM[i][2] = -1;
		xM[i][3] = -1;
	}
	rep(i, M) {
		int l, r, x;
		scanf("%d %d %d", &l, &r, &x);
		chmin(xm[r][x], l);
		chmax(xM[r][x], l);
		aru[r] = 1;
	}

	const int mod = 1e9 + 7;
	dp[0][0] = 1;
	rep1(i, N) {
		if (aru[i]) {
			for (int j = i - 1; j >= 0; j--) for (int k = i - 1; k >= j; k--) {
				int tmp = dp[j][k];
				dp[j][k] = 0;
				int jj = j;
				int kk = k;
				int OKJ = 1, OKK = 1;
				if (xm[i][1] < kk) OKK = 0;
				if (xm[i][2] < jj) OKJ = 0;
				if (xM[i][2] >= kk) OKK = 0;
				if (xM[i][3] >= jj) OKJ = 0;
				if (OKJ && OKK) dp[jj][kk] = tmp;
				kk = i;
				OKK = 1;
				if (xm[i][1] < kk) continue;
				if (xM[i][2] >= kk) continue;
				if (OKJ) {
					dp[jj][kk] += tmp;
					if (dp[jj][kk] >= mod) dp[jj][kk] -= mod;
				}
				jj = k;
				OKJ = 1;
				if (xm[i][2] < jj) OKJ = 0;
				if (xM[i][3] >= jj) OKJ = 0;
				if (OKJ) {
					dp[jj][kk] += tmp;
					if (dp[jj][kk] >= mod) dp[jj][kk] -= mod;
				}
			}
		}
		else {
			for (int j = i - 1; j >= 0; j--) for (int k = i - 1; k >= j; k--) {
				dp[j][i] += dp[j][k];
				if (dp[j][i] >= mod) dp[j][i] -= mod;
				dp[k][i] += dp[j][k];
				if (dp[k][i] >= mod) dp[k][i] -= mod;
			}
		}
	}

	ll kotae = 0;
	rep(j, N + 1) rep(k, N + 1) {
		kotae += dp[j][k];
	}
	printf("%lld", kotae% mod);

	Would you please return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < (s.size() + 1) / 2; i++) {
    if (s[i] != s[s.size() - i - 1])
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

const int inf = 1e9;
int H,W,Q;
string sh,sw;
int ans;
V<int> Ln,Ls,Rn,Rs,Uw,Ue,Dw,De;

void dfs(int a,int b,int c,int d,bool vert,int turn,int dist){
	#define goNext(na,nb) if(a!=na || b!=nb) dfs(na,nb,c,d,!vert,turn+1,dist+abs(a-na)+abs(b-nb))
	#define goNext2(na,nb) if(a!=na || b!=nb) dfs(na,nb,c,d,vert,turn,dist+abs(a-na)+abs(b-nb))

	if(a == -1 || a == H || b == -1 || b == W) return;

	if(a == c && b == d){
		chmin(ans,dist);
		return;
	}
	if(turn == 5){
		return;
	}
	if(vert){
		if(sw[b] == 'N'){	//a--
			goNext(Uw[a],b);
			goNext(Ue[a],b);
			if(a>c){
				goNext(c,b);
				goNext2(c,b);
			}
		}else{
			goNext(Dw[a],b);
			goNext(De[a],b);
			if(a<c){
				goNext(c,b);
				goNext2(c,b);
			}
		}
	}else{
		if(sh[a] == 'W'){
			goNext(a,Ln[b]);
			goNext(a,Ls[b]);
			if(b>d){
				goNext(a,d);
				goNext2(a,d);
			}
		}else{
			goNext(a,Rn[b]);
			goNext(a,Rs[b]);
			if(b<d){
				goNext(a,d);
				goNext2(a,d);
			}
		}
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	cin >> H >> W >> Q;
	cin >> sh >> sw;

	{
		Ln = V<int>(W,-1);
		Ls = V<int>(W,-1);
		rep(i,W){
			if(i != 0) Ln[i] = Ln[i-1], Ls[i] = Ls[i-1];
			if(sw[i] == 'N') Ln[i] = i;
			else Ls[i] = i;
		}
	}
	{
		Rn = V<int>(W,-1);
		Rs = V<int>(W,-1);
		rep(i,W){
			if(i != 0) Rn[i] = Rn[i-1], Rs[i] = Rs[i-1];
			if(sw[W-1-i] == 'N') Rn[i] = i;
			else Rs[i] = i;
		}
		reverse(all(Rn));
		reverse(all(Rs));
		rep(i,W) Rn[i] = W-1 - Rn[i], Rs[i] = W-1 - Rs[i];
	}
	{
		Uw = V<int>(H,-1);
		Ue = V<int>(H,-1);
		rep(i,H){
			if(i != 0) Uw[i] = Uw[i-1], Ue[i] = Ue[i-1];
			if(sh[i] == 'W') Uw[i] = i;
			else Ue[i] = i;
		}
	}
	{
		Dw = V<int>(H,-1);
		De = V<int>(H,-1);
		rep(i,H){
			if(i != 0) Dw[i] = Dw[i-1], De[i] = De[i-1];
			if(sh[H-1-i] == 'W') Dw[i] = i;
			else De[i] = i;
		}
		reverse(all(Dw));
		reverse(all(De));
		rep(i,H) Dw[i] = H-1-Dw[i], De[i] = H-1-De[i];
	}
	show(Ln);
	show(Ls);
	show(Rn);
	show(Rs);
	show(Ue);
	show(Uw);
	show(De);
	show(Dw);

	rep(_,Q){
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		a--,b--,c--,d--;
		ans = inf;
		dfs(a,b,c,d,false,0,0);
		dfs(a,b,c,d,true,0,0);
		if(ans == inf) ans = -1;
		cout << ans << endl;
	}
}


Measured memory_bytes: 4944
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define EQ(a,b) (abs((a)-(b))<EPS)
int r,c;
int b[10][10000];
int t[10][10000];
int ans;
int count1;
int count2;
int main()
{
	while(1)
	{
		ans=0;
		memset(b,0,sizeof(b));
		memset(t,0,sizeof(t));
		cin >> r >> c;
		if(r==0&&c==0)break;
		for(int i=0;i<r;i++)
		{
			for(int j=0;j<c;j++)
			{
				cin >> b[i][j];
			}
		}
		for(int i=0;i<1<<r;i++)
		{
			memcpy(t,b,sizeof(b));
			for(int j=0;j<r;j++)
			{
				if((i>>j)&1==1)
				{
					for(int k=0;k<c;k++)
					{
						t[j][k]^=1;
					}
				}
			}
			count2=0;
			for(int k=0;k<c;k++)
			{
				count1=0;
				for(int j=0;j<r;j++)
				{
					count1 += t[j][k];
				}
				count2 += max(r-count1,count1);
			}
			ans=max(ans,count2);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1948
N = list(map(int, input().split()))
N.sort()

cnt = 0

while True:
  N.sort()
  if N[0] == N[1] == N[2]:
    print(cnt)
    exit()

  if N[1] - N[0] > 1:
    N[0] += 2
    cnt += 1
  elif N[2] - N[1] > 1:
    N[1] += 2
    cnt += 1
  elif N[2] - N[0] == 2:
    N[0] += 2
    cnt += 1
  elif N[0] == N[1] and N[2] - N[1] == 1:
    N[0] += 1
    N[1] += 1
    cnt += 1
  elif N[1] == N[2]:
    N[0] += 2
    cnt += 1

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d;
  string s,ss;
  long long ans = 0;
  
  cin >> a >> b;

  ans = a + b;
  if(ans >= 24) ans -= 24;
  
  cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;

int n, m, k, u, v, x, y, t, a, b, ans;
string S;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>S;
	cout<<S[0]<<S[1]<<S[2]<<'\n';
	
	
	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

void trace(int A[],int N){
    REP(i,N){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}


int main(){
    string A,B,C;
    cin >> A >> B >> C;
    if(A[A.length()-1] == B[0] && B[B.length()-1] == C[0])puts("YES");
    else puts("NO");
}


Measured memory_bytes: 256
#include <stdio.h>

int cil(int n)
{
     int a, b, c, d, i=0;

     for(a=0; a<=9; a++)
	  for(b=0; b<=9; b++)
	       for(c=0; c<=9; c++)
		    for(d=0; d<=9; d++)
		    {
			 if(a+b+c+d==n) i++;
		    }
     
     return i;
}

int main(void)
{
     int n;

     while(0<1){
	  if(scanf("%d", &n)==-1) break;
	  else{
	       printf("%d\n", cil(n));
	  }
     }

     return 0;
}

Measured memory_bytes: 596
#include <algorithm>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

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

using namespace std;

typedef long long ll;

int h, w;
char grid[30][30];
int ans;

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

void dfs(int x, int y) {
  grid[y][x] = '#';
  ans++;
  for (int i = 0; i < 4; i++) {
    int nx = x + dx[i];
    int ny = y + dy[i];
    if (nx < 0 || ny < 0 || nx >= w || ny >= h ) {
      continue;
    }
    if ( grid[ny][nx] == '#' ) {
      continue;
    }
    dfs(nx, ny);
  }
}

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

  int sx, sy;

  while ( true ) {
    cin >> w >> h;

    if (w == 0 && h == 0) { break; }

    rep(y, h) {
      cin >> grid[y];
    }

    rep(y, h) {
      rep(x, w) {
        if (grid[y][x] == '@') {
          sx = x; sy = y;
        }
      }
    }
    ans = 0;
    dfs(sx, sy);
    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 3140
a, b, c, d = map(int, input().split())

if b <= c or d <= a:
    print(0)
elif a >= c and b <= d:
    print(b - a)
elif a <= c and b >= d:
    print(d - c)
elif a >= c and b >= d:
    print(d - a)
elif a <= c and b <= d:
    print(b - c)


Measured memory_bytes: 38384
#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main(){
	string str,command,p;
	string X="print",Y="reverse",Z="replace";
	int q,a,b,i,j;
	char w;
	cin >> str;
	cin >> q;
	for(i=0;i<q;i++){
		cin >> command >> a >> b;
		if(command == X){
			for(j=a;j<=b;j++){
				cout << str[j];
			}
			cout << endl;
		}else if(command == Y){
			for(j=0;j<(b-a)/2+1;j++){
				w=str[a+j];
				str[a+j]=str[b-j];
				str[b-j]=w;
			}
		}else if(command == Z){
			cin >> p;
			for(j=a;j<=b;j++) str[j]=p[j-a];
		}
	}
	return 0;
}

Measured memory_bytes: 1216
program digit
implicit none
integer n, k, ik
integer i
!
! input
read *, n, k
!
!
i=1
ik=1
do
  ik=k*ik
  if(n-ik>=0) then
    i = i + 1
  else
    exit
  end if
end do
!
! output
print '(i0)', i
end program

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,ans=0;
  scanf("%d%d",&a,&b);
  if(a>=13){
    ans=b;
  }
  else if(a<=5){
    ans=0;
  }
  else{
    ans=b/2;
  }
  printf("%d\n",ans);
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    int cur = 1;
    for (auto x : v) {
        if (x == cur) {
            cur++;
        }
    }
    if (cur == 1) {
        cout << -1 << endl;
    } else {
        cout << n - cur + 1 << endl;
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 998244353
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

using namespace std;

int main(){

    int n;

    cin >> n;

    int ans = 0;

    for(int i = 1; i <= 50000; i++){
        double tmp = 1.08 * i;
        if(((int)tmp) == n){
            ans = i;
            break;
        }
    }

    if(ans == 0){
        cout << ":(" << endl;
    }else{
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

const int N =259;

int main(void)
{
   char a[N],b[N];
   int k =0 ,go=0;
   
   while(fgets(a,259,stdin))
   {
   	int c = strlen(a)-1;
   	
   	for(int i=c ,j =0 ;j<c ;i++,j++)
   	{
   		a[i]=a[j];
	}
	
   	fgets(b ,259 ,stdin);
   	for(int i =0 ;i<strlen(a) ; i++)
   	{
   		k =0;
   	   for(int j =0 ;j<strlen(b)-1 ; j ++)
   	   {
   		if(a[i+j]==b[j])
   		{
   			k++;
		}
		else
		{
			break;
		}   
      	}
     
		if(k==strlen(b)-1)
		{
			go =1;
			break;
	    }
    }
	if(go==1)
	{
		printf("Yes\n");
	}
    else
    {
    	printf("No\n");
	}
   	
   }
   
}


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

int main(){
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int dx = x1 - x2;
    int dy = y1 - y2;
    int x3,x4,y3,y4;
    x3 =x2+dy;
    y3 =y2-dx;
    x4 =x3+dx;
    y4 =y3+dy;
    cout <<x3 <<" " <<y3 <<" " <<x4 <<" " <<y4 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

#define rep(var, n) for(int var = 0;var < n;var++)
using namespace std;

int main() {
  while(true) {
    int R, C;
    cin >> R >> C;
    if(R == 0 && C == 0) break;

    vector< vector<int> > field(R, vector<int>(C));

    rep(i, R) {
      rep(j, C) {
        cin >> field[i][j];
      }
    }

    int ans = -1;

    int n = pow(2, R);
    rep(i, n) {
      vector< vector<int> > field2 = field;

      int num_of_one = 0;
      rep(j, R) {
        rep(k, C) {
          if((i >> j) & 1) field2[j][k] = 1 - field2[j][k];

          if(field2[j][k] == 1) num_of_one++;
        }
      }

      int flip_to = num_of_one > (R * C) ? 1 : 0;

      int num = 0;
      rep(i, C) {
        int num_col = 0;
        rep(j, R) {
          if(field2[j][i] == flip_to) {
            num_col++;
          }
        }

        if(num_col <= R / 2) {
          rep(j, R) {
            field2[j][i] = 1 - field2[j][i];
          }
          num_col = R - num_col;
        }

        num += num_col;
      }

      ans = max(ans, num);
    }

    cout << ans << endl;
  }
}

Measured memory_bytes: 2068
#include<stdio.h>
int main()
{
 int a,b,c;

 scanf("%d%d%d",&a,&b,&c);
 if((a>=b)&&(a>=c))
 {
    if(b>=c)
    {

    printf("%d %d %d\n",c,b,a);
    }
    else
    {

     printf("%d %d %d\n",b,c,a);
    }
 }
 else if((b>=a)&&(b>=c))
 {
    if(a>=c)
    {

   printf("%d %d %d\n",c,a,b);
    }
    else
    {

     printf("%d %d %d\n",a,c,b);
    }
 }
 else if((c>=a)&&(c>=b))
 {
  if(a>=b)
  {

     printf("%d %d %d\n",b,a,c);
  }
  else
  {

     printf("%d %d %d\n",a,b,c);
  }
}
}


Measured memory_bytes: 2104
using System;

namespace ITP1_4_B
{
	class Program
	{
		static void Main(string[] args)
		{
			double r = double.Parse(Console.ReadLine());
			const double PI = 3.1415926535897932384626433832795;

			double area = r * r * PI;
			double len = 2 * PI * r;

			Console.WriteLine($"{area:f6} {len:f6}");
		}
	}
}



Measured memory_bytes: 17960
n = int(input())
xn = list(map(int, input().split()))
xsort = sorted(xn)
a, b = xsort[n//2-1:n//2+1]
if a == b:
  for _ in range(n):
    print(a)
else:
  for x in xn:
    if x <= a:
      print(b)
    else:
      print(a)


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    string c;
    int a, b;
    stack<int> s;
    while (cin >> c)
    {
        if (c == "+")
        {
            a = s.top();
            s.pop();
            b = s.top();
            s.pop();
            s.push(a + b);
        }
        else if (c == "-")
        {
            b = s.top();
            s.pop();
            a = s.top();
            s.pop();
            s.push(a - b);
        }
        else if (c == "*")
        {
            a = s.top();
            s.pop();
            b = s.top();
            s.pop();
            s.push(a * b);
        }
        else
        {
            s.push(stoi(c));
        }
    }
    OP(s.top());
    return 0;
}



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

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

  cout << max(0, A - 2 * B) << endl;
  return 0;
}

Measured memory_bytes: 3644
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/24 11:32:32 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>
// #include <boost/multi_array.hpp>
// #include <boost/optional.hpp>
// #include <boost/range/irange.hpp>
// #include <boost/range/algorithm.hpp>
// #include <boost/range/adaptors.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// #include <boost/algorithm/string/classification.hpp> // is_any_of
// #include <boost/algorithm/string/split.hpp>
// #include <boost/algorithm/string/join.hpp>
// #include <boost/algorithm/string/replace.hpp>
// #include <boost/math/tools/minima.hpp>

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

// namespace adaptor = boost::adaptors;
using namespace std;
// using boost::math::tools::brent_find_minima;
// using boost::irange;
// using boost::algorithm::join;
// using boost::algorithm::split;
// using boost::algorithm::replace_all;
// using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	bitset<500000>	bsa;
	bitset<500000>	bsb;

	int	n, m;
	cin >> n >> m;

	rep(i, m)
	{
		int x, y;
		cin >> x >> y;
		if (x == 1)
			bsa.set(y);
		if (y == n)
			bsb.set(x);
	}
	if ((bsa & bsb).any())
		cout << "POSSIBLE" << endl;
	else
		cout << "IMPOSSIBLE" << endl;

}
// END

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


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define P pair<int,int>
#define PP pair<ll,pair<int,int>>
using namespace std;
void util(vector<ll>&A,vector<ll>&arr,int k){
	int n=A.size();
	int m=arr.size();
	set<P>myset;
	priority_queue<PP>Q;
	Q.push({A[n-1]+arr[m-1],{n-1,m-1}});
	myset.insert({n-1,m-1});
	while(!Q.empty() && k--){
		ll cur_sum=Q.top().first;
		cout<<cur_sum<<"\n";
		int A_index=Q.top().second.first;
		int arr_index=Q.top().second.second;
		Q.pop();
		if(arr_index>0){
			ll left_sum=A[A_index]+arr[arr_index-1];
			if(myset.find({A_index,arr_index-1})==myset.end()){
				Q.push({left_sum,{A_index,arr_index-1}});
				myset.insert({A_index,arr_index-1});
			}
		}
		if(A_index>0){
			ll right_sum=A[A_index-1]+arr[arr_index];
			if(myset.find({A_index-1,arr_index})==myset.end()){
				Q.push({right_sum,{A_index-1,arr_index}});
				myset.insert({A_index-1,arr_index});
			}
		}
	}
}
int main(){
	int x,y,z,k;
	cin>>x>>y>>z>>k;
	vector<ll>A(x);
	vector<ll>B(y);
	vector<ll>C(z);
	for(int i=0;i<x;i++)
		cin>>A[i];
	for(int i=0;i<y;i++)
		cin>>B[i];
	for(int i=0;i<z;i++)
		cin>>C[i];
	sort(A.begin(),A.end());
	vector<ll>arr(y*z);
	int index=0;
	for(int i=0;i<y;i++){
		for(int j=0;j<z;j++){
			arr[index++]=B[i]+C[j];
		}
	}
	sort(arr.begin(),arr.end());
	util(A,arr,k);
	return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int a=0;
    string S;
    cin >> S;
    for (int i=0; i<S.size(); i++){
        if(S[i] == '1'){
            a++;
        }
    }
    cout << a << endl;
    
}

Measured memory_bytes: 256