akhauriyash/Code-Regression huggingface dataset:
# AOJ ITP1_6_D

def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    a = numinput()
    n = a[0]; m = a[1] # nが行、mが列の数。
    M = []
    for i in range(n):
        data = numinput()
        list = []
        for j in range(m):
            list.append(data[j])
        M.append(list)
    b = []
    for j in range(m):
        b.append(int(input()))

    for i in range(n):
        sum = 0
        for j in range(m):
            sum += M[i][j] * b[j]
        print(sum)

if __name__ == "__main__":
    main()


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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int nax = 1e5 + 100;
int f[nax][2];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
	#endif
	int n;
	cin>>n;
	int ans = n;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		f[a][i%2]++;
	}
	multiset<int> st;
	n/=2;
	for(int i=0;i<nax-1;i++){
		st.insert(n - f[i][0]);
	}
	for(int i=0;i<nax;i++){
		st.erase(st.find(n-f[i][0]));
		ans = min(ans , n - f[i][1] + *st.begin());
		st.insert(n-f[i][0]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 5760
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
#include <fstream>
#include <climits>
 
  using namespace std;
   
 
//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ

  typedef long long ll;
  typedef long double lld;
  typedef unsigned long long ull;
  int INF = INT_MAX;
  // ll mod = 998244353;
  // lld PI = 3.141592653;







  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
      string s;
      cin>> s;
      cout<<s;
      if (s[s.length()-1] == 's'){
        cout<<"es\n";
      }else{
        cout<<"s\n";
      }

}

Measured memory_bytes: 3096
#include <stdio.h>

int a[1010];
int s[1010];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	int q;
	scanf("%d",&q);
	while(q--){
		//[b,e)と[t,*)をswap
		int b,e,t;
		scanf("%d%d%d",&b,&e,&t);
		for(int i=0;i<e-b;i++)s[i]=a[b+i];
		for(int i=0;i<e-b;i++)a[b+i]=a[t+i];
		for(int i=0;i<e-b;i++)a[t+i]=s[i];
	}
	for(int i=0;i<n;i++)printf("%d%c",a[i],i==n-1?10:32);
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)

int main( void ){
	int n;
	if (!scanf( "%d", &n ))
		return -1;
	int* array = new int[ n ];
	int max = 0;
	rep( i, 0, n ){
		if (!scanf( "%d", array + i ))
			return -1;
	}
	std::sort( array, array + n );
	int k = array[ n - 1 ] / 2;
	int m = 0;
	bool is_sub = false;
	for(int i = n - 2; i >= 0; i--){
		if(array[ i ] > k){
			if (m < array[ n - 1 ] - array[ i ]){
				is_sub = true;
				m = array[ n - 1 ] - array[ i ];
			}
		}
		else {
			if (m < array[ i ]){
				is_sub = false;
				m = array[ i ];
			}
		}
	}
	if (is_sub){
		m = array[ n - 1 ] - m;
	}
	printf( "%d %d\n", array[ n - 1 ], m );
	return 0;
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 1; i <= 9; i++){
		for(int j = i; j <= 9; j++){
			if(i*j == n){
				cout << "Yes\n";
				return 0;
			}
		}
	}
	cout << "No\n";
	return 0;
} 

