akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,m;
	LL a,b;
	cin>>n>>m>>a>>b;
	vector<vector<char>> bd=vector<vector<char>>(n+2,vector<char>(m+2,'.'));
	int h=n,w=m;
	if(h==1&&w==1){
		if(a==0&&b==0){
			cout<<"YES"<<endl;
			cout<<"."<<endl;
		}else{
			cout<<"NO";
		}
		return 0;
	}
	if(h%2==1&&w%2==1){
		FOR(i,h-1,h){
			FOR(j,0,w-3){
				if(a>0){
					bd[i][j]='<';
					bd[i][j+1]='>';
					j++;
					a--;
				}else break;
			}
		}
		FOR(i,0,h-3){
			FOR(j,w-1,w){
				if(b>0){
					bd[i][j]='^';
					bd[i+1][j]='v';
					i++;
					b--;
				}else break;
			}
		}
		if(a>1&&b>1&&a%2==0&&b%2==0){
			bd[h-3][w-3]='<';
			bd[h-3][w-2]='>';
			bd[h-1][w-2]='<';
			bd[h-1][w-1]='>';
			bd[h-2][w-3]='^';
			bd[h-1][w-3]='v';
			bd[h-3][w-1]='^';
			bd[h-2][w-1]='v';

			a-=2;
			b-=2;
		}else{
			if(a>0){
				bd[h-1][w-3]='<';
				bd[h-1][w-2]='>';
				a--;
			}
			if(b>0){
				bd[h-3][w-1]='^';
				bd[h-2][w-1]='v';
				b--;
			}
		}
		h--;
		w--;
	}else if(h%2==1){
		FOR(i,h-1,h){
			FOR(j,0,w){
				if(a>0){
					bd[i][j]='<';
					bd[i][j+1]='>';
					j++;
					a--;
				}else break;
			}
		}
		h--;
	}else if(w%2==1){
		FOR(i,0,h){
			FOR(j,w-1,w){
				if(b>0){
					bd[i][j]='^';
					bd[i+1][j]='v';
					i++;
					b--;
				}else break;
			}
		}
		w--;
	}else{

	}
	FOR(i,0,h){
		FOR(j,0,w){
			if(bd[i][j]!='.')break;
			if(a>0){
				bd[i][j]='<';
				bd[i][j+1]='>';
				if(a>1){
					bd[i+1][j]='<';
					bd[i+1][j+1]='>';
					a--;
				}
				a--;
			}else if(b>0){
				bd[i][j]='^';
				bd[i+1][j]='v';
				if(b>1){
					bd[i][j+1]='^';
					bd[i+1][j+1]='v';
					b--;
				}
				b--;
			}
			j++;
		}
		i++;
	}
	if(a!=0||b!=0){
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	FOR(i,0,n){
		FOR(j,0,m){
			cout<<bd[i][j];
		}
		cout<<endl;
	}
  return 0;
}


Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <numeric>
#include <cmath>

#define rep(i, n) for(int i = 0;i < (int)(n); i++)
#define pb push_back
typedef long long ll;

using namespace std;

int main() {
    int p[10];
    int n,m;
    cin >> n >> m;
    bool ok[n][n];
    rep(i, n) rep(j ,n) ok[i][j] = false;
    rep(i, m){
        int a, b;
        cin >> a >> b;
        ok[a-1][b-1] = true;
        ok[b-1][a-1] = true;
    }

    rep(i, n) p[i] = i;
    int count = 0;
    do {
        int flg = true;
        for(int j = 1; j < n; j++){
            if(!ok[p[j - 1]][p[j]]) {
                flg = false;
                break;
            }
        }
        if(flg) count++;
    } while (next_permutation(p + 1, p + n));
    //next?permutationは最後だったらfalse返すので
    //全部のPの順列に大してこれで処理できる.

    cout << count << endl;

    return 0;
}


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

int main() {
	int N;
	cin >> N;
	map<string, int> ma;
	for (int i = 0; i < N; i++) {
		string S;
		cin >> S;
		ma[S]++;
	}

	vector<pair<int, string>> Poll;
	for (auto x: ma) {
		auto y = make_pair(x.second, x.first);
		Poll.push_back(y);
	}

	sort(Poll.begin(), Poll.end(), greater<pair<int, string>>());
	int max_Poll = Poll.at(0).first;
	for (int i = (int)Poll.size() - 1; i >= 0; i--) {
		if (Poll.at(i).first == max_Poll) {
			cout << Poll.at(i).second << endl;
		}
	}
}

Measured memory_bytes: 29680
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>
#include<queue>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

template<class T>
struct Edge {
    int to;
    T cost;
    Edge() {};
    Edge(int to, T cost) : to(to), cost(cost) {};
};

template<class T>
class Graph {
    int n;
    bool directed;
    vector<vector<Edge<T>>> edges;
public:

    Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)){};
    Graph() {};

    void add(int from,int to, T cost) {
        edges[from].emplace_back(to, cost);
        if(!directed){
            edges[to].emplace_back(from,cost);
        }
    }

    int size() {
        return n;
    }
};


