akhauriyash/Code-Regression huggingface dataset:
from collections import Counter
n = int(input())
a = sorted(list(map(int, input().split())))
c = Counter(a)
maxa = a[-1]+1
dp = [True] * maxa
s = list(set(a))
for x in s:
    for j in range(x*2,maxa,x):
        dp[j] = False
ret = 0
for x in a:
    if c[x] == 1 and dp[x] == True:
        ret += 1
print(ret)


Measured memory_bytes: 51328
#pragma warning( disable : 6031)

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <math.h>
int minimum(int a, int b) { return a < b ? a : b; }
int maximum(int a, int b) { return a > b ? a : b; }
const long long mod = 1000000007;
//const long long mod = 998244353;
using std::vector;
using std::pair;
using std::string;
using std::map;
int main() {
	int A, B, C, D;
	scanf("%d %d %d %d", &A, &B, &C, &D);
	while (1) {
		C -= B;
		if (C <= 0) {
			printf("Yes");
			break;
		}
		A -= D;
		if (A <= 0) {
			printf("No");
			break;
		}
	}
	return 0;
}

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

char S[114514];
int len;

int main(void) {
	int onazi = 1;
	int i;
	int len;
	int minKyori;
	int target;
	int answer;
	if (scanf("%114513s", S) != 1) return 1;
	len = (int)strlen(S);
	for (i = 1; i < len; i++) {
		if (S[i] != S[0]) {
			onazi = 0;
			break;
		}
	}
	if (onazi) {
		printf("%d\n", len);
		return 0;
	}
	answer = 0;
	for (target = '0'; target <= '1'; target++) {
		minKyori = len - 1;
		for (i = 0; i < len; i++) {
			if (S[i] != target) {
				int k1 = i, k2 = len - i - 1;
				int kyori = k1 > k2 ? k1 : k2;
				if (kyori < minKyori) minKyori = kyori;
			}
		}
		if (answer < minKyori) answer = minKyori;
	}
	printf("%d\n", answer);
	return 0;
}

/*

1110

*/

/*

長さが1だけ違う操作をすることで、その端だけをひっくり返せる

*/


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>	
using namespace std;
typedef long long ll;
#define bay_bay return 0;
#define fori(n) for(int i=0;i<n;++i)
#define for1(n) for(int i=1;i<=n;i+=3)
#define all(v) ((v).begin()), ((v).end())	
#define sz(v) v.size()
#define endl "\n"
constexpr auto EPS = 1e-9;
#define ff fflush(stdout);
const int mod = 1000000007;
clock_t T;
#define ctime cerr << "Time : " << double(clock() - T) / CLOCKS_PER_SEC << endl
void GOAT()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
#endif
}
int main()
{

	//GOAT();
	int h, a;
	cin >> h >> a;
	 (h % a == 0) ?cout<< h / a :cout<< (h / a) + 1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
int main() {
    ull N, M;
    cin >> N >> M;
    priority_queue<ll> q;
    rep(i, N) {
        ll tmp;
        cin >> tmp;
        q.push(tmp);
    }
    rep(i, M) {
        ll num = q.top();
        q.pop();
        num /= 2;
        q.push(num);
    }

    ll sum = 0;

    while(!q.empty()) {
        sum += q.top();
        q.pop();
    }
    cout << sum << endl;
}

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

int n;
vector<pair<int,int>> G[100005];
int color[100005];

void dfs(int v,int c){
    color[v]=c;
    for(auto e:G[v]){
        int u=e.first;
        int w=e.second;
        if(color[u])continue;
        if(w&1){
            dfs(u,-c);
        }else{
            dfs(u,c);
        }
    }
}

int main(){
    cin>>n;
    for(int i=0;i<n-1;i++){
        int u,v,w;
        cin>>u>>v>>w;
        --u;--v;
        G[u].push_back({v,w});
        G[v].push_back({u,w});
    }
    dfs(0,1);
    for(int i=0;i<n;i++){
        cout<<(color[i]+1)/2<<endl;
    }
}


Measured memory_bytes: 8320
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l=sc.nextLong(),r=sc.nextLong(),min=Long.MAX_VALUE;
		if(l==0 || r-l>=2018) {
			System.out.println(0);
		}else {
			for(long i=l;i<r;i++) {
				if(i%2019==0) {
					System.out.println(0);
					System.exit(0);
				}
				for(long j=l+1;j<=r;j++) {
					min=Math.min(min, (i*j)%2019);
				}
			}
			System.out.println(min);
		}
	}
}



Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int x; cin >> x;
   int i = 0;
   int t = 0;
   while(i < x){
      t++;
      i += t;
   }
   if (i == x)cout << t << endl;
   else cout << t << endl;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll INF = 1e17;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

ll dp[MAXN];

int x[MAXN];

