akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <ctype.h>
int main(void)
{
    char ch;
    int num, i;
    int counter[26] = {0};
    while (scanf("%c", &ch) != EOF)
    {
        if (isupper(ch))
        {
            num = ch - 'A';
        }
        else if (islower(ch))
        {
            num = ch - 'a';
        }
        else
        {
            continue;
        }
        counter[num]++;
    }
    for (i = 0; i < 26; i++)
    {
        printf("%c : %d\n", i + 'a', counter[i]);
    }
    return 0;
}


Measured memory_bytes: 2036
import kotlin.math.sqrt

fun main() {
    val N = readLine()!!.toLong()

    val map = mutableMapOf<Long, Long>()
    for (p in 2..N) {
        var P = p
        for (q in 2..sqrt(p.toDouble()).toLong()) {
            if (P % q != 0L) {
                continue
            }
            if (!map.containsKey(q)) {
                map[q] = 0
            }
            while (P % q == 0L) {
                P /= q
                map[q] = map[q]!! + 1
            }
        }
        if (!map.containsKey(P)) {
            map[P] = 0
        }
        if (P != 1L) {
            map[P] = map[P]!! + 1
        }
    }

    var cnt = 1L
    for (i in map.values) {
        cnt *= i + 1
        cnt %= (1e9.toLong() + 7)
    }
    println(cnt)
}


