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

#define EQ(n,m) (abs((n)-(m)) < EPS * (abs(n) + abs(m)))

typedef vector<double> vec;
typedef vector<vec> mat;
const double EPS = 1e-9;

int D;
vec V;

vec gauss_jordan(mat& A){
    int m = A.size();
    int n = A[0].size();
    
    for(int i=0; i<m; i++){
        int pivot = i;
        for(int j=i; j<m; j++)
            if(abs(A[pivot][i]) < abs(A[j][i])) pivot = j;
        swap(A[i], A[pivot]);
        
        if(EQ(A[i][i], 0)) return vec();
        
        for(int j=i+1; j<n; j++)
            A[i][j] /= A[i][i];
        A[i][i] = 1; //for debugging
        
        for(int j=0; j<m; j++) if(i != j){
            for(int k=i+1; k<n; k++)
                A[j][k] -= A[j][i] * A[i][k];
            A[j][i] = 0; //for debugging
        }
    }
    vec res(m);
    for(int i=0; i<m; i++)
        res[i] = A[i][n-1];
    return res;
}

int solve(){
    double m = 1<<30;
    int mi = -1;
    
    for(int i1=0; i1<D+3; i1++){
        vec ans;
        for(int i2=0; i2<D+3; i2++) if(i1 != i2){
            mat A;
            
            for(int j=0; j<D+3; j++) if(i1 != j && i2 != j){
                vec row(D+2);
                for(int k=0; k<D+1; k++){
                    row[k] = pow(j, D-k);
                }
                row[D+1] = V[j];
                A.push_back(row);
            }
            vec t = gauss_jordan(A);
            if(ans.size() == 0){
                ans = t;
            }else{
                for(int i=0; i<ans.size(); i++)
                    if(abs(ans[i]-t[i]) < m){
                        m = abs(ans[i]-t[i]);
                        mi = i1;
                    }
            }
        }
    }
    
    return mi;
}

int main(){
    while(cin >> D, D){
        V.resize(D+3);
        for(auto& v: V) cin >> v;
        cout << solve() << endl;
    }
    return 0;
}

Measured memory_bytes: 3396
#include<iostream>


#include<queue>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<cstdlib>
#include<math.h>
using namespace std;

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

typedef pair<int, int> pii;


int main() {
	
	long long x, y;
	cin >> x >> y;

	int cnt = 0;
	for (int i = 0; x <= y; i++) {
		cnt++;
		x *= 2;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

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

ll mod = 1e9 + 7;


int main(){
	int a,b;
	cin >> a >> b;
	if(a<10&&b<10)cout << a*b << endl;
	else cout << "-1" << endl;
	return 0;
}


Measured memory_bytes: 256
function main() {
  const D = Number(input[0]);
  const c = input[1].split(' ').map(Number);
  
  const scores_of_day = input.slice(2,D+2);
  const scores = scores_of_day.map((text) => {
    return text.split(' ').map(Number);
  });
  let s = 0;
  let c_stock = Array.from(c);
  let real_s, add, t;
  
  for (i=0;i<D;i++) {
    real_s = [];
    for (j=0;j<26;j++) {
      real_s.push(scores[i][j]-c_stock[j]);
    }
    t = real_s.indexOf(Math.max.apply(null, real_s));
    s += scores[i][t];
    add = Array.from(c);
    add[t] = 0;
    
    for (j=0;j<26;j++) {
      c_stock[j] += add[j];
    }
    s -= c_stock.reduce(function(a, x){return a + x;});
    console.log(t+1);  
  }
}

var input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});

Measured memory_bytes: 34200
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
using graph = vector<vector<int>>;

const int INF = 1001001001;

int main(){
	int n,m;
	cin >> n >> m;
	graph G(n);
	rep(i,m){
	int a,b;
    cin >> a >> b;
    a--,b--;
	G[a].push_back(b);
	G[b].push_back(a);
	}
	
	vector<int> dist(n,INF);
	queue<int> q;
  	vector<int> kari(n, -1);
	
	dist[0] = 0;
	q.push(0);
	
	while(!q.empty()){
		int v = q.front();
		q.pop();
		
		for(int nv : G[v]){
			if(dist[nv] != INF) continue;
			
			dist[nv] = dist[v] + 1;
          	kari[nv] = v;
			q.push(nv);
		}
	}
  cout << "Yes" << endl;
	rep(i,n){
      	if(i == 0) continue;
      	int an = kari[i];
      	an++;
		cout << an << endl;
	}
}


Measured memory_bytes: 10604
#include<iostream>
using namespace std;
int main(){
	int b1,b2,b3;
	cin >> b1 >> b2 >> b3;
	if(b1 == 1 && b2 == 1 || b3 == 1){
		cout << "Open" << endl;
	}
	else{
		cout << "Close" << endl;
	}
}

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define CEIL(n, m) ceil(n/pow(10.0, m))*pow(10.0, m)
#define FLOOR(n, m) floor(n/pow(10.0, m))*pow(10.0, m)
#define ROUND(n, m) round(n/pow(10.0, m))*pow(10.0, m)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define llong long long
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

