akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
using namespace std;
char map[110][110];
signed main() {
	for0(i, 40)for0(j, 100)map[i][j] = (i < 20 ? '#' : '.');
	int b, w; cin >> w >> b; b--; w--;
	for0(i, w / 50)for0(j, 50)map[i * 2][j * 2] = '.';
	for0(j, w % 50)map[w / 50 * 2][j * 2] = '.';
	for0(i, b / 50)for0(j, 50)map[21 + i * 2][j * 2] = '#';
	for0(j, b % 50)map[21 + b / 50 * 2][j * 2] = '#';
	cout << "40 100\n";
	for0(i, 40) { for0(j, 100)cout << map[i][j]; cout << endl; }
}

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

using namespace std ;

string s , t ;

int main ()
{
	int i , j ;
	int lens , lent ;
	cin >> s >> t ;
	lens=s.length() , lent=t.length();
	bool ok=0;
	for ( i=0 ; i<lent ; i++ )
	{
		bool yes=1;
		for ( j=0 ; j<lens ; j++ )
			if ( s[j]!=t[(j+i)%lens] ) yes=0;
		ok|=yes;
	}
	puts(ok?"Yes":"No");
	return 0 ;
}

Measured memory_bytes: 256
n = int(input())
a_lis = []
for i in range(n):
    a_lis.append(int(input()))
a_s = sorted(a_lis)
max_a = a_s[-1]
n_max_a = a_s[-2]
for i in range(n):
    if a_lis[i] == max_a:
        print(n_max_a)
    else:
        print(max_a)

Measured memory_bytes: 14128
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<vector>
#include<deque>
#include<map>
#include<set>

using namespace std;

int main(){
  char c1[4], c2[4];
  cin >> c1 >> c2;
  if( c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0] ){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  
  return 0;
}

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

furui = [i for i in range(10**6+2)]

ans = 9999999999999

yakusuu = []

for i in range(1,int(n**0.5)+1+1):
    
    if n%i == 0:
        
        yakusuu.append(i)
        

    
