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

using namespace std;
int n,a[2000005],ans,ada[2000005];
int main(){
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);cout.tie(0);
	cin>>n;
	memset(ada,0,sizeof ada);
	for(int i=1;i<=n;i++){
		cin>>a[i];
		ada[a[i]]++;
	}
	sort(a+1,a+n+1);
	ans=0;
	for(int i=1;i<=n;i++){
		if(ada[a[i]]==-1) continue;
		for(int j=2*a[i];j<=a[n];j+=a[i]){
			ada[j]=-1;
		}
		if(ada[a[i]]==1) ans++;
		ada[a[i]] = -1;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 12220
#include <iostream>
using namespace std;
int main (){
	long long  a , b;
	cin >> a >> b;
	if( b % 2 == 1 ){
		cout << (a/b) * (a/b) * (a/b) ;
	}
	else {
		cout << (a/b) * (a/b) * (a/b) + ((a/(b/2) + 1) /2) * ((a/(b/2) + 1) /2) * ((a/(b/2) + 1) /2) ;
	}
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <numeric>
#include <complex>
#include <iomanip>

using namespace std;

#define bitcount(n) __builtin_popcount(n)

#define debug(n) cout << n << endl;

#define PREC(n) setprecision(n)
#define DOTPREC(n) fixed << setprecision(n)

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

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false); cin.tie(0)

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

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

const ll MOD = 1000000007;

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

    vi V;
    vi C;

    rep(i, N) {
        int tmp;
        cin >> tmp;
        V.push_back(tmp);
    }

    rep(i, N) {
        int tmp;
        cin >> tmp;
        C.push_back(tmp);
    }

    long max = 0;
    rep(i, N) {
        max += V[i] > C[i] ? V[i] - C[i] : 0;
    }

    cout << max << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
   long int N;
  cin>>N;
   long int count=0;
  for( long int a=1;a<N;a++){
    for( long int b=1;b<N;b++){
      if(a*b<N){
        count++;
      }
      else break;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include<stdio.h>
#include <string.h>
using namespace std;
int main(void){
    int N,K;
    std::cin >> N >> K;
    if(K==1){
        std::cout << 0 << std::endl;
    }
    else{
        N=N-K;
        std::cout << N << std::endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int dice[6];
  int i,j;
  char ins[101];
  for(i=0;i<6;i++)scanf("%d",&dice[i]);
  scanf("%s",ins);
  for(i=0;i<strlen(ins);i++)
  {
    if(ins[i]=='N')
    {
      int temp=dice[0];
      dice[0]=dice[1];
      dice[1]=dice[5];
      dice[5]=dice[4];
      dice[4]=temp;
    }
    if(ins[i]=='E')
    {
      int temp=dice[0];
      dice[0]=dice[3];
      dice[3]=dice[5];
      dice[5]=dice[2];
      dice[2]=temp;
    }
    if(ins[i]=='S')
    {
      int temp=dice[0];
      dice[0]=dice[4];
      dice[4]=dice[5];
      dice[5]=dice[1];
      dice[1]=temp;
    }
    if(ins[i]=='W')
    {
      int temp=dice[0];
      dice[0]=dice[2];
      dice[2]=dice[5];
      dice[5]=dice[3];
      dice[3]=temp;
    }
  }
  printf("%d\n",dice[0]);
  return 0;
}

Measured memory_bytes: 596
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
char s[1005];
long long k;
int main(){
	scanf("%s",s);
	scanf("%lld",&k);
	int ans=0;
	while(s[ans]=='1'&&ans<strlen(s)-1)ans++;
	if(k<ans+1)printf("1");
	else printf("%c",s[ans]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
string a,b,r;
int dp[3005][3005];

void LCS()
{
    r = "";
    for(int i = 1;i < a.length()+1;i++)
    {
        for(int j = 1;j < b.length()+1;j++)
        {
            if(a[i-1] == b[j-1])
                dp[i][j] = dp[i-1][j-1] + 1;
            else
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
    }
}

void cadena()
{
    r = "";
    int i = a.length(),j = b.length();
    while(i > 0 && j > 0)
    {
        if(a[i-1] == b[j-1])
        {
            r += a[i-1];
            i--; j--;
        }
        else
        {
            if(dp[i][j-1] > dp[i-1][j])
                j--;
            else
                i--;
        }
    }
    string resp = "";
    for(int k = r.length()-1;k >= 0;k--)
        resp += r[k];
    cout << resp << endl;
}

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

    cin >> a >> b;
    LCS();
    cadena();

    return 0;
}


Measured memory_bytes: 35456
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a<b){
			if(b<c){
				System.out.println("Yes");
			}
			else{
				System.out.println("No");
			}
		}
		else{
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 26316
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC073A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            n = int.Parse(Console.ReadLine());
            if (n % 10 == 9 || n / 10 == 9)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

            Console.ReadKey();
        }
    }
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];

    int flag = 0;

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

    for(int i=0; i<n-1; i++){
        if(a[i] == a[i+1]) {
            flag = 1;
            break;
        }
    }    

    if(flag) cout << "NO" << endl;
    else cout << "YES" << endl;

    return 0;

}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <queue>

//#define int long long

using namespace std;

int grid[53][53];

struct s
{
    int x;
    int y;
};

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

    int w, h;
    cin >> h >> w;

    string str;
    int white = 0;

    for (int hh = 0; hh < h; ++hh)
    {
        cin >> str;

        for (int ww = 0; ww < w; ++ww)
        {
            grid[hh + 1][ww + 1] = str[ww] == '#' ? -1 : 0;
            white += (str[ww] == '#' ? 0 : 1);
        }
    }
    //マップの周りを埋める
    for (int ww = 0; ww < w + 2; ++ww)
    {
        grid[0][ww] = -1;
        grid[h + 1][ww] = -1;
    }

    //マップの周りを埋める
    for (int hh = 0; hh < h + 2; ++hh)
    {
        grid[hh][0] = -1;
        grid[hh][w + 1] = -1;
    }

    queue
 qu;

    //スタート地点をqueueに積む
    qu.push({ 1,1 });

    for (;;)
    {
        //たどり着けなかったら-1出して終了
        if (qu.empty())
        {
            cout << -1 << endl;
            return 0;
        }

        //1番後ろを取り出す
        s s = qu.front();
        qu.pop();
        const auto n = grid[s.y][s.x];

        //cout << s.x << "<x | y> " << s.y << " n:" << s.n << endl;

        //4方向をそれぞれ検証
        int x = 0, y = 0;
        x = s.x - 1;
        y = s.y - 0;
        if (grid[y][x] == 0)
        {
            qu.push({ x,y});
            grid[y][x] = n+1;
        }

        //4方向をそれぞれ検証
        x = s.x - 0;
        y = s.y - 1;
        if (grid[y][x] == 0)
        {
            qu.push({ x,y });
            grid[y][x] = n+1;
        }

        //4方向をそれぞれ検証
        x = s.x + 1;
        y = s.y + 0;
        if (grid[y][x] == 0)
        {
            qu.push({ x,y });
            grid[y][x] = n+1;
        }

        //4方向をそれぞれ検証
        x = s.x + 0;
        y = s.y + 1;
        if (grid[y][x] == 0)
        {
            qu.push({ x,y });
            grid[y][x] = n+1;
        }

        //ゴールに値が入ったら終わり
        if (s.y == h && s.x == w)
        {
            break;
        }
    }

    cout << white - grid[h][w] - 1 << endl;


    //デバッグ出力
    /*
    for (int h = 0; h < h + 2; ++h)
    {
        for (int w = 0; w < w + 2; ++w)
        {
            cout << grid[h][w] + 1;
        }
        cout << '\n';
    }
    */
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {

	int A, B;
	cin >> A >> B;

	int X = -1;

	for (int i = 10 * B + 9; i >= B; --i)
	{
		int a = i * 0.08;
		int b = i * 0.1;

		if (a == A && b == B) X = i;
	}

	cout << X;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    static final long MOD  = 998_244_353;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            sum += a[i];
        }
        long[][] dp = new long[n+1][sum+1];
        long[][] dp2 = new long[n+1][sum+1];
        dp[0][0] = 1;
        dp2[0][0] = 1;
        for (int i = 0; i < n; i++) {
            for(int j = 0; j+a[i] < sum+1; j++){
                dp[i+1][j] += dp[i][j] * 2;
                dp[i+1][j] %= MOD;
                dp[i+1][j+a[i]] += dp[i][j];
                dp[i+1][j+a[i]] %= MOD;

                dp2[i+1][j] += dp2[i][j];
                dp2[i+1][j] %= MOD;
                dp2[i+1][j+a[i]] += dp2[i][j];
                dp2[i+1][j+a[i]] %= MOD;
            }
        }
        long ans = modPow(3, n);
        for (int i = (sum+1)/2; i < sum+1; i++) {
            ans += MOD - dp[n][i] * 3;
            ans %= MOD;
        }
        if(sum % 2 == 0){
            ans += dp2[n][sum/2] * 3;
            ans %= MOD;
        }
        System.out.println(ans);
        sc.close();
    }

    public static long modPow(long base, int exp) {
        long ret = 1;
        while(exp > 0){
            if((exp & 1) == 1){
                ret = ret * base %MOD;
            }
            base = base * base %MOD;
            exp >>= 1;
        }
        return ret;
    }

}


