akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstring>
#include<cstdio>
using namespace std;
void File(){
	freopen("D.in","r",stdin);
	freopen("D.out","w",stdout);
}
#define REP(i,a,b) for(register int i=a;i<=b;++i)
#define DREP(i,a,b) for(register int i=a;i>=b;--i)
const int maxn=100+10;
int n,m,a[maxn][maxn],cnt0,cnt1;
int main(){
	//File();
	scanf("%d%d",&n,&m);
	REP(i,1,50)REP(j,1,100)a[i][j]=1;
	REP(i,51,100)REP(j,1,100)a[i][j]=0;
	cnt0=cnt1=1;
	bool flag1=0,flag2=0;
	if(cnt1<m)
	for(int i=1;i<=49;i+=2){
		if(flag1)break;
		for(int j=1;j<=100;j+=2){
			if(flag1)break;
			a[i][j]=0;
			++cnt1;
			if(cnt1==m)flag1=1;
		}
	}
	if(cnt0<n)
	for(int i=52;i<=100;i+=2){
		if(flag2)break;
		for(int j=1;j<=100;j+=2){
			if(flag2)break;
			a[i][j]=1;
			++cnt0;
			if(cnt0==n)flag2=1;
		}
	}
	cout<<100<<" "<<100<<endl;
	REP(i,1,100){
		REP(j,1,100)
		if(a[i][j]==1)cout<<".";
		else cout<<"#";
		cout<<endl;
	}
	return 0;
}



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

int compare(const void *a, const void *b){
    return *(int*)a - *(int*)b;
}

int main(int argc, char *argv[]){
    int num;
    scanf("%d", &num);

    int numbers[num];
    for(int i = 0; i < num; i++){
        scanf("%d", numbers+i);
    }

    qsort(numbers, num, sizeof(int), compare);

    for(int i = 0; i < num; i++){
        if(numbers[i] == numbers[i+1]){
                printf("NO");
                return 0;
        }
    }

    printf("YES");
    return 0;
}

Measured memory_bytes: 1788
/// hi_im_manh :D
#include <bits/stdc++.h>
#define reset(a,n) memset(a,0,(n+1)*sizeof(int))
#define endl "\n"
#define llmin LLONG_MIN
#define llmax LLONG_MAX
#define intmax INT_MAX
#define intmin INT_MIN
#define ll long long
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

#define duckman "TASK"

#define input freopen(duckman".inp", "r", stdin);
#define output freopen(duckman".out", "w", stdout);

#define nmax 22000
using namespace std;


int main()
{
    fast;
//    input;
//    output;

    int n;
    cin >> n;
    vector<int> dp (3, 0);
    for (int day = 0; day < n; ++day) {
        vector<int> h(3);
        for (int i = 0; i < 3; ++i) {
            cin >> h[i];
        }
        vector<int> new_dp(3, 0);
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (i != j) {
                    new_dp[i] = max(new_dp[i], h[j] + dp[j]);
                }
            }
        }
        dp = new_dp;
    }
    cout << max({dp[0], dp[1], dp[2]});
}
/*

*/


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();
    List<string> lst = new List<string>();

    public void Solve() {
        var N = sc.nextInt();

        for (int i = 3; i <= N.ToString().Length; i++) {

            c("", 0, i);
        }
        var ans = 0;
        foreach (string val in lst) {
            if (val.IndexOf('3') >= 0 && val.IndexOf('5') >= 0 && val.IndexOf('7') >= 0) {
                if (int.Parse(val) <= N) ans++;
            }
        }
        WriteLine(ans);



    }

    void c(string val, int cnt, int limit) {
        if (cnt == limit) {
            lst.Add(val);
            return;
        }
        c(val + "3", cnt + 1, limit);
        c(val + "5", cnt + 1, limit);
        c(val + "7", cnt + 1, limit);
    }


}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 13536
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

for l in [b,c]:
    p = []
    for i in a:
        for j in l:
            p.append(i+j)
    a = sorted(p, reverse=True)[:k]

for i in a:
    print(i)


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

