akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

const LL MOD = 1000000007;

int memo[300001];

void solve(long long N, std::vector<long long> A){
    LL ans = 0;
    for(LL i=0; i<60; i++) {
        REP(j, N+1) memo[j] = 0;
        REP(j, N) {
            if(A[j]&(1LL<<i)) {
                memo[j+1] = memo[j] + 1;
            } else {
                memo[j+1] = memo[j];
            }
            // cout << "memo[" << (j+1) << "]: " << memo[j+1] << endl;
        }

        LL add = (1LL<<i) % MOD;
        // cout << add << endl;
        for(LL j=N-1; j>=1; j--) {
            if(A[j]&(1LL<<i)) {
                // cout << "t i=" << i << " j=" << j << " add=" << add << " A[j]=" << A[j] << endl;
                ans += (add * (j-memo[j]));
            } else {
                //cout << "f i=" << i << " j=" << j << " add=" << add << " A[j]=" << A[j] << endl;
                ans += (add * memo[j]);
            }
            ans %= MOD;
            // cout << "ans: " << ans << endl;
        }

        // cout << "i=" << i << " ans:" << ans << endl;
    }

    cout << ans << endl;
}

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: 3712
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {

        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            var ls = new List<Rest>();
            for (int i = 0; i < n; i++)
            {
                string[] s = ReadLine().Split(' ');
                ls.Add(
                    new Rest(s[0],int.Parse(s[1]),i+1)
                    );
            }
            foreach (var item in ls.OrderBy(x => x.Name).ThenByDescending(y => y.Point))
            {
                WriteLine(item.Id);
            }
        }
    }

    class Rest
    {
        public Rest(string name, int point,int id)
        {
            Name = name;
            Point = point;
            Id = id;
        }

        public string Name { get; set; }
        public int Point { get; set; }
        public int Id { get; set; }
    }
}


Measured memory_bytes: 13536
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <list>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <iterator> 
#include <limits>

#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define ALL(a) (a).begin(),(a).end()
#define RALL(A) (a).rbegin(),(a).rend()
#define PB push_back
#define MP make_pair

#define dump(x) cerr << #x << " = " << (x) << endl;

using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define MAX_E 1000000
#define MAX_V 200000

struct edge {int u, v, cost; };
edge  es[MAX_E];
int V, E;

// Kruscal uses union-find tree
int par[MAX_V];
int uf_rank[MAX_V];

void init_union_find(int v) {
    for (int i = 0; i < v; i++) {
        par[i] = i;
        uf_rank[i] = 0;
    }
}

int find(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = find(par[x]);
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) {
        return;
    }
    if (uf_rank[x] < uf_rank[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (uf_rank[x] == uf_rank[y]) {
            uf_rank[x]++;
        }
    }
}

bool same(int x, int y) {
    return find(x) == find(y);
}

bool comp(const edge& e1, const edge& e2) {
    return e1.cost < e2.cost;
}

LL kruscal() {
    sort(es, es + E, comp);
    init_union_find(V);
    LL res = 0;
    for (int i = 0; i < E; i++) {
        edge e = es[i];
        if (!same(e.u, e.v)) {
            unite(e.u, e.v);
            res += e.cost;
        }
    }
    return res;
}

int N;
VI X;
VI Y;

struct point_tx {
    int id;
    int x;

    bool operator<( const point_tx& right ) const {
        return x < right.x;
    }
};

struct point_ty {
   int id;
   int y;

    bool operator<( const point_ty& right ) const {
        return y < right.y;
    }
};