void solve(){
	int n, E, T;
	scanf("%d%d%d", &n, &E, &T);
	REPN(i, 1, n){
		scanf("%d", &x[i]);
	}
	ll mn = INF;
	for(int i = 1, j = 1; i <= n; i++){
		for(; 2 * (x[i] - x[j]) >= T; j++){
			mn = min(mn, dp[j - 1] - x[j - 1] - 2ll * x[j]);
		}
		dp[i] = min(dp[j - 1] - x[j - 1] + x[i] + T, mn + 3ll * x[i]);
		//printf("%d %d %lld %lld %lld %lld\n", i, j, mn, dp[j - 1] - x[j - 1] + x[i] + T, mn + 3ll * x[i], dp[i]);
	}
	ll ans = (ll)E - (ll)x[n] /*+ (ll)x[1] - 0ll*/ + dp[n];
	printf("%lld\n", ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e18;

signed main(){
	int N,A,B,C;
	cin >> N >> A >> B >> C;
	vector<char>ans;
	int flg = 1;
	vector<string>s(N);
	REP(i,N)cin >> s[i];
	REP(i,N){
		if(s[i] == "AB"){
			if(A == 0 || A < B || (i + 1 != N && A == B && s[i + 1] == "AC")){
				A++;
				B--;
				ans.emplace_back('A');
			}else{
				A--;
				B++;
				ans.emplace_back('B');
			}
		}else if(s[i] == "BC"){
			if(B == 0 || B < C || (i + 1 != N && B == C && s[i + 1] == "AB")){
				B++;
				C--;
				ans.emplace_back('B');
			}else{
				B--;
				C++;
				ans.emplace_back('C');
			}
		}else{
			if(C == 0 || C < A || (i + 1 != N && C == A && s[i + 1] == "BC")){
				C++;
				A--;
				ans.emplace_back('C');
			}else{
				C--;
				A++;
				ans.emplace_back('A');
			}
		}
		if(A < 0 || B < 0 || C < 0)flg = 0;
	}
	if(flg == 0)out("No");
	else{
		out("Yes");
		REP(i,ans.size())out(ans[i]);
	}
}

Measured memory_bytes: 6720
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.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); i++)

int main(){
    string s;
    cin >> s;
    if(s == "Sunny") cout << "Cloudy" << endl;
    if(s == "Cloudy") cout << "Rainy" << endl;
    if(s == "Rainy") cout << "Sunny" << endl;
}

Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(0); 
    cin.tie(0);   
	ll n,a[200009],m,k,ans=0,fl=0;
	string s;
	cin>>s;
	for(int i=0;i<3;i++)
	{
		if(s[i]!=s[0])
			ans=1;
	}
	if(ans==1)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main() {
  int s;
  cin >> s;
  int L = s/100;
  int R = s%100;
  if(L>=1&&L<=12){
    if(R>=1&&R<=12)
      cout << "AMBIGUOUS" << endl;
    else 
        cout << "MMYY" << endl;  
  }else{
     if(R>=1&&R<=12) 
     cout << "YYMM" << endl;  
     else 
     cout << "NA" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
using System.Linq;
using System;

public class P
{
    public  int id { get; set; }
    public int s { get; set; }
}

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            var ps = new P[n];
            for (int i = 0; i < n; i++)
            {
                string[] line = Console.ReadLine().Trim().Split(' ');
                var a = Array.ConvertAll(line, int.Parse);
                ps[i] = new P { id = a[0], s = getScore(a) };
            }
            foreach (var x in ps.OrderByDescending(y =>y.s).ThenBy(y =>y.id))
                Console.WriteLine("{0} {1}",x.id,x.s);
        }
    }
    static int getScore (int[] a)
    {
        var p = 1;  var s = 0;  var f = 1;
        while (true)
        {
            if (f == 10)
            {
                for (int i = p; i < a.Length; i++) s += a[i];
                break;
            }
            else
            {
                if (a[p] == 10) { s += 10 + a[p + 1] + a[p + 2];  p++; }
                else if (a[p] + a[p+ 1] == 10) { s += 10  + a[p + 2]; p+= 2; }
                else { s += a[p] + a[p + 1];  p += 2; }
            }
            f++;
        }
        return s;
    }
}



Measured memory_bytes: 14296
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<functional>
#include<set>
#include<map>
#include<utility>
#define ul unsigned long long int
#define ll long long int
#define MAX 1000000+1
using namespace std;
#define F first
#define S second
#define pi 2*acos(0.0)
#define PB push_back
#define Pp push
#define LSTAGE 1
int arr[200010];
ll bfs(vector<int> a[])
{
    queue<int>v;
    v.push(1);
    int t;
    arr[1] = 0;
    int x;
    while(v.size())
    {
        t = v.front();
        v.pop();
        if(arr[t]==2) return 1;
        for(int i= 0; i < a[t].size(); i++)
        {
            x = a[t][i];
            if(arr[x]==-1)
            {
                v.push(x);
                arr[x] = arr[t]+1;

            }
        }

    }
    return 0;

}


