akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(int(1e6))

n,m=map(int,input().split())
memo=[-1]*(n+1)
memo[0]=1
memo[1]=1
for i in range(m):
    memo[int(input())]=-2
def dp(i): #i段目(0~n)まで行く方法
    if memo[i]==-2:
        return 0
    elif memo[i]==-1:
        s=dp(i-1)
        if i>=2:
            s+=dp(i-2)
        memo[i]=s%(10**9+7)
        return memo[i]
    else:
        return memo[i]
print(dp(n))

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


int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string s[100],str;
	ll n,a[100],i,sum=0;
	cin>>n;
	for(i=0;i<n;i++) {
		cin>>s[i]>>a[i];
		sum+=a[i];
	}
	cin>>str;
	for(i=0;i<n;i++) {
		sum-=a[i];
		if(s[i]==str) break;
	}
	cout<<sum;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,count=0;
  cin>>n>>k;
  vector<int>h(n);
  for(int i=0;i<n;i++){
    cin>>h.at(i);
  }
  for(int i=0;i<n;i++){
    if(h.at(i)>=k){
      count++;
    }
  }
  cout<<count<<endl;
  

  
}

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

int main() {
  int a,b,c;
  cin>>a>>b;
  cout<<b-a+1;
  c=b-a+1;
  for(int i=1;i<2*a-1;i++){
    c++;
    cout<<' '<<c;
  }
  cout<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
	int m, f, r, sum;
	while (scanf("%d %d %d", &m, &f, &r) == 3) {
		sum = m + f;
		if (m == -1 && f == -1 && r == -1) break;
		else if (m == -1 || f == -1) printf("F\n");
		else if (sum >= 80) printf("A\n");
		else if (65 <= sum && sum < 80) printf("B\n");
		else if (50 <= sum && sum < 65) printf("C\n");
		else if (30 <= sum && sum < 50) {
			if (r >= 50) printf("C\n");
			else printf("D\n");
		}
		else printf("F\n");
	}
	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple


int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
// 	int t;
// 	cin>>t;
  string s;
  cin>>s;
  int ok=0;
  for(int i=0;i<2;i++)
 {
     if(s[i]=='A'&&s[i+1]=='B')
    { ok=1;break;}
     if(s[i]=='B'&&s[i+1]=='A')
    { ok=1;break;}
 }
 if(ok)
 cout<<"Yes"<<endl;
 else 
 cout<<"No"<<endl;
    
  
 
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=200010;
int x[N],y[N];
int b[N],lst[N],len=0;
inline int lcmp(int a,int b){
	return x[a]<x[b];
}
inline int binfind(int cury){
	int l=0,r=len;
	while(l<r){
		int m=((l+r)>>1)+1;
		if(y[b[m]]>cury){
			r=m-1;
		}else{
			l=m;
		}
	}
	return l;
}
int main(){
	int x1=ni,y1=ni,x2=ni,y2=ni;
	bool flag1=x1>x2,flag2=y1>y2;
	int n=ni;
	if(flag1){
		x1=-x1,x2=-x2;
	}
	if(flag2){
		y1=-y1,y2=-y2;
	}
	for(int i=1;i<=n;i++){
		x[i]=ni,y[i]=ni;
		if(flag1){
			x[i]=-x[i];
		}
		if(flag2){
			y[i]=-y[i];
		}
		if(!(x1<=x[i]&&x[i]<=x2&&y1<=y[i]&&y[i]<=y2)){
			n--,i--;
		}
		lst[i]=i;
	}
	sort(lst+1,lst+n+1,lcmp);
	for(int i=1;i<=n;i++){
		int j=lst[i],k=binfind(y[j]);
		if(k==len||y[j]<y[b[k+1]]){
			b[k+1]=j;
			if(k==len){
				len++;
			}
		}
	}
	printf("%.20lf\n",100ll*(x2-x1+y2-y1)-20*len+M_PI*5*(len+(len==min(x2-x1,y2-y1)+1)));
	return 0;
}

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

int dp(vector<pair<int, int>> &dim, vector<vector<int>> &memo, int r, int l) {
  // dp[r][l] := [r,l)の区間の行列を掛けるときのスカラー乗算の最小値
  if (memo[r][l] != -1) {
    return memo[r][l];
  }
  if (l - r == 1) {
    return memo[r][l] = 0;
  }
  int res = INT32_MAX;
  for (int i = 1; i < l - r; i++) {
    res = min(res, dp(dim, memo, r, r + i) + dp(dim, memo, r + i, l) +
                       dim[r].first * dim[r + i].first * dim[l - 1].second);
  }
  return memo[r][l] = res;
}

int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> dim(n);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    dim[i] = make_pair(a, b);
  }
  vector<vector<int>> memo(n + 1, vector<int>(n + 1, -1));
  cout << dp(dim, memo, 0, n) << endl;
}



Measured memory_bytes: 3204
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

// l:距離, v:速さ, かかる時間を返す.
double f(double l, double v){
	return l / v;
}

typedef pair<double,int> P;
const int CARROT = 1;
const int SLOW = 2;
const int GOAL = 3;

