akhauriyash/Code-Regression huggingface dataset:
import itertools
import numpy as np

N, M = map(int, input().split())
switch = dict()
for i in range(1, M+1):
    in_put = list(map(int, input().split()))
    s = in_put[1:]
    switch[i] = s

mod = list(map(int, input().split()))
A = [0, 1]
comb = itertools.product(A, repeat=N)

switch_list = list()
for i, v in switch.items():
    kari = list()
    for k in range(1, N+1):
        if k in v:
            kari.append(1)
        else:
            kari.append(0)
    switch_list.append(kari)
switch_array = np.array(switch_list)

count = 0
for i in comb:
    check_count = 0
    comb_array = np.array(i)
    for k in range(M):
        check = switch_array[k, :] * comb_array
        check_sum = check.sum()
        #print(i)
        #print(switch_array[k, i])
        #print(check, check_sum)
        if check_sum % 2 != mod[k]:
            check_count = 1
    if check_count == 0:
        count += 1

print(count)


Measured memory_bytes: 12664
#include <stdio.h>
#include <string.h>
int main()
{
    int n,k,q;
    scanf("%d%d%d",&n,&k,&q);
    int point[n];
    for(int i=0;i<n;i++){
        point[i]=k-q;
    }
    for(int i=0;i<q;i++){
        int tmp;
        scanf("%d",&tmp);
        point[tmp-1]++;
    }
    for(int i=0;i<n;i++){
        if(point[i]>0){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }
    
    return 0;
}


Measured memory_bytes: 896
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
const int N = 200005, P = 1000000007;
int n;
std::vector<int> E[N];
int fac[N], inv[N];
int sz[N], f[N], g[N], ans[N];
int qpow(int a, int b = P - 2){
	int s = 1;
	for (; b; b >>= 1, a = 1ll * a * a % P) if (b & 1) s = 1ll * s * a % P;
	return s;
}
void init(int n){
	fac[0] = 1;
	for (register int i = 1; i <= n; ++i) fac[i] = 1ll * fac[i - 1] * i % P;
	inv[n] = qpow(fac[n], P - 2);
	for (register int i = n; i; --i) inv[i - 1] = 1ll * inv[i] * i % P;
}
int C(int n, int m){
	if (m < 0 || m > n) return 0;
	return 1ll * fac[n] * inv[m] % P * inv[n - m] % P; 
}
void dfs_f(int u, int fa = 0){
	f[u] = 1, sz[u] = 1;
	for (int v : E[u])
		if (v != fa){
			dfs_f(v, u), sz[u] += sz[v];
			f[u] = 1ll * f[u] * f[v] % P * C(sz[u] - 1, sz[v]) % P;
		}
}
void dfs_g(int u, int fa = 0){
	ans[u] = 1ll * f[u] * g[u] % P * C(n - 1, n - sz[u]) % P;
	for (int v : E[u])
		if (v != fa){
			g[v] = 1ll * ans[u] * qpow(1ll * f[v] * C(n - 1, sz[v]) % P, P - 2) % P;
			dfs_g(v, u);
		}
}
int main(){
	scanf("%d", &n);
	for (register int i = 1, u, v; i < n; ++i)
		scanf("%d%d", &u, &v), E[u].push_back(v), E[v].push_back(u);
	init(n);
	dfs_f(1), g[1] = 1, dfs_g(1);
	for (register int i = 1; i <= n; ++i) printf("%d\n", ans[i]);
}

Measured memory_bytes: 18676
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?-1:*p1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*p1=buf,*p2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
int n,a[3],b[3],ans,dp[3450502];
ll ndp[25079968];
int main() {
  int i,j;
  scanf("%d",&n);
  for (i=0;i<3;++i) scanf("%d",a+i);
  for (i=0;i<3;++i) scanf("%d",b+i);
  for (i=0;i<=n;++i) {
    dp[i]=max(dp[i],i);
    for (j=0;j<3;++j)
      if (i-a[j]>=0) dp[i]=max(dp[i],dp[i-a[j]]+b[j]);
  }
  for (i=0;i<=dp[n];++i) {
    ndp[i]=max(ndp[i],(ll)i);
    for (j=0;j<3;++j)
      if (i-b[j]>=0) ndp[i]=max(ndp[i],ndp[i-b[j]]+a[j]);
  }
  printf("%lld\n",ndp[dp[n]]);
}

Measured memory_bytes: 198940
#include <stdio.h>

int main(void)
{
    int H, W;
    
    while (1) {
        scanf("%d %d", &H, &W);
        
        if (H == 0 && W == 0) {
            break;
        } else {
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    if ((i % 2 == 0 && j % 2 != 0) || (i % 2 != 0 && j % 2 == 0)) printf(".");
                    else printf("#");
                }
                printf("\n");
            }
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1000
#include <algorithm>
#include <iostream>
#include <unordered_set>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

struct SieveOfEratosthenes {
    vector<bool> is_prime;
    vector<ll> primes;

    SieveOfEratosthenes(ll V) {
        is_prime = vector<bool>(V + 1, true);
        primes = vector<ll>({2, 3, 5});
        for (ll i = 4; i <= V; i += 2) {
            is_prime[i] = false;
        }
        for (ll i = 9; i <= V; i += 3) {
            is_prime[i] = false;
        }
        for (ll i = 25; i <= V; i += 5) {
            is_prime[i] = false;
        }
        for (ll i = 7; i <= V; i += 2) {
            if (is_prime[i]) {
                primes.push_back(i);
                for (ll j = i * i; j <= V; j += i) {
                    is_prime[j] = false;
                }
            }
        }
    }

    vector<pll> factorize(ll x) {
        if (x == 1) {
            return {pll(1, 1)};
        }
        auto result = vector<pll>();
        for (auto p : primes) {
            ll exp = 0;
            while (x % p == 0) {
                exp++;
                x = x / p;
            }
            if (exp > 0) {
                result.push_back(pll(p, exp));
            }
            if (p * p > x) {
                break;
            }
        }
        if (x > 1) {
            result.push_back(pll(x, 1));
        }
        return result;
    }
};

ll gcd(ll a, ll b) {
    // gcd(x, 0) = x
    // gcd(a, b) = gcd(b, r)
    while (b != 0) {
        ll r = a % b;
        a = b;
        b = r;
    }
    return a;
}

string solve() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    if (all_of(A.begin(), A.end(), [&](const ll x) { return x == 1; })) {
        return "pairwise coprime";
    }

    auto sieve = SieveOfEratosthenes(*max_element(A.begin(), A.end()));
    auto used_primes = unordered_set<ll>();

    ll gcd_all = A[0];
    for (int i = 1; i < N; i++) {
        gcd_all = gcd(gcd_all, A[i]);
    }

    if (gcd_all != 1) {
        return "not coprime";
    }

    for (auto x : A) {
        if (x == 1) {
            continue;
        }
        auto factors = sieve.factorize(x);
        for (auto [p, e] : factors) {
            if (used_primes.find(p) != used_primes.end()) {
                return "setwise coprime";
            }
            used_primes.insert(p);
        }
    }

    return "pairwise coprime";
}

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

    cout << solve() << endl;

    return 0;
}