int main(int argc, char const* argv[])
{
    cin >> N;
    vector<point_tx> tx_lst;
    vector<point_ty> ty_lst;
    REP(i, N) {
        V += 1;
        int x, y;
        cin >> x >> y;
        point_tx px = point_tx{i, x};
        point_ty py = point_ty{i, y};
        tx_lst.PB(px);
        ty_lst.PB(py);
    }
    sort(ALL(tx_lst));
    sort(ALL(ty_lst));
    int edge_ind = 0;
    REP(i, N - 1) {
        edge e = edge{tx_lst[i].id, tx_lst[i + 1].id, tx_lst[i + 1].x - tx_lst[i].x};
        es[edge_ind++] = e;
        E += 1;
    }
    REP(i, N - 1) {
        edge e = edge{ty_lst[i].id, ty_lst[i + 1].id, ty_lst[i + 1].y - ty_lst[i].y};
        es[edge_ind++] = e;
        E += 1;
    }
    LL ans = kruscal();
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5356
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  int count = 0;
  string str;
  
  cin >> N;
  cin >> str;
  
  for (int i = 0; i < N; i++)
    if (str.at(i) == 'A' && i < 48)
      if (str.at(i+1) == 'B')
        if (str.at(i+2) == 'C')
          count++;
  cout << count;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
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;
}
int main() {
  cout << fixed << setprecision(10);
  ll n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n){
    cin >> a.at(i);
    a.at(i)--;
  }

  vector<int> b;
  b.push_back(0);
  int i = 0;
  vector<int> dist(n,-1);
  dist.at(0)=0;
  int ans;
  while(true){
    int tmp = a.at(b.back());
    i++;
    if(dist.at(tmp)!=-1){
      ans = dist.at(tmp);
      break;
    }
    dist.at(tmp)=i;
    b.push_back(tmp);
  }
  if(k<=ans){
    cout << b.at(k)+1 << endl;
  }else{
    cout << b.at(ans+((k-ans)%(i-ans)))+1 << endl;
  }
}


Measured memory_bytes: 5800
#include <stdio.h>
#define N 100
#define WHITE 0
#define BLACK 1
#define INF 100000
 
int n,m[N][N];
 
int min(){
  int color[N],d[N],p[N],i,j,min,u,sum=0;
  for(i = 0;i < n;i++){
    d[i] = 2001;
    p[i] = -1;
    color[i] = WHITE;
  } 

  d[0] = 0;
  while(1){
    min = 2001;
    for(i = 0;i < n;i++){
      if(min > d[i] && color[i] != BLACK){
    u =i;
    min = d[i];
      }
    }
    if(min == 2001) break;
    color[u] = BLACK;
    for(j = 0;j < n;j++){
      if(color[j] != BLACK){
    if(d[j] > m[u][j] && m[u][j] != -1){
      d[j] = m[u][j];
      p[j] = u;
    }
      }
    }
  }
  for(i = 0; i < n;i++){
    if(p[i] != -1){
      sum += m[i][p[i]];
    }
  }
  return sum;
 
}
 
int main(){
  int i,j;
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      scanf("%d",&m[i][j]);
    }
  }
  printf("%d\n",min());
  return 0;
}

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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
const ll mod = 1e9+7;


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

	int n;
	cin >>n;
	VI a(n);
	rep(i,n) cin>>a[i];
	sort(all(a));
	
	int ck[]={0,400,800,1200,1600,2000,2400,2800,3200,999999};
	
	VI rk(10);
	rep(i,n){
		rep(j,10){
			if(ck[j]<=a[i] && a[i] < ck[j+1]){ rk[j]++; break;}
		}
	}
	
	
	ll ans=0;
	rep(i,8) if(rk[i] != 0) ans++;
	
	cout << max(1LL,ans) << " " << ans + rk[8] <<"\n";
	return 0;
}




Measured memory_bytes: 256
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        int L=ni();
        double dexp=((float)L*L*L/27.0);
        System.out.printf("%f\n", dexp);
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = true;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-->0) {process();}
        out.flush();out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 21076
s = []
p = []
a = i = 0
for c in input():
	if c == "\\":
		s += [i]
	elif c == "/" and s:
		j = s.pop()
		t = i-j
		a += t
		while p and p[-1][0] > j:
			t += p[-1][1]
			p.pop()
		p += [(j,t)]
	i += 1

print(a)
if p:
	print(len(p),*list(zip(*p))[1])
else:
	print(0)



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

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

Measured memory_bytes: 3516
N = int(input().rstrip("\n"))

print(0)
left_s = input().rstrip("\n")
if left_s == "Vacant":
    exit()
print(N-1)
right_s = input().rstrip("\n")
if right_s == "Vacant":
    exit()

even = left_s
odd = "Male" if even == "Female" else "Female"