int main()
{
    ll n, m;
    cin >> n >> m;
    for(int i = 1; i <=n; i++)
        arr[i] = -1;
    vector<int> v[n+1];
    int t1, t2;


    for(int i = 0; i < m; i++)
    {
        cin >> t1 >> t2;
        v[t1].PB(t2);
        v[t2].PB(t1);
    }
    bfs(v);
    if(arr[n]==2 || arr[n]==1) cout <<"POSSIBLE";
    else cout <<"IMPOSSIBLE";


    return 0;
}


Measured memory_bytes: 13168
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
char c,s[100100];
int tott,ans,cnt[100100];
int main() {
	c=getchar();
	while (c>='a'&&c<='z') {
		if (c!='x') s[tott++]=c; else cnt[tott]++;
		c=getchar();
		//s[++tots]=c;
	}
	for (int i=0;i*2<=tott;i++) {
		ans+=abs(cnt[i]-cnt[tott-i]);	
		if (s[i]!=s[tott-i-1]) {
			printf("-1");
			return 0;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] d =  new int[n];
        for (int i = 0;i<n;i++) {
            d[i] = sc.nextInt();
        }

        int ans = 0;
        for (int i = 0; i< n;i++) {
            for (int j = i+1; j< n;j++) {
                ans += d[i] * d[j];
            }            
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23252
/*
ID: zhaowei10
TASK:
LANG: C++14
*/
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;

#ifdef LOCAL
#include <debug.h>
#else
#define debug(...) 0
#endif

#define eb emplace_back

using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vc = vector<char>;
using vb = vector<bool>;
using vll = vector<ll>;

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

#ifdef LOCAL
  freopen("test.in", "r", stdin);
  freopen("test.out", "w", stdout);
#else
#endif

  ll a, bi = 0, bd = 0;
  string bs;
  cin >> a >> bs;
  bool found_dec = false;
  for (int i = 0; i < (int)bs.size(); ++i) {
    if (bs[i] == '.') {
      found_dec = true;
      continue;
    }
    if (!found_dec) {
      bi = bi * 10 + bs[i] - '0';
    } else {
      bd = bd * 10 + bs[i] - '0';
    }
  }
  ll b = bi * 100 + bd;
  cout << (a * b) / 100;
}


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

int main()
{

	int  ChangeNum;
	int  WordNum;
	char BeforWord;
	char AfterWord;
	char Word;

	vector< pair< char, char > > vecpChangePair;
	vector< pair< char, char > > :: iterator pIt;
	vector< pair< char, bool > > vecpString;
	vector< pair< char, bool > > :: iterator vIt;

	while( 1 ) {

		cin >> ChangeNum;

		if( ChangeNum == 0 ) break;

		for( int i = 0; i < ChangeNum; i++ ) {

			cin >> BeforWord >> AfterWord;

			vecpChangePair.push_back( pair< char, char >( BeforWord, AfterWord ) );

		}

		cin >> WordNum;

		for( int i = 0; i < WordNum; i++ ) {

			cin >> Word;

			vecpString.push_back( pair< char, bool >( Word, false ) );

		}

		for( vIt = vecpString.begin(); vIt != vecpString.end(); ++vIt ) {

			for( pIt = vecpChangePair.begin(); pIt != vecpChangePair.end(); ++pIt ) {

				if( vIt->first == pIt->first && !vIt->second ) {

					vIt->first = pIt->second;

					vIt->second = true;

				}

			}

		}

		for( vIt = vecpString.begin(); vIt != vecpString.end(); ++ vIt ) {

			cout << vIt->first;

		}

		cout << endl;

		vecpChangePair.clear();
		vecpString.clear();

	}

	return 0;

}

Measured memory_bytes: 1528
s = input()
t = input()

s_set = list(set(s))
t_set = list(set(t))

s_count = [0] * len(s_set)
t_count = [0] * len(t_set)

for i in range(0,len(s_set)) :
    s_count[i] = s.count(s_set[i])

for j in range(0,len(t_set)) :
    t_count[j] = t.count(t_set[j])

s_count.sort()
t_count.sort()

if s_count == t_count :
    print('Yes')
else :
    print('No')

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
 
 
 
void change(char *str){
  int len=strlen(str);
  int i;
  for(i=0;i<len;i++){
    if('a'<=str[i]&&str[i]<='z'){
      str[i]-=32;
    }
  }
}
 
int main(){
  char t[10000];
  char key[10000];
  char eofstr[]={"END_OF_TEXT"};
  int ans=0;
 
  scanf("%s",key);
  change(key);
 
  while(1){
    scanf("%s",t);
    if(strcmp(t,eofstr)==0){
      break;
    }
    change(t);
    if(strcmp(t,key)==0){
      ans++;
    }
  }
 
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 2072
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll a,b,c, k;
    cin >> a >> b >> c >> k;
    if (a+b>=k)
    {
        cout << min(a, k) << endl;
    }
    else
    {
        cout << a - (k-(a+b)) << endl;
    }
    
    
}




Measured memory_bytes: 3644
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

n = int(input())
a = list(map(int,input().split()))

li = [0 for i in range(10**5)]
for i in range(n):
    li[a[i]] += 1

x = 0
for i in range(1,10**5-1):
    x = max(li[i-1]+li[i]+li[i+1],x)

print(x)



Measured memory_bytes: 13964
#include<stdio.h>
#include<math.h>
int main(){
  int n,i,j,l,max,c;
  double x[310],y[310],k,s,t,a,b,e=1e-6;
  while(scanf("%d",&n),n){
    max=1;
    for(i=0;i<n;i++)scanf("%lf,%lf",&x[i],&y[i]);
    for(i=0;i<n;i++){
      for(j=i+1;j<n;j++){
	a=(x[i]-x[j])/2;
	b=(y[i]-y[j])/2;
	if(hypot(a,b)-e>1)continue;
	k=tan(acos(hypot(a,b)));
	s=x[j]+a+k*b;
	t=y[j]+b-k*a;
	for(l=c=0;l<n;l++){
	  if(hypot(x[l]-s,y[l]-t)-e<1)c++;
	}
	if(max<c)max=c;
	s=x[j]+a-k*b;
	t=y[j]+b+k*a;
	for(l=c=0;l<n;l++){
	  if(hypot(x[l]-s,y[l]-t)-e<1)c++;
	}
	if(max<c)max=c;
      }
    }
    printf("%d\n",max);
  }
  return 0;
}

Measured memory_bytes: 724
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int):
    from math import ceil
    print(ceil(N/2))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


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

int main()
{
    int n;
    cin >> n;
    string s[51];
    int count[51][26];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 26; j++){
            count[i][j] = 0;
        }
    }
    for(int i = 0; i < n; i++){
        cin >> s[i];
        int k = s[i].size();
        for(int j = 0; j < k; j++){
            count[i][s[i][j] - 'a']++;
        }
    }
    for(int j = 0; j < 26; j++){
        char alph = 'a' + j;
        int ansj = 100;
        for(int i = 0; i < n; i++){
            ansj = min(ansj, count[i][j]);
        }
        for(int i = 0; i < ansj; i++){
            cout << alph;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define double long double
using namespace std;
double PI = 3.14159265358979;
double per(double ang){
	if (ang < 0) ang += 2*PI;
	return ang;
}
pair<double, double> get(pair<double, double> a, pair<double, double> b){
	pair<double, double> vect = make_pair(b.first - a.first, b.second - a.second);
	pair<double, double> L = make_pair(vect.second, -vect.first);
	pair<double, double> R = make_pair(-vect.second, vect.first);
	double ang1 = atan2(L.second, L.first);
	double ang2 = atan2(R.second, R.first);
	ang1  = per(ang1);
	ang2  = per(ang2);
	return make_pair(ang1, ang2);
}
bool vn(double l, double r, double nv){
    double diff1 = r - l;
    double diff2 = nv - l;
    while (diff1 < 0) diff1+=2*PI;
	while (diff1 >= 2*PI) diff1 -= 2*PI;
	while (diff2 < 0) diff2+=2*PI;
	while (diff2 >= 2*PI) diff2 -= 2*PI;
	if (diff1 >= diff2) return true;
	return false;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	//freopen("1.txt", "r", stdin);
    int n;
    cin >> n;
    vector<pair<int, int> > g;
    for (int i=0; i < n; i++){
		int a, b;
		cin >> a >> b;
		g.push_back(make_pair(a, b));
    }
    cout.precision(20);
    for (int i=0; i < n; i++){
		bool c = false;
		double l, r;
		for (int j=0; j < n; j++){
			if (j==i) continue;
			pair<double, double> v = get(g[i], g[j]);
			if (!c){
				l = v.first, r = v.second;
				c = true;
				continue;
			}
			//cout << l << " " << r << " " << v.first << " " << v.second << endl;
            if (vn(l, r, v.first)){
				l = v.first;
				continue;
            }
            if (vn(l, r, v.second)){
				r = v.second;
				continue;
            }
            double diff = r - v.first;
            while (diff < 0) diff+=2*PI;
            while (diff >= 2*PI) diff -= 2*PI;
            if (diff > PI){
				l = r;
				break;
            }
		}
		double diff1 = r-l;
		while (diff1 < 0) diff1+=2*PI;
		while (diff1 >= 2*PI) diff1 -= 2*PI;
		cout << (diff1) / (2*PI) << endl;
    }
}



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

int K,N;
vector<int> ans;
int main(){
	cin >> K >> N;
	if(K==1){
		for(int i=0;i<(N+1)/2;i++){
			cout << 1 << (i!=(N+1)/2-1? " ":"\n");
		}
		return 0;
	}
	if(K%2==0){
		for(int i=0;i<N;i++){
			if(i==0) cout << K/2 << " ";
			else cout << K << (i!=N-1? " ":"\n");
		}
		return 0;
	}else{
		for(int i=0;i<N;i++){
			ans.push_back((K+1)/2);
		}
		int cnt = N/2,n = ans.size();
		while(cnt>0){
			if(ans[n-1]==1) ans.pop_back();
			else{
				ans[n-1]--;
				while(ans.size()<N) ans.push_back(K);
			}
			cnt--;
			n = ans.size();
		}
		for(int i=0;i<ans.size();i++){
			cout << ans[i] << (i!=(int) ans.size()-1? " ":"\n");
		}
	}
}


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

using namespace std;

list <int> *adj;
bool *visited;
int *path;

void addEdge(int u,int v)
{
	adj[u].push_back(v);
}

void DFS(int u)
{
	visited[u] = true;
	int m1=0,m2 = 0;
	for(auto it = adj[u].begin();it != adj[u].end(); ++it)
	{
		if(visited[*it] == false)
		DFS(*it);
		path[u] = max(path[u],path[*it]+1);
	}
}

int main()
{
	int n,m,len=0;
	scanf("%d%d",&n,&m);
	adj = new list <int> [n];
	visited = new bool[n];
	path = new int[n];
	memset(path,0,sizeof path);
	memset(visited,false,sizeof visited);
	for(int i=0;i<m;++i)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		addEdge(x-1,y-1);
	}
	int v = -1;
	while(++v < n)
	if(visited[v] == false)
	DFS(v);
	for(int i=0;i<n;++i)
	len = max(len,path[i]);
	printf("%d\n",len);
	delete [] adj,path,visited;
	return 0;
}


Measured memory_bytes: 6784
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) assert(type(default_val) ~= 'table') local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
----
local X = read.n()
local c500 = X // 500
local r = X % 500
local c5 = r // 5
local p = c500 * 1000 + c5 * 5
print(p)