void solve()
{
  int ans=0;

  int x; cin >> x;
  int sum=0;
  for (int i=0; i<x; i++) {
    sum += i+1;
    ans++;
    if (sum >= x) break;
  }

  cout << ans << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
# BFS
from collections import deque

h, w = map(int, input().split())
s = [input() for _ in range(h)]

ans = 0

for i in range(h):
    for j in range(w):
        if s[i][j] == '#': continue
        q = deque([(i, j)])
        dist = [[-1]*w for _ in range(h)]
        dist[i][j] = 0
        while q:
            x, y = q.popleft()
            for k, l in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
                if 0 <= x+k < h and 0 <= y+l < w and dist[x+k][y+l] < 0 and s[x+k][y+l] == '.':
                    dist[x+k][y+l] = dist[x][y] + 1
                    ans = max(ans, dist[x+k][y+l])
                    q.append((x+k, y+l))
print(ans)

Measured memory_bytes: 3444
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "benri.h"
#else
#define out(args...)
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
const ll MOD=1e9+7; //998244353

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	vector<int> a(4);
	rep(i,4) cin>>a[i];
	sort(all(a));
	int re=MOD;
	do{
		MN(re,abs(a[0]+a[1]-a[2]-a[3]));
	}while(next_permutation(all(a)));
	cout<<re NL;
  return 0;
}



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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

ll pow_mod(ll v, ll st){
	ll ans = 1ll;
	for(; st; st /= 2ll){
		if (st & 1){
			ans = (ans * v) % MOD;
		}
		v = (v * v) % MOD;
	}
	return ans;
}

vi divs;
vector<ll> dp;

void solve(){
	int n, k;
	cin >> n >> k;
	for(int i = 1; i * i <= n; i++){
		if (n % i == 0){
			divs.pb(i);
			if (i * i != n){
				divs.pb(n / i);
			}
		}
	}
	SORT(divs);
	int m = SZ(divs);
	dp.resize(m);
	dp[0] = k;
	REP(i, 1, m){
		dp[i] = pow_mod(k, (divs[i] + 1) / 2);
		REP(j, 0, i){
			if (divs[i] % divs[j] == 0){
				dp[i] = (dp[i] + MOD - dp[j]) % MOD;
			}
		}
	}
	ll ans = 0ll;
	REP(i, 0, m){
		//cout << divs[i] << " " << dp[i] << endl;
		ll mul = divs[i];
		if (divs[i] % 2 == 0){
			mul /= 2;
		}
		ans = (ans + dp[i] * mul) % MOD;
	}
	cout << ans << endl;
	
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Objects;

public class Main {
  public static void main(String[] args ){

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    int B = sc.nextInt();

    long result = -1;
    if (A % 2 == B % 2){
      result =(A + B) / 2;
    }

    System.out.println(result < 0 ? "IMPOSSIBLE" : Objects.toString(result, ""));

  }
}


Measured memory_bytes: 22612
#include<iostream>

using namespace std;

int main(){
   int n, a, count = 0, ocount = 0;
   int colar[8] = {};

   cin >> n;
   for(int i = 0; i < n; i++){
      cin >> a;
      if(a < 3200){
         colar[a/400]++;
      }else{
         ocount++;
      }
   }

   for(int i = 0; i < 8; i++) if(colar[i] != 0) count++;
   cout << (count != 0 ? count : 1) << " " << count + ocount << endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#define mem0(a) memset(a,0,sizeof(a))
#define meminf(a) memset(a,0x3f,sizeof(a))
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef double db;
const int maxn = 1e6 + 10;
char s[4];
int cnt1,cnt2,cnt3;
int main()
{
   cin>>s;
   for(int i=0;i<3;i++)
   {
    if(s[i]=='a')cnt1++;
    if(s[i]=='b')cnt2++;
    if(s[i]=='c')cnt3++;
   }
   if(cnt1&&cnt2&&cnt3)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			C();
		}
 
		public static void C()
		{
			Scanner cin = new Scanner();
			string s = cin.Next();
			List<int> v = new List<int>();
			int count0 = 0;
			int count1 = 0;
			for (int n = 0; n < s.Length; ++n) {
				if (s[n] == '0') {
					++count0;
				} else {
					++count1;
				}
			}
 
			int temp = Math.Abs(count0 - count1);
 
			Console.WriteLine(s.Length - temp);
		}
 
		public static int Hoge(string s, int count)
		{
			int n = s.Length - 1;
			if (n <= 0) {
				return count;
			}
 
			int maxCount = count;
			for (int m = 0; m < n; ++m) {
				if (s[m] != s[m + 1]) {
					int count2 = count + 2;
					string s2 = s.Remove(m, 2);
					int count3 = Hoge(s2, count2);
 
					if (count3 > maxCount) {
						maxCount = count3;
					}
				}
			}
 
			return maxCount;
		}
 
		public static int Piyo(List<int> s, int count)
		{
			int n = s.Count - 1;
			if (n <= 0) {
				return count;
			}
 
			int maxCount = count;
			for (int m = 0; m < n; ++m) {
				var s2 = new List<int>(s);
				if (s2[m] != s2[m + 1]) {
					int count2 = count + 2;
					s2.RemoveRange(m, 2);
					int count3 = Piyo(s2, count2);
 
					if (count3 > maxCount) {
						maxCount = count3;
					}
				}
			}
 
			return maxCount;
		}
 
		
	}
 
	public class Scanner
	{
		string[] s;
		int i;
 
		char[] cs = new char[] { ' ' };
 
		public Scanner()
		{
			s = new string[0];
			i = 0;
		}
 
		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}
 
		public int NextInt()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextInt() + add;
			}
			return Array;
		}
 
		public long NextLong()
		{
			return long.Parse(Next());
		}
 
		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextLong() + add;
			}
			return Array;
		}
 
		public double NextDouble()
		{
			return double.Parse(Next());
		}
 
 
		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