Measured memory_bytes: 12100
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();
		if(a > b) {
			System.out.println("safe");
		}else {
			System.out.println("unsafe");
		}
	}
}


Measured memory_bytes: 35792
n = gets.to_i
station = []
(n-1).times do
  station << gets.split.map(&:to_i)
end
(n-1).times do |i|
  ans = 0
  (n-i-1).times do |j|
    start = ans < station[i+j][1] ? station[i+j][1] : ans
    k = start % station[i+j][2] == 0 ? 0 : 1
    ans = ((start / station[i+j][2]).to_i + k) * station[i+j][2] + station[i+j][0]
  end
  puts ans
end
puts 0


Measured memory_bytes: 1788
#![allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

trait Monoid {
   fn unit() -> Self;
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
enum MinInt {
   Val(i64),
   Maximal,
}
impl MinInt {
   fn unwrap(self) -> i64 {
      if let Self::Val(x) = self {
         x
      } else {
         panic!();
      }
   }
}
impl std::ops::MulAssign for MinInt {
   fn mul_assign(&mut self, other: Self) {
      if other < *self {
         *self = other
      };
   }
}
impl std::ops::Mul for MinInt {
   type Output = Self;
   fn mul(self, other: Self) -> Self {
      if self < other {
         self
      } else {
         other
      }
   }
}
impl Monoid for MinInt {
   fn unit() -> Self { MinInt::Maximal }
}
use MinInt::*;

#[fastout]
fn main() {
   input! {
      n: usize,
      m: usize,
   }
   let mut a = vec![];
   let mut c = vec![0usize; m];
   for i in 0..m {
      input! {
         _a: i64,
         _b: usize,
         _c: [Usize1; _b]
      }
      a.push(_a);
      for k in _c {
         c[i] += 1 << k;
      }
   }

   let num = 1 << n;
   let mut dp = vec![Maximal; num];
   dp[0] = Val(0);
   for i in 0..m {
      let mut next = dp.clone();
      for j in 0..num {
         if let Val(x) = dp[j] {
            next[j | c[i]] *= Val(x + a[i]);
         }
      }
      dp = next;
   }

   if let Val(a) = dp[num - 1] {
      println!("{}", a);
   } else {
      println!("-1");
   }
}


Measured memory_bytes: 2348
def main():
    S = input()
    n = len(S)
    dp = [0 for _ in range(n+1)]
    dp[0] = 0
    dp[1] = 1
    for i in range(1, n):
        if i == 1:
            if S[i-1] == S[i]: dp[i+1] = 1
            else: dp[i+1] = 2
        else:
            if S[i] != S[i-1]:
                dp[i+1] = dp[i] + 1
            else:
                dp[i+1] = dp[i-2] + 2
    return dp[n]

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 11400
#include<iostream>
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int main()
{
	string a;
	int i,flag,cnt;
	while(cin>>a)
	{
		flag=1;
		cnt=1;
		for(i=0;i<a.length();i++)
		{
			if((i+1)%2==1&&flag==1&&(a[i]=='R'||a[i]=='U'||a[i]=='D'))
				flag=1;
			else if((i+1)%2==1)
				flag=0;
			if((i+1)%2==0&&cnt==1&&(a[i]=='L'||a[i]=='U'||a[i]=='D'))
				cnt=1;
			else if((i+1)%2==0)
				cnt=0;
		}
		if(flag==1&&cnt==1)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
p = gets.split.map(&:to_i)
a = Array.new(n){|i|i*20000}
b = Array.new(n){|i|(n-i-1)*20000+1}
for i in 0..n-1
    a[p[i]-1] += i+1
end
puts a.join(" "),b.join(" ")

Measured memory_bytes: 4988
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};

fn main() {
    let n: usize = read();
    let k: usize = read();
    let mut a: Vec<i64> = read_n(n);
    a.sort();

    if k >= n {
        println!("{}", 0);
        return;
    }

    a.split_off(max(n - k, 0));
    println!("{}", a.iter().sum::<i64>());
}


Measured memory_bytes: 61564
// AOJ 2877 Aquarium
// 2018.4.15 bal4u
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define INF 0x33
long long s[502];
double dp[502][502];

// バッファを経ずstdinから数値を得る
//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

int main()
{
	int N, M, i, j, k;

	N = in(), M = in();
	for (i = 1; i <= N; i++) s[i] = s[i-1] + in();
	memset(dp, -INF, sizeof(dp));
	for (i = 1; i <= N; i++) dp[i][1] = (double)s[i]/i;

	for (i = 1; i <= N; i++) for (j = 1; j < M; j++) if (dp[i][j] >= 0) {
		for (k = i+1; k <= N; k++) {
			double x = dp[i][j] + (double)(s[k]-s[i])/(k-i);
			if (dp[k][j+1] < x) dp[k][j+1] = x;
		}
	}
	printf("%.8lf\n", dp[N][M]);
	return 0;
}


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

int main(int argc, char const *argv[])
{
	int n,a,b;
	cin>>n>>a>>b;
	if ((b-a)%2==0)
	{
		cout<<"Alice\n";
	}
	else
	{
		cout<<"Borys\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int N,i,j,k,v;
  int a[100];
  scanf("%d",&N);
  for(i = 0;i < N; i++){
    scanf("%d",&a[i]);
  }
  for(i = 1;i <= N-1; i++){
    for(k = 0;k < N; k++){
      printf("%d",a[k]);
      if(k != N-1)
	printf(" ");
    }
    printf("\n");
    v = a[i];
    j = i-1;
    while(j >= 0&&a[j]>v){
      a[j+1] = a[j];
      j--;
      a[j+1] = v;
    }
    
  }
  
  for(k = 0;k < N; k++){
    printf("%d",a[k]);
    if(k != N-1)
	printf(" ");
  }
  printf("\n");
}



Measured memory_bytes: 2140
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

A, B, K = map(int, input().split())

if K<=A:
    print(A-K, B)
elif B-(K-A) >= 0:
    print(0, B-(K-A))
else:
    print(0,0)

Measured memory_bytes: 77552
#include <bits/stdc++.h>
#define INF 1000000000000000LL

using namespace std;

typedef long long ll;

ll ab(ll x) { return (x < 0) ? -x : x; }

int main() {
  int n;
  ll arr[200200];

  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
    if (i > 0) arr[i] += arr[i - 1];
  }

  ll ans = INF;

  for (int i = 0; i < n; i++) {
    int j = lower_bound(arr, arr + i + 1, arr[i] / 2) - arr;
    int k = lower_bound(arr + i + 1, arr + n, (arr[n - 1] - arr[i]) / 2 + arr[i]) - arr;

    if (j != 0) j--;
    if (k != 0) k --;
    // printf("%d %d %d\n", j, i, k);

    int x = j, y = k;

    ll p = arr[x];
    ll q = arr[i] - arr[x];
    ll r = arr[y] - arr[i];
    ll s = arr[n - 1] - arr[y];
    ans = min(ans, max(max(p, q), max(r, s)) - min(min(p, q), min(r, s)));

    x = j + 1, y = k;

    p = arr[x];
    q = arr[i] - arr[x];
    r = arr[y] - arr[i];
    s = arr[n - 1] - arr[y];
    ans = min(ans, max(max(p, q), max(r, s)) - min(min(p, q), min(r, s)));

    x = j, y = k + 1;

    p = arr[x];
    q = arr[i] - arr[x];
    r = arr[y] - arr[i];
    s = arr[n - 1] - arr[y];
    ans = min(ans, max(max(p, q), max(r, s)) - min(min(p, q), min(r, s)));

    x = j + 1, y = k + 1;

    p = arr[x];
    q = arr[i] - arr[x];
    r = arr[y] - arr[i];
    s = arr[n - 1] - arr[y];
    ans = min(ans, max(max(p, q), max(r, s)) - min(min(p, q), min(r, s)));
  }

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

Measured memory_bytes: 1792
//file_name:ABC57_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    int a[n];
    int b[n];
    int c[m];
    int d[m];
    rep(i,n){
        cin >> a[i] >> b[i];
    }
    rep(i,m){
        cin >> c[i] >> d[i];
    }

    rep(i,n){
        int che = 1;
        int kyo = 888888888;
        rep(j,m){
            if(kyo>abs(a[i]-c[j])+abs(b[i]-d[j])){
                che = j+1;
                kyo = abs(a[i]-c[j])+abs(b[i]-d[j]);
            }
        }
        cout << che << endl;
    }

    return 0;
}



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

using namespace std;

using ll = long long;


constexpr ll f(const ll l, const ll r, const ll x) {
    return r / x - (l - 1) / x;
}

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

    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    const ll g = __gcd(c, d);
    ll res = b - a + 1;
    res -= f(a, b, c) + f(a, b, d);
    res += f(a, b, c * d / g);
    cout << res << '\n';
}

Measured memory_bytes: 256
/**
 * ?§???????????????°???????????°

goto ?????????C/C++?¨????????????§???????????¨?????§???????????§????????????????????¨????????¶????????????????????????????????????????£?????????????????????° goto CHECK_NUM; ??¨?????????????????????????????¨???????????°??????????????§ CHECK_NUM: ??¨????????????????????????????§?????????????????????????????????£????????°?????????????????????????????????????????¨?????§????????????

?????????goto ???????????±??????????????????????????°?????????????????§?????±??????????????????????????????????????????????????¨?????¨?\¨?????????????????????

?¬????C++?¨???????????????°????????¨?????????????????????????????°????????????????????????????????????????????????goto ????????????????????§????£?????????????????????????

void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;

  cout << endl;
}
????????°???????????¬???

Input
???????????´??° n ?????????????????????????????????

Output
????¨?????????°???????????\????????´??° n ????????????????????????????????????????????????

Constraints
3???n???10000

Sample Input
30

Sample Output
 3 6 9 12 13 15 18 21 23 24 27 30
??????????????????????????????????????¨?????¨????????????????????????


 */

#include <iostream>
#include <sstream>

void call(int n) {
  int i = 1;
  do {
    int x = i;
    if (x % 3 == 0) {
      std::cout << " " << i;
    } else {
      do {
        if (x % 10 == 3) {
          std::cout << " " << i;
          break;
        }
        x /= 10;
      } while (x);
    }
  } while (++i <= n);

  std::cout << std::endl;
}

int main(int argc, char const *argv[]) {
  unsigned int n;

  while (true) {
  std::string Param;

  getline(std::cin, Param);
  std::istringstream iss(Param);
  iss >> n;

  if (n < 3 || n > 10000) {
    std::cout << "Error: 1 <= x <= 10000" << std::endl;
  } else {
    break;
  }
}
  call(n);

  return 0;
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    ll s;
    cin>>s;
    ll x=(s+INF-1)/INF;
    ll y=x*INF-s;
    cout<<"0 0 "<<1<<" "<<1000000000<<" "<<x<<" "<<y<<endl;
}

Measured memory_bytes: 256
#define ll long long
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
//#include<bits/stdc++.h>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>
ll pi = acos(-1) ;
ll z =  1000000007 ;
ll inf = 100000000000000000 ;
ll p1 = 37 ;
ll p2 = 53 ;
ll mod1 =  202976689 ;
ll mod2 =  203034253 ;
ll fact[100] ;
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll power(ll a ,ll b , ll p){if(b == 0) return 1 ; ll c = power(a , b/2 , p) ; if(b%2 == 0) return ((c*c)%p) ; else return ((((c*c)%p)*a)%p) ;}
ll inverse(ll a ,ll n){return power(a , n-2 , n) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
ll min(ll a , ll b){if(a < b) return a ; return b ;}
ll left(ll i){return ((2*i)+1) ;}
ll right(ll i){return ((2*i) + 2) ;}
ll ncr(ll n , ll r){if(n < r) return 0 ; return ((((fact[n] * inverse(fact[r] , z)) % z) * inverse(fact[n-r] , z)) % z);}
void swap(ll&a , ll&b){ll c = a ; a = b ; b = c ; return ;}
//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
using namespace std ;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
//__builtin_popcount(n) -> returns number of set bits in n
const ll N = 3600000 ;
ll test_case = 1 ;  


void solve()
{
    
    ll n ;
    cin >> n ;
    ll sum = 0 ;
    for(ll i = 1 ; i <= n ; i++)
    {
        if((i%3 == 0) || (i%5 == 0))
            continue ;
        sum += i ;
    }
    cout << sum << endl ;
}
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif*/
    fact[0] = 1 ;
    for(ll i = 1 ; i < 100 ; i++)
    {
        fact[i] = (fact[i-1] * i) ;
        fact[i] %= z ;
    }
    ll t ;
    //cin >> t ;
    t = 1 ;
    while(t--)
    {
        solve() ;
    }
    //cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  int n;
  cin >> n;
  map<int,int> mp;
  rep(i,n){
    int x;
    cin >> x;
    mp[x] ++;
  }
  int ans = 0;
  for(auto  p : mp){
    ans += p.second&1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include<string>
using namespace std;
int main()
{
    string a,b; cin>>a>>b;
    for(int i=0;i<max(a.size(),b.size());i++)
    {
        if(i<a.size())cout<<a[i];
        if(i<b.size())cout<<b[i];
    }
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	ll n;cin >> n;
	ll ans = 0;
	vector<pair<string, ll>> v(n);
	REP(i, n){
		cin >> v[i].FI >> v[i].SE;
		ans += v[i].SE;
	}

	string seica;cin >> seica;
	REP(i, n){
		ans -= v[i].SE;
		if(seica == v[i].FI)break;
	}
	cout << ans << endl;

	return 0;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int k,s; cin >> k >> s;
  int sum = 0;
  for(int i = 0; i < k+1; ++i){
    for(int j = 0; j < k+1; ++j){
      if(j + i > s)break;
      int x = s - i - j;
      if(x > k)continue;
      sum++;
    }
  }
  cout << sum << endl;
  return 0;
}


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

typedef vector<int> vec;
typedef vector<vec> mat;

int main() {
    int M, N, K;
    cin >> N >> M >> K;
    mat J(N+2, vec(M+2)), O(N+2, vec(M+2)), I(N+2, vec(M+2));
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            char c; cin >> c;
            if (c == 'J') J[i][j]++;
            else if (c == 'O') O[i][j]++;
            else if (c == 'I') I[i][j]++;
        }
    }

    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            J[i][j] += J[i-1][j] + J[i][j-1] - J[i-1][j-1];
            O[i][j] += O[i-1][j] + O[i][j-1] - O[i-1][j-1];
            I[i][j] += I[i-1][j] + I[i][j-1] - I[i-1][j-1];
        }
    }

    for (int k = 0; k < K; k++) {
        int sx, sy, gx, gy;
        cin >> sx >> sy >> gx >> gy;
        cout << J[gx][gy] - J[gx][sy-1] - J[sx-1][gy] + J[sx-1][sy-1] << " ";
        cout << O[gx][gy] - O[gx][sy-1] - O[sx-1][gy] + O[sx-1][sy-1] << " ";
        cout << I[gx][gy] - I[gx][sy-1] - I[sx-1][gy] + I[sx-1][sy-1] << endl;
    }

    return 0;
}

