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

public class Main{

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

        // input
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        // answer
        if(b % a == 0){
            System.out.println(b + a);
        } else {
            System.out.println(b - a);
        }

    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
// template<class T> T gabs(const T& x) { return max(x, -x); }
// #define abs gabs

int main() {
    int n;
    cin >> n;
    cout << 800 * n - n / 15 * 200 << endl;
    return 0;
}

Measured memory_bytes: 888
N = int(input())
A = [int(n) for n in input().split()]
ans = 0
up = False
down = False
for i in range(N-1):
    if A[i] < A[i+1]:
        up = True
        if (down):
            ans += 1
            up = False
            down = False
    elif A[i] > A[i+1]:
        down = True
        if up:
            ans += 1
            down = False
            up = False
    else:
        pass
print(ans+1)

Measured memory_bytes: 14252
#include <iostream>

using namespace std;

int main() {
  int N,X,T,a;
  cin >> N >> X >> T;
  if(N%X == 0) {
    cout << (N/X)*T << endl;
  }
  else if (N%X >= 1) {
    cout << ((N/X)+1)*T << endl;
  }
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
//const long long MOD = 1e9+7;
const long long MOD = 998244353;
const long long INF_LL = 1e18+11; const int INF_int = 1e9+11;
#define ll long long
#define mp std::make_pair
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto x:a) cout << x << " ";cout << endl;
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    int xdiff = c-a;int ydiff = d-b;
    ll dp[xdiff+1][ydiff+1];
    rep(i,xdiff+1) rep(j,ydiff+1) dp[i][j] = 0LL;
    dp[0][0]=1;
    lrep(i,xdiff+1){
        lrep(j,ydiff+1){
            if(i==0 && j==0) continue;
            if(i==0){
                dp[i][j]=dp[i][j-1]*(a);
                dp[i][j]%=MOD;
            }
            else if(j==0){
                dp[i][j]=dp[i-1][j]*(b);
                dp[i][j]%=MOD;
            }
            else{
                dp[i][j]+=((dp[i-1][j]*(b+j-1))%MOD);
                dp[i][j]%=MOD;
                
                dp[i][j]+=((dp[i][j-1]*(a+i-1))%MOD);
                dp[i][j]%=MOD;

                ll tmp = (a+i-1)*(b+j-1);
                tmp%=MOD;
                dp[i][j]-=((dp[i-1][j-1]*tmp)%MOD);
                dp[i][j]%=MOD; 

                dp[i][j]+=(dp[i][j-1]+dp[i-1][j]);
                dp[i][j]%=MOD;
            }
            //cout << dp[i][j] << endl;
        }
    }
    if(dp[xdiff][ydiff]<0) dp[xdiff][ydiff]+=MOD;
    cout << dp[xdiff][ydiff] << endl;
    
}

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

int main(){
  int n;
  cin >> n;
  int a[n];
  long long sum = 0;
  for ( int i = 0; i < n; i++){
    cin >> a[i];
    sum += a[i];
  }
  long long crr = 0, ans = ( 2 * 100000000000000);
  for ( int i = 0; i < n - 1; i++){
    crr += a[i];
    ans = min( ans, abs(sum - crr - crr) );
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	string S;
	long long K;
	cin >> S >> K;
	char ans = S[0];
	for (long long i = 0; i < min(K, (long long)S.length()); i++) {
		if (S[i] != '1') {
			ans = S[i];
			break;
		}
	}
	cout << ans << endl;
}


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

int main()
{
    int h,w;
    int x,y;
    cin >> h >> w;

while(h != 0 && w != 0)
{
    for (x = 0; x < h; x++)
    {
        for (y = 0; y < w; y++)
        {
            if ((x + y) % 2 == 0)
            {
                cout << "#";
            }
            else
            {
                cout << ".";
            }
        }
        cout << endl;
    }
    cout << endl;
    cin >> h >> w;
}
    return 0;
}


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

i = 1
while i <= n:
    x = i
    if x % 3 == 0:
        print(" {:d}".format(i),end="")
    else:
        while x:
            if x % 10 == 3:
                print(" {:d}".format(i),end="")
                break
            x = x // 10
    i += 1
print("")


Measured memory_bytes: 5876
#include <iostream>
#include <cstdio>
using namespace std;

int n, t, s, a, b;
int main()
{
	cin >> n >> t;
	while (n--) {
		scanf("%d", &a);
		if (a > b) s += b - a;
		b = a + t;
	}
    cout << s + b << endl;
    return 0;
}

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

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


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

int main(){
  string S;
  cin>>S;
  int rest=15-S.size();
  int wins=0;
  for(int i=0;i<S.size();i++){
    if(S[i]=='o') wins++;
  }
  if(wins+rest>=8) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int m[100];
	int N;
	int X;
	int i;
	int min;
	
	scanf("%d %d", &N, &X);
	
	for (i = 0; i < N; i++){
		scanf("%d", &m[i]);
		X -= m[i];
	}
	
	min = m[0];
	
	for (i = 1; i < N; i++){
		if (min > m[i]){
			min = m[i];
		}
	}
	
	printf("%d\n", (X / min) + N);
	
	return (0);
}

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

void solve(int N, int M) {
    vector<int> H(1), W(1);
    rep(i, N) {
        int a; cin >> a;
        H.push_back(H.back() + a);
    }
    rep(i, M) {
        int a; cin >> a;
        W.push_back(W.back() + a);
    }
    map<int, int> mp;
    rep(i, N) for(int j = i + 1; j < N + 1; ++j) {
        mp[H[j] - H[i]]++;
    }
    int ans = 0;
    rep(i, M) for(int j = i + 1; j < M + 1; ++j) {
        ans += mp[W[j] - W[i]];
    }
    cout << ans << '\n';
}

int main() {
    int N, M;
    while(cin >> N >> M) {
        if(!N) break;
        solve(N, M);
    }
    return 0;
}



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

static int N = 13;
static int MOD_ANS = 1000000007;

int main() {
    string str;
    cin >> str;
    long dp[str.length() + 1][N];
    for (int i = 0; i < str.length() + 1; i++) {
        for (int j = 0; j < N; j++) {
            dp[i][j] = 0;
        }
    }
    int mod = 1;
    dp[0][0] = 1;
    for (int i = str.length() - 1; i >= 0; i--) {
        int digit = str.length() - 1 - i;
        int number;
        if (str[i] != '?') {
            number = ((str[i] - '0') * mod) % N;
            for (int j = 0; j < N; j++) {
                dp[digit + 1][(number + j) % N] = dp[digit][j];
            }
        } else {
            for (int k = 0; k < 10; k++) {
                number = (k * mod) % N;
                for (int j = 0; j < N; j++) {
                    dp[digit + 1][(number + j) % N] += dp[digit][j];
                    dp[digit + 1][(number + j) % N] %= MOD_ANS;
                }
            }
        }
        mod *= 10;
        mod %= N;
    }
    cout << dp[str.length()][5] << endl;
}


Measured memory_bytes: 10752
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s;
    cin >> s;
    for(int i=0;i<19;i++){
        if(s.at(i)==',') s.at(i)=' ';
        cout << s.at(i);
    }
    cout << endl;
    
}

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