Graph graph;
ll dp[100005][2];
bool visited[100005];

ll dfs(int v) {
    dp[v][0] = 1;
    dp[v][1] = 1;
    visited[v] = true;
    for (int u : graph[v]) {
        if (!visited[u]) {
            dfs(u);
            dp[v][0] = dp[v][0] * (dp[u][0] + dp[u][1]);
            dp[v][0] %= MOD;
            dp[v][1] = dp[v][1] * dp[u][0];
            dp[v][1] %= MOD;
        }
    }
    return (dp[v][0] + dp[v][1]) % MOD;
}

void Main() {
    int N;
    cin >> N;
    graph.resize(N);
    rep(i, N - 1) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    cout << dfs(0) << '\n';
}

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


Measured memory_bytes: 12928
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
// rep(i, 1, 4) --> {1,2,3,4}
// rep(i, 4, 1) --> {4,3,2,1}
// rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int n, r;
    cin >> n >> r;
    cout << (n>=10?r:r+(100*(10-n)));
    return 0;
}

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

using namespace std;

int main() {
	char ch;
	while (1){
		cin.get(ch);
		if (ch == '\n') break;
		if (islower(ch)) cout << (char)toupper(ch);
		else if (isupper(ch)) cout << (char)tolower(ch);
		else cout << ch;
	}
	cout << endl;
}

Measured memory_bytes: 1124
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
#define pi acos(-1);
ll strtoint(string str);
int main(){
	fast;
	ll a,b,x,v;
	double pp,bb;
	double ans=0; cin>>a>>b>>x;
	v=a*a*b;
	if(v<=2*x){
		pp=2*(v-x);
		bb=a*a*a;
		ans=atan(pp/bb);
	}else{
		pp=a*b*b;
		bb=2*x;
		ans=atan(pp/bb);
	}
	ans*=180/pi;
	cout<<setprecision(10)<<fixed<<ans<<'\n';
	return 0;
}
ll strtoint(string str){
	ll x=0;
	stringstream ss;
	ss<<str;
	ss>>x;
	return x;
}

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  string ans = "";
  ans = ans + a.at(0) + b.at(0) + c.at(0);
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

			int i=0;

			int height = scan.nextInt();
			int width = scan.nextInt();
//			int height = Integer.parseInt(args[k]);
//			int width = Integer.parseInt(args[k+1]);
			
			if(!(height == 0 && width ==0)){

				for(i = 0;i<height;i++){

					if(i == 0 || i == height-1){//先頭の場合
						for(int j=0;j < width; j++){
							System.out.print("#");
						}
						System.out.println("");


					}else{
						for(int j=0;j < width; j++){
							if(j==0 || j == width-1){
								System.out.print("#");
							}else{
							System.out.print(".");
							}
						}
						System.out.println("");
					}
				}
			}
			
			if(height == 0 && width== 0){
				break;
			}
			System.out.println("");		//H=0,W=0のときは改行しない
		}

	}
}


Measured memory_bytes: 32720
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#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()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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
}
 
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;
}
 
using namespace std;

vector<int>z_algorithm(const string &s){//Z-Algorithm O(|S|)
	vector<int>prefix(s.size());
	for(int i=1,j=0;i<s.size();++i){
		if(i+prefix[i-j]<j+prefix[j]){
			prefix[i]=prefix[i-j];
		}
		else {
			//再利用出来ないとき
			int k=max(0,j+prefix[j]-i);
			while(i+k<s.size()&&s[k]==s[i+k])++k;//Sの先頭からとS[i]からk文字共通しているか
			prefix[i]=k;//共通接頭辞の長さはk
			j=i;
		}
	}
	prefix[0]=(int)s.size();//0文字目から始めるということはSとSを比較しているということなのでs.size()
	return prefix;
}


