akhauriyash/Code-Regression huggingface dataset:
def gcd(a,b):
    while b!=0:
        tmp = b
        b = a%b
        a = tmp
    return a

def lcm(a,b):
    return a*b // gcd(a,b)

N = int(input())
T = [int(input()) for _ in range(N)]
ans = 1
for t in T:
    ans = lcm(ans, t)
print(ans)


Measured memory_bytes: 9088
/*
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

int main()
{
    int n, m;
    long int sum = 0;
    int max = 0;

    std::cin >> n >> m;
    std::vector<int> a(n);
    std::vector<std::pair<int, int>> cb(m);

    for (int i = 0; i < n; i++)
        std::cin >> a[i];

    for (int i = 0; i < m; i++)
    {
        std::cin >> cb[i].second >> cb[i].first;
    }

    std::sort(a.begin(), a.end());
    std::sort(cb.rbegin(), cb.rend());

    auto a_itr = a.begin();
    for (auto cb_itr = cb.begin(); cb_itr < cb.end(); cb_itr++)
    {
        for (int i = 0; i < cb_itr->second; i++)
        {
            if (*a_itr < cb_itr->first)
                *a_itr = cb_itr->first;
            else
                break;

            a_itr++;
        }
    }

    for (int i = 0; i < n; i++)
        sum += a[i];

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

Measured memory_bytes: 1408
def resolve():
    import sys
    input = sys.stdin.readline
    mod = 998244353
    n, k = map(int, input().split())
    dp = [0] * n
    dp[0] = 1
    s = [tuple(map(int, input().split())) for _ in range(k)]
    total = 0
    for i in range(n - 1):
        total = (total + dp[i]) % mod
        for l, r in s:
            if i + l < n:
                dp[i + l] += total
                if i + r + 1 < n:
                    dp[i + r + 1] -= total
    print(dp[-1] % mod)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 69460
#include<stdio.h>
#define W 300
int main(){
    int i,c=0,d=0,j;
    int a[W],b[W];
    for(i=0;i<W;i++){
        scanf("%d",&a[i]);
        scanf("%d",&b[i]);
        if(a[i]==0||b[i]==0)break;
    }
    i=0;
    j=0;
    while(a[c]!=0||b[d]!=0){
    for ( i = 0; i < a[c]; i++ ){
        for ( j = 0; j < b[d]; j++ ){
            if(i>0&&j>0&&i<a[c]-1&&j<b[d]-1){
                printf(".");
            }else{
            printf("#");
            }
        }
        printf("\n");
    }
        printf("\n");
        c++;
        d++;
    }
    
	return 0;
}



Measured memory_bytes: 1992
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n,sum;
int main(){
	scanf("%d",&n);
	for(register int i=1;i<=n;i++){
		for(register int j=1;j<=n;j++){
			for(register int k=1;k<=n;k++){
				sum+=__gcd(__gcd(i,j),k);
			}
		}
	}
	printf("%d\n",sum);
	return 0;
}

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

using namespace std;

int result[100];
int tgt[100];

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

	for (int i = 0; i < m; ++i) cin >> tgt[i];

	for (int i = 0; i < m; ++i) {
		int x = 0;
		for (int j = 0; j < n; ++j) {
			int yosou; cin >> yosou;
			if (yosou == tgt[i]) result[j]++;
			else x++;
		}
		result[tgt[i] - 1] += x;
	}

	for (int i = 0; i < n; ++i) {
		printf("%d\n", result[i]);
	}
}

Measured memory_bytes: 1144
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;

string st;
int now = 0;

string getst(bool isone=false) {
	string genom;
	while (isalpha(st[now])) {
		genom += st[now];
		now++;
		if (isone)break;
	}
	return genom;
}
int getcount() {
	long long int num = 0;
	while (isdigit(st[now])) {
		num = num * 10 + st[now] - '0';
		now++;
	}
	return num;
}

pair<string,char> check(long long int rest,long long int kakeru) {
	if (kakeru > 1e8) {
		kakeru = 1e8;
	}
	long long int num = 1;
	string nst;
	bool isstart = true;
	bool prenum = false;
	while (1) {
		if (nst.size() > rest)return make_pair("",nst[rest]);
		if (st.size() <= now)break;
		if (st[now] == '(') {
			now++;
			pair<string,char>p=check(rest-nst.size(),num);
			if (p.second == '0') {
				nst += p.first;
			}
			else {
				return make_pair("",p.second);
			}
			prenum = false;
			num = 1;
		}
		else if (st[now] == ')') {
			now++;
			break;
		}
		else if(isalpha(st[now])){
			string genom;
			if (!prenum) {
				genom = getst();
			}
			else {
				genom = getst(true);
			}
			if (genom.size()*num > rest) {
				return make_pair("", genom[rest%genom.size()]);
			}
			else {
				//rest -= genom.size()*kakeru*num;
				for (int i = 0; i < num; ++i) {
					nst += genom;
					if (nst.size() > 1e6)break;
				}
			}
			num = 1;
			prenum = false;
		}
		else {
			assert(isdigit(st[now]));
			num = getcount();
			prenum = true;
		}

		isstart = false;
	}
	string finst;
	for (int i = 0; i < kakeru; ++i) {
		finst += nst;
		if (finst.size() > 1e6)break;
	}
	if (finst.size() > rest)return make_pair("",finst[rest]);
	return make_pair(finst, '0');
}
int main() {
	while (1) {
		cin >> st;
		if (st == "0")break;
		now = 0;
		int n; cin >> n;
		pair<int, char>p;
		char ans=check(n,1).second;
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 7136
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }



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

  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  ll ans = 0;
  if (a[0] != 0) {
    cout << -1 << '\n';
    return 0;
  }
  int idx = n;
  FORR(i, n - 1, 1) {
    if (i < idx) {
      if (a[i] > i) {
        cout << -1 << '\n';
        return 0;
      }
      else if (a[i] != 0) {
        idx = i - a[i];
        ans += a[i];
      }
    }
    else {
      if (a[i] < i - idx) {
        cout << -1 << '\n';
        return 0;
      }
      else if (a[i] > i - idx) {
        if (a[i] > i) {
          cout << -1 << '\n';
          return 0;
        }
        idx = i - a[i];
        ans += a[i];
      }
    }
  }
  cout << ans << '\n';






  
  return 0;
}

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

int main() {
    string s; cin >> s;
    int n = s.length();
    int ans = n;

    for (int i = 0; i < n-1; i++) {
        if (s[i] != s[i+1]) {
            // cout << ans << endl;
            ans = min(ans, max(i+1, n-i-1));
            // cout << i << " " << s[i] << " " << s[i+1] << " " <<
            // i+1 << " " << n-i-1 << " " << ans << endl;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
        int h[]=new int[n+1];
        for(int i=1;i<=n;i++)
        h[i]=sc.nextInt();
      
       int dp[]=new int[n+1];
       dp[1]=0;
       for(int i=2;i<=n;i++)
       {
           dp[i]=1000000000;
          for(int j=i-1;j>=1 && (i-j)<=k;j--)
          {
              dp[i]=Math.min(dp[i],dp[j]+Math.abs(h[i]-h[j]));
          }
       }
        System.out.println(dp[n]);        
    }
}

Measured memory_bytes: 52820
#include<iostream>
#include<algorithm>
#include<iomanip>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <new>
#include <cmath>
#include<fstream>
using namespace std;
#define Precision(i) cout << fixed << setprecision(i)
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <long long, long long> pll;
const ll N = 2e5 + 100, MOD = 1e9 + 7, INF = 1e15, SQ = 350, LOG = 20;
ll n, m, x1, x2, d, z , t, sum,y, y2, maxi,mini, ans, ptr, x, q, dp[N], a[N];
int main()  
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = n; ; i++)
	{
		if (i % 10 == (i / 10) % 10 && i % 10 == (i / 100) ) return cout << i, 0;
	}
}

Measured memory_bytes: 256
import math
import sys


(N, M) = list(map(int,input().split()))
# print(N,M)
nwa = 0
nac = 0

ac = [ "" for _ in range(N+1)]
wa = [ 0 for _ in range(N+1)]
for i in range(0,M):
    (x,S)  = input().split()
    p = int(x)
    # print(p,S)
    if ac[p] == "AC":
        continue
    if S == "AC":
        nac = nac + 1
        ac[p] = "AC"
    else:
        wa[p] = wa[p] + 1

# print(ac,wa)
for i in range(1,N+1):
    if ac[i] == "AC":
        nwa = nwa + wa[i]

print(nac,nwa)



Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
int main(){
long long x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> x1 >> y1 >> x2 >> y2;
  if(x1<=x2 and y1<=y2){
    x3=x2-abs(y2-y1);
    y3=y2+abs(x2-x1);
    x4=x1-abs(y2-y1);
    y4=y1+abs(x2-x1);
  }else if(x1<=x2 and y1>=y2){
    x3=x2+abs(y2-y1);
    y3=y2+abs(x2-x1);
    x4=x1+abs(y2-y1);
    y4=y1+abs(x2-x1);
  }else if(x1>=x2 and y1<=y2){
    x3=x2-abs(y1-y2);
    y3=y2-abs(x2-x1);
    x4=x1-abs(y2-y1);
    y4=y1-abs(x2-x1);
  }else if(x1>=x2 and y1>=y2){
    x3=x2+abs(y2-y1);
    y3=y2-abs(x2-x1);
    x4=x1+abs(y2-y1);
    y4=y1-abs(x2-x1);
  }
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
  return 0;
}

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

namespace ABC056C
{
    class Program
    {
        static void Main(string[] args)
        {
            new Solver().Solve();
        }
    }

    class Solver
    {
        long X;

        public void Solve()
        {
            // キャスト前の値以上の整数なら条件を満たす.
            int ans = (int)((-1.0 + Math.Sqrt(1 + 8 * X)) / 2.0);

            // 条件を満たすときtrueを返す.
            Func<int, bool> check = t => t * t + t - 2 * X >= 0;
            if (!check(ans))
            {
                ans++;
            }
            Console.WriteLine(ans);
        }

        public Solver()
        {
            X = ReadLong();
        }

        static String ReadString() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static String[] ReadStringArray() { return Console.ReadLine().Split(' '); }
        static int[] ReadIntArray() { return Console.ReadLine().Split(' ').Select(e => int.Parse(e)).ToArray(); }
        static long[] ReadLongArray() { return Console.ReadLine().Split(' ').Select(e => long.Parse(e)).ToArray(); }
        static double[] ReadDoubleArray() { return Console.ReadLine().Split(' ').Select(e => double.Parse(e)).ToArray(); }
    }

}


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

using namespace std;

int main() {
  //input
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  //solve
  int ans = 0;
  while(true){
    bool OK = true;
    for (int i = 0; i < n; i++){
      if (a[i] % 2 == 0){
        a[i] /= 2;
      }else{
        OK = false;
        break;
      }
    }
    if(OK){
      ans ++;
    }else{
      break;
    }
  }
  
  //output
  cout << ans << endl;
}


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

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP(x) cerr << #x << " = " << (x) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent=false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);

template<typename T = int> inline T in() { T x; cin >> x; return x; }
template<typename T = int> inline vector<T> in(int n) { vector<T> xs(n); rep(i, n) cin >> xs[i]; return xs; }
template<typename T = int> inline vector<vector<T>> in(int n, int m) { vector<vector<T>> xs(n, vector<T>(m)); rep(i, n) rep(j, m) cin >> xs[i][j]; return xs; }

int main(void) {
    int N = in();
    VI as = in(N);
    rep(i, N) --as[i];

    int cnt = 0;
    rep(a, N) {
        int b = as[a];
        int c = as[b];
        if (a == c && a < b) {
            ++cnt;
        }
    }

    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <unordered_map>

using namespace std;

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

#define ri(a) scanf("%d", &a)
#define rii(a,b) scanf("%d %d", &a, &b)
#define riii(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define rl(a) scanf("%lld", &a)
#define rll(a,b) scanf("%lld %lld", &a, &b)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define ROF(i,n,m) for(int i=n; i>m; i--)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second

const int INF = 0x3f3f3f3f;
const ll LLINF = 1e18;
const int maxN = 1e5; // CAMBIAR ESTE

// GJNM
char s[4];

int main() {
	scanf("%s", s);
	if ( s[0] == 'R' && s[1] == 'R' && s[2] == 'R' ) {
		printf("3\n");
	}
	else if ( (s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R')) {
		printf("2\n");
	}
	else if ( s[0] == 'R' || s[1] == 'R' || s[2] == 'R' ){
		printf("1\n");
	}
	else{
		printf("0\n");
	}

	return 0;
}

Measured memory_bytes: 3760
import numpy as np
nums=np.array([list(map(int, input().split())) for i in range(3)])

out='Yes'
a_1=nums[1, :]-nums[0, :]
if a_1[0]!=a_1[1] or a_1[0]!=a_1[2]:
  out='No'
  
a_2=nums[2, :]-nums[1, :]
if a_2[0]!=a_2[1] or a_2[0]!=a_2[2]:
  out='No'
  
b_1=nums[:, 1]-nums[:, 0]
if b_1[0]!=b_1[1] or b_1[0]!=b_1[2]:
  out='No'
  
b_2=nums[:, 2]-nums[:, 1]
if b_2[0]!=b_2[1] or b_2[0]!=b_2[2]:
  out='No'
  
print(out)

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

using namespace std;

int n,m,k,cnt;
string s;
vector <char> v;

int main (){
	cin >> n;
	cin >> s;
	for (int i = 0; i < s.size(); i++){
		int r;
		r = (int)(s[i]);
		v.push_back(r);
		r = 0;
	}
	for (int i = 0; i < v.size(); i++){
		v[i] += n;
		if(v[i] > 90){
			v[i] -= 26;
		}
	}
	for (int i = 0; i < v.size(); i++){
		cout << (char)(v[i]);
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
string a,b;
int main(){
    cin>>a>>b;
    if(a<b){
        cout<<"<";
    }else if(a==b){
        cout<<"=";
    }else{
        cout<<">";
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		float now = sc.nextFloat();
		float will = sc.nextFloat();

		will = will * 2;
		float res = will - now;
		System.out.println((int)res);
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    int N;
    cin >> N;
    vl A(N);
    in(N,A);
    sort(all(A));
    reverse(all(A));
    
    ll ans = 0;
    ans = A[0];
    queue<ll> B;
    B.push(A[1]);
    reps(i,2,N){
        ll aa = B.front();
        B.pop();
        ans += aa;
        B.push(A[i]);
        if(i!=N-1){
            ans += aa;
            i++;
            B.push(A[i]);
        }
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5540
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<algorithm>
#include<deque>
#include<queue>
#include<set>
#include<map>
#include<functional>

using namespace std;
#define LL long long
#define LLBIG 1999999999999999999
#define INTBIG 1111111111
#define PI pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>


int main() {
	string s; cin >> s;
	int ans = 0, tmp = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G') {
			tmp++; ans = max(tmp, ans);
		}
		else tmp = 0;
	}
	cout << ans;

	return 0;
}

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

#define mp make_pair
#define pb push_back

#define int int64_t

const int MOD = 1e9+7;
 
int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

 	int n;
 	cin>>n;
 	long double x[n];
 	long double y[n];
 	for(int i=0;i<n;i++)
 		cin>>x[i]>>y[i];

 	int arr[n];
 	for(int i=0;i<n;i++)
 	{
 		arr[i]=i;
 	}
 	long double ans=0;
 	do {
 		for(int i=1;i<n;i++)
 		{
 			//cout<<sqrt((x[arr[i]]-x[arr[i-1]])*(x[arr[i]]-x[arr[i-1]])+(y[arr[i]]-y[arr[i-1]])*(y[arr[i]]-y[arr[i-1]]))<<"\n";
 			ans+=sqrt((x[arr[i]]-x[arr[i-1]])*(x[arr[i]]-x[arr[i-1]])+(y[arr[i]]-y[arr[i-1]])*(y[arr[i]]-y[arr[i-1]]));
 		}
 	}
 	while(next_permutation(arr,arr+n));
 	long double fact=1;
 	for(int i=1;i<=n;i++)
 		fact*=i;
 	//cout<<ans<<"\n";
 	cout<<setprecision(17)<<ans/fact;

	return 0;
}

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

public class Hello{
    public static void Main(){
        // Your code here!
        int n = int.Parse(Console.ReadLine());
        int ans = 0;
        ans = n + n * n;
        ans = ans + n * n * n;
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 17540
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

ll n, a, b;
vector<ll> c;

bool check(ll k){
	ll cnt = 0;
	rep(i, n){
		ll d = c[i]-k*b;
		if(d>0) cnt += (d+a-1)/a;
	}
	return cnt<=k;
}

int main(){
	cin>>n>>a>>b;
	a -= b;
	c = vector<ll>(n);
	rep(i, n) cin>>c[i];
	sort(all(c));
	ll lb = 0, ub = 1e9; //(lb, ub]
	while(ub-lb>1){
		ll md = (ub+lb+1)/2;
		if(check(md)) ub = md;
		else lb = md;
	}
	cout<<ub<<endl;
	return 0;
}


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

using namespace std;

int n,m, x,y,a;
vector<int> vecx, vecy;
int main() {
	cin >> n >> m >> x >> y;
	for (int i = 0; i < n; i++) {
		cin >> a;
		vecx.push_back(a);
	}
	sort(vecx.begin(), vecx.end());
	for (int i = 0; i < m; i++) {
		cin >> a;
		vecy.push_back(a);
	}
	sort(vecy.begin(), vecy.end());
	for (int i = vecx[n - 1]+1; i <= vecy[0]; i++) {
		if (x < i&&i <= y) {
			cout << "No War" << '\n';
			return 0;
		}
	}
	cout << "War" << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int n;
	cin >> n;
	vector<int> A(n);
	rep(i,n)cin>>A[i];
	vector<int> anss;
	sort(ALL(A));
	stack<int> nS,pS;
	nS.push(A[0]);
	pS.push(A[A.size()-1]);
	for(int i=1;i<n-1;i++)
	{
		if(A[i]<0)nS.push(A[i]);
		else pS.push(A[i]);
	}
	int ans=-A[0];
	for(int i=1;i<n-1;i++)ans+=abs(A[i]);
	ans+=A[n-1];
	cout<<ans<<endl;
	while(pS.size()!=1)
	{
		cout<<nS.top()<<" "<<pS.top()<<endl;
		nS.top()-=pS.top();
		pS.pop();
	}
	while(!nS.empty())
	{
		cout<<pS.top()<<' '<<nS.top()<<endl;
		pS.top()-=nS.top();
		nS.pop();
	}


	return 0;
}

Measured memory_bytes: 2636
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
//long long num[100000];
int main(){
	int x,a,b;
	cin>>x>>a>>b;
	if(abs(x-a)>abs(x-b)) cout<<"B"<<endl;
	else cout<<"A"<<endl;
	return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll N;
  cin >> N;
  vector<ll> v(N);
  rep(i,N)
    cin>>v[i];

  ll ans = 0;
  rep(i,N)
    for (ll j=i+1; j<N; j++) {
      ans += v[i]*v[j];
    }
  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;
using ll = long long;
using P = pair<ll,ll>;

int main() {
  ll n, m, cnt = 0, ans = 0; cin >> n >> m;
  vector<P> d(n); rep(i, n) cin >> d[i].first >> d[i].second;
  sort(d.begin(), d.end());
  rep(i, n) {
    if (cnt + d[i].second <= m) {
      cnt += d[i].second;
      ans += d[i].first * d[i].second;
    }
    else {
      ans += d[i].first * (m - cnt);
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
def lin(x,y):
    return np.sqrt(sum((x-y)**2))

from itertools import combinations as cb
n,d = map(int,input().split())
import numpy as np

x=[]
for i in range(n):
    x.append(np.array(list(map(int,input().split()))))

cnt = 0
for a,b in cb(range(n),2):
    #print(x[a],x[b])
    if lin(x[a],x[b]).is_integer():
        cnt += 1

print(cnt)

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    if(s < t) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define print(a) cout << a << "\n"
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

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

  int N, A, B, C, X;
  int r[10001];
  int y[10001];


  while(true) {
    cin >> N >> A >> B >> C >> X;
    if(N + A + B + C + X == 0){
      break;
    }
    r[0] = X;
    REP(i, 10000) {
      r[i + 1] = (A * r[i] + B) % C;
    }

    REP(i, N) {
      cin >> y[i];
    }

    int n = 0;
    REP(i, N) {
      if(n == -1) {
        break;
      }
      while (true) {
        // if(y[i + 1] == y[i]) {
        //   n++;
        // }
        if(y[i] == r[n]) {
          n++;
          break;
        }

        if(n > 10000) {
          n = -1;
          break;
        }
        n++;
      }
    }
    if(n == -1){
      cout << n << endl;
    } else {
      cout << --n << endl;
    }

  }
  return 0;
}



Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n;
    cin >> n;
    vi t(n),x(n),y(n);
    rep(i,n){
        cin >> t[i] >> x[i] >> y[i];
    }
    bool ok = true;
    if(n==1 && (t[0] < x[0] + y[0] || t[0]%2 - (x[0]+y[0])%2!=0)){
        ok = false;
    }
    vi c(n-1);
    vi d(n-1);
    rep(i,n-1){
        c[i] = t[i+1] - t[i];
        d[i] = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
    }
    
    rep(i,n-1){
        if((c[i]%2 - d[i]%2)!=0 || c[i] < d[i] ){
            ok = false;
            break;
        }
    }
    cout << (ok? "Yes": "No") << endl;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,sum; cin>>n>>k;
  vector<int> v(n); sum=0;
  for(int i=0;i<n;i++) cin>>v[i];
  sort(v.begin(),v.end());
  for(int i=0;i<k;i++) sum=sum+v[i];
  cout<<sum;
  return 0;
}


Measured memory_bytes: 3600
Q = int(input())
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]], is_prime

primes_num, is_primes = primes(10**5+5)
sums = []
cnt = 0

for i in range(0, 10**5+4):
    if i % 2 != 0:
        a = (i+1) // 2
        if is_primes[i] and is_primes[a]:
            cnt += 1

    sums.append(cnt)

for i in range(Q):
    l, r = map(int, input().split())
    print(sums[r]-sums[l-1])


Measured memory_bytes: 11388
/*
Dont BLUNDER
*/

