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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define MOD 1000000007
#define yn(f) cout << (f ? "Yes" : "No") << endl;
#define YN(f) cout << (f ? "YES" : "NO") << endl;

int n,k,a[200000];
vector<int> before_loop;
deque<int> loop;
bool visited[200000];


signed main() {
    cin >> n >> k;
    rep(i,n) cin >> a[i], a[i]--;
    int now = 0;
    while(true) {
        before_loop.pb(now);
        if (visited[now]) break;
        visited[now] = true;
        now = a[now];
    }
    do {
        loop.push_front(before_loop.back());
        before_loop.pop_back();
    }
    while(loop.back() != before_loop.back());
    if (before_loop.size() > k) cout << before_loop[k] + 1 << endl;
    else cout << loop[(k-before_loop.size())%loop.size()] + 1 << endl;
}




Measured memory_bytes: 7804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

VI G[100010];
int reached[100010];
int color[100010];


int main(){
    int n,a,b;
    cin>>n>>a>>b;
    cout<<min(n*a,b)<<endl;
}


Measured memory_bytes: 2560
N, K = gets.split.map(&:to_i)

counter = Hash.new(0)

K.times do
  d = gets.to_i
  a = gets.split.map(&:to_i)

  a.each do |i|
    counter[i] += 1
  end
end

puts (1..N).count { |n| counter[n].zero? }


Measured memory_bytes: 14228
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
const int MAX = 1000000;
const int w = 1010;
const int center = w/2;
vector<vector<int> > caves(w,vector<int>(w,-1));
vector<int> sosuu(MAX+1,1);
int n;
int st;
int stX;
int stY;
void makeCaves(){
  caves = vector<vector<int> >(w,vector<int>(w,-1));
  int dir = 3;//0 右 1 上 2 左 3 下
  int dx[4] = {1,0,-1,0};
  int dy[4] = {0,1,0,-1};
  int x = center;
  int y = center;
  caves[x][y] = 1;
  if(st == 1){
    stX = x;
    stY = y;
    
  }
  for(int i = 2;i <= n;i++){
    int left = (dir+1)%4;
    if(caves[dx[left]+x][dy[left]+y] == -1){
      dir = left;
    }
    x = x+dx[dir];
    y = y+dy[dir];
    caves[x][y] = i;
    if(i == st){
      stX = x;
      stY = y;
    }
  }
}
void makeSosuu(){
  sosuu[0] = 0;
  sosuu[1] = 0;
  for(int i = 2;i <= MAX;i++){
    if(sosuu[i]){
      for(int j = i+i;j <= MAX;j = j+i){
	sosuu[j] = 0;
      }
    }
  }
}/*
void dpSearch(vector<vector<par<int,int> > > &dp,int cx,int cy){
  
  

  } */
int main(){
  // pair<int,int> dp();
  makeSosuu();
  while(true){
    cin >> n >> st;
    if(n == 0 && st == 0)break;
    makeCaves();
    vector<vector<pair<int,int> > > dp(w,vector<pair<int,int> >(w,pair<int,int>(-1,-1)));
    int dx[3] = {-1,0,1};
    int dy[3] = {-1,-1,-1};
    if(sosuu[st]){
      dp[stX][stY].first = 1;
      dp[stX][stY].second = st;
    }else{
      dp[stX][stY].first = 0;
      dp[stX][stY].second = 0;
    }
    //    cout << stX-center << " " << stY-center << endl;
    pair<int,int> ans;//(dp[stX][stY].first,dp[stX][stY].second);
    ans = dp[stX][stY];
    //    cout << ans.first << " " << ans.second << endl;
    for(int i = stY;i > 0;i--){
      for(int j = 1;j < 1001;j++){
	for(int k = 0;k <3;k++){
	  //cout << i << " " << j << endl;
	  int nx = j+dx[k];
	  int ny = i+dy[k];

	  if(caves[nx][ny] != -1 && dp[j][i].first != -1){
	    if(dp[nx][ny].first < dp[j][i].first + sosuu[caves[nx][ny]]){
	      dp[nx][ny].first = dp[j][i].first + sosuu[caves[nx][ny]];
	      if(sosuu[caves[nx][ny]]){
		dp[nx][ny].second = caves[nx][ny];
	      }else{
		dp[nx][ny].second = dp[j][i].second;
	      }
	      if(ans < dp[nx][ny]){
		ans = dp[nx][ny];
	      }
	    }
	  } 
	} 
      }
    }
    cout << ans.first << " " << ans.second << endl;
  }
  
  return 0;
}

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

int n;
int t[202][3];
int ans[202];