right = N-1
left = 0
while right - left > 1:
    mid = (right + left) // 2
    print(mid)
    s = input().rstrip("\n")

    if s == "Vacant":
        exit()
    
    if mid % 2 == 0:
        if even == s:
            left = mid
        else:
            right = mid
    else:
        if odd == s:
            left = mid
        else:
            right = mid

print(left)
s = input().rstrip("\n")
if s == "Vacant":
    exit()
print(right)
s = input().rstrip("\n")
if s == "Vacant":
    exit()

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 200005;
int N, K;
int A[MAX_N];
int sumA[MAX_N];
vector<int> vecs;

signed main()
{
  cin >> N >> K;

  int kans = 0;

  REP(n,N) {
    cin >> A[n];
    sumA[n+1] = (sumA[n] + A[n] + K - 1) % K;
    if(A[n] == 1) {
      kans++;
    }
  }

  if(K == 1) {
    cout << kans << endl;
    return 0;
  }

  map<int, int> S;
  int s = 0;
  REP(n,min(N,K-1)) {
    s += (A[n] + K - 1);
    s %= K;
    S[s]++;
    vecs.push_back(s);
  }

  int ans = 0;
  int ss = 0;
  REP(n,N) {
    if(n>0) {
      S[vecs[n-1]]--;
      if(n+K-1 <= N) {
        vecs.push_back(sumA[n+K-1]);
        S[sumA[n+K-1]]++;
      }
    }
    
    ans += S[(K+ss)%K];
    ss += (vecs[n]+K-ss)%K;
    ss %= K;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 17392
from copy import deepcopy  

H, W = map(int, input().split())
S = [list(input()) for i in range(H)]
ans = 0
queue = [[1,0],[-1,0],[0,1],[0,-1]]

def now(n,s):
    t = []
    for i in queue:
        j = n[0] + i[0]
        k = n[1] + i[1]
        if 0 <= j < H and 0 <= k < W:
            if s[j][k] == ".":
                t.append([j,k])
                s[j][k] = "#"
    return [t,s]
        

def bfs(trust, a, s):
    t = []
    for i in trust:
        tt, s = now(i,s)
        t += tt
    if len(t) == 0:
        return a
    else:
        a = a + 1
        return bfs(t, a, s)


for i in range(H):
    for j in range(W):
        s = deepcopy(S)
        if S[i][j] == ".":
            s[i][j] = "#"
            ans = max(ans, bfs([[i,j]], 0, s))
print(ans)

Measured memory_bytes: 9272
import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda: list(map(int, input().strip().split()))

# MOD = 10**9 + 7
def main():
	MAXN = 1000001
	spf = [0 for i in range(MAXN)] 
	# sett = set()
	def sieve(): 
		spf[1] = 1
		for i in range(2, MAXN):  
			spf[i] = i 

		for i in range(4, MAXN, 2): 
			spf[i] = 2

		for i in range(3, ceil(sqrt(MAXN))): 
			
			if (spf[i] == i): 
				
				for j in range(i * i, MAXN, i): 
					
					if (spf[j] == j): 
						spf[j] = i
	sieve()
	n = int(input()); arr = read()
	gcd_ = arr[0]
	check = [0]*(10**6 +1)
	f1 = 0; f2 = 1
	for i in arr:
		gcd_ = gcd(gcd_, i)
		# x = i
		ret = []
		flag = 1
		while (i != 1):
			if check[spf[i]]:# in sett:
				flag = 0
			ret.append(spf[i]) 
			i = i // spf[i]
		for j in ret:check[j] = 1
		# sett = sett.union(ret)
		# print(x, flag)
		f1 += flag; f2 &= flag

	# print(sett)

	if f2:print("pairwise coprime")
	elif gcd_ == 1:print("setwise coprime")
	else:print("not coprime")



	



if __name__ == "__main__":
	main()


Measured memory_bytes: 195128
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;
typedef long long ll;

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

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int H,A;
  cin>>H>>A;
  cout<<(H+A-1)/A<<endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, x, y;
  cin >> n >> x >> y;
  vector<int> l(n-1, 0);
  for(int i=0; i<n-1; i++){
    for(int j=i+1; j<n; j++){
      int l1=j-i-1;
      int l2=abs(x-i-1)+abs(y-j-1);
      l[min(l1, l2)]++;
    }
  }
  for(int i=0; i<n-1; i++){
    cout << l[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cstdio>
using namespace std;

inline int getint()
{
    int x = 0, c = getchar();
    while (c > 47 && c < 58)
    {
        x = x * 10 + c - 48;
        c = getchar();
    }
    return x;
}

constexpr int MAX = 300000;
constexpr int mask = (1 << 20) - 1;
long bomb[MAX];
long pos[MAX];

int main()
{
    int H = getint();
    int W = getint();
    int M = getint();

    int h;
    long w;
    int ans, x, y;
    int mxr = 0;
    int mxc = 0;
    int ctrow = 0;
    int ctcol = 0;
    for (int i = 0; i < M; ++i)
    {
        h = getint() - 1, w = getint() - 1;
        bomb[i] = h + (w << 20);
        ++pos[h], pos[w] += 1 << 20;

        x = pos[h] & mask;
        y = pos[w] >> 20;

        if (x == mxr) ++ctrow;
        else if (x > mxr) mxr = x, ctrow = 1;

        if (y == mxc) ++ctcol;
        else if(y > mxc) mxc = y, ctcol = 1;
    }
    ans = mxr + mxc;

    long ct = ctrow;
    ct *= ctcol;
    if (ct > M)
    {
        printf("%d\n", ans);
        return 0;
    }

    for (int i = 0; i < M; ++i) ct -= ((pos[bomb[i] & mask] & mask) == mxr) && ((pos[bomb[i] >> 20] >> 20) == mxc);
    printf("%d\n", ans - (ct <= 0));
    return 0;
}


Measured memory_bytes: 6288
#include <iostream>

using namespace std;

typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    ll n, m;
    cin >> n >> m;
    if(n>m) swap(n, m);
    if(n==1)
    {
        if(m==1)
            cout << m << endl;
        else
            cout << m-2 << endl;
    }
    else
        cout << (n-2)*(m-2) << endl;
    return 0;
}


Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val s, t = sc.next()
  val a, b = sc.nextInt()
  val u = sc.next()
  var num_s = -1
  var num_t = -1
  if (s==u) {
    num_s = a - 1
    num_t = b
  } else {
    num_s = a
    num_t = b - 1
  }
  println(s"$num_s $num_t")
}


Measured memory_bytes: 25648
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
int main()
{
    IOS
     // freopen("input.txt","r",stdin);
     // freopen("output.txt","w",stdout);
     // freopen("error.txt","w",stderr);
     ll n;
     cin>>n;
     ll lps[n+1]={0};
     ll pw[n+1]={0};
     for(ll i=2;i<=n;i++)
     {
        if(lps[i]==0)
        {
            lps[i]=i;
            pw[i]=1;
            for(ll j=2*i;j<=n;j+=i)
            {
                if(lps[j]==0)
                {
                    lps[j]=i;
                    ll temp=j;
                    while(temp%i==0)
                    {
                        pw[j]++;
                        temp/=i;
                    }
                }
            }
        }
     }
     ll dp[n+1]={0};
     dp[1]=1;
     ll sum=1;
     for(ll i=2;i<=n;i++)
     {
        if(lps[i]==i)
        {
            dp[i]=2;
        }
        else
        {
            ll par = i/lps[i];
            ll pwc = pw[i];
            ll pwp = pw[par];
            dp[i]=dp[par];
            if(lps[par]==lps[i])
                dp[i]/=(pwp+1);
            dp[i]*=(pwc+1);
        }
       // cout<<i<<" "<<dp[i]<<endl;
        sum+=i*dp[i];
     }
     cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 238028
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}


string bina(ll i,ll x){
    string ans="";
    while(i>0){
        if(i%2==1){
            ans='1'+ans;
            i=i/2;
        }else{
            ans='0'+ans;
            i=i/2;
        }
    }
    while(ans.size()<x){
        ans='0'+ans;
    }
    return ans;
}

ll bi(string i){
    ll c=1;
    ll ans=0;
    for(ll j=i.size()-1;j>=0;j--){
        if(i[j]=='1'){
            ans=ans+c;
        }
        c=c*2;
    }
    return ans;
}

ll hpow(ll x,ll y){
    ll ans=1;
    ll i=x;
    if(y==0)return 1;
    while(y>0){
        if(y%2==1){
            ans=(ans*i)%a7;
        }
        i=(i*i)%a7;
        y=y/2;
        
    }
    return ans;
}

ll c[62];
int main(){
    ll n;cin>>n;
    ll a[n];
    string s[n];
    rep(i,0,n-1){
        cin>>a[i];
        s[i]=bina(a[i],62);
        reverse(s[i].begin(),s[i].end());
        rep(j,0,61){
            if(s[i][j]=='1'){
                c[j]++;
            }
        }
    }
    ll ans=0;
    ll d;
    rep(i,0,61){
        d=(c[i]*(n-c[i]))%a7;
        d=(d*hpow(2,i))%a7;
        ans=ans+d;
        ans=ans%a7;
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 33024
#include <iostream>

using namespace std;

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

    string S;

    cin >> S;
    ((S[2] == S[3]) and (S[4] == S[5])) ? cout << "Yes\n" : cout << "No\n";

    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);
		while (sc.hasNext()) {
			double a = sc.nextDouble(), b = sc.nextDouble(), c = sc.nextDouble(), d = sc.nextDouble(), e = sc.nextDouble(), f = sc.nextDouble();
			double y = (c * d - a * f) / (b * d - a * e), x = (c * e - b * f) / (a * e - b * d);
			if (Math.abs(x) <= 0.0005) x = 0;
			if (Math.abs(y) <= 0.0005) y = 0;
			System.out.printf("%.3f %.3f\n", x, y);
		}
		sc.close();
	}
}


Measured memory_bytes: 28420
#include "bits/stdc++.h"
#define rep(i,N) for(int (i) = 0;(i) < (N); (i)++)
int main(){
    std::cin.tie(nullptr);std::ios::sync_with_stdio(false);

    int N;std::cin>>N;std::vector<int> d(N);
    rep(i,N)std::cin>>d[i];
    std::sort(d.begin(),d.end());

    int ans = d[N/2] - d[N/2 - 1];
    std::cout<<ans;

    return 0;
}


Measured memory_bytes: 640
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int k,x;
  cin >> k >> x;

  if(k * 500 >= x) cout << "Yes";
  else cout << "No";

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
//#pragma GCC target ("avx2,sse2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree <pair <ll, int>, null_type, less <pair <ll, int> >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long
#define ull unsigned long long
#define db double
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define fi first
#define se second
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define endl "\n"

#define left fsdsdfoisf
#define sum dpsdfioppsf
#define assign xcvjlkdjfio
#define trie fksdfkjkfnjuiv
#define next sidlfjsfkl
#define merge sdfksdkfsldf

//#define int long long

using namespace std;

void dout() {
    cerr << endl;
}
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;

const int N = 107, K = 1e5 + 7;
int n, k, a[N], dp[K];

void solve(int tc) {
    // check for (int i = 0; i < n; j++)
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= n; j++) {
            if (a[j] > i) {
                continue;
            }
            dp[i] |= (1 - dp[i - a[j]]);
        }
    }
    if (dp[k]) {
        cout << "First";
    }   else {
        cout << "Second";
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int tc = 1;
//    cin >> tc;
    for (int i = 0; i < tc; i++) {
        solve(i);
//        cleanup();
    }
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
#define double long double
#define vi vector<int>
#define vpi vector<pair<int,int> >
#define mii map<int,int>
#define mpi map<pair<int,int>,int>
#define msi map<string,int>
#define set set<int>
#define u_set unordered_set<int>
#define pb push_back
#define endl "\n"
#define ll long long int
#define vll vector<long long int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define umap unordered_map 
#define mod 1000000007
#define fori(a,n) for(int i=a;i<n;i++)
#define forj(a,n) for(int j=a;j<n;j++)
#define MAX 300303
#define V vector
using namespace std;
double dp[301][301][301];
int n;
double rec(int one,int two,int three){
    if(one ==0 && two == 0 && three == 0)return 0;
    if(dp[one][two][three] != 0)return dp[one][two][three];
    dp[one][two][three] = n/(double)(one+two+three);
    if(one>0)
    dp[one][two][three] += (one/(double)(one+two+three))*(rec(one-1,two,three));
    if(two>0)
    dp[one][two][three] += (two/(double)(one+two+three))*(rec(one+1,two-1,three));
    if(three > 0)
    dp[one][two][three] += (three/(double)(one+two+three))*(rec(one,two+1,three-1));
    return dp[one][two][three];
}

signed main()
{
    io
    cin >> n;
    vi sus(n);
    int one =0 ,two = 0, three = 0;
    fori(0,n){cin >> sus[i]; 
        if(sus[i]  == 1)one++;
        else if(sus[i] == 2)two++;
        else three++;
    }
    cout << setprecision(11) << rec(one,two,three) << endl;

} 

Measured memory_bytes: 426240
#include<cstdio>
int N,A[100010];
int gcd(int a,int b){return b?gcd(b,a%b):a;}
bool calc(){
	bool s=0;
	int o=0;
	for(int i=0;i<N;i++)if(A[i]%2)o++;
	if(!o){
		for(int i=0;i<N;i++)A[i]/=2;
		return calc();
	}
	if(o==1&&N%2==1){
		int g=0;
		for(int i=0;i<N;i++)g=gcd(g,A[i]);
		for(int i=0;i<N;i++){
			if(A[i]==g)return 0;
			if(A[i]%2)A[i]-=g;
		}
		return!calc();
	}
	for(int i=0;i<N;i++)s^=(A[i]+1)%2;
	return s;
}
int main(){
	scanf("%d",&N);
	for(int i=0;i<N;i++)scanf("%d",A+i);
	puts(calc()?"First":"Second");
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a);i < (b);++i)
#define FORR(i, b, a) for (int i = (b) - 1;i >= 0;--i)
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = (n) - 1;i >= 0;--i)
#define ITER(itr, v) for(auto itr = v.begin();itr != v.end();++itr)
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int a, b, x;
	cin >> a >> b >> x;
	double res;
	if (2 * x < a * a * b) res = atan(a * b * b / 2.0 / x);
	else res = atan(2.0 / a / a / a * (a * a * b - x));
	cout << fixed << setprecision(10) << res * 45 / atan(1) << endl;

	return 0;
}

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