void solve(){
  int n;
  string s;
  cin>>n>>s;
  int ans=0;
  rep(i,n){
    string t=s.substr(i,n-i);
    auto x=z_algorithm(t);
    rep(j,x.size()){
      int res=x[j];
      chmin(res,j);
      chmax(ans,res);
    }
  }
  cout<<ans<<endl;
}

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

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

using namespace std;
using ll = long long;


int main()
{
    int e;
    while(scanf("%d", &e)){
        if(e == 0)return 0;
        int ans = 1e9;
        for(int z = 0;z * z *z <= e;z++){
            for(int y = 0;y * y <= e - z * z * z;y++){
                int s = z * z * z + y * y;
                int usi = e - s;
                ans = min(ans, z + y + usi);
            }
        }
        printf("%d\n", ans);
    }
}



Measured memory_bytes: 3148
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  double x[3],y[3],s=0,z,a,b,c;
  char cc;
  cin>>x[0]>>cc>>y[0];
  cin>>x[1]>>cc>>y[1];
  for(int i=1;cin>>x[i%2+1]>>cc>>y[i%2+1];i++){
    a = sqrt((x[1]-x[0])*(x[1]-x[0])+(y[1]-y[0])*(y[1]-y[0]));
    b = sqrt((x[2]-x[1])*(x[2]-x[1])+(y[2]-y[1])*(y[2]-y[1]));
    c = sqrt((x[2]-x[0])*(x[2]-x[0])+(y[2]-y[0])*(y[2]-y[0]));
    z = (a+b+c)/2;
    s += sqrt(z*(z-a)*(z-b)*(z-c));
  }
  printf("%.7f\n",s);
  return 0;
}

Measured memory_bytes: 0
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int n,m;
int taro[110];
int hanako[110];

int main()
{
  while(cin>>n>>m,n||m){
    rep(i,n){
      cin>>taro[i];
    }rep(i,m){
      cin>>hanako[i];
    }
    
    int sum =1e+7;
    int a,b;
    int ansx=-1,ansy;
    for(int i = 0;i < n;i++){
      for(int j = 0;j < m;j++){
	a = i;//太郎が交換
	b = j;//花子が交換
	int sum1= 0;
	int sum2 = 0;
	for(int l = 0;l < n;l++){
	  if(l !=a){
	    sum1 +=taro[l];
	  }else{
	    sum1 +=hanako[b];
	  }
	}
	for(int l = 0;l < m;l++){
	  if(l !=b){
	    sum2 +=hanako[l];
	  }else{
	    sum2 +=taro[a];
	  }
	}
	if(sum1 ==sum2&&sum >sum1){
	  ansx = taro[a];
	  ansy = hanako[b];
	  sum =sum1;
	}
      }
    }
    if(ansx==-1){
      cout <<ansx<<endl;
    }else{
      cout <<ansx<<" "<<ansy<<endl;
    }
  }
    return 0;
  }

Measured memory_bytes: 1164
import math
n=int(input())

a=[int(input()) for i in range(n)]
k=0
l=int(math.sqrt(max(a)))
for i in range(n):
    if a[i]!=1 and a[i]>0:
        for j in range(2,l):
            if a[i]%j==0 and a[i]!=j:
                m=2
                break
            m=1
        if a[i]==2:
            m=1
        if m==1:
            k+=1
print(k)



Measured memory_bytes: 6008
#include <stdio.h>

#define N 100001

typedef struct{
  int parent;
  int left;
  int right;
  int sibling;
}Node;

Node T[N];
int depth[N];

int heightcheck(Node T[], int i){
  int height = 0;
  int left, right;
  if(T[i].left == -1 && T[i].right == -1) return height;
  else if(i == -1) return height;

  left = heightcheck(T,T[i].left);
  right = heightcheck(T,T[i].right);
  if(left > right) return left + 1;
  else return right + 1;
}
int main(){
  int n, i, j, buf;
  int id, degree;

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    T[i].parent = -1;
    T[i].left = N;
    T[i].right = N;
    T[i].sibling = -1;
    depth[i] = 0;
  }

  for(i = 0; i < n; i++){
    scanf("%d", &id);
    scanf("%d%d", &T[id].left, &T[id].right);

    if(T[id].left != -1){
      T[T[id].left].parent = id;
      T[T[id].left].sibling = T[id].right;
    }

    if(T[id].right != -1){
      T[T[id].right].parent = id;
      T[T[id].right].sibling = T[id].left;
    }
  }

  for(i = 0; i < n; i++){
     buf = T[i].parent;
      while(1){
	if(buf == -1) break;
	else {
	  buf = T[buf].parent;
	  depth[i]++;
	}
      }

      printf("node %d: parent = %d, sibling = %d,", i, T[i].parent, T[i].sibling);

      if(T[i].left != -1 && T[i].right != -1){
	printf(" degree = 2, depth = %d, height = %d,", depth[i], heightcheck(T,i));
	if(T[i].parent == -1)printf(" root\n");
	else printf(" internal node\n");
      }
      else if(T[i].left != -1 || T[i].right != -1){ 
	printf(" degree = 1, depth = %d, height = %d,", depth[i], heightcheck(T,i));
	if(T[i].parent == -1)printf(" root\n");
	else printf(" internal node\n");
      }
      else{
	printf(" degree = 0, depth = %d, height = %d,", depth[i], heightcheck(T,i));
	if(T[i].parent == -1)printf(" root\n");
	else printf(" leaf\n");
      }
  }
  return 0;
}

