akhauriyash/Code-Regression huggingface dataset:
// Nurbakyt Madibek
// Look at my code! IT'S AWESOME

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <unordered_set>

using namespace std;

#define pb push_back
#define pp pop_back
#define f first
#define s second
#define mp make_pair
#define sz(a) (int)((a).size())
#ifdef _WIN32
#  define I64 "%I64d"
#else
#  define I64 "%lld"
#endif
#define fname "."

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pi;
typedef pair < int, ull > pu;
typedef pair < ll, ll > pl;

const int inf = (int)1e9 + 123;
const ll infl = (ll)1e18 + 123;
const double eps = 1e-9;

const int MAX_N = (int)1e5 + 5;
const int mod = (int)1e9 + 7;

int n;
int t, e;
int x[MAX_N];

ll dp[MAX_N];

set < pl > q, r;

void add(ll x, ll y) {
    q.insert(mp(x - y, x));

    auto it = r.upper_bound(mp(x - y, infl));
    if (it != r.begin()) {
        it--;
        if (it -> s <= y)
            return;
    }
    
    while(1) {
        auto it = r.lower_bound(mp(x - y, -inf));
        if (it != r.end() && it -> s >= y) {
            r.erase(it);
        } else {
            break;
        }
    }
    r.insert(mp(x - y, y));
}

ll findF(ll x) {
    auto it = q.lower_bound(mp(x, -inf));
    if (it != q.end())
        return it -> s;
    return infl;
}

ll findS(ll x) {
    auto it = r.lower_bound(mp(x, -inf));
    if (it != r.begin()) {
        it--;
        return it -> s;
    }
    return infl;
}

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    scanf("%d%d%d", &n, &e, &t);
    for (int i = 1; i <= n; i++)
        scanf("%d", &x[i]);
    x[0] = dp[0] = 0;
    for (int i = 1; i <= n; i++)
        dp[i] = infl;
    
//    for (int i = 0; i < n; i++) {
//        for (int j = i + 1; j <= n; j++) {
//            ll now = max(dp[i] + x[j] - x[i] + t, dp[i] + x[j] - x[i] + 2ll * (x[j] - x[i + 1]));
//            dp[j] = min(dp[j], now);
//        }
//    }
    
    add(dp[0] - x[0] + t, dp[0] - x[0] - 2ll * x[1]);
    
    for (int i = 1; i <= n; i++) {
        dp[i] = min(findF(2ll * x[i]) + x[i], findS(2ll * x[i]) + 3ll * x[i]);

        if (i != n)
            add(dp[i] - x[i] + t, dp[i] - x[i] - 2ll * x[i + 1]);
    }

    printf("%lld\n", dp[n] + e - x[n]);
    return 0;
}


Measured memory_bytes: 13952
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long n=sc.nextLong();
        long a=sc.nextLong();
        long b=sc.nextLong();
        long rem=n%(a+b)<a?n%(a+b):a;
        long res=n/(a+b)*a+rem;
        System.out.println(res);
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;

const ll MOD = 1e9+7;