#define ll long long 

ll n,k,w;
const ll N = 105;
//ll a[100005];
//ll dp[100005];
const ll Inf = 1e10;

ll ht[2][N];
const ll W = 100005;
ll dp[N][W];

ll maxValue(ll item, ll weightleft){
	if(item == n)return 0;
  	
  	if(weightleft > w)return 0;
  		
  	if(dp[item][weightleft] != -1){
    	return dp[item][weightleft];
    }
  	//2 choices to choose this item or to not chose this item
    //1 choose this item
  	auto ans1 = 0LL;
  	if(weightleft + ht[0][item] <= w)
    	ans1 = ht[1][item] + maxValue(item+1,weightleft+ht[0][item]);
  
  	//2 not choose this item
  	auto ans2 = maxValue(item+1,weightleft);
  
  	return dp[item][weightleft] = max(ans1,ans2);
}

int main(){
  	
	cin >> n >> w;
  	for(int i = 0; i < n; i++){
    	cin >> ht[0][i] >> ht[1][i];
    }
	
  	for(int i = 0; i < n+1; i++){
    	for(int j = 0; j < w+1; j++){
        	dp[i][j] = -1;
        }
    }
  
	cout << maxValue(0,0) << endl;  	
    return 0;
}


Measured memory_bytes: 82504
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
std::random_device rd;
std::mt19937 mt(rd());
constexpr int MOD = 1e9 + 7; constexpr int MAX = 200020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e16;
typedef array<int, 3>arr3;