for i in yakusuu:
    
    ans = min(i+n//i,ans)
    # print(i,ans)
    
print(ans-2)


Measured memory_bytes: 142728
#include <iostream>
typedef long long ll;
using namespace std;
int main(){
    ll n;
    cin >> n;
    ll ans =0;
    int i= 1;
    while( (ll)i * i + 2*i <= n){
           if(n % i == 0){
                ans += n / i - 1;
           }
           i++;
    }
    cout << ans;
}

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

int main() {
	int S;
	int h, m, s;

	cin >> S;

	h = S / 3600;
	S -= 3600 * h;
	m = S / 60;
	S -= 60 * m;
	s = S;

	cout << h << ":" << m << ":" << s << endl;
	
}


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

int main(){
	int n, v, i, j = 1, last, ans = 0;
	scanf("%d", &n);
	for(i = 1; i <= n; ++ i){
		scanf("%d", &v);
		if(i != 1 && v != last)
			ans += (i - j) >> 1, j = i;
		last = v;
	} printf("%d\n", ans + ((n + 1 - j) >> 1));
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;

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

int main(){
	string S;
	cin>>S;
	int n=0,l=S.length();
	for(int i=l-1;i>=0;i--){
		string s="";
		S.erase(i,1);
		n=S.length()/2;
		for(int j=0;j<n;j++){
			s=s+S[j];
		}
		if(s+s==S){
			cout<<S.length();
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = false;
}  // namespace mydef
using namespace mydef;
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans


void solve() {
}

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

    int X, Y;
    cin >> X >> Y;

    Yes(Y % 2 == 0 && X * 2 <= Y && X * 4 >= Y);

    solve();
    return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
int n,k;
ll x[100],y[100];
int main(){
	cin >> n >> k;

	REP(i,n) {
		cin >> x[i] >> y[i];
	}

	ull ans = ULLONG_MAX;
	REP(i,n) {
		REP(j,n) {
			REP(l,n) {
				REP(m,n) {
					if(x[i] < x[j] || y[l] < y[m]) {
						continue;
					} 

					int c = 0;
					REP(a,n) {
						if(x[j] <= x[a] && x[a] <= x[i] && y[m] <= y[a] && y[a] <= y[l])
							c++;
					}
					if(c >= k){
						ull S = (x[i] - x[j]) * (y[l] - y[m]);
						ans = min(ans,S);
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
import itertools
import numpy as np

N=int(input())
Names=[input() for i in range(N)]

seq = ('m', 'a', 'r', 'c', 'h')

M=0
A=0
R=0
C=0
H=0

for i in Names:
    if i[0]=='M':
        M+=1
    if i[0]=='A':
        A+=1
    if i[0]=='R':
        R+=1
    if i[0]=='C':
        C+=1
    if i[0]=='H':
        H+=1
        
Seq=[M,A,R,C,H]
Combi=list(itertools.combinations(Seq,3)) #3つ選ぶ組み合わせ列挙

Ans=0
for i in Combi:
    Ans+=np.prod(i)
print(Ans)

Measured memory_bytes: 19064
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 0x3f3f3f3f;
const double pi=acos(-1),eps=1e-8;
const int maxn = 1<<17;
const int mod = 1e9+7;
const int N = 1e6+10;
inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}
int a[105];
int main()
{
	for(int i=1;i<=105;i++)
	a[i]=a[i-1]+i;
	ULL n;
	int ans=0;
	cin>>n;
	for(ULL i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			int cnt=0;
			while(n%i==0)
			{
				n/=i;
				cnt++;
			}
			int idx=1;
			for(int j=1;j<=105;j++)
			if(cnt>=a[j])idx=j;
			else break;
			ans+=idx;
		}
	}
	if(n!=1)ans++;
	cout<<ans;
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    int sum = 0;
    rep(i, 5) {
        int a; cin >> a;
        a = max(a, 40);
        sum += a;
    }
    cout << sum/5 << '\n';
    return 0;
}


Measured memory_bytes: 3116
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String array[] = str.split("");
		for(int i = 0; i < array.length; i++){
			for(int j = i + 1; j < array.length; j++){
				if(array[i].equals(array[j])){
					System.out.println("no");
					return;
				}
			}
		}
		System.out.println("yes");
	}
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    bool isodd = false;
    for(int i = 0; i < n; i++){
        if(a[i]%2) isodd = true;
    }

    if(isodd) cout << "first" << endl;
    else cout << "second" << endl;
    return 0;
}

Measured memory_bytes: 3788
#include <stdio.h>

int main(void) {
	double max, min, x, n;
	
	scanf("%lf", &x);
	max=x;
	min=x;
	
	while(scanf("%lf", &n)!=EOF){
		if(min>n)
		min=n;
		
		if(max<n)
		max=n;
	}
	
	printf("%.1lf\n", max-min);
	
	return 0;
}

Measured memory_bytes: 652
#include<stdio.h>

int A[1000000], n;

int search(int key)
{
	int left = 0;
	int right = n;
	int mid;

	while (left < right)
	{
		mid = (left + right) / 2;
		if (key == A[mid])return 1;
		if (key > A[mid])left = mid + 1;//ああ、ここだ、＋１することによってだ。そもそももうmidで比較しているので
		else if (key < A[mid])right = mid;
	}
	return 0;
}

int main()
{
	int i, q, k, sum = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &A[i]);
	}

	scanf("%d", &q);
	for (i = 0; i < q; i++)
	{

		scanf("%d", &k);
		if (search(k))
		{
			sum++;
		}
	}
	printf("%d\n", sum);

	return 0;
}



Measured memory_bytes: 2084
while True:
    try:
        n = int(input())
        P = list(map(int, input().split()))
        cnt = 0
        for i in range(1, n-1):
            if min(P[i-1:i+2]) < P[i] < max(P[i-1:i+2]):
                cnt += 1
        print(cnt)
    except:
        break

Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
ll n,c,g,a,we,ac,L[7],p[7],k,dp[500][500];
signed main()
{
cin>>n>>c,c*=n,k=1<<(n - 1);
forn(i,n)cin>>L[i],L[i]*=n;
sort(L,L+n);
iota(p,p+n-1,0);
do{
    memset(dp,0,sizeof(dp));
    dp[L[n-1]][0] = 1;
    forn(i,c) if(i%n)
    {
        we = p[i%n-1];
        forn(mask, k) if (!((1<<we)&mask))
            for (ac=i;ac<=c;ac++)
                dp[max(ac,min(c,L[we]+i))][mask+(1<<we)]+=dp[ac][mask];
    }
    g+=dp[c][k-1],a++;
}while(next_permutation(p, p + n - 1));
printf("%.15f",g/pow(c/n,n-1)/a);
}


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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll A,B,C;
    cin >> A >> B >> C;
    ll ans = 0;
    ll minc = min(B,C);
    ans += minc * 2;
    if(B >= C){
        ans += B-minc;
    } else {
        if(C-minc > A){
            ans += A+1;
        } else {
            ans += C - minc;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3496
#include<cstdio>
#include<algorithm>
using namespace std;
int n,ans;
long long a[100005],qzh[100005];
void bs(int l,int r) {
	int mid=l+r>>1;
	bool flag=false;
	long long now=qzh[mid];
	for(int i=mid;i!=n;++i) if(a[i+1]<=(now<<1)) now+=a[i+1];else {flag=true;break;}
	if(l==r) {if(!flag) ans=mid;return;}
	if(!flag) {ans=mid;bs(l,mid);}
	else bs(mid+1,r);
}
int main()
{
	scanf("%d",&n);for(int i=1;i<=n;++i) scanf("%lld",&a[i]);
	sort(a+1,a+1+n);for(int i=1;i<=n;++i) qzh[i]=qzh[i-1]+a[i];
	bs(1,n);
	printf("%d\n",n-ans+1);
	return 0;
}

Measured memory_bytes: 1664
n = int(input())
v = list(map(int,input().split()))

def f(x,y):
    return (x+y) / 2

v.sort()
while True:
    if len(v) == 1:
        break
    v[0] = f(v[0],v[1])
    del v[1]
print(v[0])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

vector<long> answer(200010);
vector<vector<int>> Graph(200010);
vector<long> dp(200010, 1e18);

void dfs(vector<long> &A, int v, int pv){
  long a = A.at(v);
  int iter = upper_bound(dp.begin(), dp.end(), a) - dp.begin();
  if(a == dp.at(iter-1)) iter--;
  pil P(iter, dp.at(iter));
  dp.at(iter) = a;
  answer.at(v) = lower_bound(all(dp), 1e18) - dp.begin() - 1;
  for(int nv : Graph.at(v)){
    if(nv == pv) continue;
    dfs(A, nv, v);
  }
  //cout << iter << endl;
  dp.at(iter) = P.second;
  return;
}

int main(){
  int n;
  cin >> n;
  vector<long> A(n);
  rep(i,n) cin >> A.at(i);
  rep(i,n-1){
    int u,v;
    cin >> u >> v;
    
    u--;v--;
    Graph.at(u).push_back(v);
    Graph.at(v).push_back(u);
  }
  dp.at(0) = -1e18;
  dfs(A, 0, -1);
  rep(i,n) cout << answer.at(i) << endl;
}

Measured memory_bytes: 33356
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

namespace {

class List {
 private:
  struct Node {
    size_t x;
    Node* next;
    Node* prev;
  };

 public:
  List() : nil_(new Node) {
    nil_->next = nil_;
    nil_->prev = nil_;
  }

  ~List() {
    Node* n = nil_->next;
    while (n != nil_) {
      Node* cur = n;
      n = cur->next;
      delete cur;
    }

    if (nil_)
      delete nil_;
  }

  void Print() const {
    for (Node* n = nil_->next; n != nil_; n = n->next) {
      if (n != nil_->next) printf(" ");
      printf("%lu", n->x);
    }
    printf("\n");
  }

  void Insert(size_t x) {
    Node* n = new Node;
    n->x = x;
    n->next = nil_->next;
    // Node is created in the beginning, the operation
    // initialize the last node since nil_->next is nil_,
    // and nil_->prev is the last node.
    n->next->prev = n;

    nil_->next = n;
    n->prev = nil_;
  }

  void Delete(size_t x) {
    Node* n = Find(x);
    if (!n) {
      return;
    }
    DeleteNode(n);
  }

  void DeleteFirst() {
    DeleteNode(nil_->next);
  }

  void DeleteLast() {
    DeleteNode(nil_->prev);
  }

 private:
  void DeleteNode(Node* n) {
    n->prev->next = n->next;
    n->next->prev = n->prev;
    delete n;
  }

  Node* Find(size_t x) {
    Node* n = nil_->next;
    for (; n != nil_; n = n->next) {
      if (n->x == x) {
        return n;
      }
    }
    return NULL;
  }

  // nil_ is a node for sentinel, but the next
  // and prev have the following roles:
  // nil_->next is the first node in the list
  // nil_->prev is the last node in the list.
  Node* nil_;
};

} // namespace

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

  char b[16];
  string op;
  op.reserve(16);
  size_t x = 0;

  List list;
  for (int i = 0; i < n; ++i) {
    scanf("%s", b);
    op = b;

    if (op == "insert") {
      scanf("%lu", &x);
      list.Insert(x);
    } else if (op == "delete") {
      scanf("%lu", &x);
      list.Delete(x);
    } else if (op == "deleteFirst") {
      list.DeleteFirst();
    } else {
      list.DeleteLast();
    }
  }
  list.Print();
  return 0;
}

Measured memory_bytes: 32456
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4.2")
#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define PB push_back
#define all(x) x.begin(),x.end()
#define vi vector<ll>
#define ii pair<ll,ll>
#define vii vector<ii>
#define vb vector<bool>
#define vvi vector<vector<ll> >
#define vvii vector<vii>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define read(x) long long x;cin>>x;
#define FOR(a,b,c,d) for(int a=b;a<=c;a+=d)
#define MP make_pair
#define F first
#define AS assign
#define S second
#define debug(x) cout<<(#x)<<": "<<(x)<<"\n"
#define SZ(x) x.size()
#define mod 1000000007
#define lg2(x) 63-(__builtin_ctzll(x))
#define RZ resize
#define IN insert
#define X real()
#define Y imag()
#define FBO find_by_order
#define OFK order_of_key
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
typedef unsigned long long ull;
typedef long double d64;
typedef complex<d64>P;
ll modpow(int a,int b,int m){if(!b)return 1%m;ll u=modpow(a,b/2,m);u=(u*u)%m;if(b&1)u=(u*a)%m;return u;}



int main(){
d64 n,k;
cin>>n>>k;
int ans=0;
while(n--){
    d64 x,y;
    cin>>x>>y;
    P z={x,0};
    P v={0,y};
    if(abs(z-v)<=k)ans++;
}
cout<<ans;
return 0;
}




Measured memory_bytes: 3820
#include <bits/stdc++.h>
#include <list>
#define int long long
using namespace std;
const int INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

signed main() {
    string s;
    cin >> s;
    s.push_back('R');
    vector<int> v;
    char current = 'R';
    int count = 1;
    for (int i = 0; i < s.size() - 1; i++) {
        if (s[i] != s[i + 1]) {
            v.emplace_back(count);
            count = 0;
        }
        count++;
    }
    vector<int> result(s.size() - 1, 0);
    int border = 0;
    for(auto itr = v.begin(); itr != v.end(); itr += 2) {
        auto r = *itr;
        auto l = *(itr + 1);
        border += r;
        result[border - 1] = r / 2 + r % 2 + l / 2;
        result[border] = r / 2 + l / 2 + l % 2;
        border += l;
    }
    for (auto && x : result) {
        cout << x << "\n";
    }
}

Measured memory_bytes: 2292
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def isprime(n):
  if n == 1:
    return False
  for i in range(2, int(n**0.5) + 1):
    if (n % i == 0):
      return False
  return True

def main():
    x = ni()

    for i in range(x, 2*10**5):
        if isprime(i) == True:
            print(i)
            return


if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include <iostream>
using namespace std;
typedef long long ll;
int main(void) {
  ll n, m;
  cin >> n >> m;
  if (n > 1 && m > 1) {
    cout << (n - 2) * (m - 2) << endl;
  } else if (n == 1 && m > 1) {
    cout << m - 2 << endl;
  } else if (n > 1 && m == 1) {
    cout << n - 2 << endl;
  } else {
    cout << 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>


using namespace std;

int main(){
    
    int n;
    cin >> n;
    
    set<string> dic;
    
    for(int i=0; i < n; i++){
        string ope, str;
        
        cin >> ope >> str;
        
        if(ope == "insert"){
            dic.insert(str);
        }else if(ope == "find"){
            if(dic.find(str) == dic.end()){
                cout << "no" << endl;
            }else{
                cout << "yes" << endl;  
            }
        }
        
    }
    
    
    return 0;
}


Measured memory_bytes: 32192
#include <iostream>
#include <algorithm>

using namespace std;

int main(){

  int n,q;
  int cnts[101];
  int maxDay=0;
  while(cin>>n>>q&&!(n==0&&q==0)){
    fill(cnts,cnts+101,0);
    for(int i = 0; i < n; i++){
      int k;
      cin>>k;
      for(int j = 0; j < k; j++){
	int t;
	cin>>t;
	cnts[t]++;
	maxDay=max(maxDay,t);
      }
    }
    int maxNum=0;
    int day=-1;
    for(int i = 1; i <= maxDay; i++){
      if(cnts[i]>=q){
	if(maxNum<cnts[i]){
	  maxNum=max(maxNum,cnts[i]);
	  day=i;
	}
      }
    }
    if(day!=-1)
      cout<<day<<endl;
    else
      cout<<0<<endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
int main(){
 char p[101],s[101];
 int i=0,j=0,k=0,l=0,m=0;
 int ans=0;
 for(i=0; i<101; i++){ 
  scanf("%c",&s[i]);
   if(s[i]=='\n')break;
 }
 for(j=0; j<101; j++){
   scanf("%c",&p[j]);
   if(p[j]=='\n')break;
 }
 for(k=0;k<i;k++){
   if(s[k]==p[0]){
     for(l=0; l<j; l++){ 
      m=k+l;
       if(m>=i)m-=i;
       if(s[m]!=p[l])break;
       if(l==j-1)ans=1;
     }
   }
 }
 if(ans)printf("Yes\n");
 else printf("No\n");
 return 0;
}



Measured memory_bytes: 2144
#include<iostream>
#include <string>
#include<vector>

using namespace std;

int main(){

	char c;
	cin >> c;
	if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u'){
		cout << "vowel" << endl;
	}
	else{
		cout <<"consonant" << endl;
	}

	return 0;

}

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

int main() {
    double W,H;
    int x,y;
    cin >> W >> H >> x >> y;
    double area = W*H / 2;
    int isCenter;

    if(W == x*2 && H == y*2){
      isCenter = 1;
    } else {
      isCenter = 0;
    }

    cout << area << " " << isCenter << endl;
}

Measured memory_bytes: 256
a1, b1 = map(int,input().split())
a2, b2 = map(int,input().split())
a3, b3 = map(int,input().split())
row = [a1,a2,a3,b1,b2,b3]
c =[0,0,0,0]
for i in row:
	if i == 1:
		c[0] += 1
	elif i == 2:
		c[1] += 1
	elif i == 3:
		c[2] += 1
	else:
		c[3] += 1
	
ans = 0
for i in c:
	if i == 3:
		ans = 1
	elif i == 0:
		ans = 1
		
if ans == 0:
	print("YES")
else:
	print("NO")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[2010][2010];
ll sum[2010][2010];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    ll s[n+1];
    ll t[m+1];
    for(ll i=1;i<=n;i++)
        cin>>s[i];
    for(ll i=1;i<=m;i++)
        cin>>t[i];
    dp[0][0]=1;
    ll p=1000000007;
    for(ll i=1;i<=n;i++)
    {
        dp[i][0]=0;
        sum[i][0]=0;
    }
    for(ll i=1;i<=m;i++)
    {
        dp[0][i]=0;
        sum[0][i]=0;
    }
    sum[0][0]=0;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=m;j++)
        {
            if(s[i]!=t[j])
            {
                dp[i][j]=0;
            }
            else
            {
                dp[i][j]=(sum[i-1][j-1]+1)%p;
            }
            sum[i][j]=(((sum[i-1][j]+sum[i][j-1])%p-sum[i-1][j-1]+p)%p+dp[i][j])%p;
        }
    }
    ll sum=0;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=m;j++)
            sum=(sum+dp[i][j])%p;
    }
    cout<<(sum+1)%p;
}

Measured memory_bytes: 63232
N, T = map(int, input().split())

c = []
for i in range(N):
    ci, ti = map(int, input().split())
    c.append([ci, ti])

c.sort(key=lambda x:x[0])

for i in range(len(c)):
    if c[i][1] <= T:
        print(c[i][0])
        exit()
print('TLE')


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

using namespace std;

int main(){
    string s, t, u;
    int a, b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if(s == u){
        --a;
    }
    if(t == u){
        --b;
    }

    cout << a << " " << b;

    return 0;
}


Measured memory_bytes: 256
// ------------------------------------
// Date:2018/ 2/22
// Problem:ABC 043 UnhappyHacking b.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()

using ll = long long;

int main()
{
  string s;
  vector<int> output;
  cin >> s;
  REP(i,s.size()) {
    if (s[i] == 'B') {
      if (output.size() != 0) output.pop_back();
    } else {
      output.emplace_back(s[i] - '0');
    }
  }
  REP(i,output.size()) {
    cout << output[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a*b%2 == 0) {
            System.out.println("Even");
        } else {
            System.out.println("Odd");
        }

    }
}


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

using namespace std;

const int N = 2e5 + 5;

int n, k, a[N], f[N];

int main(){
    ios::sync_with_stdio(false);
    cin >> n >> k;
    for (int i = 1; i <= n; i++) cin >> a[i], f[i] = f[i - 1] + a[i];
    
    int res = 0;
    for (int i = k; i <= n; i++) {
        res = max(res, (f[i] - f[i - k] + k));
    }
    
    cout << fixed << setprecision(10) << (double)res / 2;
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		System.out.println(a <= c && c <= b ? "Yes" : "No");

		sc.close();

	}

}

Measured memory_bytes: 35432
#include<iostream>
using namespace std;
void printAns(int arr[], int len) {
	using std::cout;
	using std::endl;
	for (int i = 0; i < len; i++)
	{
		if (i)
			cout << " ";
		cout << arr[i];
	}
	cout << endl;
}
int main() {
	int len;
	cin >> len;
	int* arr = new int[len];
	for (int i = 0; i < len; i++)
		cin >> arr[i];

	//insertion sort
	/* for (int i = 0; i < len - 1; i++) {
		printAns(arr, len);
		for (int j = i + 1; j > 0; j--) {
			if (arr[j - 1] > arr[j])
				swap(arr[j - 1], arr[j]);
		}
	}
	printAns(arr, len);*/

	//bubble sort
	/*int step = 0;
	for (int i = 0; i < len - 1; i++) {
		for (int j = len - 1; j > i; j--) {
			if (arr[j] < arr[j - 1]) {
				swap(arr[j], arr[j - 1]);
				step++;
			}
		}
	}
	printAns(arr, len);
	cout << step << endl;*/

	//brush sort (switch time is the same as buble sort)
	/*int step = 0;
	for (int i = 0; i < len - 1 ; i++) {
		if (arr[i] > arr[i + 1]) {
			swap(arr[i], arr[i + 1]);
			step++;
		}
		for(int j=i;j>0;j--){
			if (arr[j] < arr[j - 1]) {
				swap(arr[j], arr[j - 1]);
				step++;
			}
		}
	}
	printAns(arr, len);
	cout << step << endl;*/

	//selection sort
	int t = 0;
	for (int i = 0; i < len - 1; i++) {
		int minp = i;
		for(int j = i+1;j<len;j++)
			if (arr[j] < arr[minp]) 
				minp = j;
		if (minp != i) {
			swap(arr[i], arr[minp]);
			t++;
		}
	}
	printAns(arr, len);
	cout << t << endl;
	return 0;
}


Measured memory_bytes: 3096
while True:
    n, x = map(int, input().split())
    count = 0
    if n == 0 and x == 0:
        break
    for q in range(1, n + 1):
        for w in range(q + 1, n + 1):
            for r in range(w + 1, n + 1):
                total = q + w + r
                if x == total:
                    count += 1
    print(count)


Measured memory_bytes: 5592
//18:50
//
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vv;
string s;
int M=1<<15;
vv mat[26];
vv expr(int &it);
vv m0(int H,int W){
	return vv(H,vi(W,0));
}
vv operator+(vv x,vv y){
	int H=x.size(),W=x[0].size();
	rep(i,H) rep(j,W) x[i][j]+=y[i][j];
	rep(i,H) rep(j,W) x[i][j]%=M;
	return x;
}
vv operator-(vv x,vv y){
	int H=x.size(),W=x[0].size();
	rep(i,H) rep(j,W) x[i][j]-=y[i][j];
	rep(i,H) rep(j,W) x[i][j]%=M;
	return x;
}
vv operator-(vv x){
	int H=x.size(),W=x[0].size();
	rep(i,H) rep(j,W) x[i][j]=-x[i][j];
	return x;
}
vv operator*(vv x,vv y){
	if(x.size()==1&&x[0].size()==1) swap(x,y);
	if(y.size()==1&&y[0].size()==1){
		rep(i,x.size()) rep(j,x[0].size()) x[i][j]=x[i][j]*y[0][0]%M;
		return x;
	}
	int a=x.size(),b=x[0].size(),c=y[0].size();
	vv z=m0(a,c);
	rep(i,a) rep(j,b) rep(k,c) z[i][k]+=x[i][j]*y[j][k];
	rep(i,a) rep(j,c) z[i][j]%=M;
	return z;
}
int num(int &it){
	int x=0;
	while(isdigit(s[it])){
		x*=10;
		x+=s[it]-'0';
		it++;
	}
	return x;
}
vv row(int &it){
	vv x=expr(it);
	while(s[it]==' '){
		it++;
		vv y=expr(it);
		rep(i,x.size()) for(int z:y[i]) x[i].pb(z);
	}
	return x;
}
vv row_seq(int &it){
	vv x=row(it);
	while(s[it]==';'){
		it++;
		vv y=row(it);
		for(auto z:y) x.pb(z);
	}
	return x;
}
vv primary0(int &it){
	if(isdigit(s[it])){
		return vv(1,vi(1,num(it)));
	}
	if(isupper(s[it])){
		return mat[s[it++]-'A'];
	}
	if(s[it]=='('){
		it++;
		vv x=expr(it);
		it++;
		return x;
	}
	if(s[it]=='['){
		it++;
		vv x=row_seq(it);
		it++;
		return x;
	}
}
vv primary(int &it){
	vv x=primary0(it);
	while(s[it]=='('||s[it]=='\''){
		if(s[it]=='('){
			it++;
			vv y=expr(it);
			it++;
			vv z=expr(it);
			it++;
			int H=y[0].size(),W=z[0].size();
			vv nx=m0(H,W);
			rep(i,H) rep(j,W) nx[i][j]=x[y[0][i]-1][z[0][j]-1];
			x=nx;
		}else{
			it++;
			int H=x.size(),W=x[0].size();
			vv nx=m0(W,H);
			rep(i,W) rep(j,H) nx[i][j]=x[j][i];
			x=nx;
		}
	}
	return x;
}
vv factor(int &it){
	bool m=0;
	while(s[it]=='-') it++,m=!m;
	vv x=primary(it);
	if(m) x=-x;
	return x;
}
vv term(int &it){
	vv x=factor(it);
	while(s[it]=='*'){
		it++;
		vv y=factor(it);
		x=x*y;
	}
	return x;
}
vv expr(int &it){
	vv x=term(it);
	while(s[it]=='+'||s[it]=='-'){
		if(s[it]=='+'){
			it++;
			vv y=term(it);
			x=x+y;
		}else{
			it++;
			vv y=term(it);
			x=x-y;
		}
	}
	return x;
}
void assignment(){
	getline(cin,s);
	int id=s[0]-'A';
	int it=2;
	mat[id]=expr(it);
	int H=mat[id].size(),W=mat[id][0].size();
	rep(i,H){
		rep(j,W){
			cout<<(mat[id][i][j]%M+M)%M;
			if(j==W-1) puts("");
			else cout<<" ";
		}
	}
}
int main(){
	while(true){
		int N;
		cin>>N;
		if(N==0) break;
		getline(cin,s);
		rep(i,N) assignment();
		puts("-----");
	}
}

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

int main(){
  int i,j,k;
  int x,y;
  int inf = 1 << 10;
  int m[200]={};
  int memo[1000005]={};
  int memo2[1000005]={};
  vector <int>  odd;
  fill(memo,memo+1000005,inf);
  fill(memo2,memo2+1000005,inf);
  for(i=1;i<201;i++) {
    m[i-1]=i*(i+1)*(i+2)/6;
    if(m[i-1]%2==1) odd.push_back(m[i-1]);
  }
  memo[0]=0;
  for(i=0;i<200;i++) {
    for(j=m[i];j<1000005;j++){
      memo[j]=min(memo[j],memo[j-m[i]]+1);
    }
  }
  memo2[0]=0;
  for(i=0;i<odd.size();i++) {
    for(j=odd[i];j<1000005;j++){
      memo2[j]=min(memo2[j],memo2[j-odd[i]]+1);
    }
  }
  int n;
  cin >> n;
  while(n!=0){
    cout << memo[n] << " " <<  memo2[n] << endl;
    cin >> n;
  }
  return 0;
}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1001001000;

int main(){
   int a[5];
   rep(i,5)cin>>a[i];
   int k;cin >> k;
   for(int i=0;i<5;i++){
      for(int j=i+1;j<5;j++){
         if(a[j]-a[i] > k){
            cout << ":(";
            return 0;
         }
      }
   }
   cout << "Yay!";
   return 0;
}

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

int main() {
  unsigned long long N;
  std::cin >> N;
  unsigned in;
  unsigned long long ans = 1;
  unsigned long long del = 1;
  for (unsigned i = 0; i < N; ++i) {
    ans *= 3;
    std::cin >> in;
    if (in % 2 == 0) {
      del *= 2;
    }
  }
  std::cout << ans - del << std::endl;
  return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll A,B; cin >> A  >> B;
    ll n = 1;
    while(n < B){
        n += A-1;
        res++;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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

using namespace std;

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

  vector< int > A(N), B(N), C(N);

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

  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());

  long long int ans = 0;
  for(int i = 0; i < N; i++) {
    long long int tmpA = upper_bound(A.begin(), A.end(), B[i] - 1) - A.begin();
    long long int tmpC = C.end() - lower_bound(C.begin(), C.end(), B[i] + 1);
    ans += tmpA * tmpC;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1408
n = input()
d = [int(input()) for i in range(int(n))]

d.sort(reverse=True)

#重複する数値ペアの数をカウントして，nから引けばいい
dupe = 0
for i in range(len(d)-1):
    if d[i] == d[i+1]:
        dupe += 1

print(int(n)-dupe)


Measured memory_bytes: 2940
#include<stdio.h>
#define INF 10000000
void warshall_floyd(void);
int min(int,int);
long long graph[101][101];
int n,c,d;

int main(void){
  int k,i,j,x,e,a,b;

  while(1){

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

    for(i=0;i<=n;i++)
      for(j=0;j<=n;j++)
	graph[i][j] = (i==j?0:INF);

    if(n==0 && k==0)break;
    
    for(i=0;i<k;i++){
      scanf("%d",&x);
      
      if(x){

	scanf("%d %d %d",&c,&d,&e);
	if(graph[c][d]>e){
	graph[c][d]=graph[d][c]=e;
	warshall_floyd();
	}
      }
      else{
	scanf("%d %d",&a,&b);
	if(graph[a][b]<INF)printf("%d\n",graph[a][b]);
	else printf("-1\n");
      }

    }

  }
  
  return 0;
}

void warshall_floyd(void){
  int i,j;

    for(i=1;i<=n;i++){
      for(j=1;j<=n;j++){
	graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
	graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][d]+graph[d][c]+graph[c][j]);
      }
    }
}

int min(int x,int y){
  return (x<y)?x:y;
}

Measured memory_bytes: 496
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(ll i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int sum[20][100001];
int dp[1 << 20];
int main() {
	int n, m; scanf("%d%d", &n, &m);
	rep(i, n) {
		int a; scanf("%d", &a);
		sum[a - 1][i + 1]++;
	}
	rep(i, m) {
		for (int j = 1; j <= n; j++)sum[i][j] += sum[i][j - 1];
	}
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	rep(i, 1 << m) {
		int p = 0;
		rep(j, m) {
			if (i >> j & 1)p += sum[j][n];
		}
		rep(j, m) {
			if (i >> j & 1)continue;
			int up = sum[j][n];
			up -= sum[j][p + sum[j][n]] - sum[j][p];
			dp[i | 1 << j] = min(dp[i | 1 << j], dp[i] + up);
		}
	}
	printf("%d\n", dp[(1 << m) - 1]);
}

Measured memory_bytes: 15096
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> a = new ArrayList<>();
        int total = 0;
        ArrayList<Integer> aa = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int tmp = sc.nextInt();
            a.add(tmp);
            total += tmp;
            if(tmp % 10 != 0) {
                aa.add(tmp);
            }
        }
        if(total % 10 != 0) {
            System.out.println(total);
        } else {
            int min = 0;
            if(aa.size() > 0) {
                min = Collections.min(aa);
                System.out.println(total - min);
            } else {
                System.out.println(0);
            }
        }
    }
}