Measured memory_bytes: 14660
#include<stdio.h>
#define min(a,b) a<b?a:b

void r(int *p){
    int tmp;
    if(p[0]>p[1]){
        tmp=p[0];
        p[0]=p[1];
        p[1]=tmp;
    }
    if(p[1]>p[2]){
        tmp=p[1];
        p[1]=p[2];
        p[2]=tmp;
    }
    if(p[0]>p[1]){
        tmp=p[0];
        p[0]=p[1];
        p[1]=tmp;
    }
}

int main(){
    int i,a[3],ans[3]={0};

    while(scanf("%d%d%d",&a[0],&a[1],&a[2])){
        r(a);
        if(a[0]+a[1]<=a[2])break;
        if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])ans[0]++;
        if(a[0]*a[0]+a[1]*a[1]>a[2]*a[2])ans[1]++;
        if(a[0]*a[0]+a[1]*a[1]<a[2]*a[2])ans[2]++;
    }
    printf("%d",ans[0]+ans[1]+ans[2]);
    for(i=0;i<3;i++)printf(" %d",ans[i]);
    puts("");
    return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
#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 rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = LLONG_MAX;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
int main() {
    int a,b;cin >> a>> b;
    if(a>=10||b>=10)cout << -1 << endl;
    else cout << a*b << endl;
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int m=0,i,b;
	char s,a[6];
	for(i=0;i<4;i++)
	{
		scanf("%c",&a[i]);
	}
	for(i=0;i<4;i++)
	{
		if(a[i]=='+')
		{
			m+=1;
			
		}
		else
		{
			m-=1;
		}
	}
	printf("%d",m);
	return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pai;
typedef pair<ll, ll> pal;
const int MOD = 1e9+7;
const ll LLINF = 1e18;


int main(){
	int n;
	cin >> n;
	int nowt = 0, nowx = 0, nowy = 0;
	for (int i = 0; i < n; i++){
		int t, x, y;
		cin >> t >> x >> y;
		int dist = abs(nowx - x) + abs(nowy - y);
		if (dist > t - nowt || dist%2 != (t-nowt)%2){
			cout << "No" << endl;
			return 0;
		}
		nowt = t, nowx = x, nowy = y;
	}
	cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();

        // ビジネスロジックここから
        String n = scanner.next();
        char[] value = n.toCharArray();
        int sum = 0;
        
        for (int i = 0; i < value.length; i++) {
        	sum += value[i] - '0';
        }
        
        
        System.out.println(sum % 9 == 0 ? "Yes" : "No");
        // ビジネスロジックここまで

    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


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


int main() {


  int n;
  cin>>n;

  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
  }

  int64_t cost_min=100000000000000000;
  for(int i=-100;i<=100;i++){
    int64_t cost_wk=0;
    for(int j=0;j<n;j++){
      cost_wk+=pow(a.at(j)-i,2);
    }
    cost_min = min(cost_min, cost_wk);
  }

  cout<<cost_min<<endl;

  return 0;
}



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

using namespace std;

int main() {
  long a,b,c,d;
  cin>>a>>b>>c>>d;

  long a1=a*c,a2=a*d,a3=b*c,a4=b*d;
  cout<<max(max(a1,a2),max(a3,a4))<<endl;


}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <fstream>
#include <string>
#include <sstream>
#include <algorithm>
#include <climits>
#include <cmath>
#include <numeric>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for(auto& el: v) cin >> el;
    sort(v.begin(), v.end());
	cout << accumulate(v.begin(), v.begin() + k, 0) << "\n";
	return 0;
}