int main() {

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

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

const int MAX_N=101010;
vector<bool> IsPrime(MAX_N, true);

void sieve() {
  IsPrime[0]=false;
  IsPrime[1]=false;
  for (int i=2; i*i<=MAX_N; i++) {
    if(IsPrime[i]) {
      for (int j=2; i*j<=MAX_N; j++) {
        IsPrime[i*j]=false;
      }
    }
  }
}


int main() {
  int x; cin>>x;
  int ans=0;
  sieve();
  for (int i=2; i<=MAX_N; i++) {
    if (IsPrime[i]&&i>=x) {
      ans=i;
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
a[51],i,j;main(n){for(;scanf("%d",&n)*n;){for(i=0;i<n;i++)scanf("%d",a+i);for(a[n]=i=0;i<n;i++){for(j=i;a[j+1]==a[j]+1;j++);i-j?printf("%d-",a[i]),i=j:0;printf("%d%c",a[i],i+1<n?32:10);}}}

Measured memory_bytes: 0
H, N = map(int, input().split())
a, b = [0]*N, [0]*N
for i in range(N):
    a[i], b[i] = map(int, input().split())
dp = [[float('inf')] * (H+1) for _ in range(N+1)]
for i in range(N+1):
    dp[i][0] = 0
for i in range(N):
    for j in range(H+1):
        if j - a[i] <= 0:
            dp[i+1][j] = min(dp[i][j],b[i])
        else:
            dp[i+1][j] = min(dp[i][j],dp[i+1][j-a[i]]+b[i])
print(dp[N][H])

Measured memory_bytes: 359740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

//long longのシフト演算には気をつけよう



vector<ll> a, p;

ll f(ll n, ll x){
    if(n==0) return 1;

    if(x==1) return 0;
    else if(x<=1+a[n-1]) return f(n-1,x-1);
    else if(x==2+a[n-1]) return p[n-1]+1;
    else if(x<=2+2*a[n-1]) return p[n-1]+1+f(n-1, x-2-a[n-1]);
    else return 2*p[n-1]+1;
}

int main(void){
    ll n, x; cin >> n >> x;
    a.push_back(1); p.push_back(1);
    for(int i=0; i<n; i++){
        a.push_back(2*a[i]+3);
        p.push_back(2*p[i]+1);
    }

    cout << f(n,x) << endl;
}


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

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

  vector<int> vec(n) ; 
  for ( int i = 0 ; i < n ; i++ ) 
  	cin >> vec.at(i);
  
  int max = *max_element(vec.begin(),vec.end()) ;
  int ans = 0;
  
  
  while ( max > 0 ) {
    bool flag = true;
    for ( int i = 0 ; i < n ; i++ ) {
    	if (vec.at(i) == max ) {
          vec.at(i) -= 1 ;
          if (flag) {ans += 1 ; flag = false ;} 
        }
      	else if ( vec.at(i) < max && flag == false)
          flag = true ; 
    }
    
    /*for ( int j : vec)
	    cout << j << ' ' ;
	
    cout << '\n' << ans << '\n' ; */
    
    max -= 1 ; 
  }
  cout << ans << endl ; 
  
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define LL long long

LL N,M,ans,r,a,o,t,f;

pair<LL, LL>bc;
vector<pair<LL, LL>>BC;
int main() {
	vector<LL> A;
	cin >> N;
	o = 0;
	t = 0;
	f = 0;

	for (int i = 0; i < N; i++) {
		cin >> a;
		if (a % 4 == 0) {
			f++;
		}
		else {
			if (a % 2 == 0)t++;
			else o++;
		}
	}

	if (o == 0){
		cout << "Yes" << endl;
		return 0;
	}

	if (t > 0)o++;
	if(f>=o-1)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>
using namespace std;

int h,w,K;
string str;
int fie[100][100];
short dp[51][51][4][1<<12+1];
int res=0;

short dfs(int x,int y,int k,int bit,int pc){
	int nx=x,ny=y;
	if(dp[x][y][k][bit]!=-1)return dp[x][y][k][bit];
	
	//11nx++,10nx--,01ny++,00ny--;
	int nbit=bit;
	if(nbit >>11 & 1)nbit-=1<<11;
	if(nbit >>10 & 1)nbit-=1<<10;
	nbit<<=2;
	short r=-20000;
	if(k>=1){
		nbit+=2;
		x--;
		if(x>=0 && y>=0 && fie[x][y]!=-1){
			r=max(r,dfs(x,y,k-1,nbit,pc+1));
		}
		x++;
		y--;
		nbit-=2;
		if(x>=0 && y>=0 && fie[x][y]!=-1){
			r=max(r,dfs(x,y,k-1,nbit,pc+1));
		}
		y++;
	}
	nbit+=3;
	x++;
	if(x>=0 && y>=0 && fie[x][y]!=-1){
		r=max(r,dfs(x,y,k,nbit,pc+1));
	}
	x--;
	nbit-=2;
	y++;
	if(x>=0 && y>=0 && fie[x][y]!=-1){
		r=max(r,dfs(x,y,k,nbit,pc+1));
	}
	y--;
	
	int sum=0;
	bool f=false;
	for(int i=0;i<min(pc,6);i++){
		if(bit >>i*2 & 1){
			if(bit >>(i*2+1) & 1)nx--;
			else ny--;
		}else{
			if(bit >>(i*2+1) & 1)nx++;
			else ny++;
		}
		if(nx==x && ny==y){
			f=true;
			break;
		}
	}
	if(!f)sum+=fie[x][y];
	
	if(r<0 && x==w-1 && y==h-1)r=0;
	return (dp[x][y][k][bit]=sum+r);
}

int main(void){
	scanf("%d%d%d",&h,&w,&K);
	memset(fie,-1,sizeof(fie));
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<h;i++){
		cin >> str;
		for(int j=0;j<w;j++){
			if(str[j]=='.')fie[j][i]=0;
			else if(str[j]=='#')fie[j][i]=-1;
			else fie[j][i]=str[j]-'0';
		}
	}
	printf("%d\n",dfs(0,0,K,0,0));
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  if (N < 82 && ((N / 1 < 10 && N % 1 == 0) 
    || (N % 2 == 0 && N / 2 < 10) || (N % 3 == 0 && N / 3 < 10) 
    || (N % 4 == 0 && N / 4 < 10) || (N % 5 == 0 && N / 5 < 10)
    || (N % 6 == 0 && N / 6 < 10) || (N % 7 == 0 && N / 7 < 10) 
    || (N % 8 == 0 && N / 8 < 10) || (N % 9 == 0 && N / 9 < 10)))
  {
    cout << "Yes";
  }else
  {
    cout << "No";
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<stack>
#include<algorithm>
using namespace std;

int main() {
	stack<int> S1;
	stack<pair<int, int> >S2;
	char s[20000 + 10];
	scanf("%s", s);
	int i = 0, sum = 0;
	while (s[i] != '\0') {
		// ??\???\????????\???
		if (s[i] == '\\')
			S1.push(i);
		else if (s[i] == '/' && !S1.empty()) {
			int j = S1.top(); S1.pop();
			// ????????°??¢????????¢?§?
			sum += i - j;
			int a = i - j;

			// ?????????????????¨??????
			while (!S2.empty() && S2.top().first > j) {
				a += S2.top().second; S2.pop();
			}
			S2.push(make_pair(j, a));
		}
		i++;
	}

	vector<int> ans;
	while (!S2.empty()) {
		ans.push_back(S2.top().second);
		S2.pop();
	}
	printf("%d\n", sum);
	int len = ans.size();
	printf("%d", len);
	for (int i = len - 1; i >= 0; i--) {
		printf(" %d", ans[i]);
	}
	printf("\n");
	return 0;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    int N, M;
    cin >> N >> M;
    int ans;
    int div = M / N;
    while (true)
    {
        if (M % div == 0)
        {
            ans = div;
            break;
        }
        div--;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
// pana1-2
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

int main(){

    ll H, W;
    cin >> H >> W;
    if(H == 1 || W == 1){
        cout << 1 << endl;
        return 0;
    }
    ll a = (W + 1) / 2;
    ll b = W / 2;
    ll ans = 0;
    if(H % 2 == 0){
        ans = (a + b) * (H / 2);
    }
    else {
        ans = (a + b) * (H / 2);
        if(W % 2)ans += a;
        else ans += b;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main() {
	int a, b, c;
	int d;

	std::cin >> a >> b >> c;
	d = c - (a - b);
	if (d > 0) {
		std::cout << d << std::endl;
	}
	else {
		std::cout << "0" << std::endl;
	}
	

}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a;
	vector<int> b;
	vector<int> c;
	int points = 0;
	for (int i = 0; i < n; ++i) {
		int input;
		cin >> input;
		a.push_back(input);
	}
	for (int i = 0; i < n; ++i) {
		int input;
		cin >> input;
		b.push_back(input);
	}
	for (int i = 0; i < n - 1; ++i) {
		int input;
		cin >> input;
		c.push_back(input);
	}
	points += b[a[0] - 1];
	for (int i = 1; i < n; ++i) {
		points += b[a[i] - 1];
		if (a[i] - a[i - 1] == 1) {
			points += c[a[i - 1] - 1];
		}
	}
	cout << points;

}

Measured memory_bytes: 256
#include <iostream>
int main(int argc, char const *argv[]) {
    int A;
    int B;
    std::cin >> A >> B;
    if (A+B>=10) {
        std::cout << "error" << '\n';
    }
    else{
        std::cout << A+B << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int i, j, k, n, l;
	int b, f, r, v;
	int a[5][4][11] = { 0 };
	cin >> n;

	for (l = 0; l < n; l++){
		cin >> b >> f >> r >> v;
		a[b][f][r] = a[b][f][r]+ v;
		if (a[b][f][r]>9){
			a[b][f][r] = 9;
		}
		if (a[b][f][r] < 0){
			a[b][f][r] = 0;
		}
	}
	for (i = 1; i <5; i++){
		for (j = 1; j < 4; j++){
			for (k = 1; k < 11; k++){
				cout <<" "<< a[i][j][k] ;
			}
			cout << endl;
		}
		if (i == 4){ break; }
		cout << "####################" << endl;
	}
	return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    int n, t, s; cin >> n >> t >> s;
    vector<ll> value(n), time(n);

    rep(i,n) cin >> value[i] >> time[i];
    vector<vector<ll>> dp1(n+1, vector<ll> (s+1,0));
    vector<vector<ll>> dp2(n+1, vector<ll> ((t-s)+1,0));

    for(int i = 0; i < n; i++){
        for(int T = 0; T <= s; T++){
            if(T >= time[i]) dp1[i+1][T] = max(dp1[i][T-time[i]] + value[i],dp1[i][T]);
            else dp1[i+1][T] = dp1[i][T];
        }
    }

    for(int i = 0; i < n; i++){
        for(int T = 0; T <= t-s; T++){
            if(T >= time[n-i]) dp2[i+1][T] = max(dp2[i][T-time[n-i]] + value[n-i],dp2[i][T]);
            else dp2[i+1][T] = dp2[i][T];
        }
    }

    ll ans = 0;
    rep(i,n){
        ans = max(dp2[i][t-s] + dp1[n-i][s], ans);
    }

    cout << ans << endl;
}



Measured memory_bytes: 73656
#include <iostream>
#include <string>

using namespace std;

int main() {

  string str;


  while(getline(cin,str)) {

    //ê¶¸Â¸ç·
    for(int i=0;i<26;i++) {

      for(int j=0;j<str.size();j++) {

	if(str[j]>='a' && str[j]<'z') str[j]+=1;

	else if(str[j]=='z') str[j]='a';

      }

      //the,this,thatª é©Ç¤©»è
      if(str.find("the")!=string::npos || str.find("this")!=string::npos || str.find("that")!=string::npos) {

	cout << str << endl;

      }

    }

  }

  return 0;

}

  

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define rep(i,start,lim) for(lld i=start;i<lim;i++)
#define repd(i,start,lim) for(lld i=start;i>=lim;i--)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define br printf("\n")
#define sz(a) lld((a).size())
#define YES printf("YES\n")
#define NO printf("NO\n")
#define all(c) (c).begin(),(c).end()
#define INF         1011111111
#define LLINF       1000111000111000111LL
#define EPS         (double)1e-10
#define MOD         1000000007
#define PI          3.14159265358979323
using namespace std;
typedef long double ldb;
typedef long long lld;
lld powm(lld base,lld exp,lld mod=MOD) {lld ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
lld ctl(char x,char an='a') {return (lld)(x-an);}
char ltc(lld x,char an='a') {return (char)(x+an);}
#define bit(x,j) ((x>>j)&1)
typedef vector<lld> vlld;
typedef pair<lld,lld> plld;
typedef map<lld,lld> mlld;
typedef set<lld> slld;
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mxm(a,b) a = max(a,b)
#define mnm(a,b) a = min(a,b)
#define endl '\n'
#define fre freopen("1.in","r",stdin); freopen("1.out","w",stdout);
#define N 1000005
int dp[N];
int main()
{
    //sync;
    rep(i,0,N) dp[i] = INF;
    vector<int> v;
    int n,p=1;
    cin>>n;
    v.pb(1);
    rep(iter,0,100) {
        p = p * 6;
        if(p > n) break;
        v.pb(p);
    } 
    p = 1;
    rep(iter,0,100) {
        p = p * 9;
        if(p > n) break;
        v.pb(p);
    } 
    dp[0] = 0;
    rep(i,1,n+1) for(auto j:v) if(i>=j) dp[i] = min(dp[i], dp[i-j]+1);
    cout<<dp[n];
    return 0;
}

Measured memory_bytes: 4096
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace contest_Csharp
{
    class Program
    {


        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var vals = Console.ReadLine().Split(' ').
                Select(x => int.Parse(x)).ToList();
            var L = vals[0];
            var R = vals[1];
            var d = vals[2];

            var ans = R / d - (L - 1) / d;




            Console.WriteLine(ans);
            Console.Out.Flush();
        }





    }
}




Measured memory_bytes: 28204
using System;

namespace ALDS1
{
    class Program
    {
        private static int Prime(int a)
        {
            int b = (int)Math.Sqrt(a);
            for(int i = 2; i <= b; i++)
                if (a % i == 0) return 0;
            return 1;
        }

        static void Main()
        {
            int c = 0;
            int l = int.Parse(Console.ReadLine());
            while (l-- > 0)
                c += Prime(int.Parse(Console.ReadLine()));
            Console.WriteLine(c);
        }
    }
}

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

#include <atcoder/all>

using namespace std;
using namespace atcoder;

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define per(i, b) per2(i, 0, b)
#define per2(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define ALL(c) (c).begin(), (c).end()
#define SZ(x) ((int)(x).size())

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

int main() {
    int N, D;
    cin >> N >> D;
    VV<int> vec(N);
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        vec[i] = V<int>{x, y};
    }
    two_sat g(N);
    rep(i, N) {
        rep(j, i) {
            rep(p, 2) rep(q, 2) {
                if (abs(vec[i][p] - vec[j][q]) < D) {
                    g.add_clause(i, p ^ 1, j, q ^ 1);
                }
            }
        }
    }
    if (!g.satisfiable()) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    auto ans = g.answer();
    rep(i, N) { cout << vec[i][ans[i]] << '\n'; }
    return 0;
}

Measured memory_bytes: 3812
#include "bits/stdc++.h"
using namespace std;
using ll = long long;


int main() {
	int n;
    double d;
	cin >> n >> d;
	vector<double> x(n), y(n);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		if (sqrt(x[i] * x[i] + y[i] * y[i]) <= d) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 6452
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int h = in.nextInt();
		int w = in.nextInt();
		boolean[][] a = new boolean[h+1][w+1];
		for(int i=0;i<h;i++) {
			String str = in.next();
			for(int j=0;j<w;j++) {
				if(str.charAt(j)=='#') a[i][j] = true;
				a[i][w] = a[i][w]|a[i][j];
				a[h][j] = a[h][j]|a[i][j];
			}
		}
		
		for(int i=0;i<h;i++) {
			if(a[i][w]) {
				String str = "";
				for(int j=0;j<w;j++) {
					if(a[h][j]) str += (a[i][j] ? "#" : ".");
				}
				System.out.println(str);
			}
		}
		in.close();

	}

}


Measured memory_bytes: 27732
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
 

int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=-1000000;i<=1000000;i++){
		if(ABS(i-b)<a)printf("%d ",i);
	}printf("\n");
}

Measured memory_bytes: 128
n = int(input())
prev_t = 0
prev_x = 0
prev_y = 0
for i in range(n):
    t, x, y=map(int, input().split())
    if abs(prev_x - x) + abs(prev_y - y) > (t - prev_t) or (abs(prev_x - x) + abs(prev_y - y) + (t - prev_t)) % 2:
        print("No")
        exit()
    prev_t = t
    prev_x = x
    prev_y = y
print("Yes")



Measured memory_bytes: 3060
#include <iostream>
#include <vector>

using namespace std;

int main(void){
	int n, m, i, p;
	vector<int> v;
	while(1){
		cin >> n >> m;
		if((n | m) == 0){
			break;
		}
		for(i = 0;i < n;i++){
			v.push_back(i + 1);
		}
		p = 0;
		while(v.size() > 1){
			p = (p + m - 1) % v.size();
			for(i = p;i < v.size() - 1;i++){
				v[i] = v[i + 1];
			}
			v.pop_back();
			p %= v.size();
		}
		cout << v[0] << endl;
		v.clear();
	}
	return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

const int N = 150000;
const int M = 500;
const int MOD = 1e9 + 7;
const int alpha = 26;
const double PI = acos(-1);
ll n, k;
ll ans = 0;
ll a[N];
ll b[N];

signed main()
{
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
    cin >> n;
    printf("%.9f", 2 * PI * n);
}


Measured memory_bytes: 3732
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
typedef long long ll;
const int N = 100;
char m[N][N];
vector<int> t[N][N];
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
bool vis[N][N];
int on[N][N];
int off[N][N];
int keep[N][N];

bool dfs(int r,int c,int y,int x,int ty,int tx,int ti,int &total){
  if (vis[y][x])return false;
  if (y == ty && x == tx){
    
    return true;
  }
  vis[y][x]=true;
  rep(i,4){
    int nex=x+dx[i],ney=y+dy[i];
    if (nex == -1 || ney == -1 || nex == c || ney == r || 
        m[ney][nex] == '#')continue;
    if (dfs(r,c,ney,nex,ty,tx,ti+1,total)){
      total++;
      t[y][x].push_back(ti);
      return true;
    }
  }
  return false;
}

int main(){
  int r,c,q;
  while(cin>>r>>c>>q){
    rep(i,r)rep(j,c)t[i][j].clear();
    rep(i,r)cin>>m[i];
    //bool dfs(int r,int c,int y,int x,int ty,int tx,int ti,int &total);
    rep(i,r)rep(j,c)cin>>keep[i][j];
    rep(i,r)rep(j,c)cin>>on[i][j];
    rep(i,r)rep(j,c)cin>>off[i][j];

    int total=0;
    int py,px;
    rep(i,q){
      rep(ii,r)rep(jj,c)vis[ii][jj]=false;
      int sy,sx;
      cin>>sy>>sx;
      if (i != 0){
        dfs(r,c,py,px,sy,sx,total,total);
      }
      if (i == q-1)t[sy][sx].push_back(total);
      py=sy;
      px=sx;
    }
    ll ans=0;
    rep(i,r){
      rep(j,c){
        if (t[i][j].size() == 0)continue;
        //debqug
        /*
          cout <<"node i j " << i <<" " << j <<" : ";
          rep(k,(int)t[i][j].size()){
          cout << t[i][j][k] << " ";
          }
          cout << endl;
        */
        ans+=on[i][j]+off[i][j];
        REP(k,1,(int)t[i][j].size()){
          ll dif=t[i][j][k]-t[i][j][k-1];
          ll costa=dif*keep[i][j];//keep
          ll costb=on[i][j]+off[i][j];//off->onn
          ans+=min(costa,costb);
        }
      }
    }
    cout << ans << endl;
  }
  return false;
}

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

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

    for(int i = 0; i < s.size(); i++){
        rotate(s.begin(), s.begin()+1, s.end());
        if(s == t){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
n, m = map(int,input().split())
for i in range(m):
    if (i == 0):
        l, r = map(int,input().split())
    else:
        l2, r2 = map(int,input().split())
        l = max(l, l2)
        r = min(r, r2)
if (l > r):
    print(0)
else:
    print(r - l + 1)


Measured memory_bytes: 9148
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ABC110A___Maximize_the_Formula
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int[] line = Array.ConvertAll(Console.ReadLine().Trim().Split(' '),int.Parse);
            Array.Sort(line);
            Array.Reverse(line);
            Console.WriteLine("{0}",line[0]*10+line[1] + line[2]);
        }
    }

}


Measured memory_bytes: 13268
program ABC085C
    implicit none
    integer(8)::N,Y,i,j
    integer(8)::flg=0
    integer(8)::result(3)
    read(5,*)N,Y

    do i=0,N
        do j=0,N-i
            if(9*i+4*j==Y/1000-N)then
                flg=1
                result(1)=i
                result(2)=j
                result(3)=N-i-j
                exit
            end if
        end do
    end do

    if(flg==0)then
        print'(i0,1x,i0,1x,i0)',-1,-1,-1
    else
        print'(i0,1x,i0,1x,i0)',result(1),result(2),result(3)
    end if
end program ABC085C

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(int i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7;

int main() {
  while(1) {
    int n; cin >> n;
    if(n == 0) return 0;
    vector<string> v(n);
    rep(i, n) cin >> v[i];
    int count = 0;
    bool flag = true;
    rep(i, n-1) {
      if(flag) {
      if(v[i] == "lu" && v[i+1] == "ru") {
        count++;
        flag = false;
      }
      if(v[i] == "ru" && v[i+1] == "lu") {
        count++;
        flag = false;
      }
      }
      else {
        if(v[i] == "ld" && v[i+1] == "rd") {
          count++;
          flag = true;
        }
        if(v[i] == "rd" && v[i+1] == "ld") {
          count++;
          flag = true;
        }
      }
    }
    cout << count << endl;
  }
}



Measured memory_bytes: 3076
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 area = a * b;
        int length = 2 * (a + b);

        System.out.println(area + " " + length);
    }
}


Measured memory_bytes: 25868
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=a*c;
    ans=max(ans,a*d);
    ans=max(ans,b*c);
    ans=max(ans,b*d);
    cout<<ans<<endl;
    return 0; 
}

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

int main() {

  unsigned int Syain;
  cin >> Syain;

  vector<int> buka(Syain,0);


  for(int i=0; i<Syain-1; i++){
    int tmpZyosi;
    cin >> tmpZyosi;
    int zyosiIndex = tmpZyosi - 1;
    buka.at(zyosiIndex)++;
  }

  for(int i=0; i<Syain; i++){
    cout << buka.at(i) << endl;
  }

  return 0;

}


Measured memory_bytes: 3988
temp = [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]
print(temp[int(input())-1])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1001001001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

int main()
{
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    for (int i = 0; i < h; i++)
    {
        if (i < b)
        {
            for (int j = 0; j < a; j++)
            {
                cout << 0;
            }
            for (int j = a; j < w; j++)
            {
                cout << 1;
            }
            cout << endl;
        }
        else
        {
            for (int j = 0; j < a; j++)
            {
                cout << 1;
            }
            for (int j = a; j < w; j++)
            {
                cout << 0;
            }
            cout << endl;
        }
    }
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
};

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

void solve() {
  int n;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  vector<int> alpha(26,51);
  for (int  i = 0; i < n; i++) {
    vector<int> tmp(26);
    for (char c : s[i]) {
      tmp[c - '0' - 49]++;
    }
   for(int j = 0; j < 26; j++) {
      alpha[j] = min(tmp[j], alpha[j]);
    }
  }
  for (int i = 0; i < 26; i++) {
    for(int j = 0; j < alpha[i]; j++){
      char r = (i + 49) + '0';
      cout << r;
    }
  }

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


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

#define rep(i,j,n) for(int i=(j);i<(n);++i)
#define erep(i,j,n) for(int i=(j);i<=(n);++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	i64 x, y;
	cin >> x >> y;
	if (abs(x - y) <= 1) cout << "Brown\n";
	else cout << "Alice\n";
}

Measured memory_bytes: 256
/*  
    Come feed the rain
	Cos I'm thirsty for your love
	Dancing underneath the skies of lust
	Yeah feed the rain...
	Cos without your love my life
	Ain't nothing but this carnival of rust
    _________________________
    _________________________
    816 Hours of Solitude
    Quarantine_Day : 34
*/

#include<bits/stdc++.h>

using namespace std;

typedef long long int       ll;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef pair<int, int>      pii;

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<int>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 50005

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

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

	int lx = 0, ly = 0, rx = w, ry = w;
	REP(i, n){
		int x, y, a;
		cin>>x>>y>>a;

		if(a == 1) lx = max(lx, x);
		else if(a == 2) rx = min(rx, x);
		else if(a == 3) ly = max(ly, y);
		else ry = min(ry, y);
	}
	if(rx - lx < 0 || ry - ly < 0) cout<<0<<"\n";
	else cout<<(rx - lx) * (ry -ly)<<"\n";

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int,int>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define ll long long
#define sz size()
#define ft front
#define pu push
#define ty empty
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int m5=100042;
int main(void)
{
	int n;
	cin>>n;
	for(long long int i=-2000;i<=2000;i++)
	{
		for(long long int j=-2000;j<=2000;j++)
		{
			if(i*i*i*i*i-j*j*j*j*j==n)
			{
				cout<<i<<" "<<j<<endl;
				return 0;
			}
		}
	}
}



Measured memory_bytes: 3640
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


n = input()
sum = 0
for i in range(len(n)):
    sum += int(n[i])
if int(n) % sum == 0:
    print("Yes")
    exit()
print("No")


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

using ll = long long;

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

    int N = 50;
    vector<ll> ans(N);
    for(int i = 0; i < N; i++) ans[i] = N - 1 - i; // K = 0;

    ll plus = K / N + ((K % N != 0) ? 1 : 0);
    ll boder = (K % N != 0) ? K % N - 1 : N - 1;

    for(int i = 0; i < N; i++) {
        if(i <= boder) ans[i] += plus;
        else ans[i] += plus - 1;
    }

    cout << N << endl;
    for(auto e : ans) cout << e << " ";
    cout << endl;

    return 0;
}

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

int main()
{
	int N,ans=0;

	cin >> N;

	for (int i = 1; i <= N; i++) {
		if (i % 2 == 0)continue;
		for (int k = 1,c=0; k <= i;k++) {
			if (i%k == 0)c++;
			if (k == i&&c == 8)ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
# coding: utf-8

N, M = (int(x) for x in input().split())
road = [list(map(int, input().split())) for _ in range(M)]

num = [0 for _ in range(N)]

for i in range(M):
    num[road[i][0] - 1] += 1
    num[road[i][1] - 1] += 1

for i in range(N):
    print(num[i])

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

#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define pb push_back
#define FI first
#define SE second
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define test 1
#define TEST if(test)

using namespace std;

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

const int MOD = 1000000007; // 998244353
const int INF = 2e9;
const ll INFLL = 1e18;
const int MAX_N = 1000;

int N;
vector<pii> vt;

ll ccw(pii a, pii b, pii c){
    b.first-=a.first; b.second-=a.second; c.first-=a.first; c.second-=a.second;
    return (ll)b.first*(ll)c.second-(ll)b.second*(ll)c.first;
}

bool sf(pii a, pii b){
    if((a<mp(0, 0))^(b<mp(0, 0)))    return a>b;
    if(ccw(mp(0, 0), a, b)!=0)    return ccw(mp(0, 0), a, b)>0;
    return ((ll)a.first*(ll)a.first+(ll)a.second*(ll)a.second)<((ll)b.first*(ll)b.first+(ll)b.second*(ll)b.second);    
}

ll X[MAX_N+1], Y[MAX_N+1];

ll ans;

int main(){
	scanf("%d", &N);
	for(int i=0; i<N; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		vt.pb({a, b});
	}
	sort(vt.begin(), vt.end(), sf);
	/*for(int i=0; i<N; i++){
		cout<<vt[i].first<<" "<<vt[i].second<<endl;
	}*/
	int sz = vt.size();
	for(int i=0; i<sz; i++){
		vt.pb(vt[i]);
	}
	int idx = 0;
	X[0] = 0;
	Y[0] = 0;
	for(int i=0; i<vt.size(); i++){
		X[i+1] = (ll)vt[i].first + X[i];
		Y[i+1] = (ll)vt[i].second + Y[i];
		for(int j=max(0, i-sz+1); j<=i; j++){
			ans = max(ans, (X[i+1]-X[j])*(X[i+1]-X[j]) + (Y[i+1]-Y[j])*(Y[i+1]-Y[j]));
		}
	}
	printf("%.30LF", (long double)(sqrt((long double)ans)));
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define flush fflush(stdout)
#define debug printf("Hello\n")
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
int n, m, k, x, y, sum, cnt;
ll ans;
double t;
priority_queue<double>pq;
int main () {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  FOR(i, 1, n) {
    cin >> t;
    pq.push(-t);
  }
  FOR(i, 1, n-1) {
    double a = -pq.top();
    pq.pop();
    double b = -pq.top();
    pq.pop();
    pq.push(-(a+b)/2.0);
  }
  cout << fixed << setprecision(10) << -pq.top() << endl;
  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define itn int
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=2e9;
const ll lnf=9e18;

int main(){
  cout << fixed << setprecision(15);
  itn n; cin >> n;
  vector<ld> x(n);
  vector<ld> y(n);
  rep(i,n) cin >> x[i] >> y[i]; 
  if(n==2){
    ld cx=(x[0]+x[1])/2;
    ld cy=(y[0]+y[1])/2;
    ld dist=sqrt((cx-x[1])*(cx-x[1])+(cy-y[1])*(cy-y[1]));
    cout << dist << endl;
    return 0;
  }
  ld ans=inf;

  rep(i,n)rep(j,n)rep(k,n)if(i!=j&&j!=k&&k!=i){
    bool f=0;
    if(abs(y[i]-y[j])<(ld)0.1||abs(y[k]-y[j])<(ld)0.1) f=1;
    ld gra1=-(x[i]-x[j])/(y[i]-y[j]);
    ld gra2=-(x[k]-x[j])/(y[k]-y[j]);
    ld cx,cy,dist;
    if(f||abs(gra1-gra2)<(ld)0.0001){
      vector<pll> v(0);
      v.push_back(pll(roundl(x[i]),roundl(y[i])));
      v.push_back(pll(roundl(x[j]),roundl(y[j])));
      v.push_back(pll(roundl(x[k]),roundl(y[k])));
      sortt(v);
      cx=((ld)v[0].fi+v[2].fi)/2;
      cy=((ld)v[0].se+v[2].se)/2;
    }
    else{
      ld a1=(x[i]+x[j])/2;
      ld b1=(y[i]+y[j])/2;
      ld a2=(x[j]+x[k])/2;
      ld b2=(y[j]+y[k])/2;
      ld s=(b2-b1+(a1-a2)*gra2)/(gra1-gra2);
      cx=a1+s;
      cy=b1+s*gra1;
    }
    ld mxdist=0;
    rep(l,n){
      dist=sqrt((cx-x[l])*(cx-x[l])+(cy-y[l])*(cy-y[l]));
      chmax(mxdist,dist);
    }
    chmin(ans,mxdist);
    cx=(x[i]+x[j])/2;
    cy=(y[i]+y[j])/2;
    dist=sqrt((cx-x[1])*(cx-x[1])+(cy-y[1])*(cy-y[1]));
    mxdist=0;
    rep(l,n){
      dist=sqrt((cx-x[l])*(cx-x[l])+(cy-y[l])*(cy-y[l]));
      chmax(mxdist,dist);
    }
    chmin(ans,mxdist);
  }
  cout << ans << endl;
}

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

int main(){
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		int Y, M, D;
		cin >> Y >> M >> D;

		int offset = (10 - M + 1) * 20 - (D - 1);
		if (Y % 3 != 0){
			offset -= (12 - M) / 2; //小の月の分を引く。 int/intだが問題ない
		}

		Y++;
		int uruutime = (1002 - Y) / 3;
		cout << offset + 195 * (1000 - Y) + uruutime * 5 << endl;
	}
	return 0;
}

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

int main(){
	
	int no;

	stack<int> st;
	
	while(cin >> no){
		
		if(no == 0){
			cout << st.top() << endl;
		    st.pop();
		}else{
			st.push(no);
		}
		
	}

	return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
	vector<int> d(4, 0);

	for (int i = 0; i < 3; ++i) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		++d[a];
		++d[b];
	}

	string ans = "YES";
	for (auto &x : d) {
		if (x >= 3) {
			ans = "NO";
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
a=int(input())
li = list(map(int,input().split()))
ans=sum(list(map(int,input().split())))
li3 = list(map(int,input().split()))
for i in range(a-1):
  if li[i]+1==li[i+1]:
    ans+=li3[li[i]-1]
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
#define ENDL cout<<endl
#define MAXE(a,b) a=max(a,b)
#define MINE(a,b) a=min(a,b)

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    
    CIN(A);CIN(B);CIN(C);
    LL ans = 0;
    if(B > C){
        ans += B+C;
        B = 0;
        C = 0;
    }else{
        ans += B*2;
        C -= B;
        B = 0;
    }
   // cout<<C<<" "<<A<<endl;
    ans += min(C,A);
    LL ins = min(C,A);
    C -= ins;
    A -= ins;

    if(C != 0){
        ans += 1;
    }

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<map>
using namespace std;

const int CN = 2e5+5;

double a[CN],pre[CN]; int n,k;

int main()
{
    cin>>n>>k; for(int i=1;i<=n;i++) cin>>a[i];

    pre[1] = 1;
    for(int i=1;i<=n;i++) pre[i] = (a[i] + 1.0) / 2.0;
    
    double ans = 0,cs = 0;
    for(int i=1;i<k;i++) cs += pre[i];
    for(int i=k;i<=n;i++){
        cs += pre[i];
        ans = max(ans, cs);
        cs -= pre[i - k + 1];
    }

    printf("%.12lf",ans);
}

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

using ll = long long;
using pii = pair<int, int>;

#define     endl               "\n"
#define     fast_io            ios::sync_with_stdio(false); cin.tie(0);
#define     file_io            freopen("input.txt", "r", stdin);   \
                               freopen("output.txt", "w", stdout);
#define     all(x)             begin(x), end(x)
#define     debug(x)           cerr <<"Line "<< __LINE__ <<" : "<< #x " = "<< x <<endl;
 
template<typename T, typename TT>
ostream& operator<<(ostream &os, const pair<T, TT> &t) { return os<<"("<<t.first<<", "<<t.second<<")"; }
template<typename T>
ostream& operator<<(ostream& os, const vector<T> &t) { for(auto& i: t) os<<i<<" "; return os; }
 




int main(int argc, char** argv) {
    fast_io
   
	
	int a, b, c;
	cin >> a >> b >> c;
	
	cout << min({a, b, c}) << " " << a + b + c - min({a, b, c}) - max({a, b, c}) << " " << max({a, b, c}) << endl;
	
	

    return 0;
}























Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  vector<int>v;
  for(int i=0;i<c;i++){
   if(a+i>b)break;
    v.push_back(a+i);
  }
  for(int i=0;i<c;i++){
   if(a>b-i)break;
    v.push_back(b-i);
  }
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  for(int i=0;i<v.size();i++){
    cout<<v[i]<<endl;
  }
}

Measured memory_bytes: 256