Measured memory_bytes: 256
/*
  ∧,,∧
( 'ω' )つ ＜WA,またお前か！！　
（m9 ＼ 　　
　 ＼　 ＼
　 　 ) ) ＼
　 ／／ ＼ ＼
　 (＿） 　 (＿)
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    if (s.length() == 1) {
        cout << "0" << endl;
        return 0;
    }

    int ans = 0;
    for (int i = 0; i <= s.length()/2 - 1; i++) {
        char a, b;
        a = s[i]; b = s[s.length() - i - 1];

        if (a - b) ans++;
    }

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


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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

ll N;
vector<pair<ll, ll>> tasks;

int main(void) {

    cin >> N;
    tasks.assign(N, make_pair(0, 0));
    rep(i, N) {
        cin >> tasks[i].first >> tasks[i].second;
    }

    sort(ALLOF(tasks), [](const pair<ll, ll>& lh, const pair<ll, ll>& rh) { return lh.second < rh.second; });

    ll asum = 0;
    bool flag = true;
    for(auto t : tasks) {
        asum += t.first;
        if (asum > t.second) {
            flag = false;
            break;
        }
    }

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

     return 0;
}

Measured memory_bytes: 3328
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100010;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main(){
	while(1){
		bool ok=true;
		string s;
		while(1){
			char c;
			cin.get(c);
			s+=c;
			if(c=='\n')break;
		}
		if(s==".\n")break;
		int a=0,b=0;
		vector<char> v;
		rep(i,s.size()){
			if(s[i]=='(')a++,v.push_back('(');
			else if(s[i]==')'){
				a--;
				if(a<0||b<0){
					ok=false;
					break;
				}
				if(v[v.size()-1]=='(')v.pop_back();
				else ok=false;
			}
			else if(s[i]=='[')b++,v.push_back('[');
			else if(s[i]==']'){
				b--;
				if(a<0||b<0){
					ok=false;
					break;
				}
				if(v[v.size()-1]=='[')v.pop_back();
				else ok=false;
			}
		}
		if(a!=0||b!=0)ok=false;
		if(ok?print("yes"):print("no"));
	}



}


Measured memory_bytes: 3148
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int n, C; cin >> n >> C;
	vector<int> s(n), t(n), c(n);
	rep(i, n) {
		cin >> s[i] >> t[i] >> c[i];
		-- c[i];
	}
	static int a[200200], ct[200200];
	rep(j, 200200) ct[j] = 0;
	rep(i, C) {
		rep(j, 200200) a[j] = 0;
		rep(j, n) {
			if(c[j] == i) a[s[j] * 2 - 1] ++, a[t[j] * 2] --;
		}
		rep(j, 200100) a[j + 1] += a[j];
		rep(j, 200100) {
			if(a[j] > 0) ct[j] ++;
		}
	}
	int mx = 0;
	rep(j, 200200) {
		chmax(mx, ct[j]);
	}
	cout << mx << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 6108
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
  int a;
  cin>>a;
  loop(i,1,40010){
    if(i*i>a){
      i--;
      cout<<i*i<<endl;
      return 0;
    }
  }
}


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

int main(){
    int A, B, C, X;
    int a = 0;
    cin >> A >> B >> C >> X;
    for(int i = 0; i < A + 1; i++){
        for(int j = 0; j < B + 1; j++){
            for(int k = 0; k < C + 1; k++){
                if(500 * i + 100 * j + 50 * k == X){
                    a++;
                }
            }
        }
    }
    cout << a << endl;
	
	return 0;
}

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

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N,M;
  cin>>N>>M;
  vector<ll> value(N);
  vector<ll> omosa(N);
  FOR(i,0,N){
    cin>>value[i]>>omosa[i];
  }
  VEC2(dp,N+1,M+1);
  FOR(i,1,N+1){
    FOR(j,1,M+1){
      if(j-omosa[i-1]>=0)dp[i][j]=max(dp[i][j-omosa[i-1]]+value[i-1],dp[i-1][j]);
      else dp[i][j]=dp[i-1][j];
    }
  }
  //FOR(i,0,N+1){
  //  FOR(j,0,M+1){
  //    cout<<dp[i][j]<<" ";
  //  }
  //  cout<<endl;
  //}

  cout<<dp[N][M]<<endl;
}



Measured memory_bytes: 10820
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(void) {
	char eibun[1010];
	char* kensaku;
	char* pos;
	int kazu,nowkazu;
	scanf("%d",&kazu);
	while(getchar()!='\n');
	for(nowkazu=0;nowkazu<kazu;nowkazu++) {
		fgets(eibun,sizeof(eibun),stdin);
		kensaku=eibun;
		while(pos=strstr(kensaku,"Hoshino")) {
			/*if(!isalpha(*(pos+7)) &&
			   (pos==eibun || *(pos-1)==' '))*/*(pos+6)='a';
			kensaku=pos+1;
		}
		printf("%s",eibun);
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int min(int a,int b){return a<b?a:b;}
int calc(int x){
	int s=0;
	while(x){
		s+=x%10;
		x/=10;
	}
	return s;
}
int main(){
	int n,i,ans;
	scanf("%d",&n);
	ans=2147483647;
	for(i=1;i<n;i++)ans=min(ans,calc(i)+calc(n-i));
	printf("%d",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
int modpow(int x,int n){
    int ret=1;
    while(n){
        if(n&1)
            (ret*=x)%=mod;
        (x*=x)%=mod;
        n>>=1;
    }
    return ret;
}
signed main(){
    int n,k;
    cin>>n>>k;
    int a[100001];
    for(int i=1;i<=k;i++)
        a[i]=modpow(k/i,n);
    for(int i=k;i>0;i--)
        for(int j=2*i;j<=k;j+=i)
            (a[i]+=mod-a[j])%=mod;
    int sum=0;
    for(int i=1;i<=k;i++)
        (sum+=i*a[i])%=mod;
    cout<<sum<<endl;
}

Measured memory_bytes: 4348
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	int w, a, b;
	cin >> w >> a >> b;
	if (a + w <= b) {
		cout << b - a - w;
	}
	else if (b + w <= a) {
		cout << a - b - w;
	}
	else cout << 0 << endl;
}


Measured memory_bytes: 256
import sys
x,n = map(int, input().split())
if n == 0:
  print(x)
  sys.exit()
else:
  p = input().split()
  p1 = [int(i) for i in p]
  if x not in p1:
    print(x)
  else:
    for c in range(1,n+1):
      u = x + c
      d = x - c
      if d not in p1:
        print(d)
        sys.exit()
      elif u not in p1:
        print(u)
        sys.exit()

Measured memory_bytes: 9200
import sys
input = sys.stdin.readline
from math import sqrt
from bisect import bisect_right

def main():
	n, m = map(int, input().strip().split())
	M = int(sqrt(m))
	l = []
	for i in range(1, M+1):
		if m % i == 0:
			l.append(i)
			l.append(m // i)
	l.sort()
	k = m//n
	ind = bisect_right(l, k)
	# print(l)
	print(l[ind-1])

if __name__ == '__main__':
	main()


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

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

        List<Integer> medianList = new ArrayList<>();
        int temp = 0;
        for (int i = 1; i <= N; i++) {
            temp = sc.nextInt() - i;
            medianList.add(temp);
        }

        Collections.sort(medianList);

        long sum = 0;
        for (int i = 0; i < N; i++) {
            sum += Math.abs(medianList.get(i) - medianList.get(N / 2));
        }

        System.out.println(sum);

        sc.close();

    }
}


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

