akhauriyash/Code-Regression huggingface dataset:
N = 6 #入力する数
a = [] #aに格納する
sum = 0 #宣言

for i in range(N):
    a.append(int(input()))
min_a = min(a[1:])
if a[0]%min_a == 0:
    print((5+a[0]//min_a)-1)
else:
    print(5+a[0]//min_a)

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

int main(){
    int n,x,ans=0,d=0;
    cin>>n>>x;
    vector<int> l(n);
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    for(int i=0;i<=n&&d<=x;i++){
        ans++;
        if(i!=n)
            d += l[i];
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
 int main(void){
     int N,L;
     cin >> N >> L;
     string S[N];
     rep(i,N) cin >> S[i];
     sort(S,S+N);
     rep(i,N) cout << S[i];
     cout << endl;
 }

Measured memory_bytes: 256
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N, K = MI()
W = [0] * N
for i in range(N):
    w = I()
    W[i] = w


def is_ok(arg):
    # 条件を満たすかどうか？問題ごとに定義
    cnt = 0
    w_sum = 0
    for i in range(N):
        w_sum += W[i]
        if w_sum > arg:
            cnt += 1
            w_sum = W[i]
        elif w_sum == arg:
            cnt += 1
            w_sum = 0
        else:
            cnt += 0
    if w_sum != 0:
        cnt += 1
    return cnt <= K


def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

a = max(W)
b = sum(W)
print(meguru_bisect(a - 1, b + 1))


Measured memory_bytes: 10416
N = int(input())
C0, C1, C2, C3 = 0, 0, 0, 0

for i in range(N):
    S = str(input())
    if S == "AC":
        C0 = C0 + 1
    elif S == "WA":
        C1 = C1 + 1
    elif S == "TLE":
        C2 = C2 + 1
    else:
        C3 = C3 + 1

print("AC x " + str(C0))
print("WA x " + str(C1))
print("TLE x " + str(C2))
print("RE x " + str(C3))



Measured memory_bytes: 74640
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define rusha scanf("%d",&n);rep(i,1,n)scanf("%d",&a[i]);
#define rushb scanf("%d",&t);while(t--)
#define debug(x) cout<<"LBWNB    "<<x<<"---\n"
#define pb push_back
#define pii pair<int,int>
#define vii vector<int>
#define fi first
#define se second
#define mp make_pair
#define p() puts("")
#define mem(a,b) memset(a,b,sizeof a)
#define all(x) (x.begin(),x.end())
#define judgef printf("%s\n",f?"Yes":"No")
#define Judgef printf("%s\n",f?"YES":"NO")
#define sz(x) ((int)(x).size())
#define sf(x) (sizeof(x))
using namespace std;
typedef long long ll;
typedef double db;
const int mod=998244353;
//const int mod=1e9+7;
//const int inf=1e9+7;
const int maxn=2e5+10;
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;
x=x*x%mod; y>>=1;} return res; }
inline ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}

int t,n,m,k;
int b[maxn];
int main(){
    scanf("%d",&n);
    rep(i,2,n) {scanf("%d",&m);b[m]++;}
    rep(i,1,n) printf("%d\n",b[i]);
	return 0;
}




//const int M=1<<20;
//ll t1[M*2+5],t2[M*2+5],ans,ca[M],cb[M];
//inline void upd(int i){t1[i]=t1[i<<1]+t1[i<<1|1];t2[i]=max(t2[i<<1],t1[i<<1]+t2[i<<1|1]);}
//inline void add(int i,int v){for(t1[i+=M]+=v;i>>=1;upd(i));}
//int n,m,p,x,y,i,j;
//struct mons{int x,y,z;}a[M];
//int main(){
//	for(i=0;i<M;++i)ca[i]=cb[i]=1ll<<60;ans=-(1ll<<60);
//	scanf("%d%d%d",&n,&m,&p);
//	for(i=1;i<=n;++i)scanf("%d%d",&x,&y),ca[x]=min(ca[x],(ll)y);
//	for(i=1;i<=m;++i)scanf("%d%d",&x,&y),cb[x]=min(cb[x],(ll)y);
//	for(i=0;i<M;++i)t2[i+M]=-cb[i];for(i=M-1;i;--i)upd(i);
//	for(i=1;i<=p;++i)scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].z);
//	sort(a+1,a+p+1,[&](const mons&a,const mons&b){return a.x<b.x;});
//	for(i=0,j=1;i<M;++i){
//		for(;j<=p && a[j].x<i;++j)add(a[j].y,a[j].z);
//		ans=max(ans,t2[1]-ca[i]);
//	}
//	printf("%lld\n",ans);
//	return 0;
//}


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

int x[1000],y[1000];
string lab[1000];

int main(){
	int n,m,s,g;
	while(cin >> n >> m >> s >> g && n){
		for(int i = 0 ; i < m ; i++){
			cin >> y[i] >> x[i] >> lab[i];
		}
		string memo[40];
		for(int i = 0 ; i < 40 ; i++) memo[i] = "~";
		memo[g] = "";
		int ref = 0;
		bool bad = 0;
		int p = 0;
		while(1){
			bool f = false;
			for(int j = 0 ; j < m ; j++){
				if(memo[x[j]]=="~") continue;
				string cost = lab[j]+memo[x[j]];
				if(cost < memo[y[j]]){
					memo[y[j]] = cost;
					f = true;
					if(s == y[j] && memo[y[j]].length() > n*6){bad = true; f = false; break;}
				}
			}
			if(!f) break;
			ref++;
			if(ref == (n+1)*6) { break;}
		}
		if(bad || memo[s] == "~") cout << "NO" << endl;
		else cout << memo[s] << endl;

	}
}

Measured memory_bytes: 0
import java.util.Scanner;

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

		long x = sc.nextLong();
		long y = sc.nextLong();
		long ans = 0;

		if (x > 0) {

			if (y > 0) {
				if (x > y) {
					ans = x - y + 2;
				} else {
					ans = y - x;
				}
			} else {
				if (x > Math.abs(y)) {
					ans = x - Math.abs(y) + 1;
				} else {
					ans = Math.abs(y) - x + 1;
				}
			}

		} else {

			if (y > 0) {
				if (Math.abs(x) > y) {
					ans = Math.abs(x) - y + 1;
				} else {
					ans = y - Math.abs(x) + 1;
				}

			} else {
				if (Math.abs(x) > Math.abs(y)) {
					ans = Math.abs(x) - Math.abs(y);
				} else {
					ans = Math.abs(y) - Math.abs(x) + 2;
				}
			}

		}

		if (x == 0) {
			if (y >= 0)
				ans = y;
			else
				ans = Math.abs(y) + 1;
		}

		if (y == 0) {
			if (x > 0)
				ans = x + 1;
			else
				ans = Math.abs(x);
		}

		System.out.println(ans);

	}

}


