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

public class Main {
    static int n, s;
    static long[] v;
    static int[] w;
    static long[][] memo;
    public static long dp(int idx, int remW){
        if(remW < 0) return -(int)1e9;
        if(idx == n) return 0;
        if(memo[idx][(int) remW] != -1) return memo[idx][(int) remW];
        long take = v[idx] + dp(idx + 1, remW - w[idx]);
        long leave = dp(idx + 1, remW);
        return memo[idx][remW] = Math.max(take, leave);
    }

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        n = Integer.parseInt(sc.next());
        s = Integer.parseInt(sc.next());
        w = new int[n];
        v = new long[n];
        memo = new long[n][s + 1];
        for(long[] arr : memo) Arrays.fill(arr, -1);
        for (int i = 0; i < n; i++) {
            w[i] = Integer.parseInt(sc.next());
            v[i] = Integer.parseInt(sc.next());
        }
        pw.println(dp(0, s));
        pw.close();
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

        public double nextDouble(String x) {

            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }


    }
}


Measured memory_bytes: 131356
import java.util.*;
class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
         int n=sc.nextInt(); int m=sc.nextInt();
         int a[]=new int[n]; int ca[]=new int [n];
         for(int i=0;i<n;i++){
        	a[i]=sc.nextInt();
        }
        for(int j=0;j<m;j++){
        	int b=sc.nextInt();
        	for(int i=0;i<n;i++){
        		if(a[i]<=b) {
        			ca[i]++;
        			break;
        		}
        	}
        }
        int temp=ca[0],num=1;
        for(int i=1;i<n;i++){
         if(temp<ca[i]){
        	 temp=ca[i]; num=i+1;
         }
        }
        System.out.println(num);
    }
 }

Measured memory_bytes: 24584
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 1001

void count(char *A,char *B){
  int i,j,tmp[N][N];

  for(i=0; i<N; i++){
    for(j=0; j<N; j++){
      tmp[i][j]=0;
    }
  }
  for(i=0; i<strlen(A); i++){
    for(j=0; j<strlen(B); j++){
      if(A[i]==B[j])tmp[i+1][j+1]=tmp[i][j]+1;
      else if(tmp[i][j+1]>tmp[i+1][j]) tmp[i+1][j+1]=tmp[i][j+1];
      else tmp[i+1][j+1]=tmp[i+1][j];
    }
  }
  printf("%d\n",tmp[strlen(A)][strlen(B)]);
}

int main(){
  int n,i,j;
  char A[N],B[N];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",A);
    scanf("%s",B);
    count(A,B);
  }

  return 0; 
}

Measured memory_bytes: 4520
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(void){
	long long x, y, n;
	long long ans;
	long long min, max;
	scanf("%lld %lld %lld", &n,&x,&y);
	if (x > y)ans = 0;
	else if (x == y)ans = 1;
	else if(n==1)ans=0;
       else{
		max = x + ((n - 1)*y);
		min = ((n - 1)*x) + y;
		ans = max - min + 1;
	}

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

	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	if(b<a)b+=360;
	double ans=(a+b)/2.0;
	if(ans-a>90)ans+=180;
	if(ans>=360)ans-=360;
	printf("%f\n",ans);
}


Measured memory_bytes: 2148
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
typedef long long LL;
using namespace std;
LL n , h;
LL Get(LL a , LL b , LL c){
	return max(a , max(b , c)) - min(a , min(b , c));
}
int main()
{
	while(~scanf("%lld%lld" , &h , &n)){
		LL ans = 1LL << 60;
		for(LL i = 1;i < h;i++){
			LL a = n * i;
			LL b = (h - i) * (n / 2); LL c = (h - i) * ((n + 1) / 2);
			ans = min(ans , Get(a , b , c));
			LL t = h - i;
			b = (t / 2) * n; c = ((t + 1) / 2) * n;
			ans = min(ans , Get(a , b , c));
		}
		for(LL i = 1;i < n;i++){
			LL a = h * i;
			LL b = (n - i) * (h / 2); LL c = (n - i) * ((h + 1) / 2);
			ans = min(ans , Get(a , b , c));
			LL t = n - i;
			b = (t / 2) * h; c = ((t + 1) / 2) * h;
			ans = min(ans , Get(a , b , c));
		}
		if(h % 3 != 0 && n % 3 != 0) printf("%lld\n" , ans);
		else printf("0\n");
	}
}

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

using namespace std;
using ll = long long;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;

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

    for (auto mp : cnt) {
        if (mp.second == 0 or mp.second % 2 != 0) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

    return 0;
}

Measured memory_bytes: 4352
#include<cstdio>
#include<queue>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<iostream>
using namespace std;
int  main(){
	int a,b;
	scanf("%d%d",&a,&b);
	int ans=10000;
	int i;
	for(i=1;i<=2000;i++){
		if(i*2/25==a&&i/10==b)
		{
			printf("%d\n",i);
			break;
		}
	}
	if(i==2001)
	printf("-1");
}




Measured memory_bytes: 256
X = int(input())

n = 10**6
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False

for i in range(2, int(n**0.5) + 1):
    if not is_prime[i]:
        continue
    for j in range(i * 2, n + 1, i):
        is_prime[j] = False

