akhauriyash/Code-Regression huggingface dataset:
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);  
  //問題文を読む時間をケチらない！！
  //未定義動作に気を付ける！！
  //DPや二分探索の範囲に気をつける！！

  int n;
  cin >> n;

  double ans = 0;
  REP(i,n){
    double m;string s;
    cin >> m >> s;
    if(s == "JPY") ans += m;
    else ans += m*380000;
  } 

  cout << fixed << ans << endl;


  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

int a[55556];

int main(){
	int n;
	cin >> n;
	
	for(int i=2; i<=55555; i++){
		if(a[i]!=0) continue;
		for(ll j=(ll)i*i; j<=55555; j+=i){
			a[j] = 1;
		}
	}
	
	vector<int> ans;
	for(int i=2; i<=55555; i++){
		if(a[i]!=0) continue;
		
		if(i%5==1) ans.push_back(i);
		if((int)ans.size()==n) break;
		
	}
	
	REP(i,n){
		if(i!=0) cout << " ";
		cout << ans[i];
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 3824
#include <stdio.h>
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a>2*b)
    {
        printf("%d",a-b*2);
    }
    if(a<=2*b&&a>=b)
    {
        printf("0");
    }
    if(a<b)
    {
        printf("0");
    }
    return 0;
}


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

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

    int maxh = 0;
    int ans = 0;

    for(int i=0;i<n;i++){
        if(maxh<=height[i]){
            ans++;
            maxh = height[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from itertools import product

H, W, K = map(int, input().split())
C = [list(input()) for _ in range(H)]

def f(i_skip, j_skip):
  cnt = 0
  for i in range(H):
    if i_skip[i] == 1:
      continue
    for j in range(W):
      if j_skip[j] == 1:
        continue
      elif C[i][j] == '#':
        cnt += 1
  return cnt == K

ans = 0
cnt = 0
for i_skip in product(range(2), repeat=H):
  for j_skip in product(range(2), repeat=W):
    ans += int(f(i_skip, j_skip))
print(ans)

Measured memory_bytes: 74136
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    int N = s.nextInt();
    ArrayList<Double> L = new ArrayList<Double>();
    for (int i=0;i<N;i++){
      L.add(s.nextDouble());
    }
    Collections.sort(L);
    Double Sum = 0.0;
    Sum += L.get(0) / Math.pow(2, N-1);
    for (int i=1;i<N;i++){
      Sum += L.get(i) / Math.pow(2, N-i);
    }
    System.out.println(Sum);
    
    
  }
}

Measured memory_bytes: 24788
import java.util.Scanner;

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

	 int data[][][] = new int[4][3][10];
	 int n, b, f, r, v, i, j, k;
	 n = scan.nextInt();
	   
	 for(i = 0; i < 4; i++) {
	  for(j = 0; j < 3; j++) {
	   for(k = 0; k < 10; k++) {
	    data[i][j][j] = 0;
	   }
	  }
	 }
	   
	 for(i = 0; i < n; i++) {
	  b = scan.nextInt();
	  f = scan.nextInt();
	  r = scan.nextInt();
	  v = scan.nextInt();
	  data[b-1][f-1][r-1] += v;
	 }
	   
	 for(i = 0; i < 4; i++) {
	  for(j = 0; j < 3; j++) {
	   for(k = 0; k < 10; k++) {
		System.out.print(" " + data[i][j][k]);
	   }
	   System.out.println("");
	  }
	  if(i != 3) {
	  System.out.println("####################");
	  }
	 }

	}
}

Measured memory_bytes: 29832
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#include <cmath>
#include <string>
#include <cstdint>

using namespace std;

int n,c,d[31][31],m[501][501],ss[3][31];

uint64_t assume(int x,int y,int z) {
    uint64_t ret = 0;
    for(int i = 1;i <= c;i++) {
        ret = ret + (d[i][x] * ss[0][i]);
        ret = ret + (d[i][y] * ss[1][i]);
        ret = ret + (d[i][z] * ss[2][i]);
    }
    return ret;
}

uint64_t mmin(uint64_t a,uint64_t b) {
    if(a > b)
        return b;
    else
        return a;
}