// #pragma GCC optimize("O3")
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimization ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include<climits>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
#include <chrono>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;


 */
//#define d long double
#define int long long
#define pii pair<int,int>
#define pb push_back
#define endl '\n'
#define pi acos(-1)

#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
int const mod1 = 998244353;
int const mod = 1000000007;
#define bitcount(x)       __builtin_popcountll(x)
#define l first
#define r second
const int inf = LLONG_MAX;
int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define haha ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// * Using PBDS *
/*typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
               os; */

struct cmp
{
	bool operator() (pii a, pii b) {
		return (a.l < b.l);
	}
};

int modexp(int x, int n) {
	if (n == 0) {
		return 1;
	}
	else if (n & 1) {
		return (modexp((x * x) % mod, n / 2) % mod * x % mod) % mod;
	}
	else {
		return (modexp((x * x) % mod, n / 2) % mod);
	}
}

int modinv(int n)
{
	return modexp(n, mod - 2);
}

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





signed main()
{
	haha
#ifndef ONLINE_JUDGE

	freopen("inp.txt", "r", stdin);

	freopen("out1.txt", "w", stdout);
#endif
	int n, x, md;
	cin >> n >> x >> md;
	vector<int> v;
	int ind = 0;
	map<int, int> m;
	int ans = 0;
	// m[x] = ind++;
	// v.pb(x);
	// ind++;
	for (int i = 0; i < n; i++) {
		ans += x;
		//x = (x * x) % md;
		if (m.find(x) != m.end()) {

			int tind = m[x];
			int r = n - i  ;
			int tsz = ind - tind  ;
			int compcycles = r / tsz;
			int rem = r % tsz;
			int totsum = 0;
			int remsum = 0;
			int con = 0;
			for (int i = tind; i < ind; i++) {
				totsum += v[i];
				if (con < rem) {
					con++;
					remsum += v[i];
				}

			}
			ans += (compcycles * totsum);
			ans += remsum;
			ans -= x;
			break;

		}
		else {
			m[x] = ind++;
			v.pb(x);
		}
		x = (x * x) % md;



	}
	cout << ans;








}


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