int dp[100010];
void solve() {
	int N, M; cin >> N >> M;
	vector<int>A(M);
	REP(i, M)cin >> A[i];
	REP(i, M) {
		dp[A[i]] = -1;
	}
	dp[0] = 1;
	REP(i, N) {
		if (dp[i] == -1)continue;
		if (dp[i + 1] != -1) {
			dp[i + 1] += dp[i];
			dp[i + 1] %= MOD;
		}
		if (dp[i + 2] != -1) {
			dp[i + 2] += dp[i];
			dp[i + 2] %= MOD;
		}
	}
	print(dp[N]%MOD);
}

signed main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
		solve();
}



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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{
    string S;
    cin >> S;

    if((S[0] == S[1]) && (S[1] == S[2])) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter
import java.math.BigDecimal
import java.util.*

val pw = PrintWriter(System.out)
val sc = Scanner(System.`in`)

fun main(args: Array<String>) {
    val n = sc.nextInt()
    val d = sc.nextLong()
    abc100b(n, d)
}

fun abc100b(n:Int, d:Long) {
    var ans = 0L
    when(n){
        0 -> {
            if(d==100L){
                ans = 101L
            }else{
                ans = d
            }
        }

        1 -> {
            if(d==100L){
                ans = 10100L
            }else{
                ans = d * 100L
            }
        }

        2 -> {
            if(d==100L){
                ans = 101L * 10000L
            }else{
                ans = d * 10000L
            }
        }
    }
    println(ans)
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextListOfString() = next().split(" ")
fun nextListOfInt() = nextListOfString().map { it.toInt() }
fun nextListOfLong() = nextListOfString().map { it.toLong() }
fun nextListOfDouble() = nextListOfString().map { it.toDouble() }



Measured memory_bytes: 31144
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<stack>
using namespace std;
int a[55],b[55];
int n;
bool ok()
{
    int p=0;
    for(int i=1;i<=n;i++){
        if(a[i]!=b[i]){
            p=1;
            break;
        }
    }
    if(p==0){
        return true;
    }
    return false;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        b[i]=a[i];
    }
    sort(b+1,b+1+n);
    int flag=0;
    if(ok()){
        flag=1;
    }
    for(int i=1;i<n;i++){
        for(int j=i+1;j<=n;j++){
            if(a[i]>a[j]){
                int temp=a[i];
                a[i]=a[j];
                a[j]=temp;
                if(ok()){
                    flag=1;
                    break;
                }
                int tem=a[i];
                a[i]=a[j];
                a[j]=tem;
            }
        }
        if(flag==1){
            break;
        }
    }
    if(flag==1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int BASE = 998244353;

int n;
string s;
map<int, int> m;

long long solve(int len)
{
  long long v = 0;
  for (int i = 0; i < len; i++)
    v = (v * 2 + s[i] - '0') % BASE;

  int isGood = 1;
  for (int i = len; i < n; i++)
  {
    int x = s[i % len] - '0';
    if (i / len % 2)
      x ^= 1;
    if (x == s[i] - '0')
      continue;
    if (x > s[i] - '0')
      isGood = 0;
    break;
  }

  v = (v + isGood) % BASE;
  long long res = 0;
  for (auto u : m)
    if (len % u.first == 0)
      v = (v - u.second + BASE) % BASE;

  m[len] = v;
  res = (res + 2LL * v * len) % BASE;
  return res;
}

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

  cin >> n >> s;
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    if (n % i == 0 && n / i % 2)
      ans = (ans + solve(i)) % BASE;
  cout << ans << endl;
}


Measured memory_bytes: 720
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(ReadLine());
        }

        public static long[] Reads()
        {
            return ReadLine().Split().Select(long.Parse).ToArray();
        }

        
         public static long gcd(long x, long y)
        {
            if (x < y) gcd(y, x);
            while (y != 0)
            {
                var z = x;
                x = y;
                y = z % y;
            }
            return x;
        }

        public static long lcm(long x, long y)
        {
            return x * y / gcd(x, y);
        } 

        public static long C(long n, long k)
        {
            long x = 1;
            for (long i = 1; i <= k; i++)
            {
                x *= n - i + 1;
                x /= i;
            }
            return x;
        }

         public static int UpperBound<T>(T[] a, T v)
        {
            return UpperBound(a, v, Comparer<T>.Default);
        }

        public static int UpperBound<T>(T[] a,T v,Comparer<T> cmp)
        {
            var l = 0;
            var r = a.Length - 1;
            while (l <= r)
            {
                var mid = l + (r - 1) / 2;
                var res = cmp.Compare(a[mid], v);
                if (res <= 0) l = mid + 1;
                else r = mid - 1;
            }
            return l;
        }

       
        public static int LowerBound(long[] a, long v)
        {
            var l = -1;
            var r = a.Length;
            while (r-l>1)
            {
                var mid = (l + r) / 2;          
                if (a[mid]>=v) r = mid;
                else l = mid;
            }
            return r;
        }


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

            var n = Read();
            var l = Reads();
            Array.Sort(l); 
            long ans = 0;
            for (int i = 0; i < n - 2; i++)
            {
                for (int j = i + 1; j < n-1; j++)
                {
                    ans += LowerBound(l, l[i] + l[j]) - j - 1;
                
                }
            }
           
            WriteLine(ans);

            

            Out.Flush();
        }
    }
}