int main(){
	int N, K, T, U, V, L;
	//cin >> N >> K >> T >> U >> V >> L;
	scanf("%d %d %d %d %d %d", &N, &K, &T, &U, &V, &L);
	
	vector<int> D(N);
	priority_queue<P, vector<P>, greater<P> > q;
	q.push( P(L,GOAL) );
	for(int i=0 ; i < N ; i++ ){
		//cin >> D[i];
		scanf("%d", &D[i]);
		q.push( P(D[i],CARROT) );
	}
	
	double x=0.0, v = U, t=0.0, k=0, carrot=0;
	while( !q.empty() ){
		if( q.top().second == CARROT ){ // 次の位置がニンジンのとき
			/*cout << "x:" << x << " -> " << q.top().first ;
			cout << " t:" << t << " -> " << t+f(q.top().first - x,v);
			cout << " speed:" << (v==U? "normal" : "quick") << endl;
			 */
			double l = q.top().first - x; // 移動する距離
			x = q.top().first; // 次の位置
			t += f(l,v); // 時間経過
			q.pop();
			
			
			if( v == U ){ // 通常の速さのとき(ニンジンを食べる)
				v = V; // 速度変化
				//cout << "speed up!" << endl;
				q.push( P(x + V*T, SLOW) ); // ニンジンの効果が切れる位置
			}else{ // 速いとき
				if( k < K ){ // ニンジンを持てるとき(持つ)
					//cout << "carrot get!" << endl;
					k++;
				}else{ // ニンジンを持てないとき(食べる)
					//cout << "eat carrot!" << endl;
					carrot++;
					q.push( P(x + V*T, SLOW) ); // ニンジンの効果が切れる位置
				}
			}
		}else if( q.top().second == SLOW ){ // ニンジンの効果が切れるとき
			/*cout << "x:" << x << " -> " << q.top().first ;
			cout << " t:" << t << " -> " << t+f(q.top().first - x,v);
			cout << " speed:" << (v==U? "normal" : "quick") << endl;
			*/
			double l = q.top().first - x; // 移動する距離
			x = q.top().first; // 次の位置
			t += f(l,v); // 時間経過
			q.pop();
			
			if( carrot > 0 ){ // ニンジンを効果が切れる前に食べたときは遅くならない
				//cout << "not speed down!" << endl;
				carrot--;
			}else if( k > 0 ){ // ニンジンを持っているときは即座に食べる
				k--;
				//cout << "speed up!" << endl;
				q.push( P(x + V*T, SLOW) ); // ニンジンの効果が切れる位置
			}else{ // 通常の速さに戻る
				//cout << "speed down!" << endl;
				v = U;
			}
		}else if( q.top().second == GOAL ){ // ゴールのとき
			/*cout << "x:" << x << " -> " << q.top().first ;
			cout << " t:" << t << " -> " << t+f(q.top().first - x,v);
			cout << " speed:" << (v==U? "normal" : "quick") << endl;
			cout << "goal!" << endl;
			*/
			double l = q.top().first - x; // 移動する距離
			x = q.top().first; // 次の位置
			t += f(l,v); // 時間経過
			q.pop();
			break;
		}
	}
	//cout << t << endl;
	printf("%.9f\n", t);
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
using lint = long long;

signed main(){
  lint N, M, X; cin >> N >> M >> X;
  vector<lint> c(N);
  vector<vector<lint> > data(N, vector<lint> (M));
  for(int i = 0; i < N; i++){
    cin >> c[i];
    for(int j = 0; j < M; j++) cin >> data[i][j];
  }
  lint ans = 1e9;
  for(lint bit = 1; bit < (1 << N); bit++){
    vector<lint> num(M, 0);
    lint ans1 = 0;
    for(int i = 0; i < N; i++){
      if(bit & (1 << i)){
        ans1 += c[i];
        for(int j = 0; j < M; j++) num[j] += data[i][j];
      }
    }
    bool ok = true;
    for(int i = 0; i < M; i++) if(num[i] < X) ok = false;
    if(ok) ans = min(ans, ans1);
  }
  if(ans == 1e9) cout << -1 << endl;
  else cout << ans << endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#define FOR(x, z, y) for(int x = (z); y; x++)
#define rep(x, y) for(int x = 0; x < (y); x++)
#define all(x) x.begin(), x.end()
#define len(x) (sizeof(x) / sizeof(x[0]))
#define split_str(str, sp_word) istringstream stream(str); string res; FOR(cnt, 0, getline(stream,res,sp_word))
#define rem_space(x) x.erase(remove(all(x), ' '),x.end())
#define scanln(x) fgets(x, sizeof x, stdin)
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define i_str(x) atoi(x.c_str())
typedef long long ll;
using namespace std;

int main() {
  string S;
  getline(cin,S);

  rep(i,S.length()){
    rep(j,S.length()){
      if(i != j & S[i] == S[j]) {
        puts("no"); 
        return 0;
      }
    }
  }

  puts("yes");
  return 0;
}

Measured memory_bytes: 256
/** 
If comrades that you trust gather around you, hope can take physical form and become visible. That’s what I believe.
*/
#include <bits/stdc++.h>
using namespace std;
/**
(▀̿Ĺ̯▀̿ ̿) (ง ͠° ͟ل͜ ͡°)ง
*/
const int N  =2e5 + 7;
// string a[N];
auto main() -> int {
	ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    unordered_set<string> s;
    for (int i = 1; i <= n; ++i) {
        string t; cin >> t;
        s.insert(t);
    }
    cout << s.size() << "\n";
	return 0;
}


Measured memory_bytes: 17704
#include "bits/stdc++.h"
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define rep(i, n) for(int i=0;i<(n);++i)
#define rrep(i, n) for(int i=n-1;i>=0;--i)
#define debug(x) cout << #x << " : " << x << " ------------ " << endl;
using namespace std;
using Info = tuple<int, int>;
int main()
{
    int n;
    while (cin >> n, n) {
        map<int, vector<int>> pList;
        rep (i, n) {
            int m;
            cin >> m;
            rep (j, m) {
                int p;
                cin >> p;
                if (!pList.count(p)) {
                    pList[p] = vector<int>{i+1};
                } else {
                    pList[p].pb(i+1);
                }
            }
        }
        int k;
        cin >> k;
        vector<int> lList = vector<int>();
        rep (i, k) {
            int l;
            cin >> l;
            lList.pb(l);
        }
        map<int, int> counter;
        for (auto l : lList) {
            if (!pList.count(l)) {
                break;
            }
            for (auto p : pList[l]) {
                if (!counter.count(p)) {
                    counter[p] = 1;
                } else {
                    counter[p] += 1;
                }
            }
        }
        vector<int> result = vector<int>();
        for (auto c : counter) {
            if (c.second == lList.size())
                result.pb(c.first);
        }
        if (result.size() != 1)
            cout << -1 << endl;
        else
            cout << result[0] << endl;
    }
    
    return EXIT_SUCCESS;
}

Measured memory_bytes: 3220
#include<iostream>
using namespace std;
int main() {
	long long N;
	cin >> N;
	long long A[N];
	for (long long i = 0; i < N; i++) {
		cin >> A[i];
	}
	long long cnt[N + 1] = {};
	bool flg = true;
	for (long long i = 0; i < N; i++) {
		int j = A[i];
		cnt[j]++;

	}
	for (long long i = 0; i < N; i++) {
		if (cnt[0] >= 2) {
			flg = false;
		}
		if (i != 0) {
			if (cnt[i] % 2 != 0) {
				flg = false;
			}
		}
		if (cnt[i] >= 3) {
			flg = false;
		}
		if (!flg) {
			cout << "0" << endl;
			return 0;
		}
	}
	
	int ans = 1;
	if (N % 2 == 0) {
		if (cnt[0] != 0) {
			cout << 0 << endl;
			return 0;
		}
		for (long long i = 0; i < N / 2; i++) {
			ans = ans*2;
			ans %= 1000000007;
		}
	}
	
	else {
		for (long long i = 0; i < (N-1) / 2; i++) {
			ans = ans*2;
			ans %= 1000000007;
		}
	}
	
	cout <<ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000000ll
using namespace std;
signed main(){
  ll n,f=0;
  string s[1000000];
  cin>>n;
  map<string,ll> mp;
  for(ll i=0;i<n;i++){
	cin>>s[i];
    mp[s[i]]++;
    if(mp[s[i]]>=2){
      f++;
    }
  }
  for(ll i=0;i<n-1;i++){
    if(s[i][s[i].size()-1]!=s[i+1][0]){
      f++;
    }
  }
  if(f>0){
    cout<<"No\n";
  }else{
    cout<<"Yes\n";
  }
  return 0;
}
        

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;

  int k = n;

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

    if (s[i] == s[i+1]){
      k--;
    }
  }
  cout << k << endl;

  return 0;
}


Measured memory_bytes: 512
import java.util.*;

 class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];
        int[] y = new int[N];
        int cost = 0;
        int max = 0;
        for(int i = 0; i<N; i++) {
        	x[i] = sc.nextInt();
        	y[i] = sc.nextInt();
        }
        for (int i = 0; i<N; i++) {
        	for (int j = 0; j<N; j++ ) {
        		if(i==j) {continue;}
        		// p,qを設定
        		int p = x[i] - x[j];
        		int q = y[i] - y[j];
        		cost=0;
//        		System.out.println("p=" + p + ",q=" + q );
        		for (int k = 0; k<N; k++) {
        			for(int l = 0; l<N; l++) {
        				if (p==x[k] - x[l] && q==y[k] - y[l]) {
        					cost++;
        				}
        			}
        		}
        		if(max<cost) {
        			max=cost;
        		}
        	}
        }
        int ans=1;
        if(N>1) {          	
         ans = N-max;	
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23252
import Data.List

step (a,b) (i,e)
  | odd i = (a+e,b)
  | otherwise = (a,b+e)

main = do
  n <- readLn :: IO Int
  xs <- zip [1..n] . sortBy (flip compare) . map read . words <$> getLine :: IO [(Int, Int)]
  let (a,b) = foldl' step (0,0) xs
  print $ abs $ a - b
  

Measured memory_bytes: 1020
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(int, char**)
{
	int n;
	cin >> n;
	vector<vector<long>> h(n, vector<long>(3));
	for (int i = 0; i < n; ++i)
	{
		cin >> h[i][0] >> h[i][1] >> h[i][2];
	}
	vector<vector<long>> v(n + 1, vector<long>(3));
	v[0] = { 0 };
	for (int i = 1; i <= n; ++i)
	{
		v[i][0] = max({v[i - 1][1] + h[i - 1][0], v[i - 1][2] + h[i - 1][0]});
		v[i][1] = max({v[i - 1][2] + h[i - 1][1], v[i - 1][0] + h[i - 1][1]});
		v[i][2] = max({v[i - 1][0] + h[i - 1][2], v[i - 1][1] + h[i - 1][2]});
	}
	cout << max({v[n][0], v[n][1], v[n][2]}) << endl;
	return 0;
}


Measured memory_bytes: 11136
def examA():
    H,A = LI()
    ans = (H-1)//A+1
    print(ans)
    return

def examB():
    H, N = LI()
    A = LI()
    if H>sum(A):
        print("No")
    else:
        print("Yes")
    return

def examC():
    N, K = LI()
    H = LI()
    H.sort()
    ans = sum(H[:max(0,N-K)])
    print(ans)
    return

def examD():
    H = I()
    ans = 2**(H.bit_length())-1
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examD()

"""

"""

Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N; cin >> N;
    vector<pair<int, int>> A(N);
    for(int i = 0; i < N; i++){
      int t; cin >> t;
      A[i] = {t, i};
    }
    sort(A.begin(), A.end());
    for(int i = 0; i < N; i++){
      cout << A[i].second +1 << " ";
    }
    cout << endl;
}


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