Measured memory_bytes: 587220
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

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

int N;

class node {
public:
	string l;
	int p, a, b, c, d, e, f, s, m;
	int income;
	int time;

	node() {}
	node(string l, int p, int a, int b, int c, int d, int e, int f, int s, int m)
		:l(l), p(p), a(a), b(b), c(c), d(d), e(e), f(f), s(s), m(m)
	{
		income = 0;
		time = 0;
		calc();
	}

	void calc()
	{
		time = a + b+ c;
		while (m > 0) {
			time += d+e;
			income += f*s;
			m--;
		}
		income -= p;
	}

	bool operator<(const node& r) const {
		if (income*r.time == r.income*time) {
			return l < r.l;
		} else {
			return income*r.time > r.income*time;
		}
	}
};

int main(void)
{
	while (cin >> N, N) {
		vector<node> vs;
		rep(i, N) {
			string l;
			int p, a, b, c, d, e, f, s, m;
			cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;

			vs.push_back(node(l, p, a, b, c, d, e, f, s, m));
		}
		sort(ALL(vs));
		rep(i, vs.size())
			cout << vs[i].l << endl;
		cout << "#" << endl;
	}
	return 0;
}

Measured memory_bytes: 1228
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main() {
    /*
    分散公式
    S = α^2 = (∑n i=1(si - 平均)^2)/n
    */
    int n,i;
    double score[1001],s,sum,ave;

    while(1){
        sum=0;
        s=0;
        scanf("%d",&n);
        if(n == 0)break;
        for(i = 0;i < n;i++){
            scanf("%lf",&score[i]);
            sum+=score[i];
            //printf("score[%d]:%lf\n",i,score[i]);//d
        }
        //printf("sum:%lf\n",sum);//d
        ave = (double)sum/n;
        //printf("ave:%lf\n",ave);
        for(i = 0;i < n;i++){
            s += pow((score[i] - ave),2)/n;
        }
        //printf("s:%lf\n",s);
    printf("%.8lf\n",sqrt(s));
    }
    return 0;
}



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

