akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <list>
#include <string>
using namespace std;
typedef long long ll;

int main() {
    int N[4];
    for(int i=0;i<4;i++){
        cin >> N[i];
    }
    int num[4];
    for(int i=0;i<4;i++){
        num[i]=0;
    }
    for(int i=0;i<4;i++){
        if(N[i]==1) num[0]=1;
        if(N[i]==7) num[1]=1;
        if(N[i]==9) num[2]=1;
        if(N[i]==4) num[3]=1;
    }
    for(int i=0;i<4;i++){
        if(num[i]==0){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;

#define MIN(a,b) ((a)<(b)?(a):(b))

long long f(long long  N, long long  a, long long  b) {
	return a * N + b * ((N == 0 ? 1 : (long long)log10(N)) + 1);
}

bool isOK(long long   index, long long   key, long long  a, long long  b) {
	cerr << f(index, a, b) << ":" <<key<<":"<< index << endl;
	cerr << (f(index, a, b) <= key ? "OK" : "NG") << endl;;
	return f(index, a, b) <= key;
}

// 汎用的な二分探索のテンプレ
long long  binary_search(long long   key, long long  a, long long  b) {
	long long   ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	long long   ok = 10e9 + 1; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	long long index = -1;
	/* ok と ng のどちらが大きいかわからないことを考慮 */
	while (abs(ok - ng) > 1) {
		long long   mid = (ok + ng) / 2;
		if (isOK(mid, key, a, b)) ng = mid;
		else ok = mid;
		index = ng;
		cerr << index << ":" << ok << ":" << ng << endl;
	}
	return index;
}

int main() {
	int  a, b, c, k;
	cin >> a >> b >> c >> k;
	int ans = 0;
	if (a >= k) {
		ans += k;
		cout << ans;
		return 0;
	}
	else {
		ans += a;
		k -= a;
	}
	if (b >= k) {
		cout << ans;
		return 0;
	}
	else {
		k -= b;
	}
	ans -= k;
	cout << ans;
	return 0;
}

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

int main() {
    string od,ev;
    cin>>od>>ev;
    for(int i=0; i<min(od.size(),ev.size()); i++){
        cout<<od[i]<<ev[i];
    }
    
    if(od.size() != ev.size()){
        cout<<od[od.size()-1];
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define NUM 20001
#define FOR(i,a,n) for(i=a;i<n;i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
	int i;
	FOR(i,0,b) a[i]=c;
	return;
}
ll a[100000],b[100000];
int main(void)
{
	int n,i;
	ll res=0,k;
	scanf("%d",&n);
	FOR(i,0,n) scanf("%lld%lld",&a[i],&b[i]);
	for(i=n-1;i>=0;i--){
		a[i]+=res;
		k=(a[i]+b[i]-1)/b[i];
		res+=b[i]*k-a[i];
	}
	printf("%lld\n",res);
	return 0;
}
    

Measured memory_bytes: 1664
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int xcomp(vector<int>& a, vector<int>& b) {
	return a[0] < b[0];
}

int ycomp(vector<int>& a, vector<int>& b) {
	return a[1] < b[1];
}

int zcomp(vector<int>& a, vector<int>& b) {
	return a[2] < b[2];
}
#define XSORT(c) sort((c).begin(),(c).end(),xcomp)
#define YSORT(c) sort((c).begin(),(c).end(),ycomp)
#define ZSORT(c) sort((c).begin(),(c).end(),zcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

LL pow2(LL a) {
	if (a == 0) {
		return 1;
	}else
		if (a == 1) {
			return 2;
		}
		else 
			if (a % 2 == 0) {
				LL b = pow2(a / 2)%mod;
				return (b*b) % mod;
			}
			else {
				LL b = pow2((a - 1) / 2) % mod;
				return (b*b * 2) % mod;
			}
}
int main() {
	LL x, y;
	cin >> x >> y;
	LL hoge = abs(abs(x) - abs(y));
	if (x > 0 && y > 0 &&x <= y) {
		cout << hoge << endl;
	}else
		if (x > 0 && y > 0 && x > y) {
			cout << hoge +2<< endl;
		}
		else
			if (x > 0 && y < 0 ) {
				cout << hoge + 1 << endl;
			}
			else
				if (x > 0 && y == 0) {
					cout << hoge + 1 << endl;
				}else
					if (x == 0 && y >= 0) {
						cout << hoge << endl;
					}else
						if (x == 0 && y < 0) {
							cout << hoge + 1 << endl;
						}else
							if (x < 0 && y>0) {
								cout << hoge + 1 << endl;
							}
							else 
								if (x < 0 && y == 0) {
									cout << hoge << endl;
								}else
									if (x <= y) {
										cout << hoge << endl;
									}
									else {
										cout << hoge + 2 << endl;
									}
			
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#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 FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
vector<int> hoge[26];
vector<int> huge[26];
int flag[26];
int flag2[26];
int main(){
    SCIN(s);SCIN(t);

    REP(a,s.size()){
        int ins = s.at(a)-'a';
        hoge[ins].push_back(a);
        int e = t.at(a)-'a';
        huge[e].push_back(a);
    }
    bool result = true;
    for(int a = 0;a < 26;a++){
        for(int b = 0;b < 26;b++){
            if(hoge[a] == huge[b] && flag[b] == 0){
                flag[b]=1;
                flag2[a]=1;
                break;
            }
        }
    }
    for(int a = 0;a < 26;a++){
        if(flag2[a] == 0)result = false;
    }
    Yes(result);
    return 0;
}


Measured memory_bytes: 3080
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

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;
}

const long long INF = 1LL << 60;

long long h[100010];

long long dp[100010];

int main(void){
    int n;
    std::cin >> n;

    for(int i = 0; i < n; i++){
        std::cin >> h[i];
    }

    for(int i = 0; i < 100010; i++){
        dp[i] = INF;
    }

    dp[0] = 0;

    for(int i = 1; i < n; i++){
        chmin(dp[i], dp[i-1] +std::abs(h[i] - h[i-1]));
        if(i > 1){
            chmin(dp[i], dp[i-2] +std::abs(h[i] - h[i-2]));
        }
    }

    std::cout << dp[n-1] << std::endl;
    return 0;
}

Measured memory_bytes: 1792
import java.lang.Math.abs
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val IN = listOf(sc.nextInt(), sc.nextInt(),sc.nextInt())
    println(if((IN.count{it == 5} == 2) && (IN.count{it == 7} == 1) ){
        "YES"
    }else{
        "NO"
    })
}

Measured memory_bytes: 34240
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
const int MOD = 998244353;
int fpow(int a, int n, int P) {
  int r = 1; while (n) {
    if (n & 1) 
      r = 1ll * r * a % P;
    a = 1ll * a * a % P; n >>= 1;
  }
  return r;
}
const int P = 998244353, R = 3, MAXN = (1 << 23);
struct Poly : vector<int> { int n; 
  Poly (int n) : n(n) { this->resize(n); }
  int extend(int x) { 
    int N = 1; while (N < x) N <<= 1; return N;
  }
  Poly operator * (const Poly &rhs) {
    Poly a = *this, b = rhs;
    int N = extend(n + rhs.n - 1);
    a.resize(a.n = N); a.ntt(1);
    b.resize(b.n = N); b.ntt(1);
    for (int i = 0 ; i < N ; i++) 
      a[i] = 1ll * a[i] * b[i] % P;
    return a.ntt(-1), a.n = n + rhs.n, a;
  }
  void ntt(int op) { static Poly r(MAXN);
    for (int i = 0 ; i < n ; i++) {
      r[i] = (i & 1) * (n >> 1) + (r[i >> 1] >> 1);
      if (r[i] < i) std::swap(at(i), at(r[i]));
    }
    for (int m = 2 ; m <= n ; m <<= 1) {
      int k = m >> 1, gn = fpow(R, (P - 1) / m, P);
      for (int i = 0 ; i < n ; i += m) { int g = 1;
        for (int j = 0 ; j < k ; j++, g = 1ll * g * gn % P) {
          int tmp = 1ll * at(i + j + k) * g % P;
          at(i + j + k) = (at(i + j) - tmp + P) % P;
          at(i + j) = (at(i + j) + tmp) % P;
        }
      }
    }
    if (op == -1) { 
      reverse(begin() + 1, end());
      int inv = fpow(n, P - 2, P);
      for (int i = 0 ; i < n ; i++)
        at(i) = 1ll * at(i) * inv % P;
    }
  }
};
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, m; cin >> n >> m;
    Poly a(n), b(m);
    for (int i = 0 ; i < n ; i++)
        cin >> a[i];
    for (int i = 0 ; i < m ; i++)
        cin >> b[i];
    Poly c = a * b;
    for (int i = 0 ; i < n + m - 1 ; i++)
        cout << c[i] << " \n"[i + 1 == n + m - 1];
}

Measured memory_bytes: 52376
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
#include <iomanip>
#include <queue>
#include <cmath>
#include <math.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;
#define min(a, b) ((a) < (b) ? (a) : (b))



long long gcd(long long a, long long b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

long long lcm(long long a, long long b)
{
	return a * b / gcd(a, b);
}

double calculateDegree(double side, double B) {
	double radian = atan2(side, B);
	double degree = radian * (180.0 / 3.141592653589793238463);
	return degree;
}


int main() {
	int N;
	cin >> N;
	vector<int> L(N);
	for (int i = 0; i < N; i++) cin >> L.at(i);
	sort(L.begin(), L.end());

	long long res = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			// イテレーターに対して- L.begin()を引いて範囲の右端を出す。
			// ちなみに、イテレーターに対して- L.end()を引いて範囲の左端を出す。
			int k = lower_bound(L.begin(), L.end(), L.at(i) + L.at(j)) - L.begin();
			// 当てはまる３本目がなかったときの対応
			// 2本目(j)より3本目(k)左にあった場合の対応
			res += max(k-(j+1), 0);
		}
	}
	cout << res << endl;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
   char a;
   cin >> a;
   if ((int)a>=65&&(int)a<=90)
   {
       cout << 'A';
   }
   else
   {
       cout << 'a';
   }
   return 0;
}

Measured memory_bytes: 3608
while True:
    s=input().split()
    h=int(s[0])
    w=int(s[1])
    if h==0:
        break
    for i in range(1,h+1):
        if i%2==1:
            if w%2==0:
                print("#."*(w//2))
            else:
                print("#."*(w//2)+"#")
        else:
            if w%2==0:
                print(".#"*(w//2))
            else:
                print(".#"*(w//2)+".")
    print()


Measured memory_bytes: 5608
package main

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

// input に使うやつ
var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

// string から int へ
func atoi(s string) int {
	i, _ := strconv.Atoi(s)
	return i
}

// 一つの文字を int として読み込み
func readInt() int {
	return atoi(readLine())
}

// 複数の文字を int のスライスとして読み込み
func readInts() []int {
	in := readLine()
	ins := strings.Split(in, " ")
	out := make([]int, len(ins))
	for i, v := range ins {
		out[i] = atoi(v)
	}
	return out
}

// sortしたスライスを返す
func sorted(a []int) []int {
	b := make([]int, len(a))
	copy(b, a)
	sort.Ints(b)
	return b
}

// 逆順のsort
func reverse(a []int) []int {
	b := make([]int, len(a))
	copy(b, a)
	sort.Sort(sort.Reverse(sort.IntSlice(b)))
	return b
}

func main() {
	n := readInt()
	h := readInts()

	var max int
	for i := 1; i < n; i++ {
		if h[i] < max-1 {
			fmt.Println("No")
			return
		}

		if h[i-1] <= h[i] || h[i-1]-1 == h[i] {
			if max < h[i] {
				max = h[i]
			}
		} else {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}


Measured memory_bytes: 7680
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <set>
#include <iomanip>
using namespace std;

typedef long long ll;

int main()
{
    ll N;
	cin >> N;
	vector<ll> A(N+2), leftsum(N+2, 0), rightsum(N+2, 0);//leftsumは左から足した和
	ll sum=0;
	for(int i=1; i<=N; i++){
		cin >> A[i];
		sum+=A[i];
		leftsum[i]=sum;
	}
	leftsum[N+1]=sum;
	for(int i=1; i<=N; i++){
		rightsum[i]=rightsum[i-1]+A[N-i+1];
	}
	rightsum[N+1]=sum;
	ll ans=100000000000;
	
	for(int mid=3; mid<=N-1; mid++){
		ll sum1=leftsum[mid-1];
		ll sum2=rightsum[N-mid+1];

		auto iter1=lower_bound(leftsum.begin()+1, leftsum.begin()+mid-1, (double)sum1/2);//key以上のうちもっとも小さい値
		auto iter2=iter1-1;
		auto iter3=lower_bound(rightsum.begin()+1, rightsum.begin()+N-mid+1, (double)sum2/2);
		auto iter4=iter3-1;
		
		if(iter1>=leftsum.begin()+1 && iter1<=leftsum.begin()+mid-1){
			if(iter3>=rightsum.begin()+1 && iter3<=rightsum.begin()+N-mid+1){//rightsum.end()-1
				ans=min(ans, max(*iter1, *iter3)-min(sum1-*iter1, sum2-*iter3));//rightsum.end()-mid+1
			}
			if(iter4>=rightsum.begin()+1 && iter4<=rightsum.begin()+N-mid+1){
				ans=min(ans, max(*iter1, sum2-*iter4)-min(sum1-*iter1, *iter4));
			}
		}
		if(iter2>=leftsum.begin()+1 && iter2<=leftsum.begin()+mid-1){
			if(iter3>=rightsum.begin()+1 && iter3<=rightsum.begin()+N-mid+1){
				ans=min(ans, max(sum1-*iter2, *iter3)-min(*iter2, sum2-*iter3));
			}
			if(iter4>=rightsum.begin()+1 && iter4<=rightsum.begin()+N-mid+1){
				ans=min(ans, max(sum1-*iter2, sum2-*iter4)-min(*iter2, *iter4));
			}
		}
	}

	cout << ans << endl;
    

    return 0;
}


Measured memory_bytes: 4992
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<cstring>
using namespace std;
#define maxn 810
#define llg int
#define inf (llg)1e9
#define yyj(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout);
llg n,m,f[maxn+100][maxn+100],A,B,ans=inf;

llg gcd(llg a, llg b){ return a == 0 ? b : gcd(b % a, a); } 

int main()
{
	//yyj("D");
	cin>>n>>A>>B;
	llg C=gcd(A,B);
	A/=C,B/=C;
	for (llg i=0;i<=maxn;i++)
		for (llg j=0;j<=maxn;j++)
			f[i][j]=inf;
	f[0][0]=0;
	for (llg k=1;k<=n;k++)
	{
		llg x,y,z;
		cin>>x>>y>>z;
		for (llg i=maxn;i>=0;i--)
			for (llg j=maxn;j>=0;j--)
				if (f[i][j]!=inf)
				{
					f[i+x][j+y]=min(f[i+x][j+y],f[i][j]+z);
				}
	}
	for (llg x=1;x<=maxn;x++)
	{
		if (x%A!=0) continue;
		llg y=x/A;
		y*=B;
		if (y>maxn) break;
		ans=min(ans,f[x][y]);
	}
	if (ans==inf) cout<<-1;else cout<<ans;
	return 0;
}


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

using namespace std;

const int maxn = 1e5 + 10;

int n, k;
int a[maxn];
bool visited[maxn];
int res = 0;
int d[maxn];
vector <int> edge[maxn];

void dfs(int u) {
  visited[u] = true;
  d[u] = 0;
  for (int v : edge[u]) {
    if (visited[v]) continue;
    dfs(v);
    d[u] = max(d[u], d[v] + 1);
  }
  if (d[u] == k - 1 && a[u] != 1) {
    a[u] = 1;
    d[u] = -1;
    res++;
  }
}

int solve() {
  if (k == 1) {
    int res = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] != 1) res++;
    }
    return res;
  }
  for (int i = 2; i <= n; i++) {
    edge[a[i]].push_back(i);
  }
  res += (a[1] != 1);
  a[1] = 1;
  dfs(1);
  return ::res;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  cout << solve();
}

Measured memory_bytes: 11264
/* ex5_4
   kento_titech*/
#include<stdio.h>
#define SIZE 11
int count(char *p);//プロトタイプ宣言
int main(void){
    char str[SIZE];
    scanf("%s",str);//文字列str読み込み
    printf("%d\n",count(str));//最大値出力
    return 0;
}
int count(char *p){
    int seq=0,max=0;
    while(*p){//アドレスｐを文字列の最後まで動かす
        if(*p=='A'||*p=='T'||*p=='G'||*p=='C'){//文字列に'A''T''G''C'が含まれるとき連続して現れる回数seqを増やす
            seq++;
            if(max<seq) 
                max=seq;//seqの最大値が更新するときmaxに保存
        }
        else 
            seq=0;
        p++;//アドレスを１つずらす
    }return (max);//最大値を返す
}

Measured memory_bytes: 1724
#include <stdio.h>

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

	if (4 * X >= Y && (4 * X - Y) % 2 == 0 && Y >= 2 * X && (Y - 2*X) % 2 == 0)
		printf("Yes\n");
	else
		printf("No\n");

	return 0;
}



Measured memory_bytes: 1660
#include <iostream>
#include<list>
#include<cstdlib>
using namespace std;

int main()
{
	list<int> L;
	int q;
	cin >> q;

	list<int>::iterator cursol = L.begin();

	for (int i = 1; i <= q; i++) {
		int quer, x;
		cin >> quer;

		if (quer == 0) {
			cin >> x;
			cursol = L.insert(cursol, x);
		}
		else if (quer == 1) {
			cin >> x;
			for (int j = 1; j <= abs(x); j++) {
				if (x > 0) {
					cursol++;
				}
				else if (x < 0) {
					cursol--;
				}
			}
		}
		else {
			cursol = L.erase(cursol);
		}	

	}

	for (list<int>::iterator i = L.begin(); i != L.end(); i++) {
		cout << *i << endl;
	}

	return 0;
}



Measured memory_bytes: 18616
def main():
    """ MAIN """
    DAT = []
    num = int(input())
    for i in range(num):
        x, y = list(map(int,input().split()))
        DAT.append(x)
    DAT.append(y)
    num1 = num + 1
    TBL = [[0] * num1 for i in range(num1)]

    for i in range(0, num1):
        for row in range(num-i):
            col = row + i + 1
            for j in range(row+1,col):
                x = DAT[row] * DAT[j] * DAT[col] + TBL[row][j] + TBL[j][col]
                if TBL[row][col] < 1 or TBL[row][col] > x:
                    TBL[row][col] = x

    print("{}".format(TBL[row][col]))

if __name__ == '__main__':
    main()

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

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;

#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define ff it->first
#define ss it->second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0;i<n;++i)
#define LOOP_IT(it,s) for(auto it=(s).begin();it!=(s).end();++it)


#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


const int inf = 2e9;

ll const mod=998244353;

ll mod_pow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}


int main(int argv, char* argc[])
{
    FASTIO

    int k,a,b;
    cin>>k>>a>>b;
    if(a%k!=0){
    int g = a/k;
    ++g;
    if(g*k<=b&&g*k>=a)
        cout<<"OK";
    else
        cout<<"NG";}
    else
        cout<<"OK";
    return 0;
}


Measured memory_bytes: 3656
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

# inputa = [int(n) for n in inputa]
# inputa.sort()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])


if a < 1200:
    print("ABC")
elif a < 2800:
    print("ARC")
else:
    print("AGC")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  int h,w,n;
  cin>>h>>w>>n;
  float x1=0,x2=0;
  float x3=0;
  x3=max(h,w);
  x2=n/x3;
  cout<<ceil(x2)<<endl;
}

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

#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vpii        vector< pii >
#define vi          vector<ll>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			1'010'000'000'000'000'017LL
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define sz(x)       (ll)x.size()
#define rep(i,a,b)	for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )

using namespace std;

template<class T>
bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>
bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
ll DivisorCount(ll x) {
	ll ans = 1;
	for (int i = 2; i <= sqrt(x); i++) {
		int cnt = 0;
		while (x % i == 0) {
			cnt++;
			x /= i;
		}
		ans *= (cnt + 1);
		if (x == 1) break;
	}
	if (x != 1) ans *= 2;
	return ans;
}

void Main() {
	char a;
	cin >> a;
	cout << ((65 <= a && a <= 90)? 'A': 'a') << endl;
}


int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	Main();
	return 0;
}


Measured memory_bytes: 3664
import Queue
import copy

def main():
    H, W = map(int, raw_input().split())
    S = []

    for i in range(H):
        S.append(list(raw_input()))


    def bfs(start, S2):
        q = Queue.Queue()
        q.put(start)
        candidates = [[0, 1], [1, 0], [0, -1], [-1, 0]]
        dist = [[0]*W for _ in range(H)]
        S2[start[0]][start[1]] = "#"
        while not q.empty():
            i = q.get()
            x = i[0]
            y = i[1]

            for candi in candidates:
                x_new = x + candi[0]
                y_new = y + candi[1]

                if x_new < H and x_new >= 0:
                    if y_new < W and y_new >=0:
                        if S2[x_new][y_new] == ".":
                            dist[x_new][y_new] = dist[x][y] + 1
                            S2[x_new][y_new] = "#"
                            q.put([x_new, y_new])

        ans = 0
        for i in range(H):
            ans = max(ans, max(dist[i]))

        return ans

    ans = 0
    for i in range(H):
        for j in range(W):
            if S[i][j] == ".":
                S2 = copy.deepcopy(S)
                ans_temp = bfs([i, j], S2)
#                print i, j, ans_temp                                                                                                                     
                ans = max(ans, ans_temp)


    print ans


if __name__ == "__main__":
    main()



Measured memory_bytes: 35864
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mod 1000000007


int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    map<char, int> m;
    for(auto x:s)
        m[x]++;
    bool f=false;
    if(m.size()!=2)
        f=true;
    for(auto x:m)
        if(x.second!=2)
            f=true;
    if(f)
        cout<<"No";
    else
        cout<<"Yes";
    return 0;
}

Measured memory_bytes: 256
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1000000007
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define INF 1e18
#define N 1001000
typedef pair<ll,ll> pll;
ll power(ll a,ll b)
{
    if(b==1)return a;
    if(b==0)return 1;
    ll temp=power(a,b/2);
    ll ans=temp*temp;
    if(b&1)
        ans*=a;
    return ans;
}
ll power(ll a,ll b,ll p)
{
    a=a%p;
    if(b==1)return a;
    if(b==0)return 1;

    ll temp=power(a,b/2,p);
    ll ans=(temp*temp)%p;
    if(b&1)
        ans=(a*ans)%p;
    return ans%p;
}
ll inv(ll a,ll m)
{
    return power(a,m-2,m);
}
//code begins
signed main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    cin.sync_with_stdio(false);
    ll k;cin>>k;
    if(k<=9)
    {
        cout<<k<<endl;
        return 0;
    }
    map<ll,bool> vis;
    queue<ll> q;
    for(ll i=1;i<=9;i++)
    {
        q.push(i);
        vis[i]=1;
    }
    ll sze=1;
    while(q.size()!=0)
    {
        ll top=q.front();q.pop();
//        cout<<"top= "<<top<<endl;
        if(sze==k)
        {
            cout<<top<<endl;
            break;
        }
        sze++;
        ll ld=top%10;
        if(ld==0)
        {
            q.push(top*10+ld);
            q.push(top*10+ld+1);
        }
        else if(ld==9)
        {
            q.push(top*10+ld-1);
            q.push(top*10+ld);
        }
        else
        {
            q.push(top*10+ld-1);
            q.push(top*10+ld);
            q.push(top*10+ld+1);
        }
    }
    return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>

int main(void)
{
  int p[1001],n,k,i,tmp,j,sum=0;
  
  scanf("%d%d",&n,&k);
  
  for(i=0;i<n;i++)
    scanf("%d", &p[i]);
  
  for (i=0; i<n; ++i) {
    for (j=i+1; j<n; ++j) {
      if (p[i] > p[j]) {
        tmp =  p[i];
        p[i] = p[j];
        p[j] = tmp;
      }
    }
  }
  
  for(i=0;i<k;i++)
    sum+=p[i];
  
  printf("%d", sum);
  
  return 0;
}

Measured memory_bytes: 1732
N = int(input())

if N%2 == 0:
  print(N, N, N//2)
else:
  for h in range(1, 3501):
    if 4*h <= N:
      continue
    for n in range(h, 3501):
      num = N*h*n
      dem = 4*h*n - N*(h+n)
      if dem > 0 and num%dem == 0:
        print(h, n, num//dem)
        quit()



Measured memory_bytes: 3064
# encoding: utf-8
N = int(input())
A = [int(input()) for i in range(N)]

A.sort()

tag = -1
cnt = 0
ans = 0
for Ai in A:
    if Ai > tag:
        tag = Ai
        ans += cnt % 2
        cnt = 0
    cnt += 1
else:
    ans += cnt % 2
        
print(ans)

Measured memory_bytes: 7508
#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--) //逆ループ

//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;

using namespace std;

//#include "./lib/generic/search.h"

int main(){
    ll k;
    cin >> k;
    ll v=7;
    rep(i,100000000){
        if(v<k){
            v*=10;
            v+=7;
        }
        else{
            v=v%k;
            if(v==0){
                cout << i+1 << endl;
                return 0;
            }
            else{
                v*=10;
                v+=7;
            }
        }
    }
    cout << -1 << endl;
    return 0;
}


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

const int N = 1e5 + 10;

char s[N];
int n , ans;

int main(){
	scanf("%s" , s + 1) , n = strlen(s + 1);
	for(int i = 2; i <= n; i++)
		if(s[i] != s[i - 1]) ans++;
	printf("%d" , ans);
	return 0;
}

Measured memory_bytes: 3904
n = int(input())
x = list(map(int,input().split()))
x_sort = sorted(x)
mini = x_sort[n//2-1]
maxi = x_sort[n//2]
if mini == maxi:
    for _ in range(n):
        print(mini)
else:
    for a in x:
        if a < maxi:
            print(maxi)
        else:
            print(mini)

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld PI = acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
//const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);

    vi dp(112345, inf);
    int h,n,maxi; cin >> h >> n;
    vi a(n), b(n);
    rep(i,n) {
        cin >> a[i] >> b[i];
        chmax(maxi, a[i]);
    }

    dp[0] = 0;
    for(int i = 0; i <= h; ++i) {
        for(int j = 0; j < n; ++j) {
            if(112345 < i+a[j]) continue;
            dp[i+a[j]] = min(dp[i+a[j]], dp[i] + b[j]);
        }
    }
    int ans = inf;
    for(int i = h; i <= h + maxi; ++i) {
        chmin(ans, dp[i]);
    }
    cout << ans << '\n';
    //for(int i = 0; i < 11; i++) debug(dp[i]);
}

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

signed main(){
	int n,r = 0,b = 0;
	string s;
	cin >> n >> s;
	for(int i = 0;i < n;i++){
		((s[i] == 'R') ? r : b)++;
	}
	cout << ((r > b) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/square.hpp
#ifndef SQUARE_HPP
#define SQUARE_HPP

/*
usage:

tools::square(5) => 25
*/

namespace tools {
  template <typename T>
  constexpr T square(const T x) {
    return x * x;
  }
}

#endif

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// lib/pow.hpp
#ifndef POW_H
#define POW_H


/*
usage:

tools::pow(2, 5) => 32
*/

namespace tools {
  template <typename T>
  constexpr T pow(const T base, const T exponent) {
    return exponent == 0
      ? 1
      : exponent % 2 == 0
        ? square(pow(base, exponent / 2))
        : pow(base, exponent - 1) * base;
  }
}

#endif

// main.cpp

int main() {
  i64 X;
  std::cin >> X;

  std::vector<bool> table(1001, false);
  table[1] = true;
  for (i64 b = 2; b <= 31; ++b) {
    for (i64 p = 2; tools::pow(b, p) <= 1000; ++p) {
      table[tools::pow(b, p)] = true;
    }
  }

  i64 i;
  for (i = X; !table[i]; --i);
  std::cout << i << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long maxn=1e5+5;
const long long inf=0x3f3f3f3f;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	string s;
	cin>>s;
	long long n=s.size()-1,ans=0;
	for(long long i=0;i<(1<<n);i++)
	{
		long long tmp=0;
		bitset<10> b(i);
		for(long long j=0;j<=n;j++)
		{
			long long a=s[j]-'0';
			tmp=tmp*10+a;
			if(b.test(j)||j==n)
			{
				ans+=tmp;
				tmp=0;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}




Measured memory_bytes: 256
package main

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

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	text := stdin.Text()
	s := strings.Split(text, " ")
	a, _ := strconv.Atoi(s[0])
	b, _ := strconv.Atoi(s[1])

	if a*b%2 == 0 {
		fmt.Println("Even")
	} else {
		fmt.Println("Odd")
	}
}

Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(){
    int N, K;
    char S[110000];
    char stmp;
    int  iS[110000];
    int i, j;
    int count=0, tmp=0;
    int length;
    int maxl=0;
    int itmp, inum=0;
    int sbool=1;

    scanf("%d %d", &N, &K);
    scanf("%s", &S);

    stmp = S[0];
    count = 1;

    for(i=0; i<N; i++){
        if(S[i] == '1'){
            if(sbool == 1){
                iS[i] = count;
            }else{
                sbool = 1;
                count++;
                iS[i] = count;
            }
        }else{
            sbool = 0;
            iS[i] = count;
        }
    }

    count = 1;
    stmp = S[0];
    length = 0;
    itmp = 0;

    for(i=0; i<N; i++){
        //printf("%d", iS[i]);
    }

    for(i=0; i<N; i++){
        if(S[i] == stmp){
            length++;
        }else if(S[i] == '1'){
            stmp = '1';
            length++;
        }else if(S[i] == '0'){
            stmp = '0';
            while(iS[itmp] <= iS[i]-K){
                itmp++;
                length--;
            }
            length++;
        }
        if(maxl < length){
            maxl = length;
        }
        //printf("%d %d\n", itmp, length);
    }

    printf("%d", maxl);

    return 0;
}

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

const int N = 105, K = 100005;

int n, k, a[N];

int dp[K];

int rec(int i) {
  if (dp[i] != 0) return dp[i];
  int res = -1;
  rep(ai, n) {
    if (i - a[ai] < 0) continue;
    if (rec(i - a[ai]) == -1) res = 1;
  }
  return dp[i] = res;
}

int main() {
  cin >> n >> k;
  rep(i, n) cin >> a[i];
  rep(i, k+1) dp[i] = 0;
  if (rec(k) == 1) cout << "First" << endl;
  else cout << "Second" << endl;
  return 0;
}

Measured memory_bytes: 8680
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N, A, B, C, D, E, X;
  cin >> N >> A >> B >> C >> D >> E;
  X=min(A, min(B, min(C, min(D, E))));
  if(N%X!=0){
    cout << N/X+5 << endl;
  }
  else {
    cout << N/X+4 << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int min(int a,int b){
    return (a<b) ? a : b ;
}

int max(int a,int b){
    return (a<b) ? b : a ;
}


int main() {

    int a,b,h ;
    cin >>a>>b>>h  ;

    cout << (a+b)*h*0.5 << endl ;

 return 0 ;
}  


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<cstdlib>
#include<cmath>
#define range(i,a,b) for(int i = (a); i <= (b); i++)
#define rrange(i,a,b) for(int i = (a); i >= (b); i--)
#define rep(i,b) for(int i = 1; i <= (b); i++)
#define rrep(i,b) for(int i = (b); i >= 1; i--)
#define all(a) (a).begin(), (a).end()
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
typedef long long ll;
const int N=3e2+11;
const int INF = 1001001001;
const ll LLINF = 1001001001001001001LL;
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
struct Edge{int nxt,to,cap,flow;}edge[(N*N)<<3];
int h,w,num_edge=1,head[N<<1],s,t,ans,cur[N<<1],d[N<<1];
bool vis[N<<1];
char ss[N];
int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
void add_edge(int from,int to,int cap){
	edge[++num_edge].nxt=head[from];edge[num_edge].cap=cap;edge[num_edge].to=to;head[from]=num_edge;
	edge[++num_edge].nxt=head[to];edge[num_edge].cap=0;edge[num_edge].to=from;edge[num_edge].flow=0;head[to]=num_edge;
}
bool bfs(){
	memset(vis,0,sizeof(vis));
	queue<int> Q;
	vis[s]=1;Q.push(s);
	while(!Q.empty()){
		int u=Q.front();Q.pop();
		for(int i=head[u];i;i=edge[i].nxt){
			int v=edge[i].to;
			if(!vis[v]&&edge[i].flow<edge[i].cap){
				d[v]=d[u]+1;vis[v]=1;
				Q.push(v);
			}
		}
	}
	return vis[t];
}
int dfs(int u,int a){
	if(a==0||u==t) return a;
	int flow=0,f;
	for(int &i=cur[u];i;i=edge[i].nxt){
		int v=edge[i].to;
		if(d[v]==d[u]+1&&(f=dfs(v,min(a,edge[i].cap-edge[i].flow)))>0){
			edge[i].flow+=f;
			edge[i^1].flow-=f;
			flow+=f;
			a-=f;
			if(!a) break; 
		}
	}
	return flow;
}
int dinic(){
	int flow=0;
	while(bfs()){
		for(int i=0;i<=t;++i) cur[i]=head[i];
		flow+=dfs(s,INF);
	}
	return flow;
}
int main(){
//	freopen("ex.in","r",stdin);
	h=read();w=read();
	s=0;t=h+w+1;
	rep(i,h){
		scanf("%s",ss+1);
		rep(j,w){
			if(ss[j]=='o') add_edge(i,j+h,1),add_edge(j+h,i,1);
			if(ss[j]=='S') add_edge(s,i,INF),add_edge(s,j+h,INF);
			if(ss[j]=='T') add_edge(i,t,INF),add_edge(j+h,t,INF);
		}
	}
	ans=dinic();
	printf("%d",ans>h+w?-1:ans);
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;

int main() {
  int H,W;
  cin >> H >> W;
  vector<string> g(H);
  for (auto&& g_ : g)
    cin >> g_;
  
  int t[2000][2000];
  for (int r = 0; r < H; ++r)
    for (int c = 0; c < W; ++c)
      t[r][c] = 0;       
  
  int nmax = 0;
  
  for (int r = 0; r < H; ++r)
    for (int c = 0; c < W; ++c){
      if (g[r][c] == '#') continue;
        
      int x;
      for (x = 0; x + c < W; ++x)
        if (g[r][c+x] == '#') break;
      for (int i = 0; i < x; ++i){
        t[r][c+i] += x;
        nmax = max(nmax, t[r][c+i]);
      }
      c+=x;
    }
  for (int c = 0; c < W; ++c)
    for (int r = 0; r < H; ++r){
      if (g[r][c] == '#') continue;
        
      int x;
      for (x = 0; x + r < H; ++x)
        if (g[r+x][c] == '#') break;
      for (int i = 0; i < x; ++i){
        t[r+i][c] += x;
        nmax = max(nmax, t[r+i][c]);
      }
      r+=x;
    }
  cout << nmax-1 << endl;
  return 0;
}

Measured memory_bytes: 19968
program ans1
      implicit none
      integer :: X,Y
      integer :: XR,YR
      read(*,*) X,Y
      XR = 0
      YR = 0
      if(X == 1) XR = 300000
      if(X == 2) XR = 200000
      if(X == 3) XR = 100000
      if(Y == 1) YR = 300000
      if(Y == 2) YR = 200000
      if(Y == 3) YR = 100000
      if(X == 1 .and. Y == 1) XR = XR + 400000
      write(*,*) XR + YR
      end program ans1

Measured memory_bytes: 256
#include <cstdio>

int main(){
    int N,M;
    scanf("%d",&N);
    scanf("%d",&M);
    if(M==1||M==2*N-1){
        puts("No");
    }else{
        puts("Yes");
        int cnt = 2;
        for(int i=1;i<=2*N-1;i++){
            if(i==N-1){
                puts("1");
            }else if(i==N){
                printf("%d\n",M);
            }else if(i==N+1){
                printf("%d\n",2*N-1);
            }else{
                if(cnt==M)cnt++;
                printf("%d\n",cnt++);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
	char s[20];
	int i, ls, f=0;
	cin >> s;
	ls=strlen(s);
	if(s[0]!='A')
	{
		cout << "WA\n";
		return 0;
	}
	int nc=0;
	for(i=1; i<ls; i++)
	{
		if(s[i]!='C' && s[i]>='A' && s[i]<='Z')
		{
			cout << "WA\n";
			return 0;
		}
		if(s[i]=='C')
		nc++;
	}
	if(nc!=1)
	{
		cout << "WA\n";
		return 0;
	}
	f=0;
	for(i=2; i<ls-1; i++)
	{
		if(s[i]=='C')
		f=1;
	}
	if(f!=1)
	{
		cout << "WA\n";
		return 0;
	}
	cout << "AC\n";
	return 0;
}
	

Measured memory_bytes: 256
import math

n, d = map(int,input().split())

x = []
for _ in range(n):
        x.append(list(map(int,input().split())))

count = 0
for i in range(n-1):
        for j in range(i+1, n):
            sum = 0
            for k in range(d):
                sum += (x[i][k]-x[j][k])**2

            y = int(math.sqrt(sum))
            if y**2 == sum:
                count +=1

print(count)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define prique priority_queue
int n,m,ans=0;
int k[20],s[20][20],p[20];
signed main(){
	cin>>n>>m;
	rep(i,m){
		cin>>k[i];
		rep(j,k[i]){
			cin>>s[i][j];
			s[i][j]--;
		}
	}
	rep(i,m)cin>>p[i];
	rep(i,(1<<n)){
		bool b=true;
		rep(j,m){
			int c=0;
			rep(cnt,k[j]){
				if(i&(1<<s[j][cnt]))c++;
			}
			if(c%2!=p[j])b=false;
		}
		if(b)ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#coding: utf-8
A = list(map(int, input().split()))
B =	list(map(int, input().split()))
num = A[0]
jud = A[1]
all = sum(B)
n = 0
C = 0
AN = 0

while n < num :
	AN = B[n]
	n += 1
    
	if AN < all / (jud*4):
		continue
	
	else:
		C += 1
    
if C >= jud:
	print("Yes")
else:
	print("No")
  


Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <queue>
#include <vector>
#include <list>

using namespace std;

static const int MAX = 10000;

vector<int> G[MAX];
list<int> out;
bool V[MAX];
int N;
int indeg[MAX];

void bfs(int s) {
	queue<int> q;
	q.push(s);
	V[s] = true;
	while (!q.empty()) {
		int u = q.front(); q.pop();
		out.push_back(u);
		for (unsigned int i = 0; i < G[u].size(); i++) {
			int v = G[u][i];
			indeg[v]--;
			if (indeg[v] == 0 && !V[v]) {
				V[v] = true;
				q.push(v);
			}
		}
	}
}

void tsort() {
	for (int i = 0; i < N; i++) {
		indeg[i] = 0;
	}

	for (int u = 0; u < N; u++) {
		for (unsigned int i = 0; i < G[u].size(); i++) {
			int v = G[u][i];
			indeg[v]++;
		}
	}

	for (int u = 0; u < N; u++)
		if (indeg[u] == 0 && !V[u]) bfs(u);

	for (list<int>::iterator it = out.begin(); it != out.end(); it++) {
		cout << *it << endl;
	}
}

int main() {
	int s, t, M;
	cin >> N >> M;

	for (int i = 0; i < N; i++) V[i] = false;

	for (int i = 0; i < M; i++) {
		cin >> s >> t;
		G[s].push_back(t);
	}

	tsort();

	return 0;
}

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

int main(){
  int n,x;
  cin>>n>>x;
  int l[n];
  int ans=0;
  int coord=0;
  while(coord<=x && ans<=n){
    cin>>l[ans];
    coord+=l[ans];
    ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;

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

        String s = sc.next();

        if (s.equals("Sunny")) {
            System.out.println("Cloudy");
        } else if (s.equals("Cloudy")) {
            System.out.println("Rainy");
        } else if (s.equals("Rainy")) {
            System.out.println("Sunny");
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
signed main(){
	int n;cin>>n;
	vi a(n);
	rep(i,n)cin>>a[i];
	vi sum(n+1,0);
	rep(i,n)sum[i+1]=sum[i]+a[i];


	int ans=0;
	rep(i,n-1){
		ans+=((sum[n]-sum[i+1])%MOD*a[i])%MOD;
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 6344
# ABC127D - Integer Cards
n, m = list(map(int, input().rstrip().split()))
num = sorted(list(map(int, input().rstrip().split())))
lst = sorted([tuple(map(int, input().rstrip().split())) for _ in range(m)], key=lambda x:x[1], reverse=True)
ans = 0
idx = 0
flg = False
for i, j in lst:
    for _ in range(i):
        if idx < n and num[idx] < j:
            ans += j
            idx += 1
        else:
            flg = True
            break
    if flg:
        break
if idx < n:
    ans += sum(num[idx:])
print(ans)

Measured memory_bytes: 23244
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed parsing")
}

use std::cmp::{min};
use std::num;

fn main() {
    
    let l = read::<u64>();
    let r = read::<u64>();
    
    const MOD : u64 = 2019;
    
    let mut ans = MOD;
    
    if (l % 673) >= (r % 673) { ans = 0; } // example : 5 674(1)
    else if (r - l >= 673) { ans = 0; }
    else {
        let s = (l % MOD) as usize;
        let g = (r % MOD) as usize;
        
        for i in s..g {
            for j in i+1..g+1 {
                ans = min(ans, (i * j) as u64 % MOD);
            }
        }
    }
    
    println!("{}",ans);
}

Measured memory_bytes: 4352
n,m = map(int,input().split())
big_image_ls = [0] * n
small_image_ls = [0] * m
for i in range(n):
    a = input()
    big_image_ls[i] = a
for i in range(m):
    b = input()
    small_image_ls[i] = b

diff = n-m+1
include = False
for up_y in range(diff):
    for left_x in range(diff):
        same = True
        for y in range(up_y, up_y+m):
            for x in range(left_x,left_x+m):
                if small_image_ls[y-up_y][x-left_x] != big_image_ls[y][x]:
                    same = False
        if same:
            include = True
if include:
    print('Yes')
else:
    print('No')
            





Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
using namespace std;
//dar hale hazer daram ba donafar mosabege midam yeki yashare yeki RM e ;))
#define pb push_back
#define mp make_pair
#define F first
#define S second
int main()//by Tutorial
{
	int n;cin>>n;
	vector<int> V;
	for(int i=0;i<n*2;i++)
	{
		int f;cin>>f;V.pb(f);
	}
	sort(V.begin(),V.end());
	int javab=0;
	for(int i=0;i<V.size();i+=2)
	{
		javab += min(V[i],V[i+1]);
	}
	cout<<javab;
	return 0;
}


Measured memory_bytes: 256