Measured memory_bytes: 36092
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#define N 402
using namespace std;
typedef long long ll;
const ll mod = 1000000007LL;
int n, c;
int a[N], b[N];
ll cnt[N][N];
ll dp[N][N];
int main() {
  cin>>n>>c;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &b[i]);
  }
  memset(cnt, 0, sizeof(cnt));
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i <= c; ++i) {
    for (int j = 1; j <= 400; ++j) {
      ll pw = 1LL;
      for (int k = 1; k <= i; ++k) {
        pw = pw * (ll)j % mod;
      }
      cnt[i][j] = (cnt[i][j-1] + pw) % mod;
    }
  }
  for (int i = 0; i <= c; ++i) {
    dp[1][i] = (cnt[i][b[1]]-cnt[i][a[1]-1]+mod)%mod;
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j <= c; ++j) {
      for (int k = 0; j + k <= c; ++k) {
        dp[i+1][j+k] = (dp[i+1][j+k] + dp[i][j]*((cnt[k][b[i+1]]-cnt[k][a[i+1]-1]+mod)%mod)%mod) % mod;
      }
    }
  }
  cout<<dp[n][c]<<endl;
  return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;

int main(){
    ll N;
    cin >> N;
    ll M;
    cin >> M;
    vector<vector<ll>> A(N, vector<ll>(M, 0));
    for(ll i=0;i<N;i++){
     for(ll j=0;j<M;j++){
         cin>>A[i][j];
         A[i][j]--;
     ;}
    ;}

    ll ans=INF;

    //問題が残ってたら１
    vector<bool> check(M,1);
    for(ll i=0;i<M;i++){
        //人数カウンター、問題ごと(人数、問題番号)
        vector<P> counter(M);
        for(ll j=0;j<M;j++){
            counter[j]=P(0,j)
        ;}
        for(ll k=0;k<N;k++){
            for(ll l=0;l<M;l++){
                if(check[A[k][l]]){
                    counter[A[k][l]].first++;break;
                }
            }
        }
        sort(counter.rbegin(), counter.rend());
        ans=min(ans,counter[0].first);
        check[counter[0].second]=0;
    ;}
    cout<<ans<<endl;

    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split();
        var A = long.Parse(input[0]);
        var B = long.Parse(input[1]);
        var K = long.Parse(input[2]);

        if (K <= A)
        {
            Console.WriteLine(A - K + " " + B);
        }
        else
        {
            Console.WriteLine("0 " + Math.Max(0, (B - (K - A))));
        }
    }
}


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