for i, p in enumerate(is_prime):
    if i >= X and p is True:
        print(i)
        break

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }

    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    
    int alice = 0;
    int bob = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            alice += a.at(i);
        } else {
            bob += a.at(i);
        }
    }

    cout << alice - bob << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)

constexpr int MAX_N = 20;

int N, ans = 0, bridges[MAX_N][MAX_N] = {};

int dfs(const int& pos = 0);

int main(){
	while(true){
		scanf("%d", &N);
		
		if(N == 0){
			break;
		}
		
		ans = 0;
		REP(i, N){
			REP(j, N){
				bridges[i][j] = 0;
			}
		}

		REP(i, N - 1){
			int a, b, t;
			scanf("%d%d%d", &a, &b, &t);

			--a, --b;
			bridges[a][b] = bridges[b][a] = t;

			ans += t * 2;
		}
		
		FOR(i, 1, N){
			int count = 0, tmp;
			REP(j, N){
				if(bridges[i][j] != 0){
					++count;
					tmp = j;
				}
			}
			if(count == 1){
				ans -= bridges[i][tmp] * 2;
				bridges[i][tmp] = bridges[tmp][i] = -1;
			}
		}

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

	}
	return 0;
}

int dfs(const int& pos){
	int res = 0;
	
	REP(i, N){
		if(bridges[pos][i] != 0){
			bridges[i][pos] = 0;
			res = std::max(res, dfs(i) + bridges[pos][i]);
		}
	}

	return res;
}

Measured memory_bytes: 2660
#include<bits/stdc++.h>
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define Repe(i,a,b) for(register int i=(a);i>=(b);--i)
#define pb push_back
#define Chkmax(a,b) a=a>b?a:b
#define Chkmin(a,b) a=a<b?a:b
typedef unsigned long long uint64;
typedef unsigned int uint32;
typedef long long ll;

using namespace std;

namespace IO
{
    const uint32 Buffsize=1<<15,Output=1<<23;
    static char Ch[Buffsize],*S=Ch,*T=Ch;
    inline char getc()
    {
        return((S==T)&&(T=(S=Ch)+fread(Ch,1,Buffsize,stdin),S==T)?0:*S++);
    }
    static char Out[Output],*nowps=Out;
    
    inline void flush(){fwrite(Out,1,nowps-Out,stdout);nowps=Out;}

    template<typename T>inline void read(T&x)
    {
        x=0;static char ch;T f=1;
        for(ch=getc();!isdigit(ch);ch=getc())if(ch=='-')f=-1;
        for(;isdigit(ch);ch=getc())x=x*10+(ch^48);
        x*=f;
    }

    template<typename T>inline void write(T x,char ch='\n')
    {
        if(!x)*nowps++='0';
        if(x<0)*nowps++='-',x=-x;
        static uint32 sta[111],tp;
        for(tp=0;x;x/=10)sta[++tp]=x%10;
        for(;tp;*nowps++=sta[tp--]^48);
        *nowps++=ch;
    }
}
using namespace IO;

inline void file()
{
#ifndef ONLINE_JUDGE
    freopen("water.in","r",stdin);
    freopen("water.out","w",stdout);
#endif
}

const int MAXN=1e6+7;

static int n;

static int a[MAXN],b[MAXN];

inline void init()
{
	read(n);
	Rep(i,1,n)read(a[i]),read(b[i]);
}

static ll cnt;

inline void solve()
{
	Repe(i,n,1)if((a[i]+cnt)%b[i])cnt+=b[i]-(a[i]+cnt)%b[i];
	printf("%lld\n",cnt);
}

int main()
{
    init();
    solve();
    return 0;
}


Measured memory_bytes: 4736
#include "bits/stdc++.h"
using namespace std;
//#include "pch.h"
using namespace std;
#include <string>
#include <iostream>
int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	int dx = tx - sx;
	int dy = ty - sy;

	for (int i = 0; i < dy; i++) putchar('U');
	for (int i = 0; i < dx; i++) putchar('R');

	for (int i = 0; i < dy; i++) putchar('D');
	for (int i = 0; i < dx; i++) putchar('L');

	putchar('L');
	for (int i = 0; i < dy; i++) putchar('U');
	putchar('U');
	for (int i = 0; i < dx; i++) putchar('R');
	putchar('R');
	putchar('D');

	putchar('R');
	for (int i = 0; i < dy; i++) putchar('D');
	putchar('D');
	for (int i = 0; i < dx; i++) putchar('L');
	putchar('L');
	putchar('U');
}


Measured memory_bytes: 256
/**
 *  author: andychen
 *  created: 09.19.2020 22:55:34
**/

#include <bits/stdc++.h>

using namespace std;

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

    int n;
    cin >> n;

    int ans = 0, cnt = 0;
    for (int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;

        if (a == b)
            cnt += 1;
        else
            cnt = 0;

        ans = max(ans, cnt);
    }

    if (ans >= 3)
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;
}


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

using namespace std;