using ll = long long;

ll f(ll i, ll n) {
  ll sum = 0;
  while (n > 0) {
    sum += n % i;
    n /= i;
  }
  return sum;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n, s;
  cin >> n >> s;
  
  if (s == n) {
    cout << n + 1 << '\n';
    return 0;
  }
  
  if (n < s) {
    cout << -1 << '\n';
    return 0;
  }
  
  for (ll i = 2; i * i <= n; i++) {
    if (f(i, n) == s) {
      cout << i << '\n';
      return 0;
    }
  }
  
  for (ll i = sqrt(n); i >= 1; i--) {
    ll b = (n - s) / i + 1;
    if (b < 2) continue;
    if (f(b, n) == s) {
      cout << b << '\n';
      return 0;
    }
  }
  
  cout << -1 << '\n';
}

Measured memory_bytes: 3660
h, w = list(map(int, input().split()))
sss = ['x' * (w + 2)] + list('x' + input() + 'x' for _ in range(h)) + ['x' * (w + 2)]
checked = [[False] * (w + 2) for _ in range(h + 2)]
ans = 0
move = [(1, 0), (-1, 0), (0, 1), (0, -1)]


def dfs(i, j):
    w_cnt, b_cnt = 0, 0
    q = [(i, j, sss[i][j] == '.')]
    while q:
        y, x, is_white = q.pop()
        if checked[y][x]:
            continue
        checked[y][x] = True
        if is_white:
            w_cnt += 1
        else:
            b_cnt += 1

        for di, dj in move:
            ni = y + di
            nj = x + dj
            if checked[ni][nj]:
                continue
            nc = sss[ni][nj]
            if nc == 'x':
                continue
            elif (nc == '.') == is_white:
                continue
            else:
                q.append((ni, nj, nc == '.'))
    return w_cnt * b_cnt


for i in range(1, h + 1):
    for j in range(1, w + 1):
        if checked[i][j]:
            continue
        ans += dfs(i, j)
print(ans)


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<vector<int>> F(N, vector<int>(10));
    vector<vector<int>> P(N, vector<int>(11));
    rep(i, N) rep(j, 10) cin >> F[i][j];
    rep(i, N) rep(j, 11) cin >> P[i][j];

    ll ans = -100100100100;
    rep(bit, 1 << 10) {
        if (bit == 0) continue;
        ll tmp = 0;
        rep(i, N) {
            int cnt = 0;
            rep(j, 10) if (F[i][j] & (bit >> j)) cnt++;
            tmp += P[i][cnt];
        }
        chmax(ans, tmp);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    def dfs(u=0,cnt=1):
        if cnt==n:return 1
        res=0
        for cu in to[u]:
            if vis[cu]:continue
            vis[cu]=True
            res+=dfs(cu,cnt+1)
            vis[cu]=False
        return res

    n,m=MI()
    to=defaultdict(list)
    for _ in range(m):
        a,b=MI1()
        to[a].append(b)
        to[b].append(a)
    vis=[False]*n
    vis[0]=True
    print(dfs())

main()

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

int main() {
    llint K, X;
    cin >> K >> X;
    for(int i = max(-1'000'000LL, X - K + 1); i <= min(1'000'000LL, X + K - 1); i++) {
        cout << i << " ";
    }
}

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

long long pow(long long x,long long n,long long mod){
  long long res = 1;
  while(n>0){
    if(n&1) res = res*x%mod;
    x = x*x%mod;
    n >>=1;
  }
  return res%mod;
}
int main(){
  long long N;
  cin >> N;
  long long M = 1000000000+7;
  long long ans = pow(10,N,M);
  ans += pow(8,N,M)+2*M;
  ans -= 2*pow(9,N,M);  
  ans %= M;
  cout << ans << endl;
}

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

using namespace std;

using ll = long long;

string Solve() {
    int n, m;
    cin >> n >> m;

    int max_score = 0;
    array<int, 10> s = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    vector<int> a(m);
    for (int i = 0; i < m; ++i) {
        cin >> a[i];
        max_score = max(max_score, s[a[i]]);
    }

    const int len = n / 2;
    vector<vector<bool>> dp(len + 1, vector<bool>(n + 1, false));
    vector<vector<int>> prev(len + 1, vector<int>(n + 1, -1));
    dp[0][0] = true;
    for (int i = 0, sum = 0; i < len; ++i) {
        for (int j = 0; j <= sum; ++j) {
            for (const int d : a) {
                if (j + s[d] <= n && dp[i][j]) {
                    dp[i + 1][j + s[d]] = true;
                    prev[i + 1][j + s[d]] = max(prev[i + 1][j + s[d]], d);
                }
            }
        }
        sum += max_score;
    }

    string res;
    int sum = n;
    for (int i = len; 1 <= i; --i) {
        if (dp[i][sum]) {
            res += string(1, (char)(prev[i][sum] + '0'));
            sum -= s[prev[i][sum]];
        }
    }

    return res;
}

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

    cout << Solve() << endl;

    return 0;
}