#define ll long long
const int MOD = 1e9 + 7;
#define INF 2e9

#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

#define MATCH(_str, _ptn) regex_match(_str, regex(_ptn))
#define REPLACE(_str, _ptn, _replacement) regex_replace(_str, regex(_ptn), _replacement)

# define pb push_back

# define INIT() cin.tie(0); ios::sync_with_stdio(false); cout << fixed << std::setprecision(20)

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

ll h,w,k,result;
string s;
int main() {
    INIT();

    cin >> h >> w >> k;
    vector<vector<char>> c(h, vector<char>(w));
    REP(i,h) {
        REP(j,w) {
            cin >> c[i][j];
        }
    }
    
    for(int bi = 0; bi < (1 << h); bi++) {
        bitset<6> hset(bi);
        for(int bj = 0; bj < (1 << w); bj++) {
            bitset<6> wset(bj);
            int cnt = 0;
            REP(i,h) {
                if(hset[i]) continue;
                REP(j,w) {
                    if(!wset[j] && c[i][j] == '#') cnt++;
                }
            }
            if(cnt == k) result++;
        }
        
    }
    
    cout << result;
}

Measured memory_bytes: 3656
a = int(input())
sum = 0
list_number = []
for i in range(a):
    list_number.append(i + 1)
for i in list_number:
    if i % 3 == 0 and i % 5 == 0:
        pass
    elif i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        sum = sum + i