Measured memory_bytes: 760
# DP
def main():
    N, W = map(int, input().split())

    dp = [-1] * (W + 1)
    dp[0] = 0
    for _ in range(N):
        w, v = map(int, input().split())
        for i in range(W - w, -1, -1):
            dpi = dp[i]
            if dpi != -1:
                if dp[i + w] < dpi + v:
                    dp[i + w] = dpi + v
    print(max(dp))


main()


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

using namespace std;

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

    cin >> a >> b >> c;

    char t = 'a';
    while (true) {
        if (t == 'a') {
            if (!a.size()) {
                cout << "A";
                break;
            }

            t = a.front();
            a = a.substr(1, a.size() - 1);
        } else if (t == 'b') {
            if (!b.size()) {
                cout << "B";
                break;
            }

            t = b.front();
            b = b.substr(1, b.size() - 1);
        } else if (t == 'c') {
            if (!c.size()) {
                cout << "C";
                break;
            }

            t = c.front();
            c = c.substr(1, c.size() - 1);
        }
    }

    return 0;
}


Measured memory_bytes: 3600
#include <string>
#include <algorithm>
#include <cctype>
#include <iostream>

using namespace std;

int A, B;

string S, c, d;

int main() {

	cin >> A >> B >> S;

	string ans = "No";
	int last = 0;
	int pos = S.find("-");
	if (pos >= 1) {
		c = S.substr(last, pos - last);
		if (A == c.length() && all_of(c.cbegin(), c.cend(), [](char c) {return isdigit(c); }))
		{
			last = pos + 1;
			d = S.substr(last, S.length() - last);
		}
		if (B == d.length() && all_of(d.cbegin(), d.cend(), [](char c) {return isdigit(c); }))
		{

			ans = "Yes";
		}
	}
	cout << ans << endl;

	return 0;
}

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