Measured memory_bytes: 620
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

struct Seg {
  int l;
  int r;
  int m;
};

int N;
int K;
bool fail = false;
int ans[114514];
int fed[114514];
Seg s[114514];
vector<int> es[114514];

Seg Merge(Seg a, Seg b) {
  if (a.m == 2) return b;
  if (b.m == 2) return a;
  if (a.m != b.m) return Seg{0, 0, 0};
  Seg ret{max(a.l, b.l), min(a.r, b.r), a.m};
  if ((2+ret.l%2)%2 != ret.m) ret.l++;
  return ret;
}

Seg Dfs(int v, int p) {
  s[v] = Seg{-MOD, MOD, 2};
  for (int u : es[v]) {
    if (u == p) continue;
    auto res = Dfs(u, v);
    res.l--;
    res.r++;
    if (res.m != 2) res.m ^= 1;
    s[v] = Merge(s[v], res);
  }

  if (s[v].r - s[v].l <= 0) fail = true;
  if (fed[v] >= 0) {
    if (s[v].m != 2) {
      if (s[v].l > fed[v]) fail = true;
      else if (s[v].r <= fed[v]) fail = true;
      else if (fed[v]%2 != s[v].m) fail = true;
    }
    if (fail) return s[v];

    s[v].l = fed[v];
    s[v].r = fed[v]+1;
    s[v].m = fed[v]%2;
  }

  //printf("v=%d: %d %d %d\n", v+1, s[v].l, s[v].r, s[v].m);
  return s[v];
}

void Dfs2(int v, int p) {
  if (fed[v] < 0) {
    Seg tmp = s[p];
    if (v != p) {
      tmp.m ^= 1;
      tmp.l--;
      tmp.r++;
    }

    s[v] = Merge(s[v], tmp);
    assert(s[v].r - s[v].l >= 1);
    ans[v] = s[v].l;
    if (s[v].m != (2+s[v].l%2)%2) ans[v]++;
    assert(ans[v] < s[v].r);

    s[v].l = ans[v];
    s[v].r = ans[v]+1;
    s[v].m = (2+ans[v]%2)%2;
  } else ans[v] = fed[v];

  for (int u : es[v]) {
    if (u == p) continue;
    Dfs2(u, v);
  }
}

int main() {
  scanf("%d", &N);
  rep(i, N-1) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a;
    --b;
    es[a].eb(b);
    es[b].eb(a);
  }

  fill(fed, fed+N, -MOD);

  scanf("%d", &K);
  rep(i, K) {
    int v, p;
    scanf("%d%d", &v, &p);
    --v;
    fed[v] = p;
  }
  Dfs(0, 0);

  if (fail) {
    puts("No");
    return 0;
  }

  Dfs2(0, 0);

  puts("Yes");
  rep(i, N) {
    printf("%d\n", ans[i]);
  }
}


Measured memory_bytes: 19840
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

    int main(){
      string S;
      cin >> S;
      bool flag1=false;
      bool flag2=false;
      bool flag3=false;
      if(S[0]=='A'){
        flag1=true;
      }
      int count=0;
      for(int i=2;i<S.size()-1;i++){
        if(S[i]=='C'){
       count++;
        }
      }
      if(count==1){
       flag2=true; 
      }
      int count2=0;
      for(int i=0;i<S.size();i++){
        for(char j='a';j<='z';j++){
       if(S[i]==j) count2++; 
        }
      }
      if(count2==S.size()-2){
       flag3=true;
      }
      if(flag1==true && flag2==true && flag3==true){
       cout << "AC" << endl; 
      }
      else{
       cout << "WA" << endl; 
      }
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr const ll INF = LLONG_MAX / 2;

struct node {
    int to;
    ll cost;
};

vector<ll> dijkstra(vector<vector<node>> const &graph, int K) {
    int N = graph.size();
    vector<ll> cost(N, INF);
    cost[K] = 0;
    priority_queue<pair<ll,int>> que;
    unordered_set<int> used;

    que.push({0, K});
    while (!que.empty()) {
        auto p = que.top(); que.pop();
        auto u = p.second;
        if (used.count(u) || cost[u] != p.first)
            continue;
        used.insert(u);
        for (auto const &v: graph[u]) {
            cost[v.to] = min(cost[v.to], cost[u] + v.cost);
            que.push({cost[v.to], v.to});
        }
    }
    return cost;
}

int main() {
    int N;
    cin >> N;
    vector<vector<node>> graph(N);

    for (int i = 0; i < N - 1; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        graph[a].push_back({b, c});
        graph[b].push_back({a, c});
    }

    int Q, K;
    cin >> Q >> K;
    K--;

    auto cost = dijkstra(graph, K);

    for (int i = 0; i < Q; i++) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        cout << cost[x] + cost[y] << endl;
    }
    return 0;
}


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