Measured memory_bytes: 202240
import Foundation
func sqrtd(_ a: Int, _ N: Int) -> Int {
  var a = a
  var current = 0
  while a < N {
    a *= 2
    current += 1
  }
  return current
}

let input = readLine()!.split(separator: " ").map { Int($0)! }

let N = input[0]
let K = input[1]

var sum: Double = 0.0
let coe = 1.0 / Double(N)
for i in 0..<N {
  let current = i + 1
  if current >= K {
    sum += coe
    continue
  }
  let times = sqrtd(current, K)
  sum += coe * pow(0.5, Double(times))
}
print(sum)

Measured memory_bytes: 13724
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


bool edge[8][8];
bool visit[8];
int ans=0;
int N;

void dfs(int x){
  if (visit[x]) return;
  visit[x]=true;
  bool work=true;
  REP(i, N) work = work && visit[i];
  if(work) ++ans;
  REP(i, N){
    if(edge[x][i]==1) dfs(i);
  }
  visit[x]=false;
  return;
}

int main(){
  int M;
  cin>>N>>M;
  REP(i, N)REP(j, N)edge[i][j]=false;
  int a, b;
  REP(i, M){
    cin>>a>>b;
    edge[a-1][b-1]=true;
    edge[b-1][a-1]=true;
  }

  REP(i, N) visit[i]=false;
  dfs(0);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6;
int d()
{
    int ret;
    scanf("%d", &ret);
    return ret;
}
long long lld()
{
    long long ret;
    scanf("%lld", &ret);
    return ret;
}
bool cmp(pair<int, int> s, pair<int, int> f)
{
    if (f.first > s.first)
        return true;
    else if (f.first == f.second && f.second < s.second)
        return true;
    else
        return false;
}
long long arr[N],n;
bool IsCover(long long d){
    long long lastcover=-1,used=0;
    for(int i=0;i<n;i++){
        if(arr[i]>lastcover){
        lastcover=arr[i]+(2*d);
        used++;
        }

    }
    return used<=3;
}
long long PS(){
    long long hi=1e5,lo=0,mid;
    while(hi-lo > 0){
        mid=(lo+hi)/2;
        if(IsCover(mid))hi=mid;
        else lo=mid+1;
    }
    return lo;
}
char num1[106],num2[106];
bool flag=false;
int main(){
scanf("%s",num1);
scanf("%s",num2);
int n1=strlen(num1);
int n2=strlen(num2);
if(n1>n2)
printf("GREATER\n");
else if(n2>n1)
printf("LESS\n");
else{

for(int i=0;i<n1;i++){
    if(num1[i] > num2[i]){
    printf("GREATER\n");
    flag=1;
    break;
    }
    else if(num1[i]< num2[i]){
    printf("LESS\n");
    flag=1;
    break;
    }
}
if(flag==0)
printf("EQUAL\n");

}

}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,tune=native")
//#pragma GCC optimize("unroll-loops")

#ifdef __APPLE__
    # include <iostream>
    # include <cmath>
    # include <algorithm>
    # include <stdio.h>
    # include <cstdint>
    # include <cstring>
    # include <string>
    # include <cstdlib>
    # include <vector>
    # include <bitset>
    # include <map>
    # include <queue>
    # include <ctime>
    # include <stack>
    # include <set>
    # include <list>
    # include <random>
    # include <deque>
    # include <functional>
    # include <iomanip>
    # include <sstream>
    # include <fstream>
    # include <complex>
    # include <numeric>
    # include <immintrin.h>
    # include <cassert>
    # include <array>
    # include <tuple>
    # include <unordered_map>
    # include <unordered_set>
    # include <thread>
#else
    # include <bits/stdc++.h>
#endif

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define files(name) name!=""?freopen(name".in","r",stdin),freopen(name".out","w",stdout):0
#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define elif else if
#define mp make_pair
#define pb push_back
#define fir first
#define sec second

using namespace std;
#define int long long

typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;

const int arr=2e5+10;
const int ar=2e3+10;
const ld pi=acos(-1);
const ld eps=1e-10;
const ll md=1e9+7;
const ll inf=1e18+10;

///---program start---///

int a[arr];
int b[arr];

signed main()
{
    #ifdef __APPLE__
        files("barik");
        freopen("debug.txt","w",stderr);
    #endif

    int n,m,k;
    cin>>n>>m>>k;
    for (int i=0;i<n;i++){
        cin>>a[i];
        if (i){
            a[i]+=a[i-1];
        }
    }
    for (int i=0;i<m;i++){
        cin>>b[i];
        if (i){
            b[i]+=b[i-1];
        }
    }
    int cur=m-1;
    int ans=0;
    for (int i=-1;i<n;i++){
        if (i==-1 || a[i]<=k){
            while (cur>=0 && (i==-1?0:a[i])+b[cur]>k){
                cur--;
            }
            ans=max(ans,(i+1)+(cur+1));
        }
    }
    cout<<ans<<"\n";
}


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

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>	       vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)	           for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

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

	ll n;
	cin >> n;
	string s = "";
	while (n) {
		s += 'a' + (n - 1) % 26;
		n = (n - 1) / 26;
	}
	cout << string(riter(s)) << endl;
	return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