Measured memory_bytes: 22868
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  cin >> str;
  while(str[0]!='0'){
    int i,o=0;
    for(i=0;i<str.size();i++){
      o+=str[i]-'0';
    }
    cout << o << endl;
    cin >> str;
  }
  return 0;
}



Measured memory_bytes: 3176
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll n,m; cin>>n>>m;
    if(n*2>m) cout<<m/2<<endl;
    else{
        ll ans=n;
        m-=2*n;
        cout<<ans+m/4<<endl;
    }
}


Measured memory_bytes: 256
use std::io;


fn main() {
    let x = read_one::<usize>();
    if x == 3 || x == 5 || x ==7 {
        println!("YES");
    } else {
        println!("NO");
    }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> TUP;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mp(a,b) make_pair(a,b)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

int main(){
    ll A,B,C,D,E,F; cin>>A>>B>>C>>D>>E>>F;
    double maxrate=0.0;
    ll a_suger=0,a_sugerwater=100*A;
    for(int a=0;a<=F/(100*A);a++){
        for(int b=0;b<=(F-A*a*100)/(100*B);b++){
            //目標(a*A+b*B)Eの砂糖を入れる
            ll w=(a*A+b*B)*E;
            for(int c=0;c<=w/C;c++){
                for(int d=0;d<=(w-c*C)/D;d++){
                    if(100*(a*A+b*B)+c*C+d*D<=F){
                        //濃度更新
                        if((c*C+d*D)/(double)(100*(a*A+b*B)+c*C+d*D)>maxrate){
                            maxrate=(c*C+d*D)/(double)(100*(a*A+b*B)+c*C+d*D);
                            a_suger=c*C+d*D;
                            a_sugerwater=100*(a*A+b*B)+c*C+d*D;
                        }
                    }
                }
            }
        }
    }
    printf("%lld %lld",a_sugerwater,a_suger);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){

    int n, k, q;
    cin >> n >> k >> q;
    
    vector<int> pt(n);

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

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

}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

int main(){
  char	x[2]={0};
  char	y[2]={0};
  scanf("%s %s", x, y);
  
  if	 ( strcmp(x,y)==0 ){ printf("="); }
  else if( strcmp(x,y) >0 ){ printf(">"); }
  else					   { printf("<"); }

  return 0;
}

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

int main() {
  int N, Y;
  cin >> N >> Y;
  for (int i{}; i <= N; ++i) {
    for (int j{}; j <= N - i; ++j) {
      int k = N - i - j;
      if (i * 10000 + j * 5000 + k * 1000 == Y) {
        cout << i << ' ' << j << ' ' << k << endl;
        return 0;
      }
    }
  }

  cout << "-1 -1 -1" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 1e-10;
const int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    int n;
    ll c,k;
    cin >> n >> c >> k;
    ll t[n+1];
    for(int i=0;i<n;++i){
        cin >> t[i];
    }
    t[n] = 1LL<<60;
    sort(t, t+(n+1));

    ll s = t[0], cnt = 1, ans = 0;
    for(int i=1;i<=n;++i) {
        if(t[i] > s+k || cnt == c) {
            ans += (cnt+c-1)/c;
            s = t[i];
            cnt = 1;
        } else {
            ++cnt;
        }
    }

    cout << ans << endl;
}


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

int main() {
	int n; scanf("%d", &n);

	long long T = 0, A = 0;
	for (int i = 1; i <= n; ++i) {
		int t, a;
		scanf("%d %d", &t, &a);
		long long tt = (T + t - 1) / t;
		long long aa = (A + a - 1) / a;
		long long k = max(tt, aa);
		if (k == 0) ++k;

		T = k * t; A = k * a;
	}

	printf("%lld\n", T + A);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
ll mod=1e9+7;
int main(){
	ll n,k;
	cin>>n>>k;
	ll dp[k+1];
	memset(dp,0,sizeof(dp));
	
	dp[0]=1;
	for(int i=0;i<n;i++){
		ll a;
		cin>>a;
		ll prefix[k+1];
		memset(prefix,0,sizeof(prefix));
		for(int used=k;used>=0;used--){
			ll temp=dp[used];
			ll l=used+1;
			ll r=used+min(a,k-used);
			if(l<=r){
				prefix[l]+=temp;
				prefix[l]%=mod;
				if(r+1<=k){
				prefix[r+1]=prefix[r+1]+mod-temp;
				prefix[r+1]%=mod;
				}
			}
			
		}
		ll p=0;
		for(int j=0;j<=k;j++){
			p+=prefix[j];
			p%=mod;
			dp[j]+=p;
			dp[j]%=mod;
		}
	}
	cout<<dp[k];
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	string S;

	int ans[2] = { 0 };
	cin >> S;
	rep(i, 0, SZ(S))
	{
		if (i % 2 == 0)
		{
			if (S[i] == '0')ans[0]++;
			else ans[1]++;
		}
		else
		{
			if (S[i] == '1')ans[0]++;
			else ans[1]++;
		}
	}

	cout << min(ans[0], ans[1]) << endl;

	return 0;
}

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

int main()
{
        int N, M;
        cin >> N >> M;
        map<int,int> m;
        for (int i = 0; i < M; ++i) {
                int a, b;
                cin >> a >> b;
                m[a-1]++;
                m[b-1]++;
        }
        for (int i = 0; i < N; ++i) {
                cout << m[i] << endl;
        }


}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
using namespace std;

int main()
{
  int N;
  int a[110];
  cin >>N;
  for(int i=0;i<N;i++)
  cin >>a[i];

  sort(a,a+N);
  cout<<a[N-1]-a[0]<<endl;
}


Measured memory_bytes: 256
h,w = map(int,input().split())
ans = [[0]*(w+2) for _ in range(h+2)]
grid = []
grid.append(['#']*(w+2))
for _ in range(h):
    s = list(input())
    grid.append(['#'] + s + ['#'])
grid.append(['#']*(w+2))
for i in range(1,h+1):
    for j in range(0,w+2):
        if grid[i][j] == '#':
            if j >= 1:
                for k in range(j-start):
                    ans[i][start+k] += j-start
            start = j + 1
for j in range(1,w+1):
    for i in range(0,h+2):
        if grid[i][j] == '#':
            if i >= 1:
                for k in range(i-start):
                    ans[start+k][j] += i-start
            start = i + 1
print(max(list(map(lambda x:max(x),ans)))-1)

Measured memory_bytes: 221832
#include<stdio.h>
int main(){
  int a,b,c,i,j;
  scanf("%d %d %d",&a,&b,&c);
  for(i=0;i<=a;i++){
    for(j=0;j<=b;j++){
      if(i*j+(a-i)*(b-j)==c){
	printf("Yes\n");
	return 0;
      }
    }
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
int n,d[100010],ans;
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	for (int i=1;i<=n;i++) read(d[i]);
	for (int i=1;i<=n;i++)
	for (int j=i+1;j<=n;j++) ans+=d[i]*d[j];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#define pai 3.1415926535


/* 値を入れ替える関数 */
	void swap(int *x, int *y) {
		int temp;    // 値を一時保存する変数

		temp = *x;
		*x = *y;
		*y = temp;
	}

	/***
	* pivotを決め、
	* 全データをpivotを境目に振り分け、
	* pivotの添え字を返す
	***/
	int partition(int array[], int left, int right) {
		int i, j, pivot;
		i = left;
		j = right + 1;
		pivot = left;   // 先頭要素をpivotとする

		do {
			do { i++; } while (array[i] < array[pivot]);
			do { j--; } while (array[pivot] < array[j]);
			// pivotより小さいものを左へ、大きいものを右へ
			if (i < j) { swap(&array[i], &array[j]); }
		} while (i < j);

		swap(&array[pivot], &array[j]);   //pivotを更新

		return j;
	}

	/* クイックソート */
	void quick_sort(int array[], int left, int right) {
		int pivot;

		if (left < right) {
			pivot = partition(array, left, right);
			quick_sort(array, left, pivot - 1);   // pivotを境に再帰的にクイックソート
			quick_sort(array, pivot + 1, right);
		}
	}

	int main(void) {
		int N;
		scanf("%d", &N);
		int d[100000];
		for (int i = 0; i < N; i++) {
			scanf("%d", &d[i]);
		}

		quick_sort(d, 0, N-1);

		printf("%d", d[N / 2] - d[N / 2 - 1]);

		return 0;
	}
	

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int m = Integer.parseInt(str[1]);

		int edge[][] = new int[n][n];

		for (int i = 0; i < m; i++) {
			str = br.readLine().split(" ");
			int a = Integer.parseInt(str[0]) - 1;
			int b = Integer.parseInt(str[1]) - 1;

			edge[a][b] += 1;
			edge[b][a] += 1;
		}

		for (int i = 0; i < n; i++) {
			int count = 0;

			for (int j = 0; j < n; j++) {
				if (edge[i][j] != 0)
					count += edge[i][j];
			}
			System.out.println(count);
		}
	}
}


Measured memory_bytes: 22996
import java.io.PrintWriter; 
import java.util.Scanner; 

public class Main
{
	static Scanner in; 
	static PrintWriter out; 

	static void solve()
	{
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int T = stdIn.nextInt();
		int A = stdIn.nextInt();
		int[] H = new int[N];
		for(int i = 0; i < N; i++)
		{
			H[i] = stdIn.nextInt();
		}
		int answer = 1;
		double near_A = Math.abs(A - (T - (H[0] * 0.006)));
		for(int i = 1; i < N; i++)
		{
			if(near_A > Math.abs(A - (T - (H[i] * 0.006))))
			{
				answer = i + 1;
				near_A = Math.abs(A - (T - (H[i] * 0.006)));
			}
		}
		System.out.println(answer);
	}

	public static void main(String[] args) 
	{ 
		in = new Scanner(System.in); 
		out = new PrintWriter(System.out); 
		solve(); 
		out.flush(); 
		out.close(); 
		in.close(); 
	} 
}

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

int main(void){

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

    int a,b,c;

    cin >> a >> b >> c;

    if(a==b&&b==c&&c==a){
        cout << "Yes\n";
    }else{
        cout<<"No\n";
    }


    return 0;
}

Measured memory_bytes: 256
n, k = [int(i) for i in input().split()]
p = 10 ** 9 + 7

def fact(n, p=10**9 + 7):
    f = [1]
    for i in range(1, n+1):
        f.append(f[-1]*i%p)
    return f

def invfact(n, f, p=10**9 + 7):
    inv = [pow(f[n], p-2, p)]
    for i in range(n, 0, -1):
        inv.append(inv[-1]*i%p)
    return inv[::-1]

f = fact(n)
invf = invfact(n, f)

def comb(a, b, p=10 ** 9 + 7):
    if a < b:
        return 0
    if a < 0 or b < 0:
        return 0
    return f[a] * invf[b] * invf[a-b] % p

b = k
r = n - k

for i in range(1, k + 1):
    print(comb(r + 1, i) * comb(b - 1, i - 1) % p)

Measured memory_bytes: 42608
import sys

input = sys.stdin.readline

def main():
    ans = 10000
    s = input().rstrip('\n')
    t = input().rstrip('\n')
    lent = len(t)
    lens = len(s)
    tmp = 0
    for i in range(lens-lent+1):
        tmp = 0
        for j in range(lent):
            if s[i:i+lent][j] != t[j]:
                tmp += 1
        ans = min(ans, tmp)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 8992
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #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 cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;

int fun(int x,int y,int z)
{
	return x*x + y*y + z*z + x*y + y*z + z*x;
}

int mp[10005];

int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS


    int n;
    cin >> n;

    for(int i = 1; i <= 100; i++){
    	for(int j = 1; j <= 100; j++){
    		for(int k = 1; k <= 100; k++){
    			int val = fun(i,j,k);
    			if(val > n)break;
    			mp[val]++;
    		}
    	}
    }

    for(int i = 1; i <= n; i++){
    	cout << mp[i] << endl;
    }




    return 0;
}


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


int main() {
    int a[6];

    for (int i = 0; i < 6; ++i){
        cin >> a[i];        
    }

    int num_1 = 0;
    int num_2 = 0;
    int num_3 = 0;
    int num_4 = 0;
    for (int i = 0; i < 6; ++i){
        if (a[i] == 1){
            ++num_1;
        }else if(a[i] == 2){
            ++num_2;
        }else if(a[i] == 3){
            ++num_3;
        }else if(a[i] == 4){
            ++num_4;
        }
    }
    if (
          (0 < num_1 && num_1 < 3)
        &&(0 < num_2 && num_2 < 3)
        &&(0 < num_3 && num_3 < 3)
        &&(0 < num_4 && num_4 < 3)
    ){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s,p; cin>>s>>p;
	for(int i=0;i<p.size()-1;++i)s+=s.at(i);
	for(int i=p.size();i<=s.size();++i){
		bool yes=true;
		for(int j=i-p.size(),k=0;j<i;++j,++k){
			if(s.at(j)!=p.at(k))yes=false;
		}
		if(yes){
			cout<<"Yes\n"s;
			return 0;
		}
	}
	cout<<"No\n"s;
}


Measured memory_bytes: 3232
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	int a,b,c;
	int ans=0;
	
	cin>>a>>b>>c;
	if(a+b>=c)
	{
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

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

	vector<int64_t> A(N);
	vector<int64_t> F(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) cin >> F[i];

	sort(A.begin(), A.end());
	sort(F.begin(), F.end(), greater<>());


	int64_t ng = -1;
	int64_t ok = 1e12;
	int64_t mid;
	while (ok - ng > 1) {
		mid = (ok + ng) / 2;
		int64_t cnt = 0;
		for (int i = 0; i < N; i++) {
			if (A[i] * F[i] > mid) {
				cnt += A[i] - ceil(mid / F[i]);
			}
		}
		if (cnt <= K) ok = mid;
		else ng = mid;
	}

	cout << ok << endl;

	return 0;
}


Measured memory_bytes: 3328
import collections

S1 = collections.deque()
S2 = collections.deque()
S3 = collections.deque()

for i, j in enumerate(input()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while True:
                if S2:
                    if S2[-1] > left_edge:
                        S2.pop()
                        new_puddle += S3.pop()
                    else:
                        break
                else:
                    break
            S2.append(left_edge)
            S3.append(new_puddle)
        else:
            pass


print(sum(S3))

print(len(S3), *list(S3))

Measured memory_bytes: 8412
from collections import*
N,*A=map(int,open(0).read().split())
A.sort()
C=Counter(A)
s=0
for a in A[::-1]:
	if C[a]:
		C[a]-=1
		b=2**a.bit_length()-a
		if C[b]:
			C[b]-=1
			s += 1
print(s)

Measured memory_bytes: 33744
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

ll gcd(ll a, ll b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

const int INF = 1<<30;
int n;

vector<int> g[1005];

vector<int> bfs(int sv){
  vector<int> dist(n,INF),pre(n,-1);
  queue<int> q;
  dist[sv] = 0;
  q.push(sv);
  while(!q.empty()){
    int v = q.front(); q.pop(); //v=現在位置
    for (int u: g[v]){
      if(dist[u] != INF) continue;
      pre[u] = v; // uの元を記録
      dist[u] = dist[v]+1; //vから1を足した数字
      q.push(u); //次のループのためにuをプッシュ
    }
  }
  pair<int,int> best(INF,-1);
  rep(v,n){
    if(v == sv) continue; //始点と選択しているノードが同じだったらcontinue
    for (int u:g[v]){
      if(u == sv){ //行き先が始点だったら
        best = min(best, make_pair(dist[v],v)); //コストが小さければbestを更新
      }
    }
  }
  //bestがINFということはsvに向かう経路がないので、ループがない。
  if(best.first == INF) return vector<int> (n+1);
  
  //svに戻ってくる前のノードをコピー
  int v = best.second;
  
  vector<int> res;
  //preに記録されている記録記録をどんどん突っ込んでいく。
  //(最終的にはsvにたどり着き、svの前はないので-1がvに代入されwhile文が終了する)
  while(v != -1){
    res.push_back(v);
    v = pre[v];
  }
  //svからスタートした場合の最小ループをリターン
  return res;
}

int main(){
  int m; cin >> n >> m;
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--,b--;
    g[a].push_back(b);
  }
  vector<int> ans(n+1);
  rep(s,n){
    auto now = bfs(s);
    if(now.size() < ans.size()) ans = now;
  }
  if(ans.size() == n+1){
    cout << -1 << endl;
    return 0;
  }
  cout << ans.size() << endl;
  for(auto v:ans){
    cout << v+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

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

	while ( true )
	{
		int w, h;
		cin >> w >> h;

		if ( !( w | h ) )
		{
			break;
		}

		int n;
		cin >> n;

		vector< vector<bool> > board( h, vector<bool>( w, false ) );
		REP( i, 0, n )
		{
			int x, y;
			cin >> x >> y;
			x--;
			y--;
			board[y][x] = true;
		}

		VVI dp( h, VI( w, 0 ) );
		dp[0][0] = 1;

		REP( i, 0, h )
		{
			REP( j, 0, w )
			{
				if ( board[i][j] )
				{
					dp[i][j] = 0;
					continue;
				}

				if ( i )
				{
					dp[i][j] += dp[ i - 1 ][j];
				}

				if ( j )
				{
					dp[i][j] += dp[i][ j - 1 ];
				}
			}
		}
		
		cout << dp.back().back() << endl;
	}

	return 0;
}

Measured memory_bytes: 1208
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

// -----------------------------------------------------------------------------------------------------

// -----------------------------------------------------------------------------------------------------

let main() =
    // https://www.hamayanhamayan.com/entry/2020/02/09/225141
    let N = readInts()
    let K = read int
    // 左からx桁目まで確定、N未満である、0がちょうどK個ある個数
    let dp = Array3D.init 110 2 5 (fun _ _ _ -> 0L)
    dp.[0, 0, 0] <- 1L
    let len = N |> Array.length
    for dgt in 0 .. len - 1 do
        for isless in 0 .. 1 do
            for k in 0 .. K do
                let n = N.[dgt] // 左からdgt桁目の数値
                for next in 0 .. 9 do
                    if n < next && isless = 0 then
                        ()
                    else
                        let dgt2 = dgt + 1

                        let isless2 =
                            if next < n then 1 else isless

                        let k2 =
                            if next <> 0 then k + 1 else k

                        dp.[dgt + 1, isless2, k2] <- dp.[dgt + 1, isless2, k2] + dp.[dgt, isless, k]

    // 答えはN以下の整数なので、N自身も含める
    let ans = dp.[len, 0, K] + dp.[len, 1, K]
    puts ans
    ()

// -----------------------------------------------------------------------------------------------------
main()
writer.Dispose()


Measured memory_bytes: 13376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define invrep(i, n) for(int i = (n)-1; i >= 0; i--)        // n-1, n-2, ..., 0
#define invREP(i, x, n) for(int i = (n)-1; i >= (x; i--)    // n-1, n-2, ..., x
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define PB push_back

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

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 n, a, b, c, l[9], ans = INF;

void dfs(int x, int A, int B, int C, int s){
    if(x > n){
        if(A && B && C) ans = min(ans, s + abs(a - A) + abs(b - B) + abs(c - C));
        return;
    }
    dfs(x + 1, A, B, C, s);
    dfs(x + 1, A + l[x], B, C, s + 10*(A > 0));
    dfs(x + 1, A, B + l[x], C, s + 10*(B > 0));
    dfs(x + 1, A, B, C + l[x], s + 10*(C > 0));
}

int main(){
    cin >> n >> a >> b >> c;
    REP(i, 1, n + 1) cin >> l[i];
    dfs(1, 0, 0, 0, 0);
    cout << ans << endl;
}

Measured memory_bytes: 256
/* author: Tarek */ 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
int main()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n;
cin>>n;
vector<int >p(n);
for(int i=0;i<n;i++){
   cin>>p[i];
}
int ans=0;
int curmin = 1e9;
for(int i=0;i<n;i++){
   curmin = min(curmin,p[i]);
   if(curmin==p[i])ans++;
}
cout<<ans<<endl;
 return 0;
}



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

outp = ""

for i in range(n):
    x = i + 1
    if x % 3 == 0:
        outp += " " + str(x)
        continue

    for num in range(10):
        if x % 10 == 3:
            outp += " " + str(i+1)
            break
        x = x // 10
        if x < 3:
            break

print(outp)


Measured memory_bytes: 5624
#include<map>
#include<queue>
#include<time.h>
#include<limits.h>
#include<cmath>
#include<ostream>
#include<iterator>
#include<set>
#include<stack>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep_1(i,m,n) for(int i=m;i<=n;i++)
#define mem(st) memset(st,0,sizeof st)
inline int read()
{
	int num=0, w=0;
	char ch=0;
	while (!isdigit(ch))
	{
		w|=ch=='-';
		ch = getchar();
	}
	while (isdigit(ch))
	{
		num = (num<<3) + (num<<1) + (ch^48);
		ch = getchar();
	}
	return w? -num: num;
}
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef pair<double,double> pdd;
const int inf = 0x3f3f3f3f;
const int N=300000+10;
int a[N];
int dp[N];
struct node
{
	int l,r;
	int v;
} tr[N*4];
void pushup(int u)
{
	tr[u].v=max(tr[u<<1].v,tr[u<<1|1].v);
}
void build(int u,int l,int r)
{
	tr[u]= {l,r};
	if(l==r)
	{
		tr[u].v=0;
		return ;
	}
	int mid=l+r>>1;
	build(u<<1,l,mid);
	build(u<<1|1,mid+1,r);
	pushup(u);
}
int query(int u,int l,int r)
{
	if(tr[u].l>=l&&tr[u].r<=r)
		return tr[u].v;

	int mid=tr[u].l+tr[u].r>>1;
	int v=0;
	if(l<=mid)
		v=max(v,query(u<<1,l,r));
	if(r>mid)
		v=max(v,query(u<<1|1,l,r));
	return v;

}

void modify(int u,int x,int p)
{
	if(tr[u].l==x&&tr[u].r==x)
	{
		tr[u].v=p;
		return;
	}
	else
	{
		int mid=tr[u].l+tr[u].r>>1;
		if(x<=mid)
			modify(u<<1,x,p);
		else
			modify(u<<1|1,x,p);
		pushup(u);
	}
}
int n;
int k;
signed main()
{
	int maxn=0;
	cin>>n>>k;
	for(int i=1; i<=n; i++)
		cin>>a[i],dp[i]=1,maxn=max(maxn,a[i]);
	build(1,0,maxn);
//	a[i]-k <=x<=   a[i]+k
	int res=0;
	for(int i=1; i<=n; i++)
	{
		int ans;
		ans=query(1,max(0,a[i]-k),a[i]+k);
		dp[i]=max(ans+1,dp[i]);
		modify(1,a[i],dp[i]);
		res=max(res,dp[i]);
	}
	cout<<res<<endl;
	return 0;
}



Measured memory_bytes: 18220
#include<iostream>
#include<algorithm>
#include<math.h>
#include <iterator>
#include <map>
#include<cmath>
using namespace std;


int main (){
 long long int x,ans=0;
 cin>>x;
 for(int i=1;i<=x;i++){
        int counter=0,temp=i;
    while(temp){
            temp/=10,counter++;
          }
 if(counter%2!=0)ans++;
 }
 cout<<ans<<endl;

	return 0;
}











Measured memory_bytes: 256
#include<bits/stdc++.h>
   using namespace std;
   int main()
   {
       ios::sync_with_stdio(0);
       cin.tie(0);
       /*int x,y;
       cin>>x>>y;
      if(y%2!=0)
      cout<<"No";
      else if((y/2<x || y/4>x))
      cout<<"No";
      else
      cout<<"Yes";*/
      int x,n;
      cin>>x>>n;
      unordered_set<int> s;
      int l;
      for(int i=0;i<n;i++)
      {
          cin>>l;
          s.insert(l);
      }
      if(n==0)
      {
          cout<<x;
          return 0;
      }
      int res;
      for(int i=0;i<=100;i++)
      {
          auto it1=s.find(x-i);
          auto it2=s.find(x+i);
          if(it1==s.end())
          {
          res=x-i;
          break;
          }
          else if(it2==s.end())
          {
              res=x+i;
              break;
          }
          
          
      }
      cout<<res;

   return 0;
   }

Measured memory_bytes: 3652
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        for(int i = 0; i < S.length(); i++){
            int c = S.charAt(i) + N;
            if(c > 90){
                c -= 26;
            }
            System.out.print((char)c);
        }
        System.out.println();
    }
}


Measured memory_bytes: 26580
#include<stdio.h>
int main(void){
	int i,n;
	scanf("%d",&n);
	int num[n];
	for(i=0;i<n;i++){
		scanf("%d",&num[n-i-1]);
	}
	for(i=0;i<n-1;i++){
		printf("%d ",num[i]);
	}
	printf("%d\n",num[n-1]);
	return 0;
}


Measured memory_bytes: 1856
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 2010;
const int MAXM = 35;
const int MAXK = 510;
const int MAXQ = 200010;

int n, m, L[MAXN][MAXN], R[MAXN][MAXN], U[MAXN][MAXN], D[MAXN][MAXN];
char ch[MAXN][MAXN];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m;
    FOR(i,1,n) FOR(j,1,m) cin >> ch[i][j];
    FOR(i,1,n) {
        int lef = 0;
        FOR(j,1,m) {
            if (ch[i][j] == '#') lef = j;
            L[i][j] = lef;
        }
        int rig = m+1;
        FORE(j,m,1) {
            if (ch[i][j] == '#') rig = j;
            R[i][j] = rig;
        }
    }
    FOR(j,1,m) {
        int u = 0;
        FOR(i,1,n) {
            if (ch[i][j] == '#') u = i;
            U[i][j] = u;
        }
        int d = n+1;
        FORE(i,n,1) {
            if (ch[i][j] == '#') d = i;
            D[i][j] = d;
        }
    }
    // FOR(i,1,n) {
    //     FOR(j,1,m) cout << L[i][j] << ' ';
    //     cout << endl;
    // }
    // cout << endl;
    // FOR(i,1,n) {
    //     FOR(j,1,m) cout << R[i][j] << ' ';
    //     cout << endl;
    // }
    // cout << endl;
    // FOR(i,1,n) {
    //     FOR(j,1,m) cout << U[i][j] << ' ';
    //     cout << endl;
    // }
    // cout << endl;
    // FOR(i,1,n) {
    //     FOR(j,1,m) cout << D[i][j] << ' ';
    //     cout << endl;
    // }
    // cout << endl;
    int res = 0;
    FOR(i,1,n)
        FOR(j,1,m)
            if (ch[i][j] != '#') {
                res = max(res, R[i][j] - L[i][j] - 1 + D[i][j] - U[i][j] - 2);
            }
    cout << res;
    return 0;
}