int main() {
  int N;
  cin >> N;
  double N2;
  double ans;
  N2=N*1.0;
  if (N%2==0) ans=0.5;
  else ans=(((N2-1)/2)+1)/N2;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>
#include <stack>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define rep(i, a, N) for(int i = a; i < N; i++)
#define rrep(i, a, N) for(int i = a; i >= N; i--)

int main() {
    int n, k;
    cin >> n >> k;
    cout << floor(log(n)/log(k)) + 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[1000], mask[1000];
int n, m, b, dp[1000][1 << 12];

int f(int k, int m)
{
    if (k == ::m)
    {
        if (m == (1 << n) - 1)
            return 0;
        return 1e9;
    }
    if (dp[k][m] != -1)
        return dp[k][m];
    return dp[k][m] = min(f(k + 1, m),
                          a[k] + f(k + 1, m | mask[k]));
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        cin >> a[i] >> b;
        for (int j = 0; j < b; ++j)
        {
            int c;
            cin >> c;
            mask[i] |= (1 << (c - 1));
        }
    }
    memset(dp, -1, sizeof dp);
    if (f(0, 0) >= 1e9)
        cout << -1;
    else
        cout << dp[0][0];
}


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

int main(){
  int n; cin >> n;
  int nums[100][3][10];
  int b, f, r, v, m=0;

  for(int i=0; i<100; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<10; k++){
        nums[i][j][k]=0;
      }
    }
  }

  for(int i=0; i<n; i++){
    cin >> b >> f >> r >> v;
    m=max(m, b);
    nums[b-1][f-1][r-1] += v;
  }

  for(int i=0; i<4; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<10; k++){
        cout << " " << nums[i][j][k];
      }
      cout << endl;
    }
    if(i==3) break;
    for(int l=0; l<20; l++) cout << '#';
    cout << endl;
  }



  return 0;
}