int main() {
    int n,mm;
    cin >> n;
    mm=100000000;
    for(int i=1;i<n;i++){
        int b = n-i,a = i;
        int hoge = 0;
        while(a>0){
            hoge+=a%10;
            a/=10;
        }
        while(b>0){
            hoge+=b%10;
            b/=10;
        }
        mm = min(mm,hoge);
    }
    cout << mm << endl;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    string st;
    cin >> st;
    int n = st.size();
    
    Int(k);

    int an = 0;
    bool ch = false;
    Rep(i, n) {
        if (ch) {
            ch = false;
        } else if (st[i-1] == st[i]) {
            ch = true;
            an++;
        }
    }
    bool ach = ch;

    int bn = 1;
    ch = true;
    Rep(i, n) {
        if (ch) {
            ch = false;
        } else if (st[i-1] == st[i]) {
            ch = true;
            bn++;
        }
    }

    if (st[0] == st.back()) {
        if (ach) {
            cout << an * k << endl;
        } else {
            if (ch) {
                if (k % 2) {
                    cout << an + (an + bn) * ((k-1) / 2ll) << endl;
                } else {
                    cout << (an + bn) * (k / 2ll) << endl;
                }
            } else {
                cout << an + bn * (k-1) << endl;
            }
        }
    } else {
        cout << min(an, bn) * k << endl;
    }


    return 0;
}


Measured memory_bytes: 256
import sys
import os
import math
 
 
dice0 = list(map(int, input().split()))
dice1 = list(map(int, input().split()))
 
def dice_roll(dice, c):
    copy = dice[:]
    if c == 'E':
        dice[2] = copy[0]
        dice[5] = copy[2]
        dice[3] = copy[5]
        dice[0] = copy[3]
    elif c == 'N':
        dice[0] = copy[1]
        dice[4] = copy[0]
        dice[5] = copy[4]
        dice[1] = copy[5]
        pass
    elif c == 'S':
        dice[1] = copy[0]
        dice[0] = copy[4]
        dice[4] = copy[5]
        dice[5] = copy[1]
    elif c == 'W':
        dice[0] = copy[2]
        dice[2] = copy[5]
        dice[5] = copy[3]
        dice[3] = copy[0]
    # Y???????????¢
    elif c == 'R':
        dice[2] = copy[1]
        dice[4] = copy[2]
        dice[3] = copy[4]
        dice[1] = copy[3]
    return dice
 
 
def check():
    global dice0
    global dice1
 
    # up???????????????
    num = 0
    while dice0[0] != dice1[0]:
        if num % 2 == 0:
            dice0 = dice_roll(dice0, 'E')
        else:
            dice0 = dice_roll(dice0, 'N')
        num += 1
        if num > 10:
            return False
 
    # front???????????????
    num = 0
    while dice0[1] != dice1[1]:
        dice0 = dice_roll(dice0, 'R')
        num += 1
        if num > 10:
            return False
 
    if dice0[2] == dice1[2] and dice0[3] == dice1[3] and dice0[4] == dice1[4] and dice0[5] == dice1[5]:
        return True
    else:
        return False
 
result = check()
if result:
    print('Yes')
else:
    # ????????????
    dice0 = dice_roll(dice0, 'N')
    result = check()
    if result:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 5676
#include <bits/stdc++.h>
using namespace std;
 
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define W while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FOR(i,x) for(i=0;i<x;i++)
#define Rof(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define mod 1000000007

  int main()
  {
    ll n,m;
    cin>>n>>m;
    ll a[m],i,sum=0;
    for(i=0;i<m;i++)
    cin>>a[i];
    for(i=0;i<m;i++)
    sum=sum+a[i];
    if(sum>n)
    cout<<-1;
    else
    cout<<n-sum;
  }

Measured memory_bytes: 3700
#!/usr/bin/env python3
import sys


YES = "YES"  # type: str
NO = "NO"  # type: str


def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


def solve(A: int, B: int, C: int):
    print(YES if C % gcd(A, B) == 0 else NO)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
// Returns the longest repeating non-overlapping
// substring in str

#include<bits/stdc++.h>

using namespace std;

string longestRepeatedSubstring(string str)
{
    int n = str.length();
    int LCSRe[n+1][n+1];

    // Setting all to 0
    memset(LCSRe, 0, sizeof(LCSRe));

    string res; // To store result
    int res_length  = 0; // To store length of result

    // building table in bottom-up manner
    int i, index = 0;
    for (i=1; i<=n; i++)
    {
        for (int j=i+1; j<=n; j++)
        {
            // (j-i) > LCSRe[i-1][j-1] to remove
            // overlapping
            if (str[i-1] == str[j-1] &&
                LCSRe[i-1][j-1] < (j - i))
            {
                LCSRe[i][j] = LCSRe[i-1][j-1] + 1;

                // updating maximum length of the
                // substring and updating the finishing
                // index of the suffix
                if (LCSRe[i][j] > res_length)
                {
                    res_length = LCSRe[i][j];
                    index = max(i, index);
                }
            }
            else
                LCSRe[i][j] = 0;
        }
    }

    // If we have non-empty result, then insert all
    // characters from first character to last
    // character of string
    if (res_length > 0)
        for (i = index - res_length + 1; i <= index; i++)
            res.push_back(str[i-1]);

    return res;
}