struct fastio { fastio () { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } _io;
template<class T, class U> bool chmax(T& a, const U &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> bool chmin(T& a, const U &b) { if (a > b) { a = b; return 1; } return 0; }

constexpr unsigned int D = 365;
constexpr unsigned int type = 26;
constexpr int INF = (1 << 30);
constexpr int X = 200;

using Data = pair<int, pair<array<int, type>, vector<int>>>;

array<int, type> c;
array<array<int, type>, D> s;

void input () {
	int buff;
	cin >> buff;
	for (int &i : c) cin >> i;
	for (int i = 0; i < D; i++) {
		for (int j = 0; j < type; j++) {
			cin >> s[i][j];
		}
	}
}

vector<pair<int, int>> calc (int day, const array<int, type> &last) {
	array<int, type + 1> l, r; l[0] = r[type] = 0;
	vector<pair<int, int>> score;
	for (int i = 0; i < type; i++) l[i + 1] = l[i] + c[i] * (day - last[i]);
	for (int i = type; i > 0; i--) r[i - 1] = r[i] + c[i - 1] * (day - last[i - 1]);
	for (int i = 0; i < type; i++) {
		int val = s[day - 1][i] - (l[i] + r[i + 1]);
		score.emplace_back(val, i);
	}
	auto comp = [&](const pair<int, int> &r, const pair<int, int> &l) {
		if (r.first == l.first) {
			if (day == D) return r.second < l.second;
			return (s[day][r.second] > s[day][l.second]);
		}
		return (r.first > l.first);
	};
	sort(score.begin(), score.end(), comp);
	return score;
}


int main() {
	input();
	vector<Data> dat;
	{
		array<int, type> a;
		vector<int> b(0);
		fill(a.begin(), a.end(), 0);
		dat.emplace_back(0, pair(a, b));
	}
	
	auto comp = [](const Data &lhs, const Data &rhs) {
		return (lhs.first > rhs.first);
	};

	for (int day = 0; day < D; day++) {
		vector<Data> buff;
		for (size_t i = 0; i < dat.size(); i++) {
			vector<pair<int, int>> cd = calc(day + 1, dat[i].second.first);
			for (auto [v, id] : cd) {
				int val = dat[i].first + v;
				array<int, type> nxt;
				vector<int> con;
				tie(nxt, con) = dat[i].second;
				nxt[id] = day + 1;
				con.push_back(id);
				buff.emplace_back(val, pair(nxt, con));
			}
		}
		sort(buff.begin(), buff.end(), comp);
		buff.resize(X);
		dat.swap(buff);
	}

	for (int a : dat[0].second.second) cout << a+1 << '\n';
	
	return 0;
}

Measured memory_bytes: 15052
import heapq


def main():
    _ = input()
    A = list(map(int, input().split()))
    heapq.heapify(A)

    while len(A) > 1:
        n1 = heapq.heappop(A)
        n2 = heapq.heappop(A)
        n = (n1 + n2) / 2
        heapq.heappush(A, n)

    print(sum(A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
base= list(map(int,input().split()))
base.sort()

count = (base[2]-base[0])//2 + (base[2]-base[1])//2
base[0] = base[2] - (base[2]-base[0])%2
base[1] = base[2] - (base[2]-base[1])%2

judge_0 = base[2]-base[0]
judge_1 = base[2]-base[1]
#print(judge_0,judge_1)
if (judge_0 == 0) and (judge_1 == 0):
  ans = count
elif (judge_0 == 0) and (judge_1 == 1):
  ans = count + 2
elif (judge_0 == 1) and (judge_1 == 0):
  ans = count + 2
elif (judge_0 == 1) and (judge_1 == 1):
  ans = count + 1
  
print(ans)

Measured memory_bytes: 3316
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	v, _ := strconv.Atoi(read())
	return v
}

func main() {
	sc.Split(bufio.ScanWords)
	flag := true
	sum := 0

	arr := make([]int, 5)
	for i := 0; i < 5; i++ {
		arr[i] = nextInt()
		// fmt.Println(arr[i])
	}

	k := nextInt()

	for i := 4; i > 0; i-- {
		for j := 3; j > -1; j-- {

			sum = arr[i] - arr[j]
			// fmt.Println(arr[i], arr[j], sum)
			if sum > k {
				flag = false
			}

		}
	}

	if flag {
		fmt.Println("Yay!")
	} else {
		fmt.Println(":(")
	}
}


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

typedef long long ll;

struct Countflag{
  int indent;
  int gathercount;
};

int main(){
  string s;
  cin >> s;
  vector<Countflag> loopflag;
  vector<int> endflag(1);
  endflag[0] = -1;
  Countflag cf;
  int point = 0;
  for(int i=0;i<s.length()-1;i++){
    if(s[i]=='R' && s[i+1]=='L') {
      cf.indent = i; cf.gathercount=0;
      loopflag.push_back(cf);
      cf.indent = i+1;
      loopflag.push_back(cf);
    }
    if(s[i]=='L' && s[i+1]=='R'){
      endflag.push_back(i);
    }
  }
  endflag.push_back(s.length()-1);

  for(int i=0;i<endflag.size()-1;i++){
    int interval = endflag[i+1]-endflag[i];
    if(interval%2 == 0){
      loopflag[2*i].gathercount = interval/2;
      loopflag[2*i+1].gathercount = interval/2;
    }else{
      if((endflag[i+1]-loopflag[2*i].indent)%2==0) {
	loopflag[2*i].gathercount = interval/2+1;
	loopflag[2*i+1].gathercount = interval/2;
      }else{
	loopflag[2*i].gathercount = interval/2;
	loopflag[2*i+1].gathercount = interval/2+1;
      }
    }
  }

  int loopcount=0;
  for(int i=0;i<s.length();i++){
    if(i==0){
      if(loopcount!=loopflag.size()){
	if(i==loopflag[loopcount].indent){
	  cout << loopflag[loopcount].gathercount;
	  loopcount++;
	}else cout  << 0;
      }else cout  << 0;
    }else{
      if(loopcount!=loopflag.size()){
	if(i==loopflag[loopcount].indent){
	  cout << " " << loopflag[loopcount].gathercount;
	  loopcount++;
	}else cout << " " << 0;
      }else cout << " " << 0;
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 1784
#include<bits/stdc++.h>
#define ll  long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pb push_back
#define Max(x,y,z) max(x,max(y,z))
#define f first
#define s second
#define lbd lower_bound
#define sz(x)       (ll)x.size()
#define pi 3.1415926536
#define mod 1000000007
using namespace std;
void solve()
{
    ll n,m,k,x,y,res=0,l,cnt0=0,sum=0,z,sum1=0,cnt1=0,h,res1,cnt2=0;
    string s1;
    cin>>s1;
    n=sz(s1);
    stack<ll> st;
    for(auto &it:s1)
    {
        if(it=='0')
        {
            if(st.size() && st.top()=='1')
            {sum+=2;st.pop();}
            else
                st.push(it);
        }
        else
        {
            if(st.size() && st.top()=='0')
            {
                sum+=2;st.pop();
            }
            else
                st.push(it);
        }
    }
    cout<<sum;


}
int main()
{   speed_up
    ll t;
   // cin>>t;
    t=1;
    while(t--)
        solve();
}


Measured memory_bytes: 1232
import java.util.Scanner;

public class Main {
	public static void main(String... args) {
		Scanner scan = new Scanner(System.in);
		long a = (long)scan.nextInt();
		long b = (long)scan.nextInt();
		long c = (long)scan.nextInt();

		long v1 = 4 * a * b;
		long v2 = (c - a - b) * (c - a - b);

		System.out.println(v1 < v2 && a + b < c ? "Yes" : "No");

		scan.close();
	}
}

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


int main(){

    int A , P; std::cin >> A >> P;

    int num = A * 3 + P;

    int ans = num / 2;

    std::cout <<ans;

    system("pause");

    return 0;

}

Measured memory_bytes: 504
#include <stdio.h>

#define MAX (20)

int main(){

    int a;  // a円/回
    int b;  // 所持金 b円
    int c;  // c回聞ければ満足 = c回以上は聞かない
    int n;  // 音を聞ける回数

    // 値の入力
    scanf("%d %d %d", &a, &b, &c);

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

}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1e9+7;
const ll  longinf = 1LL<<60;
const int mod=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int main(){
  int n;cin>>n;
  rep(i,n){
    ll a,b;
    cin>>a>>b;
    if(a==b){
      cout<<2*(a-1)<<endl;
      continue;
      }
    if(a>b)swap(a,b);
    ll ret=sqrt(a*b);
    ll ans=a-2+sqrt(a*b);
    ans+=(a*b-1)/ret-a;
    cout<<ans<<endl;
    }
  
  return 0;
  }

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

namespace ConsoleApp16
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            // 
            string[] c = a.Split(' ');

            int A = Convert.ToInt32(c[0]);

            int B = Convert.ToInt32(c[1]);

            int Con = 1;

            int tap = 0;

            while(Con<B)
            {
                Con = Con - 1 + A;
                tap = tap + 1;
            }
            
            Console.WriteLine(tap);

            
            Console.Read();
        }
    }
}


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

using namespace std;

int n;
long long int ans;

struct ss
{
	char c[15];
	string s;
}S[100010];

bool cmp1(char a,char b)
{
	return a<b;
}

bool cmp(ss a,ss b)
{
	return a.s<b.s;
//	for(int i=0;i<10;i++)
//		if(a.c[i]!=b.c[i])
//		    return a.c[i]<b.c[i];
//	return 1;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",S[i].c);
//		for(int j=0;j<10;j++)
//		    S[i].c[j]='a';
		sort(S[i].c,S[i].c+10,cmp1);
		for(int j=0;j<10;j++)
		    S[i].s=S[i].s+S[i].c[j];
	}
	sort(S+1,S+1+n,cmp);
//	for(int i=1;i<=n;i++)
//	{
//		for(int j=0;j<=10;j++)
//		    printf("%c",S[i].c[j]);
//		printf("\n");
//	}
	long long int sum=1;
	for(int i=2;i<=n;i++)
	{
		int bj1=1;
	    for(int j=0;j<10;j++)
	    {
	    	if(S[i].c[j]!=S[i-1].c[j])
	    	{
	    		bj1=0;
	    		break;
			}
		}
		if(bj1==1)
		    sum++;
		else
		{
			ans=ans+(sum-1)*sum/2;
			sum=1;
		}
	}
	ans=ans+(sum-1)*sum/2;	
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
#define maxn 100100
using namespace std;
struct edge{
	int r,nxt;
}e[maxn<<1];
int head[maxn],n,m,col[maxn],esz;
void addedge(int u,int v){
	e[++esz].r=v;e[esz].nxt=head[u];head[u]=esz;
	e[++esz].r=u;e[esz].nxt=head[v];head[v]=esz;
}
void dfs(int u){
	for(int t=head[u];t;t=e[t].nxt)
		if(col[e[t].r]){
			if(col[e[t].r]==(col[u]==1?2:1))continue;
			printf("%lld",1ll*n*(n-1)/2-m);
			exit(0);
		} else col[e[t].r]=(col[u]==1?2:1),dfs(e[t].r);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1,u,v;i<=m;++i)
		scanf("%d%d",&u,&v),addedge(u,v);
	col[1]=1,dfs(1);
	int sum=0;
	for(int i=1;i<=n;++i)if(col[i]==1)sum++;
	printf("%lld",1ll*sum*(n-sum)-m);
}

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

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n, k;
    cin >> n >> k;
    ll r, s, p;
    cin >> r >> s >> p;
    string t;
    cin >> t;
    const ll RR = 0, SS = 1, PP = 2;

    ll ans = 0;
    for (ll i = 0; i < k; ++i) {
        vector<vector<ll>> dp(n / k + 10, vector<ll>(3));
        ll tmp = 0;
        for (ll j = i; j < n; j += k) {
            ll idx = j / k;
            rep(now, 3) {
                rep(prev, 3) {
                    if (idx > 0 && now == prev) continue;
                    if (t[j] == 'r') {
                        if (now == PP) {
                            dp[idx + 1][now] = max(dp[idx + 1][now], dp[idx][prev] + p);
                        } else {
                            dp[idx + 1][now] = max(dp[idx + 1][now], dp[idx][prev]);
                        }
                    } else if (t[j] == 's') {
                        if (now == RR) {
                            dp[idx + 1][now] = max(dp[idx + 1][now], dp[idx][prev] + r);
                        } else {
                            dp[idx + 1][now] = max(dp[idx + 1][now], dp[idx][prev]);
                        }
                    } else {
                        if (now == SS) {
                            dp[idx + 1][now] = max(dp[idx + 1][now], dp[idx][prev] + s);
                        } else {
                            dp[idx + 1][now] = max(dp[idx + 1][now], dp[idx][prev]);
                        }
                    }
                }
                tmp = max(tmp, dp[idx + 1][now]);
            }
        }
        ans += tmp;
    }
    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  string s;
  cin >> s;
  int cnt = 0;
  rep (i, 3) if (s[i] == 'R') cnt++;
  if (cnt == 0) {
    cout << 0 << endl;
  } else if (cnt == 1) {
    cout << 1 << endl;
  } else if (cnt == 3) {
    cout << 3 << endl;
  } else if (s[1] == 'R') {
    cout << 2 << endl;
  } else {
    cout << 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 3520
using namespace std;

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <numeric>
#include <map>
using namespace std;


int main(void){
	int N,M;
  string S;

	cin >> S;

	for (int i = 0;i < S.length() - 1;i++)
      if (S[i] == S[i+1]){
        cout << "Bad" << endl;
        return 0;
      }

      cout << "Good" << endl;
  	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<queue>
#define ll long long
#define PI 3.141592653589793
using namespace std;
int main() {
	double a, b, x;
	cin >> a >> b >> x;

	if (pow(a, 2)*b / 2 <= x) {
		printf("%.7f\n",atan((2*b-(2*x)/pow(a,2)) / a)*180/PI);
	}
	else {
		printf("%.7f\n", atan((b) / ((2 * x) / (a* b))) * 180 / PI);
	}
}

Measured memory_bytes: 256
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template < typename T >
using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

typedef long long ll;
typedef double db;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define pb push_back
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const db PI = acos(-1);
const ll MOD = 1e9 + 7, INF = LLONG_MAX;
const ll N = 1e5 + 10;

ll p[N], y[N];
string ans[N];
vector < pll > belong[N];

void test_case();

int main() {
	fast_io();
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	ll n, m;
	cin >> n >> m;
	for (ll i = 1; i <= m; ++i) {
		cin >> p[i] >> y[i];
		belong[p[i]].pb({y[i], i});
	}
	for (ll i = 0; i <= n; ++i) {
		sort(belong[i].begin(), belong[i].end());
		string pref = to_string(i);
		while (pref.size() != 6) {
			pref = "0" + pref;
		}
		for (ll j = 0; j < belong[i].size(); ++j) {
			string suff = to_string(j + 1);
			while (suff.size() != 6) {
				suff = "0" + suff;
			}
			ans[belong[i][j].second] = pref + suff;
		}
	}
	for (ll i = 1; i <= m; ++i) {
		cout << ans[i] << "\n";
	}
}

Measured memory_bytes: 13952
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
using namespace std;
int main(void)
{
  int h,w;
  cin >> h >> w;
  REP(i,h) REP(j,w){
    string s;
    cin >> s;
    char c = 'A'+j;
    if(s=="snuke") cout << c << i+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 1501
using namespace std;
struct pt { int u,k; };
pt h[N];
vector <int> a[N],c[N],vec;
const int oo=round(1e9);
int u,v,k,n,m,i,f[N][N],d[N],vt[N],nh,ma,dd[N];
void up(int u)
{
    while(1)
    {
        int p=u/2;
        if(p==0 || h[p].k<h[u].k) break;
        swap(vt[h[u].u],vt[h[p].u]);
        swap(h[u],h[p]);
        u=p;
    }
}
void down(int u)
{
    while(1)
    {
        int p=u*2;
        if(p<nh && h[p+1].k<h[p].k) p++;
        if(p>nh || h[p].k>h[u].k) break;
        swap(vt[h[u].u],vt[h[p].u]);
        swap(h[u],h[p]);
        u=p;
    }
}
void push(int u,int k)
{
    h[++nh]={ u,k }; vt[u]=nh;
    up(nh);
}
void pop()
{
    swap(h[1],h[nh--]); vt[h[1].u]=1;
    down(1);
}
void dijkstraf(int s)
{
    nh=0;
    for(int u=1;u<=n;u++) { vt[u]=0; f[s][u]=oo; }
    f[s][s]=0; push(s,0);
    while(nh>0)
    {
        int u=h[1].u; pop();
        ma=max(ma,f[s][u]);
        for(int i=0;i<a[u].size();i++)
        {
            int v=a[u][i];
            if(f[s][v]>f[s][u]+c[u][i])
            {
                f[s][v]=f[s][u]+c[u][i];
                if(vt[v]==0) push(v,f[s][v]);
                else { h[vt[v]].k=f[s][v]; up(vt[v]); }
            }
        }
    }
}
void dijkstrad(int s)
{
    nh=0;
    for(int u=1;u<=n;u++) { vt[u]=0; d[u]=oo; }
    for(int u=1;u<=n;u++)
        if(f[s][u]==ma) { d[u]=0; push(u,0); }
    while(nh>0)
    {
        int u=h[1].u; pop();
        if(f[s][u]+d[u]==ma) dd[u]=1;
        for(int i=0;i<a[u].size();i++)
        {
            int v=a[u][i];
            if(d[v]>d[u]+c[u][i])
            {
                d[v]=d[u]+c[u][i];
                if(vt[v]==0) push(v,d[v]);
                else { h[vt[v]].k=d[v]; up(vt[v]); }
            }
        }
    }
}
int main()
{
    //freopen("ztown.inp","r",stdin);
    //freopen("Ztown.out","w",stdout);
    cin>>n>>m;
    while(m--)
    {
        cin>>u>>v>>k;
        a[u].push_back(v); a[v].push_back(u);
        c[u].push_back(k); c[v].push_back(k);
    }
    for(u=1;u<=n;u++) dijkstraf(u);
    for(u=1;u<=n;u++) dijkstrad(u);
    for(u=1;u<=n;u++)
        if(dd[u]==0) vec.push_back(u);
    cout<<vec.size()<<'\n';
    for(i=0;i<vec.size();i++) cout<<vec[i]<<'\n';
}



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

namespace AtCoder
{
	public class ABC
	{
		static int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			// int n = int.Parse(Console.ReadLine());
			string s = Console.ReadLine();
			// int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			switch (s) {
				case "SUN":
					Console.WriteLine(7);
					break;
				case "MON":
					Console.WriteLine(6);
					break;
				case "TUE":
					Console.WriteLine(5);
					break;
				case "WED":
					Console.WriteLine(4);
					break;
				case "THU":
					Console.WriteLine(3);
					break;
				case "FRI":
					Console.WriteLine(2);
					break;
				case "SAT":
					Console.WriteLine(1);
					break;
			}


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13152
from fractions import gcd
import sys
input = sys.stdin.readline

N,M=map(int,input().split())
List=list(map(lambda x:int(x)//2,map(int, set(input().split()))))

def main():
    LCM=1

    for i in List:
        LCM*=i//gcd(LCM,i)

    for i in List:
        if LCM//i%2==0:
            print(0)
            exit()

    print(int(M//(LCM*2)+M%(LCM*2)//LCM))


if __name__ == '__main__':
    main()

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

void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;

  cout << endl;
}

int main() {
	int n;
	cin >> n;
	call(n);
	return 0;
}

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

ll maxIndex(vector<ll> &v) {
  ll n = v.size();
  pair<ll, ll> mi = {0, v[0]};
  for(ll i = 0; i < n; i++) {
    if(v[i] > mi.first) {
      mi = {i, v[i]};
    }
  }
  return mi.first;
}

bool f(ll n, ll K) {
  vector<ll> ans(n);

  ans[0] = (K / n) + 1;
  for(ll i = 1; i < n; i++) {
    ans[i] = ans[i - 1] + 1;
  }

  // ((K / n) + 1) * n回かかってしまっている
  // こっから((K / n) + 1) * n - K回進めれば良い

  for(ll i = 0; i < ((K / n) + 1) * n - K; i++) {
    int mi = maxIndex(ans);
    for(ll j = 0; j < n; j++) {
      if(mi == j) {
        ans[j] -= n;
      }else {
        ans[j] += 1;
      }
    }

  }

  for(ll i = 0; i < n; i++) {
    if(ans[i] > 10000000000001000 || ans[i] < 0) {
      return false;
    }
  }

  cout << n << endl;
  for(ll i = 0; i < n; i++) {
    if(i == 0) {
      cout << ans[i];
    }else {
      cout << ' ' << ans[i];
    }
  }
  cout << endl;

  return true;
}

int main() {
  ll K;
  cin >> K;

  if(K == 0) {
    cout << 4 << endl;
    cout << "3 3 3 3" <<endl;
    return 0;
  }

  if(K == 1) {
    cout << 3 << endl;
    cout << "1 0 3" << endl;
    return 0;
  }

  if(K <= 49) {
    cout << K << endl;
    for(ll i = 1; i <= K; i++) {
      if(i == 1) {
        cout << i;
      }else {
        cout << ' ' << i;
      }
    }
    cout << endl;
    return 0;
  }


  for(ll i = 50; i >= 2; i--) {
    if(f(i, K)) {
      return 0;
    }
  }


}


Measured memory_bytes: 256
// ALDS1_12_C.cpp
// Graph II - Single Source Shortest Path II
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <queue>
using namespace std;

struct Node {
    int v;
    int c;
    Node(int v, int c): v(v), c(c) {}
};

const int maxN = 10000;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
static const int INF = (1<<21);
vector<Node> G[maxN];
vector<int> dist(maxN, INF);
vector<int> p(maxN);
vector<int> color(maxN, WHITE);
priority_queue<pair<int, int>> mq;
int n;

void dijkstra(int x)
{
    dist[x] = 0;
    p[x] = -1;
    mq.push({-dist[x], x});
    while(!mq.empty()) {
        pair<int, int> P = mq.top();
        mq.pop();
        int mindist = -P.first;
        int u = P.second;
        if (color[u] == BLACK) continue;

        for (int i = 0; i < G[u].size(); i++) {
            if (color[u] == BLACK) continue;
            int v = G[u][i].v;
            int c = G[u][i].c;
            if (dist[u] + c < dist[v]) {
                dist[v] = dist[u] + c;
                p[v] = u;
                color[v] = GRAY;
                mq.push({-dist[v], v});
            }
        }
        color[u] = BLACK;
    }
}

int main()
{
//    freopen("in7.txt", "r", stdin);
//    freopen("out7.txt", "w", stdout);
    cin >> n;
    int u, k;
    int v, c;
    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            cin >> v >> c;
            G[i].push_back(Node(v, c));
        }
    }
    dijkstra(0);
    for (int i = 0; i < n; i++) {
        printf("%d %d\n", i, dist[i]);
    }
    return 0;
}

Measured memory_bytes: 8204
n = int(input())
infinity = float("inf")

x = list(map(int, input().split()))
y = list(map(int, input().split()))

p = [1, 2, 3, infinity]

for i in p:
    if i != infinity:
        total = 0
        for X, Y in zip(x, y):
            total += (abs(X - Y)) ** i
        D = total ** (1/i)
        print(D)
    else:
        d = list()
        for X, Y in zip(x, y):
            d.append(abs(X - Y))
        print(max(d))


Measured memory_bytes: 5648
#include<bits/stdc++.h>
using namespace std;
int a[50];
int b[50];
int c[50];
int w[500][500];
int n,k1,k2,ans=10000000;
int min(int a,int b)
{
	return a<b?a:b;
}
int main()
{
	scanf("%d",&n);
	scanf("%d%d",&k1,&k2);
	memset(w,127,sizeof(w));
    for(int i=1;i<=n;i++)	
	    scanf("%d%d%d",&a[i],&b[i],&c[i]);
	for(int i=0;i<=406;i++) 
	    for(int j=0;j<=406;j++)
		    w[i][j]=9999999;    
	w[0][0]=0;   
	for(int i=1;i<=n;i++)
	    for(int j=405;j>=0;j--)
	        for(int t=405;t>=0;t--)
	            {
	                 w[j+a[i]][t+b[i]]=min(w[j][t]+c[i],w[j+a[i]][t+b[i]]);  	
	            }
	for(int i=0;i<=405;i++)
	    for(int j=0;j<=405;j++)
		    {
		    	if(w[i][j]!=9999999&&i*k2==j*k1)
		    	   {
		    	   	   if(w[i][j]<ans&&w[i][j]!=0)
		    	   	      ans=w[i][j];
		    	   }
		    }
	if(ans!=10000000)		        
	printf("%d",ans);
	else
	printf("-1");		  
	return 0;
}

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

int main(){
    int A,B,C; cin>>A>>B>>C;
    if(A==B || A==C || B==C){
        if(A==B && B==C) cout<<"No"<<endl;
        else cout <<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}

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

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

Measured memory_bytes: 256