int main(){
    string sa, sb, sc;
    vector <string> s;
    cin >> sa >> sb >> sc;
    s.push_back(sa);
    s.push_back(sb);
    s.push_back(sc);
    vector <vector<int>> int_s(3);
    for (int i = 0; i < 3; i ++){
        for (int j = 0; j < s[i].size(); j ++){
            int_s[i].push_back(s[i][j] - 'a');
        }
        int_s[i].push_back(-1);
    }

    vector <int> trash_cnt(3, 0);
    int turn = 0;

    while(1){

        int next_turn = int_s[turn][trash_cnt[turn]];
        if (next_turn == -1) break;
        trash_cnt[turn] += 1;
        turn = next_turn;
    }

    char ans = turn + 'A';
    cout << ans << endl;
}

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

using namespace std;

#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))

template <class T> inline T bigmod(T p, T e, T m)
{
    T ret = 1;
    for (; e > 0; e >>= 1)
    {
        if (e & 1)
            ret = (ret * p) % m;
        p = (p * p) % m;
    }
    return (T)ret;
}

#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
    cerr << name << " is " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " is " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define debug(...)
#endif



void solve()
{
    int n;
    cin>>n;

    vector<int> items(n);

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

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

    int diff=0;

    for(int i=0; i<n; i++)
    {
        if(temp[i]!=items[i])
        {
          diff++;
        }
    }

    if(diff==0||diff==2)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
}

int main()
{
    int t=1;

    while (t--)
    {
        solve();
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const int MN=1e5+4,MOD=1e9+7;
int N,M,A[MN];
std::bitset<MN>ok;
long long mem[MN];
long long solve(int loc) {
  if(loc > N || ok[loc]) return 0;
  if(loc == N) return 1;
  if(~mem[loc]) return mem[loc];
  return mem[loc] = (solve(loc+1) + solve(loc+2)) % MOD;
}
int main() {
   scanf("%d%d",&N,&M);
   for(int i=0,a;i<M;++i) {
     scanf("%d",&a);
     ok[a]=1;
   }
  memset(mem, -1, sizeof mem);
  printf("%lld",solve(0));
}

Measured memory_bytes: 4096
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

def D(p):
    sum = 0
    for i in range(n):
        sum += abs(x[i]-y[i])**p
    print('{:.6f}'.format(sum ** (1/p)))

for i in range(n):
    z = [abs(x[i]-y[i]) for i in range(n)]

D(1)
D(2)
D(3)
print('{:.6f}'.format(max(z)))


Measured memory_bytes: 5652
//ハミング数

#include<iostream>
using namespace std;

int main()
{

  while(1){
  

    int m,n,cnt=0;
    
  
      cin >> m;
      if(m==0)
        break;
      cin >> n;
 
      
    for(int i=n; m<=i; i--){
      if(i==1){
        cnt++;

        break;
      }
      int a=i;
      if(a%2==0 || a%3==0 || a%5==0){
         while(1){
           if(a%2!=0 || a==1)
             break;
           a=a/2;
         }
         while(1){
           if(a%3!=0 || a==1)
             break;
           a=a/3;
         }
         while(1){
           if(a%5!=0 || a==1)
             break;
           a=a/5;
         }
     }    
      
     if(a==1)
       cnt++;
       
      }
    cout << cnt << endl;
   }
  
  return 0;
  
}  

Measured memory_bytes: 1160
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val a = List.fill(n)(sc.nextInt())
  val count = a.groupBy(identity).view.mapValues(_.length)
  var ans = 0
  for ((k, v) <- count) {
    if (k <= v) {
      ans += v - k
    } else {
      ans += v
    }
  }
  println(ans)
}


Measured memory_bytes: 78000
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <deque>

using namespace std;

#define rep1(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep2(i, n, m) for (long long i = (long long)(n); i <= (long long)(m); i++)
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; }
const long long mod = 1e9 + 7;

int main() {
    string s; cin >> s;
    long long q; cin >> q;
    deque<char> queue;
    bool rev = false;
    for (char ch : s) queue.push_back(ch);

    rep1(i, q) {
        int t; cin >> t;
        if (t == 1) {
            rev = !rev;
        } else {
            int f; cin >> f;
            char c; cin >> c;
            if (rev) {
                if (f == 1) {
                    queue.push_back(c);
                } else {
                    queue.push_front(c);
                }
            } else {
                if (f == 1) {
                    queue.push_front(c);
                } else {
                    queue.push_back(c);
                }
            }
        }
    }
    if (rev) {
        while (!queue.empty()) {
            cout << queue.back(); queue.pop_back();
        }
    } else {
        while (!queue.empty()) {
            cout << queue.front(); queue.pop_front();
        }
    }
    cout << endl;
}

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