int main(){
  while(cin >> n){
    for(int i = 0; i < n; i++){
      for(int j = 0; j < 3; j++){
        cin >> t[i][j];
      }
    }

    memset(ans, 0, sizeof(ans));

    for(int j = 0; j < 3; j++){
      for(int i = 0; i < n; i++){
        bool flg = true;

        for(int ti = 0; ti < n; ti++){
          if(i == ti) continue;
          if(t[i][j] == t[ti][j]){
            flg = false;
            break;
          }
        }
        if(flg){
          ans[i] += t[i][j];
        }
      }
    }

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

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

const ll MX = 1e18;
const long double PI = acos(-1);

int main()
{
    int d, t, s; cin >> d >> t >> s;
    if( d <= s*t )
    {
        pri("Yes");
    }
    else
    {
        pri("No");
    }
    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	void set(int arg_tag_index,int arg_x_1,int arg_y_1,int arg_x_2,int arg_y_2,int arg_depth){
		tag_index = arg_tag_index;
		x_1 = arg_x_1;
		y_1 = arg_y_1;
		x_2 = arg_x_2;
		y_2 = arg_y_2;
		depth = arg_depth;
	}
	int tag_index,x_1,y_1,x_2,y_2,depth;
	vector<int> children;
};

int N;
char buf[1001];
char tagName[500][501];
Info info[500];

bool strCmp(char* base, char* comp){
	int length1,length2;
	for(length1=0;base[length1] != '\0';length1++);
	for(length2=0;comp[length2] != '\0';length2++);
	if(length1 != length2)return false;

	for(int i=0;base[i] != '\0'; i++){
		if(base[i] != comp[i])return false;
	}
	return true;
}

void strcpy(char* to,char* str){
	for(int i=0;str[i] != '\0';i++){
		to[i] = str[i];
		to[i+1] = '\0';
	}
}

void func(){

	for(int i = 0; i < 500; i++){
		info[i].children.clear();
	}

	scanf("%s",buf);

	char work[501];
	int tag_index = 0,work_index,depth = 0;
	int tmp,count;

	stack<int> PARENT;

	for(int index = 0;buf[index] != '\0';){

		if(buf[index] == '<'){
			if(buf[index+1] != '/'){
				work_index = 0;
				for(++index; buf[index] != '>'; index++){
					work[work_index] = buf[index];
					work[work_index+1] = '\0';
					work_index++;
				}
				strcpy(tagName[tag_index],work);
				info[tag_index].depth = depth;
				info[tag_index].tag_index = tag_index;

				if(!PARENT.empty()){
					info[PARENT.top()].children.push_back(tag_index);
				}

				index++;

				count = 0;
				while(count < 4){
					tmp = 0;
					for(;buf[index] != ',' && buf[index] != '<';index++){
						tmp = 10*tmp + buf[index]-'0';
					}
					switch(count){
					case 0:
						info[tag_index].x_1 = tmp;
						break;
					case 1:
						info[tag_index].y_1 = tmp;
						break;
					case 2:
						info[tag_index].x_2 = tmp;
						break;
					case 3:
						info[tag_index].y_2 = tmp;
						break;
					}
					count++;
					if(count < 4)index++;
				}

				PARENT.push(tag_index);
				tag_index++;
				depth++;

			}else{
				index++;
				for(;buf[index] != '>';index++);
				index++;
				depth--;
				PARENT.pop();
			}
		}
	}

	int x,y;
	int max_depth,touch_index;
	for(int loop = 0; loop < N; loop++){
		scanf("%d %d",&x,&y);

		max_depth = -1;
		for(int i = 0; i < tag_index; i++){
			if(info[i].x_1 <= x && info[i].x_2 >= x && info[i].y_1 <= y && info[i].y_2 >= y){
				if(max_depth < info[i].depth){
					max_depth = info[i].depth;
					touch_index = i;
				}
			}
		}
		if(max_depth == -1){
			printf("OUT OF MAIN PANEL 1\n");
		}else{
			printf("%s %lld\n",tagName[info[touch_index].tag_index],info[touch_index].children.size());
		}
	}
}


int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 3124
X = int(input())

if 400 <= X <= 599:
    print(8)
elif 600 <= X <= 799:
    print(7)
elif 800 <= X <= 999:
    print(6)
elif 1000 <= X <= 1199:
    print(5)
elif 1200 <= X <= 1399:
    print(4)
elif 1400 <= X <= 1599:
    print(3)
elif 1600 <= X <= 1799:
    print(2)
else:
    print(1)

Measured memory_bytes: 9124
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N,T;
  cin>>N>>T;
  int c[1000],t[1000];
  int ans=1001;
  for(int i=0;i<N;i++){
  	cin>>c[i]>>t[i];
    if(t[i]<=T&&ans>c[i])ans=c[i];
  }
  if(ans==1001){cout<<"TLE"<<endl;}
  else{cout<<ans<<endl;}
}

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

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = scan.nextInt();
		}
		Arrays.sort(s);
		boolean f = true;;
		for (int i = 0; i < n; i++) {
			if (s[i] % 10 != 0) {
				f = false;
			}
		}

		int ans = 0;
		if (f) {
			System.out.println(ans);
			return;
		}
		for (int i = 0; i < n; i++) {
			ans += s[i];
		}
		if (ans % 10 != 0) {
			System.out.println(ans);
			return;
		}

		for (int i = 0; i < n; i++) {
			ans -= s[i];
			if (ans % 10 != 0) {
				System.out.println(ans);
				return;
			} else {
				ans += s[i];
			}
		}
	}
}