// Driver program to test the above function
int main()
{
    int n;
    string str;
    cin >> n >> str;
    cout << longestRepeatedSubstring(str).length();
    return 0;
}


Measured memory_bytes: 97920
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
using namespace std;
int main(){
 int x,n;
 scanf("%d%d",&x,&n);
 vector<int> p(1000);
 int i,a;
 bool flag[1000]={0}; 
 
 for(i=0;i<n;i++){
  scanf(" %d",&a);
  flag[a]=1;
  p.push_back(a);
 }
 sort(p.begin(),p.end());
 int min,tmp=1000;
 for(i=0;i<=200;i++){
  if(tmp>abs(x-i)&&!flag[i]){
   min=i;tmp=abs(x-i);
  }
  if(x-i==0&&!flag[i]){
   printf("%d\n",i);
   return 0;
  }
 }
 printf("%d\n",min);
return 0;}

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

int main()
{
  int long long a, b, r, x, tmp;
 
  cin >> a >> b;
 
  x = a * b;
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  cout << x/b << endl;

}

Measured memory_bytes: 256
H, W = map(int, input().split())
S = []
for i in range(H):
    S.append(input())
for i in range(H):
    for j in range(W):
        sum = 0
        if(S[i][j] == '#'):
            print('#', end = "")
            continue
        for a in range(-1, 2):
            for b in range(-1, 2):
                if(i + a < 0 or i + a >= H or j + b < 0 or j + b >= W):
                    continue
                if(S[i + a][j + b] == '#'):
                    sum += 1
        print(sum, end = "")
    print()

Measured memory_bytes: 3444
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

l=[0]*5
n=int(input())
for i in range(n):
    s=input()
    if s[0]=="M":
        l[0]+=1
    if s[0]=="A":
        l[1]+=1
    if s[0]=="R":
        l[2]+=1
    if s[0]=="C":
        l[3]+=1
    if s[0]=="H":
        l[4]+=1

ans=0
for q in list(itertools.combinations([0,1,2,3,4], 3)):
    c=1
    for i in q:
        c*=l[i]
    ans+=c
print(ans)

Measured memory_bytes: 10312
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll x,a;
    cin >> x >> a;
    cout << (x<a?0:10) << endl;
    return 0;
}

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

signed main() {
  int n;
  int h;
  cin >> n >> h;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i) >> b.at(i);
  }
  int maxa = *max_element(begin(a), end(a));
  int num = 0, sum = 0;
  sort(begin(b), end(b), greater<int>());
  for (auto &&w : b) {
    if (w <= maxa) break;

    sum += w;
    num++;
    if (sum >= h) {
      cout << num << endl;
      return 0;
    }
  }
  int numa = ((h - sum) + maxa - 1) / maxa;
  cout << num + numa << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <stack>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <climits>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const ll MOD = 1000000007;
const ll INF = LLONG_MAX;
const ll MAX_N = 100000;
const double EPS = 10e-8;

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

int a, b, c, d, e, f, wt=0, sg=0;
bool ck[100][10000]{};

void solve(int w, int s) {
	if (ck[w][s])return;
	ck[w][s] = true;
	if (w == 0) {
		solve(a, s);
		solve(b, s);
		return;
	}
	if (w * 100 + s > f)return;
	if (s > w*e) {
		solve(w + a, s);
		solve(w + b, s);
		return;
	}
	if (s * (100 * wt + sg) - sg * (100 * w + s)>0 || sg==0) {
		wt = w; sg = s;
	}
	solve(w, s + c);
	solve(w, s + d);
	return;
}

