akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
  var b = nextLine()
  var ret = ""

  if b == "A" {
    ret = "T"
  }

  if b == "T" {
    ret = "A"
  }

  if b == "C" {
    ret = "G"
  }

  if b == "G" {
    ret = "C"
  }
  fmt.Println(ret)
}


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

int main(){
	int n;
	cin >> n;
	int temp = n / 10;
	if(n % 10 == 0)temp++;
	int count = 1;
	while(temp != 0){
		temp = temp / 10;
		count++;
	}

	int ans = 0;
	
	if(count % 2 != 0){
		ans = n - pow(10,count-1) + 1;
		count--;
	}
	// cout << count << ans << endl;
	rep(i,1,count+1){
		if(i == 1)ans += 9;
		else if(i % 2 != 0){
			ans += pow(10,i-1) * 9;
		}
	}
	cout << ans << endl;
}


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

int main()
{
    int N, K, x;
    int sum = 0;
    cin >> N >> K;

    rep(i, N)
    {
        cin >> x;
        sum += min(x, K - x) * 2;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    if (n, x) == (0, 0):
        break
    cnt = 0
    for i in range(1, n + 1):
            for j in range(i+1, n + 1):
                    for k in range(j+1, n + 1):
                        if i + j + k == x:
                            cnt+=1
    print(cnt)


Measured memory_bytes: 5596
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  string S,T="No";
  cin>>S;
  if(S=="hi"||S=="hihi"||S=="hihihi"||S=="hihihihi"||S=="hihihihihi") T="Yes";
  cout<<T;
return 0;}

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

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define PII pair<int, int>
#define mp make_pair
#define x first
#define y second

#define LL long long
#define Ldouble long double

using namespace std;

int n, a[10005], b[10005];

int main(){
  scanf("%d", &n);
  FI(i, 1, n) scanf("%d", &a[i]);
  FI(i, 1, n) scanf("%d", &b[i]);
  LL def = 0, save = 0;
  FI(i, 1, n){
    def += b[i] - a[i];
    save += max(0, b[i] - a[i] + 1) / 2;
  }
  if(def >= save) printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 384
N,K = map(int, input().split())
V = list(map(int, input().split()))

## 宝石を取得する個数、でループ
ans = 0
for k in range(K+1):
  for _ in range(K+1):
    if (k+_)>N or (k+_)>K:
      break
    
    cnt_push_stone = K-(k+_)
    
    ## 取得する宝石をリストにしてソートする
    got_stones = V[:k]+V[N-_:]
    got_stones.sort()
    
    ## 負の価値の宝石を戻す
    for i in range(min(cnt_push_stone,k+_)):
      if got_stones[i] < 0:
        got_stones[i] = 0
    
    ## 既存の最大値との比較
    ans = max(ans, sum(got_stones))

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <iterator>

using namespace std;

int main(){
    int N, K;
    cin  >> N >> K;

    int count = 0;
    while(N > 1){
        N /= K;
        count++;
    }
    if(N == 1)count++;

    cout << count << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(Scanner sc = new Scanner(System.in)){
			final long A = sc.nextLong();
			final long B = sc.nextLong();
			final long C = sc.nextLong();
			
			System.out.println((A <= C && C <= B) ? "Yes" : "No");
			
		}
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
		
		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define ALL(v) v.begin(), v.end()
const int INF = 1e9;
const int MAX = 510000;
const int MOD = 1000000007;
const double PI = acos(-1);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

/*C++になってるか確認したほうがよくない？WOWWOW*/
/*DP使ったほうがよくない？？WOWWOW*/

int main(){
    int N, M; cin>>N>>M;
    int H[N];
    for(int i=0; i<N; i++){
        cin>>H[i];
    }

    int able[N];
    for(int i=0; i<N; i++){
        able[i]=1;
    }

    int a, b;
    for(int i=0; i<M; i++){
        cin>>a>>b;
        if(H[a-1]>=H[b-1]){
            able[b-1]*=0;
        }
        if(H[a-1]<=H[b-1]){
            able[a-1]*=0;
        }
    }
    int ans=0;
    for(int i=0; i<N; i++){
        ans+=able[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4416
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b && b!=c)
        cout<<"Yes"<<endl;
    else if(a==c && c!=b)
        cout<<"Yes"<<endl;
    else if(b==c && a!=b)
        cout<<"Yes"<<endl;
    else 
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
  ll n,sum=0,num;
  cin >> n;
  vector<ll> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
    a[i] -= (i+1);
  }
  sort(a.begin(),a.end());
  num = a[n/2];
  for(int i=0;i<n;i++){
    sum += abs(a[i]-num);
  }
  if(n%2!=0){
   ll num1 = a[n/2 -1];
   ll sum1 = 0;
   for(int i=0;i<n;i++){
     sum1 += abs(a[i]-num1);
   }
   sum = (sum<sum1)?sum:sum1;
  }
  cout << sum << endl;
}


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

int ans[]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
	int k;cin>>k;cout<<ans[k]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P  = pair<int, int>;
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; }

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    int l = A-B;
    int m = C-l;
    cout << max(0, m) << endl;
    // if(m > 0) cout << m << endl;
    // else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3632
from collections import deque

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

Q = deque([0])
comfort = 0
i = 0
while Q:
    if i == n:
        break
    comfort += Q.popleft()
    if i == 0:
        Q.append(a[i])
    elif i > 0:
        Q.append(a[i])
        Q.append(a[i])
    i += 1

print(comfort)


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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a.begin(), a.end(), greater<ll>());
    ll ans = 0;
    for (int i = 0; i < (n + 1) / 2 - 1; i++)
    {
        ans += a[i];
    }
    for (int i = 0; i < (n + 1) / 2 - 1; i++)
    {
        ans += a[i + 1];
    }
    if (n % 2 == 0)
        ans += a[(n + 1) / 2 - 1];
    cout << ans << endl;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    queue<int> q;
    int INF = 1001001001;
    vector<int> dist(n, INF);
    q.push(0);
    // int now = 1;
    while(!q.empty()){
        int tmp = q.front();
        q.pop();
        auto update = [&](int i, int j){
            if(dist[i] != INF) return;
            dist[i] = j;
            q.push(i);
        };
        rep(i, g[tmp].size()){
            update(g[tmp][i], tmp);
        }
    }
    bool check = true;
    rep(i, n){
        if(dist[i] == INF) check = false;
    }
    if(!check){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    for(int i = 1; i < n; i++){
        cout << dist[i]+1 << endl;
    }

    return 0;
}

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

int main(){
	int n;
	cin >> n;
    vector<pair<double,double>> P(n);
	rep(i,n) cin >> P[i].first >> P[i].second;
	vector<int> keiro;
	rep(i,n) keiro.push_back(i);

	double ans = 0.0;
	double sum = 0.0;
	do{
		rep(i,n-1){
			double dx = P[keiro[i+1]].first - P[keiro[i]].first;
			double dy = P[keiro[i+1]].second - P[keiro[i]].second;
			ans += sqrt(dx*dx + dy*dy);
		}
		sum++;
	}while(next_permutation(keiro.begin(),keiro.end()));
	ans /= sum;
	cout << fixed << setprecision(16) << ans << endl;
	return 0;
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; 
    cin>>n;
     char c[n];int ans =1;
     cin>>c[0];
     for(int i=1;i<n;i++){cin>>c[i];if(c[i]!=c[i-1])ans++;}cout<<ans;
}

Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long ab = gcd(a, b);

		long c = 0;
		for (long i = 2; i * i <= ab; i++) {
			if (ab % i != 0) continue;
			c++;
			while (ab % i == 0) {
				ab /= i;
			}
		}
		if (ab > 1) c++;
		System.out.println(c + 1);
	}


	private static long gcd(long a, long b) {
		while (a % b != 0) {
			long x = a % b;
			a = b;
			b = x;
		}
		return b;
	}
}