vector< bool > get_prime(int n){
  vector< bool > prime( n + 1, true);
 
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
 
  for(int i = 2; i * i <= n; i++){
    if(prime[i]){
      for(int j = i + i; j <= n; j += i) prime[j] = false;
    }
  }
 
  return prime;
}

int main() {
  vector< bool > prime = get_prime(10000);
  int m, a, b;
  while(cin >> m >> a >> b, m) {
    int bestA = 0, bestB = 0;
    for(int i = 1; i <= 10000; i++) {
      if(!prime[i]) continue;
      for(int j = i; j <= 10000 && i * j <= m; j++) {
        if(!prime[j]) continue;
        if(a * j > i * b) continue;
        if(bestA * bestB < i * j) {
          bestA = i; bestB = j;
        }
      }
    }
    cout << bestA << " " << bestB << endl;
  }
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<(k) ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=(k) ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef jayinnn
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
const ll MAXN = 100005;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/********** Good Luck :) **********/
int main () {
    TIME(main);
    IOS();
    char a;
    cin >> a;
    if('a' <= a && a <= 'z') cout << "a" << endl;
    else cout << "A" << endl;


    return 0;
}

Measured memory_bytes: 3516
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> A(100), B(100), C(100), D(100);
int answer = 0;

void input() { 
    cin >> N; 
    for(int i = 0; i < N; i++) cin >> A.at(i) >> B.at(i);
    for(int i = 0; i < N; i++) cin >> C.at(i) >> D.at(i);
}

void solve() {
    vector<int> count(N,0);
    int answer = 0;
    
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            if (A.at(i) < C.at(j) && B.at(i) < D.at(j)) count.at(i) = count.at(i) + 1;
        }
    }

    vector<int> used(N, 0);
    for (int i = 1; i <= N; i++) {
        for(int j = 0; j < N; j++) {
            if (count.at(j) == 0) continue;
            if (count.at(j) == i) {
                for (int k = 0; k < N; k++) {
                    if (used.at(k) != 0) continue;
                    if (A.at(j) < C.at(k) && B.at(j) < D.at(k)) {
                        answer++;
                        used.at(k) = 1;
                        break;
                    }
                }
            }
        }
    }
}