int n, m, num, h, arr[50], cnt;
int main()
{
	cin >> n >> m;
	for(int i = 1 ; i <= n ; ++i)
	{
		cin >> num;
		for(int j = 1; j <= num ; ++j)
		{
			cin >> h;
			++arr[h];
			if(arr[h] == n)
				++cnt;
		}
	}
	cout << cnt << endl;
	return 0;
}

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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define P3(a, b, c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 998244353;
const ll INF = 1e18;

long long fast_power(long long a, long long b) {
	long long ret = 1;
	// aが負の場合
	if (a < 0) {
		a = -a;
		if (b % 2 == 1) ret = -1;
	}
	// 累乗計算 (MODを取るときはコメントを外す)
	while (b>0) {
		if (b & 1) {
			ret *= a;
		}
		a *= a;
		a %= MOD;
		ret %= MOD;
		b >>= 1;
	}
	return ret;
}

int main(){
    ll N,ans=1;
    cin >> N;
    vector<ll> D(N);
    REP(i,0,N){
        cin >> D[i];
    }

    if(D[0]!=0){
        P(0);
        return 0;
    }

    map<ll, ll> mp;
    REP(i,1,N){
        mp[D[i]]++;
    }

    ll now=0,pre;
    for(auto m:mp){
        now++;
        if(m.first!=now){
            P(0);
            return 0;
        }
        if(now==1){
            pre=m.second;
            continue;
        }
        ans=(ans*fast_power(pre, m.second))%MOD;
        pre = m.second;
    }

    P(ans);
}

Measured memory_bytes: 7296
//Chandigarh University
//author:- shivamkr21 (pseduo coders)
#include<bits/stdc++.h>
#define lli long long int
#define endl "\n"
// #define loop(i,n) for(long long int (a)=i, (a)<n, (a)++)
#define mod 1000000007
using namespace std;
int main()
{
	lli h;
	cin>>h;
  	lli s=log2(h);
  	lli m=pow(2,s);
  	cout<<(2*m)-1;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
ll inv(ll x){
    return expm(x,big-2);
}

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/

    int h,w;cin >> h >> w;
    int sx,sy,gx,gy;cin >> sx >> sy >> gx >> gy;
    sx--;sy--;gx--;gy--;
    vec<vec<char>> s(h,vec<char> (w));
    rep(i,h)rep(j,w)cin >> s[i][j];
    auto ok = [&](ll x,ll y){
        if(x>=0&&y>=0&&x<h&&y<w&&s[x][y]=='.')return true;
        return false;
    };
    deque<P> q;
    vec<vec<ll>> ans(h,vec<ll>(w,INF));
    ans[sx][sy]=0;
    q.push_back({sx,sy});
    while(q.size()){
        P now=q.front();
        q.pop_front();
        int x=now.first,y=now.second;
        rep(i,4){
            int nx,ny;nx=x+dx[i];ny=y+dy[i];
            if(!ok(nx,ny))continue;
            //残ったやつらのうち距離更新がされるやつをqに突っ込みなおす
            if(ans[nx][ny]<=ans[x][y])continue;
            ans[nx][ny]=ans[x][y];
            q.push_front({nx,ny});
        }
        rep2(i,-2,3)rep2(j,-2,3){
            if(i*i+j*j<=1)continue;
            int nx=x+i,ny=y+j;
            if(!ok(nx,ny))continue;
            if(ans[nx][ny]<=ans[x][y]+1)continue;
            ans[nx][ny]=ans[x][y]+1;
            q.push_back({nx,ny});
        }
    }
    cout << (ans[gx][gy]==INF ? -1 : ans[gx][gy]) << endl;
}

Measured memory_bytes: 12664
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;

int main(){
  int n, m;
  cin >> n >> m;
  vector<bool> done(n);
  vector<int> wa(n);
  rep(i,n) done[i] = false;
  int p_count=0, a_count=0;
  rep(i,m){
    int x; string s;
    cin >> x >> s;
    if(done[x-1]) continue;
    if(s=="AC"){
      done[x-1] = true;
      a_count++;
      p_count+=wa[x-1];
    }else if(s=="WA") wa[x-1]++;
  }
  cout << a_count << " " << p_count;
}

Measured memory_bytes: 640
x, k, d = map(int, input().split())

x, cnt = abs(x), abs(x) // d
if k % 2 == cnt % 2:
    ans = abs(x - d * min(k, cnt))
elif k % 2 != cnt % 2:
    ans = abs(x - d * min(k, cnt + 1))
print(ans)


Measured memory_bytes: 61828
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define first fi;
#define second se;
using namespace std;
typedef pair<int, int> P;

string change(string s){
    string res = "";
    string str = "aiueo";
    res += s[0];
    rep(i, 0, s.size()){
        if(str.find(s[i]) != string::npos && i != s.size() - 1){
            res += s[i + 1];
        }
    }
    return res;
}

signed main(){
    int n;
    while(cin >> n, n){
        set<string> st;
        vector<string> d;
        bool f = true;
        int MAX = 0;
        rep(i, 0, n){
            string s;
            cin >> s;
            string tmp = change(s);
            if(st.count(tmp)) f = false;
            else{
                MAX = max(MAX, (int)(tmp.size()));
                st.insert(tmp);
                d. push_back(tmp);
                // cout << tmp << endl;
            }
        }
        if(!f){
            cout << -1 << endl;
            continue;
        }
        rep(i, 1, MAX + 1){
            bool g = true;
            set<string> st2;
            rep(j, 0, d.size()){
                string tmp = d[j].substr(0, min((int)d[j].size(), i));
                if(st2.count(tmp)) g = false;
                else st2.insert(tmp);
                // cout << tmp << endl;
            }
            if(g){
                cout << i << endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 3128
use std::io::{self, Read};

macro_rules! input {
    ($it: expr) => ($it.next().unwrap().parse().unwrap());
    ($it: expr, $T: ty) => ($it.next().unwrap().parse::<$T>().unwrap());
}

fn main() {
    let mut buf = String::new();
    io::stdin().read_to_string(&mut buf).unwrap();

    let mut it = buf.split_whitespace();

    let k: usize = input!(it);
    let s: String = input!(it);

    println!("{}", if s.len() <= k {
        s
    } else {
        s[0..k].to_string() + "..."
    })
}

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    ll N;
    std::cin >> N;
    string ans = "";
    while(N != 0) {
        int r = abs(N % 2);
        ans += to_string(r);
        N = -1 * ((N - r) >> 1);
    }
    reverse(ans.begin(), ans.end());
    cout << (ans == "" ? "0" : ans) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int a = sc.nextInt();
        int b = sc.nextInt();
        String res = (a * b) % 2 == 0 ? "Even" : "Odd";
        System.out.println(res);
    }

}


Measured memory_bytes: 22996
import java.util.*;
public class Main{
	public static void main(String[]agrs){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i = 0; i < n; i++) {
			int s = sc.nextInt();
			int g = sc.nextInt();
			if(s > g) {
				int tmp = s;
				s = g;
				g = tmp;
			}
			
			if(s == 0) {
				int count = 0;
				if(g % 2 == 1) {
					g--;
					count++;
				}
				
				for(int j = 32; j >= 0; j--) {
					while(g / (int)Math.pow(2, j) > 0) {
						g -= (int)Math.pow(2, j);
						count++;
					}
				}
				System.out.println(count);
				
			}
			else if(g == 0) {
				int count = 0;
				if(s % 2 == 1) {
					s++;
					count++;
				}
				
				for(int j = 32; j >= 0; j--) {
					while(s / (int)Math.pow(2, j) < 0) {
						s += (int)Math.pow(2, j);
						count++;
					}
				}
				System.out.println(count);
			}
			else if(s >= 0 && g >= 0) {
				int count = 0;
				if(s % 2 == 1) {
					s++;
					count++;
				}
				if(g % 2 == 1) {
					g--;
					count++;
				}
				CON:while(s != g)
				for(int j = 32; j >= 0; j--) {
					while(s % (int)Math.pow(2, j) == 0 && s + (int)Math.pow(2,j) <= g) {
						s += (int)Math.pow(2, j);
						count++;
						continue CON;
					}
				}
				System.out.println(count);
			}
			else if(s <= 0 && g <= 0) {
				int count = 0;
				if(s % 2 == 1) {
					s++;
					count++;
				}
				if(g % 2 == 1) {
					g--;
					count++;
				}
				CON:while(s != g){
					for(int j = 32; j >= 0; j--) {
						while(s % (int)Math.pow(2, j) == 0 && s + (int)Math.pow(2,j) <= g) {
							s += (int)Math.pow(2, j);
							count++;
							continue CON;
						}
					}
				}
				System.out.println(count);
			}
			else {
				int count = 0;
				if(g % 2 == 1) {
					g--;
					count++;
				}
				
				for(int j = 32; j >= 0; j--) {
					while(g / (int)Math.pow(2, j) > 0) {
						g -= (int)Math.pow(2, j);
						count++;
					}
				}
				if(s % 2 == 1) {
					s++;
					count++;
				}
				
				for(int j = 32; j >= 0; j--) {
					while(s / (int)Math.pow(2, j) < 0) {
						s += (int)Math.pow(2, j);
						count++;
					}
				}
				System.out.println(count);
			}
			
			
			
		}
	}
}

Measured memory_bytes: 20856
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=998244353;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)

int main(void){
    int d,t,s;
    cin>>d>>t>>s;
    if(s*t>=d) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
string s;
void solve(){
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5]){
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
}
int main(){
	solve();
	return 0;
}

Measured memory_bytes: 3600
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

vector<int>E[55];
int visit[55];
int a[55];
int b[55];

void dfs(int pos){
	if(visit[pos]==1){return;}

	visit[pos]=1;

	int i;

	for(i=0;i<E[pos].size();i++){
		dfs(E[pos][i]);
	}
}



int main(){

	int N,M;

	scanf("%d %d",&N,&M);

	int i,j;

	for(i=0;i<M;i++){
		scanf("%d %d",&a[i],&b[i]);
		E[a[i]].push_back(b[i]);
		E[b[i]].push_back(a[i]);
	}

	int ans=0;

	for(i=0;i<M;i++){
		for(j=0;j<E[a[i]].size();j++){
			if(E[a[i]][j]==b[i]){
				E[a[i]].erase(E[a[i]].begin() + j);
				break;
			}
		}
		for(j=0;j<E[b[i]].size();j++){
			if(E[b[i]][j]==a[i]){
				E[b[i]].erase(E[b[i]].begin() + j);
				break;
			}
		}
		memset(visit,0,sizeof(visit));
		dfs(a[i]);
		for(j=1;j<=N;j++){
			if(visit[j]==0){
				ans++;
				break;
			}
		}
		E[a[i]].push_back(b[i]);
		E[b[i]].push_back(a[i]);
	}
	printf("%d\n",ans);


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string str = "aeiou";
  char c;
  int i, cnt;
  cin >> c;
  for (i=0; i<5; i++) {
    if (str[i]==c) {
      cout << "vowel" << endl;
      return 0;
    }
  }
  cout << "consonant" << endl;
  return 0;
}

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

struct Area{
    int si, ti, sj, tj;
};

int main(){
    int w, h, n;
    while(cin >> w >> h >> n, w){
        int cnt[n+1];
        for(int i = 1; i <= n; i++){
            int a, b;
            cin >> a >> b;
            cnt[a] = b;
        }
        string s[h][w];
        for(int i = 0; i < h*w; i++)    cin >> s[i/w][i%w];
        vector<Area> ok[n+1];
        for(int si = 0; si < h; si++){
            for(int sj = 0; sj < w; sj++){
                for(int ti = si; ti < h; ti++){
                    for(int tj = sj; tj < w; tj++){
                        string tmp = "";
                        bool valid = true;
                        for(int i = si; i <= ti; i++){
                            for(int j = sj; j <= tj; j++){
                                if(s[i][j] == "0")  continue;
                                if(tmp != "" && tmp != s[i][j]){
                                    valid = false;
                                    break;
                                }
                                tmp = s[i][j];
                            }
                            if(!valid)  break;
                        }
                        if(tmp != "" && valid && (ti-si+1)*(tj-sj+1)==cnt[stoi(tmp)]){
                            ok[stoi(tmp)].push_back(Area({si,ti,sj,tj}));
                        }
                    }
                }
            }
        }
        vector<vector<int>> ans(h, vector<int>(w, 0)), pool(h, vector<int>(w, 0));
        bool na = false;
        function<void(int)> dfs = [&](int ind)->void{
            if(ind == n+1){
                if(pool[0][0] != 0){
                    na = true;
                    return;
                }
                pool = ans;
                return;
            }
            for(Area a : ok[ind]){
                bool valid = true;
                for(int i = a.si; i <= a.ti; i++){
                    for(int j = a.sj; j <= a.tj; j++){
                        valid &= ans[i][j] == 0;
                    }
                }
                if(!valid)  continue;
                for(int i = a.si; i <= a.ti; i++){
                    for(int j = a.sj; j <= a.tj; j++){
                        ans[i][j] = ind;
                    }
                }
                dfs(ind+1);
                for(int i = a.si; i <= a.ti; i++){
                    for(int j = a.sj; j <= a.tj; j++){
                        ans[i][j] = 0;
                    }
                }
            }
        };
        dfs(1);
        if(na || pool[0][0] == 0){
            cout << "NA" << endl;
        }else{
            for(int i = 0; i < h; i++){
                for(int j = 0; j < w; j++){
                    cout << pool[i][j] << " \n"[j==w-1];
                }
            }
        }
    }
    return 0;
}


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

int main()
{
	double n[4],x,y,d;
	for(int i=0;i<4;++i)
		cin >> n[i];

	x = n[0]-n[2];
	y = n[1]-n[3];

	d = sqrt(pow(x,2)+pow(y,2));

	printf("%.8lf\n",d);

	return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

long long pow(long long a, long long p){
    if(p == 0) return 1;
    auto res = pow(a, p/2);
    res = (res*res);
    if(p%2) res = (res*a);
    return res;
}

int bitCount(long long t){
    int res = 0;
    for(auto i=t;i;i&=(i-1)) ++res;
    return res;
}

long long genMask(const vector<vector<pair<int, int>>>& g, int u, int v){
    queue<int> qu; qu.push(u);
    vector<pair<int, int>> prev(g.size(), make_pair(-1, -1));
    prev[u].first = -2;
    while(!qu.empty()){
        int p = qu.front(); qu.pop();
        for(auto& t : g[p]){
            if(prev[t.first].first != -1) continue;
            prev[t.first] = make_pair(p, t.second);
            qu.push(t.first);
        }
    }
    long long res = 0;
    while(u != v){
        res |= 1LL << prev[v].second;
        v = prev[v].first;
    }
    return res;
}

int main(){
    int N;
    while(cin >> N){
        vector<vector<pair<int, int>>> g(N);
        for(int i=0;i<N-1;i++){
            int a, b; cin >> a >> b;
            --a; --b;
            g[a].emplace_back(b, i);
            g[b].emplace_back(a, i);
        }
        int M; cin >> M;
        vector<long long> m(M);
        for(int i=0;i<M;i++){
            int u, v; cin >> u >> v;
            --u; --v;
            m[i] = genMask(g, u, v);
        }
        vector<long long> cnt(1<<M, 0);
        for(int i=0;i<(1<<M);i++){
            long long mask = 0;
            for(int j=0;j<M;j++){
                if(i&(1<<j)) mask |= m[j];
            }
            cnt[i] = pow(2, N-1-bitCount(mask));
        }
        long long res = 0;
        for(int i=1;i<(1<<M);i++){
            if(bitCount(i)%2 == 1) res += cnt[i];
            else res -= cnt[i];
        }
        cout << pow(2, N-1) - res << endl;
    }
}

Measured memory_bytes: 8448
import numpy as np
w, h, n = map(int, input().split())
mat = np.ones((h, w))
for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        mat[:, :x] = 0
    elif a == 2:
        mat[:, x:] = 0
    elif a == 3:
        mat[:y, :] = 0
    elif a == 4:
        mat[y:, :] = 0
print(int(mat.sum()))

Measured memory_bytes: 12508
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
  	string s;
  	cin>>s;
  
  	cout<<s[0]<<s.size()-2<<s[s.size()-1]<<endl;
  
  
}

Measured memory_bytes: 3580
s = int(input())

#関数f(n)の定義
def f(n):
  if n % 2 == 0:
    n = n/2
  else:
    n = 3 * n + 1
  return n
    
#数列anの作成
a = []
c = []  # 比較用のaのコピー数列
i = 1
a.append(s)
c.append(s)
while i <= 10000000:
  a.append(f(a[i-1]))
  if a[i] in c:
    print(i +1)
    break
  c.append(a[i])
  i += 1


  

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, m) for (int i = 0; i < (int)(m); i++)
 
 int main(){
 	int A,B,C,D;
 	cin>>A>>B>>C>>D;
 	int	ans=0; int ans1=0;

 while (A>0)
 {
	 A=A-D; ans++;
 }
 
 while (C>0)
 {
	 C=C-B; ans1++;
 }
 
 if(ans>=ans1){cout<<"Yes";}
 else{cout<<"No";}}