int main() {
	cin >> a >> b >> c >> d >> e >> f;
	solve(0, 0);
	cout << wt * 100 + sg << " " << sg << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


int n;
int a[100010];
int fact[100010], invFact[100010];


void makeFact(){
	fact[0] = 1;
	repe(i, 1, n+1) fact[i] = MUL(i, fact[i-1]);
	int M = MOD-2;
	int pow = fact[n+1];
	invFact[n+1] = 1;
	do {
		if(M&1) invFact[n+1] = MUL(invFact[n+1], pow);
		pow = MUL(pow, pow);
	} while(M/=2);
	repr(i, n+1, 0) invFact[i] = MUL(invFact[i+1], i+1);
}


int comb(int a, int b){
	if(a < 0 || b < 0 || a < b) return 0;
	return MUL(fact[a], MUL(invFact[b], invFact[a-b]));
}


void solve(){
	int l, r;
	MII indx;
	rep(i, 0, n+1){
		if(indx.find(a[i]) != indx.end()){ l = indx[a[i]]+1; r = i+1; break; }
		indx[a[i]] = i;
	}
	repe(i, 1, n+1) cout << ADD(comb(n+1, i), -comb(l+n-r, i-1)) << endl;
}


signed main(){
	cin >> n;
	rep(i, 0, n+1) cin >> a[i];
	
	makeFact();

	solve();

	return 0;
}

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

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    int n;
    set<string> Sset;
    string s;
    cin >> n;
    while(n--){
        cin >> s;
        Sset.insert(s);
    }
    cout << Sset.size();

    return 0;
}