print(sum)

Measured memory_bytes: 48512
n = int(input())
a = list(map(int, input().split()))
a.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if a[i] < a[j] < a[k] and a[k] < a[i] + a[j]:
                ans += 1

print(ans)

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

int main() {
  int n;
  string s,t;
  cin>>n>>s>>t;
  int cnt=0,ans=0;
  
  for(int i=0;i<n;i++){
    if(t.substr(0,n-i)==s.substr(i,n-i)){
      cout<<n+i;
      return 0;
    }
  }
  
  cout<<2*n;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<set>
#include<ctime>
#include<vector>
#include<stack>
#include<map>
using namespace std;
typedef long long ll;

int ck[128];

int main(){
    ios::sync_with_stdio(0); cin.tie(0), cout.tie(0);
    string s,ss; cin >> s;
    ss = s;
    if(s.size()==26){
      if(s=="zyxwvutsrqponmlkjihgfedcba") cout << -1;
      else{
        next_permutation(s.begin(),s.end());
        for(int i = 0 ; i < 26 ; i++){
          cout << s[i];
          if(s[i]!=ss[i]) return 0;
        }
      }
    }
    else{
      for(auto i : s) ck[i]++;
      cout << s;
      for(int i = 'a' ; ; i++){
        if(!ck[i]){
          cout << (char)i;
          return 0;
        }
      }
    }
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	A := make([][]int, n)
	for i := range A {
		A[i] = make([]int, m)
		for j := range A[i] {
			fmt.Scan(&A[i][j])
		}
	}
	B := make([]int, m)
	for i := range B {
		fmt.Scan(&B[i])
	}
	// fmt.Println(A, B)
	ans := make([]int, n)
	for i := 0; i < len(A); i++ {
		for j := 0; j < len(A[i]); j++ {
			ans[i] += A[i][j] * B[j]
		}
	}
	for i := 0; i < len(ans); i++ {
		fmt.Println(ans[i])
	}
}




Measured memory_bytes: 1812
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

ans = 0
for i in range(N):
    if a[i] <= x:
        ans += 1
        x -= a[i]
        if i == N - 1 and x != 0:
            ans -= 1
    
print (ans)

Measured memory_bytes: 3060
n = gets.to_i
mon = gets.split.map(&:to_i)
hero = gets.split.map(&:to_i)

cnt = 0
for i in 0...n
    x = [mon[i], hero[i]].min
    cnt += x
    rest = hero[i] - x

    y = [mon[i+1], rest].min
    cnt += y
    mon[i+1] -= y
end

puts cnt


Measured memory_bytes: 19612
import sys
s = input()

flag = False
ans = ""
for i in range(len(s)):
    if i + 3 <= len(s) and s[i] == s[i+2]:
        print("{0} {1}".format(i+1, i+3))
        sys.exit()
    elif i + 2 <= len(s) and s[i] == s[i+1]:
        print("{0} {1}".format(i+1, i+2))
        sys.exit()

print("-1 -1")
    

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

int main()
{
	int64_t n;
	cin >> n;
	vector<string> ss(n);
	for (auto &&s : ss)
	{
		cin >> s;
	}

	set<string> st;
	for (auto &&s : ss)
	{
		st.insert(s);
	}

	cout << st.size() << endl;

	return 0;
}

Measured memory_bytes: 25004
#include<bits/stdc++.h>
using namespace std;
template<typename T>
bool chmin(T &a,T b){
    if(a<=b)return 0;
    a=b;
    return 1;
}

class dijekstra{
public:
    struct edge{int v, dist;};
    struct state{
        int v,cost;
        bool operator>(const state s) const { return cost>s.cost;}
    };
    const int INF = 1e9+7;
    int N;
    vector<vector<edge>> E;

    dijekstra(int n): N(n),E(n){}

    void add_edge(int u,int v,int d){
        E[u].push_back((edge){v,d});
        // E[v].push_back((edge){u,d});
    }

    vector<int> sp(int s){
        vector<int> dp(E.size(),INF);
        priority_queue<state,vector<state>,greater<state>> q;
        q.push((state){s,0});
        while(q.size()){
            int v=q.top().v, cost = q.top().cost;
            q.pop();
            if(dp[v] <= cost) continue;
            dp[v] = cost;
            for(int i=0;i<E[v].size();i++){
                int nv = E[v][i].v, ncost = cost+E[v][i].dist;
                if(dp[nv] > ncost)q.push((state){nv,ncost});
            }
        }
        return dp;
    }
};

vector<vector<array<int,4>>> v;

signed main(){
    //ofstream cout("out.txt");

    int n,m,h,k;
    while(cin>>n>>m>>h>>k){
        if(n==0)break;
        h++;
        v = vector<vector<array<int,4>>>(n);
        for(int i=0;i<m;i++){
            int a,b,c,d,r;
            cin>>a>>b>>c>>d>>r;
            a--,b--,r--;
            v[a].push_back({b,c,d,r});
            v[b].push_back({a,c,d,r});
        }
        int ss,tt,p;
        cin>>ss>>tt>>p;
        ss--,tt--;
        vector<int> ps(p);
        int d[p];
        for(int i=0;i<p;i++){
            int l;
            cin>>l>>d[i];
            for(int j=0;j<l;j++){
                int a;
                cin>>a;
                a--;
                ps[i] += (1<<a);
            }
        }
        int ans = 1e9+7;
        int dp[(1<<k)];
        for(int i=0;i<(1<<k);i++)dp[i] = 1e9+7;
        dp[0] = 0;
        for(int bit=0;bit<(1<<k);bit++){
            for(int i=0;i<p;i++){
                chmin(dp[bit|ps[i]], dp[bit]+d[i]);
            }
        }
        for(int bit=0;bit<(1<<k);bit++){
            if(dp[bit] > 1e9)continue;
            dijekstra dij(h*n);
            for(int i=0;i<n;i++){
                for(auto e:v[i]){
                    int to=e[0],cost=e[1],t=e[2],r=e[3];
                    if(bit&(1<<r)){
                        for(int y=0;y<h;y++){
                            if(y+t<h) dij.add_edge(i+y*n,to+(y+t)*n,0);
                            else break;
                        }
                    }
                    else{
                        for(int y=0;y<h;y++){
                            if(y+t<h) dij.add_edge(i+y*n,to+(y+t)*n,cost);
                            else break;
                        }
                    }
                }
            }

            vector<int> dist = dij.sp(ss);
            for(int i=0;i<h;i++){
                chmin(ans,dist[tt+i*n]+dp[bit]);
            }
        }
        if(ans>1e9)ans=-1;
        cout << ans << "\n";
    }
}


Measured memory_bytes: 3476