int main(void)
{
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    
    cout << fixed;
    // compute
    // 時間から角度を求める
    static const double pi = acos(-1);
    long double kakudo = abs((h/12+m/(12*60) - m/60)) * 2 * pi;

    // output
    long double ans = sqrt(a*a + b*b - 2*a*b*std::cos(kakudo));

    cout << setprecision(20) << ans << endl;

}


Measured memory_bytes: 4168
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main() {

  int A;
  int B;
  cin >> A >> B;
  int s = 1;
  int p = 0;
  while (s < B) {
    s = (s-1) + A;
    p++;
  }
  cout << p;

  return 0;
}


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

int main(){long n;
cin >> n;
vector<string> s(n + 1);
erep(i, n) cin >> s.at(i);

vector<long> x(33);
vector<long> y(33);
erep(i, 32) y.at(i) = 51;

long k;
erep(i, n){
    rep(j, s.at(i).size()){
        k = 1;
        for(char t = 'a'; t <= 'z'; t++){
            if(s.at(i).at(j) == t){
                x.at(k)++;
            }
            k++;
        }
    }
    erep(u, 31){
        y.at(u) = min(x.at(u), y.at(u));
        x.at(u) = 0;
    }
}
k = 1;
for(char t = 'a'; t <= 'z'; t++){
    for(long i = 1; i <= y.at(k); i++){
        cout << t;
    }
    k++;
}
cout << endl;


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




Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }

int main() {
	SS(double,R);
	p(R*2*3.1415926535897932);
}

Measured memory_bytes: 3776
#include <atcoder/fenwicktree>
#include <iostream>

int main() {
    int n, q;
    std::cin >> n >> q;
    atcoder::fenwick_tree<long long> fw(n);
    for (int i = 0; i < n; ++i) {
        int a;
        std::cin >> a;
        fw.add(i, a);
    }
    for (int i = 0; i < q; ++i) {
        int t, x, y;
        std::cin >> t >> x >> y;
        if (t == 0) fw.add(x, y);
        else std::cout << fw.sum(x, y) << "\n";
    }
    return 0;
}


Measured memory_bytes: 8220
package main

import "fmt"

func main() {
	a := [][]int{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}
	appear := [][]bool{{false, false, false}, {false, false, false, false}, {false, false, false}}
	result := "No"

	for i:=0; i<len(a); i++{
		for j:=0; j<len(a[i]); j++{
			fmt.Scan(&a[i][j])
		}
	}
	var n int
	fmt.Scan(&n)
	b := make([]int, n)
	for i:=0; i<n; i++{
		fmt.Scan(&b[i])
	}

	for i:=0; i<3; i++{
		for j:=0; j<3; j++{
			for k:=0; k<n; k++{
				if a[i][j] == b[k]{
					appear[i][j] = true
				}
			}
		}
	}

	for i:=0; i<3; i++{
		if appear[0][i] && appear[1][i] && appear[2][i]{
			result = "Yes"
		}
	}

	for i:=0; i<3; i++{
		if appear[i][0] && appear[i][1] && appear[i][2]{
			result = "Yes"
		}
	}

	if appear[0][0] && appear[1][1] && appear[2][2]{
		result = "Yes"
	}

	if appear[0][2] && appear[1][1] && appear[2][0]{
		result = "Yes"
	}

	fmt.Println(result)

}

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1000000000000000000;
long long mod=1000000007;


int main(){
    long long N,K,S;
    cin>>N>>K>>S;
    
    if(S<1e9){
        rep(i,K){
            cout<<S<<" ";
        }
        rep(i,N-K){
            cout<<S+1<<" ";
        }
    }
    else{
        rep(i,K)cout<<S<<" ";

        rep(i,N-K)cout<<'1'<<endl;
    }
    /*
    S<1e9の時　s,s,...,s,s+1,s+1,...,s+1
    S==1e9の時　s,s,...,s,1,1,...,1

    */
    
    return 0;

}
/*


*/


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

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);i++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);i--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
constexpr int loose = 0;
constexpr int tight = 1;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

ll dp[101010];

ll dfs(Graph& g,Array& used, int v){
	if(used[v]) return dp[v];
	used[v]=true;
	dp[v]=0;
	for(auto e:g[v]){
		chmax(dp[v],dfs(g,used,e.to)+1);
	}
	return dp[v];
}

void solve(){
	ll h,w;
	cin>>h>>w;
	vector<string> a(h);
	REP(i,h) cin>>a[i];
	
	Matrix dp(h,Array(w,0));
	dp[0][0]=1;

	REP(i,h){
		REP(j,w){
			if(a[i][j]=='#') continue;
			if(i+1<h) (dp[i+1][j]+=dp[i][j])%=MOD;
			if(j+1<w) (dp[i][j+1]+=dp[i][j])%=MOD; 
		}
	}

	cout<<dp[h-1][w-1]<<en;
}

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

    solve();
    return 0;
}

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

