akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

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

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

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func maxInt64(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

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

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumInt64(a []int64) int64 {
	var ret int64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

// sort ------------------------------------------------------------

type int64Array []int64

func (s int64Array) Len() int           { return len(s) }
func (s int64Array) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s int64Array) Less(i, j int) bool { return s[i] < s[j] }

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

func main() {
	n := readInt()
	k := readFloat64()

	var p float64
	for i := 1; i < n+1; i++ {
		t := k / float64(i)
		j := 0
		for t > math.Pow(2.0, float64(j)) {
			j++
		}
		p += (1 / float64(n)) * (1 / math.Pow(float64(2), float64(j)))
	}

	fmt.Println(p)
}


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

int main() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    cout << a[0] << " " << a[1] << " " << a[2] << endl;
    return 0;
}

Measured memory_bytes: 3112
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<time.h>
#include<typeinfo>
#include <cstdlib>
#include<stdio.h>

using namespace std;

#define ll long long
#define MOD 1000000007

int main(){
	int n,m;
	vector<pair<int, ll> > es[100001];
	cin >> n >> m;
	ll u,v,w;
	for(int i = 0;i < m;i++){
		cin >> u >> v >> w;
		u--;v--;
		es[u].push_back(make_pair(v,w));
		es[v].push_back(make_pair(u,w));
	}
	ll memo[100001];
	fill_n(memo,100001,-1);
	int ans = 0;
	for(int s = 0;s < n;s++){
		if(memo[s]!=-1)continue;
		ans++;
		queue<pair<int, ll> > que;
		que.push(make_pair(s,0));
		while(que.size()){
			int at = que.front().first;
			ll cost = que.front().second;
			que.pop();
			if(memo[at]!=-1)continue;
			memo[at] = cost;
			for(int i = 0;i < es[at].size();i++){
				que.push(make_pair(es[at][i].first,es[at][i].second+cost));
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 10292
n=input()
if n[0]=="1":
  s="9"
elif n[0]=="9":
  s="1"
else:
  s=n[0]
if n[1]=="1":
  s+="9"
elif n[1]=="9":
  s+="1"
else:
  s+=n[1]
if n[2]=="1":
  s+="9"
elif n[2]=="9":
  s+="1"
else:
  s+=n[2]
print(s)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<LL> vl;
typedef vector<vl> vvl;
 
double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
 
#ifdef TESTING
  #define DEBUG fprintf(stderr,"====TESTING====\n")
  #define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
  #define debug(...) fprintf(stderr, __VA_ARGS__)
#else
  #define DEBUG 
  #define VALUE(x)
  #define debug(...)
#endif
 
#define FOR(a,b,c) for (int (a)=(b);(a)<(c);++(a))
#define FORN(a,b,c) for (int (a)=(b);(a)<=(c);++(a))
#define FORD(a,b,c) for (int (a)=(b);(a)>=(c);--(a))
#define FORSQ(a,b,c) for (int (a)=(b);(a)*(a)<=(c);++(a))
#define FORC(a,b,c) for (char (a)=(b);(a)<=(c);++(a))
#define FOREACH(a,b) for (auto &(a) : (b))
#define REP(i,n) FOR(i,0,n)
#define REPN(i,n) FORN(i,1,n)
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
#define SQR(x) ((LL)(x) * (x))
#define RESET(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(),v.end()
#define ALLA(arr,sz) arr,arr+sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr,sz) sort(ALLA(arr,sz))
#define REVERSEA(arr,sz) reverse(ALLA(arr,sz))
#define PERMUTE next_permutation
#define TC(t) while(t--)
 
inline string IntToString(LL a){
  char x[100];
  sprintf(x,"%lld",a); string s = x;
  return s;
}
 
inline LL StringToInt(string a){
  char x[100]; LL res;
  strcpy(x,a.c_str()); sscanf(x,"%lld",&res);
  return res;
}
 
inline string GetString(void){
  char x[1000005];
  scanf("%s",x); string s = x;
  return s;
}
 
inline string uppercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}
 
inline string lowercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}
 
inline void OPEN (string s) {
  #ifndef TESTING
  freopen ((s + ".in").c_str (), "r", stdin);
  freopen ((s + ".out").c_str (), "w", stdout);
  #endif
}

int n;
int A[100000];
int j, v;

void solve() {
  for (int i=0; i < n; i++){
    if (i != 0){
      cout << " ";
    }
    cout << A[i] ;
  }
  cout << endl;
  for (int i = 1; i < n; i++){
    v = A[i];
    j = i - 1;
    while (j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    for (int k=0; k < n; k++){
      if (k != 0) cout << " ";
      cout << A[k];
    }
    //if(i != n-1){
      cout << endl;
    ///}
  }
}

int main() {
  cin >> n ;
  REP(i, n) {
    cin >> A[i];
  }

  solve();

  return 0;
}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
 
int main(){
    string s; cin >> s;
    ll q; cin >> q;
    map<ll, string> mp;
    mp[0] = s;
    ll st = -1, last = 1;
    int f = 1;
    for(int i = 0; i < q; i++){
        int t; cin >> t;
        if(t == 1){
            f *= -1;
        }else{
            int c; cin >> c;
            string ss; cin >> ss;
            if(c == 1){
                if(f == 1){
                    mp[st] = ss;
                    st--;
                }else{
                    mp[last] = ss;
                    last++;
                }
            }else{
                if(f == 1){
                    mp[last] = ss;
                    last++;
                }else{
                    mp[st] = ss;
                    st--;
                }
            }
        }
    }
    if(f == 1){
        for(ll i = st+1; i < last; i++){
            cout << mp[i];
        }
    }else{
        for(ll i = last-1; i > st; i--){
            if(i == 0){
                string t = mp[0];
                reverse(t.begin(), t.end());
                cout << t;
                continue;
            }
            cout << mp[i];
        }
    }
}

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

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair
using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

int gcd(int a, int b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));}

int lcm(int a, int b)
{return a * b / gcd(a, b);}

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

vector<pair<ll, int>> prime_div(ll n){
  vector<pair<ll, int>> res;
  for (ll i=2; i*i <= n;i++){
    if (n%i == 0){
      int a = 0;
      while(n%i == 0){
        n /= i;
        a++;
      }
      pair<ll, int> tmp;
      tmp.first = i;
      tmp.second = a;
      res.push_back(tmp);
    }
  }
  if (n != 1){
    pair<ll, int> now;
    now.first = n;
    now.second = 1;
    res.push_back(now);}
  return res;
}


// printf("%.10f\n" , ans);
int main(void){
  ios::sync_with_stdio(false);
  int k;
  cin >> k;
  set<int> a;
  int x = 7 % k;
  int ans = 1;
  while (a.count(x) == 0){
    if (x == 0){
      cout << ans << endl;
      return 0;
    }
    a.insert(x);
    x = (x*10 + 7) % k;
    ans++;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 50492
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b<c+d)cout<<"Right"<<endl;
    else if(a+b==c+d)cout<<"Balanced"<<endl;
    else cout<<"Left"<<endl;
}


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

using namespace std;

int main()
{
    int n,mi=1e6,ans=0;

    cin >> n ;

    int a[n];

    for(int v,i=0;i<n;i++)
    {
        cin >> v;

        mi = min(mi,v);

        if(mi == v) ans++;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;
typedef vector<int> Vint;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j, k;
  for(int testcase = 0;testcase >= 0;testcase++){
    int5(a, b, c, d, e);
    if(a < 40)a = 40;
    if(b < 40)b = 40;
    if(c < 40)c = 40;
    if(d < 40)d = 40;
    if(e < 40)e = 40;
    pri((a + b + c + d + e) / 5);

/*/

//*/ break;
  }
  return 0;
}

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

int s[1000000], t[50000];
int n, q;

bool bsearch(const int array[], int l, int r, int v)
{
    while (l + 1 < r)
    {
        int m = (l + r) / 2;
        if (v < array[m])
            r = m;
        else
            l = m;
    }
    return l < r && array[l] == v;
}

int main()
{
    int c = 0;
    cin >> n;
    rep(i, n) cin >> s[i];
    cin >> q;
    rep(i, q) cin >> t[i];
    rep(i, q)
    {
        if (bsearch(s, 0, n, t[i]))
            c++;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 3624
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define rep2(i, m, n) for (int i = m; i < n; i++)
#define all(v) v.begin(), v.end
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

int main()
{
    int N,num,c,ans = 0;
    cin >> N;

    rep(i, N){
        num = i + 1;
        c = 1;
        while(num >= 10){
            num /= 10;
            c++;
        }

        if(c % 2 != 0){
            ans++;
        }
    }

    cout << ans << endl;
}



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

int main(){
    int N; cin >> N;
    vector <int> A(N);
    rep(i,N) cin >> A[i];
    
    int ans=1e9;
    
    for (int i=1; i<N; i++){
        int l=0; 
        int r=0;
        for (int j=0; j<i; j++) l+=A[j];
        for (int j=i; j<N; j++) r+=A[j];
        ans=min(ans,abs(l-r));
    }
    cout << ans;
}

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

using namespace std;

typedef long long ll;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
const double pi=acos(-1);
const int maxn=1e5;
const int mod=1e9+7;
typedef struct xx
{
    int wz[maxn],sl;
};
xx a[10];
int v[10]= {0};
int b[10];
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0; i<10; i++)
        a[i].sl=0;
    for(int i=0; i<n; i++)
    {
        int k=s[i]-'0';
        a[k].wz[a[k].sl++]=i;
        if(!v[k])
            v[k]=1;
    }
    int ss=0;
    for(int i=0; i<10; i++)
        if(v[i])
            b[ss++]=i;
    for(int i=0; i<ss; i++)
    {
        int k=b[i];
        sort(a[k].wz,a[k].wz+a[k].sl);
    }
    int zb1;
    int sum=0;
    for(int i=0; i<ss; i++)
    {
        int s1=b[i],xb;
        zb1=a[s1].wz[0];
        for(int j=0; j<ss; j++)
        {
            int s2=b[j],zb2;
            xb=lower_bound(a[s2].wz,a[s2].sl+a[s2].wz,zb1+1)-a[s2].wz;
            zb2=a[s2].wz[xb];
           // cout<<zb<<endl;
            if(xb<a[s2].sl)
            for(int k=0; k<ss; k++)
            {
                int s3=b[k];
                xb=lower_bound(a[s3].wz,a[s3].sl+a[s3].wz,zb2+1)-a[s3].wz;
                if(xb<a[s3].sl)
                    {
                        sum++;
                     //  cout<<s1<<" "<<s2<<" "<<s3<<endl;
                    }
            }
        }

    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 512
#A


s = input().split("/")
if int(s[1]) <= 4:
    print("Heisei")
else:
    print("TBD")

#B
"""
n = int(input())
ans = 0
for i in range(n):
    a = input().split()
    if a[1] == "JPY":
        ans += int(a[0])
    else:
        ans +=  float(a[0]) * 380000
print(ans)
"""

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

//aのp乗を求めるアルゴリズム。計算量はO(logp)
ll modpow(ll a, int p) {
    if(p == 0) {
        return 1;
    }
    if(p%2 == 0) {
        //pが偶数の時
        int halfP = p/2;
        ll half = modpow(a, halfP);
        //a^(p/2)をhalfとして、half*halfを計算
        return half * half % mod;
    }
    else {
        //pが奇数の時は、pを偶数にするために1減らす
        return a * modpow(a, p-1) % mod;
    }
}

ll Comb(int a, int b) {
    if(b > a-b) {
        return Comb(a, a-b);
    }

    ll ansMul = 1;
    ll ansDiv = 1;
    rep(i, b) {
        ansMul *= (a-i);
        ansDiv *= (i+1);
        ansMul %= mod;
        ansDiv %= mod;
    }
    // ansMul/ansDivをやりたい
    // ansDivの逆元を使って求めよう
    ll ans = ansMul * modpow(ansDiv, mod-2) % mod;

    return ans; 
}

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

    int mNokori = m;
    ll ans = 1;
    for(int i = 2; i*i <= mNokori; i++) {
        if(mNokori%i == 0) {
            int cnt = 0;
            while(mNokori%i == 0) {
                cnt++;
                mNokori /= i;
            }

            ans *= Comb(n+cnt-1, n-1);
            ans %= mod;
        }
    }
    if(mNokori != 1) {
        //最後に素数が残ってる分を処理する
        ans *= Comb(n, n-1);
        ans %= mod;
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#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 all(v) v.begin(),v.end()
const double PI = 3.14159265358979323846;

int main() {
    int r;
    cin >> r;
    cout << 2*PI*r << endl;
    return 0;
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int ans[N],n;
int main()
{
	for(int i=1;i<=100;i++)
	{
		for(int j=1;j<=100;j++)
		{
			for(int k=1;k<=100;k++)
			{
				ans[i*i+j*j+k*k+i*j+j*k+k*i]++;
			}
		}
	}
	cin>>n;
	for(int i=1;i<=n;i++)cout<<ans[i]<<"\n";	
	return 0;
}

Measured memory_bytes: 3824
int n,m;
int p[1<<17],r[1<<17];
int l[1<<17];
int find(int a){return p[a]-a?p[a]=find(p[a]):a;}
void unite(int a,int b)
{
	int pa=find(a),pb=find(b);
	if(pa==pb)return;
	if(r[pa]<r[pb])
	{
		p[pa]=pb;
	}
	else
	{
		p[pb]=pa;
		if(r[pa]==r[pb])r[pa]++;
	}
}
main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<=n||i<=m;i++)l[i]=-1,p[i]=i;
	for(int i=0;i<n;i++)
	{
		int k,a;
		scanf("%d",&k);
		for(int j=0;j<k;j++)
		{
			scanf("%d",&a);
			if(l[a]<0)l[a]=i;
			else unite(i,l[a]);
		}
	}
	int f=1;
	for(int i=0;++i<n;)f&=find(0)==find(i);
	puts(f?"YES":"NO");
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using f32 = float;
using f64 = double;
using LL = long long;
using ULL = unsigned long long;
#define REP(i, n) for (LL i = 0; i < (int)(n); i++)
int main()
{ 
  string a;
    cin >>a;
  REP(i,2){
  if(a[i]!=a[i+1]){
  cout << "Yes";
  return 0;
  }
  }
  cout << "No";
  
}

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

priority_queue<double> pq;

int main() {
	ll n, x;
	cin >> n;

	vector<ll> v;

	for(int i = 0; i < n; ++i) {
		cin >> x;
		pq.push(-x);
	}

	while(pq.size() > 1) {
		double x = -pq.top();
		pq.pop();

		double y = -pq.top();
		pq.pop();

		pq.push(-((x+y)/2.0));
	}

	cout << -pq.top() << endl;
	return 0;
}

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

int N, K;
int D[11][5];
int C[11];

int main() {
  cin >> N >> K;
  D[0][0] = 4;
  D[0][1] = 2;
  D[0][2] = 0;
  D[0][3] = 9;
  D[0][4] = 7;
  for (int i=1; i<11; i++) {
    for (int j=0; j<5; j++) {
      D[i][j] = (D[i-1][j]+8)%11;
    }
  }
  for (int i=0; i<11; i++) {
    for (int j=0; j<5; j++) {
      if (D[i][j] == K) C[i]++;
    }
  }
  long long s = 0;
  for (int i=0; i<11; i++) s += C[i];
  N -= 2;
  s *= (N/11);
  for (int i=0; i<(N%11); i++) s += C[i];
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

//ABC081B - Shift only

int odd_check(int *,int n);

int main(void){

  int n; //整数の数N
  int s=0; //操作回数
  char buf[256]; //読み取り用一列
  int j;

  scanf("%d\n",&n);

  int a[n]; //整数の配列A

  for (int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  //fgets(buf,sizeof(buf),stdin); //一行文字列を読み取り配列に格納
  
  
  /*for(int i =0;i<n;i++){
    fgets(a[i],sizeof(int),buf);
  }

  printf("%d\n",a[2]);
  */

  s = odd_check(a,n);
     
  printf("%d\n",s);
  
  return 0;
}

int odd_check(int *a, int n){
  int odd=0; //奇数の個数
  int s=0; //操作回数
  while(odd == 0){
    odd = 0;
    for(int i=0;i<n;i++){
      if(a[i] % 2 != 0){
        odd = odd+1;
      }
      a[i] = a[i] / 2;
    }
    s = s + 1;
  }
  return (s-1);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int a,ans;
int main(){
	cin>>a;
	for(int i=1;i<=a;++i){
		if(i>=0&&i<10)ans++;
		if(i>=100&&i<1000)ans++;
		if(i>=10000&&i<100000)ans++;
	}
	cout<<ans;
	return 0;
} 


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

int main(){
    int N,A,judge;
    cin >> N >> A;

    judge = N % 500;

    if(judge == 0 || A > judge)
        cout << "Yes" << endl;
    else if(judge != 0 || A < judge)
        cout << "No" << endl;
    
}

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

const int MAX_N = 100;

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int N, K;
    int d;
    cin >> N;
    cin >> K;
    int ans = N;
    int seen[N] = {};
    for (int i = 0; i < K; i++) {
        cin >> d;
        for (int j = 0; j < d; j++) {
            int A;
            cin >> A;
            if (seen[A-1]) {
            } else {
                seen[A-1] = 1;
                ans--;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3624
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N=in();
	ll V=in<ll>();
	auto A=vecin<ll>(N);
	auto B=vecin<ll>(N);
	auto C=vecin<ll>(N);
	auto D=vecin<ll>(N);
	unordered_map<ll,ll> S;
	REP(i,N){
		REP(j,N){
			S[A[i]+B[j]]++;
		}
	}
	ll sum=0;
	REP(i,N){
		REP(j,N){
			ll P=C[i]+D[j];
			if(S.find(V-P)!=S.end()) sum+=S[V-P];
		}
	}
	out(sum);
	return 0;
}



Measured memory_bytes: 42280
"""参考
@drken
2020年02月02日に更新
BFS (幅優先探索) 超入門！ 〜 キューを鮮やかに使いこなす 〜
https://qiita.com/drken/items/996d80bcae64649a6580
"""
import numpy as np 
from copy import deepcopy,copy
from copy import copy
def Breadth_first_search(start,already_initial):#幅優先探索
    already=set()
    already =copy(already_initial)
    already.add(start)    
    now = start
    now_generation =copy(queue_dic[start]) #次に行けるところ
    next_preparation =set() #その世代の間、nextに行くために溜めておく
    count_generation=0
    while len(already) < (H+2)*(W+2):
        for now in now_generation:
            if now in already:          #今いるのが壁
                continue            #壁はalready入力すみ
            elif now_generation <= already:   #壁・alreadyに囲まれている
                already.add(now)
                continue
            else:
                #print(now,end=" ")
                already.add(now)
                next_preparation    |= queue_dic[now] 

        now_generation.clear()
        now_generation           |= next_preparation
        next_preparation.clear()
        count_generation +=1
    return count_generation 

# 初期入力

H,W = (int(x) for x in input().split())

map_np =np.full((H+2,W+2),"#",dtype=str) #グリッド初期化、壁で囲むので＋２
for i in range(1,H+1):
    S = input()
    S.strip()
    for j in range(1,W+1):
        map_np[i,j]=S[j-1]

# 構造ーつながり
queue_dic={(h,w):set()for h in range(1,H+1) for w in range(1,W+1)}
already_initial=set() #探索すみ座標の初期値
for h in range(H+2):
    for w in range(W+2):
        if map_np[h,w] ==".":
            if map_np[h+1,w] =="." :
                queue_dic[h,w].add((h+1  ,w  ))
            if map_np[h-1,w] =="." :
                queue_dic[h,w].add((h-1  ,w  ))
            if map_np[h,w+1] =="." :
                queue_dic[h,w].add((h    ,w+1))
            if map_np[h,w-1] =="." :
                queue_dic[h,w].add((h    ,w-1))
        else:
            already_initial.add((h,w)) #壁は行けない＝既に行った
grid_all =queue_dic.keys() #マップの全て
can_pass =grid_all - already_initial  #通過できるところ

#幅優先探索
distance_list =[] #各スタート場所ごとの距離
for start1 in can_pass:
    already1 =set()
    already1=copy(already_initial )
    #print(already_initial)  
    distance_from_start =Breadth_first_search(start1,already_initial)
    distance_list.append(distance_from_start)

print(max(distance_list))

Measured memory_bytes: 12536
k,n=map(int,input().split())
a=list(map(int,input().split()))
a+=[k+a[0]]

ans=0
max_l=0
for i in range(1,n+1):
  ans+=a[i]-a[i-1]
  max_l=max(max_l,a[i]-a[i-1])
print(ans-max_l)

Measured memory_bytes: 26000
package main

import "fmt"

func main() {
	var n, l int

	var isZero bool
	var all int
	var last int

	fmt.Scan(&n)
	fmt.Scan(&l)

	for i := 1; i <= n; i++ {
		taste := l + i - 1
		all = all + taste

		if taste == 0 {
			isZero = true
		}
		if i == n {
			last = taste
		}
	}

	if isZero {
		fmt.Println(all)
	} else if l < 0 {
		fmt.Println(all - last)
	} else {
		fmt.Println(all - l)
	}
}


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

int main() {

    ios::sync_with_stdio(false) ;
    cin.tie(0) ;

    long double a, b, c, d ;
    cin >> a >> b >> c >> d ;
    cout << fixed << setprecision(0)<<  b-a+1 - (floor(b/c) - ceil(a/c) + 1 + floor(b/d) - ceil(a/d) + 1 - floor(b/(c*d/__gcd((long long)c, (long long)d))) + ceil(a/(c*d/__gcd((long long)c, (long long)d))) - 1) << '\n' ;
/*    cout <<  floor(b/c) - ceil(a/c) + 1 << '\n' ;
    cout <<  floor(b/d) - ceil(a/d) + 1 << '\n' ;
    cout <<  floor(b/(c*d/__gcd((long long)c, (long long)d))) - ceil(a/(c*d/__gcd((long long)c, (long long)d))) + 1 << '\n' ;
    cout << (c*d/__gcd((long long)c, (long long)d)) ;*/

}


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

typedef long long ll;
const ll MOD = 1000000007;
const int MAXN = 5010;

int n, siz[MAXN];
vector<int> G[MAXN];
ll dp[MAXN][MAXN], g[MAXN], t[MAXN];

void dfs(int x, int fa)
{
	siz[x] = 1;
	dp[x][1] = 1;
	for(int i = 0; i < G[x].size(); ++i)
	{
		int y = G[x][i];
		if(y == fa) continue;
		dfs(y, x);
		for(int j = 0; j <= siz[x]; ++j) t[j] = dp[x][j], dp[x][j] = 0;
		for(int j = 0; j <= siz[x]; ++j)
			for(int k = 0; k <= siz[y]; ++k)
				dp[x][j + k] = (dp[x][j + k] + t[j] * dp[y][k] % MOD) % MOD;
		siz[x] += siz[y];
	}
	for(int i = 0; i <= siz[x]; ++i) dp[x][0] = (dp[x][0] - dp[x][i] * g[i] % MOD + MOD) % MOD;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1, u, v; i < n; ++i)
	{
		scanf("%d %d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	g[0] = 1;
	for(int i = 2; i <= n; i += 2) g[i] = g[i - 2] * (i - 1) % MOD;
	dfs(1, 0);
	printf("%lld\n", MOD - dp[1][0]);
	return 0;
}

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

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

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?' ':'\n'); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);}//最小公倍数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

const int NMAX = 200;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    IOS;
    CIN(N);
    int ans=0;
    RepS(i,1,N){
        int div_num=0;
        RepS(j,1,i){
            if(i%j==0)div_num++;
        }
        if(div_num==8)ans++;
        i++;
    }
    printf("%d\n",ans);

    return 0;
}

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

signed main(){
	string s, t; cin >> s >> t;
	lint N = s.size(), M = t.size();
	vector<lint> cs(26, 0), ct(26, 0);
	vector<vector<lint> > alp(26);
	for(lint i = 0; i < N; i++){
		cs[s[i] - 'a']++;
		alp[s[i] - 'a'].push_back(i + 1);
	}
	for(lint i = 0; i < M; i++) ct[t[i] - 'a']++;
	for(lint i = 0; i < 26; i++){
		if(cs[i] == 0 && ct[i] != 0){
			cout << -1 << endl;
			return 0;
		}
	}
	lint ans = 0, counter = 1;
	for(lint i = 0; i < M; i++){
		lint j = t[i] - 'a';
		lint v = lower_bound(alp[j].begin(), alp[j].end(), counter) - alp[j].begin();
		if(v == alp[j].size()){
			ans += ((N - counter + 1) + alp[j][0]);
			counter = alp[j][0] + 1;
		}
		else{
			ans += (alp[j][v] - counter + 1);
			counter = alp[j][v] + 1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1724
import sys
sys.setrecursionlimit(10**6)
def p(n):
    if n==1:
        return 1
    return n*p(n-1)%(10**9+7)
n,m=map(int,input().split())
if n==m:
    print(p(n)**2*2%(10**9+7))
elif abs(n-m)==1:
    print(p(n)*p(m)%(10**9+7))
else:
    print(0)

Measured memory_bytes: 83316
A, B, M = map(int, input().split())
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]
xyc = [[0] * 3 for i in range(M)]
for i in range(M):
    x, y, c = map(int, input().split())
    xyc[i][0], xyc[i][1], xyc[i][2] = x, y, c
ans = min(a) + min(b)
for i in range(M):
    ans = min(ans, a[xyc[i][0]-1]+b[xyc[i][1]-1]-xyc[i][2])
print(ans)

Measured memory_bytes: 30708
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
#define sc(x) scanf("%lld",&x)
#define scs(x) scanf("%s",x)
#define pr(x) printf("%lld\n",x)
#define prs(x) printf("%s\n",x)
using namespace std;
const int maxn=1e5+5;
const int mod=1e9+7;
const double pi=acos(-1.0);
ll n,m,s,v;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    sc(n),sc(m);
    for(int i=1;i<=m;i++){
        sc(v);
        s+=v;
    }
    if(s>n) printf("-1\n");
    else pr(n-s);
    return 0;
}

Measured memory_bytes: 3788
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace _1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            for (int i = 9; i>= 1; i--)
            {
                if(a%i==0)
                {
                    if(i<=9&&a/i<=9)
                    {
                        Console.WriteLine("Yes");
                        return;
                    }
                }
            }
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 11092
n, k = map(int, input().split())
lis = [False] * n
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(d):
        lis[a[j]-1] = True
ans = 0
for i in range(n):
    if lis[i] == False:
        ans += 1
print(ans)


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

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '7') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

class state{
public:
	int dir,x,y,cost;
	state(int _d, int _x, int _y, int _c){
		dir=_d; x=_x; y=_y; cost=_c;
	}
	bool operator<(const state& tmp)const{
		return cost>tmp.cost;
	}
};

const int dx[] = {0,1,0,-1}; // up, right, down, left
const int dy[] = {-1,0,1,0};
int memo[4][32][32];

int main(){
	int w,h;
	int field[32][32],c[4];
	while(scanf("%d%d",&w,&h),w|h){
		rep(i,32)rep(j,32)memo[0][i][j]=memo[1][i][j]=memo[2][i][j]=memo[3][i][j]=INT_MAX;
		rep(i,h)rep(j,w)scanf("%d",&field[i][j]);
		scanf("%d%d%d%d",c,c+1,c+2,c+3);
		
		priority_queue<state> q;
		q.push(state(1,0,0,0));
		memo[1][0][0]=0;
		
		int karikari = INT_MAX;
		while( !q.empty() ){
			int x = q.top().x;
			int y = q.top().y;
			int co = q.top().cost;
			int d = q.top().dir;
			
			if( karikari<co )break;
			q.pop();
			rep(i,4){
				int next_dir = (d+i)%4;
				int tx = x + dx[next_dir];
				int ty = y + dy[next_dir];
				
				if( tx<0 || ty<0 || tx>=w || ty>=h )continue;
				//if( !(tx==w-1 && ty==h-1) && field[ty][tx]==4 )continue;
				
				//printf("t(%d,%d),(dir:%d, i:%d, (%d,%d), c:%d)",tx,ty,d,i,x,y,co);
				if( i==field[y][x] ){
					//printf(" --(y)-->(dir:%d ,(%d,%d), c:%d)\n",next_dir,tx,ty,co);
					if( memo[next_dir][ty][tx] > co ){
						memo[next_dir][ty][tx] = co;
						if( !(tx==w-1&&ty==h-1) ){
							q.push(state(next_dir, tx, ty, co));
						}else{
							karikari = min(karikari,co);
						}
					}
				}else{
					//printf(" --(n)-->(dir:%d ,(%d,%d), c:%d)\n",next_dir,tx,ty,co+c[i]);
					if( memo[next_dir][ty][tx] > co + c[i] ){
						memo[next_dir][ty][tx] = co + c[i];
						if( !(tx==w-1&&ty==h-1) ){
							q.push(state(next_dir, tx, ty, co+c[i]));
						}else{
							karikari = min(karikari,co+c[i]);
						}
					}
				}
			}
			//puts("");
		}
		
		int ans = INT_MAX;
		rep(i,4)ans=min(ans,memo[i][h-1][w-1]);
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;++i)
#define repi(i,n) for(ll i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define slf(n) scanf("%lf", &n);
typedef long long ll;
typedef double lf;
static const ll max_n = 100010;
static const ll mod = 1000000007;
static const ll max_value = 100000000000100;

ll N, M;


void Main(){
    // bool is_ok = true;
    // printf("------------- V=%lld---------\n", V);
    ll N, M, a;
    sll(N);
    sll(M);
    set<ll> all_number;
    // rep(i, N){
    //     all_number.insert(i+1);
    // }
    ll num = 0;
    ll even_i = N, even_j = N-M+1;
    ll odd_i = 1, odd_j = M+1;
    while(num < M){
        num ++;
        if(num % 2 == 1){
            printf("%lld %lld\n", odd_i, odd_j);
            odd_i ++;
            odd_j --;
        }else{
            printf("%lld %lld\n", even_j, even_i);
            even_i --;
            even_j ++;
        }

    }

    // printf("%lld\n", );


    // cout<<fixed<<setprecision(10)<<num<<endl;
    // cout << num << endl;

}

int main(){
    Main();

    return 0;

}

Measured memory_bytes: 3232
#include<stdio.h>
#include<string.h>

int main()
{
	long long n;
	char pass[255] = {0};
	
	scanf("%lld", &n);
	--n;
	int i = 0;
	
	while(n >= 0){
		pass[i] = (n % 26) + 'a';
		n /= 26;
		++i;
		--n;
	}
	
	int len = strlen(pass);
	
	for(int i = len - 1 ; i >= 0; i--){
		printf("%c", pass[i]);
	}
	
	
}

Measured memory_bytes: 1644
#include<iostream>
#include<cstring>
#include<stack>
using namespace std;
char s[10];
stack<int> q;
int main()
{
	ios::sync_with_stdio(false);
	cin>>s;
	int len=strlen(s);
	for(int i=0;i<=len;i++)
	{
		if(s[i]=='A')
		  q.push(s[i]);
		else
		if(s[i]=='C'&&s[i-1]=='A')
		{
			if(!q.empty())
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

using namespace std;
#define INFS (1LL<<28)
#define INF (1LL<<60)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long
#define double long double
#define all(n) n.begin(),n.end()

vector<pair<double,pair<double,double>>> ans;

double max(double a,double b){
	if(a>b)return a;
	else return b;
}

double rot(double x,double y){
	double angle=acos(x/(sqrt(x*x+y*y)));
	angle=angle*180.0/acos(-1);
	if(y<0)angle=360.0-angle;
	return angle;
}

signed main(){
	cout << fixed << setprecision(15);
	int n;
	cin>>n;

	lp(i,n){
		int x,y;
		cin>>x>>y;
      if(x==0 && y==0){continue;}
		ans.push_back({rot(x,y),{x,y}});
	}
	sort(ans.begin(),ans.end());
  n=ans.size();
	lp(i,n){
		ans.push_back(ans[i]);
	}
	double r=0;
	lp(i,n){
		double sum[2]={0,0};
		for(int j=i;j<n+i;j++){
			sum[0]+=ans[j].second.first;
			sum[1]+=ans[j].second.second;
			r=max(r,(double)sqrt(sum[0]*sum[0]+sum[1]*sum[1]));
		}
	}
	cout<<r<<endl;
	return 0;
}


Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Happy Birthday!
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int a, b;
  cin >> a >> b;
  if (a <= 8 && b <= 8) puts("Yay!");
  else puts(":(");
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<stdio.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e9

int p[100001];
int main()
{
	int n;
	cin >> n;
	rep(i, n) cin >> p[i];
	int ans = 0;
	rep(l, n) {
		if (l + 1 == p[l]) {
			int w = p[l];
			p[l] = p[l + 1];
			p[l + 1] = w;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int N, x;
	cin >> N >> x;
	if (x == 1 || x == N * 2 - 1){
		cout << "No" << endl;
	} else {
		vector<int> ans(N * 2 - 1, -1);
		if (x < N * 2 - 2){
			ans[N - 1] = x - 1;
			ans[N] = x;
			int num = 1;
			for (int i = 0; i < N * 2 - 1; i++){
				if (num == x - 1 || num == x){
					num = x + 1;
				}
				int pos = (N + 2 + i) % (N * 2 - 1);
				if (ans[pos] == -1){
					ans[pos] = num; 
					num++;
				}
			}
		} else {
			ans[N - 1] = x;
			ans[N] = x + 1;
			int num = 1;
			for (int i = 0; i < N * 2 - 1; i++){
				int pos = (N - 2 + i) % (N * 2 - 1);
				if (ans[pos] == -1){
					ans[pos] = num;
					num++;
				}
			}
		}
		cout << "Yes" << endl;
		for (int i = 0; i < N * 2 - 1; i++){
			cout << ans[i] << endl;
		}
	}
}

Measured memory_bytes: 3936
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;

int main()
{
	std::ios::sync_with_stdio(false);
	int A, B;
	std::cin >> A >> B;
	if (B % A) std::cout << B - A;
	else std::cout << A + B;

	return 0;
}//Rhein_E


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

constexpr static ll MOD = 1000000007ll;
constexpr static int INF = 1 << 28; // for x <= 10^9
constexpr static ll INFL = 1ll << 60; // for x <= 10^19

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

    int maxA = -1, maxB = -1;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;

        if (maxA < a) {
            maxA = a;
            maxB = b;
        }
    }

    cout << (maxA + maxB) << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
template<typename T> inline void add(T& a, T b) { a += b; if (a >= MOD) a -= MOD; }
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  int N; cin >> N;
  vector<ll> A(N+1);
  A[0] = 0;
  map<ll,ll> T;
  T[0] = 1;
  rep1(i, N) {
    cin >> A[i];
    A[i] += A[i-1];
    T[A[i]]++;
  }
 
  ll ans = 0;
  for(auto t : T) {
    if(t.second >= 2) {
      ans += t.second * (t.second - 1) / 2;
    }
  }
 
  cout << ans << endl;
}

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

using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//最終奥義 #define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//lambda: [](int x, int y){return x<y;}

signed main(void){
    vvint a(3, vint(3,0));
    rep(i,3){
        rep(j,3){
            cin>>a[i][j];
        }
    }
    int n;cin>>n;
    vint b(n);vin(b);

    vvint opened(3,vint(3,0));
    rfor(x,b){
        rep(i,3){
            rep(j,3){
                if(a[i][j]==x)opened[i][j]++;
            }
        }
    }
    rep(i,3){
        if(opened[i][0]&&opened[i][1]&&opened[i][2]){
            cout << "Yes" << endl;
            return 0;
        }
        if(opened[0][i]&&opened[1][i]&&opened[2][i]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    if(opened[0][0]&&opened[1][1]&&opened[2][2]||opened[0][2]&&opened[1][1]&&opened[2][0]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    

    return 0;
}


Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    string s,t;
    cin>>s>>t;
    int sz=s.size();
    int cnt=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])cnt++;
    }
    cout<<cnt<<endl;

    return 0;

}





































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

const int n = 105;

int N;
int B[n];

int main(){
  cin >> N;
  for(int i=1; i<=N; i++){
    cin >> B[i];
    if(B[i] > i){
      cout << -1 << endl;
      exit(0);
    }
  }

  vector<int> R;
  for(int i=0; i<N; i++){
    for(int j=N-i; j>=0; j--){
      if(B[j] == j){
        R.push_back(j);
        for(int k=j; k<N-i; k++){
          B[k] = B[k+1];
        }
        break;
      }
    }
  }

  for(int i=N-1; i>=0; i--){
    cout << R[i] << endl;
  }

  return 0;
}


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

int main(){
	float w;
	float border[10] = { 48.00, 51.00, 54.00, 57.00, 60.00, 64.00, 69.00, 75.00, 81.00, 91.00 };
	char CLASS[11][16] = { "light fly", "fly", "bantam", "feather", "light", "light welter", "welter", "light middle", "middle", "light heavy", "heavy" };

	while (cin >> w){
		for (int i = 0; i < 10; ++i){
			if (w <= border[i]){
				cout << CLASS[i];
				break;
			}

			if (i == 9)
				cout << CLASS[10];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
import java.util.Scanner; 
public class Main
{
	public static void main(String[] args) {
		Scanner ulaz = new Scanner(System.in);
		int k;
		String s;
		k = ulaz.nextInt();
		s = ulaz.next();
		
		if (s.length() <= k)
		    System.out.println(s);
		else
		{
		    for (int i = 0; i < k; i++)
		        System.out.print(s.charAt(i));
		    System.out.print("...");
		}
	}
}


Measured memory_bytes: 35688