Measured memory_bytes: 22996
n,m = map(int,input().split())
li_a = [list(input()) for _ in range(n)]
li_b = [list(input()) for _ in range(m)]


for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if li_a[i+k][j:j+m] != li_b[k][:]:
                break
        else:
            print("Yes")
            exit()
            
print("No")

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <chrono>
#include <cstdio>
#include <ctime>
#include <iostream>
#include <random>
#include <string>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
/*---------------------------------------*/

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int a, b; cin >> a >> b;
  if (a % 2 != 0 && b % 2 != 0) {
    cout << "Yes" << "\n";
  } else {
    cout << "No" << "\n";
  }
  return 0;
}


Measured memory_bytes: 256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const long long SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑


int win;
int main() {


	string h;
	cin >> h;
	for (int i = 0; i < h.length(); ++i) {
		if (h[i] == 'o') { ++win; }
	}

	if (15 - h.length() + win >= 8) { cout << "YES" << endl; }
	else { cout << "NO" << endl; }


}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <stack>

using namespace std;
const int maxn = 11;

int num[maxn];

int main()
{
    int ite=0;
    scanf("%d", &ite);
    while(ite--)
    {
        bool flag = true;
        for(int i=0; i<10; ++i)
        {
            scanf("%d", &num[i]);
        }

        stack<int> a, b;

        a.push(num[0]);
        int i = 1;
        while(i<10 && num[i]>a.top()){
            a.push(num[i++]);
        }
        if(i+1<10) b.push(num[i++]);
        for(; i<10; ++i){
            int dif1 = num[i] - a.top(), dif2 = num[i]-b.top();
            if(dif1<0 && dif2<0) {
                flag = false;
                break;
            }
            else if(dif1>0 && dif2>0){
                if(a.top()<b.top()) b.push(num[i]);
                else a.push(num[i]);
            }
            else{
                if(dif1>0) a.push(num[i]);
                else b.push(num[i]);
            }
        }
        if(flag)  printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}



Measured memory_bytes: 3068
def main():
    h, w, n = map(int, input().split())
    y, x = map(int, input().split())
    y -= 1
    x -= 1
    s, t = input(), input()

    u, d, l, r = 0, h - 1, 0, w - 1

    for ss, tt in zip(s[::-1], t[::-1]):
        if tt == 'U':
            d = min(d + 1, h - 1)
        elif tt == 'D':
            u = max(u - 1, 0)
        elif tt == 'L':
            r = min(r + 1, w - 1)
        else:
            l = max(l - 1, 0)  # tt == 'R'

        if ss == 'U':
            u += 1
        elif ss == 'D':
            d -= 1
        elif ss == 'L':
            l += 1
        else:
            r -= 1  # ss == 'R'

        if l > r or u > d:
            print('NO')
            return

    if l <= x <= r and u <= y <= d:
        print('YES')
        return
    else:
        print('NO')
        return


if __name__ == '__main__':
    main()

Measured memory_bytes: 4024
#include<bits/stdc++.h>
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 Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

void out(){cout << "\n";}
template<class T,class... Args>
void out(const T &x,const Args &... args){
	cout << x << " ";
	out(args...);
}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll ans=0;
	ll x;
	cin >> x;
	ll now=100.0;
	while(now<x){
		now=(double)now*1.01;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a >= k) sum++;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
def resolve():
    N = int(input())
    A = [int(input()) for i in range(N)]
    totals = [sum(A)]
    for a in A:
        totals.append(totals[0] - a)
    filtered = list(filter(lambda x: x % 10 != 0, totals))
    print(max(filtered) if len(filtered) > 0 else 0)

    

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 3064
X, K, D = map(int, input().split())
if X < 0:
    X = -X
if X >= K*D:
    ans = X - K*D
else:
    n = X // D
    X %= D
    K -= n
    if K%2 == 0:
        ans = X
    else:
        ans = abs(X-D)
print(ans)

Measured memory_bytes: 9176
n, m = map(int, input().split())
fri_dic = {}
for _ in range(m):
  a, b = map(int, input().split())
  if a not in fri_dic:
    fri_dic[a] = set()
  if b not in fri_dic[a]:
    fri_dic[a].add(b)
  if b not in fri_dic:
    fri_dic[b] = set()
  if a not in fri_dic[b]:
    fri_dic[b].add(a)
visited = set()
max_count = 0
for i in range(1, n + 1):
  #print(visited)
  if i in visited:
    continue
  stack = [i]
  con_visited = set()
  while stack:
    p = stack.pop()
    if p in visited:
      continue
    visited.add(p)
    con_visited.add(p)
    if p not in fri_dic:
      continue
    for j in fri_dic[p]:
      stack.append(j)
  if len(con_visited) > max_count:
    max_count = len(con_visited)
print(max_count)

Measured memory_bytes: 208636
#include <iostream>
#include <vector>

int main() {
  int a, b, n;
  int way[18][18];
  bool flag[18][18];
  std::vector<std::vector<int> > search;
  std::vector<int> v(2);
  int x, y;

  while (true) {
    std::cin >> a >> b;
    if (a == 0 && b == 0) {
      break;
    } else {
      std::cin >> n;
      for (int i = 0; i <= a + 1; i++) {
        for (int j = 0; j <= b + 1; j++) {
          if (i == 0 || i == a + 1 || j == 0 || j == b + 1)
            way[i][j] = -1;
          else
            way[i][j] = 0;
          flag[i][j] = false;
        }
      }

      for (int i = 0; i < n; i++) {
        std::cin >> x >> y;
        way[x][y] = -1;
      }

      way[1][1] = 1;
      v[0] = 1;
      v[1] = 1;
      search.push_back(v);
      while (!search.empty()) {
        x = search[0][0];
        y = search[0][1];
        if (way[x + 1][y] != -1) {
          way[x + 1][y] += way[x][y];
          if (!flag[x + 1][y]) {
            v[0] = x + 1;
            v[1] = y;
            search.push_back(v);
          }
          flag[x + 1][y] = true;
        }
        if (way[x][y + 1] != -1) {
          way[x][y + 1] += way[x][y];
          if (!flag[x][y + 1]) {
            v[0] = x;
            v[1] = y + 1;
            search.push_back(v);
          }
          flag[x][y + 1] = true;
        }
        search.erase(search.begin());
      }
      std::cout << way[a][b] << std::endl;
    }
  }
}


Measured memory_bytes: 3032
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N;
    cin>>N;
    vi H(N);
    rep(i,N) cin>>H.at(i);
    int ans=0,counter=0;
    H.pb(H.at(N-1)+1);
    rep(i,N) {
        if(H.at(i)>=H.at(i+1)) {
            counter++;
        }
        else {
            ans=max(ans,counter);
            counter=0;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=(a),_ed=(b);i<=_ed;++i)
#define DREP(i,a,b) for(int i=(a),_ed=(b);i>=_ed;--i)
#define mp(x,y) make_pair((x),(y))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
inline int read(){
    register int x=0,f=1;register char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();}
    while(isdigit(ch)){x=x*10+(ch^'0');ch=getchar();}
    return f?x:-x;
}

int n,col[605][605];

void paint(int d){
	int cnt=0;
	while(d%4==0)d/=4,++cnt;
	if(d&1){
		REP(i,0,n+n-1)REP(j,0,n+n-1)
			col[i][j]|=((i>>cnt)+(j>>cnt))&1;
	}
	else{
		REP(i,0,n+n-1)REP(j,0,n+n-1)
			col[i][j]|=(i>>cnt)&1;
	}
}

int main(){
	// freopen("in.in","r",stdin);
	n=read();
	paint(read()),paint(read());
	int cnt=0;
	REP(i,0,n+n-1)REP(j,0,n+n-1){
		if(!col[i][j])printf("%d %d\n",i,j),++cnt;
		if(cnt==n*n)return 0;
	}
	return 0;
}


Measured memory_bytes: 2304
#include <string>
#include <iostream>
using namespace std;
int main()
{
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  if (S==U) {
    cout << A-1 << " " << B << endl;
  } else {
    cout << A << " " << B-1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int n,k=9;
  
  cin>>n;
  
  for(k=9;k>=1;k--)
  {
    if(n%k==0)
      break;
  }
  
  int c=n/k;
  
  if(c>=10)
    cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(_i,_a,_n) for(int _i=_a;_i<=_n;++_i)
#define PER(_i,_a,_n) for(int _i=_n;_i>=_a;--_i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(_a) ({REP(_i,1,n) cout<<_a[_i]<<',';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



#ifdef __APPLE__
const int N = 1e2+50;
#else
const int N = 1e6+50;
#endif


int n,m,a,b;


int main() {
	scanf("%d%d%d%d",&n,&m,&a,&b);
	if (a>2*m||b>2*n) return puts("-1"),0;
	REP(i,1,n) {
		REP(j,1,m) putchar("01"[i<=n-b&&j<=m-a||i>n-b&&j>m-a]);
		hr;
	}
}








Measured memory_bytes: 1280
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}
void swap(int *a,int *b){
	int t=*a;
	*a=*b;
	*b=t;
}

int main(void){
	int c[5],f;
	while(scanf("%d,%d,%d,%d,%d",c,c+1,c+2,c+3,c+4)!=EOF){
		sort(c,5);
		f=1;
		if(c[0]==c[1]||c[1]==c[2]||c[2]==c[3]||c[3]==c[4])f=2;
		if(c[0]==c[1]&&c[2]==c[3]||c[0]==c[1]&&c[3]==c[4]||c[1]==c[2]&&c[3]==c[4])f=3;
		if(c[0]==c[1]&&c[1]==c[2]||c[1]==c[2]&&c[2]==c[3]||c[2]==c[3]&&c[3]==c[4])f=4;
		if(c[0]+1==c[1]&&c[1]+1==c[2]&&c[2]+1==c[3]&&c[3]+1==c[4])f=5;
		if(c[0]==1&&c[1]==10&&c[2]==11&&c[3]==12&&c[4]==13)f=5;
		if(c[0]==c[1]&&c[1]==c[2]&&c[3]==c[4]||c[0]==c[1]&&c[2]==c[3]&&c[3]==c[4])f=6;
		if(c[0]==c[1]&&c[1]==c[2]&&c[2]==c[3]||c[1]==c[2]&&c[2]==c[3]&&c[3]==c[4])f=7;
		switch(f){
			case 1:puts("null"); break;
			case 2:puts("one pair"); break;
			case 3:puts("two pair"); break;
			case 4:puts("three card"); break;
			case 5:puts("straight"); break;
			case 6:puts("full house"); break;
			case 7:puts("four card"); break;
			default: break;
		}
	}
	return 0;
}


Measured memory_bytes: 2024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define ill long long
#define fcout cout << fixed << setprecision(10)
using namespace std;

int main() {
  int n;
  cin >> n;
  if(n == 0) cout << 1 << "\n";
  else cout << 0 << "\n";
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
	int h, w;
	cin >> h >> w;
	queue<int> a;
	rep(i, h/2) rep(j, w/2) a.push(4);
	if(h%2 == 1 && w%2 == 0){
		rep(j, w/2) a.push(2);
	}else if(h%2 == 0 && w%2 == 1){
		rep(i, h/2) a.push(2);
	}else if(h%2 == 1 && w%2 == 1){
		rep(i, h/2) a.push(2);
		rep(j, w/2) a.push(2);
		a.push(1);
	}
	vector<int> al(26);
	rep(i, h){
		string s;
		cin >> s;
		rep(j, w) al[s.at(j) - 'a']++;
	}
	sort(al.begin(), al.end());
	queue<int> q;
	rep(i, 26) if(al[i] != 0) q.push(al[i]);
	bool f = true;
	int ll = 0;
	while(!q.empty()){
		int k = q.front();//85 10
		int t = a.front();//4 4 4 4 4 2 2 1
//		cout << k << ' ' << t << endl;
		int l = 0;
		while(k >= t){
			l = 1;
			k -= t;
			a.pop();
			if(a.empty()) break;
			t = a.front();
		}
		if(l == 0) ll++;
		else ll = 0;
		if(ll > 26*2+1){
			f = false;
			break;
		}
		if(k != 0) q.push(k);
		q.pop();
	}
	if(f){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

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

int main()
{
	int S, h, m, s;
	cin >> S;
	h = S / 3600;
	m = (S % 3600) / 60;
	s = (S % 3600) % 60;
	cout << h <<":"<<m<<":"<<s<<  endl;
}

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

int main(){
    int X, Y;
    cin >> X >> Y;
    if (Y < 2 * X or Y > 4 * X) {
        cout << "No";
    }
    else if (Y % 2 != 0) {
        cout << "No";
    }
    else {
        cout << "Yes";
    }
} 

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

typedef uint32_t u32;
typedef uint64_t u64;

int n, l;
char d[128];
int  p[128];
int last_l;
int last_r;

bool check_finish() {
  for(int i = 0; i < n; ++i) {
    if( p[i] != 0 and p[i] != l ) {
      return false;
    }
  }
  return true;
}

int main() {
  
  for(;;) {
    std::cin >> n >> l;
    if( n == 0 and l == 0 ) break;
    for(int i = 0; i < n; ++i) {
      std::cin >> d[i] >> p[i];
    }

    int t = 0;
    for(;;) {
      if( check_finish() ) {
        std::cout << t << " " << (last_l != 0 ? last_l : last_r) << std::endl;
        break;
      }
      int count[128] = {};
      last_l = last_r = 0;
      for(int i = n - 1; i >= 0; --i) {
        if( p[i] == 0 or p[i] == l ) continue;
        if( d[i] == 'L' ) {
          p[i] -= 1;
          if( p[i] == 0 ) last_l = i + 1;
        }
        if( d[i] == 'R' ) {
          p[i] += 1;
          if( p[i] == l ) last_r = i + 1;
        }
        count[p[i]] += 1;
      }
      for(int i = 0; i < l; ++i) {
        if( count[i] >= 2 ) {
          int id1 = 0, id2 = 0;
          for(int j = 0; j < n; ++j) {
            if( p[j] == i ) {
              id1 = j;
              break;
            }
          }
          for(int j = n - 1; j >= 0; --j) {
            if( p[j] == i ) {
              id2 = j;
              break;
            }
          }
          d[id1] = 'R' + 'L' - d[id1];
          d[id2] = 'R' + 'L' - d[id2];
        }
      }
      t += 1;
    }
  }
   
  return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
typedef long long ll;



int main()
{
	ll n;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n);
	rep(i,n)cin >> a[i];
	rep(i,n)cin >> b[i];
	rep(i,n)cin >> c[i];
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());
	ll count=0;
	rep(i,n)
	{
		ll alow = lower_bound(a.begin(),a.end(),b[i])-a.begin();
		ll clow = upper_bound(c.begin(),c.end(),b[i])-c.begin();
		//cout<<alow<<":"<<clow<<endl; 
		count +=alow*(n-clow);
	}
	cout<<count<<endl;
	return 0;
}

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


int main()
{
	string S;
	cin >> S;

	int num_r = 0, num_b = 0;
	for (const auto& c : S) {
		if (c == '0') ++num_r;
		else ++num_b;
	}
	cout << min(num_b, num_r) * 2 << endl;
}



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

using namespace std;
using ll = long long;

ll solve(int N, const vector<int>& xs)
{
    ll ans = 0;
    auto L = 0, R = 0, x = 0;

    while (L < N)
    {
        x |= xs[L];
        R = max(R, L + 1);
        
        while (R < N and (x & xs[R]) == 0)
        {
            x |= xs[R];
            ++R;
        }

        ans += (R - L);

        x &= ~xs[L];
        ++L;
    }

    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<int> xs(N);

    for (int i = 0; i < N; ++i)
        cin >> xs[i];

    auto ans = solve(N, xs);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4008
n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))


#Binary Search
def BinarySearch(A,n, key):
    left  = -1
    right = n
    i = 0
    while left < right:

        mid   = (left + right) // 2
        if A[mid] == key:
            return True
        elif key > A[mid]:
            left = mid + 1
        else:
            right = mid
    return False

cnt = 0
for i in range(q):
    if BinarySearch(S, n, T[i]):
        cnt = cnt+1

print(cnt)


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

int main(){
    int n;
    cin >> n;
    if(n==1) cout << "Hello World" << endl;
    if(n==2){
        int a,b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
<?php
// Your code here!

    const PI = 3.141592653589;
    
    $r = trim(fgets(STDIN));
    $area_ans = round(PI * $r**2,6);
    $circle_ans = round(2 * PI * $r,6);
    
    echo $area_ans . " " . $circle_ans;

?>



Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n;
    cin >> n;
    vector<pair<int, int>> ans;
    eFOR(i, 1, n)eFOR(j, i + 1, n) {
        if (i + j != n / 2 * 2 + 1) {
            ans.push_back({ i,j });
        }
    }

    cout << ans.size() << "\n";
    for (auto i : ans)cout << i.first << " " << i.second << "\n";
}

Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <ctime>
using namespace std;
typedef long long ll;

const int INF = 100000000;
const int MAX_N = 100000;


int main(int argc, char *args[]) {
	ll N;
	cin >> N;
	ll ans = N*(N - 1) / 2;
	cout << ans << endl;
}

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

int main(){
  int n, m, i, a, b;
  cin >> n >> m;
  
  vector<int> road(n, 0);
  for (i=0; i<m; i++) {
    cin >> a >> b;
    road[a-1]++;
    road[b-1]++;
  }
  
  for (i=0; i<n; i++) {
    cout << road[i] << endl;
  }
  
  return 0;  
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstdio>
#include <queue>
using namespace std;

long long cnt = 0;

void merge(vector<int> &v, int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  vector<int> l(n1 + 1);
  vector<int> r(n2 + 1);
  int i, j, k;
  for(int i=0;i<n1;i++){
    l[i] = v[left + i];
  }
  for(int i=0;i<n2;i++){
    r[i] = v[mid + i];
  }
  l[n1] = r[n2] = 1000000007;
  i = j = 0;
  for(k = left;k < right;k++){
    if(l[i] <= r[j]){
      v[k] = l[i++];
      cnt += j;
    }else{
      v[k] = r[j++];
    }
  }
}

void mergeSort(vector<int> &a, int left, int right){
  if(left+1 < right){
    int mid = (left + right)/2;
    mergeSort(a, left, mid);
    mergeSort(a, mid, right);
    merge(a, left, mid, right);
  }
}

int main(void){
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i=0;i<n;i++)
    cin >> v[i];

  mergeSort(v, 0, n);
  cout << cnt << endl;
  return 0;
}

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

int main()
{
  int y,m,d;
  char a,b;
  cin>>y>>a>>m>>b>>d;
  
  if(y>2019||m>4||d>30)
   cout<<"TBD";
  else
  cout<<"Heisei";
 return 0;  
}


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,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define sz(x) int(x.size())
using ll = long long;
using P = pair<int,int>;
const ll LLINF = numeric_limits<long long>::max();
const int mod = 1000000007;
const int INF = 1001001001;

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

    for(int i=0;i<=x;i++){
        int z = max(0,x - i);
        //cout << z <<endl;
        if(i*2 + z*4 == y){
            cout << "Yes" <<endl;
            return 0;
        }
    }

    cout << "No" <<endl;

    return 0;
}

Measured memory_bytes: 3632
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}


fn main(){
    let s = read_as_string().chars().collect::<Vec<char>>();

    let mut ans = 0;
    for i in 0..s.len()/2{
        let j = s.len() -1 - i;
        if s[i] != s[j]{
            ans += 1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
[N,K] = list(map(int,input().split()))

mod = pow(10,9)+7

kaijo = [1]
for i in range(1,N+1): 
  kaijo.append(kaijo[i-1]*i % mod)

s =0
for m in range((K+1)*(N>K)+(N)*(K>=N)):
  s += (kaijo[N]*pow((kaijo[m]*kaijo[N-m]),mod-2,mod ))%mod * (kaijo[N-1]*pow((kaijo[m]*kaijo[N-1-m]),mod-2,mod ) )%mod
  s = s%mod

print(s)

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

template <typename T> inline void rd(T& x) {
	int si = 1; char c = getchar(); x = 0;
	while(!isdigit(c)) si = c == '-' ? -1 : si, c = getchar();
	while(isdigit(c)) x = x * 10 + c - 48, c = getchar();
	x *= si;
}
template <typename T, typename... Args>
inline void rd(T& x, Args&... args) { rd(x); rd(args...); }

#define fi first
#define se second

typedef long long ll;
typedef double ff;
typedef std::pair<int, int> pii;

ll Check(ll a1, ll a2, ll a4, ll a5) {
	return (a1 - a1 % 2) + a2 + (a4 - a4 % 2) + (a5 - a5 % 2);
}

int main() {
	ll a1, a2, a3, a4, a5, a6, a7;
	rd(a1, a2, a3, a4, a5, a6, a7);
	ll ans = Check(a1, a2, a4, a5);
	ans = std::max(ans, Check(a1 - 1, a2, a4 - 1, a5 - 1) + (a1 > 0 && a4 > 0 && a5 > 0) * 3);
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main(){
    int A,B,K;
    set<int> s;

    cin >> A >> B >> K;

    for(int i = 0; i < K; i++){
        if(A+i <= B){
            s.insert(A+i);
        }
    }

    for(int i = K-1; i >= 0; i--){
        if(B-i >= A){
            s.insert(B-i);
        }
    }

    for(auto itr = s.begin(); itr != s.end(); itr++){
        cout << *itr << endl;
    }

    return 0;
}


Measured memory_bytes: 256
A = input() + "x"
B = input() + "x"
C = input() + "x"

a=b=c=0

x = 'a'
ans = ""
while x!='x':
  if x=='a':
    x = A[a]
    a += 1
    ans = "A"
  elif x=='b':
    x = B[b]
    b += 1
    ans = "B"
  elif x=='c':
    x = C[c]
    c += 1
    ans = "C"

  # print(a,b,c)

print(ans)


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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  int n;
  cin >> n;
  vt<int> h(n);
  rep(i, 0, n) cin >> h[i];

  int ans = 0;
  for(int l = 0; l < n;) {
    if(h[l] == 0) {
      ++l;
      continue;
    }

    int r = l, cnt = INF;
    while(r < n && h[r] != 0) {
      cnt = min(cnt, h[r]);
      ++r;
    }

    ans += cnt;
    rep(i, l, r) h[i] -= cnt;
    while(l < n && h[l] == 0) ++l;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import collections


n = int(input())
sequence = list(map(int, input().split()))
answer = collections.deque()
reverse = False
for i in range(n):
	if reverse is False:
		answer.append(sequence[i])
		reverse = True
	else: 
		answer.appendleft(sequence[i])
		reverse = False
answer = list(answer)
if reverse is True:
	answer.reverse()
print(*answer)

Measured memory_bytes: 25536
package main
import("fmt";"sort")

func main(){
  var n int
  fmt.Scanf("%d",&n)
  
  a:=make([]float64,n)
  for i:=range a{
    fmt.Scanf("%f",&a[i])
  }
  sort.Float64s(a)
  
  answer := (a[0]+a[1])/2
  for i:=2;i<n;i++{
    answer=(answer+a[i])/2
  }
  
  fmt.Printf("%f",answer)
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

const ll MOD = 1000000007;

ll ans[105][4][4][4];

int main(){

	int N;
	cin >> N;
	ans[0][3][3][3] = 1;
	for(int n = 0; n < N; n ++){
		for(int i = 0; i < 4; i ++){
			for(int j = 0; j < 4; j ++){
				for(int k = 0; k < 4; k ++){
					for(int c = 0; c < 4; c ++){
						if(c == 2 && i == 1 && j == 0)continue;
						if(c == 2 && i == 0 && j == 1)continue;
						if(c == 1 && i == 2 && j == 0)continue;
						if(c == 2 && i == 1 && k == 0)continue;
						if(c == 2 && j == 1 && k == 0)continue;

						ans[n + 1][c][i][j] += ans[n][i][j][k];
						ans[n + 1][c][i][j] %= (ll)MOD;
					}
				}
			}
		}
	}
	int a = 0;
	for(int i = 0; i < 4; i ++){
		for(int j = 0; j < 4; j ++){
			for(int k = 0; k < 4; k ++){
				a += ans[N][i][j][k];
				a %= (ll)MOD;
			}
		}
	}
	cout << a << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

long long PowerMod(long long a, long long b, int m)
{
    long long res = 1;

    for (int i = 0; b > 0; i++) {
        if (b & 1) {
            res = (res * a) % m;
        }
        a = (a * a) % m;
        b >>= 1;
    }

    return res;
}

long long FactorialMod(long long a, int m)
{
    long long res = 1;
    for (int i = a; i > 0; i--) {
        res = (res * i) % m;
    }
    return res;
}

long long CombinationMod(long long n, long long r, int m)
{
    long long res = 1;
    for (int i = 0; i < r; i++) {
        res = (res * (n - i)) % m;
    }
    res *= PowerMod(FactorialMod(r, m), m - 2, m);
    res %= m;

    return res;
}

void PrimeFactorization(int x, vector<pair<int, int> >& y)
{
    int xrest = x;

    for (int i = 2; i < x; i++) {
        if (i > xrest) {
            break;
        }
        if (xrest % i == 0) {
            y.push_back(make_pair(i, 1));
            xrest /= i;
            while (1) {
                if (xrest % i == 0) {
                    y.back().second++;
                    xrest /= i;
                } else {
                    break;
                }
            }
        }
    }

}

int main()
{
    const int MOD = 1e9 + 7;

    int N, M;
    cin >> N >> M;

    vector<pair<int, int> > v;
    PrimeFactorization(M, v);

    long long ans = 1;
    for (int i = 0; i < v.size(); i++) {
        ans *= CombinationMod(v[i].second + N - 1, v[i].second, MOD);
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b)
{
	ll res = 1;
	a %= mod;
	assert(b >= 0);
	for (; b; b >>= 1)
	{
		if (b & 1)
			res = res * a % mod;
		a = a * a % mod;
	}
	return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

static uint MD = mod;
struct ModInt
{
	using M = ModInt;
	uint v;
	ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
	M &set_v(uint _v)
	{
		v = (_v < MD) ? _v : _v - MD;
		return *this;
	}
	explicit operator bool() const { return v != 0; }
	M operator-() const { return M() - *this; }
	M operator+(const M &r) const { return M().set_v(v + r.v); }
	M operator-(const M &r) const { return M().set_v(v + MD - r.v); }
	M operator*(const M &r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
	M operator/(const M &r) const { return *this * r.inv(); }
	M &operator+=(const M &r) { return *this = *this + r; }
	M &operator-=(const M &r) { return *this = *this - r; }
	M &operator*=(const M &r) { return *this = *this * r; }
	M &operator/=(const M &r) { return *this = *this / r; }
	bool operator==(const M &r) const { return v == r.v; }
	M pow(ll n) const
	{
		M x = *this, r = 1;
		while (n)
		{
			if (n & 1)
				r *= x;
			x *= x;
			n >>= 1;
		}
		return r;
	}
	M inv() const { return pow(MD - 2); }
	friend ostream &operator<<(ostream &os, const M &r) { return os << r.v; }
};
using Mint = ModInt;
//head
// cin >> t;
// for (int cas = 1; cas <= t; ++cas)
// {
// 	cout << "Case #" << cas << ": ";
// }
int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if((c-1)/b+1 <= (a-1)/d+1) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 3624