akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int main(){

	int n,sum,a,b,c,size,w;

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

		sum = 0;

		for(int i = 0; i < n; i++){
			scanf("%d %d %d %d",&a,&b,&c,&w);

			size = a+b+c;

			if(size <= 60 && w <= 2){
				sum += 600;
			}else if(size <= 80 && w <= 5){
				sum += 800;
			}else if(size <= 100 && w <= 10){
				sum += 1000;
			}else if(size <= 120 && w <= 15){
				sum += 1200;
			}else if(size <= 140 && w <= 20){
				sum += 1400;
			}else if(size <= 160 && w <= 25){
				sum += 1600;
			}
		}

		printf("%d\n",sum);
	}

    return 0;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int l,a,b,c,d;
    cin >> l >> a >> b >> c >> d;
    int s=(a/c),t=(b/d);
    if(a%c!=0){s++;}
    if(b%d!=0){t++;}
    cout << l-max(s,t) << endl;

    return 0;
}


Measured memory_bytes: 3188
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 * C <= B) {
			System.out.println(C);
		} else {
			System.out.println(B / A);
		}

	}
}

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

int main(){
    int N;
    cin >> N;
    for(int i=0; i<N; i++){
        string Si;
        cin >> Si;
        if(Si == "Y"){
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define Accel ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Re(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define REP(I, N) for (int I = 0; I < (N); I++)
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define SZ(a) ((int)a.size())
//#pragma GCC optimize(2)
using namespace std;
const int N=2e5+10;
const int M=1LL<<30;
const int inf=1e9+7;
const LL INF=1e18;
const double eps=1e-6;
typedef complex<double>C;
const double PI(acos(-1.0));
//for(int mask=i;mask>0;mask=(mask-1)&i)
//int a[25]= { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
//__gcd, atan2(y,x)=y/x , __int128
//c(n,k)=c(n-1,k-1)+c(n-1,k)
//c(i,r),i for r to n =c(n+1,r+1)
//void add(int x){while(x<N)BIT[x]++,x+=x&-x;}
//int sum(int x){int s=0;while(x){s+=BIT[x];x-=x&-x;}return s;}
//int find(int x){return x==p[x]?x:p[x]=find(p[x]);}
//LL pw(LL a,LL b){LL t=1;for(;b;b>>=1,a=a*a%M)b&1?t=t*a%M:0;return t;}
//log() = ln() , log(x)/log(y)=log(y)-base-x
//INT_MAX 127,INT_MIN 128
//int dw[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
//int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
//cout<<fixed<<setprecision(12)<<ans<<endl;
//__builtin_popcount(mask)
LL n,x;
LL a[N];
LL d[N];
int main(){Accel
	cin>>n>>x;
	FOR(i,1,n){
		cin>>a[i];
		d[i]=d[i-1]+a[i];
	}
	LL ans=9e18;
	for(int k=1;k<=n;k++){
		LL cur=3;
		LL z=0;
		for(int i=n;i>=1;i-=k){
			z+=(d[i]-d[max(i-k,0)])*max(5LL,cur);
			cur+=2;
			if(z>=ans){
				break;
			}
		}
		z+=(k+n)*x;
		ans=min(ans,z);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3328
using System;

namespace A___Double_Helix
{
    class Program
    {
        static void Main (string[] args)
        {
            var b = Console.ReadLine ();
            if (b == "A")
            {
                Console.WriteLine ("T");
            }
            else if (b == "C")
            {
                Console.WriteLine ("G");
            }
            else if (b == "G")
            {
                Console.WriteLine ("C");
            }
            else
            {
                Console.WriteLine ("A");
            }
        }
    }
}

Measured memory_bytes: 11092
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

unordered_map<ll, ll> mp;


int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = unordered_map<ll, ll>();
#pragma clang diagnostic pop
#endif

        int a, b;
        cin >> a >> b;

        char ans[100][100];
        a--, b--;
        for (int i = 0; i < 50; i++) {
            for (int j = 0; j < 100; j++) {
                if (a && i % 2 == 0 && j % 2 == 0) {
                    ans[i][j] = '.';
                    a--;
                } else {
                    ans[i][j] = '#';
                }
            }
        }
        for (int i = 99; i >= 50; i--) {
            for (int j = 0; j < 100; j++) {
                if (b && i % 2 == 0 && j % 2 == 0) {
                    ans[i][j] = '#';
                    b--;
                } else {
                    ans[i][j] = '.';
                }
            }
        }
        printf("100 100 \n");
        rep(i, 100) {
            rep(j, 100) cout << ans[i][j];
            printf("\n");
        }
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int res = 0;
  int total;
  for (int a = 0; a<25 ; ++a) {
    for (int b = 0; b<20 ; ++b) {
        total = 4*a + 7*b;
        if (total == N){
        cout << "Yes" << endl;
          res=1;
          goto loopend;
        }
    }
}
  loopend:
    if(res == 0) cout << "No" << endl;
}


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

int main() {

    int n, min_v, max_v;
    long int sum_v = 0;
    cin >> n;
    min_v = 1000001;
    max_v = -1000001;
    rep(i, n){
        int a;
        cin >> a;
        min_v = min(min_v, a);
        max_v = max(max_v, a);
        sum_v += a;
    }
    printf("%d %d %ld\n", min_v, max_v, sum_v);

}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  vector<int> vs({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});

  int k;
  cin>>k;
  cout<<vs[k-1]<<endl;
  return 0;
}


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

void solve(long long N, std::vector<long long> A)
{
    sort(A.begin(), A.end());
    if (A[0] == 0)
    {
        cout << 0 << endl;
        return;
    }
    ll ans = 1;
    double res = 1;
    for (ll i = 0; i < N; i++)
    {
        if (ans * A[i] > (ll)1e18 || res * A[i] > (ll)1e18)
        {
            ans = -1;
            break;
        }
        ans *= A[i];
        res *= A[i];
    }
    cout << ans << endl;
}

signed main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


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

using namespace std;

struct Coordinate {
    const long long x;
    const long long y;

    Coordinate(const long long x, const long long y) : x(x), y(y) {};
};

long long getClosestPointIndex(const Coordinate &student, const vector<Coordinate> &points) {
    long long closestManhattanDist = 1ULL << 60;
    int closestPointIndex = -1;
    for (int i = 0; i < points.size(); i++) {
        long long manhattanDist = abs(student.x - points[i].x) + abs(student.y - points[i].y);
        if (manhattanDist < closestManhattanDist) {
            closestManhattanDist = manhattanDist;
            closestPointIndex = i;
        }
    }
    return closestPointIndex + 1;
}

int main() {
    int N, M;
    cin >> N >> M;

    vector<Coordinate> students;
    for (int i = 0; i < N; i++) {
        long long ai, bi;
        cin >> ai >> bi;
        students.emplace_back(ai, bi);
    }

    vector<Coordinate> points;
    for (int i = 0; i < M; i++) {
        long long ci, di;
        cin >> ci >> di;
        points.emplace_back(ci, di);
    }

    for (Coordinate s: students) {
        cout << getClosestPointIndex(s, points) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,q,l,r,i;
  string s;
  vector<int> a;
  cin>>n>>q>>s;
  for(i=0;i<n-1;i++) if(s.at(i)=='A'&&s.at(i+1)=='C') a.push_back(i+1);
  for(i=0;i<q;i++){
    cin>>l>>r;
    cout<<distance(lower_bound(a.begin(),a.end(),l),lower_bound(a.begin(),a.end(),r))<<endl;
  }
}

Measured memory_bytes: 3888
#include <bits/stdc++.h>
using namespace std;
#define MAXN 200009
#define MOD 1000000007
#define INF 1000000009
#define FOR(x,n) for(int x=0; x<n; x++)
#define FOR1e(x,n) for(int x=1; x<=n; x++)
typedef pair<int, int> ii;
typedef long long ll;

int b[MAXN];

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	FOR(x, n) {
		scanf("%d", &b[x]);
	}
	sort(b, b + n);
	
	int ans = 0;
	vector<int> v;
	int ind = 0;
	while (ind < n) {
		int fim = ind;
		while (b[ind] == b[fim]) fim++;
		v.push_back(fim-ind);
		ind = fim;
	}
	sort(v.begin(), v.end());

	int t = 0;
	while (v.size() - t > k) {
		ans += v[t++];
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 2168
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

const mod = 1000000007

var f = []int{
	1,
	682498929,
	491101308,
	76479948,
	723816384,
	67347853,
	27368307,
	625544428,
	199888908,
	888050723,
	927880474,
	281863274,
	661224977,
	623534362,
	970055531,
	261384175,
	195888993,
	66404266,
	547665832,
	109838563,
	933245637,
	724691727,
	368925948,
	268838846,
	136026497,
	112390913,
	135498044,
	217544623,
	419363534,
	500780548,
	668123525,
	128487469,
	30977140,
	522049725,
	309058615,
	386027524,
	189239124,
	148528617,
	940567523,
	917084264,
	429277690,
	996164327,
	358655417,
	568392357,
	780072518,
	462639908,
	275105629,
	909210595,
	99199382,
	703397904,
	733333339,
	97830135,
	608823837,
	256141983,
	141827977,
	696628828,
	637939935,
	811575797,
	848924691,
	131772368,
	724464507,
	272814771,
	326159309,
	456152084,
	903466878,
	92255682,
	769795511,
	373745190,
	606241871,
	825871994,
	957939114,
	435887178,
	852304035,
	663307737,
	375297772,
	217598709,
	624148346,
	671734977,
	624500515,
	748510389,
	203191898,
	423951674,
	629786193,
	672850561,
	814362881,
	823845496,
	116667533,
	256473217,
	627655552,
	245795606,
	586445753,
	172114298,
	193781724,
	778983779,
	83868974,
	315103615,
	965785236,
	492741665,
	377329025,
	847549272,
	698611116,
}

func mfrac(n int) int {
	N := n / 10000000
	ret := f[N]
	for i := N*10000000 + 1; i <= n; i++ {
		ret *= i
		ret %= mod
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)

	N, K := getInt(), getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt() - 1
	}
	cback := make([]int, 2000)
	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			if a[i] > a[j] {
				cback[a[i]]++
			}
		}
	}
	second := 0
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			if a[i] > a[j] {
				second++
			}
		}
	}
	// out(cback, second, K)

	first := 0
	for i := 0; i < 2000; i++ {
		first += cback[i]
	}
	// out(first, second)
	ans := 0
	ans += first * K
	ans %= mod
	comb := K * (K - 1) / 2
	comb %= mod
	ans += second * comb
	ans %= mod
	out(ans)
}


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

using namespace std;
int n;
int arr[3];
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> arr[0] >> arr[1] >> arr[2];
    sort(arr, arr + 3);
    int ret = (1<<30);
    do{
        int tmp = 0;
        for(int i = 1; i < 3; i ++){
            tmp += abs(arr[i] - arr[i - 1]);
        }
    ret = min(ret, tmp);

    }while(next_permutation(arr, arr + 3));
    printf("%d\n", ret);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            long[] NR = cin.ReadLongArray(2);
            long N = NR[0];
            long R = NR[1];
            if (N >= 10)
            {
                Console.WriteLine(R);
            }
            else
            {
                Console.WriteLine(R + 100 * (10 - N));
            }
            
        }


    }
            


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public double[] ReadDoubleArray(long N) { var ret = new double[N]; for (long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
#endif
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	if(a>=k)
	{
		cout<<k<<endl;
	}
	else if(a+b>=k)
	{
		cout<<a<<endl;
	}
	else
	{
		cout<<a-(k-a-b)<<endl;
	}
	return 0;
}

Measured memory_bytes: 3648
n,ma,mb=map(int,input().split())
dp=[[[4001]*401 for _ in range(401)] for j in range(n+1)]
dp[0][0][0]=0
a=[0]*n; b=[0]*n; c=[0]*n
for i in range(n):
    a[i],b[i],c[i]=map(int,input().split())

for i in range(n):
    for j in range(401):
        for k in range(401):
            if dp[i][j][k]==4001:
                continue
            dp[i+1][j][k]=min(dp[i+1][j][k], dp[i][j][k])
            dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i])