int main()
{
	int k,x,m,l=-1000000;
  cin >> k >> x;
  m = k-1;
  vector<int> a;
  while((x-m)>=l){
       if(m==0)
      break;
	a.push_back(x-m);
    m--;
 
  }
a.push_back(x);
  m=1;
  while(x+m<=1000000){
    if(m==k)
      break;
  	a.push_back(x+m);
    m++;
  }
  for(auto i=a.begin();i!=a.end();++i)
    cout << *i << " ";
}

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

div = make_divisors(N)
ans='No'
for i in range(len(div)//2):
  a=div[2*i]
  b=div[2*i+1]
  if (a<10) and (b<10):
    ans='Yes'
    break
if len(div)%2==1:
  if div[-1] <10:
    ans='Yes'
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
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;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;
using namespace atcoder;


template<typename T>
struct StronglyConnectedComponents{
	vector<vector<T>> g,rg;
	vector<T>vs,cmp;//1回目のdfsの帰り順の並び,トポロジカル順序
	vector<bool>used;
	int num;//強連結成分の個数

	StronglyConnectedComponents(const vector<vector<T>> &G):num(0){//"有向"グラフを渡す
		int v=G.size();
		g.resize(v);
		rg.resize(v);
		used.resize(v);
		cmp.resize(v,-1);
		for(int i=0;i<v;++i){
			for(auto &e:G[i]){
				add_edge(i,e);
			}
		}
		for(int i=0;i<v;++i){
			if(!used[i]){
				dfs(i);
			}
		}
		reverse(vs.begin(),vs.end());
		for(int i=0;i<v;++i){
			if(cmp[vs[i]]==-1){
				rdfs(vs[i],num);
				num++;
			}
		}
	}

	void add_edge(int u,int v){
		g[u].emplace_back(v);
		rg[v].emplace_back(u);
	}

	void dfs(int v){
		used[v]=true;
		for(auto &x:g[v]){
			if(!used[x]){
				dfs(x);
			}
		}
		vs.emplace_back(v);
	}

	void rdfs(int v,int num){
		cmp[v]=num;
		for(auto &x:rg[v]){
			if(cmp[x]==-1)rdfs(x,num);
		}
	}

};

void solve(){
	int n,m;
	cin>>n>>m;
	vector<vector<int>>g(n);
	rep(i,m){
		int u,v;
		cin>>u>>v;
		g[u].eb(v);
	}
	StronglyConnectedComponents<int>scc(g);
	vector<vector<int>>ans(scc.num);
	rep(i,n){
		ans[scc.cmp[i]].eb(i);
	}
	cout<<scc.num<<"\n";
	rep(i,scc.num){
		if(ans[i].size()){
			cout<<ans[i].size();
		}
		for(auto e:ans[i]){
			cout<<" "<<e;
		}
		cout<<"\n";
	}
}


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 101272
#include<bits/stdc++.h>
using namespace std;
long double X[200100];
int N;
long long Count(long double len)
{
  long long Ans=0;
  for(int i=0;i<N;i++)
  {
    Ans+=(long long)(X[i]/len);//解答引っ張ってきた人の条件。なぜか通る
    //Ans+= ceil(X[i]/len)-1;//多少遅くなるがこっちが正解
  }
  return Ans;
}

int main()
	{
	  long long K;
	  cin>>N>>K;
	  for(int i=0;i<N;i++)
	{
		cin>>X[i];
		//X[i]-=0.1;
	}

  long double l=1,r=1e9;
  //while(l<r-0.1)//解答を引っ張ってきた人の条件。なぜかOKだったが、lとｒの整数部が異なる状態でループを出ると問題になるはず
	//for(int i=0;i<35;i++)//OK log2(10^9)=30.二分探索だとこのやり方安定する。ただし、浮動小数のせいか34以上でないと通らず。
  //while(!((ceil(r)-ceil(l)) == 0))//NG:左端が初期値0のままだと、右端のceilは0にならず、無限ループ
	while(!((floor(r)-floor(l)) == 0))//OK:右端がぴったり整数にならなければ成立.(あまりよくない)
  {
    long double mid=(l+r)/2;
    if(Count(mid)<=K) r=mid;
    else	l=mid;
  }
  cout<<(long long)(l+0.999)<<endl;
  return 0;
}

Measured memory_bytes: 6796
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

class CANDGrid {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int h,w;
        in>>h>>w;
        vector<string> a(h);
        for(auto&i:a) in>>i;
        fr(i,h){
            fr(j,w){
                if(i==h-1||(a[i][j]=='.'&&i>0&&(j&1)==0)) out<<".";
                else out<<"#";
            }
            out<<endl;
        }
        out<<endl;
        fr(i,h){
            fr(j,w){
                if(i==0||(a[i][j]=='.'&&i<h-1&&(j&1)==1)) out<<".";
                else out<<"#";
            }
            out<<endl;
        }
    }
};