int main(void) {
    cin >> n >> c;
    for(int i = 0;i < c;i++) {
        for(int ii = 0;ii < c;ii++) {
            cin >> d[i+1][ii+1];
        }
    }
    for(int i = 0;i < n;i++) {
        for(int ii = 0;ii < n;ii++) {
            cin >> m[i+1][ii+1];
        }
    }
    for(int i = 1;i <= n;i++) {
        for(int j = 1;j <= n;j++) {
            ss[(i+j)%3][m[i][j]]++;
        }
    }
    uint64_t mm = UINT64_MAX;
    for(int x = 1;x <= c;x++) {
        for(int y = 1;y <= c;y++) {
            for(int z = 1;z <= c;z++) {
                if(x != y && y != z && z != x)
                    mm = mmin(mm,assume(x,y,z));
            }
        }
    }
    cout << mm << endl;
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

int dp[25000005];
ll dp2[25000005];

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

    int N;
    vector<vector<int>> X(2, vector<int>(3));
    cin >> N;
    for(int i = 0; i < 2; ++i){
        for(int j = 0; j < 3; ++j){
            cin >> X[i][j];
        }
    }
    int bound = 0;
    for(int i = 0; i <= N; ++i){
        dp[i] = i;
        for(int j = 0; j < 3; ++j){
            if(i >= X[0][j])    chmax(dp[i], dp[i - X[0][j]] + X[1][j]);
        }
        chmax(bound, dp[i]);
    }
    ll ans = 0;
    for(int i = 0; i <= bound; ++i){
        dp2[i] = i;
        for(int j = 0; j < 3; ++j){
            if(i >= X[1][j])    chmax(dp2[i], dp2[i - X[1][j]] + X[0][j]);
        }
        chmax(ans, dp2[i]);
    }
    cout << ans << endl;
}

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

#define REP(i,n) for(int i=0;i<n;i++)
typedef long long int lli;
typedef pair<int, int> P;

int main() {
    lli n, k;
    cin >> n >> k;

    lli num;
    lli bunbo;

    double ans = 0;
    for (lli i=1; i < n+1; i++) {
        // i が出たとき
        num = i;
        bunbo = 1;
        while (true) {
            if (num >= k)
                break;
            bunbo *= 2;
            num *= 2;
        }
        ans += 1.0/bunbo;

    }


    cout << setprecision(13) << ans/n<< endl;
}


Measured memory_bytes: 768
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int n;
	double t,a;
	cin>>n;
	cin>>t>>a;
	double d;
	int ma=1;
	int cnt=1;
	double x[1005];
	while(n--)
	{
		cin>>d;
		x[cnt]=fabs(a-(t-0.006*d));
		if(x[cnt]<x[ma])
		{
			ma=cnt;
		}
		cnt++;
	}
	cout<<ma<<endl;
	return 0;
}

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

#define MAX_N 100005

int n;
int a ,b ,c;
vector <pair<int ,int>> adj[MAX_N];

bool ans[MAX_N];
void dfs(int u ,int p=-1 ,int d=0){
    ans[u] = d&1;
    for(auto v : adj[u]) if(v.first != p)
        dfs(v.first ,u ,d+v.second);
}

int main()
{
    scanf("%d",&n);
    for(int i=1; i<n; i++){
        scanf("%d%d%d",&a,&b,&c);
        adj[a].push_back({b,c});
        adj[b].push_back({a,c});
    }

    dfs(1);
    for(int i=1; i<=n; i++)
        printf("%d\n",ans[i]);
}


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

int main()
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	int x , n  , input , c = 0; 
	cin >> x >> n ; 
	int cnt[201]  = {0};
	bool check = true ;  
	for(int i = 0 ; i < n ; ++i)
	{
		cin >> input ;
		cnt[input] = 1 ;  
	}
	while(check)
	{
		if(cnt[x - c] == 0)
		{
			cout << (x - c) ;
			check = false ;  
			break ; 
		}
		else if(cnt[x + c] == 0)
		{
			cout << (x + c) ;
			check = false ; 
			break ;  
		}
		++ c ; 
	}
}





Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ALL(x) x.begin(), x.end()
#define mset(a, b) memset(a, b, sizeof a)
#define rep(i, a, b) for(int i(a), i##_END_(b); i <= i##_END_; i++) 
#define drep(i, a, b) for(int i(a), i##_END_(b); i >= i##_END_; i--)
using namespace std;
template<class T> inline bool tomax(T &a, T b) {return a < b ? a = b, 1 : 0;}
template<class T> inline bool tomin(T &a, T b) {return b < a ? a = b, 1 : 0;}
typedef long long ll;
typedef double db;

const int N = 1e5 + 5;

int a[N], b[N];