Measured memory_bytes: 3164
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iostream>

using namespace std;

struct Vec{
	int ind;
	int val;
};

bool valDesc( const Vec& left, const Vec& right ) {
    return left.val == right.val  ? left.val> right.val: left.val > right.val;
}

bool valAsc( const Vec& left, const Vec& right ) {
    return left.val == right.val  ? left.val <  right.val: left.val < right.val;
}
int main(void){
	int N,K,a[100000];
	char ans;
	string s;
	vector<int> stable;
	
	scanf("%d%d",&N,&K);
	if(N+K == 15)ans = '+';
	else if (N*K == 15)ans = '*';
	else ans = 'x';
	printf("%c\n",ans);
	fflush(stdout);

	return 0;
}

Measured memory_bytes: 256
((input: string): void => {
    const [[o, p], [q, r]]: number[][] = input.trim().split(/\n/).map(
        (i: string): number[] => { return i.split(" ").map(Number) }
    );
    console.log((o-q) * (p-r));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;

int main()
{
	int N; cin >> N;
	vector<int> T(N + 1, 0), X(N + 1, 0), Y(N + 1, 0);
	for (int i = 1; i < N + 1; ++i) {
		cin >> T.at(i) >> X.at(i) >> Y.at(i);
	}

	for (int i = N; i >= 1; --i) {
		int distance = abs(X.at(i) - X.at(i - 1)) + abs(Y.at(i) - Y.at(i - 1));
		int dt = T.at(i) - T.at(i - 1);
		if (distance > dt) {
			cout << "No" << endl;
			return 0;
		}
		if (distance % 2 != dt % 2) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3804
s=int(input())

a_list=[s]


a=s
while True:
    
    if a%2==0:
        a=a//2
    else:
        a=3*a+1
    
    if a in a_list:
        break
    else:
        a_list.append(a)

ans=len(a_list)+1

print(ans)

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

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 << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define ff first
#define endl "\n"
#define ss second
#define maxn 2000006
#define pb push_back
#define ll long long
#define lll __int128
#define vll vector<ll>
#define mll map<ll,ll>
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define pll pair<ll,ll>
#define ull unsigned long long
#define f(i,x,n) for(ll i=x;i<=n;i++)
#define fr(i,x,n) for(ll i=x;i>=n;i--)
inline ll min(ll a, ll b, ll c) { return min(min(a, b), c);}
inline ll max(ll a, ll b, ll c) { return max(max(a, b), c);}
inline void fastio() {ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);}

int dx[] = { -1, 0, 1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};



int main() {
	fastio();

	int n, k; cin >> n >> k;
	vector<int> a(n + 1, 0); f(i, 1, n) cin >> a[i];

	vector<vector<int>> dp(101, vector<int>(100001, 0));
	// dp[1][0]=1;
	// f(j,1,k) dp[1][j]=1+dp[1][j-1];
	dp[1][0] = 1;
	f(j, 1, a[1]) dp[1][j] = (1 + dp[1][j - 1] % MOD) % MOD;
	f(j, a[1] + 1, k) dp[1][j] = (dp[1][j] % MOD + dp[1][j - 1] % MOD) % MOD;

	f(i, 2, n) {
		f(j, 0, k) {
			// dp[i][j]+=dp[i][j-1];
			// dp[i][j]+=(dp[i-1][j]-dp[i-1][max(0ll,j-a[i]-1)]);
			// f(z,max(0ll,j-a[i]),j) dp[i][j]+=dp[i-1][z];
			if (j == 0) dp[i][j] += 1;
			else {
				dp[i][j] = (dp[i][j] % MOD + (dp[i - 1][j] % MOD - ((j - a[i] >= 1) ? dp[i - 1][max(0ll, j - a[i] - 1)] : 0) % MOD + MOD) % MOD) % MOD;

				dp[i][j] = (dp[i][j] % MOD + dp[i][j - 1] % MOD) % MOD;
			}
		}
	}

	// debug(dp);

	cout << (dp[n][k] % MOD - dp[n][k - 1] % MOD + MOD) % MOD;
	// cout<<dp[n][k];

	return 0;
}

Measured memory_bytes: 40192
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long H,W;
    cin >> H >> W;
    long long res;

    if(H==1||W==1){
        res = 1;
    }else if(H%2==0||W%2==0){
        res = H*W/2;
    }else{
        res = H*W/2+1;
    }

    cout << res << endl;
}

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

int main() {
  int a; int b; int c; int i;
  cin >> a >> b;
  if (b==100){
    c = 1000*a + b;
  }
  else if (b>=10){
    c = 100*a + b;
  }
  else{
    c = 10*a + b;
  }
  while(c >= i*i){
    if (c == i*i){
      cout << "Yes" << endl;
      break;
    }
    else{
      i++;
    }
  }
  if (c < i*i){
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
(let ((n (read))
      (x (read))
      (ans 1)
      (d 0))
  (loop :for i :from 1 :to n
        :for l := (read)
        :do (setf d (+ d l))
        :if (<= d x)
        :do (incf ans))
  (format t "~A~%" ans))


Measured memory_bytes: 24464
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define in insert
#define rep(i,a,b) for(int i = a ; i < b ; i++)
#define repr(i,a,b) for(int i = b ; i > a ; i--) 
 
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
}   
 
signed main(){
    fast;
    int flag=0;
    string s, t;
    cin >> s >>t;
    rep(i,0,s.length()){
        if(s[i]!=t[i]){
            flag=1;
        }
    }

    if(flag==1 || s.length()+1!=t.length()){
        cout << "No";
    }
    else{
        cout << "Yes";
    }
}

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

int main(){
    int n;
    cin>>n;
    int a[105];
    for(int i=1;i<=n;i++){
        scanf("%d",a+i);
    }
    int ans=0;
    for(int i=2;i<=n;i++){
        if(a[i]==a[i-1]){
            if(a[i+1]==(a[i-1]+n)%n){
                a[i]=a[i-1]+n+1;
                a[i]%=n;
            }
            else{
                a[i]=a[i-1]+n;
                a[i]%=n;
            }
            ans++;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		 Scanner sc = new Scanner(System.in);
	        int x = sc.nextInt();
	        int y = sc.nextInt();
	        int a = 0;
	        int b = 0;
	        
	        a = y/2;
	        
	        b = x + a;
	        
	        System.out.println(b);
	        
	        
	        
	
	}

}


Measured memory_bytes: 23764
def examA():
    N = I()
    ans = 0
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    N = I()
    node = N*(N-1)//2
    V = [[]for _ in range(node)]
    D = [[0]*N for _ in range(N)]
    cur = 0
    for i in range(N):
        for j in range(i+1,N):
            D[i][j] = cur
            D[j][i] = cur
            cur += 1
    #A = [LI() for _ in range(N)]
    for i in range(N):
        a = LI()
        for j in range(N-2):
            fr = D[i][a[j]-1]
            to = D[i][a[j+1]-1]
            #print(fr,to)
            V[fr].append(to)

    visited = [False] * node
    calculated = [False] * node
    dp = [1] * node
    # https://mhiro216.hatenablog.com/entry/2019/09/08/142414
    def dfs(v):
        if visited[v]:
            if not calculated[v]:
                return -1  # 計算が終わっていない頂点を2度訪れるのはループがあるということ
            return dp[v]
        visited[v] = True
        for u in V[v]:  # 全ての辺をなめる
            res = dfs(u)
            if res == -1: return -1  # ループがあれば-1を返す
            elif res+1>dp[v]:
                dp[v] = res + 1
        calculated[v] = True
        return dp[v]

    ans = 0
    for i in range(node):
        res = dfs(i)
        ans = max(ans,res)
        if res == -1:
            print('-1')  # ループがあれば-1を返す（問題文の指示）
            return
    print(ans)
    return

def examF():
    def calc_L(a,b):
        return (a**2 + b**2)**(1/2)
    N = I()
    X = [[]for _ in range(N)]
    for i in range(N):
        x,y = LI()
        d = math.degrees(math.atan2(y,x))
        if d<0:
            d += 360
        X[i] = [d,x,y]
    X.sort()
    #print(X)
    ans = 0
    for i in range(N):
        cur_X = 0; cur_Y = 0
        for d2,x2,y2 in (X[i:] + X[:i]):
            if calc_L(cur_X+x2,cur_Y+y2)<calc_L(cur_X,cur_Y):
                continue
            cur_X += x2
            cur_Y += y2

        now = calc_L(cur_X,cur_Y)
        if now>ans:
            ans = now

    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examF()

"""

"""

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

using namespace std;

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

const int inf = 1e9;
const ll inf64 = 1e18;

int slow(vector<string> a) {
    int n = (int)a.size();
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        p[i] = i;
    }
    int res = 0;
    do {
        int tmp = 0;
        string s = "";
        for (int i = 0; i < n; i++) {
            s += a[p[i]];
        }
        for (int i = 0; i + 1 < (int)s.size(); i++) {
            tmp += (s[i] == 'A' && s[i + 1] == 'B');
        }
        res = max(res, tmp);
    } while (next_permutation(p.begin(), p.end()));
    return res;
}

int fast(vector<string> a) {
    int res = 0;
    int n = (int)a.size();
    int cnt[3][3] = {0};

    for (int i = 0; i < 3; i++) {
        for (int j = 0;j < 3; j++) {
            cnt[i][j] = 0;
        }
    }

    for (int i = 0; i < n; i++) {
        string s = a[i];
        for (int j = 0; j + 1 < (int)s.size(); j++) {
            if (s[j] == 'A' && s[j + 1] == 'B') {
                res++;
            }
        }
        int head = (s.front() > 'B' ? 'C' : s.front()) - 'A';
        int tail = (s.back()  > 'B' ? 'C' : s.back())  - 'A';
        cnt[head][tail]++;
    }

    int t1 = cnt[0][0] + cnt[2][0];
    int t2 = cnt[1][1] + cnt[1][2];

    if (t1 == t2) {
        if (t1 == 0) return res + max(0, cnt[1][0] - 1);
        return res + cnt[1][0] + t1;
    } else if (t1 > t2) {
        return res + t2 + cnt[1][0];
    } else {
        return res + t1 + cnt[1][0];
    }
}

void test() {
    int n;

//    cin >> n;
    n = 6;

    vector<string> a(n);

    mt19937 rnd(time(NULL));

    while (1) {

        for (int i = 0; i < n; i++) {
            //        cin >> a[i];
            a[i] = "";
            a[i].push_back((rnd() % 3) + 'A');
            a[i].push_back((rnd() % 3) + 'A');
        }

        int fs = fast(a);
        int sl = slow(a);

        if (fs == sl) {
            cout << "OK\n";
        } else {
            cout << "WA\n";
            cout << "exp = " << sl << "\n";
            cout << "fnd = " << fs << "\n";
            cout << n << "\n";
            for (int i = 0; i < n; i++) {
                cout << a[i] << "\n";
            }
            break;
        }
    }
}

void work() {
    int n;
    cin >> n;
    vector<string> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    cout << fast(a) << "\n";
}

int main() {

#ifdef debug
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

//    test();
    work();

    return 0;
}

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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  int ans_l = 1, ans_r = N;
  for (int i = 0; i < M; i++) {
    int l, r;
    cin >> l >> r;
    ans_l = max(ans_l, l);
    ans_r = min(ans_r, r);
  }
  cout << max(ans_r - ans_l + 1, 0) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	
	int n,i;
	char s[102];
	
	scanf("%d", &n);
	scanf("%s", &s);
	
	if(n%2 != 0){
		printf("No");
		return 0;
	}
	
	for(i = 0; i < n/2; i++){
		if(s[i] != s[n/2 + i]){
			printf("No");
			return 0;
		}
	}
	
	printf("Yes");
	return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int a, b, k;
    cin >> a >> b >> k;

    vector<int> ans;
    for (int i = 1; i <= min(a, b); i++)
    {

        if (a % i == 0 && b % i == 0)
        {
            ans.push_back(i);
        }
    }
    cout << ans[ans.size() - k] << endl;
}


Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let s: String = input();
    let s: Vec<char> = s.chars().collect();
    let mut count = 0;
    for i in 0..n-2 {
        if s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C' {
            count += 1;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 4352