int main() {
    CANDGrid solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

using namespace std;


struct UnionFind
{
  vector< int > data;

  UnionFind(int sz) : data(sz, -1) {}

  int find(int k)
  {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  void unite(int x, int y)
  {
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
  }

  int size(int k)
  {
    return (-data[find(k)]);
  }
};


int main()
{
  int N, C[100000], M;
  vector< int > g[100000];
  vector< pair< int, int > > beet[100000];
  int dp[100000];

  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    scanf("%d", &C[i]);
  }
  scanf("%d", &M);

  UnionFind tree(N);
  for(int i = 0; i < M; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a, --b;
    if(C[a] > C[b]) swap(a, b);
    if(C[a] == C[b]) tree.unite(a, b);
    else g[a].push_back(b);
    beet[a].emplace_back(C[b], b);
    beet[b].emplace_back(C[a], a);
  }

  for(int i = 0; i < N; i++) {
    sort(begin(beet[i]), end(beet[i]));
    for(int j = 1; j < beet[i].size(); j++) {
      auto &pv = beet[i][j - 1], cr = beet[i][j];
      if(pv.first == cr.first) tree.unite(pv.second, cr.second);
      else g[pv.second].push_back(cr.second);
    }
  }

  vector< int > order;
  for(int i = 0; i < N; i++) {
    if(tree.find(i) == i) {
      order.push_back(i);
      dp[i] = 1;
    } else {
      for(int j : g[i]) g[tree.find(i)].push_back(j);
      copy(begin(g[i]), end(g[i]), back_inserter(g[tree.find(i)]));
      g[i].clear();
    }
  }

  sort(begin(order), end(order), [&](int a, int b)
  {
    return (C[a] < C[b]);
  });

  long long ret = 0;
  for(int idx : order) {
    for(int to : g[idx]) dp[tree.find(to)] = max(dp[tree.find(to)], dp[idx] + 1);
    ret += 1LL * dp[idx] * tree.size(idx);
  }

  printf("%lld\n", ret);
}

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

// Template START
#define endl "\n"
#define async ios_base::sync_with_stdio(false); cin.tie(NULL);
#define int long long int
#define all(y) y.begin(), y.end()
#define present( x, y ) (x.find( y ) != x.end())
const int mod = (int)1e9 + 7 ;
template<class T>
auto matrix( int r, int c, T v ){
    return vector<vector<T>>( r, vector<T>( c, v ) ) ;
}
template<class T>
auto matrix( int o1, int o2, int o3, T v ){ 
    return vector<vector<vector<T>>>( o1, vector<vector<T>>( o2, vector<T>( o3, v ) ) ) ;
}
#define v vector
int power( int x, int n ){
    if( n == 0 ) return 1 ;
    else if( n & 1 ) return ( x * power( (x*x) % mod, n / 2 ) ) % mod ;
    return power( (x*x) % mod, n / 2 ) % mod ;
}
template<class T> void __print( v<T> &arr ){
    int n = arr.size() ;
    cerr << "[ " ;
    for( int i = 0 ; i < n ; i++ ) {
        cerr << arr[i] ;
        if( i != n - 1 ) cerr << ", " ;
    }
    cerr << " ]" << endl ;
}
template<class T> void __print( T arr[], int n ){ 
    cerr << "[ " ;
    for( int i = 0 ; i < n ; i++ ) {
        cerr << arr[i] ;
        if( i != n - 1 ) cerr << ", " ;
    }
    cerr << " ]" << endl ;
}
#define print(x) cerr << "{ " << #x << " : " << x << " } " ;
#define println(x) cerr << "{ " << #x << " : " << x << " }" << endl ;
// Template END


signed main(){
    int n ; cin >> n ;
    int a[n], b[n] ;
    for( int i = 0 ; i < n ; i++ ){
        cin >> a[i] >> b[i] ;
    }
    sort( a, a + n ) ;
    sort( b, b + n ) ;
    int l = a[n/2] + (( n & 1 ) ? 0 : a[n/2 - 1]) ;
    int r = b[n/2] + (( n & 1 ) ? 0 : b[n/2 - 1]) ;
    cout << abs( r - l + 1 ) << endl ; 
    return 0 ;   
}          

Measured memory_bytes: 6712
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(uniqu7e(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const LL INF = 1e18;
const LL MOD = 1e9 + 7;

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

void END()
{
	cout << "NO" << endl;
	exit(0);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	if (s.size() > 9) END();
	int k=0, i=0, h=0, b=0, r=0, a=0;
	REPx(x, s)
	{
		if(x == 'K')
		{
			if (a > 1) END();
			if (k || i || h || b || r) END();
			k++;
			a = 0;
		}
		else if(x == 'I')
		{
			if (a || !k || i || h || b || r) END();
			i++;
		}
		else if(x == 'H')
		{
			if (a || !k || !i || h || b || r) END();
			h++;
		}
		else if(x == 'B')
		{
			if (a > 1) END();
			if (!k || !i || !h || b || r) END();
			b++;
			a = 0;
		}
		else if(x == 'R')
		{
			if (a > 1) END();
			if (!k || !i || !h || !b || r) END();
			r++;
			a = 0;
		}
		else if(x == 'A') a++;
		else END();
	}
	if (k != 1 || i != 1 || h != 1 || b != 1 || r != 1 || a > 1) END();
	cout << "YES" << endl;
	
	return 0;
}


Measured memory_bytes: 256
//
// ABC046D
// URL : https://atcoder.jp/contests/abc046/tasks/abc046_d
// 
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;

namespace AtCoder
{
    class ABC046D
    {
        static readonly char GU = 'g';
        static readonly char PA = 'p';

        static void Main(string[] args)
        {
            preprocess();

            var TopChoice = Console.ReadLine();//TopCoDeerの手
            var COUNT_TURN = TopChoice.Length;//総ターン数

            var PA_Max = COUNT_TURN / 2;
            var PointAllGu = TopChoice.Count(x => x == PA) * -1;

            Console.WriteLine( (PointAllGu + PA_Max ));
            Console.Out.Flush();
        }


        //---------------------------------------------------------------------------------
        /// <summary>
        /// 
        /// </summary>
        public static void preprocess()
        {
            //出力高速化
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
        }


        /// <summary>
        /// 与えられた数が素数かどうかを計算する
        /// </summary>
        /// <param name="num">対象数</param>
        /// <returns>true:素数, false:素数ではない(合成数)</returns>
        public static bool isPrime(int num)
        {
            if (num < 2) return false;
            else if (num == 2) return true;
            else if (num % 2 == 0) return false;

            double sqrtNum = Math.Sqrt(num);
            for (int i = 3; i <= sqrtNum; i += 2)
            {
                if (num % i == 0)
                {
                    return false;
                }
            }
            return true;
        }

        /// <summary>
        /// 順列mPnを計算する
        /// </summary>
        /// <param name="m"></param>
        /// <param name="n"></param>
        /// <returns></returns>
        public static long Permutation(long m, long n)
        {
            long ret = 1;
            for(var i = 0; i < n; ++i)
            {
                ret *= m - i;
            }
            return ret;
        }
        /// <summary>
        /// 組み合わせmCnを計算する
        /// </summary>
        /// <param name="m"></param>
        /// <param name="n"></param>
        /// <returns></returns>
        public static long Combination(long m, long n)
        {
            if(m == n || n == 0)
            {
                return 1;
            }
            long ans = 1;
            for(var i = 0; i <= n; ++i)
            {
                ans *= (m - i + 1) / i;
            }
            return ans;
        }

        static long Gcd(long m, long n)
        {
            if (n == 0) return m;
            return Gcd(n, m % n);
        }

        static long Lcm(long m, long n)
        {
            var gcd = Gcd(m, n);
            //return (m * n) / gcd;
            return m / gcd * n;//桁あふれ対策
        }
    }
}



Measured memory_bytes: 13280
module Main where

import Data.Functor

main :: IO ()
main = do
  { loop 1
  }

loop :: Int -> IO ()
loop i = do
  { [x] <- getInts
  ; if x == 0 then done
    else do
      { putStrLn ("Case " ++ show i ++ ": " ++ show x)
      ; loop (i+1)
      }
  }

getInts :: IO [Int]
getInts = map read . words <$> getLine

done :: IO ()
done = return ()

Measured memory_bytes: 4116
function main(input) {
  const args = input.split('\n');
  const N = parseInt(args[0], 10);
  const M = parseInt(args[N + 1], 10);
  data = {};
  let blues = [];
  let reds = [];
  let ans;
  
  for (let i = 1; i <= N; i++) {
    blues.push(args[i]);
  }
  
  for (let i = (N + 2); i <= (N + M + 1) ; i++) {
  	reds.push(args[i]);
  }
  
  for (let i = 0; i < blues.length; i++) {
    key = blues[i];
    data[key] = data[key] ? data[key] + 1 : 1;
  }
  
  for (let i = 0; i < reds.length; i++) {
  	key = reds[i];
    data[key] = data[key] ? data[key] - 1 : -1;
  }
  
  for (key in data) {
    if (!ans || data[key] > ans) { 
      ans = data[key];
    }
  }
  
  if (ans < 0) {
    console.log(0);
  } else {
    console.log(ans);
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29608
import copy
def or01swap(n, pli):

    plis = copy.copy(pli)
    plis.sort()
    count = 0

    for i in range(n):
        if pli[i] != plis[i]:
            count += 1

    return "YES" if count <= 2 else "NO"

def main():
    n = int(input())
    pli = list(map(int, input().split()))
    print(or01swap(n, pli))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
ll from, to, cost;
bool operator<(const E &b) const { return cost < b.cost; }
bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
vector<string>split(string s, char c = ' ') {
	vector<string>vec;
	string h = "";
	for (int i = 0; i < s.size();) {
		int j = i;
		while (j < s.size() && s[j] != ' ') {
			h += s[j++];
		}
		if (h.size() > 0) vec.push_back(h);
		h = "";
		i = j + 1;
	}
	return vec;
}
template<typename T>
void print_vec(vector<T>a) {
	for (int i = 0; i < a.size(); i++) {
		cout << (i == 0 ? "" : " ") << a[i];
	}
	cout << endl;
}
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n;
int a[30][30];
int dp[22][1 << 21];
bool used[22][1 << 21];
int solve(int i, int t) {
	if (i == n && t == (1 << n) - 1) {
		return 1;
	}
	if (used[i][t]) return dp[i][t];
	int sum = 0;
	for (int j = 0; j < n; j++) {
		if (a[i][j] && ((1 << j)&t) == 0) {
			sum += solve(i + 1, t|(1 << j));
			sum %= Mod;
		}
	}
	used[i][t] = 1;
	return dp[i][t] = sum;
}
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	cout << solve(0, 0) << endl;
}

Measured memory_bytes: 354560
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int d=sc.nextInt();
        int x=sc.nextInt();
        for(int i=0;i<n;i++)x+=(d-1)/sc.nextInt()+1;
        System.out.println(x);
    }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define all(x) (x).begin(), (x).end()

using namespace __gnu_pbds;
using namespace std;

using ull = unsigned long long;
using ll = long long;
using ld = long double;
template <typename T> using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

const int mod = 1e9 + 7;
const int inf = INT_MAX;

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

    int n, d;
    cin >> n >> d;

    int c = 0;
    while (n--) {
        ll x, y;
        cin >> x >> y;

        if (x * x + y * y <= d * (ll)d)
            c++;
    }

    cout << c << "\n";
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define MOD 1e9+7;
using namespace std;
using Graph = vector<vector<int>>;
typedef vector<vector<char>> field_t;
typedef  unsigned long long int ull;
typedef pair<int, int> point_t;
typedef long long ll;
ll N,K;
ll chr[100001];



signed main()
{
    cin >> N >> K;
    vector<ll> a(N);
    ll sum=0;
    rep(i,N){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    rep(i,K){
        sum+=a[i];
    }
    cout << sum <<endl;
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define ll long long
#define coYes cout << "Yes" << endl
#define coYES cout << "YES" << endl
#define coyes cout << "yes" << endl
#define coNo cout << "No" << endl
#define coNO cout << "NO" << endl
#define cono cout << "no" << endl
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
int gcd(int a, int b){ //最大公約数
    if(a%b == 0){
        return b;
    }else{
    return gcd(b, a%b);
    }
}

int main(){
    int k;
    cin >> k;
    rep0(i,k){
        cout << "ACL";
    }
    cout << endl;
}

Measured memory_bytes: 3624
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define ub upper_bound
#define lb lower_bound
#define bit __builtin_popcount

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

inline void boost(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const ll maxn=5e3+123;
const ll inf=1e9+123;
const ll linf=1e18+123;
const ll mod=1e9+7;
const ll p=31;
const double eps=1e-9;
const double pi=acos(-1);
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};
int n;
string s;
bool check(int x){
    unordered_map<string,int>cntr;
    unordered_map<string,int>f;
    for(int i=0;i<n;i++){
        if(i+x-1<n){
            string t=s.substr(i,x);
            if(f[t]<=i){
                cntr[t]++;
                if(cntr[t]>1){
                    return 1;
                }
                else{
                    f[t]=i+x;
                }
            }
        }
    }
    return 0;
}
int main(){
    //boost();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin>>n;
    cin>>s;
    int mx=0;
    int l=1,r=n;
    while(l<r){
        int m=l+r>>1;
        if(check(m)==1){
            mx=max(mx,m);
            l=m+1;
        }
        else{
            r=m;
        }
    }
    cout<<mx;
	exit(0);
}


Measured memory_bytes: 6812
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
  
#define repd(i,a,b) for (int i=(a);i<=(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}
  
int main()
{
  int a; string s;

  cin >> a >> s;

  if(a >= 3200){
      cout << s << endl;
  }
  else{
      cout << "red" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

const int pi = (int) 2 * acos(0.0);

int main() {
  //cout << pi << endl;
  int r;
  cin >> r;
  cout << (int) (1ll * r * r * pi) / (int) (pi) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include<cstdio>
using namespace std;

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

  int K, X;
  
  cin >> K >> X;
  
  
  int rig = X + (K - 1);
  int lef = X - (K - 1);
  
  for(int i = lef; i < rig + 1; i++) {
    cout << i << " ";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define ALL(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl


int main() {
    IN(int, k);
    IN(int, s);
    int ans = 0;
    REP(x, k+1){
        REP(y, k+1){
            int z = s-x-y;
            if ((z>=0) && (z<=k)) {
                ans ++;
            }
        }
    }
    COUT(ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"

using namespace std;


int main()
{
    int d, t, s;
    cin >> d >> t >> s;

    if((t * s) >= d)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3612
n = int(input())
s = list(map(int, list(input())))

ans = 0

def dfs(depth, id):
    global ans
    for i in range(10):
        for j in range(id, n):
            if i == s[j]:
                if depth < 2:
                    dfs(depth + 1, j + 1)
                else:
                    ans += 1
                break

dfs(0, 0)
print(ans)

Measured memory_bytes: 3644
/*
  ∧,,∧
( 'ω' )つ ＜WA,またお前か！！　
（m9 ＼ 　　
　 ＼　 ＼
　 　 ) ) ＼
　 ／／ ＼ ＼
　 (＿） 　 (＿)
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    if (a >= 3200) {
        cout << s << endl;
    } else {
        cout << "red" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;

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

	int a, b;
	cin >> a >> b;
	string s;
	cin >> s;
	repr(i, 0, a) {
		if (s[i] == '-') {
			cout << "No" << endl;
			return 0;
		}
	}

	if (s[a] != '-') {
		cout << "No" << endl;
		return 0;
	}

	repr(i, a + 1, a+b+1) {
		if (s[i] == '-') {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define forn(a,b,c) for(int a=b;a<=c;a++)
#define ford(a,b,c) for(int a=b;a>=c;a--)
#define f first
#define s second
typedef pair<int,int> pii;
const int N=2e5+5;
const int mod=998244353;
const ll inf=1e18+7;
int n,k,h[N],cost[N];
int main()
{
    scanf("%d%d",&n,&k);
    forn(i,2,n){
        cost[i]=1e9+7;
    }
    forn(i,1,n){
        scanf("%d",&h[i]);
        forn(j,max(1,i-k),i-1){
            cost[i]=min(cost[i],cost[j]+abs(h[i]-h[j]));
        }
       // printf("cost[%d]:%d\n",i,cost[i]);
    }
    printf("%d\n",cost[n]);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    int n = (int)s.length(), i = 0;
    while (i < n) {
        if (s[i] == 'm') {
            if (i + 4 < n && s[i + 1] == 'a' && s[i + 2] == 'e' && s[i + 3] == 'r' && s[i + 4] == 'd') i += 5;
            else {
                cout << "NO";
                return 0;
            }
        } else if (s[i] == 'e') {
            if (i + 4 < n && s[i + 1] == 's' && s[i + 2] == 'a' && s[i + 3] == 'r' && s[i + 4] == 'e') i += 5;
            else {
                cout << "NO";
                return 0;
            }
        } else if (s[i] == 'r') {
            if (i + 6 < n && s[i + 1] == 'e' && s[i + 2] == 'm' && s[i + 3] == 'a' && s[i + 4] == 'e' && s[i + 5] == 'r' && s[i + 6] == 'd') i += 7;
            else if (i + 5 < n && s[i + 1] == 'e' && s[i + 2] == 's' && s[i + 3] == 'a' && s[i + 4] == 'r' && s[i + 5] == 'e') i += 6;
            else {
                cout << "NO";
                return 0;
            }
        } else {
            cout << "NO";
            return 0;
        }
    }
    if (i == n) cout << "YES";
    else cout << "NO";
}


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

int main(){
    string A,B,C;
    cin>>A>>B>>C;
    
    int ans = max({ stoi(A+B)+stoi(C),
                    stoi(B+A)+stoi(C),
                    stoi(B+C)+stoi(A),
                    stoi(C+B)+stoi(A),
                    stoi(C+A)+stoi(B),
                    stoi(A+C)+stoi(B)});

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

Measured memory_bytes: 256