int main() {
    int n;
    scanf("%d", &n);
    rep(i, 1, n) scanf("%d", &a[i]), b[i] = a[i];
    int tot = 0;
    b[++tot] = a[1];
    rep(i, 2, n) {
        if(b[tot] >= a[i]) b[++tot] = a[i];
        else {
            int l = 1, r = tot, mid, o;
            while(l <= r) {
                mid = (l + r >> 1);
                if(b[mid] < a[i]) r = mid - 1, o = mid;
                else l = mid + 1;
            }
            b[o] = a[i];
        }
    }
    printf("%d\n", tot);
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
//#pragma comment(linker,"/STACK:1024000000,1024000000")
//251103FD
using namespace std;
#define PB pop_back
#define PF pop_front
#define np next_permutation
#define eb emplace_back
#define bf push_front
#define mp make_pair
#define s second
#define f first
#define mt make_tuple
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define forn(i, a) for(int i=0; i<a; ++i)
#define Forn(i, a) for(int i=1; i<=a; ++i)
#define read(x) ((scanf("%s", &_), (x) = _))
#define INF 1e9
#define memINF 127
#define inf 1e18
#define all(x) x.begin(), x.end()
#define MOD 1e9+7 
#define HASH 1543 

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<pi,int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef unsigned int uint;

using namespace std;

inline int in() 
{
    int x=0, c;
    for(; (uint)((c=getchar())-'0')>=10;) 
	{ 
		if(c=='-') 
			return -in(); 
		if(!~c)
			throw ~0; 
	}
    do 
	{ 
		x=(x<<3)+(x<<1)+(c^48); 
	} 
	while((uint)((c=getchar())^48)<10);
    return x;
}
inline int gcd(int a, int b){if(a>b) swap(a, b); return a==0?b:gcd(b%a, a);}
inline int lcm(int a, int b){return a*b/gcd(a, b);}

int N, M, par[1000010], ranks[1000010], a, b, c, dist[1000010], all, newNode[1000010];
vector<pi> e[1000010];
vi adj[1000010];
bool used[1000010];

inline int find(int x)
{
	return par[x]==x?x:par[x]=find(par[x]);
}

inline void unite(int x, int y)
{
	x=find(x), y=find(y);
	if(x==y)
		return;
	if(ranks[x]<ranks[y])
		par[x]=y;
	else
	{
		par[y]=x;
		if(ranks[x]==ranks[y])
			ranks[x]++;
	}
}

int main()
{
	while(~scanf("%d %d",&N,&M))
	{
		while(M--)
		{
			a=in(), b=in();
			e[in()].eb(mp(a, b));
		}
		all=N;
		Forn(i, 1000000)
		{
			if(!e[i].size())
				continue;
			int pa;
			foreach(it, e[i])
	        {
	            used[it->f]=used[it->s]=false,
	            newNode[it->f]=newNode[it->s]=-1,
	            ranks[it->f]=ranks[it->s]=0;
	            par[it->f]=it->f;
				par[it->s]=it->s;
	        }
			foreach(it, e[i])
				unite(it->f, it->s);
			foreach(it, e[i])
	        {
	            if(!used[it->f])
	            {
	                used[it->f]=true;
	                pa=find(it->f);
	                if(newNode[pa]<=0)
	                    newNode[pa]=++all;
	                adj[it->f].eb(newNode[pa]);
	                adj[newNode[pa]].eb(it->f);
	            }
	            if(!used[it->s])
	            {
	                used[it->s]=true;
	                pa=find(it->s);
	                if(newNode[pa]<=0)
	                    newNode[pa]=++all;
	                adj[it->s].eb(newNode[pa]);
	                adj[newNode[pa]].eb(it->s);
	            }
	        }
		}
		queue<int> q;
		q.push(1);
		memset(dist, -1, sizeof(dist));
		dist[1]=0;
		while(!q.empty())
		{
			int cur=q.front();
			q.pop();
			foreach(it, adj[cur])
				if(dist[*it]<0)
					dist[*it]=dist[cur]+1, q.push(*it);
		}
		if(dist[N]<0)
			puts("-1");
		else
			printf("%d\n", dist[N]>>1);
		forn(i, all+1)
	    {
	    	e[i].clear();
	    	adj[i].clear();
	    	used[i]=0;
	    	newNode[i]=0;
	    }
	}
	return 0;
}


Measured memory_bytes: 72960
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define vl vector<long long>
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mod 1000000007
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define F first
#define S second
long long qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
long long INF = 1e9;
long pow(long x, int n) { //x^n 計算量O(logn)
	long ans = 1;
	while (n > 0) {
		if ((n & 1) == 1) {
			ans = ans * x;
		}
		x = x * x; //一周する度にx, x^2, x^4, x^8となる
		n >>= 1; //桁をずらす n = n >> 1
	}
	return ans;
}

int main(){
    vector<int> lyn(100010);
    for(int i = 0;i <= 100000;i++) lyn[i] = qp(3,i,mod);
    //debug(lyn[3]);
    string L; cin >> L;
    int n = L.size();
    ll ans = 0;
    vector<int> one;
    for(int i = L.size()-1;i >= 0;i--){
        if(L[i] == '1') one.pb(i);
    }
    for(int i = 0;i < one.size();i++){
        if(i == 0){
            ans = (lyn[n - one[0] - 1] + 2) % mod;
        }else{
            ll k = ans * 2;
            ans =( k + lyn[n-one[i] - 1]) % mod;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1404
n,t = map(int,input().split())
l = []
tmpcost = 1001
for i in range(n):
  l.append([int(x) for x in input().split()])
#print(l)
for i in range(n):
  if l[i][1] <= t and l[i][0] <= tmpcost:
    tmpcost = l[i][0]
if tmpcost == 1001:
  print("TLE")
else:
  print(tmpcost)
    

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <fstream>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)

bool has_key_using_count(map<char, char> &m, char n){
    if (m.count(n) == 0){
		//cout << "m doesn't have " << n << "." << endl;
        return false;
    }
    else{
        //cout << "m has " << n << "." << endl;
        return true;
    }
}

int main()
{
	//ifstream cin("sample.txt");

	int n = 0;
	
	string table_in = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", table_out = "DEFGHIJKLMNOPQRSTUVWXYZABC";
	map<char, char> table;

	// テ・ツセツゥテ・ツ渉キティツ。ツィテ」ツ?ョテ、ツスツ愿ヲツ按静ッツシツ暗ヲツ堋療・ツ渉キティツ。ツィテ」ツ?ァテ」ツ?ッテ」ツ?ェテ」ツ??ッツシツ?
	table.clear();
	rep(i, table_in.size()) {
		//table.insert( map<char, char>::value_type(table_in[i], table_out[i]));
		table.insert( map<char, char>::value_type(table_out[i], table_in[i]));
	}
	//cout << table['A'] << " " << table['M'] << endl;
	string input = "", ans = "";

	// テ・ツ?・テ・ツ環崚ヲツ鳴?・ツュツ療・ツ按療ィツェツュテ」ツ?ソティツセツシテ」ツ?ソ
	getline(cin, input);
	//cout << input << endl;

	// テ・ツ、ツ嘉ヲツ渉?
	rep(i, input.size()) {
		ans.push_back(table[input[i]]);
	}

	// テ・ツ?コテ・ツ環崚」ツ?凖」ツつ?
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1188
import java.io.IOException;
import java.util.*;

public class Main {
    public static int map[][]=new int[11][11];
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        long L=sc.nextLong();
        long R=sc.nextLong();

        long diff=R-L;
        long lmod=L%2019;
        if(lmod+diff>=2019){
            System.out.println(0);
            return;
        }
        
        long ans=999999;
        for(long i=L;i<R;i++){
            for(long j=i+1;j<=R;j++){
                ans=Math.min(ans,i*j%2019);
            }
        }
        System.out.println(ans);
    }


}

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

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

  int cnt = 0;
  map<pair<int, int>, int> dict;

  for (int i = 1; i <= n; ++i) {
    int last = i % 10;
    if (last == 0) {
      continue;
    }
    int first = i;
    while (first >= 10) {
      first /= 10;
    }
    dict[make_pair(first, last)]++;
  }
  for (int i = 1; i <= 9; ++i) {
    for (int j = 1; j <= 9; ++j) {
      cnt += dict[make_pair(i, j)] * dict[make_pair(j, i)];
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

char s[1000010];
int n, dp[1000010][2];
int main() {
	scanf("%s", s + 1);
	dp[0][0] = 0, dp[0][1] = 1;
	for (n = 1; s[n] != 0; n++) {
		int i = n;
		int d = s[i] - '0';
		dp[i][0] = min(dp[i - 1][0] + d, dp[i - 1][1] + min(10 - d, 1 + d));
		dp[i][1] = min(dp[i - 1][0] + (d + 1), dp[i - 1][1] + min(10 - (d + 1), 1 + (d + 1)));
	}
	printf("%d\n", dp[n - 1][0]);
}

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

class Combination {
private:
  const int max;
  const int mod;
  std::vector<long long> inv; // inv[k] = k^-1 in Fp
  std::vector<long long> com; // com[k] = nCk
public:
  Combination(int max, int mod)
      : max(max), mod(mod), inv(max, -1), com(max, -1) {
    inv[1] = 1;
    for (int i = 2; i < max; ++i) {
      inv[i] = mod - inv[mod % i] * (mod / i) % mod;
    }
  }
  void setn(int n) {
    com[0] = 1;
    for (int k = 1; k < max; ++k)
      com[k] = (com[k - 1] * (n - k + 1) % mod) * inv[k] % mod;
  }
  long long operator()(int k) const {
    if (k < 0)
      return 0;
    return com[k];
  }
};

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

int main() {
  int n, a, b;
  std::cin >> n >> a >> b;
  const int MAX = 1000000;
  const int MOD = 1000000007;
  Combination comb(MAX, MOD);
  comb.setn(n);
  long long res = modpow(2, n, MOD) - 1;
  if (res < 0)
    res += MOD;
  res -= comb(a);
  if (res < 0)
    res += MOD;
  res -= comb(b);
  if (res < 0)
    res += MOD;
  std::cout << res << std::endl;

  // for (int n = 0; n < 10; ++n) {
  //   comb.setn(n);
  //   for (int k = 0; k <= 10; ++k) {
  //     std::cout << " " << comb(k);
  //   }
  //   std::cout << std::endl;
  // }
}


Measured memory_bytes: 15872
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace dwacon
{
    class Program
    {

        static void Main(string[] args)
        {
            var split = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = split[0];
            int a = split[1];
            int b = split[2];
            int output = 0;
            for (int i = 1; i <= n; i++)
            {
                if (a <= sum(i) && sum(i) <= b)
                    output += i;

            }
            Console.WriteLine(output);
        }

        static int sum(int m)
        {
            string s_m = m.ToString();
            int output = 0;
            for (int i = 0; i < s_m.Length; i++)
            {
                output += int.Parse(s_m[i].ToString());
            }
            return output;
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#include <set>
#include <iterator>
using namespace std;
using namespace __gnu_pbds;


#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define INF INT_MAX
#define matrix vector<vector<ll> >

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )

typedef tree<pll, null_type, less<pll>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
const int N=1e5+10, M=(ll)1e9+1 ;
const int mod = 1e9+7  ;


void work(){
    ll n;
    cin >> n;
    vl t(n),d(n);
    vll a(n);
    for(ll i=0;i<n;i++){
//        cin >> t[i] >> d[i]
        cin >> a[i].s >> a[i].f;
    }
    sort(a.begin(),a.end());
    ll cur=0;
    for(ll i=0;i<n;i++){
        cur+=a[i].s;
        if(cur>a[i].f){
            cout << "No";
            return;
        }
    }
    cout << "Yes";
}
int main(){
 ios_base::sync_with_stdio(0);

    ll t,z;
    // cin >> t;
    // z=t;
    t=1;
    while(t--){
            // cout << "Case #" << z-t << ": ";
            work();
    }
   return 0;

}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int a,b,h;
  cin >> a >> b >> h;
  cout << (a+b)*h/2 << endl;
}


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

int main(){
    int N,K;
    string S;
    
    cin>>N>>S>>K;
    char c=S[K-1];
    for(auto i=0;i<S.length();i++)
        if(S[i]!=c)
            S[i]='*';
    cout<<S<<endl;
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    
    int n = (int)s.size();
    long long ans = 0;
    
    for (int tmp = 0; tmp < (1<<n-1); tmp++){
        bitset<10> t(tmp);
        
        long long cur = s[0] - '0';
        
        for (int i = 0; i < n-1; i++){
            if (t.test(i)){
                ans += cur;
                cur = s[i+1] - '0';
            }
            else{
                cur = cur*10 + (s[i+1]-'0');
            }
        }
        ans += cur;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <fstream>
#include <vector>
#include <string>
using namespace std;
int main(void){
    char a;
    cin>>a;
    if(isupper(a)){
        cout<<"A"<<endl;
    }else{
        cout<<"a"<<endl;
    }
    
}


Measured memory_bytes: 3648
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3];
        int[] b = new int[3];
        for (int i = 0; i < 3; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }

        int[] count = new int[4];
        for (int i = 0; i < 3; i++) {
            count[a[i] - 1]++;
            count[b[i] - 1]++;
        }
        int a1 = 0;
        int a2 = 0;

        for (int i = 0; i < 4; i++) {
            if (count[i] == 1)
                a1++;
            if (count[i] == 2)
                a2++;
        }

        if (a1 == 2 && a2 == 2)
            System.out.println("YES");
        else
            System.out.println("NO");

    }

}


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

n, m = map(int, input().split())
l = []
r = []
answer = 0
for i in range(m):
    a, b = map(int, input().split())
    l.append(a)
    r.append(b)
min_ok = max(l)
max_ok = min(r)
answer = max_ok - min_ok + 1
if answer < 0:
    answer = 0
print(answer)


Measured memory_bytes: 10996
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define MP make_pair
#define PB push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	vector<int> a(3);
	for (int i = 0; i < 3; i++)cin >> a[i];
	sort(a.begin(), a.end());
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
}


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

int main(){
  int a, b;
  cin >> a >> b;
  string s, t;
  rep(i,b) s += a+'0';
  rep(i,a) t += b+'0';
  cout << min(s,t) << endl;
  return 0;  
}

Measured memory_bytes: 3628
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = set()
    # 逆順で考える
    # indexではなく数値で考える
    for i in reversed(range(1, n+1)):
        # 倍数計算は2倍したあとは数値的にnまでiごとにという形で算出
        for j in range(i*2, n+1, i):
            a[i-1] ^= a[j-1]
        if a[i-1] == 1:
            ans.add(i)
    print(len(ans))
    print(" ".join(map(str, ans)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 21460
#include<bits/stdc++.h>
 
using namespace std;
 
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_D&lang=jp
 
int LIS(int n,vector<int> a) {
  vector<int> dp(n+1,INT_MAX);
  for(int i=0;i<n;++i) {
    *lower_bound(dp.begin(),dp.end(),a[i]) = a[i];
  }
  return lower_bound(dp.begin(),dp.end(),INT_MAX) - dp.begin();
}
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;++i) cin >> a[i];
  cout << LIS(n,a) << endl;
  return 0;
}

Measured memory_bytes: 3916
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

ll a[25];
int main()
{
  ll n, ans = 0, b, c;
  scanf("%lld", &n);
  for (int i = 0; i < n; i++)
  {
    scanf("%lld", &a[i]);
  }
  for (int i = 0; i < n; i++)
  {
    scanf("%lld", &c);
    b = a[i] - c;
    if (b > 0)
      ans += b;
  }
  printf("%lld\n", ans);
  return 0;
}


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

int main(){
    int N, M, C;
    cin >> N >> M >> C;

    vector<int> B(M);
    for(int i = 0; i < M; ++i) cin >> B[i];

    vector<int> A(M);
    int ans = 0;
    for(int i = 0; i < N; ++i){
        for(int i = 0; i < M; ++i) cin >> A[i];

        int sum = C;
        for(int i = 0; i < M; ++i){
            sum += A[i]*B[i];
        }

        if(sum > 0) ++ans;
    }

    cout << ans << endl;
}

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

using namespace std;

int main()
{
    int n;
    int a;
    int count = 0;
    bool exitFlag=false;
    vector<int> num;
    cin >> n;

    for (int i = 0; i < n; ++i)
    {
        cin >> a;
        num.push_back(a);
    }
    while (true){
        for (int i = 0; i < n; ++i){
            if (num[i] % 2 == 0){
                num[i] = num[i] / 2;
                if (i == n-1)
                    ++count;
            }
            else{
                exitFlag=true;
                break;
                
            
            }

        }
        if(exitFlag==true){
            break;
        }

    }
    cout<<count;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N,M,P;
int A[5000],B[5000],C[5000];
main()
{
	cin>>N>>M>>P;
	for(int i=0;i<M;i++)
	{
		cin>>A[i]>>B[i]>>C[i];
		A[i]--,B[i]--;
		C[i]-=P;
	}
	vector<long>d(N,-1e18);
	d[0]=0;
	for(int i=0;i<M;i++)for(int j=0;j<M;j++)
	{
		d[B[j]]=max(d[B[j]],d[A[j]]+C[j]);
	}
	long ans=d[N-1];
	for(int i=0;i<M;i++)for(int j=0;j<M;j++)
	{
		d[B[j]]=max(d[B[j]],d[A[j]]+C[j]);
	}
	cout<<(ans<d[N-1]?-1:ans<0?0:ans)<<endl;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
#include<vector>
#include<map>
#include<set>
#include<algorithm>

int main(){
  long long int h,w;
  cin>>h>>w;
  if(h%3==0||w%3==0){
    cout<<0<<endl;
    return 0;
  }

  long long int ans = h*w;

  for(int i = 1;i<h;i++){
    vector<long long int> x(3);
    x[0]=i*w;
    long long int w2=w/2;
    x[1]=w2*(h-i);
    x[2]=(w-w2)*(h-i);
    sort(x.begin(),x.end());
    long long int ans2 = x[2]-x[0];

    ans=min(ans,ans2);
  }

  for(int i = 1;i<w;i++){
    vector<long long int> x(3);
    x[0]=i*h;
    long long int w2=h/2;
    x[1]=w2*(w-i);
    x[2]=(h-w2)*(w-i);
    sort(x.begin(),x.end());
    long long int ans2 = x[2]-x[0];

    ans=min(ans,ans2);
  }

  ans=min(ans,w);
  ans=min(ans,h);

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


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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> W(N);

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

    int sum = 0;
    for(int i = 0; i < N; i++){
        sum += W[i];
    }

    int m = sum;
    int sum_tmp = 0;
    for(int i = 0; i < N; i++){
        sum_tmp += W[i];
        m = min(m, abs(sum_tmp - (sum - sum_tmp)));
    }

    cout << m << endl;

    return 0;
}

Measured memory_bytes: 256
def func(x, n):
  res = 1
  for _ in range(n):
    res = res * x % MOD
  return res

n = int(input())
MOD = 10**9 + 7

ans = func(10, n) - func(9, n) - func(9, n) + func(8, n)
ans %= MOD
print(ans)


Measured memory_bytes: 9180
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>

using namespace std;

string s;

int main(){
    cin >> s;

    for(int mask = 0; mask < (1 << 4); mask++){

        string tmp;
        tmp += s[0];
        int num = s[0] - '0';

        for(int i = 1; i < 4; i++){
            if((mask >> i) & 1){
                tmp += '+';
                num += s[i] - '0';
            }
            else{
                tmp += '-';
                num -= s[i] - '0';
            }
            tmp += s[i];
        }

        if(num == 7){
            cout << tmp << "=7" << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
S = input().split()
A = int(S[0])
B = int(S[1])
if B == 1:
    print(0)
    exit()
if A >= B:
    print(1)
    exit()
ans = (B-1) // (A - 1)
if (B-1) % (A-1) != 0:
    ans += 1
print(ans)


Measured memory_bytes: 3060
fun main(args: Array<String>) {
   val list: List<Int> = readLine()!!.split(" ").map { it.toInt() }
   val a = list[0]
   val b = list[1]
   val c = list[2]
   val ans = if (a<b && b<c && a<c) "Yes" else "No"
   println(ans)
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	for (;;) {
		int n; cin >> n;
		if (!n) break;

		vector<int> v(n);
		rep(i, 0, n) cin >> v[i];
		sort(all(v));
		int ans = 0;
		rep(i, 1, n - 1) ans += v[i];
		cout << ans / (n - 2) << endl;
	}
}



Measured memory_bytes: 3128
import collections
import sys
import numpy as np
from operator import itemgetter

N, T = map(int, input().split())
c = [0]*N
t = [0]*N
ct = [[0, 0]]*N

for i in range(N):
    c[i], t[i] = map(int, input().split())
    ct[i]= [c[i], t[i]]

ct.sort(key=itemgetter(0), reverse=False)
for i in range(N):
    if ct[i][1] <= T:
        print(ct[i][0])
        sys.exit()
print("TLE")

Measured memory_bytes: 21640
#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 mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main(){
    string s;
    cin >> s;
    int n = s.size();
    reverse(s.begin(), s.end());
    vector<vector<mint>> dp(n+1, vector<mint>(13));
    dp[0][0] = 1;
    int tmp = 1;
    rep(i,n){
        if(s[i] != '?'){
            int k = s[i] - '0';
            k *= tmp;
            k %= 13;
            rep(j,13) dp[i+1][(j+k)%13] += dp[i][j];
        }
        else{
            rep(k,10){
                int l = k;
                l *= tmp;
                l %= 13;
                rep(j,13) dp[i+1][(j+l)%13] += dp[i][j];
            }
        }
        tmp *= 10;
        tmp %= 13;
    }
/*    rep(i,n+1){
        rep(j,13) cout << dp[i][j] << ' ';
        cout << endl;
    }
*/
    cout << dp[n][5] << endl;
}

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

using namespace std;

#define Int long long

Int Card[55];
Int dp[50][50][50*51];

Int N,A;


Int rec(Int ind, Int ncard, Int total){

    if(ind == N){
        return ((ncard * A == total) && total != 0);
    }

    if(dp[ind][ncard][total] != -1){
        return dp[ind][ncard][total];
    }

    Int sum = 0;

    Int left = rec(ind+1, ncard,total);
    Int right = rec(ind+1, ncard+1,total+Card[ind]);

    sum += left + right;

    dp[ind][ncard][total] = sum;

    return dp[ind][ncard][total];
}


int main(){

   // freopen("input.txt","r",stdin);

    cin >> N >> A;

    for(Int i=0; i<N;i++){
        cin >> Card[i];
    }

    memset(dp,-1,sizeof dp);

    Int ans = rec(0,0,0);

    cout << ans << endl;

    return 0;
}






Measured memory_bytes: 50048
def dif_mm(a,b):
    f_min=(a-1)*a/2
    f_max=(2*b-a+1)*a/2
    return int(f_max-f_min+1)
N,K=map(int,input().split())
mod=10**9 + 7
ans=0
for i in range(K,N+2):
    ans+=dif_mm(i,N)
    ans%=mod
print(ans)


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using P = pair<ll, ll>;
const int INF = 1001001001;

int main(void){
  ll n, m;
  cin >> n >> m;
  vector<vector<ll>> g(n, vector<ll>(n, INF));
  vector<P> bridge(m);
  REP(i, m){
    ll a, b;
    cin >> a >> b;
    a--; b--;
    g[a][b] = 1;
    g[b][a] = 1;
    bridge[i] = P(a, b);
  }
  ll ans = 0;
  REP(i, m){
    vector<vector<ll>> t(g);
    ll a = bridge[i].first;
    ll b = bridge[i].second;
    t[a][b] = INF;
    t[b][a] = INF;
    REP(k, n)REP(p, n) REP(q, n){
      chmin(t[p][q], t[p][k]+t[k][q]);
    }
    if(t[a][b] == INF) ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    S[K-1] = tolower(S[K-1]);
    print(S);
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main(void){
  int i,N,D,count=0;
  
  scanf("%d",&N);
  scanf("%d",&D);
  int x[N],y[N];
  double dis[N];
  
  for(i=0; i<N; i++){
    scanf("%d",&x[i]);
    scanf("%d",&y[i]);
  }
  
  for(i=0; i<N; i++){
    dis[i]=sqrt(pow(x[i],2)+pow(y[i],2));
    if(dis[i]<=D){
      count++;
    }
  }
  
  printf("%d",count);
  return 0;
}

Measured memory_bytes: 5260
using System;
using System.Linq;

namespace Exa2019_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();
            Console.WriteLine(s.Where(x => x == 'R').Count() > s.Where(x => x == 'B').Count() ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9 + 7;
const int MAX = 510000;

int main() {
    string s; cin >> s;
    rep(i,s.size()){
        if(i%2==0) cout << s[i];
    }
}

Measured memory_bytes: 512
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define vi vector<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007LL
#define pi 3.141592653589
//#define mod 998244353 
using namespace std;

int power(int x, int y) ;
int gcd(int a, int b) ;

/*___________________________TEMPLATE END______________________________*/

signed main() {
    quickie
    int a; 
    long db b ;
    cin >> a >> b ;
    int ans = a*b ;
    cout << ans << "\n" ;
} 

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}

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


Measured memory_bytes: 3740
def first_ABC():
    array = []
    for fig in range(1, 10):
        sum = fig * 100 + fig * 10 + fig
        array.append(sum)
    return array

if __name__ == "__main__":
    N = int(input())
    array = first_ABC()
    for select in array:
        if select >= N:
            print(select)
            break

Measured memory_bytes: 2940
function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.split(" ");
	input = input.split("\n");
	//input = input.split(" ").map((a)=>Number(a));
	//input = input.split("\n").map((a)=>Number(a));
  var list = input[0].split(" ").map((a)=>Number(a));
  var K = parseInt(input[1]);
  var output = 0;
  var max = Math.max.apply(null,list);
  list.splice(list.indexOf(max),1);
  //myout(list);
  output += list[0] + list[1];
  for(var i = 0; i < K; i++){
    max *= 2;
  }
  output += max;
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 7372
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define rep(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define irep(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define rrep(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

const int MOD = 1e9 + 7;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    rep(i, 0, n)
        cin >> l[i];
    sort(l.begin(), l.end(), greater<int>());
    cout << accumulate(l.begin(), l.begin() + k, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>//bit DP
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
priority_queue<long>p;
typedef long long ll;

  long long n;
  ll k;
  ll ans=0;
  ll now=0;
  ll h[400005]={0};
  ll a[200005]={0};
  ll L[12]={0};
  ll R[12]={0};
  ll t=0;
  ll M=998244353;
int main()
{
  cin>>n>>k;
  for(int i=1;i<=k;i++)cin>>L[i]>>R[i];
  for(int j=1;j<=k;j++){
    h[L[j]+1]++;
    h[R[j]+1+1]--;
  }
  for(int i=2;i<n;i++){
    now+=h[i];
    if(now<0)now+=100*M;
    now%=M;
    for(int j=1;j<=k;j++){
      h[L[j]+i]+=now;
      h[R[j]+i+1]-=now;
    }
  }
  cout<<((now+h[n])+100*M)%M<<endl;
}


Measured memory_bytes: 6700
use std::io::Read;

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

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let h: usize = iterator.next().unwrap().parse().unwrap();
    let w: usize = iterator.next().unwrap().parse().unwrap();
    let mut total = 0;
    for _ in 0..h {
        total += iterator.next().unwrap().chars()
            .filter(|c| *c == '#')
            .count();
    }

    return if total == h + w - 1 {
        "Possible".to_string()
    } else {
        "Impossible".to_string()
    }
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
	string S;
	cin >> S;
	bool flag = true;
	fx(S.size()) {
		if (x%2==0) {
			if (S[x]=='L') {
				flag = false;
				break;
			}
		}
		else {
			if (S[x] == 'R') {
				flag = false;
				break;
			}
		}
	}

	if (flag) {
		ce("Yes")
	}
	else {
		ce("No")
	}
    return 0;
}



Measured memory_bytes: 256
import Control.Monad
import Control.Applicative

main :: IO ()
main = do
  c <- getLine
  putStrLn $ solve c

solve "a" = "vowel"
solve "i" = "vowel"
solve "u" = "vowel"
solve "e" = "vowel"
solve "o" = "vowel"
solve _ = "consonant"


Measured memory_bytes: 508