Measured memory_bytes: 35140
#include<bits/stdc++.h>
using namespace std;
int main(){
	int k,s,ans=0;
	cin>>k>>s;
	for(int x=0;x<=k;x++){
		for(int y=0;y<=k;y++){
			if(s-x-y>=0&&s-x-y<=k){
				ans++;
			}
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

ll dp[105][5][2];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int k;
    cin >> s >> k;
    int n = s.size();
    dp[0][0][0] = 1;
    rep(i,n)rep(j,4)rep(l,2){
        int nd = s[i] - '0';
        rep(d,10){
            int ni = i+1, nj = j, nl = l;
            if(d != 0) nj++;
            if(nj > k) continue;
            if(l == 0){
                if(d > nd) continue;
                if(d < nd) nl = 1;
            }
            dp[ni][nj][nl] += dp[i][j][l];
        }
    }
    ll ans = dp[n][k][0] + dp[n][k][1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }

#define INF 1LL<<60

struct state {
    int x;
    int y;
    int dir;
};

state next_state(state s, int i) {
    P cur = make_pair(s.x, s.y);
    P next = cur;
    if(i == 0)
        next.first += 1;
    else if(i == 1)
        next.first -= 1;
    else if(i == 2)
        next.second += 1;
    else
        next.second -= 1;

    state ns = {next.first, next.second, i};
    return ns;
}

int main() {
    int H, W, K;
    cin >> H >> W >> K;
    P s, t;
    cin >> s.first >> s.second >> t.first >> t.second;

    vector<string> c_raw(H);
    REP(i, H) cin >> c_raw[i];

    vector< vector<int> > c(H+2, vector<int>(W+2, 0));
    FOR(i, 1, H)
        FOR(j, 1, W)
            if(c_raw[i-1][j-1] == '.')
                c[i][j] = 1;

    // dp[i][j][k]: (i, j) にいるときに方向kを向いてる
    vector< vector< vector<ll> > > dist(H+5, vector< vector<ll> >(W+5, vector<ll>(4, 1e18)));
    REP(i, 4)
        dist[s.first][s.second][i] = 0;

    queue< pair<ll, state> > q;
    REP(i, 4) {
        state a = {s.first, s.second, i};
        q.push(make_pair(0, a));
    }

    while(!q.empty()) {
        state cur = q.front().second;
        q.pop();

        // 4方向について探索
        REP(i, 4) {
            state ns;
            ll nd;

            if(i == cur.dir) {
                ns = next_state(cur, i);
                if(c[ns.x][ns.y] == 0) continue;
                nd = dist[cur.x][cur.y][cur.dir] + 1;
            } else {
                state stmp = {cur.x, cur.y, i};
                ns = stmp;
                nd = ceil(dist[cur.x][cur.y][cur.dir] / double(K)) * K;
            }

            if( dist[ns.x][ns.y][ns.dir] > nd ) {
                dist[ns.x][ns.y][ns.dir] = nd;
                q.push(make_pair(nd, ns));
            }
        }
    }

    // cerr << "DEBUG" << endl;
    // REP(i, H+2) {
    //     REP(j, W+2) {
    //         int a = 1e9;
    //         REP(k, 4) a = min(a, int(ceil(dist[i][j][k])));
    //         cerr << a << " ";
    //     }
    //     cerr << endl;
    // }

    double ans = 1e9;
    REP(i, 4)
        ans = min(ans, ceil(dist[t.first][t.second][i] / double(K)));

    if(ans == 1e9) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 508028
#include <cstdio>
#include <vector>

typedef long long LL;
const int Mod = 1000000007;
const int MN = 5005;

int N, M, f[MN][MN];

int main() {
	scanf("%d%d", &N, &M);
	for (int j = 1; j <= M; ++j) f[0][j] = 1;
	for (int i = 1; i <= N; ++i) {
		for (int j = 2; j <= M; ++j)
			f[i][j] = (2 * f[i][j - 1] + (LL)f[i - 1][j - 1] * (j - 1)) % Mod;
		for (int j = 1; j <= M; ++j)
			f[i][j] = (f[i][j] + (LL)f[i - 1][j] * (j + 1)) % Mod;
	}
	printf("%d\n", f[N][M]);
	return 0;
}

Measured memory_bytes: 99512
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 17:52:43 2019

@author: nakamuratakayuki
"""

N, M = tuple(map(int, input().split()))
AtoB = []
for i in range(N):
    AtoB.append(tuple(map(int, input().split())))
AtoB.sort()
cost = 0
m = 0
lastorder = 0
history = []

for i in range(len(AtoB)):
    cost += AtoB[i][0]*AtoB[i][1]
    m += AtoB[i][1]
    lastorder = AtoB[i][0]
    if M <= m:
        break
while M < m:
    cost -= lastorder
    m -= 1

print(cost)

Measured memory_bytes: 16984
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
 
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const long INF =2147483647;//32bit 2*1e+9
const long MOD =1e+9+7;
#define PI 3.14159265258979
 
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};


int main(void){
	int X,Y,Z;
	cin>>X>>Y>>Z;

	print(1+(X-(Y+2*Z))/(Y+Z));
	return 0;
}



Measured memory_bytes: 256
N, A, B = [int(_) for _ in input().split()]
if N < A + B - 1 or A * B < N:
    print(-1)
elif B == 1:
    print(*list(range(1, A + 1)))
else:
    M = N - A - B + 1
    count = [B] * (1 + M // (B - 1))
    count += [1] * (A - len(count))
    count[-1] += (N - A - B + 1) % (B - 1)
    f = 0
    ans = []
    for c in count:
        ans += list(range(f + c, f, -1))
        f += c
    print(*ans)


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

int counter[100001];
int main(){
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    long long int n, k, q;
    cin>>n>>k>>q;
    
    int a[q+1];

    for(int i = 1; i <= q; i++){
        cin>>a[i];
        counter[a[i]] += 1;
    }

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

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

#define f first
#define s second
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ll long long
#define ull unsigned long long
#define db double
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pli pair<ll, int>
#define px pair<db, db>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define input(a) for (auto& el : a) cin >> el;
#define output(a) cout << '!'; for (auto& el : a) cout << el << ' '; cout << '\n'; cout.flush();
#define sz(el) int(el.size())
#define sq(a) ((a) * (a))
#define xll bitset<128>
#define xmin(a,b) a = min(a, b)
#define xmax(a,b) a = max(a, b)
#define sun(a) sort(all(a)); a.resize(unique(all(a)) - a.begin());
/**/  /// extra
//#define forn(i,n) for (int i = 0; i < n; ++i)
//#define rforn(i,n) for (int i = n - 1; i >= 0; --i)
#define bn '\n'
#define vi vector<int>
#define vii vector<vi>
#define vl vector<ll>
#define vll vector<vl>
//#define G vector<vector<pii>>
#define GVE vector<vector<edge>>
#define usi unordered_set<int>
#define usp set<pii>
/**/

using namespace std;

const int INF = 1'000'000'017;
const ll LLINF = 1'000'000'000'000'000'017LL;
const ld inf = 1.0 / 0.0;
const ld eps = 1e-9;
const int MOD = 998244353;

//mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

//uniform_int_distribution<int> uid(l, r); [l, r]
//int x = uid(rng);

const int N = 61;

int t[N];
vector<ll> base;

ll check() {
    //output(base);
    int id = 0;
    for (int bit = N - 1; bit >= 0; --bit) {
        ll mx = -1;
        int pos = -1;
        for (int i = id; i < sz(base); ++i) {
            if (base[i] & (1ll << bit)) {
                if (base[i] > mx) {
                    mx = base[i];
                    pos = i;
                }
            }
        }
        if (mx > -1) {
            swap(base[id], base[pos]);
        } else {
            continue;
        }
        for (int i = 0; i < sz(base); ++i) {
            if (i != id && (base[i] & (1ll << bit))) {
                base[i] ^= mx;
            }
        }
        ++id;
        //output(base);
    }
    ll res = 0;
    for (int i = 0; i < sz(base); ++i) {
        res ^= base[i];
    }
    //cout << res << endl;
    //cout << (res << 1) << endl;
    return res << 1;
}

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

    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        for (int j = 0; j < N; ++j) {
            if (a[i] & (1ll << j)) {
                ++t[j];
            }
        }
    }
    ll ans = 0;
    ll msk = 0;
    for (int i = 0; i < N; ++i) {
        if (t[i]) {
            if (t[i] & 1) {
                ans |= (1ll << i);
            } else {
                msk |= (1ll << i);
            }
        }
    }
    base = a;
    for (auto& el : base) {
        el &= msk;
    }
    sort(rall(base));
    //cout << ans << endl;
    cout << (ans + check());
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
int main() {
    ll n,k;
    cin>>n>>k;
    ll ans=k*pow(k-1,n-1);
    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits> 
#include <time.h>

long gcd(long a,long b)
{
    if(a<b){
        std::swap(a,b);
    }
    if(a%b==0){
        return b;
    }else{
        return gcd(b,a%b);
    }
}

int main()
{
   // clock_t start=clock();
    long K;
    std::cin >> K;
    long sum=0;
    for(long i=1; i<=K; i++){
        for(long j=1; j<=K; j++){
            for(long l=1; l<=K;l++){
                sum+=gcd(gcd(i,j),l);
            }
        }
    }
    std::cout << sum << std::endl;
//clock_t end=clock();
//std::cout << static_cast<double>(end-start)/CLOCKS_PER_SEC * 1000.0 << std::endl;
    return 0;
}

Measured memory_bytes: 3620
#include<stdio.h>
int main()
{
    int a[100],i,n,flag=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        if(a[i]%2==0)
        {
            if(a[i]%3!=0&&a[i]%5!=0)
            {
                flag=1;
                printf("DENIED");
                break;
            }
        }
    }
    if(flag==0)
        printf("APPROVED");
}


Measured memory_bytes: 128
N, K = map(int, input().split())

ans = 0
for i in range(1, N + 1):
    prob = 1 / N
    score = i
    #j = 1
    while score < K:
        prob *= (1 / 2)
        #j += 1
        score *= 2
    ans += prob

print(ans)

Measured memory_bytes: 2940
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = l[0], M = l[1];

            var broke = new long[M];
            var noList = new bool[N];
            noList = noList.Select(z => z = true).ToArray();
            for (var i = 0; i < M; i++)
            {
                broke[i] = long.Parse(Console.ReadLine());
                noList[broke[i]] = false;
            }

            var memo = new long[N + 1];
            memo[0] = 1;
            for (var i = 0; i < N; i++)
            {
                for (var j = i + 1; j <= Math.Min(i + 2, N); j++)
                {
                    if (noList[i])
                    {
                        memo[j] += memo[i];
                        memo[j] %= 1000000007;
                    }
                }
            }
            Console.WriteLine(memo[N]);
        }
    }
}


Measured memory_bytes: 14816
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <string>
using namespace std;

int main(){
    int64_t N, M;
    cin >> N >> M;

    if(N == 1 && M == 1){
        cout << 1 << endl;
    }
    else if(N == 1){
        cout << M - 2 << endl;
    }
    else if(M == 1){
        cout << N - 2 << endl;
    }
    else {
        cout << N * M - 2 * (N + M) + 4 << endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static kyoupuro.Input;
using static kyoupuro.MyMath;

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var N = NextLong();

            if(N % 2 == 1) {
                Console.WriteLine(0);
                return;
            }

            long count = N / 10;
            N /= 10;

            while(N > 0) {
                count += N / 5;
                N /= 5;
            }

            Console.WriteLine(count);
        }
    }

    class MyMath {
        public static long mod = 1000000007;

        public static long Gcd(long a, long b) {
            return b == 0 ? a : Gcd(b, a % b);
        }

        public static List<long> Factor(long n) {
            var list = new List<long>();
            n = DivideToLimit(n, 2, list);
            n = DivideToLimit(n, 3, list);
            long sqrt = Sqrt(n);
            for (int i = 5; i <= n && i <= sqrt; i += 4) {
                n = DivideToLimit(n, i, list);
                i += 2;
                n = DivideToLimit(n, i, list);
            }
            if(n > 1) list.Add(n);
            return list;
        }

        public static long Sqrt(long n) {
            if (n < 0) return 0;
            long a = 0, tmp = 0, b = 0;
            for (int i = 62; i >= 0; i -= 2) {
                tmp = (b << 1) + 1 <= (n >> i) ? 1 : 0;
                a = a << 1 | tmp;
                n -= (((b << 1) + 1) * tmp) << i;
                b = (b << 1) + tmp + tmp;
            }
            return a;
        }

        static long DivideToLimit(long divisor, long dividend, List<long> list) {
            while(divisor % dividend == 0) {
                list.Add(dividend);
                divisor /= dividend;
            }
            return divisor;
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
//long long int countt[200003];
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds; //necessary for the GNU based Policy based data structures.
typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define int long long
#define endl "\n"


signed main()
{
    FAST;
    
    int i=0,j=0,k=0,n=0,m=0,count=0,temp=0;
    int temp1=0,temp2=0,temp3=0,x=0,l=0,y=0,sum=0;
    int left=0,up=0,down=0,start=0,end=0,r=0,q=0,total=0;
    int maxx=0,minn=0,curr=0,ans=0,places=0,zeroes=0,low=0,high=0;
    int prev=0,mid=0,z=0,d=0,val=0,pos=0,shift=0,h=0,right=0,var=0;
    
    int a,b;
    cin>>k>>a>>b;
    for(i=a;i<=b;i++)
    {
        if(i%k==0)
        {
            cout<<"OK"<<endl;
            return 0;
        }
    }
    
    cout<<"NG"<<endl;
    
}

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

int		main(void)
{
	string a;
	cin >> a;
	for (auto &i : a)
	{
		if (i == '7')
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 3592
#include<stdio.h>
#include<map>
typedef std::map<int,int>M;
typedef M::iterator I;
void F(int*a,int s,M&m)
{
	int i,j,x;
	for(i=1;i<=s;++i)
	{
		for(x=j=0;j<i;++j)x+=a[j];
		++m[x];
		for(j;j<s;++j)
		{
			x-=a[j-i];
			x+=a[j];
			++m[x];
		}
	}
}
int main()
{
	int n,m,h[1500],w[1500],i,r;
	I p,q;
	while(scanf("%d%d",&n,&m),m)
	{
		M H,W;
		for(r=i=0;i<n;++i)scanf("%d",h+i);
		for(i=0;i<m;++i)scanf("%d",w+i);
		F(h,n,H);
		F(w,m,W);
		for(p=H.begin();p!=H.end();++p)
			if((q=W.find(p->first))!=W.end())
				r+=p->second*q->second;
		printf("%d\n",r);
	}
	return 0;
}

Measured memory_bytes: 18000
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;

bool cmp(pair<string,int> a,pair<string ,int>b){
	if(a.first<b.first){
		return true;
	}else{
		if(a.first == b.first){
			if(a.second > b.second){
				return true;
			}else {
				return false;
			}
		}else{
			return false;
		}
	}
}

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

	std::vector<pair<string ,int>>m;
	map<pair<string,int>,int>pos;	
	string x;
	int y;
	for(int i=0;i<n;i++){
		cin>>x>>y;
		m.push_back({x,y});
		pos[{x,y}] = i+1;
	}

	sort(m.begin(),m.end(),cmp);

	for(int i=0;i<n;i++){
		cout<<pos[{m[i].first,m[i].second}]<<endl;
	}
	

	return 0;
}

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

string get_win(string s) {
    if (s == "r") {
        return "p"; 
    } else if (s == "p") {
        return "s"; 
    } else if (s == "s") {
        return "r"; 
    }
    return "";
}

int main() {
    int n, k, r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;

    long long ans = 0;
    string past[n];
    for (int i = 0; i < n; i++) {
        if (i < k) {
            past[i] = get_win(t.substr(i, 1));
        } else {
            string win = get_win(t.substr(i, 1));
            if (win != past[i - k]) {
                past[i] = win;
            }
        }
        if (past[i] == "r") {
            ans += r;
        } else if (past[i] == "p") {
            ans += p;
        } else if (past[i] == "s") {
            ans += s;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5760
#include <stdio.h>
int main(void)
{
int W, H, x, y, r;

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if(W-x < r || H - y < r)
printf("No");

else if(x < r || y <r)
printf("No");

else 
printf("Yes");

printf("\n");

return 0;
}

Measured memory_bytes: 588
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef tuple<int,int,int> TP;
//少数点表示
//cout << std::fixed << std::setprecision(14) <<double値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n;
    cin >> n;
    vector<vector<P>> syougen(n);
    vector<int> a(n+1);
    rep(i,n){
        cin >> a[i];
        rep(j,a[i]){
            int x,y;
            cin >> x >> y;
            syougen[i].push_back(make_pair(x,y));
            syougen[i][j].first--;
        }
    }
    int bitmany = 0;
    int max_ = 0;
    for(int bit=0;bit<(1<<n);++bit){
    //bit列でフラグ立った人を正直者と仮定
        bool flag = true;
        bitmany = __builtin_popcount(bit);
        //cout << "bit:"<<bitset<5>(bit)<<endl;
        for(int i = 0;i<n;i++){
            //bit列と矛盾した証言をしている者がいないか
            //cout <<"i:"<< bitset<5>(1<<i)<<"("<<i<<")" <<" bit:"<<bitset<5>(bit)<<"("<<bit<< endl;
            if(!(bit&(1<<i))) continue;

            int h = a[i];
            rep(j,h){
                //cout << "証言"<<i<< syougen[i][j].first <<","<<syougen[i][j].second<<endl;
                if((((bit>>syougen[i][j].first) & 1)) ^ syougen[i][j].second){
                    flag = false;
                    //cout << "NG" << endl;
                }else{
                    //cout << "OK" << endl;
                    //cout << bitmany <<endl;
                }
            }
             
        }
        if(flag){
            //cout <<"ok"<<endl;
            max_=max(max_,bitmany);
        }
    }
    cout << max_;

}

Measured memory_bytes: 256
#include<stdio.h>
int selectionSort(int A[],int N){
  int i,j,swap=0,min,tmp;
  for(i=0;i<N-1;i++){
    min = i;
    for(j=i;j<N;j++){
      if(A[j]<A[min])min=j;
    }
    tmp = A[i];A[i]=A[min];A[min]=tmp;
    if(i !=min )swap++;
  }
  return swap;
}
int main(){
  int A[100],N,i,swap;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  swap=selectionSort(A,N);
  for(i=0;i<N;i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",swap);

  return 0;
}


Measured memory_bytes: 2036
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	class P {
		int x, y, t;
		P(int x, int y, int t) {
			this.x = x;
			this.y = y;
			this.t = t;
		}
	}
	
	void run() {
		int t, n;
		boolean[][] map = new boolean[140][140];
		boolean[][] check = new boolean[140][140];
		int[] dx = {0, 0, 1, -1, 1, -1};
		int[] dy = {1, -1, 0, 0, 1, -1};
		Queue<P> q = new LinkedList<P>();
		while (true) {
			t = sc.nextInt(); n = sc.nextInt();
			if (t == 0) break;
			for (int i = 0; i < 140; i++) {
				Arrays.fill(map[i], true);
				Arrays.fill(check[i], false);
			}
			for (int i = 0; i < n; i++)
				map[sc.nextInt()+70][sc.nextInt()+70] = false;
			int x = sc.nextInt()+70, y = sc.nextInt()+70;
			int ans = 0;
			check[x][y] = true;
			q.add(new P(x, y, 0));
			while (!q.isEmpty()) {
				ans++;
				P p = q.poll();
				if (p.t < t) {
					for (int i = 0; i < 6; i++) {
						if (!check[p.x+dx[i]][p.y+dy[i]] && map[p.x+dx[i]][p.y+dy[i]]) {
							check[p.x+dx[i]][p.y+dy[i]] = true;
							q.add(new P(p.x+dx[i], p.y+dy[i], p.t+1));
						}
					}
				}
			}
			out.println(ans);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

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

int main(){
    ll H, W;
    cin >> H >> W;

    ll ans = 1e18;
    rep(h, 1, H){
        ll s1 = h * W, s2, s3, smx, smn, diff;
        // rest = W * (H-h);
        // H方向分割
        s2 = W * (ll)((H-h)/2);
        s3 = W * (ll)((H-h+1)/2);
        smx = max(s1, max(s2, s3));
        smn = min(s1, min(s2, s3));
        diff = smx - smn;
        ans = min(diff, ans);
        // W方向分割
        s2 = (H-h) * (ll)(W/2);
        s3 = (H-h) * (ll)((W+1)/2);
        smx = max(s1, max(s2, s3));
        smn = min(s1, min(s2, s3));
        diff = smx - smn;
        ans = min(diff, ans);
    }
    
    rep(w, 1, W){
        ll s1 = w * H, s2, s3, smx, smn, diff;
        // rest = W * (H-h);
        // W方向分割
        s2 = H * (ll)((W-w)/2);
        s3 = H * (ll)((W-w+1)/2);
        smx = max(s1, max(s2, s3));
        smn = min(s1, min(s2, s3));
        diff = smx - smn;
        ans = min(diff, ans);
        // W方向分割
        s2 = (W-w) * (ll)(H/2);
        s3 = (W-w) * (ll)((H+1)/2);
        smx = max(s1, max(s2, s3));
        smn = min(s1, min(s2, s3));
        diff = smx - smn;
        ans = min(diff, ans);
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int x[100000];
	for(int i=0;i<5;i++)
	{
		cin>>x[i];
	}
	for(int i=1;i<=5;i++)
	{
		if(x[i-1]==0)cout<<i;
	}
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
using namespace std;
#define ll long long


int main() {
	int N; cin >> N;
	int a=0, b=0, ab=0, b_a=0;
	for(int i=0; i<N; ++i){
	    string s; cin >> s;
	    if(s[0]=='B') ++b;
	    if(s.back()=='A') ++a;
	    if(s[0]=='B' && s.back()=='A') ++b_a;
	    for(int i=0; i+1<s.size(); ++i){
	        if(s.substr(i, 2)=="AB") ++ab;
	    }
	}
	if(a==b_a && b==b_a && b_a>0) cout << ab+b_a-1 << endl; 
	else cout << ab+min(a, b) << endl;
	return 0;
}


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

using namespace std;

const int NS = (int)1e5 + 4;
const long long MOD = (long long)1e9 + 7;
int N;
char s[NS * 2];

int main(){
    scanf("%d", &N);
    scanf("%s", s + 1);
    int val = 0;
    long long ans = 1;
    for(int i = 1; i <= N * 2; ++i){
        if((s[i] == 'B' && val % 2 == 0) || (s[i] == 'W' && val % 2 == 1)) ++val;
        else{
            ans = (ans * val) % MOD;
            --val;
        }
    }
    if(val){
        puts("0"); return 0;
    }
    for(int i = N; i >= 1; --i){
        ans = (ans * i) % MOD;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) { cin >> a[i]; }
    ll res = INF;
    ll ans = 0LL;
    ll s = 0LL;
    //はじめは正
    for(int i = 0; i < n; i++) {
        s += a[i];
        if(i % 2 == 1) {
            //負に
            if(s >= 0) {
                ans += s + 1;
                s = -1;
            }
        } else {
            //正に
            if(s <= 0) {
                ans += -s + 1;
                s = 1;
            }
        }
    }
    res = min(res, ans);
    // cout << res << endl;
    s = 0;
    ans = 0;
    for(int i = 0; i < n; i++) {
        s += a[i];
        if(i % 2 == 0) {
            if(s >= 0) {
                ans += s + 1;
                s = -1;
            }
        } else {
            if(s <= 0) {
                ans += -s + 1;
                s = 1;
            }
        }
        // cout << s << endl;
    }
    res = min(res, ans);

    cout << res << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
 
#define INIT_CAP 10
#define INF 1000000000
 
typedef struct {
	int *elem, cap, size;
} VecInt;
 
VecInt adj[100000];
int d[100000];
int cnt[100000];
int queue[100000];
int front, rear;
 
void init(int n) {
	while (n--)
		adj[n] = (VecInt){malloc(sizeof(int) * INIT_CAP), INIT_CAP, 0};
}
 
void add(int from, int to) {
	if (adj[from].size == adj[from].cap) {
		adj[from].cap <<= 1;
		adj[from].elem = realloc(adj[from].elem, sizeof(int) * adj[from].cap);
	}
	adj[from].elem[adj[from].size++] = to;
}
 
int main(void) {
	int i;
	int n, m;
 
	scanf("%d %d", &n, &m);
 
	init(n);
	for (i = 0; i < m; i++) {
		int a, b;
 
		scanf("%d %d", &a, &b);
		a--; b--;
 
		add(a, b);
		add(b, a);
	}
	for (i = 0; i < n; i++)
		d[i] = INF;
 
	d[0] = 0;
	queue[rear++] = 0;
	while (front != rear) {
		const int from = queue[front++];
		cnt[d[from]]++;
		for (i = 0; i < adj[from].size; i++) {
			const int to = adj[from].elem[i];
			if (d[to] == INF) {
				d[to] = d[from] + 1;
				queue[rear++] = to;
			} else if (d[to] == d[from]) {
				printf("%lld\n", (long long)n * (n - 1) / 2 - m);
				return 0;
			}
		}
	}
 
	long long sum[2] = {0};
	for (i = 0; i < 100000; i++)
		sum[i & 1] += cnt[i];
 
	printf("%lld\n", sum[0] * sum[1] - m);
 
	return 0;
}

Measured memory_bytes: 7168
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int x,y,num;
    	cin>>x>>y>>num;
    	for(int i =0;i<y;i++)
    		cout<<num<<' ';
    	int result = num+1;
    	if(num==1e9)
    		result = num-1;
    	for(int i =0;i<x-y;i++)
    		cout<<result<<' ';
    	cout<<endl;
    }

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

int main (void){
  int k,ans;
  cin >> k;

  if(k % 2 == 1){
    ans = (k - 1) / 2 * (k + 1) / 2;
  }else{
    ans = k/2 * k/2;
  }
  cout << ans << "\n";
  return 0;
}

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

//再帰関数の書き方
/*戻り値の型 func(引数) {
  if (ベースケース) {
    return ベースケースに対する値;
  }

  func(次の引数); // 再帰呼び出しします。その前後でも色々やります。
  return (答え);
}*/

long long f(long long x) {
  if (x==1) return 1;
  return f(x/2)*2+1;
}
  
int main(){
  long long h;
  cin >> h;
  cout << f(h) << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\n", a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
using namespace std;

int main() {
    int k, a, b;
    scanInt(k);
    scan2Int(a, b);
    if (a%k == 0) {
        printf("OK\n");
        return 0;
    }
    int tmp = k - a % k;
    if (tmp <= b-a) printf("OK\n");
    else printf("NG\n");
    return 0;
}


Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double num = 0.;
		for (int i = 0; i < n; i++) {
			num += Math.pow(sc.nextDouble(), -1);
		}
		System.out.println(Math.pow(num, -1));
	}
}


Measured memory_bytes: 24916
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int N,C[200010];
int col_id[200010] = {};
vector<vector<int>> col(200010);
vector<ll> col_sum(200010,0);
ll dp[200010] = {},inf = 1e9+7;
int main(){
    cin >> N;
    int c;
    for(int i=1;i<=N;i++){
        cin >> C[i];
        //col[c].push_back(i);
    }
    dp[0] = 1;
    for(int i=1;i<=N;i++){
        (dp[i] += dp[i-1]+(C[i-1]!=C[i]? col_sum[C[i]]:0))%=inf;
        (col_sum[C[i]] = dp[i])%=inf;
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    int a[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n-1; j++) {
            cin >> a[i][j]; a[i][j]--;
        }
    }
    map<pair<int, int>, vector<pair<int, int>>> v;
    map<pair<int, int>, int> cnt;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n-2; j++) {
            pair<int, int> s = {min(i, a[i][j]), max(i, a[i][j])};
            pair<int, int> t = {min(i, a[i][j+1]), max(i, a[i][j+1])};
            v[s].emplace_back(t);
            cnt[t]++;
        }
    }
    queue<pair<int, int>> q;
    queue<pair<int, int>> sw;
    for (int i = 0; i < n; i++) {
        pair<int, int> s = {min(i, a[i][0]), max(i, a[i][0])};
        if (cnt.find(s) == cnt.end()) q.push(s), cnt[s]++;
    }
    int t = 0; int l = 0;
    while (!q.empty()) {
        l++;
        while (!q.empty()) {
            t++;
            auto p = q.front(); q.pop();
            for (auto &e: v[p]) {
                cnt[e]--;
                if (cnt[e] == 0) sw.push(e);
            }
        }
        swap(sw, q);
    }
    if (t == n * (n-1) / 2) cout << l << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 89984
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

ll gcd(ll a, ll b) {
    if (a < b) return gcd(b, a);
    else if (b == 0) return a;
    else return gcd(b, a % b);
}
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    ll a[100010];
    rep(i, N) {
        cin >> a[i];
    }
    set<int> st;
    rep(i, N) {
        int num = a[i];
        int cnt = 0;
        while(num % 2 == 0) {
            cnt++;
            num /= 2;
        }
        st.insert(cnt);
    }
    if(st.size() > 1) {cout << 0 << endl; return 0;}
    ll L = 1;
    rep(i, N) {
        L = L * (a[i] / 2) / gcd((a[i] / 2), L);
        if ((M + L) / (L * 2) == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    cout << (M + L) / (L * 2) << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int moneyone;
int moneytwo;
int moneythree;
int main(void){
    int X;
    int Y;
    cin>>X;
    cin>>Y;
    for(int k=1;k<4;k++){
    if(X==k){
        moneytwo=400000-k*100000;
    }
        
    }
    for(int i=1;i<4;i++){
            
        if(Y==i){
            moneyone=400000-i*100000;
        }
            
    }
    moneythree=moneyone+moneytwo;
    if(X==1&&Y==1)
    moneythree=moneythree+400000;
    cout<<moneythree<<endl;
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 25555,mo=1e9+7;
int n,k,m,a[N],f[N][404],qz[N][404],vis[N],res,tot;
int main() {
	read(n);read(k);read(m);
	rep(i,1,m)read(a[i]);
	rep(i,1,k-1)f[0][i]=1;
	rep(i,1,n){
		for(int j=1,cur=f[i-1][j];j<k;j++,cur=(cur+f[i-1][j])%mo)
			f[i][j]=(cur+1LL*f[i-1][j+1]*(k-j))%mo;
	}
	tot=n-m+1;rep(i,1,n-m)tot=1LL*tot*k%mo;
	rep(i,1,m-k+1){
		rep(j,0,k)vis[j]=0;bool ok=1;
		rep(j,i,i+k-1)ok&=!vis[a[j]],vis[a[j]]=1;
		if(ok){
			res=n-m+1;
			rep(i,1,n-m)res=1LL*res*k%mo;
			cout<<res;
			return 0;
		}
	}
	rep(i,0,n)rep(j,1,k)qz[i][j]=(qz[i][j-1]+f[i][j])%mo;
	bool bo=0;rep(i,1,m)bo|=vis[a[i]],vis[a[i]]=1;
	if(bo){
		int x=0,y=0;memset(vis,0,sizeof(vis));
		rep(i,1,m){if(vis[a[i]]){x=i;break;}vis[a[i]]=1;}
		memset(vis,0,sizeof(vis));
		per(i,m,1){if(vis[a[i]]){y=i;break;}vis[a[i]]=1;}
		x=x-1;y=m-y;
	//	cerr<<x<<' '<<y<<endl;
	//	cerr<<f[0][3]<<' '<<f[1][3]<<' '<<f[2][3]<<endl;
		rep(l,0,n-m)res=(res+1LL*f[l][x]*f[n-m-l][y])%mo;
		cout<<(tot-res+mo)%mo;
		return 0;
	}
	rep(a,0,k-m-1)if(a+m<=n){
		int xs=1;rep(i,1,a)xs=1LL*xs*(k-m-i+1)%mo;
		int ans=f[n-(a+m)][a+m];
		rep(l,0,n-(a+m)-1){
			ans=(ans+1LL*f[n-l-(a+m)-1][a+m]*qz[l][a+m])%mo;
		//	cerr<<n-l-(a+m)-1<<' '<<a+m<<' '<<l<<' '<<f[n-l-(a+m)-1][a+m]*qz[l][a+m]<<endl;
		}
	//	cerr<<a<<' '<<ans<<' '<<xs<<endl;
		res=(res+1LL*ans*xs)%mo;
	}
	cout<<(tot-res+mo)%mo<<endl;
	return 0;
}


Measured memory_bytes: 80256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n = int(input())
xy = [[[] for _ in range(10**5+1)] for __ in range(2)]

for _ in range(n):
    x,y = map(int,input().split())
    xy[0][x].append(y)
    xy[1][y].append(x)

ans = 0
used = [[False for _ in range(10**5+1)] for __ in range(2)]

def dfs(i,flag):
    for v in xy[flag][i]:
        if not used[1-flag][v]:
            used[1-flag][v] = True
            dfs(v,1-flag)
            count[1-flag] += 1

for i in range(10**5+1):
    if xy[0][i] and not used[0][i]:
        used[0][i] = True
        count = [1,0]
        dfs(i,0)
        ans += count[0]*count[1]

ans -= n
print(ans)

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

#define all(v) v.begin(), v.end()
#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REPE(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void chmax(T& a, T b) { if(a > b) a = b; }
template<class T> void chmin(T& a, T b) { if(a < b) b = a; }
typedef long long ll;

int main() {
    string s; cin >> s;
    int ans = 753;
    rep(i, s.size() - 2){
        string str = s.substr(i, 3);
        int x = stoi(str);
        ans = min(ans, abs(753 - x));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
target = input()
now_height = []
now_area = [0]
answer = []
continued = 0
depth = 0
depth_list = []
for t in target:
    # print(now_height,depth_list,now_area,answer,continued)
    if t == '\\':
        now_height.append(continued)
        depth_list.append(depth)
        now_area.append(0)
        depth -= 1
    elif t == '_':
        pass
    elif t == '/' and len(now_height) > 0:
        depth += 1
        started = now_height.pop()
        temp_area = continued - started
        # print(depth_list[-1],depth)
        now_area[-1] += temp_area
        if depth > depth_list[-1]:
            while depth > depth_list[-1]:
                temp = now_area.pop()
                now_area[-1] += temp
                depth_list.pop()
    continued += 1
now_area = list(filter(lambda x:x != 0,now_area))
answer.extend(now_area)
print(sum(answer))
print(len(answer),*answer)

Measured memory_bytes: 9256
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))
if k > max(a):
    print("IMPOSSIBLE")
else:
    gcd = 0
    for i in range(n):
        gcd = math.gcd(gcd, a[i])
    if k % gcd == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Measured memory_bytes: 20188
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <chrono> 
using namespace std::chrono;
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_mset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fr(i,a,b) for (int i=(a); i<(b);++i)
#define frr(i,a,b) for(int i=(a-1);i>=(b);--i)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define F first
#define S second
#define pii pair<int,int> 
#define rev(a) reverse(a.begin(),a.end())
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.begin(),a.end(),greater<int>())
#define sz(a) (ll)a.size()
#define endl "\n"
#define po(a,b) (ll)(pow(a,b)+0.5)
#define double long double
#define print(a) for(auto x:a)cout<<x<<" ";cout<<endl;
const ll M=1e9+7;
const int MaxM=501;
ll dp[2000005];


int main()
{ios_base::sync_with_stdio(false);
 cin.tie(NULL);cout.tie(NULL);
   
   
   char a;
   cin>>a;
   if(a-'a'<26 && a-'a'>=0)cout<<'a';
   else cout<<'A';
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937 rnd;
#define F first
#define S second
#define pb push_back
#define pii pair<int,int>


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif // LOCAL
    int n;
    cin >> n;
    int a[n+1][3]={};
    for (int i=1; i<=n; i++) cin >> a[i][0] >> a[i][1] >> a[i][2];
    int dp[n+1][3]={};
    for (int i=1; i<=n; i++) {
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i][0];
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + a[i][1];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + a[i][2];
    }
    int ans = max(dp[n][0], max(dp[n][1], dp[n][2]));
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 2560
import heapq
from collections import deque

n, q = list(map(int, input().split()))
Q = []
[Q.append([]) for _ in range(n)]

for i in range(q):
    query = list(map(int, input().split()))
    t = query[1]

    # insert
    if query[0] == 0:
        heapq.heappush(Q[t], -query[2])

    # getMax
    elif query[0] == 1:
        if Q[t]:
            print(-Q[t][0])

    # deleteMax
    else:
        if Q[t]:
            heapq.heappop(Q[t])




Measured memory_bytes: 13552
import java.util.Scanner;

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

		if (A.endsWith(B.substring(0, 1)) && B.endsWith(C.substring(0, 1))) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		sc.close();
	}
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#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 INF INT_MAX/2

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<vs> vvs;

int main()
{
	while (1)
	{
		int n; cin >> n;
		if (n == 0) return 0;

		set<string> str;
		rep(i, 0, n) { string s; cin >> s; str.insert(s); }

		set<string> delstr;
		for (string a : str) for (string b : str)
		{
			if (a == b) continue;
			if (a.find(b) != string::npos) delstr.insert(b);
		}

		for (string a : delstr) str.erase(a);

		vector<string> s(str.begin(), str.end());
		n = s.size();

		vvi dist(n, vi(n, 0));
		rep(i, 0, n) rep(j, 0, n)
		{
			string a = s[i];
			string b = s[j];

			rrep(len, min(a.length(), b.length()), 1)
			{
				bool ok = true;
				rep(i, 0, len)
				{
					if (a[a.length() - 1 - len + 1 + i] != b[i]) ok = false;
				}
				if (ok)
				{
					dist[i][j] = len;
					break;
				}
			}
		}

		string infstr = "";
		rep(i, 0, 11) infstr += "zzzzzzzzzz";
		vvs dp(1 << n, vs(n+1, infstr));
		dp[0][n] = "";
		rep(mask, 0, (1 << n) - 1) rep(i, 0, n + 1)
		{
			if (100 < dp[mask][i].length()) continue;
			rep(j, 0, n) if ((mask & (1 << j)) == 0)
			{
				int ni = mask + (1 << j);
				if (i == n)
					dp[ni][j] = s[j];
				else
				{
					string nstr = dp[mask][i] + s[j].substr(dist[i][j]);
					if (nstr.length() < dp[ni][j].length())
						dp[ni][j] = nstr;
					else if (nstr.length() == dp[ni][j].length() && nstr < dp[ni][j])
						dp[ni][j] = nstr;
				}
			}
		}

		string ans = infstr;
		rep(i, 0, n)
		{
			string a = dp[(1 << n) - 1][i];
			if (a.length() < ans.length())
				ans = a;
			else if (a.length() == ans.length() && a < ans)
				ans = a;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3336
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
//    String s=sc.next();
//    int x=sc.nextInt();
    int a=sc.nextInt();
//    int b=sc.nextInt();
//    int[] a={sc.nextInt(),sc.nextInt(),sc.nextInt()};
//    Arrays.sort(a);
    System.out.println((a/2)*((a+1)/2));
  }
}


Measured memory_bytes: 23892
A,B,C,D=map(int, input().split())
L=D
M=C
if M < L:
    M, L = L, M
while M % L != 0:
    M, L = L, M % L
K=L
E=int((C*D)//K)
F=int(A//E)
G=int(B//E)
H=int(E//C+E//D-1)
I=int((E*(F+1)-A)//C+(E*(F+1)-A)//D)
J=int((B-(E*G))//C+(B-(E*G))//D)
if A%C==0 and A%D==0:
    print(B-A-((G-F-1)*H+I+J-1))
else:
    print(B-A-((G-F-1)*H+I+J))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define rep(i, a, b) for(int i=a; i<b; i++)
#define per(i, a, b) for(int i=b-1; i>=a; i--)
#define ifor(n) for(int i=0;i<n;i++) 
#define jfor(n) for(int j=0;j<n;j++)
#define Ifor(n) for(int i=1;i<n;i++) 
#define Jfor(n) for(int j=1;j<n;j++)
const int inf=0x3f3f3f3f;
ll a[3];
int main(){
	ll a,b,c;
	cin>>a>>b>>c;
	int num0=0;
	if(b-a==0)num0++;
	if(c-a==0)num0++;
	if(b-c==0)num0++;
	if(num0==1)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
} 


Measured memory_bytes: 256
n, m = (int(i) for i in input().split())
ans = 0
if n==1 and m==1:
    ans = 1
elif n==1 or m==1:
    ans = abs(n-m)-1
elif n==2 or m==2:
    ans = 0
else:
    ans = m*n-(2*(m+n)-4)
print(ans)


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

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

    string s;
    cin >> s;
    map<char, int> counter;
    int num = 0;
    for (auto &c : s) {
        counter[c]++;
    }
    for (auto &p : counter) {
        if (p.second == 2) {
            num++;
        }
    }
    if (num == 2) {
        cout << "Yes";
    } else {
        cout << "No";
    }
}

Measured memory_bytes: 256