int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    int count = 0;
    rep(i, n) cin >> p[i];
    rep(i, n) if (p[i] != i + 1) count++;
    if (count <= 2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  ABC_121_B
//
//  Created by Joe Mori on 2020/05/29.
//  Copyright © 2020 Joe Mori. All rights reserved.
//

#include <iostream>
#include<bits/stdc++.h>

int main(int argc, const char * argv[]) {
    int n,m,c;
    int count=0;
    std::cin>>n>>m>>c;
    int b[m],a[m];
    for(int i=0;i<m;i++){
        std::cin>>b[i];
    }
    for(int i=0;i<n;i++){
        for(int i=0;i<m;i++){
            std::cin>>a[i];
        }
        int sub=c;
        for(int i=0;i<m;i++){
            sub=sub+a[i]*b[i];
        }
        if(sub>0)count++;
    }
    std::cout<<count<<std::endl;
    return 0;
}


Measured memory_bytes: 256
s = [input() for i in range(2)]
sides = [int(i) for i in s[1].split()]
sides = sorted(sides,reverse=True)
long_side= sides.pop(0)

total = 0
for side in sides:
  total += side
  
if long_side < total:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
using System.Linq;
using static System.Console;

namespace AtCoder.ABC118
{
    public class C
    {
        public static void Solve()
        {
            var N = int.Parse(ReadLine());
            var A = ReadLine().Split().Select(int.Parse).ToArray();

            var ans = 0;

            for (int i = 0; i < N; i++)
            {
                ans = GetGcd(ans, A[i]);
            }

            WriteLine(ans);
        }

        private static int GetGcd(int a, int b)
        {
            if (a < b)
            {
                GetGcd(b, a);
            }

            while (b > 0)
            {
                var r = a % b;
                a = b;
                b = r;
            }

            return a;
        }
    }
}

namespace AtCoder {
    class Program
    {
        static void Main(string[] args)
        {
            ABC118.C.Solve();
        }
    }
}

Measured memory_bytes: 21728
#include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;
struct P{double x,y;};

void k(int n,P a,P b){
  if(n==0)return;
  P s,t,u;
  double th=M_PI*60.0/180.0;
  s.x=(2.0*a.x+1.0*b.x)/3;
  s.y=(2.0*a.y+1.0*b.y)/3;
  t.x=(1.0*a.x+2.0*b.x)/3;
  t.y=(1.0*a.y+2.0*b.y)/3;
  u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
  u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
  k(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  k(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  k(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  k(n-1,t,b);
} 

int main(){
  int n;
  P a,b;
  a.x=0,a.y=0,b.x=100,b.y=0;
  cin>>n;
  printf("%.8f %.8f\n",a.x,a.y);
  k(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);
  return 0;
}


Measured memory_bytes: 3228
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
string grid[20];
int d[20][20];
int h_moves[4] = {-1, 1, 0, 0};
int w_moves[4] = {0, 0, -1, 1};
int bfs(int h, int w, int H, int W){
  d[h][w] = 0;
  queue <pair <int, pair <int, int> > > q;
  q.push((make_pair(0, make_pair(h, w))));
  int ans = 0;
  while(!q.empty()){
    auto cur = q.front();
    ans = max(ans, cur.first);
    q.pop();
    int cur_h = cur.second.first;
    int cur_w = cur.second.second;
    for(int i = 0; i < 4; i++){
      int next_h = cur_h + h_moves[i];
      int next_w = cur_w + w_moves[i];
      if(0 <= next_h && next_h < H && 0 <= next_w && next_w < W
        && grid[next_h][next_w] != '#' && d[next_h][next_w] == INT_MAX){
          d[next_h][next_w] = cur.first + 1;
          q.push(make_pair(cur.first + 1, make_pair(next_h, next_w)));
      }
    }
  }
  return ans;
}

int main(){
  int H;
  int W;
  cin >> H >> W;
  for(int i = 0; i < H; i++){
    cin >> grid[i];
  }

  int ans = 0;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(grid[i][j] == '#'){
        continue;
      }
      for(int k = 0; k < H; k++){
        for(int l = 0; l < W; l++){
          d[k][l] = INT_MAX;
        }
      }
      ans = max(ans, bfs(i, j, H, W));

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

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

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

int n,m,q;
ll a[50],b[50],c[50],d[50];
VI v(10);
ll ans=0;

void solve(int s,int t){
  if(s==n){
    ll sc = 0;
    for(int j=0;j<q;j++){
      if(v[b[j]]-v[a[j]]==c[j]) sc+=d[j];
    }
    ans = max(ans,sc);
    return;
  }
  for(int i=t;i<=m;i++){
    v[s]=i;
    solve(s+1,i);
  }

}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int i,j;
  cin>>n>>m>>q;
  for(i=0;i<q;i++) {
    cin>>a[i]>>b[i]>>c[i]>>d[i];
    a[i]--;
    b[i]--;
  }
  solve(0,1);
  cout<<ans<<endl;
}

Measured memory_bytes: 3664
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

const int L=100*1000+1;
vector<int> ed[L];
int st[L];
bool f(int u,int s)
{
	st[u]=s;
	bool ret=false;
	for(int v:ed[u]){
		if(st[v]==-1){
			ret|=f(v,s^1);
		}
		else if(st[v]==s){
			ret=true;
		}
	}
	return ret;
}

int main() {
	memset(st,-1,sizeof(st));
	int N,M;
	cin >> N >> M;
	for(int i=0;i<M;i++){
		int u,v;
		cin >> u >> v;
		ed[u].push_back(v);
		ed[v].push_back(u);
	}

	LL s=0;
	LL e=0;
	LL o=0;
	for(int i=1;i<=N;i++){
		if(st[i]==-1){
			if(ed[i].size()){
				if(f(i,0)){
					o++;
				}
				else{
					e++;
				}
			}
			else{
				s++;
			}
		}
	}
	LL ret=2*s*N-s*s+o*o+2*o*e+2*e*e;
	cout << ret << endl;


	return 0;
}



Measured memory_bytes: 9984
import java.util.ArrayList;
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> list = new ArrayList<Integer>();
    boolean bool = false;

    for (int i = 1; i <= 9; i++) {
      for (int j = 1; j <= 9; j++) {
        list.add(i * j);
      }
    }

    for (int i = 0; i < list.size(); i++) {
      if (N == list.get(i)) {
        bool = true;
        break;
      }
    }

    if (bool == true) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

    sc.close();
  }
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  REP(i,s.size())cout << 'x';
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))

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

Measured memory_bytes: 15432
A, B = list(map(int, input().split()))

a1 = float(A)/0.08
a2 = float(A+1)/0.08
b1 = float(B)/0.1
b2 = float(B+1)/0.1
if (a1 - int(a1)) == 0:
  a1 = int(a1)
else:
  a1 = int(a1+1)
if (b1 - int(b1)) == 0:
  b1 = int(b1)
else:
  b1 = int(b1+1)
if a2 - int(a2) == 0:
  a2 = int(a2-1)
else:
  a2 = int(a2)
if b2 - int(b2) ==0:
  b2 = int(b2-1)
else:
  b2 = int(b2)

if a1>b1:
  a1,a2,b1,b2 = b1,b2,a1,a2
if b1<=a2:
  print(b1)
else:
  print(-1)



Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<cmath>
#include<memory.h>
#include<cctype>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<list>
#include<stack>
#include<utility>
#include<iomanip>
#include<bitset>
#include<vector>
#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<cstring>
using namespace std;
typedef long long int ll;
typedef long double ld;
int dx[]={0,0,1,-1,1,1,-1,-1};
int dy[]={1,-1,0,0,1,-1,-1,1};
int main(){
	//freopen("a.txt","r",stdin);
	int n;
	scanf("%d",&n);
	vector<int>v;
	for(int a,i=0;i<n;++i){
		scanf("%d",&a);
		v.push_back(a);
	}
	int sol=0;
	for(int i=0;i<n;++i){
		if(i<n-1&&v[i]==i+1){
			swap(v[i],v[i+1]);
			++sol;
		}else if(i==n-1&&v[i]==i+1)++sol;
	}
	printf("%d\n",sol);
	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
 
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long 
#define ld long double
#define sz(v) int(v.size())
#define all(v) v.begin(), v.end()
 
#define y1 what

using namespace std;
 
const int N = (int) 5e3 + 10;
const int M = (int) 4e6 + 7;
const ll LINF = (ll) 1e18;
const int INF = (int) 1e9 + 7;
const double EPS = (double) 1e-9;
const int mod = 1e9 + 7;

const int nx[4] = {1, -1, 0, 0};
const int ny[4] = {0, 0, 1, -1};

int n, m;
int a[N];
vector<int> v[2];
vector<int> ans;

void print() {
	for (auto it : ans) if (it) cout << it << " ";
	ans[0]--;
	ans[sz(ans) - 1]++;
	if (ans[0] == 0) {
		reverse(all(ans));
		ans.pop_back();
		reverse(all(ans));
	}
	cout << "\n" << sz(ans) << "\n";
	for (auto it : ans) cout << it << " ";
	exit(0);
}

int main() {
    #define fn "balls"
    #ifdef witch
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
//        freopen(fn".in", "r", stdin);
//        freopen(fn".out", "w", stdout);
    #endif
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
    	cin >> a[i];
    	v[a[i] % 2].pb(a[i]);
    }
    if (m == 1) {
    	ans.pb(a[1]);
    	ans.pb(0);
    	print();
    }
    if (sz(v[1]) > 2) {
    	cout << "Impossible";
    	return 0;
    }
    if (sz(v[1]) == 2) {
    	ans.pb(v[1][0]);
    	for (auto it : v[0]) ans.pb(it);
    	ans.pb(v[1][1]);
    	print();
	}
	if (sz(v[1]) == 1) {
		ans.pb(v[1][0]);
    	for (auto it : v[0]) ans.pb(it);
    	print();
	}
	for (auto it : v[0]) ans.pb(it);
	print();
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

std::vector<std::string> split(std::string str, char del) {
    int first = 0;
    int last = str.find_first_of(del);
 
    std::vector<std::string> result;
 
    while (first < str.size()) {
        std::string subStr(str, first, last - first);
 
        result.push_back(subStr);
 
        first = last + 1;
        last = str.find_first_of(del, first);
 
        if (last == std::string::npos) {
            last = str.size();
        }
    }
 
    return result;
}

int main() {
  string K="1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51";
  vector<string> x(32);
  int N,cnt=0;
  
  cin >> N;
  
	char del = ',';
 
    for (const auto subStr : split(K, del)) {
      x.at(cnt)=subStr;
      cnt++;
    }
 	
  cout << x.at(N-1) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    int n,m;    
    cin >> n >> m;
    vector<int>h(n);
    rep(i, n) cin >> h[i];
    vector<vector<int>>G(n);
    rep(i, m){
        int a,b;    
        cin >> a >> b;
        --a;    
        --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int ans = 0;
    rep(i, n){
        int num = 0;
        rep(j, G[i].size()){
            int next = G[i][j];
            if(h[i] > h[next])  num++;
        }
        if(num == G[i].size())  ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 8756
from bisect import bisect_left,bisect_right
n=int(input())
al=list(map(int,input().split()))
bl=list(map(int,input().split()))
cl=list(map(int,input().split()))
al.sort()
cl.sort()
s=0
for b in bl:
    a=bisect_left(al,b)
    c=n-bisect_right(cl,b)
    s+=a*c
print(s)


Measured memory_bytes: 29472
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
int a[105];

int main(){
	int n,i;
	cin>>n;
	
	for(i=1;i<=n;i++)
	cin>>a[i];
	
	for(i=1;i<=n;i++){
		if(a[i]%2==0){
			if(a[i]%3!=0&&a[i]%5!=0){
				cout<<"DENIED";
				return 0;
			}
		}
	}
	
	cout<<"APPROVED";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

int main(){
  int n;
  cin >> n;
  vector<double>x(n);
  vector<double>y(n);
  for(int i=0;i<n;i++){
    cin >> x.at(i) >> y.at(i);
  }
  vector<int>in(n);
  for(int i=0;i<n;i++){
    in.at(i)=i;
  }
  double ans=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      double x_long=pow(x.at(i)-x.at(j),2.0);
      double y_long=pow(y.at(i)-y.at(j),2.0);
      ans+=sqrt(x_long+y_long);
    }
  }
  ans/=facctorialMethod(n);
  ans*=facctorialMethod(n-1);
  ans*=2;
  cout << fixed << setprecision(10);
  cout << ans << endl;
}


Measured memory_bytes: 256
S = input()
cnt = 0
ans = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
ans = max(ans, cnt)
print(ans)


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

int main() {
	int N; cin >> N;
	vector<int> a(N);
	lint answer = 0;

	REP(i,N) {
		cin >> a.at(i);
		answer += a.at(i) - 1;
	}

	cout << answer << endl;

	return 0;
}

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

const double pi = 3.14159265358979323846;
const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n, m, x; cin >> n >> m >> x;
	vector<int> c(n);
	vector<vector<int>> a(n);
	rep(i,n){
		cin >> c.at(i);
		rep(j,m){
			int b; cin >> b;
			a.at(i).push_back(b);
		}
	}
	int cost = 1001001001;
	for(int i = 0; i < (1 << n); i++){
		int tmp = 0;
		vector<int> u(m, 0);
		for(int j = 0; j < n; j++){
			if(i & (1 << j)){
				tmp += c.at(j);
				for(int k = 0; k < m; k++){
					u.at(k) += a.at(j).at(k);
				}
			}
		}
		//if(i == 2) cout << u.at(0) << endl;
		sort(u.begin(), u.end());
		if(u.at(0) >= x) cost = min(cost, tmp);
	}
	if(cost == 1001001001) cout << -1 << endl;
	else cout << cost << endl;
} 

Measured memory_bytes: 3660
from itertools import accumulate
from bisect import bisect

N = int(input())
C = [0]+list(accumulate(map(int,input().split())))

def h(i,j):
  ci,cj = C[i],C[j]
  k = bisect(C, (ci+cj)//2, lo=i+1,hi=j)
  _,a,b = min((abs(ci+cj-2*c),cj-c,c-ci) for c in (C[k-1],C[k]))
  return a,b

def solve(x):
  L = h(0,x)+h(x,N)
  return max(L)-min(L)

print(min(solve(i) for i in range(2,N-1)))

Measured memory_bytes: 25972
#include<iostream> 
#include<algorithm>
#include<cstdio>
using namespace std;
typedef struct{
	int cost,v,u;
}wa;
wa way[10000];
int par[200];
int compare(const wa& a,const wa& b){
	return a.cost<b.cost;
}
int find(int t){
	if(par[t]==t)
	return t;
	else return find(par[t]);
}
int same(int x,int y){
	return find(x)==find(y);
}
void unite(int x,int y){
	x=find(x);
	y=find(y);
	par[y]=find(par[x]);
}
int main(){
	int n,m,ans,x,y,c;
	while(cin>>n,n){
		cin>>m;
		ans=0;
		for(int i=0;i<m;i++){
			scanf("%d,%d,%d",&x,&y,&c);
			way[i].v=x;
			way[i].u=y;
			way[i].cost=c/100-1;
		}
		sort(way,way+m,compare);
		for(int i=0;i<n;i++)
			par[i]=i;
		for(int i=0;i<m;i++){
			if(!same(way[i].v,way[i].u)){
			unite(way[i].v,way[i].u);
			ans+=way[i].cost;
			}
		}
			
		
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_2_D&lang=jp
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int w,h,x,y,r;
  cin>>w>>h>>x>>y>>r;
  if(x>=r&&x<=w-r&&y>=r&&y<=h-r)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}



Measured memory_bytes: 3092
using System;

class Problem
{
  public static void Main(string[] args)
  {
    var n = int.Parse(Console.ReadLine());
    var k = int.Parse(Console.ReadLine());
    var min = 1;
    for (var i = 0; i < n; i++)
      min = Math.Min(min * 2, min + k);
    Console.WriteLine($"{min}");
  }
}


Measured memory_bytes: 13140
n = int(input())
s = input()


def findstr(s, targetstr):
    result1 = findchar(s, targetstr[0], 0)
    if result1:
        result2 = findchar(s, targetstr[1], result1)
        if result2:
            result3 = findchar(s, targetstr[2], result2)
            if result3:
                return True

    return False
    
    


def findchar(s, targetchar, ind):
    # print("char")
    # print(targetchar)
    sub = s[ind:]
    # print("{} {} {} {}".format(s, targetchar, ind, sub))
    for i, elm in enumerate(sub):
        if elm == targetchar:
            # print("return")
            # print(i+1+ind)
            return i+1+ind
    else:
        return False



count = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            target = str(i) + str(j) + str(k)
            # print(target)
            if findstr(s, target):
                count += 1

print(count)



Measured memory_bytes: 3188
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 



int main(){
    double ans=0;
    double L;
    cin >> L;
    ans=(L/3)*(L/3)*(L/3);
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
count = dict([])
n = int(input().strip())
for _ in range(n):
    key = input()
    if key in count:
        count[key] += 1
    else:
        count[key] = 1
m = int(input().strip())
for _ in range(m):
    key = input()
    if key in count:
        count[key] -= 1
    else:
        count[key] = -1
num = 0
for k, v in count.items():
    if num < v:
        num = v
print(num)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;

ull gcd(ull a, ull b)
{
    if (a < b)
    {
        std::swap(a,b);
    }
    ull r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
    return b;
}
ull lcm(ull a, ull b)
{
    return (a*b)/gcd(a,b);
}

int main()
{
  ull A,B,C,D;

  cin >> A >> B >> C >> D;

  ull count = 0;

  ull countOfCMultiplier = B / C - A / C + (A%C == 0 ? 1 : 0);
  ull countOfDMultiplier = B / D - A / D + (A%D == 0 ? 1 : 0);
  ull CD = lcm(C, D);
  ull countOfBothMultiplier = B / CD - A / CD + (A%CD == 0 ? 1 : 0);

  //cout << "total count " << (B - A + 1) << endl;
  //cout << "C count " << countOfCMultiplier << endl;
  //cout << "D count " << countOfDMultiplier << endl;
  //cout << "Both count " << countOfBothMultiplier << endl;
  //cout << "Required count " << (B - A + 1) - (countOfCMultiplier + countOfDMultiplier - countOfBothMultiplier) << endl;

  cout << (B - A + 1) - (countOfCMultiplier + countOfDMultiplier - countOfBothMultiplier) << endl;
  return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
const int N=1505;
int b[N][N],S[N],n,u[N][N],l[N],r[N];
char A[N][N];
bool flag[N][N];
int main(){
	scanf("%d",&n);
	for (register int i=1;i<=n;++i)scanf("%s",A[i]+1);
	for (register int i=1;i<=n;++i)
		for (register int j=1;j<=n;++j)flag[i][j]=A[i][j]>='0'&&A[i][j]<='9',b[i][j]=A[i][j]-'0';
	for (register int i=0;i<=n;++i)
		for (register int j=0;j<=n;++j)u[i][j]=flag[i][j]?min(i,min(u[i-1][j],u[i][j-1])):1<<30;
	long long ans=0;
	for (register int x=1;x<=n;++x){
		for (register int j=1;j<=n;++j)S[j]=S[j-1]+(u[x][j]<=x?b[x][j]:0);
		for (register int j=n+1;j;--j){
			if (flag[x][j]){
				l[j]=j-1;
				r[j]=max(r[j+1],j);
				ans+=b[x][j]*(S[r[j]]-S[l[j]]-b[x][j]);
			}
			else l[j]=1e9,r[j]=-1;
		}
		for (register int i=x-1;i;--i){
			for (register int j=1;j<=n;++j)S[j]=S[j-1]+(u[x][j]<=i?b[x][j]:0);
			for (register int j=n+1;j;--j){
				if (flag[i][j]){
					l[j]=min(l[j+1],l[j]);
					r[j]=max(r[j+1],r[j]);
					if (l[j]<=r[j])ans+=b[i][j]*(S[r[j]]-S[l[j]]);
				}
				else l[j]=1e9,r[j]=-1;
			}
		}
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 11264
import java.util.*;

import static java.lang.System.*;

class Main {
    public static Scanner sc = new Scanner(in);
    public static Random rand=new Random();

    public List<Integer> getPrimeList(int max){
		LinkedList<Integer> primes=new LinkedList<Integer>();

		PLoop:for(int i=2;i<max;i++){
			for(int prime:primes){
				if(i%prime==0){
					continue PLoop;
				}
				if( prime*prime>i){
					break;
				}
			}
			primes.add(i);
		}
		return primes;
	}
    public void run() {
    	Set<Integer> pmap=new HashSet<Integer>(getPrimeList(123456*2));

        Test:while(true){
        	int n=sc.nextInt();
        	if(n==0)return;
        	int res=0;
        	for(int i=n+1;i<=2*n;i++){
        		if(pmap.contains(i)){
        			res++;
        		}
        	}
        	ln(res);
        }
    }
    public static void main(String[] args) {
        new Main().run();
    }

    public int[] nextIntArray(int n){
        int[] res=new int[n];
        for(int i=0;i<n;i++){
            res[i]=sc.nextInt();
        }
        return res;
    }
    public static void pr(Object o) {
        out.print(o);
    }
    public static void ln(Object o) {
        out.println(o);
    }
    public static void ln() {
        out.println();
    }
}

Measured memory_bytes: 60208
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n; cin >> n;
  vector<long long> a(n), b(n);
  long long res = 0;
  for (int i = 0; i < n; i++) {
  	cin >> a[i] >> b[i];
  }
  for (int i = n - 1; i >= 0; i--) {
  	res += (b[i] - (a[i] + res) % b[i]) % b[i];
  }
  cout << res << endl;
}

Measured memory_bytes: 4820
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <iomanip>
#include <tuple>
#include <map>
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<vector<int>> Graph(n);
    vector<pair<int, int>> edges;
    for (int i = 0; i < n - 1; i++) {
        int a,b; cin >> a >> b;
        a--,b--;
        Graph[a].push_back(b);
        Graph[b].push_back(a);
        edges.emplace_back(a,b);
    }
    vector<int> used(n,0);
    int k = 0;
    map<pair<int,int>,int> I;
    vector<int> cs(n,0);
    queue<int> que;
    que.emplace(0);
    used[0]=1;

    while(!que.empty()) {
        int s = que.front(); que.pop();
        if (k < Graph[s].size()) k = Graph[s].size();
        int cur = 1;
        for (auto t : Graph[s]) {
            if (used[t]) continue;
            if (cur == cs[s]) cur++;
            I[make_pair(s, t)] = I[make_pair(t, s)] = cs[t] = cur++;
            used[t] = 1;
            que.emplace(t);
        }
    }

    cout << k << "\n";
    for (auto e : edges) cout << I[e] << "\n";
}

Measured memory_bytes: 20084
import java.util.*;
import java.io.*;

public class Main {

	private static void solve(){
		//Implement solution here.
		int sum = ni() + ni() + ni();
		if(sum >= 22) {
			System.out.println("bust");
		} else {
			System.out.println("win");
		}
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
vi color;
using Edge = tuple<int, int>;
vector<vector<Edge>> G;

void dfs(int v, int c){
    if(color[v] != -1) return;
    color[v] = c;

    for(auto& e : G[v]){
        int nv, w; tie(nv, w) = e;
        dfs(nv, c ^ (w % 2));
    }
}

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

    int n; cin >> n;
    G = vector<vector<Edge>>(n);
    rep(_, n-1){
        int a, b, w; cin >> a >> b >> w;
        a--, b--;
        G[a].emplace_back(Edge(b, w));
        G[b].emplace_back(Edge(a, w));
    }

    color = vi(n, -1);
    dfs(0, 0);
    for(auto& e : color){
        cout << e << endl;
    }

    return 0;
}


Measured memory_bytes: 7424
s = input()
ans = float('Inf')
def f(c):
  global ans
  temp = s
  i = 0
  while True:
    t = ''
    flag = False
    if temp.count(temp[0]) == len(temp):
      ans = min(ans, i)
      break
    
    for j in range(len(temp)-1, -1, -1):
      if not temp[j] == c and flag == False:
        flag = True
        continue
      elif j <= len(temp)-2 and temp[j+1] == c:
        t += c
      else:
        t += temp[j]
    temp = t
    i += 1

for i in range(97, 123):
  f(chr(i))

print(ans)


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

using namespace std;
typedef vector<int> vi;

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    int m = 2*n - 1;
    vi arr(m);
    for (int i = 0; i < m; i++) cin >> arr[i];
    int lo = 1, hi = m + 1;
    vi brr(m);
    while (lo < hi){
        int mid = (lo + hi) / 2;
        for (int i = 0; i < m; i++){
            brr[i] = (arr[i] >= mid);
        }
        int fin;
        int L = n-2, R = n;
        while (L >= 0 && brr[L] != brr[L+1]) L--;
        while (R < m && brr[R] != brr[R-1]) R++;

        int d = min(abs(L - (n-1)), abs(R - (n-1)));
        if (d & 1) {
            fin = brr[n-1];
        } else {
            fin = 1 - brr[n-1];
        }
        if (fin) lo = mid + 1;
        else hi = mid;
    }
    cout << lo - 1 << endl;
}


Measured memory_bytes: 1920
# エラトステネスの篩で素数列挙して高速に素因数分解したい！
# ref: https://atcoder.jp/contests/abc177/editorial/82
class PrimeDivWithSieve
  def initialize(n)
    @sieve = []
    @elements = {}
    (2..n).each do |i|
      next if @elements[i]
      @sieve << i
      @elements[i] = [i]

      sieve_target = i * 2
      while sieve_target <= n do
        if @elements[sieve_target]
          @elements[sieve_target].push(i)
        else
          @elements[sieve_target] = [i]
        end
        sieve_target += i
      end
    end
  end

  def element(num)
    @elements[num] || []
  end
end


_n = gets.chomp.split.map(&:to_i)
arr = gets.chomp.split.map(&:to_i)

divisor = PrimeDivWithSieve.new(1_000_000)
common_elms = divisor.element(arr[0])
all_elms = {}
common_elms.each do |i|
  all_elms[i] = true
end

pair = true
set = false
arr[1..-1].each do |i|
  crr_elms = divisor.element(i)
  if pair
    crr_elms.each do |i|
      break pair = false if all_elms[i]
      all_elms[i] = true
    end
  end
  if !set
    common_elms = (common_elms & crr_elms)
    set = common_elms.empty?
  end

  break if set && !pair
end

if pair
  puts "pairwise coprime"
elsif set
  puts "setwise coprime"
else
  puts "not coprime"
end

Measured memory_bytes: 261940
#include<bits/stdc++.h>
#define mod 1000000007
#define endl '\n'
typedef long long int ll ;
using namespace std;
int main()
{
    ll a,b;
    cin>>a>>b;
    ll val=a-(2*b);
    if(val<=0) cout<<0;
    else cout<<val<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LLI long long int
#define pii pair<int,int>
#define fst first
#define sec second
#define ULTRA 2134567890
#define de(x) if(x!=0 && MODE==x)
#define MODE 1
using namespace std;

int p[1007] = {};

int main() {
    int i,j;
    int N,K;

    scanf("%d %d", &N, &K);
    for( i=1; i<=N; i++) {
        scanf("%d", &p[i]);
    }
    sort( p+1, p+N+1);
    int ans = 0;
    for( i=1; i<=K; i++)
        ans += p[i];
    printf("%d\n", ans);

    return 0;
}

//
//          ___ ___  __________  __________
//         /////\  \/\   ______\/\\\\\\\\\\\  Code by ~Ice Tea~ of
//        //// \ \  \ \  \_____/\ \\\\_____/      New Empire of CHSH ...
//       ////   \ \  \ \  \      \ \\\\\\\\\\\
//      ////__   \ \  \ \  \      \ \\\\_____/
//     ///////\   \ \  \ \  \______\ \\\\_______   ________
//    ////____/    \ \__\ \___   ___\ \\\\\\\\\\\ _\  ___  \_
//   /__/           \/__/\/__/\  \__/\ \\\\_____//\  .\_/\_  \
//                           \ \  \   \ \\\\\\\\\\\\  \_\/_\  \
// ... with the AC Power of   \ \  \   \ \\\\_____/ \   _____  \
//   The Great Tsundere Doggy. \ \  \   \ \\\\     \ \  \  \ \  \
//                              \ \__\   \ \\\\\\\\\\ \__\  \ \__\
//                               \/__/    \/________/\/__/   \/__/
//


Measured memory_bytes: 3824