Measured memory_bytes: 3108
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.trim().split('\n');

var line;
while (line = lines.shift()) {
    var w = +line;

    var c;

    if (w <= 48) c = 'light fly';
    else if (w <= 51) c = 'fly';
    else if (w <= 54) c = 'bantam';
    else if (w <= 57) c = 'feather';
    else if (w <= 60) c = 'light';
    else if (w <= 64) c = 'light welter';
    else if (w <= 69) c = 'welter';
    else if (w <= 75) c = 'light middle';
    else if (w <= 81) c = 'middle';
    else if (w <= 91) c = 'light heavy';
    else c = 'heavy';

    console.log(c);
}

Measured memory_bytes: 7640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#define ll long long

using namespace std;
const int maxn = 100001;

inline int read() {
    int x = 0, f = 1; char ch = getchar();
    for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = -1;
    for(; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
    return x * f;
}

void write(int x) {
    if(x < 0) {putchar('-'); write(-x); return ;}
    if(x > 9) write(x / 10);
    putchar(x % 10 + '0');
    return ;
}

int n, a[101], m, ans = 0;

int main() {
    n = read(); m = n << 1;
    for(int i = 1; i <= m; ++i) a[i] = read();
    sort(a + 1, a + 1 + m);
    for(int i = 1; i <= m - 1; i += 2) ans += a[i];
    write(ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static final int MODULUS = 1_000_000_007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        System.out.println(solve(n, k));

        sc.close();
    }

    static int solve(int n, int k) {
        int[][][] wayNums = new int[n + 1][n + 1][k + 1];
        wayNums[0][0][0] = 1;
        for (int i = 1; i <= n; ++i) {
            for (int j = 0; j <= n; ++j) {
                for (int p = 0; p <= k; ++p) {
                    wayNums[i][j][p] = addMod(
                            addMod(multiplyMod(2 * j + 1, getWayNum(wayNums, i - 1, j, p - 2 * j)),
                                    multiplyMod((j + 1) * (j + 1), getWayNum(wayNums, i - 1, j + 1, p - 2 * j))),
                            getWayNum(wayNums, i - 1, j - 1, p - 2 * j));
                }
            }
        }

        return wayNums[n][0][k];
    }

    static int getWayNum(int[][][] wayNums, int seenNum, int unpairNum, int oddness) {
        int n = wayNums.length - 1;

        return (unpairNum == -1 || unpairNum == n + 1 || oddness < 0) ? 0 : wayNums[seenNum][unpairNum][oddness];
    }

    static int addMod(int x, int y) {
        return (x + y) % MODULUS;
    }

    static int multiplyMod(int x, int y) {
        return (int) ((long) x * y % MODULUS);
    }
}

Measured memory_bytes: 67968
import heapq
x, y, z, k = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
Q = []
heapq.heappush(Q, (-(A[0]+B[0]+C[0]), 0, 0, 0))
for _ in range(k):
  m, i, j, k = heapq.heappop(Q)
  print(-m)
  if i+1<x:
    a = A[i+1]+B[j]+C[k]
  if j+1<y:
    b = A[i]+B[j+1]+C[k]
  if k+1<z:
    c = A[i]+B[j]+C[k+1]
  if i+1<x and (-a, i+1, j, k) not in Q:
    heapq.heappush(Q, (-a, i+1, j, k))
  if j+1<y and (-b, i, j+1, k) not in Q:
    heapq.heappush(Q, (-b, i, j+1, k))
  if k+1<z and (-c, i, j, k+1) not in Q:
    heapq.heappush(Q, (-c, i, j, k+1))

Measured memory_bytes: 3828
from bisect import bisect_left
from bisect import bisect_right
n = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

total = 0
for b in B:
  total += bisect_left(A, b) * (n - bisect_right(C, b))
print(total)
                             

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

//#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(ba))

signed main() {
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    
    sort(ALL(s));
    
    rep(i,n) cout << s[i];
    cout << endl;
}

Measured memory_bytes: 256
def main():
    N = int(input())

    def trans(x, y):
        r = ""
        k = ""
        while not(x==y==0):
            r += str(x%6)
            x = x//6
            k += str(y%9)
            y = y//9
        return r,k

    cost = N
    for i in range(N+1):
        roku, kyu = trans(i, N-i)
        cost_i = 0
        for j in range(len(roku)):
            cost_i += int(roku[j]) + int(kyu[j])
        cost = min(cost, cost_i)

    return cost

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


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

int main()
{
    long N, ptr=0, res=0;
    cin >> N;
    vector<long> a(N);
    for (long i = 0; i < N;i++){
        cin >> a.at(i);
    }

    sort(a.begin(), a.end());

    while(ptr<N){
        int tmp = a.at(ptr), f = 0;
        while(ptr<N && a.at(ptr)==tmp){
            f++;
            ptr++;

        }
        res += f % 2;
    }

    cout << res << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

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

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; }
const int INF = 1001001001;
const long long INFLL = LLONG_MAX / 3;
const double eps = (1e-9);

set<ll> enum_divisor(ll m) {
  set<ll> divisors;
  for (ll i = 1; i*i <= m; ++i) {
    if (m % i != 0) continue;
    divisors.insert(i);
    if (i * i != m) divisors.insert(m / i);
  }
  return divisors;
}

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

  ll n, m;
  cin >> n >> m;

  ll mx = m / n;
  set<ll> divisors = enum_divisor(m);
  for (auto itr = divisors.rbegin(); itr != divisors.rend(); itr++) {
    if (*itr <= mx) {
      cout << *itr << endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (a < b)
        cout << "a < b" << endl;
    else if (a > b)
        cout << "a > b" << endl;
    else
        cout << "a == b" << endl;
    return 0;
}

Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
using namespace std;
typedef long long LL;
LL a,b,ans;
int main(){
	cin>>a>>b;
	if(a==b) ans=0;
	else if(a==0){
		if(b>0) ans=b-a;
		else ans=-b+1;
	}
	else if(b==0){
		if(a<0) ans=b-a;
		else ans=a+1;
	}
	else if(a<0&&b<0){
		if(a<b) ans=b-a;
		else ans=a-b+2;
	}	
	else if(a>0&&b>0){
		if(a<b) ans=b-a;
		else ans=a-b+2;
	}
	else if(a>0&&b<0){
		ans=abs(a+b)+1;
	}
	else if(a<0&&b>0){
		ans=abs(a+b)+1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}


ll f[200001],rf[200001];

ll inv(ll x){
	ll ret=1;
	ll k=mod-2;
	ll y=x;
	while(k){
		if(k&1) ret=(ret*y)%mod;
		y=(y*y)%mod;
		k/=2;
	}
	return ret;
}

void init(){
	f[0]=1;
	for(int i=1;i<=200000;++i) f[i]=(f[i-1]*i)%mod;
	rep(i,200001) rf[i]=inv(f[i]);
}

ll calc(int n,int k){
	ll a=f[n];
	ll b=rf[n-k];
	ll c=rf[k];
	ll bc=(b*c)%mod;
	return (a*bc)%mod;
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h,w,a,b;cin >> h >> w >> a >> b;
	init();
	ll ans = 0;
	for(int i = b; i <= w; i++){
		ans += calc((h - a - 1) + i, i) * calc(a - 1 + (w - i - 1), w - i - 1) % mod;
		ans %= mod;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, k;
  	cin >> n >> k;
  	
   	vector<int> prices;
  	for(int i = 0; i < n; i++){
    	int a;
      	cin >> a;
      	prices.push_back(a);
    }
  
  	sort(prices.begin(), prices.end());
    int total = 0;
  	for(int i = 0; i < k; i++){
    	total += prices[i];
    }
  
  	cout << total;
}

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

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

    if (a<=0 and b>=0 or a==0 or b==0)
        cout<<"Zero"<<endl;
    else if (a>0 or (b>0 and a%2==0) or (a-b)%2)
        cout<<"Positive"<<endl;
    else
        cout<<"Negative"<<endl;
}


Measured memory_bytes: 256
def main
    n = gets.chomp.to_i
    t = [0]
    x = [0]
    y = [0]
    
    n.times do |i|
        t_,x_,y_ = gets.chomp.split(" ").map(&:to_i)
        t.push t_
        x.push x_
        y.push y_
    end

    n.times do |i|
        dx = (x[i+1] - x[i]).abs
        dy = (y[i+1] - y[i]).abs
        dt = (t[i+1] - t[i]).abs

        if ((dx+dy > dt) || ((dt-(dx+dy)).odd?))
            puts "No"
            return
        end
    end
    puts "Yes"
end

main

Measured memory_bytes: 4208
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <limits.h>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    ll sum = 0;
    cin >> n;
    vector<ll> b(n);

    for (int i = 0; i < n - 1; i++)
    {
        cin >> b[i];
    }

    for (int i = 1; i < n - 1; i++)
    {
        sum += min(b[i - 1], b[i]);
    }
    sum += b[n - 2] + b[0];
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#define INF 1000000000

using namespace std;

typedef long long ll;

int n, m;

int main()
{
	cin >> n >> m;
	vector<int> a;
	vector<int> c;
	for (int i = 0; i < m; i++) {
		int ai, bi;
		cin >> ai >> bi;
		a.push_back(ai);
		int ci = 0;
		for (int j = 0; j < bi; j++) {
			int cij;
			cin >> cij;
			ci += 1 << (cij - 1);
		}
		c.push_back(ci);
	}

	int d = 1 << n;
	vector<ll> memo;
	
	memo.resize(d,INF);
	memo[0] = 0;
	for (int i = 0; i < m; i++)
	{
		for (int j = 0; j < d; j++) {
			int x = j | c[i];
			memo[x] = min(memo[x], memo[j] + a[i]);
		}
	}
	if (memo[d - 1] == INF) {
		cout << "-1" << endl;
	}
	else {
		cout << memo[d - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
using namespace std;
const int maxn = 100050;
typedef long long ll;
priority_queue<int>pq;

int a[200];
int main()
{
   int n;
   cin>>n;

    for(int i=0;i<n;i++)
        cin>>a[i];
        sort(a,a+n);
        cout<<a[n-1] - a[0]<<endl;

    return 0;
}


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

LL BMPow(int x,int n,int m=0){
    LL ans=1;LL p=x;
    if(m==0){ while(n>0){if(n&1==1){ans*=p;} p*=p; n>>=1;}}
    else{ while(n>0){if(n&1==1){ans=(ans*p)%m;} p=(p*p)%m ;n>>=1;}}
    return ans;
}

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

    double p = 0;
    REP(i,n){
        int tokuten = i+1;
        int cnt = 0;
        while(tokuten<k){
            tokuten *= 2;
            cnt++;
        }
        // cout<<i+1<<" "<<cnt<<" "<<1.0/BMPow(2,cnt)<<endl;
        p += 1.0/BMPow(2,cnt);
    }

    cout<<fixed<<setprecision(15)<<p*(1./n)<<endl;

    return 0;
}

Measured memory_bytes: 256
N,A,B,C= list(map(int,input().split()))
l=[]
Inf=float("Inf")
for i in range(N):l.append(int(input()))
def Answer(cnt,a,b,c):
   if cnt==N:
      return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else Inf
   pt1=Answer(cnt+1,a,b,c)
   pt2=Answer(cnt+1,a+l[cnt],b,c)+10
   pt3=Answer(cnt+1,a,b+l[cnt],c)+10
   pt4=Answer(cnt+1,a,b,c+l[cnt])+10
   return(min(pt1,pt2,pt3,pt4))
print(Answer(0,0,0,0))

Measured memory_bytes: 9036