int main(){
	int data, i;
	i = 0;
	while (cin >> data){
		if (data != 0){
			i++;
			cout << "Case " << i << ": " << data << endl;
		}
		else {
			break;
		}
	}
	return 0;
}

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

#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define vi vector<int>
#define vl vector<long long>
#define sz size()
#define x first
#define y second
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;
int mod = (int)1e9 + 7;
ll n, m, f[100100];
ll ans1, ans2 = 0;

int c(int n, int k) {
	if(k > n) return 0;
	return f[n] / (f[k] * f[n - k] % mod);
}

int main() {
	cin >> n >> m;

	f[1] = 1;
	for(int i = 2; i <= 100000; i++) {
		f[i] = f[i-1] * i;
		f[i] %= mod;	
	}
	
	if(abs(n - m) >= 2) {
		cout << 0;
		return 0;
	}
	
	
	if(n == m) {
		ans1 = f[n];
		ans2 = f[n];
		ans1 *= ans2;
		ans1 %= mod;
		ans1 *= 2;
		ans1 %= mod;
		cout << ans1 << endl;
	} else {
		if(n < m) {
			ans1 = f[n];
			ans2 = f[m];
			ans1 *= ans2;
			ans1 %= mod;
			cout << ans1 << endl;
		} else {
		     ans1 = f[m];
			ans2 = f[n];
			ans1 *= ans2;
			ans1 %= mod;
			cout << ans1 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <functional>

inline void
rep(int n, std::function<void(int)> f) {
    for (int i = 0; i < n; i++) {
        f(i);
    }
};

typedef std::pair<int, int> P;

int main() {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	
	std::string s;
	std::cin >> s;
	std::cin.ignore();
	
	int cnta = 0;
	int cntb = 0;
	for (int i = 0; i < static_cast<int>(s.length()); i++) {
		if (i % 2 == 1) {
			if (s[i] != '1') {
				cnta++;
			}
			else {
				cntb++;
			}
		}
		else {
			if (s[i] != '0') {
				cnta++;
			}
			else {
				cntb++;
			}
		}
	}

	if (cnta > cntb) {
		std::cout << cntb << '\n'; 
	}
	else {
		std::cout << cnta << '\n'; 
	}
	
	return 0;
}



Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <algorithm>

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
inline int gcd(int a,int b){return b?gcd(b,a%b):a;}
inline int lcm(int a,int b){return a*b/gcd(a,b);}
typedef long long ll;
typedef std::vector<int> VI;
typedef std::pair<int, int> PII;

using namespace std;

int main()
{
  int A, B;
  cin >> A >> B;
  cout << max(A+B, max(A-B, A*B)) << endl;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def main():
    down_positions = []
    ponds = []
    for index, value in enumerate(raw_input()):
        if value == '\\':
            down_positions.append(index)
        elif value == '/' and down_positions:
            right = index
            left = down_positions.pop()
            area = right - left
            candidate_area = 0
            while ponds and left < ponds[-1][0]:
               candidate_area += ponds.pop(-1)[1]

            # new_pond = (left, area + candidate_area)
            ponds.append((left, area + candidate_area))
            # ponds.append(new_pond)
    
    print sum(x[1] for x in ponds)
    print len(ponds), 
    for pond in ponds:
        print pond[1], 

if __name__ == '__main__':
    main()

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

#define rep(i, beg, end) for (int i = (beg); i < (end); i++)
#define rrep(i, beg, end) for (int i = (beg); i >= (end); i--)
typedef long long ll;
typedef pair<ll, ll> P;
typedef unsigned long long ull;
const int INF = 2e9;
const int mod = 1e9 + 7;
const int N = 1010;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main(void)
{
    int x, a; cin >> x >> a;
    cout << ((x < a) ? "0" : "10") << endl;
    return 0;
}

Measured memory_bytes: 3652
n,m=map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
r=any([r[j:j+m] for r in a[i:i+m]]==b for i in range(n-m+1) for j in range(n-m+1))
print('Yes' if r else 'No')

Measured memory_bytes: 39152
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int A, B; cin >> A >> B;
    int res = 0;
    rep(i, A, B + 1){
        stringstream ss;
        ss << i;
        string S = ss.str();
        string T = S;
        reverse(_all(T));

        if(S == T) res++;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
def fac_count( x, counter):
    i=2;
    while x > 1:
        if x%i == 0:
            counter[i] = counter.get(i,0) + 1
            x //= i
        else:
            i += 1
    return counter

n=int(input())
counter = {}
for i in range(2,n+1):
    counter = fac_count(i,counter)

fac = [0] * 5 #2,4,14,24,74回以上

for i in counter.values():
    if i>=2:  fac[0] += 1
    if i>=4:  fac[1] += 1
    if i>=14: fac[2] += 1
    if i>=24: fac[3] += 1
    if i>=74: fac[4] += 1

 #3*5*5 / 3*25 / 5*15 / 75
ans =   fac[1] * (fac[1]-1)//2 * (fac[0]-2) + fac[3] * (fac[0] - 1) + fac[2] * (fac[1] - 1) + fac[4]
print(ans)

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

int main(){
    int a[4][4];
    bool b[4][4];
    memset(b,false,sizeof(b));
    
    for(int i=1;i<=3;i++)
        for(int j=1;j<=3;j++)
            cin>>a[i][j];
            
    int n,x;
    cin>>n;
    
    for(int i=1;i<=n;i++){
        cin>>x;
        for(int j=1;j<=3;j++)
            for(int k=1;k<=3;k++)
                if(a[j][k]==x){
                    b[j][k]=true;
                }
    }
    
    if(b[1][1] && b[1][2] && b[1][3]){
        cout<<"Yes"<<endl;
        return 0;
    }
    
    if(b[2][1] && b[2][2] && b[2][3]){
        cout<<"Yes"<<endl;
        return 0;
    }
    
    if(b[3][1] && b[3][2] && b[3][3]){
        cout<<"Yes"<<endl;
        return 0;
    }
    
    if(b[1][1] && b[2][1] && b[3][1]){
        cout<<"Yes\n";
        return 0;
    }
    
    if(b[1][2] && b[2][2] && b[3][2]){
        cout<<"Yes\n";
        return 0;
    }
    
    if(b[1][3] && b[2][3] && b[3][3]){
        cout<<"Yes\n";
        return 0;
    }
    
    if(b[1][1] && b[2][2] && b[3][3]){
        cout<<"Yes\n";
        return 0;
    }
    
    if(b[1][3] && b[2][2] && b[3][1]){
        cout<<"Yes\n";
        return 0;
    }
    
    cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define rv(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
const int M = 120000;
const int inf=1e9+7;
typedef long long ll;
int n,m,k;
int a[M];
int b[M];
int main(){
    int A,B;
    cin>>A>>B>>m;
    int ma=inf;
    int mb=inf;
    fo(i,1,A) {
        cin>>a[i];
        ma=min(ma,a[i]);
    }
    fo(i,1,B) {
        cin>>b[i];
        mb=min(mb,b[i]);
    }
    int x,y,c;
    int ans=ma+mb;
    fo(i,1,m){
        cin>>x>>y>>c;
        ans=min(ans,a[x]+b[y]-c);
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define _P(...) (void)fprintf(stderr, __VA_ARGS__)

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;


int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int k;
	cin >>k;
	
	vector<vector<pii>> r(k);
		if(k==1){puts("0"); return 0;}
	rep(i, k){
		r[i].emplace_back((i+1)%k, 1);
		r[i].emplace_back((i*10)%k, 0);
	}
	
	VI dd(k, mod);
	
	dd[1] = 1;
	priority_queue< pii, vector<pii>, greater<pii> > que;
	que.push(pii(1, 1));
	while(!que.empty()){
		int cost, v; tie(cost, v) = que.top();
		que.pop();
		if(dd[v] < cost) continue;
		for(const auto& rp : r[v]){ 
			int rct, rto; tie(rto, rct) = rp;
			if(dd[rto] > dd[v] + rct){
				dd[rto] = dd[v] + rct;
				que.push(pii(dd[rto], rto));
			}
		}
	}
	cout << dd[0] <<endl;
	return  0;
}

Measured memory_bytes: 6780
#include <stdio.h>
#include <stdlib.h>
 
int main(void){
    int i;
    long int j;
    j = 0;
    scanf("%d", &i);
    for(int x=0 ;x<(i/15);x++){
    j += x*8*15 + 60;    
    }
    
    switch(i%15){
    case 0:
    j += 0;
    break;
    case 1:
    j += 1 + (i/15)*15;
    break;
    case 2:
    j += 3 + (i/15)*15*2;
    break;
    case 3:
    j += 3 + (i/15)*15*2;
    break;
    case 4:
    j += 7 + (i/15)*15*3;
    break;
    case 5:
    j += 7 + (i/15)*15*3;
    break;
    case 6:
    j += 7 + (i/15)*15*3;
    break;
    case 7:
    j += 14 + (i/15)*15*4;
    break;
    case 8:
    j += 22 + (i/15)*15*5;
    break;
    case 9:
    j += 22 + (i/15)*15*5;
    break;
    case 10:
    j += 22 + (i/15)*15*5;
    break;
    case 11:
    j += 33 + (i/15)*15*6;
    break;
    case 12:
    j += 33 + (i/15)*15*6;
    break;
    case 13:
    j += 46 + (i/15)*15*7;
    break;
    case 14:
    j += 60 + (i/15)*15*8;
    break;
    }
    
  printf("%ld",j);
  return 0;
}

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  priority_queue<int> a;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    a.push(tmp);
  }
  // cout << "prev sort" << endl;
  // sort(a.begin(), a.end());
  // cout << "after sort" << endl;
  // for (int i = 0; i < m; i++) {
  //   a[n - 1] /= 2;
  //   if (n > 1 && a[n - 1] < a[n - 2]) {
  //     int tmp = a[n - 1];
  //     a.pop_back();
  //     auto p = lower_bound(a.begin(), a.end(), tmp);
  //     a.insert(p, tmp);
  //   }
  // }
  for (int i = 0; i < m; i++) {
    int tmp = a.top();
    a.pop();
    a.push(tmp / 2);
  }
  ll sum = 0;
  for (int i = 0; i < n; i++) {
    // sum += a[i];
    sum += a.top();
    a.pop();
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 892
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 2010

int sum[SIZE];

int main(){
  int n, m;
  int a[SIZE], b[SIZE];

  scanf("%d%d", &n, &m);

  for(int i=0; i<n; i++) scanf("%d", a+i);
  for(int i=0; i<m; i++) scanf("%d", b+i);

  ll ans = 0;

  for(int i=0; i<n; i++){
    ll row = 0;
    for(int j=0; j<m; j++) {
      ll p = 0;
      if (a[i] == b[j]) {
        p = row + 1;
        ans = (ans + p) % mod;
      }
      row = (row + sum[j]) % mod;
      sum[j] = (sum[j] + p) % mod;
    }
  }


  cout << (ans + 1) % mod << endl;

  return 0;
}


Measured memory_bytes: 384
import bisect
n=int(input())

t1 = list(map(int,input().split()))

t2 = list(map(int,input().split()))

t3 = list(map(int,input().split()))

t1.sort()

t3.sort()

ans = 0

for i in t2:
    ans += bisect.bisect_left(t1,i)*(n-bisect.bisect_right(t3,i))
print(ans)

Measured memory_bytes: 105444
import java.util.*;

public class Main {
  public static ArrayList<Integer> list; 
  public static int[] used;
  public static int[] perm;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    used = new int[n + 1];
    list = new ArrayList<Integer>();
    perm = new int[n];
    dfs(0, n);
    Collections.sort(list);
    int p = 0;
    int q = 0;
    for(int i = 0; i < n; i++) {
      int k = sc.nextInt();
      int s = k * ((int)Math.pow(10, n - 1 - i));
      p += s;
    }
    for(int i = 0; i < n; i++) {
      int k = sc.nextInt();
      int s = k * ((int)Math.pow(10, n - 1 - i));
      q += s;      
    }
    int a = 0;
    int b = 0;
    for(int i = 0; i < list.size(); i++) {
      int d = list.get(i);
      if(p == d) a = i;
      if(q == d) b = i;
    }
    int ans = Math.abs(a - b);
    System.out.println(ans);
  }
 
  public static void dfs(int pos, int n) {
    if(pos == n) {
      int t = 0;
      for(int i = 0; i < n; i++) {
        int k = perm[i];
        int s = k * ((int)Math.pow(10, n - 1 - i));
        t += s;      
      }
      list.add(t);      
    } else {
      for(int i = 1; i <= n; i++) {
        if(used[i] == 0) {
          perm[pos] = i;
          pos++;
          used[i] = 1;
          dfs(pos, n);
          used[i] = 0;
          pos--;
        }     
      }      
    }
  }
}

Measured memory_bytes: 26232
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
signed main() {

  int Q;
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    int c, a, n;
    cin >> c >> a >> n;
    int ans = 0;
    if (n > 0 && a > 0 && c > 0) {
      ans += min(c,min(a,n));
      a -= ans;
      n -= ans;
      c -= ans;
    }
    if (c > 1 && a > 0) {
      int k = min(c/2, a);
      ans += k;
      c -= k*2;
      a -= k;
    }
    if (c > 2) {
      int k = c/3;
      ans += k;
      c -= k*3;
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3120
#include<iostream>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n!=0) {
		double a = -100;
		double r=22, r1 = 10000;
		for (int i = 0; i < n; i++) {
			double id, cm, kg;
			cin >> id >> cm >> kg;
			cm /= 100;
			double bmi;
			bmi = (kg / (cm*cm));
			double r2 = r - bmi;
			if (r2 < 0) r2 = 0 - r2;
			if (r1 > r2) {
				r1 = r2;
				a = id;
			}
			else if (r1 == r2&&a<id) {
				a = id;
			}
		}
		cout << a << endl;
	}
}

Measured memory_bytes: 3176
#include <stdio.h>


int main(void){

    int N,flag;

    scanf("%d", &N);

    flag = N%10;
    N -=flag;
    if(flag==7){
        printf("Yes");
        return 0;
    }

    flag = N%100/10;
    N -= flag;
    if(flag==7){
        printf("Yes");
        return 0;
    }
    flag = N%1000/100;
    if(flag==7){
        printf("Yes");
        return 0;
    }

    printf("No");

    return 0;

}

Measured memory_bytes: 1732
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int t = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int[] max = new int[n];
        max[n-1] = a[n-1];
        for (int i = 1; i < n; i++) {
            max[n-1-i] = Math.max(max[n-i], a[n-1-i]);
        }
        Map<Integer, Integer> map = new HashMap<>();
        int dmax = 0;
        map.put(0, 0);
        for (int i = 0; i < n-1; i++) {
            int d = max[i+1] - a[i];
            if(dmax < d) dmax = d;
            if(!map.containsKey(d)) map.put(d, 0);
            map.put(d, map.get(d) + 1);
        }
        System.out.println(map.get(dmax));
        sc.close();

    }

}


Measured memory_bytes: 64676
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n, h, w := scanInt(), scanInt(), scanInt()
	ans := 0
	for i := 0; i < n; i++ {
		a, b := scanInt(), scanInt()
		if a >= h && b >= w {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>

using namespace std;

int H, N, A;
long long f[10001], B;

int main() {
	scanf("%d%d", &H, &N);
	fill(f + 1, f + H + 1, (long long)1e11);
	while (N--) {
		scanf("%d%lld", &A, &B);
		for (int i = 1; i <= A; ++i)
			f[i] = min(f[i], B);
		for (int i = A + 1; i <= H; ++i)
			f[i] = min(f[i], f[i - A] + B);
	}
	printf("%lld\n", f[H]);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	cin >> N;
	if (N % 2) {
		cout << 0 << endl;
		return 0;
	}

	int ans = 0;

	int i = 10;

	while (i<=N) {
		ans += N / i;
		i *= 5;
	}


	cout << ans << endl;
	return 0;
}



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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;

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

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

    if(a + b == 15){
        cout << "+" << endl;
    }else if(a * b == 15){
        cout << "*" << endl;
    }else{
        cout << "x" << endl;
    }

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i;
	double l[16];
	double v[2];
	double vi;
	double total;
	double t;
	
	while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v[0], &v[1]) != EOF){
		total = 0;
		for (i = 0; i < 10; i++){
			total += l[i];
		}
		vi = v[0] + v[1];
		t = total / vi;
		t = v[0] * t;
		
		total = 0;
		for (i = 0; i < 10; i++){
			total += l[i];
			if (t <= total){
				printf("%d\n", i + 1);
				break;
			}
		}
	}
	return (0);
}

Measured memory_bytes: 1052
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;


int main(void){

int nm=9;
int sum,j;
int su[5001]={0};

	while(1){
		cin >> nm;
		if(nm == 0) break;
		int mx = -999999999;
		rep(i,nm) cin >> su[i];
		rep(i,nm){
			sum=0;
			rep2(j,i,nm){
		 		sum += su[j];
				mx = max(mx,sum);
			}
		}
		cout << mx << endl;
	}
	return 0;
}

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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end



int main(){
   int n; cin>>n;
   ll res=0; int pre=0;
   rep(i,0,n){
       int x; cin>>x;
       res+=max(0,pre-x);
       chmax(pre,x);
   }
   cout<<res<<endl;
   return 0;
}

Measured memory_bytes: 3688
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
using namespace std;

int main() {
	long long X, Y;
	long long N, K;
	cin >> N >> K;

	X = N % K;
	Y = abs(X - K);
	if (X > Y) {
		cout << Y << endl;
	}
	else {
		cout << X << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
D=int(input())
C=list(map(int, input().split()))
S=[list(map(int,input().split())) for i in range(D)]

#T=[]
#for i in range(D):
#  T.append(int(input()))

#M=int(input())
#dq=[list(map(int,input().split())) for i in range(M)]

def dissat(day):
  dissat = 0
  for i in range(26):
    if T[day-1]-1 == i:
      continue
    dissat += C[i]*(day-lastdays[i])

  return dissat    
    
def last(day):
  lastdays[T[day-1]-1] = day

# 
def calcscore(D):
  sat = 0
  for i in range(D):
    # dayi
    last(i)
    sat += S[i][T[i]-1] - dissat(i+1)
  #print(sat)
  return sat

# main
#lastdays = [0]*26
#calcscore(D)


# change contenst
#for i in range(M):
#  T[dq[i][0]-1] = dq[i][1]
#  lastdays = [0]*26
#  calcscore(D)

#
import random
T = [0]*D
for i in range(D):
  T[i] = random.randrange(1,26)

lastdays = [0]*26
oldscore = calcscore(D)

count = 0
while count < 1000:
  count += 1
  d=random.randrange(1,D)
  q=random.randrange(1,26)
  old = T[d-1] # 後で戻せるように元の値を記憶しておく
  T[d-1] = q
  lastdays = [0]*26
  newscore = calcscore(D)
  if newscore < oldscore:
    T[d-1] = old
  else:
    oldscore = newscore

for i in range(D):
  print(T[i])

Measured memory_bytes: 79208
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int first_area = a * b;
  int second_area = c * d;
  
  if (first_area == second_area){
    cout << first_area << endl;
  }
  else if (first_area  > second_area){
    cout << first_area << endl;
  }
  else {
    cout << second_area << endl;
  }
}

Measured memory_bytes: 256
public class Main{
  static double e = 0.0000000001;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    double xa, ya, xb, yb, xc, yc, xd, yd;

    for(;sc.hasNext();){
      xa = sc.nextDouble(); ya = sc.nextDouble();
      xb = sc.nextDouble(); yb = sc.nextDouble();
      xc = sc.nextDouble(); yc = sc.nextDouble();
      xd = sc.nextDouble(); yd = sc.nextDouble();

      if((xa - xb) * (xc - xd) + (ya - yb) * (yc - yd) < e &&
          (xa - xb) * (xc - xd) + (ya - yb) * (yc - yd) > -e)
        out.println("YES");
      else out.println("NO");
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 30984
<?php
    /*
        Problem URL : http://abc057.contest.atcoder.jp/tasks/abc057_c

        Score  :
        Result :
        Time   : ms
        Memory : KB
     */

    ini_set('error_reporting', E_ALL & ~E_NOTICE);

    // define('DEBUG', true);
    define('DEBUG', false);

    if (DEBUG) {
        $start = microtime(true);
    }
    echo solve();
    if (DEBUG) {
        $t = microtime(true) - $start;
        printf ("Elapsed time: %7.3f sec\n", $t);
    }


    function solve() {
        $ret = PHP_INT_MAX;

        fscanf(STDIN, "%d\n", $N);
        for ($i = 1; $i <= sqrt($N); $i++) {
            if ($N % $i == 0) {
                $x = $N / $i;
                // echo "{$x} {$i}\n";
                $num = max(strlen(strval($x)), strlen(strval($i)));
                $ret = min($num, $ret);
            }
        }
        return $ret;
    }


Measured memory_bytes: 4728
#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;
#define Khela ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define llu long long unsigned int
#define pf printf
#define sf scanf
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define pii pair<int ,int>
#define PII pair<ll, ll>

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int Set(int N,int pos){return N=N | (1<<pos);}
int reset(int N,int pos){return N= N & ~(1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}
const int Max=1e9+100;
const int sz=1e3+100;
bool cmp(PII a,PII b)
{
    if(a.s==b.s) return a.f<b.f;
    return a.s<b.s;
}
int main()
{
    Khela
    ll a,b,c,i,j,k,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,n,mx;
    char ch;
    double d;
    string str1,str2,str;
    bool bl,bl1;
    int t,cs=1;
    while(cin>>n)
    { 
        PII ara[n];
        for(i=0;i<n;i++) cin>>ara[i].f>>ara[i].s;

    sort(ara,ara+n,cmp);
    ll time=0;
    bl=true;
    for(i=0;i<n;i++)
    {
        if(time+ara[i].f<=ara[i].s){
            time+=ara[i].f;
        }
        else{
            bl=false;
            break;
        }
    }

    if(bl) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    }



}

Measured memory_bytes: 3456
import java.util.Scanner;

public class Main{
	private class Pair{
		public int n;
		public int c;
		public Pair(){
		}
		public Pair(int n){
			this.n = n;
			c = 1;
		}
		
		public void print(int v){
			c += v;
			System.out.print(n+" ");
			System.out.println(c);
			return ;
		}
	}
	
	public Main(){
		Scanner sc = new Scanner(System.in);
		Pair p1[] = new Pair[1000];
		Pair p2[] = new Pair[1000];
		int p = 0, q = 0, f;
		
		while(sc.hasNext()){
			String s = sc.nextLine();
			if(s.length()==0){
				break;
			}
			String[] st = s.split(",");
			int v = Integer.parseInt(st[0]);
			f = 0;
			for(int i = 0; i < p; i++){
				if(p1[i].n == v){
					p1[i].c++;
					f = 1;
					break;
				}
			}
			if(f == 0){
				p1[p++] = new Pair(v);
			}
		}
		
		while(sc.hasNext()){
			String[] s = (sc.nextLine()).split(",");
			int v = Integer.parseInt(s[0]);
			f = 0;
			for(int i = 0; i < q; i++){
				if(p2[i].n == v){
					p2[i].c++;
					f = 1;
					break;
				}
			}
			if(f == 0){
				p2[q++] = new Pair(v);
			}
		}
		sort(p1, p);
		
		for(int i = 0; i < p; i++){
			for(int j = 0; j < q; j++){
				if(p1[i].n == p2[j].n){
					p1[i].print(p2[j].c);
					break;
				}
			}
		}
	}
	
	private void sort(Pair[] p, int n){
		Pair t;
		for(int i = n-1; i >= 0; i--){
			for(int j = 1; j <= i; j++){
				if(p[j].n < p[j-1].n){
					t = p[j];
					p[j] = p[j-1];
					p[j-1] = t;
				}
			}
		}
		
		return ;
	}
	
	public static void main(String[] args){
		new Main();
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;
class fenwick {
	int N;
	vector<ll> bit;
	public: 
	fenwick(int n) {
		N=n;
		bit.resize(N,0);
	}
	void update(int idx, int delta) {
		for(;idx<N; idx = idx|(idx+1)) {
			bit[idx]+=delta;
		}
	}
	ll sum(int r) {
		ll ret = 0;
		for(;r>=0;r = (r&(r+1))-1) {
			ret+=bit[r];
		}
		return ret;
	}
	ll sum(int l, int r) {
		return sum(r) - sum(l-1);
	} 
};
struct Query {
	int l, r, id;
	bool operator<(const Query &b) const{
		return r<b.r;
	}
};
int main() {
	int n,q;
	cin>>n>>q;
	vector<ll> a(n);
	for(int i=0;i<n;i++) {
		cin>>a[i];
	}
	vector<Query> query(q);
	for(int i=0;i<q;i++) {
		int aa,b;
		cin>>aa>>b;
		--aa,--b;
		query[i].l = aa;
		query[i].r = b;
		query[i].id = i;
	}
	debug()<<imie(a);
	int qno = 0;
	sort(query.begin(),query.end());
	vector<int> lastvisit(n+10,-1), ans(q);
	fenwick bit(n);
	for(int i=0;i<n;i++) {
		if(lastvisit[a[i]]!=-1) {
			bit.update(lastvisit[a[i]],-1);
		}
		lastvisit[a[i]] = i;
		bit.update(i,1);
		while(qno<q && query[qno].r==i) {
			ans[query[qno].id] = bit.sum(query[qno].l,query[qno].r);
			qno++;
		}
	}
	for(auto it:ans) {
		cout<<it<<"\n";
	}
	
}



Measured memory_bytes: 21256
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main(){
	
	int m;
	char l[5][5];
	cin>>m;
	for(int i=0;i<m;i++){
		int max=0;
		for(int j=0;j<25;j++)cin>>l[j%5][j/5];
		for(int h=1;h<6;h++)for(int w=1;w<6;w++){
			int p=0;
			for(int y=0;y<5-h+1;y++)for(int x=0;x<5-w+1;x++){
				int q=0;
				for(int b=0;b<h;b++)for(int a=0;a<w;a++)if(l[x+a][y+b]=='0')q=1;
				if(q==0)p=1;
			}
			if(p==1&&w*h>max)max=w*h;
		}
		cout<<max<<endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    int ans=0;
    for(int i=1; i<=n; ++i){
        int cnt=0;
        for(int j=1; j<=i; ++j){
            if(i%2==1&&i%j==0)cnt++;
        }
        if(cnt==8)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;

int main(void){
 int N,a;
 cin>>N;
 for(int i=0; i<N;i++){
  cin>>a;
  if(a%2==1){
   cout<<"first"<<endl;
   return 0;
  }
 }

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

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC160
{
    class C
    {
        static void Main(string[] args)
        {
            var kn = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var k = kn[0]; var n = kn[1];
            var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var asum = a.Sum();
            var sa = new long[n];
            sa[0] = Math.Abs(k - a[a.Length - 1] + a[0]);

            for (int i = 1; i < n; i++)
            {
                sa[i] = Math.Abs(a[i] - a[i - 1]);
            }

            Console.WriteLine(sa.Sum() - sa.Max());

        }
    }
}


Measured memory_bytes: 38116
#include <stdio.h>
int main(){
 int a,b;
 scanf("%d%d",&a,&b);
 if((a+b)%3==0)
  printf("Possible");
else if(a % 3 == 0)
  printf("Possible");
else if (b % 3 == 0)
 printf("Possible");
 else
  printf("Impossible");
    return 0;
}

Measured memory_bytes: 128