akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

using ll =  long long;
using pint =  pair<int,int>;

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義(使うときはINFも書き換えろ!!)
//#define int long long
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  string s;cin>>s;
  string day[7]={"MON","TUE","WED","THU","FRI","SAT","SUN"};

  rep(i,7){
    if(s==day[i]&&s=="SUN"){
      cout << 7 << endl;
      return 0;
    }
    if(s==day[i]){
      cout << 7-(i+1) << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

int main() {
    cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(20);

    ll N;
    cin >> N;
    vll a(N);
    rep(i,N) cin >> a[i];
    const ll NX = 1100000;
    vll cnt(NX, 0);
    rep(i,N) {
        if(cnt[a[i]] > 0) {
            cnt[a[i]]++;
            continue;
        }
        for(ll j = a[i]; j < NX; j += a[i]) cnt[j]++;
    }

    ll ans = 0;
    rep(i,N) if(cnt[a[i]] == 1) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 13476
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
using namespace std;

int main()
{
    long long int N, K;
    scanf("%lld %lld", &N, &K);

    long long int block = (N - 1) / (K - 1);
    long long int amari = (N - 1) % (K - 1);

    printf("%d", block + (amari == 0 ? 0 : 1));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,m,k;
 bool isvalid(ll i, ll j) { return i >=0  && i < n && j >=0 && j < m; }
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
      cin>>n>>m>>k;
      int x1,y1,x2,y2;
      cin>>x1>>y1>>x2>>y2;
      x1--;y1--;
      x2--;y2--;
      vector< vector<char> > g(n,vector<char>(m));
    vector< vector<int> > dist(n,vector<int>(m,1<<30));
      for(int i=0;i<n;i++){
          for(int j=0;j<m;j++){
              cin>>g[i][j];
          }
      }
      queue< pair<int,int> > q;
      dist[x1][y1]=0;
     // bool vis[n][m]={false};
      q.push({x1,y1});
      //vis[x1][y1]=true;
      int dr[4][2]={{-1,0},{1,0},{0,1},{0,-1}};
      while(!q.empty()){
          pair<int,int> u;
          u=q.front();
          q.pop();
          for(int i=0;i<4;i++){
              for(int j=1;j<=k;j++){
              int nx = u.first + j*dr[i][0];
              int ny = u.second + j*dr[i][1];
              if(isvalid(nx,ny) && g[nx][ny]=='.' && (dist[nx][ny]==1<<30 || dist[nx][ny]==(dist[u.first][u.second]+1))){
                //  vis[nx][ny]=true;
                  if(dist[nx][ny]==1<<30){
                      dist[nx][ny]=dist[u.first][u.second]+1;
                      q.push({nx,ny});
                  }
                  }
                  else break;
          }}
      }
      if(dist[x2][y2]==1<<30) cout<<-1<<"\n";
      else cout<<dist[x2][y2]<<"\n";
}

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

int main() {
	int S, h, m, s;
	cin >> S;
	h = S / 3600;
	m = S / 60 - h * 60;
	s = S - h * 3600 - m * 60;
	cout << h << ":" << m << ":" << s << endl;
}


Measured memory_bytes: 3096
import itertools
n = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
l = []
for i in range(n):
    l.append(i+1)
i = 1

for r in itertools.permutations(l, n):
    if P == list(r):
        a = i
    if Q == list(r):
        b = i
    i += 1

print(abs(a-b))

Measured memory_bytes: 3064
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int dp[100001],h[100001];
int main()
{

    int n;cin>>n;
    for(int i=1;i<=n;i++)cin>>h[i];

    dp[1] = 0;
    dp[2] = abs(h[1] - h[2]);
    for(int i=3;i<=n;i++){
            int a,b;
            a = dp[i-1] +  abs(h[i-1] - h[i]);
            b= dp[i-2] + abs(h[i-2] - h[i]);

        dp[i] = min (a,b);


    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int selection_sort(int n, int *a)
{
	int i, j, minj, x;
int ans = 0;

	for (i = 0; i < n; i++) {
		minj = i;
		for (j = i; j < n; j++) {
			if (a[j] < a[minj]) minj = j;
		}
		if (i != minj) {
			x = a[i], a[i] = a[minj], a[minj] = x;
ans++;
		}
	}
return ans;
}

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

int a[102];

int main()
{
	int N, i, k;

	N = in();
	for (i = 0; i < N; i++) a[i] = in();
	k = selection_sort(N, a);
	printf("%d", a[0]);
	for (i = 1; i < N; i++) printf(" %d", a[i]);
	putchar('\n');
	printf("%d\n", k);
	return 0;
}


Measured memory_bytes: 2144
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <iostream>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
using namespace std;

int main ()
{
	int a,b;
	scanf("%d%d",&a,&b);
	if (a%3==0 || b%3==0 || (a+b)%3==0 )
		printf("Possible\n");
	else
		printf("Impossible\n");

	return 0;
}

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

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            int i=0,sum=0;
            
            while ((line = br.readLine()) != null) {
            	int a=Integer.parseInt(line);
            	if(a<40){
            		a=40;
            	}
            	sum+=a;
            	i++;
            	if(i==5){
            		break;
            	}
            }
            System.out.println(sum/5);
        }
    }

}

Measured memory_bytes: 24388
n = int(input())
S = sorted(int(input()) for i in range(n))
ans = sum(S)
cnt = 0
for i in range(n):
  if ans % 10 == 0:
    if S[i] % 10 != 0:
      ans -= S[i]
    else:
      cnt += 1
if cnt == n:
  print(0)
else:
  print(ans)

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

int main()
{
    int a[3];
    cin >> a[0] >> a[1] >> a[2];

    int tmp;
    for(int i=0 ; i<3 ; ++i){
        for(int j=i+1 ; j<3 ; ++j){
            if(a[i]<a[j]){
                 tmp = a[i];
                 a[i] = a[j];
                a[j] = tmp;
            }
           
        }
    }

    cout << a[0]-a[2] << endl;

    return 0;
}

Measured memory_bytes: 256
/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define all(vec) vec.begin(),vec.end()
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"Case #"<<x<<":"
#define pi 3.14159265358979323846264338327950L

const ll mod = 1e9+7;
const ll inf = 1e18;


void virus(){
          ll a, b, c, d;
          cin>>a>>b>>c>>d;
          cout<<max({a*c, b*c, a*d, b*d})<<endl;
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t = 1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
           cerr << "\n Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

Measured memory_bytes: 3660
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			if (numN % 2 == 0) {
				System.out.println(numN);
			} else {
				System.out.println(numN * 2);
			}

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			int[] wk = new int[numN];

			for (int i = 0; i < wk.length; i++) {
				wk[i] = scanner.nextInt();
			}
			Arrays.sort(wk);

			System.out.println(wk[wk.length - 1] - wk[0]);

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define prique priority_queue
int n,m;
int ans;
int memo[200000];
int f(int x){
    if(x==1)return 1;
    if(memo[x])return memo[x];
    return memo[x]=(f(x-1)*x)%mod;
}
signed main(){
    cin>>n>>m;
    if(n==m){
        ans=(f(n)*f(m)*2)%mod;
    }
    else if(abs(n-m)==1){
        ans=(f(n)*f(m))%mod;
    }
    else ans=0;
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;
 
int main ()
{
  prep();
  int n;
  cin >> n;
  int arr[n];
  for (int i=0; i<n; i++){
      cin >> arr[i];
  }
  int cur = 1;
  for (int i=0; i<n; i++){
      if (arr[i] == cur){
          cur++;
      }
  }
  cur--;
  if (cur == 0){
      cout << -1;
  }else{
      cout << n-cur;
  }
  return 0; 
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

const int INF = 1<<28;
struct ID{
  map<string, int> maker;
  int get(string s){
    int n = maker.size();
    if(maker.count(s)) return maker[s];
    else return maker[s] = n;
  }
};
struct edge{
  int from, to, cost;
  edge () {}
  edge(int from, int to, int cost) :
    from(from), to(to), cost(cost) {}
  bool operator < (const edge& r) const {
    return cost != r.cost ? cost > r.cost : from != r.from ? from < r.from : to < r.to;
  }
};

typedef vector<edge> edges;
typedef vector<edges> graph;

vector<int> dijkstra(const graph& g, int s){
  int n = g.size();
  vector<bool> visit(n, false);
  vector<int> dist(n, INF);
  vector<int> src(n, -1);
  priority_queue<edge> que;
  que.push(edge(-1, s, 0));
  while(!que.empty()){
    edge e = que.top(); que.pop();
    if(visit[e.to]) continue;
    visit[e.to] = true;

    int from = e.to;
    REP(i, g[from].size()){
      int to = g[from][i].to;
      int ncost = e.cost + g[from][i].cost;
      if(visit[to] || ncost >= dist[to] ) continue;
      dist[to] = ncost;
      src[e.to] = from;
      que.push(edge(from, to, ncost));
    }
  }
  return dist;
}

int main(){
  int n,m;
  while(cin>>n>>m,n){
    graph G(n);
    string s,p,g;
    cin>>s>>p>>g;
    ID id;
    id.get(s);
    id.get(p);
    id.get(g);
    REP(i,m){
      string A,B;
      int ds,t;
      cin>>A>>B>>ds>>t;
      int dist = ds/40 + t;
      int na = id.get(A);
      int nb = id.get(B);
      G[na].push_back(edge(na, nb, dist));
      G[nb].push_back(edge(nb, na, dist));
    }
    vector<int> dist = dijkstra(G, 1);
    cout<<dist[0] + dist[2]<<endl;
  }
  return 0;
}

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

int main() {
  int N ;
  int a = 1;
  cin >> N ;
  vector<int>v(N);

  for(int i = 0; i < N ; i++ ){
    cin >> v.at(i);
  }
  
  for(int i = 0; i < N ; i++ ){
    a = v.at(a-1);
    if(i == N-1){
      cout << -1 << endl;
    }else if (a == 2){
      cout << i + 1 << endl;
      break;
    }
  }
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int x;
	cin>>x;
	int l=0;
	char c[100];
	while(x>0)
	{
		if(x%26==0)
		c[l]=x%26+'a'-1+26;
		else
			c[l]=x%26+'a'-1;
	if(x%26==0)
		x=(x/26-1);
		else
		x/=26;
		l++;
	}
	for(int i=l-1;i>=0;i--)
	cout<<c[i];
	
}

Measured memory_bytes: 3636
#include<cstdio>
#include<vector>
#include<algorithm>
#define INF 2100000000
#define MAXN 100006
using namespace std;
vector<int> road[MAXN];
int v[MAXN],k,minline[MAXN],cnt,n,m,block[MAXN],minone[MAXN],a,b;
long long ans;
bool vis[MAXN];
void DFS(int x,int co)
{
	block[x]=co;
	if(v[minone[co]]>v[x]) minone[co]=x;
	for(int i=0;i<(int)road[x].size();i++)
	{
		int nex=road[x][i];
		if(block[nex]) continue;
		DFS(nex,co);
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",&v[i]);
	v[0]=INF;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&a,&b);
		a++;
		b++;
		road[a].push_back(b);
		road[b].push_back(a);
	}
	for(int i=1;i<=n;i++)
		if(!block[i]) DFS(i,++k);
	if(k==1)
	{
		printf("0");
		return 0;
	}
	if(k*2-2>n)
	{
		printf("Impossible");
		return 0;
	}
	for(int i=1;i<=k;i++)
	{
		ans+=1ll*v[minone[i]];
		vis[minone[i]]=1;
	}
	for(int i=1;i<=n;i++)
		if(!vis[i]) minline[++cnt]=v[i];
	sort(minline+1,minline+1+cnt);
	for(int i=1;i<=k-2;i++)
		ans+=1ll*minline[i];
	printf("%lld",ans);
}

Measured memory_bytes: 7040
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        k: usize,
        a: usize,
        b: usize
    }
    if a % k == 0 || b % k == 0 || a / k < b / k {
        println!("OK");
    } else {
        println!("NG");
    }
}


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

int main() {
  int A,B,n,m,l;
  A=0;
  int N,K;
  string S;
  cin >> N >> K >> S;

  
  vector<int>a(N);
  vector<int>b(N-1);
  for(int i=0;i<(N-1);i++){
    if(S.at(i)!=S.at(i+1)){
      n++;
    }else{
      m++;
    }
  }
  l=n/2;
  
  if(l>=K){
    A=m+2*K;
  }else{
    A=m+n;
  }
  
cout << A << endl;


}

Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int n;
	
	cin>>n;
	
	cout<<n*n<<endl;
	
	
	return 0;
}

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

int main(){
  int a,b,c,d,e,f,g,h,i,j,k,array[100001];
  string s,array1[100001];
  cin>>s>>a;
  for(i=0;i<s.size();i+=a){
    cout<<s[i];
  }
  cout<<endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; ++i) cin >> a.at(i);
  
  sort(a.begin(), a.end());
  
  cout << a.at(N - 1) - a.at(0) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define ggr getchar(); getchar();return 0;
#define ll long long
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

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

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, m, x[14], s[14][14], p[14];
int bit = 1;
int ta[14];
bool bl;
int ans;

signed main() {
	cin >> n >> m;
	rep(i, m) {
		cin >> x[i];
		rep(j, x[i]) {
			cin >> s[i][j];
		}
	}
	rep(i, m)cin >> p[i];
	rep(i, n)bit *= 2;
	bit;
	rep(i, bit) {
		int mu = i;
		rep(j, n) {
			if (mu & (1 << j)) {
				rep(k, m) {
					rep(l, x[k]) {
						if (s[k][l] == j + 1)ta[k]++;
					}
				}
			}
		}
		
		bl = true;
		rep(j, m) {
			if (ta[j] % 2 != p[j])bl = false;
			ta[j] = 0;

		}
		if (bl) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import Control.Monad
import Data.Array
main = do
  n <- readLn :: IO Int
  bfrv <- replicateM n $ return . map (read :: String->Int) . words =<< getLine
  showArray $ foldr addArray (makeArray [0..]) (map makeArray bfrv)

addArray arr1 arr2 = array ((1,1,1),(4,3,10)) [((b,f,r), (arr1!(b,f,r)) + (arr2!(b,f,r))) |b<-[1..4],f<-[1..3],r<-[1..10]]
makeArray bfrv =  array ((1,1,1),(4,3,10)) [((b',f',r'), if b==b' && f==f' && r==r' then v else 0)|b'<-[1..4],f'<-[1..3],r'<-[1..10]]
  where b:f:r:v:_ = bfrv
showArray arr = do
  forM_ [1..4] $ \b -> do
    forM_ [1..3] $ \f -> do
      putStr " "
      forM_ [1..10] $ \r -> do
        putStr $ show $ arr!(b,f,r)
        putStr $ if r/=10 then " " else ""
      putStrLn ""
    if b==4 then (return ()) else (putStrLn ['#'|i<-[1..20]])


Measured memory_bytes: 12688
#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;
int a[123456], n, ans; string s;
signed main() {
	cin >> n; for0(i, n) { cin >> a[i]; ans += a[i]; }
	sort(a, a + n);
	cout << (ans - a[n - 1] > a[n - 1] ? "Yes\n" : "No\n");
}

Measured memory_bytes: 256
#include <queue>
#include <vector>
#include <iostream>
using namespace std;
int N;
int D[110];
int G[110][110];
void bfs(int src){
	queue<int> Q;
	Q.push(src);
	D[src] = 0;
	while(!Q.empty()){
		int cur = Q.front();
		Q.pop();
		for(int i=0;i<N;i++){
			if(G[cur][i] && D[i]==0){
				D[i] = D[cur]+1;
				Q.push(i);
			}
		}
	}
	for(int i=0;i<N;i++){
		if(i!=src && D[i]==0) D[i]=-1;
	}
	D[src]=0;
}

int main(){
	while(cin >> N && N>0){
		vector<vector<int> > g(110,vector<int>(110,0));
		int u,k;
		for(int i=0;i<N;i++){
			cin >> u >> k;
			for(int j=0;j<k;j++){
				int a;
				cin >> a;
				g[u-1].push_back(a); 
			}
		}
		for(int i=0;i<N;i++){
			for(int j=0;j<g[i].size();j++){
				int f = g[i][j];
				G[i][f-1] = 1;
			}
		}
		bfs(0);
		for(int i=0;i<N;i++){
			cout << i+1 << " " << D[i] << endl;
		}
	}
}

#if 0
無限ループに陥らないようにするのに少し苦労した。プログラム上では番号を0から始めたのもよくないかもしれない。
#endif


Measured memory_bytes: 3284
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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

    int x,y; cin >> x >> y;

    for(int i = 0;i < x+1;i ++){
        if(i * 2 + (x - i) * 4 == y){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}

Measured memory_bytes: 3652
#include <stdio.h>

int main(void) {
  int c, a, b, x, ans = 0, i, j, k;
  scanf("%d%d%d%d", &a, &b, &c, &x);
  x /= 50;
  for(i = 0; i <= a; ++i) {
    for(j = 0; j <= b; ++j) {
      for(k = 0; k <= c; ++k) {
        if(k + 2 * j + i * 10 == x) ++ans;
      }
    }
  }
  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CHSI solver = new CHSI();
        solver.solve(1, in, out);
        out.close();
    }

    static class CHSI {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();
            out.println((1900 * m + 100 * (n - m)) * (1 << m));
        }

    }
}



Measured memory_bytes: 22608
#include <iostream>
#include <string>

using namespace std;

int main(){
    int N, count = 0;
    cin >> N;
    long long array[N];
    for(int i = 0; i < N; i++){
        cin >> array[i];
    }
    bool flag = true;
    while(flag){
        for(int i = 0; i < N; i++){
            if(array[i] % 2 != 0){
                flag = false;
                break;
            }
            else{
                array[i] /= 2;
                count++;
            }
        }
    }
    cout << count / N << endl;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, ans = 1e9;
int A[18], B[18];
int DP[int(1e6)][51], Bit[20];

int make_cnt(int num){
  int ans = 0, now = num;
  while (now > 0){
    ans += now % 2; now /= 2;
  }
  return ans;
}

int Solve(int num){
  int cnt = make_cnt(num);

  for (int j = 0; j <= 50; j++){
    if (DP[num][j] == 1e9) continue;

    for (int i = 0; i < N; i++){
      int judge = Bit[i] & num;
      if (judge > 0) continue;

      int order = 0;
      for (int k = 0; k < i; k++){
        judge = num & Bit[k];
        if (judge == 0) order++;
      }

      int next = num | Bit[i];
      if ((cnt-i) % 2 == 0 && j <= A[i]){
        DP[next][A[i]] = min(DP[next][A[i]], DP[num][j] + order);
      }else if ((cnt-i) % 2 != 0 && j <= B[i]){
        DP[next][B[i]] = min(DP[next][B[i]], DP[num][j] + order);
      }
    }
  }

  return 0;
}


int main(){
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) cin >> B[i];
  Bit[0] = 1;
  for (int i = 1; i <= N; i++) Bit[i] = Bit[i-1] * 2;

  fill((int*)DP, (int*)(DP+Bit[N]+1), 1e9);
  DP[0][0] = 0;

  for (int i = 0; i < Bit[N]; i++) Solve(i);

  for (int i = 0; i <= 50; i++){
    ans = min(ans, DP[Bit[N] - 1][i]);
  }
  if (ans == 1e9) ans = -1;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 55928
/**
 * @author yuzining
**/
#ifdef local
#include "D:\vscode\acm\local.hpp"
#else
#include<bits/stdc++.h>
using namespace std;
#define debug(...) do { } while(false)
void Main();
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main();
  return 0;
}
#endif

void Main() {
  int n; cin >> n;
  vector<long long> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), [&](const long long &x, const long long &y) {
    return x > y;
  });
  long long ans = 0;
  for(int i = 1; i < n; i++) {
    ans += a[i / 2];
  }
  cout << ans << '\n';
}

Measured memory_bytes: 4764
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>

using namespace std;
int main(){
    int N;
    int ans;
    cin >> N;
    if(N/100000 == 1){
        ans = 90909;
    }else if(N/10000 > 0){
        ans = 909 + (10000*((N/10000)-1))+ N%10000 + 1;
    }else if(N/1000 > 0){
        ans = 909;
    }else if(N/100 > 0){
        ans = 9 + (100*((N/100)-1))+N%100 + 1;
    }else if(N/10 > 0){
        ans = 9;
    }else{
        ans = N;
    }
    cout << ans << endl;
}


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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	vector<string> v(h);
	vi x, y;
	REP(i, h)cin >> v[i];
	int sx, sy, tx, ty;
	REP(i, h) {
		REP(j, w) {
			if (v[i][j] == '@') {
				sy = i; sx = j;
			}
			else if (v[i][j] == '$') {
				y.push_back(i); x.push_back(j);
			}
			else if (v[i][j] == '%') {
				ty = i; tx = j;
			}
		}
	}
	int n = x.size();
	vvi mp(h, vi(w, INF));
	mp[ty][tx] = 0;
	queue<pii> q;
	q.push({ tx,ty });
	while (!q.empty()) {
		pii p = q.front(); q.pop();
		REP(i, 4) {
			int nx = p.first + dx[i * 2], ny = p.second + dy[i * 2];
			if (nx >= 0 && ny >= 0 && ny < h&&nx < w&&v[ny][nx]!='#'&&mp[ny][nx]==INF) {
				mp[ny][nx] = mp[p.second][p.first] + 1;
				q.push({ nx,ny });
			}
		}
	}
	int p=mp[sy][sx], s = INF;
	REP(i, n) {
		s = min(s, mp[y[i]][x[i]]);
	}
	if (p < s)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

using namespace std;

typedef long long LL;

const int maxn = 1e5 + 5;

LL a[maxn];
int main(){
	int K;
	cin >> K;
	for(int i = 1;i <= K;i++){
		scanf("%lld",a + i);
	}
	bool flag = 1;
	LL L = 2,R = 2;
	for(int i = K;i >= 1;i--){
		LL l = (L + a[i] - 1) / a[i];
		LL r = R / a[i];
		if(l > r){
			flag = 0;
			break;
		}else{
			L = l * a[i];
			R = (r + 1) * a[i] - 1;
		}
	}
	if(flag){
		cout << L << " " << R << endl;
	}else{
		cout << -1 << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main()
{
    int H,W,i;
    scanf("%d %d",&H,&W);
    char P[H][W+1];
    for(i=0;i<H;i++) scanf("%s",P[i]);
    for(i=0;i<W+2;i++) printf("#");
    puts("");
    for(i=0;i<H;i++) printf("#%s#\n",P[i]);
    for(i=0;i<W+2;i++) printf("#");
    puts("");
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;

const int MAX = 100001;
const int NIL = -1;
struct Node {
	int parent, left, right;
};
struct Node T[MAX];

vector<int> pre, in;
int p = 0, n;
bool ok = false;

void reconstruction(int l, int r)
{
	if (l >= r)
		return;
	int c = pre[p++];
	int m = find(in.begin(), in.end(), c) - in.begin();
	reconstruction(l, m);
	reconstruction(m + 1, r);
	if (ok == true)
		cout << " " << c;
	else {
		cout << c;
		ok = true;
	}
}

int main(void)
{
	int node;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> node;
		pre.push_back(node);
	}
	for (int i = 0; i < n; i++) {
		cin >> node;
		in.push_back(node);
	}
	reconstruction(0, n);
	cout << endl;
	return 0;
}



Measured memory_bytes: 3168
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int M=stdIn.nextInt();
		boolean visit[]=new boolean[N];
		int ball[]=new int[N];
		int ans=0;
		visit[0]=true;
		for(int i=0;i<N;i++){
			ball[i]=1;
		}
		for(int i=0;i<M;i++){
			int x=stdIn.nextInt()-1;
			int y=stdIn.nextInt()-1;
			if(visit[x]){
				visit[y]=true;
			}
			ball[y]++;
			ball[x]--;
			if(ball[x]==0){
				visit[x]=false;
			}
		}
		for(int i=0;i<N;i++){
			if(visit[i])
				ans++;
		}
		System.out.println(ans);
	}
}


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

int main() {
  int n;
  cin >> n;
  if (n%1111==0){
    cout<<"Yes"<<endl;
  }
  else if ((n/10)%111==0){
    cout<<"Yes"<<endl;
  }
  else if ((n%1000)%111==0){
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Slimes | diff Slimes.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Slimes.cpp && ./a.out

/*
 
 10/19/2019
 
 5:06-
 
 */

const int MAX_N=1e6+1;
string S;
int N;

void solve() {
  VI B;
  REP(i,N) if(B.empty()||B.back()!=S[i]) B.push_back(S[i]);
  cout<<SZ(B)<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>S;
  solve();
  
  return 0;
}


Measured memory_bytes: 972
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int a,p;
  cin >> a >> p;
  cout << (3*a+p)/2 << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int 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();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=105;
int a[maxn],n,m;
vector<int> odd,even;
int main(){
	read(n);read(m);
	rep(i,1,m)read(a[i]);
	if(m==1){
		cout<<a[1]<<endl;
		if(a[1]==1){
			cout<<1<<endl;
			cout<<1<<endl;
			return 0;
		}
		cout<<2<<endl;
		cout<<a[1]-1<<' '<<1<<endl;
		return 0;
	}
	rep(i,1,m)if(a[i]&1)odd.pb(a[i]);else even.pb(a[i]);
	if(odd.size()>2){
		puts("Impossible");return 0;
	}
	vector<int> ans;
	if(odd.size()){
		ans.pb(odd[odd.size()-1]);odd.pop_back();
	}
	for(int v:even)ans.pb(v);
	if(odd.size()){
		ans.pb(odd[odd.size()-1]);odd.pop_back();
	}
	vector<int> res;
	res=ans;
	res[0]--;res[res.size()-1]++;
	reverse(res.begin(),res.end());
	if(res[res.size()-1]==0)res.pop_back();
	reverse(res.begin(),res.end());
	for(int v:ans){
		printf("%d ",v);
	}puts("");
	printf("%d\n",res.size());
	for(int v:res){
		printf("%d ",v);
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c,x,y,z,ans;
	scanf("%d %d %d",&a,&b,&c);
	x=a*100;
	y=b*10;
	z=x+y+c;
	if(z%4==0){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//227
	int n,t;
	cin>>n>>t;
	int mi = 1001;
	while(n--) {
		int c,w;
		cin>>c>>w;
		if(w<=t)mi=min(mi,c);
	}
	if(mi>1000)cout<<"TLE";
	else cout<<mi;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

int main() {
  string a, b;
  cin >> a >> b;
  if (a.length() > b.length()) {
    cout << "GREATER" << endl;
  } else if (b.length() > a.length()) {
    cout << "LESS" << endl;
  } else {
    int i;
    for (i = 0; i < a.length(); i++) {
      if (a.at(i) > b.at(i)) {
        cout << "GREATER" << endl;
        break;
      } else if (b.at(i) > a.at(i)) {
        cout << "LESS" << endl;
        break;
      }
      if (i == a.length() - 1) {
        cout << "EQUAL" << endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  long long n = 0, k = 0;
  cin >> n >> k;
  if (k == 0) {
    cout << n * n << endl;
  } else {
    long long cnt = 0;
    for (long long i=k; i<=n; i++) {
      cnt += n-i;
      cnt += (n-i) / i * (i-k) + max(0ll, (n-i)%i - k + 1);
    }
    cout << cnt << endl;
  }
  return 0;
}


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

using namespace std;

int main()
{
    int a[3],k;
    cin>>a[0]>>a[1]>>a[2]>>k;
    for (int i=0; i<k; i++)
    {
        sort(a,a+3);
        a[2]*=2;
    }
    cout<<a[0]+a[1]+a[2]<<endl;
    return 0;
}


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

#define repi(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(v) begin(v), end(v)

using ll = long long;

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

  int D, T, S;
  cin >> D >> T >> S;

  if (T * S >= D) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }

  return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if(H==0 && W==0) break;

			for(int i = 0; i < H ; i++) {

				for(int j = 0; j<W ; j++ ) {
					if(i==0 || i ==H-1)
					System.out.print("#");
				else {
					if(j==0 || j==W-1)
						System.out.print("#");
					else
						System.out.print(".");
				}
			}
		System.out.println();
		}
		System.out.println();
	}
    }
}


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

int main()
{
    int N;
    int sum = 0;
    cin >> N;
    for(int i = 0; i < N; i++){
        int a,b;
        cin >> a >> b;
        sum += b - a + 1; 
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)


void solve(std::string S){
    REP(i, S.size()){
        cout << 'x';
    }
    cout << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n=0;
int id(int a ,int b,int c){
    return a*(n+1)*(n+1)+b*(n+1)+c;
}
double pr(double a[],int p ,int q, int r){
    double n1 =n;
    double p1 =p;
    double q1 =q;
    double r1 =r;
    if(a[id(p,q,r)]!=-1)return a[id(p,q,r)];
    if((p==0)&&(q==0)&&(r==1)) return n1;
    double y =p1+q1+r1;
    double x = 0;
    if(p>0) x+=(p1/y)*(n1/y + pr(a,p-1,q+1,r));
    if(q>0) x+=(q1/y)*(n1/y + pr(a,p,q-1,r+1));
    if(r>0) x+=(r1/y)*(n1/y + pr(a,p,q,r-1));
    //cout<<n<<" "<<y<<" "<<p<<" "<<q<<" "<<r<<" "<<x<<endl;
    a[id(p,q,r)] = x;
    return x;
}
int main()
{
    scanf("%d",&n);
    int c1=0,c2=0,c3=0;
    for(int i=0;i<n;i++){
        int x;
        scanf("%d",&x);
        if(x==3)c1++;
        if(x==2)c2++;
        if(x==1)c3++;
    }
    double a[(n+1)*(n+1)*(n+1)];
    for(int i=0;i<=n;i++){
        for(int j=0;j<n+1;j++){
            for(int k=0;k<=n;k++)
                a[id(i,j,k)]=-1;
        }
    }
    printf("%.10f\n",pr(a,c1,c2,c3));
    return 0;
}

Measured memory_bytes: 213376
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>
#include <fstream>
#include <ctime>

using namespace std;
using ll = long long;

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

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

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string S;
    cin >> S;

    string Sunny = "Sunny";
    string Cloudy = "Cloudy";
    string Rainy = "Rainy";

    if (S == Sunny)cout << Cloudy << endl;
    else if (S == Cloudy)cout << Rainy << endl;
    else cout << Sunny << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
 
using namespace std;
 
int main(){
  	string a;
	cin >> a;
  	string result;
	if(stoi(a.substr(0,4) + a.substr(5,2) + a.substr(8,2)) <= 20190430){
      result = "Heisei";
    }else{
      result = "TBD";
    }
	cout << result <<endl;
	
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int n,i;
  bool flag=true;
  scanf("%d",&n);
  for (i=1;i<=n;i++) {
    int a;
    scanf("%d",&a);
    if (a%2==1) flag=false;
  }
  if (flag) printf("second\n");
  else printf("first\n");
  return 0;
}

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

int N;
int p[100010];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    
    cin >> N;
    for(int i = 0; i < N; ++i){
        cin >> p[i];
    }

    int cnt = 0;
    if(p[0] == 1){
        cnt++;
        swap(p[0], p[1]);
    }
    for(int i = 1; i < N; ++i){
        if(p[i] == i + 1){
            ++cnt;
            if(p[i] != i + 2 && i != N - 1){
                swap(p[i], p[i + 1]);
            }
            else{
                swap(p[i], p[i - 1]);
            }
        }
    }

    cout << cnt << endl;

	return 0;
}

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

#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

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

using namespace std;
typedef long long int ll;

int main() {
  vector<ll> abc(3);
  rep(i, 3) cin >> abc.at(i);
  ll maxd = *max_element(all(abc));
  ll s=0;
  rep(i, 3) s+=maxd-abc.at(i);
  if(s%2==1) s+=3;
  cout << s/2 << endl;

  return 0;
}

Measured memory_bytes: 256