int main() {
    input();

    vector<pair<int, int>> blue(N);
    for(int i = 0; i < N; i++) {
        blue.at(i).first = C.at(i);
        blue.at(i).second = D.at(i);
    }
    sort(blue.begin(), blue.end());
    vector<int> used(N, 0);
    for (int i = 0; i < N; i++) {
        int maxRedY = -1;
        int maxRedJ = -1;
        for(int j = 0; j < N; j++){
            if (used.at(j) != 0) continue;
            if (blue.at(i).first > A.at(j) && blue.at(i).second > B.at(j)) {
                if (B.at(j) > maxRedY) maxRedJ = j;
                maxRedY = max(B.at(j), maxRedY);
            }
        }
        if(maxRedJ != -1) {
            answer++;
            used.at(maxRedJ) = 1;
        }
    }

    cout << answer << endl;

    return 0;
}

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

int main(){
  int N; cin >> N;
  vector<int> H(N);
  rep(i, N) cin >> H[i];
  int count = 0; int max = 0;
  
  rep(i, N-1){
    if(H[i] >= H[i+1]){
      count++;
    }
    else{
      count = 0;
    }
    if(max < count) max = count;
  }
  cout << max << endl;
}


Measured memory_bytes: 640
def main():
    N, K = map(int, input().split())
    A = map(int, input().split())
    cnt = {}
    for a in A:
        if a not in cnt:
            cnt[a] = 0
        cnt[a] += 1
    n = max(len(cnt) - K, 0)
    x = list(cnt.values())
    x.sort()
    print(sum(x[:n]))


if __name__ == "__main__":
    main()


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

int main(){
    ll n;
    std::cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    sort(a.begin(),a.end());
    std::cout << a[n-1]-a[0] << std::endl;
}



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

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;

void mainmain(){
  int a,b;
  while(cin>>a>>b,a||b){
    cout<<min(a,b)<<" "<<max(a,b)<<endl;
  }
}



}
main() try{
    mainmain();
}
catch(...){
}

Measured memory_bytes: 1160
//********************************************************************//
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define fi first 
#define se second 
#define RANGE(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define DFOR(i, a, b) for(int i = a; i > b; --i)
#define DEB(x) cout << #x << ": " << x << endl
#define ALL(v) v.begin(), v.end() 
#define SORT(v) sort(ALL(v))
#define DISPV(v) { for(auto x___: v) cout << x___ << " "; cout << endl; }
#define DISPM(m) { for(auto x____: m){ cout << x____.first << ": " << x____.second << endl; } };
#define DISPMV(m) { for(auto x_____: m){ cout << x_____.first << ": " ;DISPV(x_____.second);} };
using LL = long long;
using VI = vector <int>;
using VC = vector <char>;
using VS = vector <string>;
using VL = vector <long long>;
using VVI = vector<VI>;
using VVL = vector <VL>;
using MII = map<int, int>;
using MIVI = map<int, VI>;
using MSS = map<string, string>;
using MLL = map<LL, LL>;
int READ_INT(){int temp;cin>>temp;return temp;}      // read an int
LL READ_LONG(){LL temp;cin>>temp;return temp;}      // read a long long
void mcs(VI &series, int &max_sum){                    // maximum contigous sub sum(kadane)
    int s=0;
    for(auto x: series){
        s += x;
        max_sum = max(max_sum, s);
        if(s < 0)s = 0;
    }
}
template<typename T>
T MAX(T t){ return t;}
template <typename T, typename... Args>
T MAX(T t, Args... args){ return max(t, MAX(args...)); }
const int MOD = int(1e9) + 7;
const int INF = 1e9 + 5;
const double PI = acos(-1.0); //M_PI;
const double EPS = 1e-9;
//********************************************************************//
 
int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    LL a, b, n;
    cin >> a >> b >> n;
    LL x = min(b-1, n);
    LL ans = (a*x)/b;
    cout << ans;

    return 0;
}



/* complie flags
-Wall -Wextra -pedantic -std=c++11 -O2 -Wshadow -Wformat=2 -Wfloat-equal -Wconversion -Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_FORTIFY_SOURCE=2 -fsanitize=address -fsanitize=undefined -fno-sanitize-recover -fstack-protector
*/

Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
using namespace std;
int p[1000], n, k;
int main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++)cin >> p[i];
	for (int i = 1; i <= k; i++) {
		for (int j = 0; j < n - 1; j++) {
			if (p[j] % i > p[j + 1] % i)swap(p[j], p[j + 1]);
		}
	}
	for (int i = 0; i < n; i++)cout << p[i] << endl;
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
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 /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}