int main()
{
	int n;
	int l;
	ll now=1e8-1;
	ll tar=0;
	ll ans=-1;
	cin>>n>>l;
	for(int i=1;i<n+1;i++)
		tar+=l+i-1;
	for(int i=1;i<n+1;i++)
	{
		ll tmp=0;
		for(int j=1;j<n+1;j++)
		{
			if(i==j)
				continue;
			tmp+=l+j-1;
		}
		if(now>abs(tar-tmp))
		{
			now=abs(tar-tmp);
			ans=tmp;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int a,b,c,d,p;
	cin>>a>>b>>c>>d>>p;
	if(p>c){
		cout<<min(a*p,(p-c)*d+b)<<endl;
	}
	else{
		cout<<min(a*p,b)<<endl;
	}
	return 0;
}


Measured memory_bytes: 3100
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

ans = 0

for i in range(1, N+1):
	if len(str(i))%2 == 1:
		ans += 1
print(ans)

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

void comb(vector<vector <long long int> > &v) {
	for (int i = 0;i <v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1;k <v.size();k++) {
		for (int j = 1;j<k;j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}

int main(){
	int n, p;
	cin >> n >> p;
	vector<int>a(n);
	int count[2];
	count[0] = 0;
	count[1] = 0;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		count[a[i] % 2]++;
	}
	vector<vector<long long int> > v(count[1] + 1, vector<long long int>(count[1] + 1, 0));
	comb(v);

	ll ans[2];
	ans[0] = 0;
	ll pc0 = (ll)pow(2, count[0]);
	for (int i = 0;i <= count[1];i += 2) {
		ans[0] += pc0 * v[count[1]][i];
	}
	ans[1] = (ll)pow(2, n) - ans[0];
	cout << ans[p] << endl;



	return 0;
}

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main(void){
    int N;
    scanf("%d",&N);

    int prime[25]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};

    int prime_factor[25]={};
    for(int i=2;i<=N;i++){
        int n=i;
        for(int j=0;j<25;j++){
            while(n%prime[j]==0){
                prime_factor[j]++;
                n=n/prime[j];
            }
        }
    }

    int ans=0;

    //p^74を探す
    for(int i=0;i<25;i++){
        if(prime_factor[i]>=74) ans++;
    }

    //p^14+q^4 or p^2+q^24を探す
    for(int i=0;i<24;i++){
        for(int j=i+1;j<25;j++){
            if(prime_factor[i]>=14 && prime_factor[j]>= 4) ans++;
            if(prime_factor[i]>= 4 && prime_factor[j]>=14) ans++;
            if(prime_factor[i]>= 2 && prime_factor[j]>=24) ans++;
            if(prime_factor[i]>=24 && prime_factor[j]>= 2) ans++;
        }
    }

    //p^2+q^4+r^4 を探す
    for(int i=0;i<23;i++){
        for(int j=i+1;j<24;j++){
            for(int k=j+1;k<25;k++){
                if(prime_factor[i]>=2 && prime_factor[j]>=4 && prime_factor[k]>=4) ans++;
                if(prime_factor[i]>=4 && prime_factor[j]>=2 && prime_factor[k]>=4) ans++;
                if(prime_factor[i]>=4 && prime_factor[j]>=4 && prime_factor[k]>=2) ans++;
            }
        }
    }

    printf("%d\n",ans);

    return 0;
}

//75=3*5*5
//n=p^2+q^4+r^4 or p^14+q^4 or p^2+q^24 or p^74

Measured memory_bytes: 128
import sys
input = sys.stdin.readline
from math import sqrt


def Eratosthenes(n):
    """n(>=6)未満の素数列挙 """
    n, correction = n - n % 6 + 6, 2 - (n % 6 > 1)
    sieve = [True] * (n // 3)
    for i in range(1, int(sqrt(n)) // 3 + 1):
        if sieve[i]:
            k = 3 * i + 1 | 1
            sieve[k * k // 3::2 * k] = [False] * ((n // 6 - k * k // 6 - 1) // k + 1)
            sieve[k * (k - 2 * (i & 1) + 4) // 3::2 * k] = [False] * ((n // 6 - k * (k - 2 * (i & 1) + 4) // 6 - 1) // k + 1)
    s = [False] * n
    for i in range(1, n // 3 - correction):
        if sieve[i]:
            s[3 * i + 1 | 1] = True
    s[2] = True
    s[3] = True
    return s


sieve = Eratosthenes(10 ** 5 + 1)
ans = [0] * (10 ** 5 + 1)
for i in range(3, 10 ** 5, 2):
    if sieve[i] and sieve[(i + 1) // 2]:
        ans[i] += 1
for i in range(3, 10 ** 5):
    ans[i + 1] += ans[i]
q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(ans[r] - ans[l - 1])


Measured memory_bytes: 12952
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
long power(long x, long m){
    if(m == 0) return 1;
    long y = power(x, m/2);
    y = y * y;
    if(m&1) y = y * x;
    return y;
}
long l2(long z){
    long a=1,e=0;
    while(a<z){
        a*=2;
        e++;
    }
    return e;
}
long long n,i,c,p,s,lg;
int main(){
    cin>>n;
    cin>>c;
    p=l2(c);
    s=s+p;
    for(i=1;i<n;i++){
        cin>>c;
        lg=l2(c);
        if(c==1){
            p=0;
        }
        else if(p>=lg){
            if(c-power(2,lg)==0){
                p=lg;
            }
            else{
                p=lg-1;
            }
        }
        else{
            s=s+lg-p;
            p=lg;
        }
    }
    cout<<s;
}

Measured memory_bytes: 384
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<ll, ll>
#define pll pair<ll, ll>
#define pli pair<ll, ll> 
#define pdd pair<ld, ld> 
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 1000000007
using namespace std;

int main(){
	FASTIO
	ll n, d;
	cin >> n >> d;
	ll c = 0;
	while(n--){
		ll x, y;
		cin >> x >> y;
		if(x*x + y*y <= d*d)
			c++;
	}
	cout << c;
    return 0;
}

Measured memory_bytes: 3640
x,y = map(int, input().split())
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
if x in a and y in a:
    print('Yes')
elif x in b and y in b:
    print('Yes')
elif x ==2 and y ==2:
    print('Yes')
else:
    print('No')

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

signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    //cout<<"I must do it...Yeahhh";
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        double l;
        cin>>l;
        double s=l/3;
        //cout<<(fixed)<<s<<' ';
        cout<<(fixed)<<setprecision(9)<<s*s*s;
        //cout<<' '<<(fixed)<<s*s*s;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))


int main(){
	ll N;
	cin >> N;
	vector<ll> C(N);
	FOR(i,0,N) cin >> C[i];
	SORT(C);

	vector<ll> two(N+2,1);

	FOR(i,1,N+1) two[i] = (two[i-1]*2) % MOD;

	ll ans = 0;
	FOR(i,0,N){
		ll l = i;
		ll r = N-1-l;
		ans += (two[r] + two[r-1]*r % MOD) % MOD * two[l] % MOD * C[i];
		ans %= MOD;
	}
	ans *= two[N];
	cout << ans%MOD << endl;

}



Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        int l[] = new int[t];
        int sg = 0;
        for(int i = 0; i < t; i++) {
            l[i] = sc.nextInt();
            sg += l[i];
        }
        int m = max(l);
        sg -= l[m];
        if(sg > l[m]) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }

    }

    private static int max(int[] a) {
        int maxi = 0;
        for(int i = 0; i < a.length; i++) {
            if(a[maxi] < a[i]) {
                maxi = i;
            }
        }
        return maxi;
    }


}


Measured memory_bytes: 23124
#include <iostream>
#include <string>

using namespace std;

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

// カードを格納
string s[3];

// A, B, Cのカードの配列の位置
int ap, bp, cp;

int game(int participant) {
  if (participant == 0) {
    ap++;
    // 勝利条件
    if (!s[participant][ap]) {
      return participant;
    } else {
      return game(s[participant][ap] - 97);
    }
  } else if (participant == 1) {
    bp++;
    // 勝利条件
    if (!s[participant][bp]) {
      return participant;
    } else {
      return game(s[participant][bp] - 97);
    }
  } else {
    cp++;
    // 勝利条件
    if (!s[participant][cp]) {
      return participant;
    } else {
      return game(s[participant][cp] - 97);
    }
  }
}

int main() {
  // 勝った人を表す
  int win;
  // カードのイテレータの初期値
  ap = -1;
  bp = -1;
  cp = -1;

  // 手札の入力
  for (int i = 0; i < 3; i++) {
    cin >> s[i];
  }

  /* 勝者を判定する
  　　参加者は0, 1, 2で表す
  　　A -> 0
  　　B -> 1
  　　C -> 2
  */
  ap++; // ゲーム開始
  win = game(0);
  char winner = win + 65;

  cout << winner << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

a.sort(reverse=True)

ans=0

if n%2==0:
    for i in range(1,n//2):
        ans=ans+a[i-1]
    for i in range(n//2,n-1):
        ans=ans+a[i-n//2+1]
    ans=ans+a[n//2-1]
    print(ans)

else:
    for i in range(1,n//2):
        ans=ans+a[i-1]
    for i in range(n//2,n-1):
        ans=ans+a[i-n//2+1]
    ans=ans+a[n//2-1]
    print(ans)

Measured memory_bytes: 94080
#include <stdio.h>

int main(void)
{
    int i = 1;
    int n;
    scanf("%d", &n);

    while (1) {
        int x = i;
        if (x % 3 == 0) {
            printf(" %d", i);
        } else {
            while (x) {
                if (x % 10 == 3) {
                    printf(" %d", i);
                    break;
                }
                x /= 10;
            }
        }
        if (++i > n) {
            break;
        }
    }
    printf("\n");
    return 0;
}

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

using namespace std;
typedef long long LL;

int hcnt[300005] = {};
int wcnt[300005] = {};
vector<int> hp, wp;

map<pair<int, int>, int> coors;

int main() {
    int h, w;
    cin >> h >> w;
    int m;
    cin >> m;
    int hm = 0, wm = 0;
    for (int i = 0; i < m; ++i) {
        int hh, ww;
        scanf("%d%d", &hh, &ww);

        hm = max(++hcnt[hh], hm);
        wm = max(++wcnt[ww], wm);
        coors.insert({{hh, ww},  0});
    }

    for (int i = 1; i <= h; ++i) {
        if (hm == hcnt[i])
            hp.push_back(i);
    }

    for (int j = 1; j <= w; ++j) {
        if (wm == wcnt[j])
            wp.push_back(j);
    }
    int ans = 0;
    for (int i : hp) {
        for (int j : wp) {
            ans = max(ans, hm + wm - (coors.count({i, j}) ? 1:0));
            if(ans == hm + wm) break;
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 28624
def main():
    n, m = list(map(int, input().split()))
    connect_1 = set()
    connect_n = set()
    for _ in range(m):
        a, b = list(map(int, input().split()))
        if a == 1:
            connect_1.add(b)
        elif b == n:
            connect_n.add(a)
        else:
            pass
    if connect_1.isdisjoint(connect_n):
        print('IMPOSSIBLE')
    else:
        print('POSSIBLE')

if __name__ == '__main__':
    main()


Measured memory_bytes: 58584
#include<iostream>
#include<vector>
#include<map>
#define rep(i, n) for(int i=0;i<n;i++)
#define rrep(n) for(int i=n-1;i>=0;i--)
using namespace std;
using ll = long long int;

int n;
vector<int> a, b, ret;
vector<int>memo;

bool remove() {
	while (b.size() > 0) {
		bool ef = false;
		for (int i = b.size() - 1; i >= 0; i--) {
			if (b[i] == i + 1) {
				ret.insert(ret.begin(), b[i]);
				b.erase(b.begin() + i);
				ef = true;
				break;
			}
		}
		if (!ef) {
			return false;
		}
	}
	return true;
}

int main(void) {
	cin >> n;
	b = vector<int>(n);
	memo = vector<int>(n + 1, 0);
	rep(i, n) {
		cin >> b[i];
		memo[b[i]]++;
	}
	if (remove()) {
		rep(i, n) {
			cout << ret[i] << endl;
		}
	}
	else {
		cout << "-1" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    vi a(n),b(n);
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];
    int ans = INF;
    rep(bit,1<<n){
        vp v(n,pii(0,0));
        int cnt = 0;
        rep(i,n){
            if((1 << i)&bit){
                v[i].first = b[i];
                v[i].second = 1;
                cnt++;
            }else{
                v[i].first = a[i];
                v[i].second = 0;
            }
        }
        //if(cnt%2)continue;
        //rep(i,n)cout << " " << v[i].first;cout << endl;
        //rep(i,n)cout << " " << v[i].second;cout << endl;
        cnt = 0;
        rep(i,n)rep(j,n-1)if(v[j].first > v[j+1].first){
            swap(v[j],v[j+1]);
            cnt++;
            v[j].second ^= 1;
            v[j+1].second ^= 1;
        }
        rep(i,n-1){
          if(v[i].first == v[i+1].first && v[i].second && v[i+1].second){
            v[i].second ^= 1;
            v[i+1].second ^= 1;
            cnt++;
          }else if(i+2<n && v[i].first == v[i+2].first && v[i].second && !v[i+2].second){
            v[i].second ^= 1;
            v[i+2].second ^= 1;
            cnt+=2;
          }
        }
        bool c = true;
        rep(i,n){
            if(v[i].second)c = false;
        }
        if(c == false)continue;
        //cout << bit << " " << cnt << endl;
        ans = min(ans, cnt);
    }
    if(ans == INF)cout << -1 << endl;
    else cout << ans << endl;
}


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

int a[100010],n,k,pos,ans=0x3f3f3f3f;

int gg(int a,int b)
{
	int xx=a%b==0?a/b:a/b+1;
	return xx;
}

int main()
{
	scanf("%d%d",&n,&k);
	if(n==1&&k==1)
	{
		puts("0");
		return 0;
	}
	if(n==k)
	{
		puts("1");
		return 0;
	}
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]==1)
		{
			pos=i;
		}
	}
	for(int i=0;i<=k-1;i++)
	{
		int l=pos-k+i+1;
		int r=pos+i;
		if(l>=1&&r<=n) 
		    if(ans>gg(l-1,k-1)+gg(n-r,k-1)+1)
		    {
		    	ans=gg(l-1,k-1)+gg(n-r,k-1)+1;
			}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int N;
  cin>>N;
  vector<int> A(N),B(N),C(N),D(N);
  for(int i=0;i<N;i++){
    cin>>A[i]>>B[i];
    C[i]=A[i]+B[i];
    D[i]=A[i]-B[i];
  }
  sort(C.begin(),C.end());
  sort(D.begin(),D.end());
  cout<<max(C[N-1]-C[0],D[N-1]-D[0])<<endl;
}

Measured memory_bytes: 9592
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		if (A>=13) {
			System.out.println(B);
		} else if (A>=6) {
			System.out.println(B/2);
		} else {
			System.out.println(0);
		}
	}
}

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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	// debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, left, right)  (a).begin()+(left),(a).begin()+(right)	// left to (right-1)


int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	FOR(i, 0, n - 1) {
		cin >> a[i];
	}
	ll sum = accumulate(ALL(a), 0LL);
	ll minsa = LINF;
	ll left = 0;
	ll right;
	FOR(i, 0, n - 2) {
		left += a[i];
		right = sum - left;
		minsa = min(minsa, abs(left - right));
	}
	pv(minsa)
	return 0;
}

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

int main (){
   string s;
   cin >> s;
   int ans = 700;
   for(int i=0; i<s.size(); i++){
      if(s[i] == 'o'){
         ans += 100;
      }
   }
   cout << ans << endl;
}
     

Measured memory_bytes: 256
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

a = l()
a.sort()
for i in range(len(a)-1):
    ans += abs(a[i+1]-a[i])

print(ans)


Measured memory_bytes: 10452
from typing import List, Any


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))


def solve() -> Any:
    s = input().strip()
    if s.endswith('s'):
        return s+'es'
    return s+'s'


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


Measured memory_bytes: 69140
fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(" ")
    val num = (a+b).toInt()
    for(i in 1 until num / 2) {
        if(num % i === 0) {
            if(num === (num / i) * (num / i)) {
                print("Yes")
                return
            }
        }
    }
    print("No")
}

Measured memory_bytes: 37740
#include<cstdio>
#include<iostream>
#include<cstring>
#define maxn 200005
int a[maxn];
using namespace std;
int main(void)
{
	int n;
	scanf("%d",&n);
	int sum=0;
	for(int i=0;i<n;++i)
	{
		scanf("%d",&a[i]);
		sum^=a[i];
	}
	for(int i=0;i<n-1;++i)
	{
		printf("%d ",sum^a[i]);
	}
	printf("%d\n",sum^a[n-1]);
	
	return 0;
}

Measured memory_bytes: 3828
n=int(input())
lst=[]
for i in range(n):
    a=list(map(int,input().split()))
    if a[2]!=0:lst.append(a)
if len(lst)==1:
    print(*lst[0])
    exit()
for i in range(101):
    for j in range(101):
        h=abs(i-lst[0][0])+abs(j-lst[0][1])+lst[0][2]
        for k in lst[1:]:
            if h!=abs(i-k[0])+abs(j-k[1])+k[2]:break
        else:
            print(i,j,h)
            exit()

Measured memory_bytes: 3064
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		double a,b,C;
		a = Double.parseDouble(scan.next());
		b = Double.parseDouble(scan.next());
		C = Double.parseDouble(scan.next());
		//?§???????????????¢???????????????toRadians()????????¨
		C = Math.toRadians(C);
		
		//??¢???????±???????
		//??¢??????a * ??????(h) / 2.0
		Double Area = a * (Math.sin(C) * b) / 2.0;
		BigDecimal bd = new BigDecimal(Area);
		//System.out.println(bd.setScale(8, BigDecimal.ROUND_DOWN));
		System.out.println(Area);
		
		//??¨?????????????±???????
		//??????a - (cos(c) * b)???+b??????
		Double length = a + b + Math.sqrt(Math.pow((a - (Math.cos(C) * b)), 2.0) + Math.pow((Math.sin(C) * b), 2.0));
		BigDecimal bd2 = new BigDecimal(length);
		//System.out.println(bd2.setScale(8, BigDecimal.ROUND_DOWN));
		System.out.println(length);
		
		//??????????±???????
		//sin(c) * b
		Double height = Math.sin(C) * b;
		BigDecimal bd3 = new BigDecimal(height);
		//System.out.println(bd3.setScale(8, BigDecimal.ROUND_DOWN));
		System.out.println(height);
		
	}
}

Measured memory_bytes: 26700
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647
// MAX O(n) 10^18

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

    string x = "";
    rep(i, b) {
        x += to_string(a);
    }

    string y = "";
    rep(i, a) {
        y += to_string(b);
    }

    if(x < y) {
        cout << x << endl;
    } else {
        cout << y << endl;
    }

    return 0;
}


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

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

ll calc_score(ll D, const vector<ll> &c, const vector<vector<ll>> &s, const vector<ll> &t) {
  vector<ll> last(26, -1);
  ll score = 0;
  REP(d, D) {
    ll i = t[d];
    score += s[d][i];
    last[i] = d;
    REP(j, 26) {
      score -= c[j] * (d - last[j]);
    }
  }
  return score;
}

ll area(ll D, ll d, const vector<ll> &t, ll target) {
  ll l = -1;
  for (int i = d - 1; i >= 0; i--) {
    if (t[i] == target) {
      l = i;
      break;
    }
  }
  ll r = D;
  FOR(i, d + 1, D) {
    if (t[i] == target) {
      r = i;
      break;
    }
  }
  ll x = r - d;
  ll y = d - l;
  return x * y;
}

ll calc_diff(ll D, ll pre, ll next, const vector<ll> &c, const vector<vector<ll>> &s, ll d, const vector<ll> &t) {
  ll diff = s[d][next] - s[d][pre];
  diff += c[next] * area(D, d, t, next);
  diff -= c[pre] * area(D, d, t, pre);
  return diff;
}

void solve(ll D, vector<ll> c, vector<vector<ll>> s) {
  vector<ll> t(D, 0);
  REP(d, D) {
    ll m = 0;
    ll cur = 0;
    FOR(i, 1, c.size()) {
      t[d] = i;
      ll diff = calc_diff(d + 1, 0, i, c, s, d, t);
      if (diff > m) {
        m = diff;
        cur = i;
      }
    }
    t[d] = cur;
  }
  REP(d, D) {
    cout << t[d] + 1 << "\n";
  }
}

int main() {
  ll D;
  scanf("%lld", &D);
  vector<ll> c(26);
  for (int i = 0; i < 26; i++) {
    scanf("%lld", &c[i]);
  }
  vector<vector<ll>> s(D, vector<ll>(26));
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < 26; j++) {
      scanf("%lld", &s[i][j]);
    }
  }
  solve(D, move(c), move(s));
  return 0;
}


Measured memory_bytes: 3792
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var XAB = ReadSplitInt();
            var X = XAB[0];
            var A = XAB[1];
            var B = XAB[2];

            if (A >= B) Println("delicious");
            else if (A < B && X - (B - A) < 0) Println("dangerous");
            else Println("safe");
        }


        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YesOrNo(bool e)
        {
            if (e) Println("Yes");
            else Println("No");
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 13268
package main

import (
	"fmt"
)

func main() {
	var N int
	var S string
	fmt.Scan(&N, &S)

	ans := 0
	bases := []int{100, 10, 1}
	for pin := 0; pin <= 999; pin++ {
		i := 0
		for _, c := range S {
			if pin/bases[i]%10 == int(c-'0') {
				i++
				if i == 3 {
					ans++
					break
				}
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 896
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	string S;
	string ans;
	cin >> S;
	ans += S.front();
	ans += to_string(SZ(S) - 2);
	ans += S.back();

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long aa;bool bb;char ch;
long long scan()
{
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	ch=='-'?(bb=1,aa=0):(bb=0,aa=ch-48);
	while(ch=getchar(),(ch>='0'&&ch<='9'))
		aa=aa*10+ch-48;
	return (bb?(-aa):(aa));
}
long long fac[100010],n,m;

const long long MOD=1000000007;
long long Pow(long long u,long long v)
{
	long long ret=1;
	while(v)
	{
		if(v&1)
			ret=ret*u%MOD;
		u=u*u%MOD;
		v>>=1;
	}
	return ret;
}
long long inv(long long u)
{
	return Pow(u,MOD-2);
}

int main()
{
	fac[0]=1;
	for(int i=1;i<=100000;++i)
		fac[i]=fac[i-1]*i%MOD;
	scanf("%d%d",&n,&m);
	if(n==m)
		printf("%lld\n",fac[n]*fac[m]%MOD*2%MOD);
	else if(n==m+1||m==n+1)
		printf("%lld\n",fac[n]*fac[m]%MOD);
	else
		puts("0");
} 

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

using namespace std;

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

    int l, r, d;
    cin >> l >> r >> d;
    int s = (l + d - 1) / d * d;
    int e = r / d * d;
    cout << 1 + (e - s) / d;

    return 0;
}


Measured memory_bytes: 3580
import sys
def f(x, y, z):
    return x*x + y*y + z*z + x*y + y*z + z*x
    
N = int(input())

ans = {}
for x in range(1, 100):
    for y in range(1, x+1):
        for z in range(1, y+1):
            ret = f(x, y, z)
            delta = 0
            if ret <= N:
                if x == y and y == z:
                    delta = 1
                elif x != y and y != z and z != x:
                    delta = 6
                else:
                    delta = 3
            
                if ret not in ans:
                    ans[ret] = delta
                else:
                    ans[ret] += delta

for i in range(1, N+1):
    if i in ans:
        print(ans[i])
    else:
        print(0)

Measured memory_bytes: 9816
#ABC092C
N=int(input())
A=[0]
for x in list(map(int,input().split())):
	A.append(x)
A.append(0)
ans=0
for i in range(N+1):
	ans+=abs(A[i]-A[i+1])
for i in range(1,N+1):
	print(ans-abs(A[i-1]-A[i])-abs(A[i]-A[i+1])+abs(A[i-1]-A[i+1]))

Measured memory_bytes: 14048
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
int main()
{
    string s;
    while(cin>>s)
    {
        if(s=="SUN")cout<<7<<endl;
        else if(s=="SAT")cout<<1<<endl;
        else if(s=="FRI")cout<<2<<endl;
        else if(s=="THU")cout<<3<<endl;
        else if(s=="WED")cout<<4<<endl;
        else if(s=="TUE")cout<<5<<endl;
        else if(s=="MON")cout<<6<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c)) 
#define all(v) (v).begin(),(v).end()
typedef long long ll;
typedef unsigned long long llu;
const double PI = 2*acos(0.0);

signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int i=0,sum = 0;
	for(;i<n;i++)
	{
		sum+=a[i];
		if(sum>k)
			break;
	}
	if(sum<k)cout<<i-1<<endl;
	else cout<<i<<endl;
	return 0;
}

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

int main(){
  string s; cin>>s;
  int c1=0,c2=0;
  for(int i=0;i<s.size();i++){
    if(i%2==0){
      if(s.at(i)=='0') c1++;
    }else{
      if(s.at(i)=='1') c1++;
    }
  }for(int i=0;i<s.size();i++){
    if(i%2==1){
      if(s.at(i)=='0') c2++;
    }else{
      if(s.at(i)=='1') c2++;
    }
  }cout<<min(c1,c2)<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e12;
using Graph = vector<vector<int>>;

signed main(){
  string S;
  cin >> S;
  int N = (int)S.size();
  //dp[i][j]:i文字目まで見たときに「ABC」のj文字目まで確定している状態の組み合わせ数
  vector<vector<int>> dp(N+10, vector<int>(4, 0));
  dp[0][0] = 1;
  for( int i = 1; i <= N; i++ ){
    //その文字を選ばなかった場合
    for( int j = 0; j <= 3; j++ ){
      if( S[i-1] == '?' ) dp[i][j] = dp[i-1][j]*3;
      else dp[i][j] = dp[i-1][j];
      dp[i][j] %= MOD;
    }
    //選んだ場合
    if( S[i-1] == 'A' ){
      dp[i][1] += dp[i-1][0];
      dp[i][1] %= MOD;
    }else if( S[i-1] == 'B' ){
      dp[i][2] += dp[i-1][1];
      dp[i][2] %= MOD;
    }else if( S[i-1] == 'C' ){
      dp[i][3] += dp[i-1][2];
      dp[i][3] %= MOD;
    }else{
      for( int j = 1; j <= 3; j++ ){
        dp[i][j] += dp[i-1][j-1];
        dp[i][j] %= MOD;
      }
    }
  }
  cout << dp[N][3] << endl;


}

Measured memory_bytes: 10384
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  string s;
  cin >> s;
  int ans = 10000000;
  rep(i,s.length()-2){
    chmin(ans, abs(753 - ((s[i]-'0') * 100 + (s[i+1]-'0') * 10 + (s[i+2]-'0'))));
  }
  pri(ans);
  
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

int main()
{
    // input
    int N;
    char S[300001];
    scanf( "%d", &N );
    scanf( "%s", S );

    // process
    int sum=0;
    for ( int i=1; i<N; i++ ) {
        if ( S[i] == 'E' ) {
            sum++;
        }
    }

    int min_index = 0;
    int min = sum;
    for ( int i=1; i<N; i++ ) {
        if ( S[i-1] == 'E' and S[i] == 'E' ) {
            sum = sum - 1;
        } if ( S[i-1] == 'E' and S[i] == 'W' ) {
            sum = sum;
        } if ( S[i-1] == 'W' and S[i] == 'E' ) {
            sum = sum;
        } if ( S[i-1] == 'W' and S[i] == 'W' ) {
            sum = sum + 1;
        }
        if ( sum < min ) {
            min = sum;
            min_index = i;
        }
    }

    // output
    printf( "%d\n", min );

    return 0;
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
    int A[3];
    int count5,count7,i;
    count5 = 0;
    count7 = 0;
    cin >> A[0] >> A[1] >> A[2];
    for(i=0;i<3;i++){
        if(A[i] == 5) count5++;
        else if(A[i] == 7) count7++;
    }
    if(count5 = 2 && count7 == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

n, a, b = map(int, sys.stdin.readline().split())

def main():
    d = b - a
    if d % 2 == 0:
        return d // 2
    else:
        return min(n - b, abs(1 - a)) + 1 + (d - 1) // 2

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

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    int N,M;
    cin>>N>>M;
    vector<int> X(M);
    rep(i,M)cin>>X.at(i);
    sort(X.begin(),X.end());
    if(N>=M){
        cout<<0<<endl;
        return 0;
    }
    vector<int> sa(M-1);
    rep(i,M-1){
        sa.at(i)=X.at(i+1)-X.at(i);
    }
    sort(sa.begin(),sa.end());
    ll ans=0;
    rep(i,M-N){
        ans+=sa.at(i);
    }
    cout<<ans<<endl;
}

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

int main() {
    char target[20];
    int len;
    int i;
    
    while (scanf("%s", target) != EOF) {
        len = strlen(target);

        for (i=0; i<len; i++) {
            printf("%c", target[len-1-i]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 524
#include<iostream>
using namespace std;
int main(void)
{
  int t, n, ans = 0;
  for(int i = 0;i < 4; i++){
    cin >> t >> n;
    if(t == 1) cout << 6000 * n << endl;
    if(t == 2) cout << 4000 * n << endl;
    if(t == 3) cout << 3000 * n << endl;
    if(t == 4) cout << 2000 * n << endl;
  }
}


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

vector<ll> divisor(ll n) {
    vector<ll> res;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            if (n/i != i) res.push_back(n/i);
        }
    }
    return res;
}

int main() {
    ll n;
    cin >> n;
    const auto &res = divisor(n);
    const auto &res_ = divisor(n-1);
    
    ll ans = res_.size() -1;
    for (int i = 0; i < res.size(); ++i){
      ll n_0 = n;
      if(res[i]==1) continue;
      while(n_0%res[i]==0) n_0 /= res[i];
      if(n_0%res[i]==1) ans++;
    }
      
    cout << ans << endl;
}


Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (a != c){
    cout << 1 << endl;
  }else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        var S = Console.ReadLine();
        int cost = 700;
        for (int i = 0; i < 3; i++)
        {
            if (S[i] == 'o')
            {
                cost += 100;
            }
        }
        Console.WriteLine(cost);
    }
}

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

int main() {
  string str;
  
  while(getline(cin, str)) {
    if(str == ".") break;

    string s;
    for(unsigned i=0; i<str.size(); i++)
      if(str[i]=='(' || str[i]==')' || str[i]=='[' || str[i]==']')
	s.push_back(str[i]);
    
    stack<char> st;
    bool ok = 1;
    for(int i=0; i<s.size(); i++) {
      if(s[i] == '(') st.push(s[i]);
      if(s[i] == '[') st.push(s[i]);
      
      if(s[i] == ')') {
	if(st.empty()) { ok = 0; break; }
	if(st.top() != '(') { ok = 0; break; }
	st.pop();
      }
      
      if(s[i] == ']') {
	if(st.empty()) { ok = 0; break;	}
	if(st.top() != '[') { ok = 0; break; }
	st.pop();
      }
    }
    cout << ( ok && st.empty() ? "yes" : "no" ) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1180
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

using Cons = System.Console;

class PriorityQueue<T>
{
    private readonly List<T> m_list;
    private readonly Func<T, T, int> m_compare;
    private int m_count;
    public PriorityQueue(int capacity, Func<T, T, int> compare)
    {
        m_list = new List<T>(capacity);
        m_compare = compare;
        m_count = 0;
    }
    private int Add(T value)
    {
        if (m_count == m_list.Count)
        {
            m_list.Add(value);
        }
        else
        {
            m_list[m_count] = value;
        }
        return m_count++;
    }
    private void Swap(int a, int b)
    {
        T tmp = m_list[a];
        m_list[a] = m_list[b];
        m_list[b] = tmp;
    }
    public void Enqueue(T value)
    {
        int c = Add(value);
        while (c > 0)
        {
            int p = (c - 1) / 2;
            if (m_compare(m_list[c], m_list[p]) < 0) { Swap(p, c); } else { break; }
            c = p;
        }
    }
    public T Dequeue()
    {
        T value = m_list[0];
        m_list[0] = m_list[--m_count];
        int p = 0;
        while (true)
        {
            int c1 = p * 2 + 1;
            int c2 = p * 2 + 2;
            if (c1 >= m_count) { break; }
            int c = (c2 >= m_count || m_compare(m_list[c1], m_list[c2]) < 0) ? c1 : c2;
            if (m_compare(m_list[c], m_list[p]) < 0) { Swap(p, c); } else { break; }
            p = c;
        }
        return value;
    }
}
static class Input
{
    public static long SingleLong()
    {
        return long.Parse(Console.ReadLine());
    }

    public static List<long> Longs()
    {
        return Console.ReadLine().Split(' ').Select(str => long.Parse(str)).ToList();
    }
}
static class Output
{
    public static void SingleLong(long l)
    {
        Cons.WriteLine(l);
    }

    public static void Longs(List<long> list)
    {
        Cons.WriteLine(string.Join(" ", list));
    }
}

class Program
{
    static int Main(string[] args)
    {
        var sw = new StreamWriter(Cons.OpenStandardOutput()){AutoFlush = false};
        Cons.SetOut(sw);

        int ret = Solve();
        Cons.Out.Flush();

        return ret;
    }

    static int Solve()
    {
        var list = Input.Longs();
        var k = list[0];
        var old_k = k;
        var ans = 0L;
        var a = list[1];
        var b = list[2];
        if((b - a) <= 2)
        {
            Cons.WriteLine(k+1);
            return 0;
        }
        k -= (a-1);
        if(k <= 0){
            Cons.WriteLine(old_k + 1);
            return 0;
        }
        ans = a;
        #if DBG
        Cons.WriteLine(ans);
        #endif
        if(k % 2 == 1)
        {
            ans++;
            k--;
        }
        ans += (k / 2) * (b - a);
        Cons.WriteLine(ans);

        return 0;
    }
}

Measured memory_bytes: 13396
N = int(input())
H = list(map(int, input().split()))
pval = max(H)
f = 1
for h in reversed(H):
  if (pval + 1 < h):
    print("No")
    f = 0
    break
  if (pval + 1 == h):
    pval = h - 1
  else:
    pval = h
if(f):
  print("Yes")

Measured memory_bytes: 15020
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main(){
  long long n, k; cin >> n >> k;
  vector<int> v(n);
  for(int i = 0; i < n; ++i) cin >> v[i];
  long long ans = 0;
  for(int i = 0; i < n; ++i){
    for(int j = i + 1; j < n; ++j){
      if(v[i] == v[j]) continue;
      if(v[i] > v[j]) ans += (k * (k + 1) / 2) % mod;
      else ans += (k * (k - 1) / 2) % mod; 
      ans %= mod;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256