Measured memory_bytes: 3624
#include<cstdio>
#include<iostream>

#define NMAX 15

using namespace std;

int main(){
	std::ios_base::sync_with_stdio(false);

	int n;
	int magic[NMAX+1][NMAX+1];
	int cnt;
	int x,y;

	while(1){
		cin>>n;
		if(n==0) break;
		for(int i=0;i<NMAX+1;i++){
			for(int j=0;j<NMAX+1;j++){
				magic[i][j]=0;
			}
		}
		cnt=0;
		x=(n/2)+1;
		y=(n/2)+2;
		while(cnt!=n*n){
			if(magic[y][x]==0){
				magic[y][x]=cnt+1;
				x+=1;
				y+=1;
				cnt++;
			}
			else{
				x-=1;
				y+=1;
			}
			if(x<=0) x=n;
			else if(x>n) x=1;
			if(y<=0) y=n;
			else if(y>n) y=1;
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				printf("%4d",magic[i][j]);
			}
			printf("\n");
		}
	}
		
	return 0;
}

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

typedef long long ll;

int main() {
	int n, k;
	cin >> n >> k;
	int A[n + 2];
	ll ans = 0;
	for(int i = 0; i < n; i++){
		cin >> A[i];
	}
	ll dp[n + 2];
	dp[n - 1] = 0;
	for(int i = n - 2; i >= 0; i--){
		dp[i] = dp[i + 1] + abs(A[i] - A[i + 1]);
		for(int j = 2; j <= k; j++){
			if(i + j >= n) break;
			dp[i] = min(dp[i], dp[i + j] + abs(A[i] - A[i + j]));
		}
		//if(i < n - 2) dp[i] = min(dp[i], dp[i + 2] + abs(A[i] - A[i + 2]));
	}
	cout << dp[0] << '\n';
	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

int main() {
	cin.sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int>a(N);
	rep(i, N)cin >> a[i];
	sort(a.begin(), a.end(),greater<int>());
	int ans = 0;
	rep(i, N) {
		if (i % 2 == 0)ans += a[i];
		else ans -= a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
H,W,D=map(int, input().split())
A = [ [0,0] for _ in range(H*W) ]

# 番号→座標のテーブル作成
for i in range(H):
  AA = list(map(int,input().split()))
  for j in range(W):
    A[AA[j]-1][0] = i
    A[AA[j]-1][1] = j

# %D が同じ値のグループごとに累積和
M = [0] * (H*W)
for d in range(D):
  i = 1
  while (D * i + d) < (H*W) :
    pn = D * (i-1) + d
    n = D * i + d
    M[n] = M[pn] + abs(A[n][0] - A[pn][0]) + abs(A[n][1] - A[pn][1])
    i += 1

# 累積和をみて回答
Q = int(input())
for i in range(Q):
  L,R=map(int,input().split())
  print( M[R-1] - M[L-1] )


Measured memory_bytes: 17052
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <numeric>

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<int> V(N), C(N);
  for_each(V.begin(), V.end(), [](int& e) { cin >> e; });
  for_each(C.begin(), C.end(), [](int& e) { cin >> e; });
  vector<int> diffv, posiv;
  transform(V.begin(), V.end(), C.begin(), back_inserter(diffv), [](int& v, int& c) { return v - c; });
  copy_if(diffv.begin(), diffv.end(), back_inserter(posiv), [](int& e) { return e > 0; });
  cout << accumulate(posiv.begin(), posiv.end(), 0) << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import Counter

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n = ni()
l = nl()
d = Counter(l)
ans = sum(x*(x-1)//2 for x in d.values())
for x in l:
    print(ans - d[x] + 1)


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

#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define ll long long
#define pb push_back
#define zoom                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define pl pair<ll, ll>
#define MOD 1000000007
#define endl "\n"
#define ff first
#define ss second
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define trace3(x, y, z) cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl
#define trace4(a, b, c, d) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl
#define trace(v)                                   \
    for (auto it = v.begin(); it != v.end(); it++) \
        cerr << *it << " ";                        \
    cerr << endl;
#define tr(container, it) \
    for (typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<vi> vvi;


void solve()
{
    int n;
    cin>>n;

    vector<int> dp(3,0);
    for(int day = 0 ; day < n; day++){
        vector<int> c(3);
        vector<int> new_dp(3,0);
        forn(i,3)cin>>c[i];

        forn(i,3){
            forn(j,3){
                if(i!=j){
                    new_dp[j]=max(new_dp[j],dp[i]+c[j]);
                }
            }
        }
        dp=new_dp;
    }

    cout<<max({dp[0],dp[1],dp[2]})<<endl;
}

int main()
{
    zoom;
    ll t=1;
    //cin >> t;

    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
int main(){
	/*
	#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	#endif
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int n;
	cin>>n;
	int a[n];
	multiset<int> m;
	for(int i=0;i<n;i++){
		cin>>a[i];
		m.insert(a[i]);
	}
	for(int i=0;i<n;i++){
		m.erase(m.find(a[i]));
		auto it=m.end();
		it--;
		cout<<*it<<"\n";
		m.insert(a[i]);
	}
}

Measured memory_bytes: 11776
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		while (in.hasNext()) {
			int q = in.nextInt();
			final int p = in.nextInt();
			boolean end = false;
			List<Integer> amalist = new ArrayList<Integer>();
			amalist.add(q);
			while (!end) {
				q *= 10;
				System.out.print(q / p);
				q = q % p;
				if (q == 0 || amalist.contains(q)) {
					break;
				}
				amalist.add(q);
			}
			System.out.println();
			if (q != 0 && amalist.contains(q)) {
				sb.setLength(0);
				char addC = ' ';
				for (Integer a : amalist) {
					if (a.equals(q))
						addC = '^';
					sb.append(addC);
				}
				System.out.println(sb.toString());
			}
		}
		in.close();
	}
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

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

    ll N, M, D;
    scanf("%lld %lld %lld", &N, &M, &D);

    double res = 2. * (N - D) / N / N * (M - 1);
    if(D == 0){
        res = 1. * (N - D) / N / N * (M - 1);
    }
    printf("%.10f\n", res);
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	
	char input;
	
	scanf("%c", &input);
	
	if (input >= 65 && input <= 90){
		puts("A");
	}else if (input >= 97 && input <= 122){
		puts("a");
	}
	
	
	return 0;
}


Measured memory_bytes: 1584
#include "bits/stdc++.h"
using namespace std;
int main(){
    int n,m,x,i,count=0;
    cin >> n >> m >> x;
    vector<int> a(m);
    for(i=0;i<m;i++) cin >> a.at(i);
    for(i=0;i<m;i++){
        if(a.at(i)<x) count++;
    }
    cout << min(count,m-count) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#define ull long long
using namespace std;

const int nmax = 100100;
int N;
int a[nmax];
ull A,B,C,X,Y;
void read(){
    cin >> A >> B >> C >> X >> Y;
}

void solve(){
    ull ans = 0;
    if((A+B) > (2*C))
    {
        ull mx = min(X,Y);
        X-=mx, Y-=mx;
        ans = 2*mx * C; 
        if( Y == 0) ans+=min(X*A, 2*X*C); 
        if( X == 0) ans+=min(Y*B, 2*Y*C); 
    }else{
    
        ans = X * A + Y * B;
    }
    cout << ans << endl;
}

int main(){
    read();
    solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = (ll)1e9;

int main(){
	int n,x;
	cin >> n >> x;
	auto a = vector<int>(n,0);
	ll ans =0;
	for(int i=0;i<n;i++){
		int t;
		cin >> t;
		if(t>x){
			ans+=abs(t-x);
			a[i]=x;
		}else{
			a[i]=t;
		}
      	//cout << a[i] << " ";
	}
  	//cout << endl;

	for(int i=0;i<n-1;i++){
		if(a[i]+a[i+1]<=x) continue;
		ans+=abs(a[i+1]-(x-a[i]));
		a[i+1]=x-a[i];
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 640
A1=list(map(int, input().split()))
A2=list(map(int, input().split()))
A3=list(map(int, input().split()))
N=int(input())
b=[]
for _ in range(N):
    b.append( int(input()) )
A1_check = [False, False, False]
A2_check = [False, False, False]
A3_check = [False, False, False]
for ii in range(3):
    for b_ in b:
        if A1[ii]==b_:
            A1_check[ii]=True
for ii in range(3):
    for b_ in b:
        if A2[ii]==b_:
            A2_check[ii]=True
for ii in range(3):
    for b_ in b:
        if A3[ii]==b_:
            A3_check[ii]=True
if A1_check[0]*A1_check[1]*A1_check[2]==True or \
   A2_check[0]*A2_check[1]*A2_check[2]==True or \
   A3_check[0]*A3_check[1]*A3_check[2]==True or \
   A1_check[0]*A2_check[0]*A3_check[0]==True or \
   A1_check[1]*A2_check[1]*A3_check[1]==True or \
   A1_check[2]*A2_check[2]*A3_check[2]==True or \
   A1_check[0]*A2_check[1]*A3_check[2]==True or \
   A1_check[2]*A2_check[1]*A3_check[0]==True:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
import numpy as np

s = input().rstrip().split(' ')
ans = 0

for i in range(int(s[0])):
    num = str(i+1)
    split_num = np.array(list(num))
    sum_split_num = split_num.astype(int).sum()
    if sum_split_num >= int(s[1]) and sum_split_num <= int(s[2]):
        ans = ans + i+1
print(ans)

Measured memory_bytes: 13552
while true do
    h, w = gets.split.map(&:to_i)
    break if h == 0 && w == 0
    w.times {print "#"}
    puts
    (h - 2).times do
        print "#"
        (w - 2).times {print "."}
        puts "#"
    end
    w.times {print "#"}
    puts
    puts
end


Measured memory_bytes: 6872
lst = [int(input()) for _ in range(5)]
tmp = [(l+9)%10 for l in lst]
last_index = tmp.index(min(tmp))
ans = 0
for i, l in enumerate(lst):
    if (i == last_index):
        ans += l
    else:
        ans += ((l+9)//10)*10
print(ans)


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<x<<endl
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
typedef vector<int> vi;

string s;
ll n,a[5];
int main(void){
    cin>>n;

    rep(i,5){cin>>a[i];}
    ll minv = *min_element(a,a+5);
    p((n+minv-1)/minv+4);

    return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int n,a[4200],b[4200],ans=10000000;
int l[4200],r[4200],f[4200];
char s[4200],t[4200];
int add(int x,int y){return (x+y-1)%n+1;}
int del(int x,int y){return add(x,n-y);}
int checkl(int x){
	memset(f,0,sizeof(f));
	int bns=0;
	for(int i=1;i<=n;i++){
		int o=del(i,x);
		if(a[i]!=b[o]){
			if(l[o]!=0)f[l[o]-1]=max(f[l[o]-1],r[o]);
			bns++;
		}
	}
	for(int i=n;i>=0;i--)f[i]=max(f[i],f[i+1]);
	for(int i=0;i<=n;i++)
		ans=min(ans,x+bns+max(0,f[i]-x)*2+i*2);
}
int checkr(int x){
	memset(f,0,sizeof(f));
	int bns=0;
	for(int i=1;i<=n;i++){
		int o=add(i,x);
		if(a[i]!=b[o]){
			if(r[o]!=0)f[r[o]-1]=max(f[r[o]-1],l[o]);
			bns++;
		}
	}
	for(int i=n;i>=0;i--)f[i]=max(f[i],f[i+1]);
	for(int i=0;i<=n;i++)
		ans=min(ans,x+bns+max(0,f[i]-x)*2+i*2);
}
int getl(int x){
	int ans=0;
	while(b[x]==0)x=del(x,1),ans++;
	return ans;
}
int getr(int x){
	int ans=0;
	while(b[x]==0)x=add(x,1),ans++;
	return ans;
}
int main(){
	scanf("%s",s+1);
	scanf("%s",t+1);
	n=strlen(s+1);
	int A=0,B=0;
	for(int i=1;i<=n;i++)a[i]=s[i]=='1',A+=a[i];
	for(int i=1;i<=n;i++)b[i]=t[i]=='1',B+=b[i];
	if(B==0){
		if(A==0)printf("0\n");
		else printf("-1\n");
		return 0;
	}
	for(int i=1;i<=n;i++){
		l[i]=getl(i);
		r[i]=getr(i);
	}
	for(int i=0;i<=n;i++)
		checkl(i);
	for(int i=0;i<=n;i++)checkr(i);
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <map>

using namespace std;
typedef long long ll;

const long long MOD = 1e9 + 7;

int main()
{
int n, k;
cin >> n >> k;
cout << n - k + 1;
}


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

typedef long long ll;
using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    if (s == "RRR") {
        cout << 3;
    }
    if (s == "SSS") {
        cout << 0;
    }
    if (s == "RSS" || s == "SRS" || s == "SSR" || s == "RSR") {
        cout << 1;
    }
    if (s == "RRS" || s == "SRR") {
        cout << 2;
    }
    return 0;
}


Measured memory_bytes: 3596
X = int(input())
for i in range(1000):
    for k in range(1000):
        if i**5 + k ** 5 == X:
            print("{} {}".format(i,k*-1))
            quit()
        elif i**5 - k**5 == X:
            print("{} {}".format(i,k))
            quit()


Measured memory_bytes: 9076
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
const int MAX=1e5;
int main()
{
    string a;
    int n;
    cin >> n;
    int b = 0,c = 0,d = 0,sum = 0;
    while(n -- )
    {
        cin >> a;
        int l=a.length();
        if(a[0] == 'B')
            b ++ ;
        if(a[l - 1] == 'A')
            c ++ ;
        if(a[l - 1] == 'A' && a[0] == 'B')
            d ++ ;
        for(int i = 0 ; i < l ; i ++ )
        {
            if(a[i] == 'A' && a[i + 1] == 'B')
                sum ++ ;
        }
    }
    if(b == d && c == d && d != 0) //
        sum -- ;
    cout << sum + min(b,c);
    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var WHN = ReadInts();

            int[] xy = ReadInts();
            var ans = 0;
            for (int i = 0; i < WHN[2] - 1; i++)
            {
                var XY = ReadInts();
                var cost = (Abs(xy[0] - XY[0]) + Abs(xy[1] - XY[1]));


                //右上or左下移動
                if (xy[0] < XY[0] && xy[1] < XY[1] || xy[0] > XY[0] && xy[1] > XY[1])
                {
                    var vertical = Abs(xy[0] - XY[0]);
                    var yoko = Abs(xy[1] - XY[1]);
                    var m = Min(vertical, yoko);
                    cost -= m;
                }
                ans += cost;
                xy = XY;
            }
            WriteLine(ans);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}



Measured memory_bytes: 17936