int main(){
   int n;
   cin >> n;
   vector<int> a(n);
   rep(i,n) cin >> a[i];
   set<int> s;
   rep(i,n) s.insert(a[i]);
   if(s.size() == n) cout << "YES" << endl;
   else cout << "NO" << endl;
}


Measured memory_bytes: 13508
//ID:computerbox --> Hajiyev Huseyn
#include <bits/stdc++.h>
#define FAST_READ ios_base::sync_with_stdio(0);/*cin.tie(0); cout.tie(0);*/
#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define COUT(n, a) cout<< fixed << setprecision(a) << n<<endl
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl
#define DTIME(ccc) __begin = clock(); ccc; cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<endl;
#define MAXN 200010

using namespace std;

ll A,B;
string S;

ll ret(char a)
{
	if(a>='0' && a<='9')return 1;
	else return 0;
}
map<char,ll>el;
int main(){
FAST_READ;
cin>>A>>B;
cin>>S;

for(ll i=0;i<A;i++)
{
  if(ret(S[i])==0)
  {
  	cout<<"No"<<endl;
  	return 0;
  }
}
for(ll i=A+1;i<S.size();i++)
{
  if(ret(S[i])==0)
  {
  	cout<<"No"<<endl;
  	return 0;
  }
}
if(S[A]!='-')cout<<"No"<<endl;
else cout<<"Yes"<<endl;





return 0;
} 

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


int main(void)
{
  int r,theta,rad=0;
  double x,y;
  x=0;y=0;
  while(1){
    scanf("%d,%d",&r,&theta);
    if(r==0 && theta==0)
      break;
    x+=r*cos((double)rad*M_PI/180);
    y+=r*sin((double)rad*M_PI/180);
    rad+=theta;
    //printf("%lf,%lf\n",x,y);
  }
  //printf("%lf,%lf\n",x,y);
  printf("%d\n%d\n",(int)y,(int)x);
  //printf("%lf\n",cos(90));
  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define viii vector <pair<ll,pair<ll,ll> > >
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define input(a,n) fr(i,0,n)cin>>a[i]
#define output(a,n) fr(i,0,n)cout<<a[i]<<endl
#define dbg cout<<"hurr"<<endl;
#define dbg2 cout<<"hurr2"<<endl;
#define md 1000000007
#define inf 999999999999999999
#define sp << " " <<
#define endl "\n"
#define pi 3.14159265358979323846
#define fixd(x) cout << fixed << setprecision(x);
#define sz size()
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
bool compare(pair<ll,ll> p1,pair<ll,ll> p2){
return p1.se>p2.se;
}
void solve(){
    ll a,b,c,d;
cin>>a>>b>>c>>d;
while(a>0 || c>0){
    c-=b;
    if(c>0){
        a-=d;
        if(a<=0){ no;
        return;}
    }
    else{
        yes;
        return;
    }

}

}
int main()
{   fast;
    ll t=1;
    //cin>>t;
    fr(zz,1,t+1){
    solve();
    }
}


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


int main() {
  vector<int> vec(3);
  cin >> vec.at(0) >> vec.at(1) >> vec.at(2);
  sort(vec.begin(), vec.end());
  int ans = abs(vec.at(0) - vec.at(1)) + abs(vec.at(1) - vec.at(2));
  cout << ans << endl;
  return 0;
  
}

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;
using namespace std;

const ll M = 1000000007;

signed main() {
  ll N;
  cin>>N;
  vector<ll> c(N+2);
  vector<ll> dp(N+2,0);
  for (int i=1; i<=N; i++)
    cin>>c[i];
  c[0] = c[N+1] = 300000;
  dp[0] = 1;


  // rightMost[c]: 色cが最後に出てきた位置
  vector<ll> rightMost(300000, -1);

  for (int i=1; i<=N; i++) {
    if (rightMost[c[i]] != -1 && rightMost[c[i]] < i-1) {
      dp[i] = dp[i-1] + dp[rightMost[c[i]]];
    } else {
      // 場合の数は増えない、単純にi番目を追加するだけ
      // 新しい色が出てきた時は、場合の数は増えない
      dp[i] = dp[i-1];
    }
    dp[i] %= M;
    rightMost[c[i]]= i;
  }
  cout<<dp[N]<<endl;
}



Measured memory_bytes: 5760
import Data.List

main = print . solve . map read . drop 1 . words =<< getContents

solve :: [Int] -> Int
solve xs
    | total `mod` 10 /= 0 = total
    | target == [] = 0
    | otherwise = total - minimum target
    where
        total = sum xs
        target = filter (\x -> x `mod` 10 /= 0) xs


Measured memory_bytes: 892