Measured memory_bytes: 23764
#import <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
	int n,k;cin>>n>>k;
	if(k==0)cout<<n*n<<endl,exit(0);
		int ans=0;
	for(int i=k+1;i<=n;i++){
		int m=n/i;
		ans+=m*(i-k)+max(0ll,n%i-k+1);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


N = I()
H = LI()

ans = 0
a = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        a += 1
    else:
        ans = max(ans,a)
        a = 0
ans = max(ans,a)
print(ans)


Measured memory_bytes: 85128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <cmath>
#define ri register int 
using namespace std;
template <class T>void read(T &x){
	x=0;int ne=0;char c;
	while(!isdigit(c=getchar()))ne=c=='-';
	x=c-48;
	while(isdigit(c=getchar()))x=(x<<3)+(x<<1)+c-48;
	x=ne?-x:x;
	return ;
} 
int n,m,d;
int main(){
	read(n),read(m),read(d);
	if(d==0)printf("%.10Lf\n",(long double)(m-1)/n);
	else if(n<=d)printf("0.0000000\n");
	else printf("%.10Lf\n",(long double)(1.00*2*(n-d)*(m-1))/n/n);
	return 0;
}

Measured memory_bytes: 256
//ツつスツづ板づアツ環ョツ青ャ
#include<stdio.h>
void sort(int *d,int max){
	int i,j,t;
	for(i=0;i<max;i++){
		for(j=i;j<max;j++){
			if(d[i]>d[j]){
				t=d[i];
				d[i]=d[j];
				d[j]=t;
			}
		}
	}
}
int n,m;
int isTrash(int *d){
	int j;
	for(j=0;j<n;j++){
		if(m<d[j]){
			m=d[j];
			d[j]=0;
			return 1;
		}
	}
	return 0;
}
int main(){
	int taro[101],hanako[101];
	int i,j;
	for(;scanf("%d",&n)&&n;){
		int list[202]={0};
		int dTaro=0,dHanako=0;
		int turn=0;
		for(i=0;i<n;i++){
			scanf("%d",&taro[i]);
			list[taro[i]]=1;
		}
		dTaro=n;
		dHanako=n;
		for(i=1,j=0;i<=2*n;i++){
			if(list[i]==0)hanako[j++]=i;
		}
		sort(taro,n);
		sort(hanako,n);
		//	for(i=0;i<n;i++)printf("taro[%d]%d\n",i,taro[i]);
		//	for(i=0;i<n;i++)printf("hanako[%d]%d\n",i,hanako[i]);
		m=taro[0];
		taro[0]=0;
		turn=1;
		dTaro--;
		for(;1;){
			//printf("ツ山ツ札:%d dTaro:%d dHanako:%d ",m,dTaro,dHanako);
			//printf("%sツづ個タツーツδ貼n",turn?"Hanako":"Taro");
			if(turn==1){
				if(isTrash(hanako))dHanako--;
				else {
					//	printf("ツ嘉板子ツ出ツつケツづ按つ「\n");
					m=0;
				}
				turn=0;
			}
			else{
				if(isTrash(taro))dTaro--;
				else {
					//			printf("ツ堕セツ郎ツ出ツつケツづ按つ「\n");
					m=0;
				}
				turn=1;
			}
			//		for(i=0;i<n;i++)printf("taro[%d]%d\n",i,taro[i]);
			//		for(i=0;i<n;i++)printf("hanako[%d]%d\n",i,hanako[i]);
			//		printf("---------------\n");
			if(dTaro==0 || dHanako==0)break;

		}
		if(dTaro==0){
			printf("%d\n%d\n",dHanako,0);
		}
		else {
			printf("%d\n%d\n",0,dTaro);
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)
 
inline ll ii(){ ll x; cin >> x; return x; }
inline string is(){ string x; cin >> x; return x; }
inline ld id(){ ld x; cin >> x; return x; }
inline void oi(ll x){ cout << x; }
inline void od(ld x){ cout << fixed << setprecision(10) << x; }
inline void os(string x){ cout << x; }
inline void oe(){ cout << endl; }
inline void oie(ll x){ oi(x); oe(); }
inline void ode(ld x){ od(x); oe(); }
inline void ose(string x){ os(x); oe(); }
inline void maxin(ll &a, ll b){ a=max(a,b); }
inline void minin(ll &a, ll b){ a=min(a,b); }


int main(){
    ll N=ii();
    ll c=0;
    REP(i,0,N){
        ll a=ii();
        ll b=ii();
        if(a==b){
            c++;
        }else{
            c=0;
        }
        if(c==3){
            ose("Yes");
            return 0;
        }
    }
    ose("No");
    return 0;
}


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

int main ( void )
{
	int N, M;

	cin >> N >> M;

	if ( ( N < 1 ) || ( 100 < N ) ){
		cout << "ERROR!\n";
		return 0;
	}
	if ( ( M < 0 ) || ( N < M ) ){
		cout << "ERROR!\n";
		return 0;
	}

	if ( N == M ){
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}

	return 0;
}

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

int main() {
    int n;
    cin >> n;
    auto p = vector<int>(n);
    for (auto &p_i : p)
        cin >> p_i;

    int counter = 0;
    for (int i = 0; i < n; i++) {
        if (p[i] != i + 1)
            counter++;
    }

    cout << (counter == 0 || counter == 2 ? "YES" : "NO");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const ll inf = 1e9;
const int MAX_N = 500;

int main() {
    int n, k; cin >> n >> k;
    vint a(n);
    rep(i,n) cin >> a[i];
    int ans = ((n-k)+(k-2))/(k-1)+1;
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
typedef long long ll;
typedef pair<int,int>P;

int main(){
  int n;
  cin>>n;
  vector<P>vec;
  rep(i,n){
    int a;
    cin>>a;
    vec.emplace_back(P(a,i));
  }
  sort(vec.begin(),vec.end());
  rep(i,n){
    cout<<vec[i].se+1;
    if(i+1==n)cout<<endl;
    else cout<<' ';
  }
  return(0);
}


Measured memory_bytes: 1780
use std::io::Read;
use std::collections::HashSet;

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

    let answer = solve(&buf);

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

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

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let m: usize = iterator.next().unwrap().parse().unwrap();
    let mut graph: Vec<Vec<usize>> = vec![Vec::new(); n];
    for _ in 0..m {
        let ai: usize = iterator.next().unwrap().parse().unwrap();
        let bi: usize = iterator.next().unwrap().parse().unwrap();
        let ai = ai - 1;
        let bi = bi - 1;
        graph[ai].push(bi);
        graph[bi].push(ai);
    }

    let mut used: HashSet<usize> = HashSet::new();
    used.insert(0);
    let ans = dfs(&graph, &used, 0, n);
    ans.to_string()
}

fn dfs(graph: &Vec<Vec<usize>>, used: &HashSet<usize>, current: usize, n: usize) -> usize {
    if used.len() == n {
        return 1;
    }
    let mut ans = 0;
    for &v in graph[current].iter() {
        if used.contains(&v) {
            continue;
        }
        let mut used = used.clone();
        used.insert(v);
        ans += dfs(graph, &used, v, n);
    }
    ans
}


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

int n;
vector<int> a;
template <class T>
void readVector(int n, vector<T> &v){
	for(int i=0; i<n; ++i){
		T t;
		cin >> t;
		v.push_back(t);
	}
}
int ans = -1;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	readVector(n, a);
	for(int i=0; i<n; ++i)
		for(int j=i+1; j<n; ++j){
			int t = a[i] * a[j];
			string s = to_string(t);
			bool f = true;
			for(int i=1; i<s.size(); ++i){
				if(s[i-1] + 1 != s[i])
					f = false;
			}
			if(f) ans = max(ans, t);
		}
	cout << ans << "\n";
}


Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

int main() {
  ll x;
  cin >> x;

  ll ans = (x / 11) * 2;
  x %= 11;
  if (1 <= x && x <= 6)
    ans++;
  else if (7 <= x && x <= 10)
    ans += 2;

  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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


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

    int N;
    cin >> N;
    bool exist_Y = false;
    string S;
    for(int i = 0; i < N; i++){
        cin >> S;
        if(S == "Y"){
            exist_Y = true;
        }
    }

    if(exist_Y){
        cout << "Four" << endl;
    }else{
        cout << "Three" << endl;
    }

    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#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 VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
int main() {
	int a,b,t;
	cin >> a >> b >> t;
	t += 0.5;
	int c = t / a;
	cout << c * b << endl;
	return 0;
}

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

int main(){
    int W, H;
    cin >> W >> H;
    
    
    vector<pair<ll, int>> pq(W+H);
    for (int i = 0; i < W; i++) {
        ll p;
        cin >> p;
        pq[i] = {p, 1};
    }
    for (int i = 0; i < H; i++) {
        ll q;
        cin >> q;
        pq[i+W] = {q, 2};
    }
    sort(pq.begin(), pq.end());
    
    int w, h;
    w = W + 1;
    h = H + 1;
    
    ll ans = 0;
    for (int i = 0; i < W+H; i++){
        ll cost = pq[i].first;
        int dir = pq[i].second;
        if (dir == 1) {
            if (w > 1) {
                ans += cost * h;
                w--;
            }
        }
        else {
            if (h > 1) {
                ans += cost * w;
                h--;
            }
        }
        if (w == 1 && h == 1) break;
        
    }
    
    cout << ans << endl;
    
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define inf 1000000000
#define modi 1000000007
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
lli dp[101][100001]={0};
int main(){
IOS;
lli n,k,i,j;
cin>>n>>k;
lli a[n];
for(i=0;i<n;i++){
    cin>>a[i];
}
dp[0][k]=1;
for(i=1;i<=n;i++){
    for(j=0;j<=k;j++){
            //cout<<i<<" "<<j<<endl;
        if(j==0){
                lli ans=0;
            for(int l=0;l<=a[i-1];l++){
                ans=(ans+dp[i-1][l])%modi;
            }
            dp[i][j]=ans;
        }
        else{
            lli ans=(dp[i][j-1]-dp[i-1][j-1])%modi;
            if(ans<0)
                ans=ans+modi;
            if(j+a[i-1]<=k)
                ans=(ans+dp[i-1][j+a[i-1]])%modi;
            dp[i][j]=ans;
        }
    }
}
cout<<dp[n][0]<<endl;
}


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

using namespace std;
using ll = long long int;
using pii = pair<int, int>;
using pil = pair<int, ll>;

int main() {
	int N;
	cin >> N;
	vector<string> s(N);
	for (int i = 0; i < N; i++)
	{
		cin >> s[i];
	}

	int a = 0, b = 0, ba = 0, ab = 0;
	bool is_ra = false, is_lb = false;;
	for (int i = 0; i < N; i++)
	{

		if (s[i][0] == 'B' and s[i][s[i].length() - 1] == 'A')
			ba++;
		else if (s[i][0] == 'B')
			b++;
		else if (s[i][s[i].length() - 1] == 'A')
			a++;

		for (int j = 0; j < s[i].length() - 1; j++)
			if (s[i][j] == 'A' and s[i][j + 1] == 'B')
				ab++;
	}

	long long ans = ab;
	if (ba > 0) {
		ans += ba - 1;
		if (a > 0) {
			a--;
			ans++;
		}
		if (b > 0) {
			b--;
			ans++;
		}
	}
	ans += min(a, b);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define mp make_pair
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    string s, c = "CODEFESTIVAL2016";
    cin >> s;

    int res = 0;
    REP(i, 16)
    res += s[i] != c[i];

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
#define INFTY 10000

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

  vector<string> s(n);
  for(int i = 0; i < n; i++){
    cin >> s[i];
  }

  sort(s.begin(), s.end());

  int cnt = 1;
  vector<pair<int, string>> lists;
  for(int i = 0; i < n-1; i++){
    if(s[i] == s[i+1]){
      cnt++;
    }else{
      lists.push_back(make_pair(cnt, s[i]));
      cnt = 1;
    }
  }
  lists.push_back(make_pair(cnt, s[n-1]));

  int m;
  cin >> m;
  string t;
  for(int i = 0; i < m; i++){
    cin >> t;
    for(int j = 0; j < lists.size(); j++){
      if(t == lists[j].second){
        lists[j].first = max(lists[j].first - 1, 0);
      }
    }
  }

  sort(lists.begin(), lists.end());

  int ans = lists[lists.size() - 1].first;

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

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int dp[200001];
int freq[200001][26];
int main(){
    string a;
    cin >> a;
    for(int j=0;j<26;j++) freq[a.length()][j] = 1000000000;
    for(int i=a.length()-1;i>=0;i--){
        for(int j=0;j<26;j++){
            if(a[i]-'a'==j)
                freq[i][j] =i;
            else
                freq[i][j] = freq[i+1][j];
        }
    }
    fill(dp,dp+a.length(),1000000000);
    dp[a.length()] = 1;
    for(int i=a.length()-1;i>=0;i--){
        for(int j=0;j<26;j++){
            if(freq[i][j]==1000000000)
                dp[i] = 1;
            else
                dp[i] = min(dp[i],1+dp[freq[i][j]+1]);
            
        }
    }
    string ret= "";
    int i =0;
    while(i<=a.length()){
        if(i==a.length()){
            ret+="a";
        }
        else{
            int next = 0;
            int nextChar = 27;
            for(int j=0;j<26;j++){
                if(freq[i][j]==1000000000){
                    if(dp[i]==1){
                        if(j<nextChar){
                            nextChar = j;
                            next = 1000000000;
                        }
                    }
                }
                else{
                    if(dp[freq[i][j]+1]+1==dp[i]){
                        if(j<nextChar){
                            nextChar = j;
                            next = freq[i][j]+1;
                        }
                    
                    }
                }
            }
            i = next;
            ret+=(nextChar+'a');

        }
    }
    cout << ret << endl;

}


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

int main() {
	ll n; cin >> n;
	vector<ll> q(n+1);
	for (ll i = 0; i < n; ++i)
	{
		ll p; cin >> p;
		q[p] = i+1;
	}

	multiset<ll> s;
	s.insert(0);
	s.insert(0);
	s.insert(n+1);
	s.insert(n+1);
	s.insert(q[n]);
	ll ans = 0;

	for (ll i = n-1; i > 0; --i)
	{
		auto loc = s.lower_bound(q[i]);
		for (ll j = 0; j < 2; ++j) --loc; auto w = *loc;
		for (ll j = 0; j < 1; ++j) ++loc; auto x = *loc;
		for (ll j = 0; j < 1; ++j) ++loc; auto y = *loc;
		for (ll j = 0; j < 1; ++j) ++loc; auto z = *loc;
		//cout << w << " " << x << " " << q[i] << " " << y << " " << z << endl; 
		ans += i * ((x-w) * (y-q[i]) + (q[i]-x) * (z-y));
		s.insert(q[i]);
	}

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

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << setiosflags(ios::fixed);
  string s;
  cin >> s;
  int cnt = 0;
  for (int l = 0, r = (int)s.length() - 1; l < r; l++, r--)
  {
    if (s[l] != s[r])
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.tie(0)
#define MAXX 100005

string s;
int a[MAXX];
int l[MAXX];
int r[MAXX];

int main()
{
    _FastIO;
    cin >> s;
    vector<int> x;
    vector<int> y;
    int n = s.size();
    for(int i = 0; i < n; i++){
        if(s[i] == 'R')
            x.push_back(i);
        else
            y.push_back(i);
    }
    reverse(x.begin() , x.end());
    int k = 0;
    for(int i = 0; i < y[0]; i++){
        if(s[i] == 'R')
            r[i] = y[0];
    }
    k++;
    for(int i = y[k - 1] + 1; i < n; i++){
        if(s[i] == 'R')
            r[i] = y[k];
    else
        k++;
    }
    k = 0;
    for(int i = n - 1; i >= x[k]; i--){
        if(s[i] == 'L')
            l[i] = x[0];
    }
    k++;
    for(int i = x[k - 1] - 1; i >= 0; i--){
        if(s[i] == 'L')
            l[i] = x[k];
        else
            k++;
    }
    for(int i = 0; i < n; i++){
        if(s[i] == 'R'){
            int d = r[i] - i;
            if(d % 2)
                a[r[i] - 1]++;
            else
                a[r[i]]++;
        }
        else{
            int d = l[i] - i;
            if(d % 2)
                a[l[i] + 1]++;
            else
                a[l[i]]++;
        }
    }
    for(int i = 0; i < n; i++){
        cout << a[i] << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 2380
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    int ans = 1001001;
    for(int i = 1; i <= n/2; i++){
        int a = n - i;
        int b = i;
        int cnt = 0;
        rep(i, 6){
            cnt += a % 10;
            cnt += b % 10;
            a /= 10;
            b /= 10;
        }
        ans = min(ans, cnt);
    } 
    cout << ans << endl;
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int n;
int main() {
	cin >> n;
	if (n == 22)puts("Christmas Eve Eve Eve");
	if (n == 23)puts("Christmas Eve Eve");
	if (n == 24)puts("Christmas Eve");
	if (n == 25)puts("Christmas");
	getchar();getchar();
	return 0;
}

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

using namespace std;

int main () {
    int N;

    while (cin >> N) {
        vector<int> B(N-1);
        for (int i = 0;i < N-1;i++) {
            cin >> B[i];
        }
        int ans = B[0] + B[N-2];
        for (int i = 0;i < N-2;i++) {
            ans += min(B[i], B[i+1]);
        }
        cout << ans << 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 N = sc.nextInt();
		int[] a = new int[N + 1];

		for (int i = 1; i <= N; i++) {
			a[i] = sc.nextInt();
		}

		int ans = 0;
		for (int i = 1; i <= N; i++) {
			if (a[a[i]] == i) {
				ans++;
			}
		}
		System.out.println(ans / 2);
	}
}


Measured memory_bytes: 32260
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
using namespace std;

typedef long long int ll;

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	const ll INF = 1e17;
	ll minn = INF;
	for(ll i=1; i*i <= n; i++){
		if(n%i == 0){
			minn = min((n/i)+i - 2, minn);
		}
	}
	cout << minn;
	return 0;
}

Measured memory_bytes: 3616
class UnionFind:
    def __init__(self, x):
        self.__par = list(range(x))
        self.__rank = [0] * x

    def find(self, x):
        if x == self.__par[x]:
            return x
        self.__par[x] = self.find(self.__par[x])
        return self.__par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.__rank[x] > self.__rank[y]:
            self.__par[y] = x
        else:
            self.__par[x] = y
            if self.__rank[x] == self.__rank[y]:
                self.__rank[y] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)


if __name__ == '__main__':
    n, m = map(int, input().split())
    uf = UnionFind(n + m)

    for i in range(n):
        for l in (int(s) + n - 1 for s in input().split()[1:]):
            uf.unite(i, l)

    print('YES' if all(uf.same(0, v) for v in range(1, n)) else 'NO')



Measured memory_bytes: 12532
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
  
using namespace std;

#define pi 3.141592653589793

int partition(int a[], char b[], int c[], int p, int r)
{
	int pivot = a[r];
	int i = p - 1;
	for(int j = p; j < r; j++){
		if(a[j] <= pivot){
			i++;
			swap(a[i], a[j]);
			swap(b[i], b[j]);
			swap(c[i], c[j]);
		}
	}
	swap(a[i + 1], a[r]);
	swap(b[i + 1], b[r]);
	swap(c[i + 1], c[r]);
	return i + 1;
}

void quicksort(int a[], char b[], int c[], int p, int r)
{
	if(p < r){
		int q;
		q = partition(a, b, c, p, r);
		quicksort(a, b, c, p, q - 1);
		quicksort(a, b, c, q + 1, r);
	}
	return;
}

bool isstable(int a[], int c[], int n)
{
	for(int i = 0; i < n - 1; i++){
		if(a[i] == a[i + 1] && c[i] > c[i + 1]) return false;
	}
	return true;
}

int main()
{
	int n;
	int a[100000];
	char b[100000];
	int c[100000];
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> b[i] >> a[i];
		c[i] = i;
	}
	quicksort(a, b, c, 0, n - 1);
	if(isstable(a, c, n)) cout << "Stable" << endl;
	else cout << "Not stable" << endl;
	for(int i = 0; i < n; i++){
		cout << b[i] << " " << a[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 2040
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n, k = MAP()

h = LIST()

dp = [INF] * n
dp[0] = 0

for i, hi in enumerate(h):
    if i == 0:
        continue
    s = i-k if i-k >= 0 else 0
    dp[i] = min([dpk + abs(hi-hk) for dpk, hk in zip(dp[s:i], h[s:i])])

print(dp[-1])


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

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	ll A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;
	cout << min({ A * X + B * Y, min(X, Y) * C * 2 + (X >= Y ? (X - Y) * A : (Y - X) * B), max(X, Y) * C * 2 }) << endl;
	return 0;
}


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

int main() {
  int N;
  int a,b,c,d;
  
  cin >> N;
  
  a = N / 1000;
  b = (N / 100) % 10;
  c = (N / 10) % 10;
  d = N % 10;
  
  if (a==b && b==c){
    cout << "Yes" <<endl;
  }
  else if(b==c && c==d){
    cout << "Yes" <<endl;
  }
  else if(a==b && b==c && c==d){
     cout << "Yes" <<endl;
  }
  else {
     cout << "No" <<endl;
  }
    
    


}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int n;
    while (scanf("%d", &n) && n != -1) {
        string res = "";
        if (n == 0) {
            printf("0\n");
            continue;
        }
        while (n > 0) {
            res += (n % 4 + '0');
            n /= 4;
        }
        reverse(res.begin(), res.end());
        cout << res << endl;
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>

using namespace std;

#define int long long

int a[100000];

signed main() {
	int n;

	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	int cnt1 = 0, cnt2 = 0, sum1 = a[0], sum2 = a[0];

	if (a[0] > 0) {
		for (int i = 1; i < n; ++i) {
			if (sum1 > 0) {
				sum1 += a[i];
				if (sum1 >= 0) {
					cnt1 += sum1 + 1;
					sum1 = -1;
				}
			}
			else {
				sum1 += a[i];
				if (sum1 <= 0) {
					cnt1 += 1 - sum1;
					sum1 = 1;
				}
			}
		}

		cnt2 += sum2 + 1;
		sum2 = -1;
		for (int i = 1; i < n; ++i) {
			if (sum2 > 0) {
				sum2 += a[i];
				if (sum2 >= 0) {
					cnt2 += sum2 + 1;
					sum2 = -1;
				}
			}
			else {
				sum2 += a[i];
				if (sum2 <= 0) {
					cnt2 += 1 - sum2;
					sum2 = 1;
				}
			}
		}
	}
	else if (a[0] < 0) {
		for (int i = 1; i < n; ++i) {
			if (sum1 > 0) {
				sum1 += a[i];
				if (sum1 >= 0) {
					cnt1 += sum1 + 1;
					sum1 = -1;
				}
			}
			else {
				sum1 += a[i];
				if (sum1 <= 0) {
					cnt1 += 1 - sum1;
					sum1 = 1;
				}
			}
		}

		cnt2 += 1 - sum2;
		sum2 = 1;
		for (int i = 1; i < n; ++i) {
			if (sum2 > 0) {
				sum2 += a[i];
				if (sum2 >= 0) {
					cnt2 += sum2 + 1;
					sum2 = -1;
				}
			}
			else {
				sum2 += a[i];
				if (sum2 <= 0) {
					cnt2 += 1 - sum2;
					sum2 = 1;
				}
			}
		}
	}
	else {
		cnt1++;
		sum1 = 1;
		for (int i = 1; i < n; ++i) {
			if (sum1 > 0) {
				sum1 += a[i];
				if (sum1 >= 0) {
					cnt1 += sum1 + 1;
					sum1 = -1;
				}
			}
			else {
				sum1 += a[i];
				if (sum1 <= 0) {
					cnt1 += 1 - sum1;
					sum1 = 1;
				}
			}
		}

		cnt2++;
		sum2 = -1;
		for (int i = 1; i < n; ++i) {
			if (sum2 > 0) {
				sum2 += a[i];
				if (sum2 >= 0) {
					cnt2 += sum2 + 1;
					sum2 = -1;
				}
			}
			else {
				sum2 += a[i];
				if (sum2 <= 0) {
					cnt2 += 1 - sum2;
					sum2 = 1;
				}
			}
		}
	}

	cout << min(cnt1, cnt2) << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double D, T, S;
  cin >> D >> T >> S;
  
  bool ans = false;
  if (D / S <= T) {
    ans = true;
  }
  
  if (ans) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3712
def biscuits():
	n,p = map(int, raw_input().split(" "))
	a = map(int, raw_input().split(" "))
	from math import pow
	has_odd = False
	for item in a:
		if item%2!=0:
			has_odd = True
			break
	if not has_odd:
		if p==0:
			print int(pow(2, n))
		else:
			print 0
	else:
		print int(pow(2, n-1))

if __name__ == "__main__":
	biscuits()

Measured memory_bytes: 2568
import sys
import math


def input():
    return sys.stdin.readline().strip()


def main():
    N, H = map(int, input().split())
    A = []
    B = []
    for i in range(N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
    max_a = max(A)
    B.sort(reverse=True)
    attack = 0
    cnt = N
    for i in range(N):
        if B[i] < max_a:
            cnt = i
            break
        attack += B[i]
        if attack >= H:
            print(i + 1)
            return

    print(cnt + math.ceil((H - attack) / max_a))


if __name__ == "__main__":
    main()


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

#define RED		0	//RED 	: 1-9
#define GREEN	10	//GREEN : 11-19
#define BLUE	20	//BLUE	: 21-29

#define SENTINEL 50

using namespace std;

int check_delete(vector<int> &card)
{
	int set[3];
	int find_index = 1;
	set[0] = 0;
	//先頭に番兵があったら
	if (card[0] == SENTINEL) return -1;
	//同じ数字3つの場合を探索
	for(int i=1; i<(int)card.size(); i++){
		if (card[i] == card[0]){
			set[find_index] = i;
			find_index++;
			if (find_index == 3){
				//セットができたら全削除
				for(int j=2; j>=0; j--){
					card.erase(card.begin()+set[j]);
				}
				return 1;
			}
		}
	}
	find_index = 1;
	set[0] = 0;
	//階段の3つの場合を探索
	for(int i=1; i<(int)card.size(); i++){
		if (card[i] == card[0] + find_index){
			set[find_index] = i;
			find_index++;
			if (find_index == 3){
				//セットができたら全削除
				for(int j=2; j>=0; j--){
					card.erase(card.begin()+set[j]);
				}
				return 1;
			}
		}
	}
	return 0;
}

int main(void)
{
	int T;
	cin >> T;
	for(int i=0; i<T; i++){
		vector<int> card(10);
		//カードの番号入力
		for(int j=0; j<9; j++){
			cin >> card[j];
		}
		//番兵を置く
		card[9] = SENTINEL;
		//カードの色入力
		for(int j=0; j<9; j++){
			char color;
			cin >> color;
			switch(color){
				case 'R':
					card[j] += RED;
					break;
				case 'G':
					card[j] += GREEN;
					break;
				case 'B':
					card[j] += BLUE;
			}
		}
		//識別番号でソート
		sort(card.begin(), card.end());
		//組を作って消しまくる
		while(check_delete(card) == 1);
		//出力
		if (card[0] == SENTINEL){
			cout << 1 << endl;
		}else{
			cout << 0 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3048
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

int main(){
    map<string,int> mp;
    int n;
    cin>>n;
    rep(i,n){
        string s;
        cin>>s;
        ++mp[s];
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;
}


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

import numpy as np
a = np.array(a)
count = 0
while (True):
    exist_odd = False
    for i in a:
        if i % 2 != 0:
            exist_odd = True
    if exist_odd:
        break
    #割り算操作
    a = a / 2
    count += 1
print(count)

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

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

typedef long long ll;
typedef pair<int, int> P;

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int x = tx - sx, y = ty - sy;

    rep(i, 4) {
        if (i < 2) {
            if (i % 2 == 0) {
                rep(j, y) cout << "U";
                rep(j, x) cout << "R";
            } else {
                rep(j, y) cout << "D";
                rep(j, x) cout << "L";
            }
        } else {
            if (i % 2 == 0) {
                cout << "L";
                rep(j, y + 1) cout << "U";
                rep(j, x + 1) cout << "R";
                cout << "D";
            } else {
                cout << "R";
                rep(j, y + 1) cout << "D";
                rep(j, x + 1) cout << "L";
                cout << "U";
            }
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int i=0,j,x[10000];
	while(1){
		scanf("%d",&x[i]);
		if(x[i]==0){
			break;
		}
		i++;
	}
	for(j=0;i>=j;j++){
		if(x[j]==0){
			break;
		}
		printf("Case %d: %d\n",j+1,x[j]);
	}
	return 0;
}

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

int main() {
    int N, Q; cin >> N >> Q;
    string str; cin >> str;

    // 累積和
    vector<int> s(N+1, 0);
    for (int i = 0; i < N; ++i) {
        if (i+1 < N && str[i] == 'A' && str[i+1] == 'C') s[i+1] = s[i] + 1;
        else s[i+1] = s[i];
    }

    // クエリ
    for (int q = 0; q < Q; ++q) {
        int l, r; cin >> l >> r;
        --l, --r; // 0-indexed にする
        cout << s[r] - s[l] << endl;
    }
}   


Measured memory_bytes: 1408
#include<cstdio>
#include<algorithm> 
#include<queue>
using namespace std;
const int maxn=1e4+10;
int n,cnt,a,b,sum,pos;
int pt[maxn],head[maxn],c[maxn],ans[maxn],vis[maxn];
queue <int> q; 
struct Edge{
	int nxt,to;
}edge[maxn<<1];
inline void add(int u,int v){
	edge[++cnt].nxt=head[u];
	edge[cnt].to=v;
	head[u]=cnt;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n-1;i++){
		scanf("%d%d",&a,&b);
		add(a,b); add(b,a);
		pt[a]++;pt[b]++;
	}
	for(int i=1;i<=n;i++) scanf("%d",&c[i]);
	if(n==1){printf("0\n%d",c[1]);return 0;}
	for(int i=1;i<=n;i++) if(pt[i]==1) q.push(i);
	sort(c+1,c+n+1);
	
	while(!q.empty()){
		int rt=q.front(); q.pop(); vis[rt]=1;
		ans[rt]=c[++pos];
		for(int k=head[rt];k;k=edge[k].nxt){
			int er=edge[k].to;
			if(vis[er]) continue;
			pt[er]--; pt[rt]--;
			if(pt[er]==1) q.push(er);
			sum+=ans[rt];
		}
	}
	printf("%d\n",sum);
	for(int i=1;i<=n;i++) printf("%d ",ans[i]);
	
}
/*
11
1 2
1 3 
1 8
2 10
2 4
2 5
3 6
8 9
6 7
6 11
10 20 30 40 50 60 70 80 90 100 110
*/

Measured memory_bytes: 640
N, M = map(int, input().split())

first = [False for _ in range(N + 1)]
second = [False for _ in range(N + 1)]

for _ in range(M):
    a, b = map(int, input().split())

    if a == 1:
        first[b] = True
    if b == 1:
        first[a] = True
    if a == N:
        second[b] = True
    if b == N:
        second[a] = True

for f, s in zip(first, second):
    if f and s:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')


Measured memory_bytes: 6320
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

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

    int n;
    cin >> n;

    if (n == 1) {
        cout << "Hello World\n";
    } else {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define all(v)   v.begin(), v.end()
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define START cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMN INT_MIN
#define IMX INT_MAX
#define pow(n, m) power((ll)n, (ll)m)
#define numOfDigits(n)  ((n)? (ll)(log10(n))+1 : 1)
#define mem(x, val)    memset(x, val, sizeof(x)) //be careful
#define sz(x)          (int) x.size()
#define MOD 1000000007
#define EPS 1e-7


typedef long long ll;
typedef long double ld;
typedef double dd;
typedef pair<int, int> pii;
typedef vector<int> vi;


int main()
{
    START
    //freopen("test cases\\in.txt", "r", stdin) ;
    int n, k; cin>>n>>k;
    int freq[n+1]={};
    for(int i = 0; i<k; i++){
        int d; cin>>d;
        while(d--){
            int a; cin>>a;
            freq[a]++;
        }
    }
    int c = 0;
    for(int i = 1; i<=n; i++)
        if(!freq[i])c++;
    cout<<c;
	return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<set>
#include<algorithm>
#include<limits>
using namespace std;
int main(){
long int n;
  cin>>n;
  cin.ignore(numeric_limits<streamsize>::max(), '\n');

  string ss;
  set <string > s;
  while(n--)
  {
    getline(cin, ss);
    s.insert(ss);
  }
  cout<<s.size();
}


Measured memory_bytes: 19188