Measured memory_bytes: 19688
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

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

    rep(i, 1, 1e3 + 1) {
        int r = X - 100 * i;
        if (0 <= r && r <= 5 * i) {
            write(1);
            return 0;
        }
    }

    write(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>
#include <iterator>
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<int,int> pii;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int MAXN = 2e5+50;
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define f first
#define s second
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define rep0(i,l,r) for(int i=l;i<r;++i
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }

int solve(){
    int n;
    cin>>n;
    vector<int> vec(n);
    for(int i=0;i<n;++i)
         cin>>vec[i];
    set<int> st;
    for(int i=0;i<vec.size();++i){
         if(st.find(vec[i])==st.end()){
             st.insert(vec[i]);
         }
         else
            return 1;
         
  
    }
    return 0;
    
          
}
int main(){
 
   ios::sync_with_stdio(false);
  cin.tie(0);
     if(solve()==1)
        cout<<"NO"<<endl;
     else
        cout<<"YES"<<endl;
}

Measured memory_bytes: 13392
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    ll h, w;
    cin >> h >> w;
    
    ll ans = h*w;
    ans = (ans + 1) / 2;

    if (h == 1 || w == 1) ans = 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        for(int i = 1; i < -~n; i++) {
            if(i % 3 == 0) {
                System.out.print(" " + i);
            } else {
                for(int x = i; x > 0; x /= 10) {
                    if(x % 10 == 3) {
                        System.out.print(" " + i);
                        break;
                    }
                }
            }
        }
        System.out.println();
    }
}