ans=4001
for i in range(1,401):
    for j in range(1,401):
        if i*mb==j*ma:
            ans=min(ans,dp[n][i][j])

print(ans if ans!=4001 else -1)


Measured memory_bytes: 95708
N, W = map(int, input().split())
v, w = [0] * N, [0] * N
for i in range(N):
    v[i], w[i] = map(int, input().split())
# dp[i][j]:i番目までの種類を使って、総和がj の時の最大価値
dp = [[0] * (W + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(1, N + 1):
    for j in range(W + 1):
        if j >= w[i - 1]:
            dp[i][j] = max(
                dp[i - 1][j],
                dp[i][j - w[i - 1]] + v[i - 1],
            )
        else:
            dp[i][j] = dp[i - 1][j]
print(max(dp[N]))
#print(dp)




Measured memory_bytes: 15688
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
const double PI=acos(-1);
struct xxx{int x,y;}d[201000];
int a[201000],s[201000];
bool cmp(xxx a,xxx b){return a.x<b.x;}
int LIS1(int n)
{
	int sz=0;
	for(int i=1;i<=n;i++)
	{
		if(sz==0||a[i]>s[sz])s[++sz]=a[i];
		else
		{
			int l=1,r=sz+1;
			while(l<r)
			{
				int mid=(l+r)>>1;
				if(s[mid]<a[i])l=mid+1;
				else r=mid;
			}
			s[r]=a[i];
		}
	}
	return sz;
}
int LIS2(int n)
{
	int sz=0;
	for(int i=1;i<=n;i++)
	{
		if(sz==0||a[i]<s[sz])s[++sz]=a[i];
		else
		{
			int l=1,r=sz+1;
			while(l<r)
			{
				int mid=(l+r)>>1;
				if(s[mid]>a[i])l=mid+1;
				else r=mid;
			}
			s[r]=a[i];
		}
	}
	return sz;
}
int main()
{
	int sx,sy,tx,ty;scanf("%d%d%d%d",&sx,&sy,&tx,&ty);bool ok=0;
	if(sx>tx)swap(sx,tx),swap(sy,ty);if(sy>ty)ok=1;
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++){int X,Y;scanf("%d%d",&X,&Y);d[i].x=X;d[i].y=Y;}
	sort(d+1,d+n+1,cmp);int cnt=0;//for(int i=1;i<=n;i++)cout<<d[i].x<<" "<<d[i].y<<endl;
	for(int i=1;i<=n;i++)if(d[i].x<sx||d[i].x>tx||d[i].y<min(sy,ty)||d[i].y>max(sy,ty))continue;else a[++cnt]=d[i].y;
//	for(int i=1;i<=cnt;i++)cout<<a[i];
	int sz=0;if(ok==0)sz=LIS1(cnt);else sz=LIS2(cnt);
	long long ans1=1ll*(tx-sx+max(sy,ty)-min(sy,ty))*100ll,ans2=0;
	if(sz==min(tx-sx,max(sy,ty)-min(sy,ty))+1)ans2+=5;
	ans2+=sz*5;ans1-=sz*20;
	printf("%.15lf",(double)ans1+(double)ans2*PI);
	return 0;
}

Measured memory_bytes: 3328
#include <string>
#include <vector>
#include <cstring>
#include <algorithm>
#include <iostream> 
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
//repetition
#define REP(i,n)  for(ll i=0;i<n;i++)
 
unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
 
unsigned binarySearch(ll target, ll max, ll min) {
  while((max - min) > 1) {
      if((max + min)/2 > target) {
        max = (max + min)/2;
        min = min;
      } else {
        max = max;
        min = (max + min)/2;
      }
    }
}
 
ll n;
 
int main() {
  cin >> n;
  
  vector<vector<ll>> vp(n, vector<ll>(n, -1));
  
  REP(m, n) { //全ての集合
    ll r;
    cin >> r;
    
    REP(l, r) {
      ll p,q;
      cin >> p >> q;
      vp.at(m).at(p-1) = q;
    }
  }
  
  ll m = 0;
  
  REP(i, (1<<n)) {
    ll tmp = 0;
 
    bool isValid = true;
    
    REP(l, n) {
      if (1 & (i >> l)) {
 
        REP(k, vp.at(l).size()){
 
          if(vp.at(l).at(k) != -1 && (i >> k & 1) != vp.at(l).at(k)) {
            isValid = false;
          }
        }
        tmp++;
      }
    }
    if (isValid) {
      m = max(m, tmp);
    }
  }
  cout << m << endl;
  
}

Measured memory_bytes: 256
n=int(input())
c=[[] for i in range(n)]
for i in range(n):
  a,b=map(int,input().split())
  c[i].append(a)
  c[i].append(b)

import math
sum=0  
for j in range(n):
  q=c[j][0];w=c[j][1]
  for k in range(j):
    sum+=math.sqrt((c[k][0]-q)**2+(c[k][1]-w)**2)
    
print(float(sum*2/n)) 

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        swap(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
int main()
{
  ll sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  rep(i,tx-sx)cout<<"R";
  rep(i,ty-sy)cout<<"U";
  rep(i,tx-sx)cout<<"L";
  rep(i,ty-sy)cout<<"D";
  cout<<"L";
  rep(i,ty-sy+1)cout<<"U";
  rep(i,tx-sx+1)cout<<"R";
  cout<<"D"<<"R";
  rep(i,ty-sy+1)cout<<"D";
  rep(i,tx-sx+1)cout<<"L";
  cout<<"U";
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    A, B = readline().split()
    A = int(A)
    B = int(B.replace('.', ''))
    print(A * B // 100)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 61928
#include <map>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define INF (1LL<<60)
typedef long long ll;

int N, K;
ll a[16];
map<pair<ll, pair<int, int> >, int>dp;

ll dfs(ll h, int n, int k){
  if(k == 0) return 0;
  if(n == N) return INF;
  ll res = INF;
  pair<ll, pair<int, int> >P = make_pair(h, make_pair(n, k));; 
  //  if(dp.find(P) != dp.end()){
  //    return dp[P];
  //  }

  if(N-n > k){
    res = min(res, dfs(max(h, a[n]), n+1, k));
  }
  res = min(res, dfs(a[n] + max(h-a[n]+1, 0LL), n+1, k-1) + max(h-a[n]+1, 0LL));
  //  cout << h << " " << n << " " << k << " " << res << endl;  
  dp[P] = res;
  return res;
}

int main(){
  cin >> N >> K;
  for(int i=0;i<N;i++) cin >> a[i];
  
  cout << dfs(0, 0, K) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <set>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; n > i; i++) cin >> a[i];
  
  int ans = 0;
  for(int i =0; n > i; i++){
	if(a[i] == i + 1){
	    ans++;
    	if(i != n-1){
			if(a[i + 1] == i + 2){   	
          		i++;
          		continue;
        	}
    	}
    }
  }
           cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fi first
#define sc second
#define ALL(x) x.begin(), x.end()
#define RALL(X) x.begin(), x.end()
#define FOR(i, n, k) for(i=0; i<n; i+=k)
#define FO(i, n, k) for(i=1; i<=n; i+=k)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define N 100005
#define mid ((l+r)/2)
#define dbg(x) (cerr << #x << " : " << x << endl)
#define endl "\n"
#define MOD 100000009

using namespace std;

typedef long long int lli;

/*bool ok(int x){
	vector <int> digits;
	while(x > 1){
		int digit = x%10;
		x -= digit;
		x /= 10;
		digits.pb(digit);
	}
	if(digits.size() != 2) return false;

}*/

int main(){
	ios_base::sync_with_stdio(false);
	int m, d;
	cin >> m >> d;
	int res = 0;
	for(int j=1; j<=m; j++){
		for(int i=1; i<=j; i++){
			if(j % i == 0){
				if(i / 10 >= 1 or (j/i) / 10 >= 1) continue;
				if(i*10 + (j/i) > d) continue;
				if(i >= 2 and j/i >= 2) res++;
			}
		}

	}
	cout << res;

	
	return 0;
}

Measured memory_bytes: 256
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	int n, m, x, ans = INF;
	cin >> n >> m >> x;
	vector<vector<int>> arr(n, vector<int>(m));
	vector<int> cost(n);
	for(int i = 0; i < n; i++) {
		cin >> cost[i];
		for(int j = 0; j < m; j++) {
			cin >> arr[i][j];
		}
	}
	for(int i = 0; i < (1<<n); i++) {
		vector<int> tmp(m);
		int cur = 0;
		for(int j = 0; j < n; j++) {
			if((i>>j)&1) {
				cur += cost[j];
				for(int k = 0; k < m; k++)
					tmp[k] += arr[j][k];
			}
		}
		bool ok = true;
		for(int &a: tmp) {
			ok &= (a >= x);
		}
		if(ok)
			ans = min(ans, cur);
	}
	if(ans == INF)
		ans = -1;
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 3652
import math
import bisect
A,B,Q = list(map(int,input().split(" ")))
Ss = [int(input())for _ in range(A)]
Ts = [int(input())for _ in range(B)]
Xs = [int(input())for _ in range(Q)]
Ss.sort()
Ts.sort()
ss = len(Ss)
ts = len(Ts)
for x in Xs:
    si = bisect.bisect_right(Ss,x)
    ti = bisect.bisect_right(Ts, x)
    cands = [[],[]]
    if si > 0:
        cands[0].append(Ss[si-1])
    if si < ss:
        cands[0].append(Ss[si])
    if ti > 0:
        cands[1].append(Ts[ti-1])
    if ti < ts:
        cands[1].append(Ts[ti])
    anss = []
    temp = 0
    for i in [0,1]:
        for t1 in cands[i]: #最初による所
            for t2 in cands[1-i]: #次に寄る所
                temp = abs(x-t1) +  abs(t2-t1)
                anss.append(temp)
    print(min(anss))


Measured memory_bytes: 16156
tarou, hanako = 0, 0
gets.to_i.times {
    t,h = gets.chomp.split(" ")
    if t == h
        tarou += 1
        hanako += 1
    elsif t > h
        tarou += 3
    else
        hanako += 3
    end
}

puts "#{tarou} #{hanako}"

Measured memory_bytes: 8696
n=int(input())
A=list(map(int,input().split()))
def C(n,A):
    if n==1 or n==2:
        return 1
    else:
        cnt=1
        d=A[1]-A[0]
        for i in range(2,n):
            if d:
                if (A[i]-A[i-1])*d<0:
                    cnt+=1
                    d=0
            else:
                d=A[i]-A[i-1]
        return cnt
print(C(n,A))

Measured memory_bytes: 14252
n, m, q = map(int, input().split(" "))

k = []
for _ in range(q):
    k.append(list(map(int, input().split(" "))))

max_score = 0
import itertools
for a in itertools.combinations_with_replacement(range(1, m+1), n):
    score = 0
    for i in range(q):
        if a[k[i][1]-1] - a[k[i][0]-1] == k[i][2]:
            score += k[i][3]
    if score > max_score:
        max_score = score
print(max_score)

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

using namespace std;
typedef long long ll;

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

int f(int n)
{
    return ((n & 1) ? 3 * n + 1 : n / 2);
}

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

    cout << 1110 - n << '\n';
    return 0;
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
char s[220001];
int main()
{
	cin>>(s+1);
	int n=strlen(s+1);
	long long ans=0;
	for(int i=1,c=0;i<=n;i++)
		if(s[i]=='A')c++;
		else if(s[i]=='C')c=0;
		else if(s[i+1]=='C')
		{
			ans+=c;
			i++;
		}
		else c=0;
	cout<<ans<<'\n';
}


Measured memory_bytes: 384
n, m, v, p = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
target = A[p - 1]
s = 0
for i in range(p - 1, n):
    s += A[i]
ans = p

B = [0] * n
B[p - 1] = A[p - 1]

count = 0
for i in range(p - 1, n - 1):
    if A[i] == A[i-1]:
        count += 1
        B[i + 1] = B[i]
    else:
        B[i + 1] = B[i] + A[i + 1] + count * A[i]
        count = 0

if v <= p:
    for i in range(p, n):
        if target - A[i] <= m:
            ans += 1
    print(ans)
    exit()
else:
    ans -= 1
    lim = m * (n - v)
    for i in range(p - 1, n):
        if i == 0:
            ans += 1
        else:
            temp = B[i - 1] - (i - p + 1) * A[i]
            if A[i] == A[i - 1] or (temp <= lim and target - A[i] <= m):
                ans += 1
            else:
                print(ans)
                exit()
    print(ans)
    exit()

Measured memory_bytes: 15020
N=int(input())
ab=[[]for _ in range(N)]
for i in range(N):
    a,b=map(int,input().split())
    ab[i]=[a+b,a,b]

ab.sort()
ab=ab[::-1]

T=A=0
for i in range(N):
    if i%2:
        A+=ab[i][2]
    else:
        T+=ab[i][1]
print(T-A)

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

int main(){
  string s; cin>>s;
  int ans=1000;
  for(int i=0; i<s.size(); ++i){
    char x=s[i];
    int now=0, len=0;
    for(int j=0; j<s.size(); ++j){
      if(s[j]!=x)++len;
      else{now=max(now,len); len=0;}
    }
    now=max(now, len);
    ans=min(ans, now);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define bitCount(num)  __builtin_popcount(num)
#define pb push_back
#define ll long long
#define bye return 0;
#define f(i,a,b) for( long long i=a;i<b;i++)
#define testCases long long t;cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define newLine <<"\n"

int main()
{
    fast
    int ans=0;
    for(int i=1;i<6;i++)
    {
        int ele;
        cin>>ele;
        if(ele!=i)
        ans=i;
    }
    cout<<ans<<endl;
    bye
}

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

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define PI 3.1415926536
#define INF 2e18
#define endl "\n"
#define llevel 20
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}

int _runtimeTerror_()
{
	ll n,m;
	cin>>n>>m;
	cout<<n*(n-1)/2+m*(m-1)/2<<endl;
	return 0;
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#ifdef runSieve
		sieve();
	#endif
	#ifdef NCR
		initialize();
	#endif
	int TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
		_runtimeTerror_();
	return 0;
}


Measured memory_bytes: 256
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(int(input())):
	s = input()
	if s=='AC':
		ac+=1
	elif s=='WA':
		wa+=1
	elif s=='TLE':
		tle+=1
	else:
		re+=1
print('AC x {}'.format(ac))
print('WA x {}'.format(wa))
print('TLE x {}'.format(tle))
print('RE x {}'.format(re))

Measured memory_bytes: 9200
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using vi = vector<int>;

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

#define P (1'000'000'007)

signed main() {
    int h, w, m;
    cin >> h >> w >> m;

    map<int, int> mx, my;
    set<pair<int, int>> vb;

    int sx = 0;
    int sy = 0;

    rep(i, m) {
        int a, b;
        cin >> a >> b;

        if(auto it = mx.find(a); it != mx.end()) {
            ++mx[a];
        } else {
            mx.emplace(a, 1);
        }

        chmax(sx, mx[a]);

        if (auto it = my.find(b); it != my.end()) {
            ++my[b];
        } else {
            my.emplace(b, 1);
        }

        chmax(sy, my[b]);

        vb.insert(make_pair(a, b));
    }

    vector<int> vx, vy;
    for (auto x: mx) {
        if(x.second == sx) vx.push_back(x.first);
    }
    for (auto y: my) {
        if(y.second == sy) vy.push_back(y.first);
    }

    int res = sx + sy - 1;

    for (auto x: vx) {
        for(auto y: vy) {
            if (vb.find(make_pair(x, y)) == vb.end()) {
                res = sx + sy;
                break;
            }
        }
    }

    cout << res;

    return 0;
}


Measured memory_bytes: 67380
#include <bits/stdc++.h>
using namespace std;
string s,t;
int n,m;

int getdiff(int ind){
    int cnt=0;
    for(int i=ind;i<=ind+m-1;i++){
        if(s[i]!=t[i-ind]) cnt++;
    }
    return cnt;
}

int main() 
{
    cin >> s >> t;
    
    n = s.size();
    m = t.size();
    int ans = INT_MAX;
    
    for(int i=0;i+m-1<n;i++){
        ans = min(ans, getdiff(i));
        //cout<<"ans "<<ans<<endl;
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3596
#include <queue>
#include <vector>
#include <iostream>
#pragma warning(disable : 4996)
using namespace std;
int N, M, K, S, P, Q, a, b, d1[111111], z[111111]; long long d2[111111]; vector<int> G[111111];
int main() {
	scanf("%d%d%d%d%d%d", &N, &M, &K, &S, &P, &Q);
	queue<int> que1;
	fill(d1, d1 + N, -1);
	for (int i = 0; i < K; i++) {
		scanf("%d", &a); a--; z[a] = 1;
		d1[a] = 0, que1.push(a);
	}
	for (int i = 0; i < M; i++) {
		scanf("%d%d", &a, &b); a--, b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	while (!que1.empty()) {
		int v = que1.front(); que1.pop();
		for (auto &e : G[v]) {
			if (d1[e] == -1) d1[e] = d1[v] + 1, que1.push(e);
		}
	}
	priority_queue<pair<long long, int> > que2; que2.push(make_pair(0, 0));
	fill(d2 + 1, d2 + N, 1LL << 60);
	while (!que2.empty()) {
		int v = que2.top().second; que2.pop();
		for (auto &e : G[v]) {
			if (z[e]) continue;
			long long f = d2[v] + (d1[e] <= S ? Q : P);
			if (d2[e] > f) d2[e] = f, que2.push(make_pair(-d2[e], e));
		}
	}
	cout << d2[N - 1] - (d1[N - 1] <= S ? Q : P) << endl;
	return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/16  Problem: ABC 075 B / Link: http://abc075.contest.atcoder.jp/tasks/abc075_b  ----- */


inline bool IN(int y, int x, int H, int W) { return (0 <= y && y < H && 0 <= x && x < W); }

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

	LL H, W; cin >> H >> W;
	vector<string> s(H);
	for (int i = 0; i < H; ++i) {
		cin >> s[i];
		FOR(j, 0, W) {
			if (s[i][j] == '.') {
				s[i][j] = '0';
			}
		}
	}
	FOR(i, 0, H) {
		FOR(j, 0, W) {
			if (s[i][j] == '#') {
				FOR(k, 0, 8) { 
					int ny = i + DY[k]; int nx = j + DX[k];
					if (IN(ny, nx, H, W) && s[ny][nx] != '#') {
						s[ny][nx]++;
					}
				}
			}
		}
	}
	FOR(i, 0, H) {
		cout << s[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll inf=1000000000000000000,mod=1000000007,BS;

int main(){
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        
        ll a,b;cin>>a>>b;
        cout<<a*b;
}


Measured memory_bytes: 3608
#include <iostream>

using namespace std;
int a[100010];
int main(){
	int i,n,cnt = 0;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	for(i=1;i<n;i++){
		if(a[i - 1]>=a[i]){
			cnt++;
		}
	}
	cout << cnt + 1 << endl;
	cout << n << endl;
}


Measured memory_bytes: 3488
from __future__ import division

n, k = map(int, raw_input().strip().split())

ans = 0
for score in xrange(1, n + 1):
    if score >= k:
        ans += 1 / n
        continue

    flips = 0
    while score < k:
        score <<= 1
        flips += 1

    x = 1 / pow(2, flips)
    y = 1 / n
    z = x * y
    ans += z

print "{0:.13f}".format(ans)

Measured memory_bytes: 30572
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 105;
const ll mm = 1e+18;
void solve()
{
    int x;
    cin>>x;
    if(x<1200) cout<<"ABC";
    else cout<<"ARC";
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
const int dx[4]={-1,1,0,0},dy[4]={0,0,-1,1};
typedef long long ll;
const int N=200005;
const int mod=1e9+7;
ll n,a,b,c,d;
using namespace std;

/*struct node
{
	int t,next;
}adj[N<<1];
void add(int s,int t)
{
	adj[++now]=(node){t,head[s]};
	head[s]=now;
}*/
int calc(int a,int b)
{
	int ans=1,tmp=a;
	while (b)
	{
		if (b&1) ans=(ll)ans*tmp%mod;
		tmp=(ll)tmp*tmp%mod,b>>=1;
	}
	return ans;
}
inline int read()
{
	char c;int x;
	while (c=getchar(),c<'0' || c>'9');x=c^'0';
	while (c=getchar(),c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x;
}
void write(int x)
{
	if (x==0) return;
	write(x/10);
	putchar((x%10)+'0');
}
int main()
{
	#ifdef Kay
		freopen ("code.in","r",stdin);
		freopen ("code.out","w",stdout);
	#endif
	cin>>n>>a>>b>>c>>d;
	n--;int i;
	for (i=0;i<=n;i++)
	{
		ll r=d*i-c*(n-i),l=c*i-d*(n-i);
		if (a+l<=b && a+r>=b){puts("YES");return 0;}
	}
	puts("NO");
	return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String[] strlist = str.split(" ");
		int a = Integer.parseInt(strlist[0]);
		int b = Integer.parseInt(strlist[1]);

		String answer = "Positive";
		int dif = 0;

		if(a <= 0 && b >= 0){
			answer = "Zero";
		}else if(b < 0){
			dif = b - a;
			if(dif % 2 == 0){
				answer = "Negative";
			}
		}else{
			dif = 0 - a;
			if(dif % 2 == 0){
				answer = "Negative";
			}
		}

		System.out.println(answer);
	}
}


Measured memory_bytes: 21204
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
using namespace std;

struct point {
	double x;
	double y;
	point(double xi, double yi){
		this->x = xi;
		this->y = yi;
	}
};

int main() {
	int n;
	scanf("%d", &n);
	
	list<point> pts;
	pts.push_back(point(0, 0));
	pts.push_back(point(100, 0));
	
	while(n--){
		list<point>::iterator fe = pts.begin(), se;
		while(1){
			se = fe;
			if(++se == pts.end()) break;
			
			double vx = ((*se).x - (*fe).x) / 3;
			double vy = ((*se).y - (*fe).y) / 3;
			
			point npr((*fe).x + vx, (*fe).y + vy);
			point npc(npr.x + cos(M_PI / 3) * vx - sin(M_PI / 3) * vy, npr.y + sin(M_PI / 3) * vx + cos(M_PI / 3) * vy);
			point npl((*fe).x + vx * 2, (*fe).y + vy * 2);
			
			pts.insert(se, npr);
			pts.insert(se, npc);
			pts.insert(se, npl);
			
			fe = se;
		}
	}
	
	list<point>::iterator e = pts.begin();
	do{
		printf("%.8f %.8f\n", (*e).x, (*e).y);
	}while(++e != pts.end());
	
    return 0;
}

Measured memory_bytes: 1416
#include <iostream>
using namespace std;
int main(void){
    int n, m=0, d[4];
    cin>>n;
    fill(d, d+4, 0);
    for(int i=0;i<n;i++){
        int l;
        string s;
        cin>>s;
        l=s.length();
        for(int j=0;j<l-1;j++){
            if(s[j]=='A'&&s[j+1]=='B')m++;
        }
        if(s[0]=='B'&&s[l-1]=='A')d[3]++;
        else if(s[0]=='B')d[2]++;
        else if(s[l-1]=='A')d[1]++;
        else d[0]++;
    }
    if(d[3]>1){
        m+=d[3]-1;
        d[3]=1;
    }
    if(d[3]>0&&(d[1]>0||d[2]>0))m++;
    m+=min(d[1], d[2]);
    cout<<m<<endl;
}


Measured memory_bytes: 256
import java.lang.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        for (int i = 1; i <= 5; i++) {
            int num = scan.nextInt();
            if (num == 0) {
                System.out.println(i);
            }
        }
    }
}

Measured memory_bytes: 35744
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<string>

int main() {
	std::string o, e, s;
	std::cin >> o >> e;
	for (int i = 0; i < e.size(); i++) {
		s += o[i];
		s += e[i];
	}
	if (o.size() > e.size()) {
		s += o[o.size() - 1];
	}
	std::cout << s << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

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

const int N = 100005;
vector<vector<pii> > G(N);
vector<int> color(N), used(N);

void dfs(int v, int p, int c) {
  // cout << "v " << v << " " << p << " " << c << endl;
  used[v] = 1;
  int co = 1;
  for (pii P : G[v]) {
    int nv = P.F, e = P.S;
    if (nv == p) continue;

    if (co == c) co++;
    color[e] = co;
    // cout << nv << " " << v << " " << co << endl;
    dfs(nv, v, co);
    co++; // dfs のあと
  }
}
void solve() {
  int n;
  cin >> n;
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].eb(b, i);
    G[b].eb(a, i);
  }
  // 何色使うか
  // 字数最大の頂点
  int K = 0;
  rep(i, n) chmax(K, sz(G[i]));
  cout << K << endl;

  dfs(0, -1, -1);
  rep(i, n - 1) cout << color[i] << endl;
}


Measured memory_bytes: 9856
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int p[100];
	for(int i=1;i<=b;i++)p[i-1]=a*i%b;
	for(int i=0;i<b;i++){
		if(p[i]==c){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
    return 0;
}

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

const long long int mod = 1000000007;

long long int c[2020][2020];

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

  for (int i = 1; i <= n-1; i++) {
    for (int j = 1; j <= i; j++) {
      if (j == 1) {
        c[i][j] = i;
      }
      if(j == i) {
        c[i][j] = 1;
      }
      if(j >= 2 && j <= i-1) {
        c[i][j] = (c[i-1][j-1] + c[i-1][j]) % mod;
      }
    }
  }

  c[1][1] = 1;

  for (int i = 1; i <= k; i++) {
    if (c[k-1][i-1] == 0) {
      c[k-1][i-1] = 1;
    }
    cout << c[n-k+1][i] * c[k-1][i-1] % mod << endl;
  }
}


Measured memory_bytes: 30336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

int main()
{
    int N; cin >> N;
    
    ll H[100009]; rep(i,N) cin >> H[i];
    H[N] = INF;

    int ans = 0, cnt = 0;

    rep(i,N)
    {
        if (H[i] >= H[i + 1]) cnt++;
        else
        {
            ans = max(ans, cnt);
            cnt = 0;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
def main():
    A, B, C, D, E, F = map(int, input().split())
    A *= 100
    B *= 100
    ans = (0, 0)
    for a in range(F//A+1):
        for b in range((F-A*a)//B+1):
            for c in range((F-A*a-B*b)//C+1):
                for d in range((F-A*a-B*b-C*c)//D+1):
                    if a == b == c == d == 0:
                        continue
                    x = C*c + D*d
                    y = A*a + B*b + x
                    if (100+E) * x <= E * y and ans[0] * x >= ans[1] * y:
                        ans = (y, x)
    print(" ".join(map(str, ans)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 41564