Measured memory_bytes: 19200
#include <iostream>
#include <set>
using namespace std;
int main(){
    set<char> st;
    for(int i = 0; i < 3; i++){
        char c; cin >> c;
        st.insert(c);
    }
    if(st.count('a') == 1 && st.count('b') == 1 && st.count('c') == 1) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
from math import ceil


def widespread(N: int, A: int, B: int, H: list)->int:
    def killable_by(T: int)->bool:
        return sum(max(0, ceil((h-B*T)/(A-B))) for h in H) <= T

    l, r = 0, 10**9
    while r - l > 1:
        m = (l + r) // 2
        if killable_by(m):
            r = m
        else:
            l = m

    return r


if __name__ == "__main__":
    N = 0
    N, A, B = map(int, input().split())
    H = [int(input()) for _ in range(N)]
    ans = widespread(N, A, B, H)
    print(ans)


Measured memory_bytes: 7196
def MI(): return map(int, input().split())
def II(): return int(input())
def IS(): return input()
def LI(): return list(map(int, input().split()))

a, b, k = MI()
small = [i for i in range(a, a+k, 1)]
large = [i for i in range(b-k+1, b+1, 1)]
for i in (sorted(list(set(small+large)))):
    if a <= i <= b: print(i)



Measured memory_bytes: 3064
import sys
input = sys.stdin.readline

L = int(input())
A = [int(input()) for _ in range(L)]
INF = 10**18
dp = [[INF] * 5 for _ in range(L+1)]
dp[0][0] = 0
# none, even, odd, even, none
for i in range(L):
    for j in range(5):
        for k in range(j, 5):
            if k in (0, 4): # none
                dp[i+1][k] = min(dp[i+1][k], dp[i][j] + A[i])
            if k in (1, 3): # even
                if A[i] == 0:
                    dp[i+1][k] = min(dp[i+1][k], dp[i][j] + 2)
                else:
                    dp[i+1][k] = min(dp[i+1][k], dp[i][j] + (A[i] % 2))
            if k == 2: # odd
                if A[i] == 0:
                    dp[i+1][k] = min(dp[i+1][k], dp[i][j] + 1)
                else:
                    dp[i+1][k] = min(dp[i+1][k], dp[i][j] + 1 - (A[i] % 2))
print(min(dp[L]))

Measured memory_bytes: 112788
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 300000;
int t[4*MAX_N];
vector<vector<int>> rows;

int pointAdd(int node,int tl,int tr,int index,int val){
	if(tl == tr)
		t[node] += val;
	else{
		int mid = (tl+tr)/2;
		if(index <= mid)
			pointAdd(2*node,tl,mid,index,val);
		else
			pointAdd(2*node+1,mid+1,tr,index,val);
		
		t[node] = max(t[2*node],t[2*node+1]);
	}
	
	return 0;
}

int main() {
	// your code goes here
	int h,w,m;
	for(int i = 0; i < 4*MAX_N; i++)
		t[i] = 0;
		
	cin >> h >> w >> m;
	for(int i = 0; i <= h; i++){
		vector<int> temp;
		temp.push_back(1);
		rows.push_back(temp);
	}
	for(int i = 0; i < m; i++){
		int hi,wi;
		cin >> hi >> wi;
		pointAdd(1,0,w-1,wi-1,1);
		rows[hi].push_back(wi);
	}
	
	int ans = 0;
	for(int row = 0; row <= h; row++){
		int curr = rows[row].size()-1;
		for(int col = 1; col < rows[row].size(); col++)
			pointAdd(1,0,w-1,rows[row][col]-1,-1);
		
		curr += t[1];
		//cout << row << ' ' << curr << '\n';
		ans = max(ans,curr);
		
		for(int col = 1; col < rows[row].size(); col++)
			pointAdd(1,0,w-1,rows[row][col]-1,1);
		
	}
	
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 28440
import math
N = int(input())
A = list(map(int,input().split()))
flag=True
if N%2 == 0:
  if 0 in A or len(set(A)) != N//2:
    flag=False
else:
  if len([0 for a in A if a==0])!=1 or len(set(A))!=N//2+1:
    flag=False
if flag:
  print(2**(N//2)%(10**9+7))
else:
  print(0)

Measured memory_bytes: 13812
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


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


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


N, K = zz()
S = S()
change_points = [0]
if (N == 1):
    print(0)
    exit()
if (S[0] == S[1] == 'R'):
    ans = 1
else:
    ans = 0
for i in range(1, N):
    if S[i] == 'L':
        if (S[i - 1] == 'L'):
            ans += 1
    else:
        if (i == N - 1):
            pass
        elif (S[i + 1] == 'R'):
            ans += 1

    if (S[i] != S[i - 1]):
        change_points.append(i)
# print(change_points)
# print(ans)
ans += (2*K)

print(min(ans, N-1))


Measured memory_bytes: 16524
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int K;
    string S;
    cin >> K >> S;
    bool flag = false;
    while (S.length() > K) {
        S.pop_back();
        flag = true;
    }
    cout << S << (flag ? "..." : "") << endl;

    return 0;
}


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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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(a > b) { a = b; return true; } return false; }

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

    int N, K; cin >> N >> K;
    cout << K * (int)pow(K-1, N-1) << endl;
}

Measured memory_bytes: 3956
#!/usr/bin/env pypy
from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__


def pi(s):
    p = [0] * len(s)
    for i in range(1, len(s)):
        g = p[i - 1]
        while g and (s[i] != s[g]):
            g = p[g - 1]
        p[i] = g + int(s[i] == s[g])

    return p


def match(s, pat):
    res = []
    p = pi(pat + '\0' + s)
    for i in range(len(p) - len(s), len(p)):
        if p[i] == len(pat):
            res.append(i - 2 * len(pat))

    return res


def main():
    s = input()
    t = input()

    n = len(s)
    s *= (len(t) + 3 * len(s) - 1) // len(s)

    lo, hi = 0, (len(s) + len(t) - 1) // len(t)
    while lo < hi:
        mi = (lo + hi) // 2
        u = mi * t
        if not match(s, u):
            hi = mi
        else:
            lo = mi + 1

    if len(t * (lo - 1)) >= 2 * n:
        print(-1)
        return

    print(lo - 1)


# region fastio

BUFSIZE = 8192


class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 152496
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

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

// value
ll N, P;


void solve() {
	
	cin >> N >> P;
	
	ll ans = 1;
	if (N == 1) {
		cout << (ll)P << endl;
		return;
	}
	if (N > 1000000) {
		cout << 1 << endl;
		return;
	}

	for (ll i = 1;; i++) {
		if (P % (ll)(powl(i, N)) == 0) {
			ans = i;
		}
		if (P < powl(i, N)) break;
	}

	cout << (ll)ans << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 256
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

#include <bits/stdc++.h>
 
using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair
#define debug_vec(x, n) cout << (#x) << ": "; for(int i = 0; i < n; i++) cout << x[i] << (i == n - 1 ? "\n" : " ");

typedef long long ll;
typedef long double ld;

void solve(){
    string s, t;
    cin >> s >> t;
    for(int i = 0; i < (int)s.size(); i++){
        if(s[i] != t[i]){
            cout <<"No\n";
            return;
        }
    }
    cout << "Yes\n";
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3640
/*
javac Main.java && java Main
*/

import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
	public static void main(String[] args) { new Main(); }
	FS in = new FS();
	PrintWriter out = new PrintWriter(System.out);

	int n, q, x, a, b;
	char[] s, ss;

	Main() {
		ss = in.next().toCharArray();
		n = ss.length;

		q = in.nextInt();
		s = new char[q + n + q];
		for (int i = q; i < q + n; i++)
			s[i] = ss[i - q];
		a = n + q - 1; b = q;
		
		x = 0;
		int t, f; char c;
		int qq = q, y = 0;
		while (qq-- > 0) {
			t = in.nextInt();
			if (t == 1) x ^= 1;
			else {
				y++;
				f = in.nextInt();
				c = in.next().charAt(0);

				if (f == 1) {
					if (x == 1) s[++a] = c;
					else s[--b] = c;
				}
				else {
					if (x == 1) s[--b] = c;
					else s[++a] = c;
				}
			}
		}
		
		char[] ans = new char[a - b + 1];
		if (x == 0) {
			x = 0;
			for (int i = b; i <= a; i++)
				ans[x++] = s[i];
		}
		else {
			x = 0;
			for (int i = a; i >= b; i--)
				ans[x++] = s[i];
		}
		out.println(new String(ans));
		out.close();
	}

	
	
	int abs(int x) { if (x < 0) return -x; return x; }
	long abs(long x) { if (x < 0) return -x; return x; }
	int max(int x, int y) { if (x < y) return y; return x; }
	int min(int x, int y) { if (x > y) return y; return x; }
	long max(long x, long y) { if (x < y) return y; return x; }
	long min(long x, long y) { if (x > y) return y; return x; }
	int gcd(int x, int y) { while (y > 0) { x = y^(x^(y = x)); y %= x; } return x; }
	long gcd(long x, long y) { while (y > 0) { x = y^(x^(y = x)); y %= x; } return x; }
	long lcm(int x, int y) { return ((long) x) * (y / gcd(x, y)); }
	long lcm(long x, long y) { return x * (y / gcd(x, y)); }

	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch (Exception e) {}
			} return st.nextToken();
		}
		int nextInt() { return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
}


Measured memory_bytes: 49088
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
 
template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }
 
typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
 
struct UnionFind {
  vector<int> data;
  UnionFind(int N) : data(N, -1) { }
  bool uni(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[x] > data[y]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool find(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};
 
struct edge{
  int src, dst, cost;
  edge(int s, int d, int c) : src(s), dst(d), cost(c) {}
  edge() {}
  bool operator< (const edge& e) const {
    return cost < e.cost;
  }
};
 
int main(){
  int N;
  cin>>N;
  vector<edge> v(N - 1);
  REP(i, N - 1){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    v[i] = edge(a, b, c);
  }
  UnionFind uf(N);
  sort(v.begin(), v.end());
  ll ans = 0;
  REP(i, N - 1){
    ans += (ll)uf.size(v[i].src) * uf.size(v[i].dst) * v[i].cost;
    uf.uni(v[i].src, v[i].dst);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 6044
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int[] p = new int[(n > k) ? n : k];

        for (int i = k - 1; i > 0; i--) {
            if (i * 2 >= k) {
                p[i - 1] = 1;
            } else {
                p[i - 1] = p[(2 * i) - 1] + 1;
            }
        }

        double result = 0.0;
        for (int i = 0; i < n; i++) {
            result += (1 / (double) n) * (Math.pow(2, -p[i]));
        }

        System.out.println(result);
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <stack>
#include <vector>
#include <stdio.h>
using namespace std;

int a[2], b[2], c[2], d[2];



int main() {

	cin >> a[0] >> b[0] >> c[0] >> d[0] >> a[1] >> b[1] >> c[1] >> d[1];

	for (int i = 0; i < 2; i++) {
		a[i] += b[i] + c[i] + d[i];
	}
	cout << max(a[0], a[1]) << endl;

	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;

#define loop(i, a, b) for (int i = int(a); i <= int(b) - 1; i++)
#define rloop(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define scfi1(v) scanf("%d", &v)
#define scfi2(v1, v2) scanf("%d %d", &v1, &v2)
#define scfll1(v) scanf("%I64d", &v);
#define scfll2(v1, v2) scanf("%I64d %I64d", &v1, &v2)
#define sz(v) int(v.size())
#define ALL(c) c.begin(), c.end()
#define pb push_back
#define mp make_pair
#define test(x) cout << #x << " => { " << (x) << " }\n";

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;

int n,x,cnt=0;
vi a;
int main()
{
    scfi1(n);
    loop(i ,0 , n){
        scfi1(x);
        a.pb(x);
    }
    for(int i=1;i<n-1;i++)
    {
        if((a[i]<=a[i+1] && a[i]>=a[i-1])|| (a[i]>=a[i+1] && a[i]<=a[i-1]))
            cnt++;
    }
    cout<<cnt;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef double D;
typedef complex<D> P;
typedef vector<P> Pol;
const D eps=1e-9;
bool eq(D a,D b){return abs(a-b)<eps;}
int sig(D a){return eq(a,0)?0:(a>0?1:-1);}
bool compxy(const P& l,const P& r){
	return eq(l.real(),r.real()) ? l.imag()<r.imag() : l.real()<r.real();
}
D cro(P a,P b){return imag(conj(a)*b);}
int ccw(P a,P b,P c){
	if(sig(cro(b-a,c-a))!=0) return sig(cro(b-a,c-a));
	if(eq(abs(a-c)+abs(c-b),abs(a-b))) return 0;
	if(eq(abs(a-b)+abs(c-b),abs(a-c))) return -2;
	if(eq(abs(a-c)+abs(a-b),abs(c-b))) return 2;
}
Pol conv(Pol p){
	int N=p.size(),k=0;
	sort(all(p),compxy);
	Pol ret(2*N);
	rep(i,N){
		while(k>=2&&ccw(ret[k-2],ret[k-1],p[i])<=0) --k;
		ret[k++]=p[i];
	}
	for(int i=N-2,t=k+1;i>=0;i--){
		while(k>=t&&ccw(ret[k-2],ret[k-1],p[i])<=0) --k;
		ret[k++]=p[i];
	}
	ret.resize(k-1);
	return ret;
}
int contain(Pol pol,P p){
	bool in=false;
	rep(i,pol.size()){
		P a=pol[i]-p,b=pol[(i+1)%pol.size()]-p;
		if(ccw(a,b,P(0,0))==0) return 0;
		if(imag(a)>imag(b)) swap(a,b);
		if(sig(imag(a))<=0 && 0<sig(imag(b)) && ccw(P(0,0),a,b)==1) in=!in;
	}
	return in?1:-1;
}
P p[1000];
bool solve(){
	int N;
	cin>>N;
	rep(i,N){
		double x,y;
		cin>>x>>y;
		p[i]=P(x,y);
	}
	for(int i=3;i<N;i++){
		Pol vs;
		rep(j,i) vs.pb(p[j]);
		vs=conv(vs);
		if(contain(vs,p[i])==1) return false;
	}
	reverse(p,p+N);
	for(int i=3;i<N;i++){
		Pol vs;
		rep(j,i) vs.pb(p[j]);
		vs=conv(vs);
		if(contain(vs,p[i])==1) return false;
	}
	return true;
}
int main(){
	if(solve()) puts("Possible");
	else puts("Impossible");
}

Measured memory_bytes: 1272
N,K = map(int,input().split())
H = list(map(int,input().split()))

INF = 10 ** 9 + 1
dp = [INF] * N
dp[0] = 0

for i in range(1, N):
  dp[i] = min(pre + abs(h - H[i]) for pre,h in zip(dp[max(0,i - K):i],H[max(0,i - K):i]))

print(dp[-1])

Measured memory_bytes: 20640
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    double a, b, c, d, e, f, x, y;

    for(;sc.hasNext();){
      a = sc.nextDouble();
      b = sc.nextDouble();
      c = sc.nextDouble();
      d = sc.nextDouble();
      e = sc.nextDouble();
      f = sc.nextDouble();

      x = (e * c - b * f) / (a * e - b * d);
      y = (-d * c + a * f) / (a * e - b * d);
      if(e * c - b * f == 0)x = 0;
      if(-d * c + a * f == 0)y = 0;

      System.out.printf("%.3f %.3f%n", x, y);
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 20524
#include <iostream>
#include <algorithm>
using namespace std;
 
int gcd(int i,int j)
{
    if(j==0) 
		return i;
    if(i < j) 
		swap(i,j);
    return gcd(j,i%j);
	if(j < i)
		return gcd(i,j%i);
}

int main()
{
    int i,j;
    while(cin >> i >> j)
	{
		cout << gcd(i,j) << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
b=[a[i+1]-a[i]for i in range(n-1)]
b.insert(0,abs(a[0]-x))

def search_common_divisor(x,y):
    if x<y:
        x,y=y,x
    while y!=0:
        x,y=y,x%y
    return x

def search_list_common_divisor(*numbers):
    b=[search_common_divisor(numbers[0],numbers[1])]
    for i in numbers:
        b.append(search_common_divisor(b[-1],i))
    return b[-1]


if n!=1:
    print(search_list_common_divisor(*b))
else:
    print(b[0])


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

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;

int main(){
    int N,K;
    int l[50];
    cin >> N >> K;
    for (int i = 0; i < N; i++){
        cin >> l[i]; 
    }
    sort(l, l + N, greater<int>());
    int total = 0;

    for (int i = 0; i < K; i++){
        total += l[i];
    }
    cout << total << endl;
    return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <valarray>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <string>
#include <tuple>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  string s;
  cin >> s;
  int pre = 0, post = 0;
  pre = s[0] - '0';
  pre *= 10;
  pre += s[1] - '0';
  post = s[2] - '0';
  post *= 10;
  post += s[3] - '0';
  bool yymm = true, mmyy = true;
  if (pre > 12 || pre == 0)
    mmyy = false;
  if (post > 12 || post == 0)
    yymm = false;

  if (yymm && mmyy)
    cout << "AMBIGUOUS" << endl;
  else if (yymm)
    cout << "YYMM" << endl;
  else if (mmyy)
    cout << "MMYY" << endl;
  else
    cout << "NA" << endl;

  return 0;
}


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

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvl;
typedef pair<int, int> pint;
typedef vector<pint> vpint;

const int INF = 1e9;

int main() {
  
int N;
  cin >>N;
  if(N<1200) {
cout <<"ABC" << endl;
  }
else if (N<2800) {
cout << "ARC" << endl;
}
else {
cout << "AGC" << endl;
}
}

Measured memory_bytes: 256
// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//


#define _USE_MATH_DEFINES
#include<math.h>

//#include<cmath>

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>



//#include "Ants.h"
using namespace std;
typedef long long ll;
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<n;i++)
#define show(s) cout<<s<<endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define LINF (1000000000000000000ll)

typedef pair < int, int> P;
ll sum[12][300000];
ll dp[100000];
ll sz[30][300000];
ll N;
string S;
int luck[1000000];
int main()
{

	cin >> N >> S;
	rep(i, N) {
		luck[i] = S[i] - '0';
	}
	rep(i, 10) {
		sz[i][N] = N;
	}
	for (int x = 0; x <= 9; x++) {
		for (int pos = N - 1; pos >= 0; pos--) {
			
			if (luck[pos] == x) {
				sum[x][pos] = sum[x][pos + 1] + 1;
				sz[x][pos] = pos;
			}
			else {
				sz[x][pos] = sz[x][pos + 1];
				sum[x][pos] = sum[x][pos + 1];
			}
		}
	}
	
	ll ans = 0;
	for (int i = 0; i <= 9; i++) {
		for (int j = 0; j <= 9; j++) {
			
			for (int k = 0; k <= 9; k++) {
				if (sz[i][0] != N && sz[j][sz[i][0]+1] != N && sz[k][sz[j][sz[i][0]+1]+1]!=N){
					//cout << i * 100 + j * 10 + k << endl;
					if (dp[i * 100 + j * 10 + k] == 0) {
						
						dp[i * 100 + j * 10 + k] = 1;
						ans++;
					}
				}
			}
				
		}
	}
	
	
	
	
	cout << ans << endl;

}


Measured memory_bytes: 49536
#include <iostream>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  int a[N];
  for(int i = 0;i < N;i++)cin >> a[i];
  for(int i = 0;i < N;i++){
    for(int j = i + 1;j < N;j++){
      if(a[i] < a[j]){
        a[i] ^= a[j];
        a[j] ^= a[i];
        a[i] ^= a[j];
      }
    }
  }
  int scoreA = 0,scoreB = 0;
  for(int i = 0;i < N;i++){
    if(i % 2){
      scoreB += a[i];
    }
    else{
      scoreA += a[i];
    }
  }
  cout << scoreA - scoreB << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
const long long mod = 1e9 + 7;
typedef long long ll;  // ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>  // chmin(min,a)
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>  // operator << (cout,a);
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
     
template<typename T>
T gcd(T a, T b){
	return b != 0 ? gcd(b, a % b) : a;
}    

int main() {
  ll x=0,y=0,z=0,k,n,m,r,s,p,h,w,ans=0,sum=0,Max=-1,Min=1e9+1;
  bool ok = true;
  string t;
  cin >> n >> k >> r >> s >> p >> t;

  rep(i,k){
    if(t[i]=='s') ans += r;
    if(t[i]=='p') ans += s;
    if(t[i]=='r') ans += p;
  }

  for(int i=k; i<n; i++){
    if(t[i-k]==t[i]) t[i] = '#';
    if(t[i]=='s') ans += r;
    if(t[i]=='p') ans += s;
    if(t[i]=='r') ans += p;
  }

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

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

long long dp[1001];
const int mod = 1e9+7;

// 素因数分解
map<int, int> prime_factor(int n) {
    map<int, int> res;
    for (int i=2;i*i<=n;++i) {
        while (n%i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

int main() {
    int N; cin >> N;
    for (int i=2;i<=N;++i) {
        map<int, int> t=prime_factor(i);
        for (auto it=t.begin(); it!=t.end(); ++it) {
            dp[it->first]+=it->second;
        }
    }
    long long res=1;
    for (int i=2;i<=N;++i) {
        res=res*(dp[i]+1)%mod;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256