int main() {
    char c;
    cin >> c;
    if (isupper(c)) cout << 'A' << endl;
    else cout << 'a' << endl;
    }

Measured memory_bytes: 3628
/********************************************
 *Author*        :ZZZZone
 *Created Time*  : 六  4/21 20:02:37 2018
 * Ended  Time*  : 六  4/21 20:05:28 2018
*********************************************/

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
#define debug(x) std::cerr << #x << " = " << (x) << std::endl
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

int A, B, C;
int x, y;

int main()
{
	scanf("%d %d %d", &A, &B, &C);
	scanf("%d %d", &x, &y);
	int n = 2 * max(x, y);
	LL ans = 1LL << 60;
	for(int i = 0; i <= n; i += 2){
		LL cnt1 = 1LL * max((x-i/2), 0) * A;
		LL cnt2 = 1LL * max((y-i/2), 0) * B;
		LL cnt3 = 1LL * i * C;
		ans = min(ans, cnt1 + cnt2 + cnt3);
	}
	printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Fri Mar  8 01:35:11 2019

@author: yuta
"""
import math

N = int(input())

def main(n):
    x = math.factorial(n)
    max_value = pow(10,9) + 7
    print(x % max_value)

main(N)


Measured memory_bytes: 3980
char*p[]={"Wednes","Thurs","Fri","Satur","Sun","Mon","Tues"};
a[12]={31,29,31,30,31,30,31,31,30,31,30,31},i,m,d;
main(){
    for(;~scanf("%d%d",&m,&d);){
        if(!m)return 0;
        for(i=0;i<m-1;d+=a[i++]);
        printf("%sday\n",p[d%7]);
    }
}

Measured memory_bytes: 1704
// D - Handstand 2
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int N;

ll solve(){
	ll ans=0;
	map<pair<int,int>,int> C;//[{i,j}]<int>=count

	rp(k,1,N+1){
		string s = to_string(k);
		int i = s[0]-'0';
		int j = s[s.size()-1]-'0';
		C[{i,j}]++;
	}

	for(auto m:C){
		int i,j; tie(i,j) = m.first;
		ll cij = m.second;
		ll cji = C[{j,i}];
		ans += cij*cji;
	}

	return ans;
}

int main(){
	cin>>N;
	cout<< solve() <<endl;
}

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

typedef long long ll;

main()
{
    string s;
    cin >> s;
    if(s == "RRR"){
        cout << 3;
    }
    else if(s == "RRS" || s == "SRR"){
        cout << 2;
    }
    else if(s == "SSS"){
        cout << 0;
    }
    else{
        cout << 1;
    }



}





///promy_pompom
//hello world


Measured memory_bytes: 3592
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>
#include <stack>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

ll gcd(ll a, ll b) {
  if (a < b) { swap(a, b); }
  if (b == 0) { return a; }
  return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
  if (a/gcd(a,b) > INF / b) { // a*b/gcd(a,b) > INF. too large
    return INF;
  } else {
    return a / gcd(a,b) * b;
  }
}

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll x;
  cin >> x;
  cout << lcm(x,360)/x << endl;
}


Measured memory_bytes: 3644
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stack>
#include <queue>

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))

typedef std::stack<int> IntStack;
typedef std::queue<int> IntQueue;
 
using namespace std;
  
int main(){
  int N;
  cin >> N;
  int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  sort(A, A+N);
  
  string ans = "YES";
  int n = A[0];
  for(int i=1;i<N;i++){
    if(n == A[i]){
      ans = "NO";
      break;
    }
    n = A[i];
  }
  
  cout << ans << endl;
}

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

// 移動ベクトル
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
int main(){
	int h,w;
	cin >> h >> w;
	vector<string> s(h);
	rep(i,h) cin >> s[i];
	
	ll res = 0;
	queue<P> q;
	vector<vector<bool>> checked(h,vector<bool>(w,false));
	
	rep(i,h){
		rep(j,w){
			ll cnt1 = 0; // "."の数
			ll cnt2 = 0; // "#"の数
			
			if(!checked[i][j]) q.push(P(i,j));
			checked[i][j] = true;
			
			while(!q.empty()){
				P nowp = q.front();
				q.pop();
				//cout << nowp.first << " " << nowp.second << endl;
				
				if(s[nowp.first][nowp.second] == '.'){
					cnt1++;
				}
				else{
					cnt2++;
				}
				
				rep(i,4){
					P nextp = P(nowp.first + dx[i], nowp.second + dy[i]);
					
					if(0 <= nextp.first && nextp.first < h && 
					   0 <= nextp.second && nextp.second < w && 
					   !checked[nextp.first][nextp.second] && 
					   s[nowp.first][nowp.second] != s[nextp.first][nextp.second]){
					   	q.push(nextp);
					   	checked[nextp.first][nextp.second] = true;
					}
				}
			}
			
			res += cnt1 * cnt2;
		}
	}
	
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  ll n;cin>>n;
  vector<ll> p(n+1);
  rep(i,n){
    cin>>p[i];
    p[i]--;
  }
  ll ans=0;
  rep(i,n){
    if(p[i]==i&&p[i+1]==i+1){
      ans++;
      p[i]=-1;
      p[i+1]=-1;
    }else if(p[i]==i){
      ans++;
      p[i]=-1;
    }
  }  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
     
    int main() {
    	int N, K, l[50], i, j, tmp, ans = 0;
    	scanf("%d%d", &N, &K);
    	for (i = 0; i < N; i++) {
    		scanf("%d", &l[i]);
    	}
    	for (i = 0; i < N-1; i++) {
    		for (j = 0; j < N-1; j++) {
    			if (l[j] < l[j + 1]) {
    				tmp = l[j];
    				l[j] = l[j + 1];
    				l[j + 1] = tmp;
    			}
    		}
    	}
    	for (i = 0; i < K; i++) {
    		ans += l[i];
    	}
    	printf("%d",ans);
    	return 0;
    }

Measured memory_bytes: 128
N = input()

odd_list = [i for i in range(len(N)) if i % 2 == 1]
count = 0
for i in range(len(odd_list)):
    count += 10**int(odd_list[i])-10**int(odd_list[i]-1)
if len(N) % 2 == 1:
    count += int(N)+1-10**(len(N)-1)

print(int(count))




Measured memory_bytes: 38256
N=int(input())
K=int(input())
c=list(map(int, input().split()))
l=[K]*N
sub=[]
res=[]
for i in range(0, N):
	sub.append(l[i]-c[i])
	if (sub[i]<=c[i]):
		res.append(2*sub[i])
	else:
		res.append(2*c[i])
print(sum(res))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
using namespace std;

int main() {
	int A;
	cin >> A;
	if (A == 3||A ==5||A==7) {
		cout << "YES" << endl;
	}
	/*else if (A == 24) {
		cout << "Christmas Eve" << endl;
	}
	else if (A == 25) {
		cout << "Christmas" << endl;
	}
	else if (A == 22) {
		cout << "Christmas Eve Eve Eve" << endl;
	}*/
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import Counter

def solve(l):
    d = Counter(l)
    d_max = max(d.values())
    max_d_list = sorted([k[0] for k in d.items() if k[1] == d_max])
    return max_d_list



def main():
    N = int(input())
    l = [input() for _ in range(N)]
    d = solve(l)
    for a in d:
        print(a)
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 38728
unittest
{
	assert( [ "1 3" ].parse.expand.solve == "Yes" );
	assert( [ "2 4" ].parse.expand.solve == "No" );
}



import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto xy = input.front.split.to!( long[] );
	return tuple( xy[ 0 ], xy[ 1 ] );
}

auto solve( long x, long y )
{
	auto xg = 0L;
	if( x == 4 || x == 6 || x == 9 || x == 11 ) xg = 1;
	if( x == 2 ) xg = 2;
	
	auto yg = 0L;
	if( y == 4 || y == 6 || y == 9 || y == 11 ) yg = 1;
	if( y == 2 ) yg = 2;
	
	return ( xg == yg ) ? "Yes" : "No";
}


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


void solve(long long N, std::vector<long long> a){
  long long count = 0;
  for(long long i = 1; i <= N; i++){
    if(i % 2 == 1 && a[i-1] %2 == 1){
      count++;
    }
  }

  cout << count << endl;
}

// Generated by 1.1.7.1 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(){
    long long N;
  scanf("%lld",&N);
  std::vector<long long> a(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&a[i]);
  }
    solve(N, std::move(a));
    return 0;
}


Measured memory_bytes: 3692
#include <iostream>

long long mod_pow(long long x, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) {
      res = res * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

long long mod_inverse(long long x, long long mod) {
  return mod_pow(x, mod - 2, mod);
}

// return nCk % mod
// it takes O(k)
long long mod_comb(long long n, long long k, long long mod) {
  long long numer = 1, denom = 1;
  for (long long i = 0; i < k; i++) {
    numer = numer * ((n - i) % mod) % mod;
    denom = denom * ((i + 1) % mod) % mod;
  }
  return numer * mod_inverse(denom, mod) % mod;
}

int main() {
  const int mod = 1000000007;
  int n, a, b;
  std::cin >> n >> a >> b;

  long long ans = mod_pow(2, n, mod) - 1;
  ans = (ans - mod_comb(n, a, mod)) % mod;
  ans = (ans - mod_comb(n, b, mod)) % mod;
  ans = (ans + mod) % mod;

  std::cout << ans << "\n";

  return 0;
}

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

int main(){
	int a, b; cin>>a>>b;
	if(a == b) cout<<"Draw\n";
	else if(b == 1){
		cout<<"Bob";
	}
	else if(a == 1) cout<<"Alice\n";
	else if(a > b){
		cout<<"Alice\n";
	}
	else cout<<"Bob\n";
}


Measured memory_bytes: 256