Measured memory_bytes: 24276
// C - Vacation
#include <bits/stdc++.h>
using namespace std;
// void abcprn(int a, int b, int c){printf("%4d,%4d,%4d\n",a,b,c);}

int main(){
	int N; cin>>N;
	int a,b,c; cin>>a>>b>>c;
	// cout<<"dp:a    b    c\n";//
	// abcprn(a,b,c);//
	for(int n=1; n<N; n++){
		int pa=a, pb=b, pc=c;
		cin>>a>>b>>c;
		a += max(pb, pc);
		b += max(pc, pa);
		c += max(pa, pb);
		// abcprn(a,b,c);//
	}
	cout<< max({a, b, c}) <<endl;
}

Measured memory_bytes: 384
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
diffs = [X[i+1] - X[i] for i in range(M-1)]
diffs.sort()
# print(diffs)
if not N == 1:
    print(sum(diffs[:-N+1]))
else:
    print(sum(diffs))

Measured memory_bytes: 13960
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////

void solve() {
	LL X, Y;
	cin >> X >> Y;
	int ans = 1;
	while (X < Y) {
		X = X*2;
		if (X <= Y) {
			++ans;
		}
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
		
		System.out.println(z + " " + x + " " + y);
	}

}


Measured memory_bytes: 22996
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll s=0, h, n;std::cin >> h >> n;
  vll a(n);
  re(i, n){
    std::cin >> a[i];
    s += a[i];
  }
  if(s>=h) std::cout << "Yes" << '\n';
  else std::cout << "No" << '\n';
  return 0;
}


Measured memory_bytes: 1024