Measured memory_bytes: 67328
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,ans=-100000;
	cin>>a>>b;
	ans=max(ans,a+b);
	ans=max(ans,a-b);
	ans=max(ans,a*b);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int x,y;
  cin >> x >> y;
  int a[3] = {300000, 200000, 100000};
  int ans = 0;
  if(x<4) ans += a[x-1];
  if(y<4) ans += a[y-1];
  if(x==1 && y==1) ans += 400000;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 384
import math


if __name__ == "__main__":
    a, b, h, m = input().split()

    a = int(a)
    b = int(b)
    h = int(h)
    m = int(m)

    theta = 2.0 * math.pi * (h + m / 60.0) / 12.0
    phi = 2.0 * math.pi * m / 60.0

    xa = a * math.sin(theta)
    ya = a * math.cos(theta)

    xb = b * math.sin(phi)
    yb = b * math.cos(phi)

    distance = math.sqrt(math.pow(xa-xb, 2) + math.pow(ya-yb, 2))

    print(distance)

Measured memory_bytes: 9532
#include <iostream>
#include <string>
using namespace std;
int main(){
    int length = 0, max = 0;
    string S;
    cin >> S;
    for (auto c : S){
        if (c == 'A' || c == 'C' || c == 'G' || c == 'T'){
            length++;
        }
        else{
            max = (max > length) ? max : length;
            length = 0;
        }
    }
    max = (max > length) ? max : length;
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    int A1, A2, A3, S;

    cin >> A1 >> A2 >> A3;

    S = A1 + A2 + A3;

    if(S>=22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }

    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAX_V 100
#define MAX_E 10000
int V,E,par[MAX_V],rank[MAX_V];
struct Colony{
  double x,y,z,r;
  Colony(){}
  Colony(double x,double y,double z,double r) : x(x),y(y),z(z),r(r) {}
};
struct Edge{
  int u,v;
  double dist;
  Edge(){}
  Edge(int u,int v,double dist) : u(u),v(v),dist(dist) {}
};
bool comp(const Edge &e1,const Edge &e2){
  return e1.dist < e2.dist;
}
 
Edge es[MAX_E];
 
void init(){
  for(int i = 0 ; i < V ; i++){
    par[i] = i;
    rank[i] = 0;
  }
}
 
int find(int x){
  if(par[x] == x){
    return x;
  }
  return par[x] = find(par[x]);
}
 
void unite(int x,int y){
  x = find(x);
  y = find(y);
 
  if(x == y) return;
 
  if(rank[x] < rank[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(rank[x] == rank[y]){
      rank[x]++;
    }
  }
}
 
bool same(int x,int y){
  return find(x) == find(y);
}
 
double kruskal(){
  sort(es,es+E,comp);
  init();
  double res = 0.0;
  for(int i = 0 ; i < E ; i++){
    Edge e = es[i];
    if(!same(e.u,e.v)){
      unite(e.u,e.v);
      res += e.dist;
    }
  }
  return res;
}
 
double getDist(const Colony &c1,const Colony &c2){
  return sqrt(pow(c1.x-c2.x,2)+pow(c1.y-c2.y,2)+pow(c1.z-c2.z,2))-c1.r-c2.r;
}
 
int main(){
  while(cin >> V,V){
    E = 0;
    double x,y,z,r;
    Colony C[MAX_V];
    for(int i = 0 ; i < V ; i++){
      cin >> x >> y >> z >> r;
      C[i] = Colony(x,y,z,r);
    }
     
    for(int i = 0 ; i < V ; i++){
      for(int j = i+1 ; j < V ; j++){
        double dist = getDist(C[i],C[j]);
        es[E++] = Edge(i,j,max(dist,0.0));
      }
    }
    printf("%.3f\n",kruskal());
  }
  return 0;
}

Measured memory_bytes: 1336
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define For(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define int long long
#define ld long double
// typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
int power_mod(int num,int g)
{
    if(g==0)return 1;
    if(g%2==1)return (num*power_mod((num*num)%mod,g/2))%mod;
    return power_mod((num*num)%mod,g/2);
}
int power(int num,int g)
{
    if(g==0)return 1;
    if(g%2==1)return (num*power((num*num),g/2));
    return power((num*num),g/2);
}
int n;
string s;
int a[3005][3005];
int32_t 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);
    
    
    cin>>n>>s;
    a[0][1]=a[0][2]=0;
    if(s[0]=='<')a[0][2]=1;
    else a[0][1]=a[0][2]=1;
    a[0][0]=0;
    a[0][3]=a[0][2];
    for(int i=1;i<n-1;i++) {
        for(int j=0;j<=i+3;j++) {
            
            if(j==0) {
                a[i][j]=0;
            }
            else if(j==i+3)a[i][j]=a[i][j-1];
            else {
                if(s[i]=='<') {
                    a[i][j]=a[i][j-1]+a[i-1][j-1];
                    a[i][j]%=mod;
                }
                else {
                    a[i][j]=a[i][j-1]+(a[i-1][i+1]-a[i-1][j-1]+mod);
                    // cout<<i<<" "<<j<<" "<<a[i][j]<<endl;
                    a[i][j]%=mod;
                }
            }
            // cout<<a[i][j]<<" ";
        }
        // cout<<endl;
    }
    int ans=0;
    cout<<a[n-2][n]<<endl;
    return 0;
}


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

int main()
{
	int N;
	cin >> N;
	vector<int> d(N);
	for (int i = 0; i < N; i++) {
		cin >> d[i];
	}
	sort(d.begin(), d.end());
	cout << d[N / 2] - d[N / 2 - 1] << endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <math.h>
using namespace std;

int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    int res = 0;
    if(b / a >= c){
        res = c;
    } else{
        res = b / a;
    }
    cout << res << endl;
    return 0;
}

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

int FindSomeOfDigits(int n){
  int sum = 0;
  while(n>0){
    sum+=n%10;
    n/=10;
  }
  return sum;
}

int main() {
  int N;
  std::cin >>N;
  int sum=FindSomeOfDigits(N);
  if(N%sum==0){std::cout << "Yes" << '\n';}
  else {std::cout << "No" << '\n';}

}


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

using namespace std;

int main(){
    string s, s1, s2;
    cin >> s >> s1 >> s2;
    putchar(toupper(s[0]));
    putchar(toupper(s1[0]));
    putchar(toupper(s2[0]));
    return 0;

}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char *argv[])
{
	int i, N, M;
	unsigned long long val = 1;
	scanf("%d %d", &N, &M);

	if ( N-M >= 2 || M-N >= 2 ){
		printf("0\n");
	} else {
		for ( i = 1; i <= M; i++ ){
			val *= i;
			val = val % 1000000007;
		}	
		for ( i = 1; i <= N; i++ ){
			val *= i;
			val = val % 1000000007;
		}
		if ( N-M == 0 ){
			val *= 2;
			val = val % 1000000007;
		}
		printf("%llu\n", val);
	}

	return 0;
}


Measured memory_bytes: 128
from itertools import permutations as per
n = int(input())
p = tuple(int(i) for i in input().split())
q = tuple(int(i) for i in input().split())

a = b = 0
for i,x in enumerate(per(range(1,n+1)),1):
    if x == p: a = i
    if x == q: b = i
    if a and b: break
print(abs(a-b))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
using vvll = vector<ll, vector<ll> >;
using vll = vector<ll> ;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main() {
    fastio();

    int A, B;
    cin >> A >> B;
    if(A < B + B) {
        cout << 0 << '\n';
    } else {
        cout << A - B - B << "\n";
    }
    
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
	 Scanner reader  =new Scanner(System.in);	
	 int A=reader.nextInt();
	 int B=reader.nextInt();
	 int s1=A+B;
	 if(s1%3==0||A%3==0||B%3==0) {
		 System.out.println("Possible");
		 
	 }
	 else {
		 System.out.println("Impossible");
	
	 }
	}

}



Measured memory_bytes: 25172