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

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}

lint P(lint n, lint k) {
  if(k == 1) { return n; }
  return (n*(P(n-1,k-1)%1000000007)%1000000007);
}


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

  vector<lint> b(n+1), c(n+1);
  b[n] = a[n];
  c[0] = 1LL;

  for(lint i=n-1;i>=0;i--) { b[i] = b[i+1]+a[i]; } // b
  for(lint i=1;i<=n;i++) { c[i] = min((c[i-1]-a[i-1])*2,(lint)1000000000000000); } // max leaf

  lint ans=0LL;
  for(lint i=0;i<=n;i++) {
    if(a[i] > c[i]) {
      cout << "-1\n";
      return 0;
    }

    ans += min(lint(b[i]),lint(c[i]));
  } // ans

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

Measured memory_bytes: 5576
#include <iostream>
#include <string>

using namespace std;

int dp[200001][2];
string s;

int main(){
  cin >> s;
  int L = s.size();

  for(int i = L - 1;i >= 0;--i){
    if(i == L - 1)
      dp[i][0] = -300000;
    else
      dp[i][0] = 1 + dp[i + 2][1];

    dp[i][1] = 1 + max(dp[i + 1][s[i + 1] == s[i]? 0 : 1], dp[i + 2][1]);
  }

  cout << dp[0][1] << endl;

  return 0;
}


Measured memory_bytes: 2180
#include<iostream>
#include <cstdio>
#include<cstring>
#include <cstdlib>  
#include<cmath>   
#include <cctype>
#include<string>
#include<set>
#include <iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility>
#define LEN 100005
using namespace std;
using ll = long long;
double pi() { return 3.14; }
int sum(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
ll LGCD(ll x, ll y) {if (x % y == 0) return y;else return LGCD(y, x % y);}
ll LLCM(ll x, ll y) {return x * y / LGCD(x, y);}

int GCD(int x, int y) {if (x % y == 0) return y;else return GCD(y, x % y);}
int LCM(int x, int y) {return x * y / GCD(x, y);}
ll dp[10000][10000];
ll combination(ll n, ll r) {
         if (n == r){dp[n][n] = 1;}
	else if (r == 0) {return dp[n][0] = 1;}
	else if (r == 1) {return dp[n][1]=n;}
	else {dp[n][r]=dp[n - 1][r - 1] % 1000000007 + dp[n - 1][r] % 1000000007;
	return dp[n][r]=combination(n - 1, r - 1) % 1000000007 + combination(n - 1, r) % 1000000007;}
}
int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A == B && B == C) cout << "No" << endl;
	else if (A != B && B != C && C != A)cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import copy
N = int(input())
a = [input() for i in range(N)]
a = list(map(int, a))
max_a = sub_max_a = max(a)
count = 0
for i in range(N):
    if max_a == a[i]:
        count += 1
        max_i = i
if count == 1:
    a.pop(max_i)
    sub_max_a = max(a)

for j in range(N):
    if max_i == j:
        print(sub_max_a)
    else:
        print(max_a)
    



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

int main(){
	
	string s ;
	
	while(1){
		getline( cin , s ) ;
		if( s == "END OF INPUT" ) break ;
		
		int ans = 0 ;
		for( int i=0 ; i<s.size() ; i++ ){
			if( s[i] == ' ' ){
				cout << ans ;
				ans = 0 ;
			}else ans++ ;
		}
		if( ans != 0 ) cout << ans ;
		cout << endl ;
	}
	
return 0 ;
}

Measured memory_bytes: 1184
import itertools
N, M = map(int, input().split())
edges = {tuple(sorted(map(int, input().split()))) for _ in range(M)}
answer = 0
for pattern in itertools.permutations(range(2, N+1), N-1):
    l = [1] + list(pattern)
    answer += sum(1 for edge in zip(l, l[1:]) if tuple(sorted(edge)) in edges)==N-1
print(answer)    

Measured memory_bytes: 3064
import std.stdio;

int[] r = [0, 0, 0, 0, 255, 255, 255, 255];
int[] g = [0, 0, 255, 255, 0, 0, 255, 255];
int[] b = [0, 255, 0, 255, 0, 255, 0, 255];
string[] name = ["black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"];

void main(){
	string s;
	int ans, n, t; 
	while (s = readln(), s != "0\n") {
		n = int.max;
		foreach (i; 0..8) {
			t = (r[i] - toInt(s[1..3]))^^2 + (g[i] - toInt(s[3..5]))^^2 + (b[i] - toInt(s[5..7]))^^2;
			if (n > t) {
				n = t;
				ans = i;
			}
		}
		writeln(name[ans]);
	}
}

int toInt(string str){
	int x, y;
	x = str[0] > '9' ? str[0] - 'a' + 10 : str[0] - '0';
	y = str[1] > '9' ? str[1] - 'a' + 10 : str[1] - '0';
	return x*16+y;
}

Measured memory_bytes: 976
import heapq

tmp = list(map(int,(input().split())))
n = tmp[0]
m = tmp[1]

ai = []
tmp = list(map(int,(input().split())))
for i in range(n):
  heapq.heappush(ai, -tmp[i])

for i in range(m):
  maxp = - heapq.heappop(ai)
  maxp = maxp // 2
  heapq.heappush(ai, -maxp)
  
sum = 0
for i in range(n):
  sum += -ai[i]

#print(ai)
print(sum)

Measured memory_bytes: 14180
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2")

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)

namespace FastIO {
struct Strs {
  char strs[10000 * 4];
  constexpr Strs() : strs() {
    for (int i = 0; i < 10000; ++i) {
      int j = i;
      for (int t = 3; t >= 0; --t) {
        strs[i * 4 + t] = j % 10 + '0';
        j /= 10;
      }
    }
  }
} constexpr strs;
static constexpr size_t buf_size = 1 << 20;
char buf_in[buf_size], buf_out[buf_size];
size_t pt_in = 0, pt_out = 0, tail_in = 0;
inline size_t num_digits(long long x) {
  if (x >= (long long)1e5) return 6;
  if (x >= (long long)1e4) return 5;
  if (x >= (long long)1e3) return 4;
  if (x >= (long long)1e2) return 3;
  if (x >= (long long)1e1) return 2;
  return 1;
}
inline void load() {
  memcpy(buf_in, buf_in + pt_in, tail_in - pt_in);
  size_t width = tail_in - pt_in;
  tail_in = width + fread(buf_in + width, 1, buf_size - width, stdin);
  pt_in = 0;
}
inline void flush() {
  fwrite(buf_out, 1, pt_out, stdout);
  pt_out = 0;
}
inline void scan(char& c) { c = buf_in[pt_in++]; }
template <class T>
inline void scan(T& x) {
  if (pt_in + 32 > tail_in) load();
  char c;
  bool minus = 0;
  x = 0;
  scan(c);
  while (c >= '0') {
    x = x * 10 + (c & 15);
    scan(c);
  }
  if (minus) x = -x;
}
inline void print(char c) { buf_out[pt_out++] = c; }
template <class T>
inline void print(T x) {
  if (pt_out > buf_size - 32) flush();
  if (x < 0) {
    print('-');
    x = -x;
  }
  size_t digits = num_digits(x);
  int i;
  for (i = pt_out + digits - 4; i > (int)pt_out; i -= 4) {
    memcpy(buf_out + i, strs.strs + (x % 10000) * 4, 4);
    x /= 10000;
  }
  memcpy(buf_out + pt_out, strs.strs + x * 4 + (pt_out - i), 4 + i - pt_out);
  pt_out += digits;
}
inline void print(const char* s) {
  if (pt_out > buf_size - 32) flush();
  for (int i = 0; s[i] != 0; ++i) print(s[i]);
}
template <class T>
inline void println(T x) {
  print(x);
  print('\n');
}
struct SetUp {
  SetUp() { load(); }
  ~SetUp() { flush(); }
} setup;
}  // namespace FastIO

using FastIO::print;
using FastIO::println;
using FastIO::scan;

int main() {
  int N;
  scan(N);
  int A[200000], B[200000];
  REP(i, N) scan(A[i]);
  REP(i, N) scan(B[N - 1 - i]);
  int ngs[200000], oks[200000];
  int ngp = 0, okp = 0;
  int ngx = -1;
  REP(i, N) {
    if (A[i] == B[i]) {
      ngs[ngp++] = i;
      ngx = A[i];
    }
  }
  REP(i, N) if (A[i] != ngx && B[i] != ngx) oks[okp++] = i;
  REP(j, ngp) {
    int i = ngs[j];
    if (okp == 0) {
      println("No");
      return 0;
    }
    int target = oks[--okp];
    swap(B[i], B[target]);
  }
  println("Yes");
  REP(i, N) println(B[i]);
  return 0;
}

Measured memory_bytes: 8068
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int n = Integer.parseInt(in.nextLine());
        int rem = 0;
        for (int i = 0; i < n; i++) {
            rem = ((rem * 10) % n + 7 % n) % n;
            if (rem == 0) {
                System.out.println(i + 1);
                return;
            }
        }
        System.out.println(-1);
    }
}


Measured memory_bytes: 36168
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int count = 0;
		for(int i = 0; i < n; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			if(Math.pow(d,2) >= Math.pow(x,2)+Math.pow(y,2)) {
				count++;
			}
		}
		System.out.println(count);
	}
}

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

int main() {
	// your code goes here
	string s;
	cin>>s;
	string s1="",s2="";
	int n=s.size();
	if(n==1){
		cout<<0;
		return 0;
	}
	if(n%2==0){
		for(int i=0;i<n;i+=2){
			s1+="10";
			s2+="01";
		}
	}
	else{
		for(int i=0;i<n-1;i+=2){
			s1+="10";
			s2+="01";
		}
		s1+="1";
		s2+="0";
	}
	int cnt1=0,cnt2=0;
	for(int i=0;i<s.size();i++){
		if(s[i]!=s1[i])
			cnt1++;
		else if(s[i]!=s2[i])
			cnt2++;
	}
	cout<<min(cnt1,cnt2);
	return 0;
}

Measured memory_bytes: 768
//suhan lee, saitama university;
#include <stdio.h>


int main(){
  int list[30];
  int n,i,w,a,b,j,tmp,tmpp;
  scanf("%d%d", &w, &n);
  for(i=1;i<w+1;i++)
    list[i]=i;
  for(i=0;i<n;i++){
    scanf("%d%c%d", &a, &tmpp, &b);
    tmp=list[a];
    list[a]=list[b];
    list[b]=tmp;
 
  }
 for(j=1;j<w+1;j++)
    printf("%d\n",list[j]);
  
 return 0;
}

Measured memory_bytes: 1024
// AtCoder-Template.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second
#define FOR(i,N) for(auto i=0; i<N; ++i)
#define FORREV(i,N,_cnt) for(auto i=N-1,cnt=_cnt; cnt > 0; --i, --cnt)
#define ALL(x) x.begin(), x.end()

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T& a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T& a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
	ifstream ifs("in.txt");
	cin.rdbuf(ifs.rdbuf());
#endif
	ll P, Q, R; cin >> P >> Q >> R;
	cout << (P + Q + R) - max({ P, Q, R }) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<iomanip>
#include<unordered_map>
#define deg(x) cerr<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;typedef long long LL;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=1e9+7;
const int inf=1e9+7;
const double eps=1e-6;
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return (r+m)%m;}
const double pi=acos(-1);

int a[203040];
int n,k;

bool check(int x){
	int cnt=0;
	for(int i=1;i<=n;i++){
		if(a[i]<=x)continue;
		int y=(a[i]-1)/x;
		cnt+=y;
	}
	return cnt<=k;
}

int main(){
    TB
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+1+n);
	int l=1,r=a[n],ans=-1;
	while(l<=r){
		int mid=(l+r)>>1;
		if(check(mid)){ r=mid-1;ans=mid; }
		else l=mid+1;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4440
a,b,c,d = map(int,input().split())
max = -10000000000000000000000
if max < a*c:
  max = a*c
if max < a*d:
  max = a*d
if max < b*c:
  max = b*c
if max < b*d:
  max = b*d
  
print(max)

Measured memory_bytes: 9176
import math
N=int(input())

a=[]
b=[]
z=[]
for i in range(1,round(math.sqrt(N))+1):
    if N%i==0:
        a.append(i)
        b.append(N//i)
    else:
        continue

for j in range(len(a)):
    z.append(a[j]+b[j]-2)

print(min(z))


Measured memory_bytes: 3416
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    x,y,z=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    #n=int(readline())
    #ss=readline().rstrip()
    #yn(1)
    print(z,end="")
    print(" ",end="")
    print(x,end="")
    print(" ",end="")
    print(y)
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------


Measured memory_bytes: 6644
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ll = long long;
#define MAX_N 1000001
#define MAX_M 100010
const long long mod = 1e9 + 7;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecBvec vector<vector<bool>>
#define vecst vector<string>
#define veche vector<char>
#define vecd vector<double>
#define vecvec vector<vector<int>>
#define vecDvec vector<vector<double>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
#define ent cout<<endl
#define printvec(vec) for(int aqw=0;aqw<vec.size();aqw++){cout<<vec[aqw]<<" ";}ent;
#define rep1(n) for(ll i = 0; i < (n); ++i)
#define rep2(i, n) for(ll i = 0; i < (n); ++i)
#define rep3(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep4(i, a, b, c) for(ll i = (a); i < (b); i += (c))
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define INF 1e+9
#define print(x) cout<<x<<endl;
using P = pair<int, int>;
#define PLL pair<ll, ll>;
#define MAX_V 1000
#define PI 3.141592653589793
#define vecP vector<P>
// cout << setprecision(15) << std::fixed;

int main()
{

    ll a, b, r, x, tmp;

    cin >> a >> b;

    x = a * b;

    /* 自然数 a > b を確認・入替 */
    if (a < b) {
        tmp = a;
        a = b;
        b = tmp;
    }

    /* ユークリッドの互除法 */
    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    /* 最小公倍数を出力 */
    cout << x / b;

    return 0;
}


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

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int a, b;
	cin >> a >> b;
	int sum = a - (2 * b);
	if (sum > 0)
	{
		cout << sum << endl;
	}
	else
	{
		cout << 0 << endl;
	}
}

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

int main() {
  int D,L;
  std::cin >> D >> L;
  int sum;
  int a = 1;
  while(1) {
    sum = L * a;
    if(D < sum) {
      --a;
      std::cout << a + (D - (sum - L)) << std::endl;
      break;
    }else if(D > sum) {
      ++a;
      continue;
    }else if(D == sum) {
      std::cout << a << std::endl;
      break;
    }
  }
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<(n);i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);
int main(){
	int h,m,H,M,k;cin>>h>>m>>H>>M>>k;
	int t = H-h,mm=M-m;
	int to =t*60+mm;
	cout<<to-k<<endl;
}

Measured memory_bytes: 3624
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    Map<Integer, Integer> seen = new HashMap<>();
    
    int count = scanner.nextInt();
    for (int ix = 0; ix < count; ix++) {
      int value = scanner.nextInt();
      seen.put(value - 1, seen.getOrDefault(value - 1, 0) + 1);
      seen.put(value, seen.getOrDefault(value, 0) + 1);
      seen.put(value + 1, seen.getOrDefault(value + 1, 0) + 1);
    }
 
    int maximum = 0;
    for (Map.Entry<Integer, Integer> entry : seen.entrySet()) {
      maximum = Math.max(maximum, entry.getValue()); 
    }
    
    System.out.println(maximum);
  }
}


Measured memory_bytes: 63556
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;
ll mod=1e9+7;

ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)res=res*a %mod;
        a=a*a %mod;
        b/=2;
    }
    return res;
}

ll c(ll a,ll b){
    ll res=1;
    for(ll i=1;i<=b;i++)res=res*(a-i+1)% mod *power(i,mod-2) %mod;
    return res;
}

int main(){
    int n,k;cin>>n>>k;
   ll r=n-k,b=k;
    for(ll i=1;i<=k;i++){
        ll bb=c(b-1,i-1)%mod;
        if(r<i-1){cout<<0<<endl;continue;}
        ll rr=c(1+r,i)%mod;
        while(bb<0)bb+=mod;
        while(rr<0)rr+=mod;
        cout<<bb*rr%mod<<endl;
        
    }
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define smax(a, b) ((a) < (b) ? ((a)=(b), true) : false)
#define smin(a, b) ((a) > (b) ? ((a)=(b), true) : false)
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using namespace std;
typedef long long ll;

ll n;
ll a[3001];
ll dp[3001][3001];

ll dps(int l, int r)
{
    if(dp[l][r] != 0) return dp[l][r];
    if(l == r) return a[l];

    dp[l][r] = max(-1 * dps(l+1, r) + a[l], -1 * dps(l, r-1) + a[r]);
    return dp[l][r];
}
int main() {
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    cout << dps(0, n-1) << endl;;
}

Measured memory_bytes: 49920
#include<stdio.h>	
int main(void)
{
	int n,a;
	scanf("%d %d",&n,&a);
	if(500<=n){
		if(n-(500*(n/500))<=a)printf("Yes\n");
		else printf("No\n");
	}
	else{
		if(n<=a)printf("Yes\n");
		else printf("No\n");
	}	
	return 0;
}		

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

typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<bool> > vvb;
typedef map<int, bool> mib;

typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vpll;

typedef vector<string> vs;

typedef long double ld;

#define _GLIBCXX_DEBUG

#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n-1); i >= 0; --i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORED(i, s, n) for (int i = (s); i >= (int)(n); i--)
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << '\n'
#define debug3(x, y, z) cerr << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << '\n'
#define debugs(s) cerr << s << "\n"
#define hyphen() cerr << "--\n"

#define ALL(vec) (vec).begin(), (vec).end()
#define REVALL(vec) (vec).rbegin(), (vec).rend()

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

#define fst first
#define snd second
#define pb push_back
#define mk(x,y) make_pair((x),(y))

// http://ehafib.hatenablog.com/entry/2015/12/23/164137
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qpm(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
// gcd : O(logN)
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a, int b) { return a / gcd(a, b) * b; }

#define sz(v) int(v.size())

// x1, x2ライブラリとの被りを避ける
#define x1 x192837465
#define x2 x123456789
#define y1 y192837465
#define y2 y123456789

// typo
#define itn int
#define reutrn return
#define reutnr return
#define srting string

#define make(type, x) type x; cin>>x;
#define make2(type, x, y) type x, y; cin>>x>>y;
#define make3(type, x, y, z) type x, y, z; cin>>x>>y>>z;
#define make4(type, x, y, z, t) type x, y, z, t; cin>>x>>y>>z>>t;

int ctoi(const char c){
    if('0' <= c && c <= '9') return (c-'0');
    return -1;
}

#define uniq(v) (v).erase(unique(ALL((v))), (v).end());

// area of (0, 0)(a, b)(c, d)
double area(double a, double b, double c, double d){
    return abs(a * d - b * c) / 2.0;
}

const int PREC = 10;
#define coutf(val) cout << fixed << setprecision(PREC) << (val) << endl;

const int MOD = (int)1e9 + 7;
const int INF = numeric_limits<int>::max();

string itoc(int n) {
    if (1 <= n && n <= 26) {
        char c = 'a' + n - 1;
        string s = "";
        s+=c;
        return s;
    } else {
        return "$";
    }

}

signed main() {
    make(int, N);
    // 1-origin

    // 26進数 like
    string ans = "";
    while(N>26) {
        int rest = N % 26;
        N /= 26;
        if (rest == 0) {
            rest += 26;
            N--;
        }

        ans += itoc(rest);
    }
    int rest = N % 26;
    N /= 26;
    if (rest == 0) {
        rest += 26;
        N--;
    }

    ans += itoc(rest);

    reverse(ALL(ans));

    cout << ans << endl;
}


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

int main(void){
    long long N;
    string S;
    cin >> N >> S;
    long long w = 0;
    for(long long i = 0; i < N; i++){
        if(S[i] == '.'){
            w++;
        }
    }
    long long BL = 0;
    long long WR = w;
    long long ans = w;
    for(long long i = 0; i < N; i++){
        if(S[i] == '#'){
            BL++;
        }else{
            WR--;
        }
        ans = min(ans,BL + WR);
    }
    cout << ans << endl;
    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }


        static void Main(string[] args)
        {
            var s = ReadLine();
            var f = false;
            for (var i = 0; i < s.Count(); ++i)
            {
                if (
                    (i % 2 == 0 && s[i] == 'L') ||
                    (i % 2 != 0 && s[i] == 'R')
                    )
                {
                    WriteLine("No");
                    return;
                }
            }
            WriteLine("Yes");
        }
    }
}


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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#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 all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll N, std::vector<ll> L) {
  ll ans = 0;

  for (int i = 0; i < N - 2; i++) {
    ll li = L.at(i);
    for (int j = i + 1; j < N - 1; j++) {
      ll lj = L.at(j);
      if (li == lj) continue;
      for (int k = j + 1; k < N; k++) {
        ll lk = L.at(k);
        if (li == lj || lj == lk || lk == li) continue;

        ll mx = max(li, max(lj, lk));
        if (mx == li && lj + lk > li) {
          ans++;
        }
        if (mx == lj && li + lk > lj) {
          ans++;
        }
        if (mx == lk && li + lj > lk) {
          ans++;
        }
      }
    }
  }

  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  std::vector<ll> L(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &L[i]);
  }
  solve(N, std::move(L));
  return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n; 
	vector<int> a(n);
	for( auto &k : a ) cin >> k;
	bool flag = true;
	for( auto k : a ){
		if( k % 2 == 0 and !( k % 3 == 0 or k % 5 == 0 ) ) flag = false;
	}
	if( flag ) cout << "APPROVED" << endl;
	else cout << "DENIED" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int n, c, k;
    cin >> n >> c >> k;
    vs32 T(n);
    rep (i, n) cin >> T[i];
    sort(T.begin(), T.end());

    int ans = 0;
    int t = -(int)1e9;
    int num = 0;
    rep (i, n)
    {
        if (T[i] <= t + k && num < c)
        {
            ++num;
        }
        else
        {
            t = T[i];
            ++ans;
            num = 1;
        }
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 640
#include<stdio.h>
int main()
{
	int a,b,c,d,e;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	if(a<0&&b<=0){
		printf("%d\n",c*(b-a));
	}else if(a<0&&b>0){
		printf("%d\n",(-a)*c+d+b*e);
	}else{
		printf("%d\n",(b-a)*e);
	}
	return 0;
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int main(void){

	int N; cin >> N;
	string S; cin >> S;

	REP(i,S.length()){
		
		cout << (char)((S[i] - 'A' + N)%26 + 'A');
	}
	cout << endl;


	return 0;

}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
using namespace std;
const long long MAX=1e9+7;
const int Mod=998244353;
int n,k,ans,tot,sum,k1,flag;
char s[100010],x;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d%d",&n,&k);
	if(n==0){
		printf("0\n");
		return 0;
	}
	scanf("%s",s+1);
	for(int i=1;i<=n;i++){
		k1++;
		if(tot/2>=k) k1--;
		if(s[i]!=x){
			tot++;
			x=s[i];
			if(tot%2==0&&tot/2<=k) ans+=2;
		}
		else ans++;
		//printf("%c: %d %d %d\n",s[i],ans,tot,k1);
	}
	x=s[k1];
	for(int i=k1+1;i<=n;i++)
		if(x!=s[i]) flag=1;
	if(flag==0&&tot>1&&tot%2==0) ans--;
	printf("%d\n",ans);
	return 0;
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

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

    int n;
    cin >> n;

    map<ll, ll> a;
    for(int i=0; i<n; i++){
        ll t;
        cin >> t;
        if(a.find(t) == a.end()){
            a[t] = 1;
        }else{
            if(a[t] % 2 == 1){
                a[t] = 0;
            }else{
                a[t] = 1;
            }
        }
    }

    ll cnt = 0;
    for(auto it=a.begin(); it != a.end(); it++){
        if(it->second == 1){
            cnt++;
        }
    }

    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 6528
num = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

s = [0 for i in range(4)]
for i in range(num):
	s[0] += abs(A[i] - B[i])
	s[1] += abs(A[i] - B[i])**2
	s[2] += abs(A[i] - B[i])**3
	s[3] = max(s[3], abs(A[i] - B[i]))
s[1] = s[1]**(1/2)
s[2] = s[2]**(1/3)
for i in range(4):
	print(f"{s[i]}")




Measured memory_bytes: 5656
#include <bits/stdc++.h>
#include <set>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


// const double PI = acos(-1);



int main() {
  ll x;
  cin >> x;
  ll ans = 0,m = 100;
  while(m < x) {
    m += m/100;
    ++ans;
  }
  cout << ans << endl;
  return 0;


}




Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const double PI = 3.14159265358979323846;
template <class T, class U>
void chmin(T& t, const U& u) {
  if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
  if (t < u) t = u;
}

struct UnionFind {
  vector<int> r;
  UnionFind(int N) { r = vector<int>(N, -1); }
  int root(int x) {
    if (r[x] < 0) return x;
    return r[x] = root(r[x]);
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (x > y) swap(x, y);
    r[x] += r[y];
    r[y] = x;
    return true;
  }
  int size(int x) { return -r[root(x)]; }
};

int main(void) {
  int N, M;
  cin >> N >> M;
  UnionFind uf(N);
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    uf.unite(a, b);
  }
  int res = 0;
  rep(i, N) { chmax(res, uf.size(i)); }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3988
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  int n; cin >> n;
  vector<int> ans(n + 1, 0);
  for (int i = 2; i <= n; i++) {
    int a; cin >> a;
    ans[a]++;
  }

  for (int i = 1; i <= n; i++) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 4052
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0] * (len(l) + 1)
sum = 0

for i in range(len(l) + 1):
    if i == 1:
        d[i] = l[i - 1]
    elif i == 0:
        pass
    else:
        d[i] = d[i - 1] + l[i - 1]

for i in range(len(d)):
    if d[i] <= x:
        sum += 1

print(sum)

Measured memory_bytes: 3064
#include <iostream>
using namespace std; using P=pair<int,int>; using ll=long long;

int main() {
  ll n; cin>>n;
  ll x=0, an=0;
  for(ll i=0;;i++) {
    ll uu=0; int a[]={0,0,0};
    for(ll j=i,k=1;j>0;j/=4,k*=10) {
      if ((j%4)==0) {a[0]=-1; break;}
      if ((j%4)==1) uu+=3*k, a[0]++;
      else if ((j%4)==2) uu+=5*k, a[1]++;
      else if ((j%4)==3) uu+=7*k, a[2]++; 
    }
    //cout<<uu<<" "<<a[0]<<" "<<a[1]<<" "<<a[2]<<" "<<i<<endl;
    if (uu>n) break;
    if (a[0]>0&&a[1]>0&&a[2]>0) an++;
  }
  cout<<an<<endl;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto S = RD!string;
	long[3] cnt;
	foreach (c; S)
	{
		++cnt[c-'a'];
	}

	writeln(cnt[0] == 1 && cnt[1] == 1 && cnt[2] == 1 ? "Yes" : "No");
	stdout.flush();
	debug readln();
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H& b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H& b) const { return x == b.x && y == b.y; }
	bool operator!=(const H& b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T& a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T& a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n;
int a[200000];
int b[200000];
signed main() {
	cin >> n;
	int ans = 0;
	for (int i = 0; i <= n; i++) {
		cin >> a[i];
		ans += a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < n; i++) {
		if (a[i] > 0) {
			int k = a[i];
			a[i] -= min(a[i], b[i]);
			b[i] = max(0ll, b[i] - k);
		}
		if (b[i] > 0) {
			a[i + 1] -= min(a[i + 1], b[i]);
		}
		ans -= a[i];
	}
	ans -= a[n];
	cout << ans << endl;
}


Measured memory_bytes: 1792
def main():
    line = input()
    mul = 1
    lista_lados = [int(x) for x in line.split()]
    index_max = lista_lados.index(max(lista_lados))
    for i in range(len(lista_lados)):
        if i != index_max:
            mul *= lista_lados[i]
    print(int(mul/2))
main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
typedef vector<int> Vi;
typedef pair<int,int> Pii;
typedef pair<int,Pii> Pip; 
const int INF = (1<<30);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){

  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int data[101];
  int maxx = 0;
  for(int i=1; i<=n; i++) {
    cin >> data[i];
  }

  int sum = 0;
  sort(data+1, data+n+1,greater<int>());
  maxx = c / a;
  for(int i=1; i<=n; i++) {
    sum += data[i];
    maxx = max(maxx, (sum+c) / ((b * i) + a));
  }

  cout << maxx << endl;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int n;
	cin>>n;
	string s;
	cin>>s;
	bool ans;
	if(s.size()%2==0){
		for(int i=0; i<n/2; i++){
			if(s[i]!=s[i+n/2]){
				ans = false;
				goto out;
			}
		}
		ans = true;	
	}else{
		ans = false;
	}
	out:
		printf(ans?"Yes\n":"No\n");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
int i,j;
int n;
int d[101];
int e[101];
int x=0;
int z=0;
int v;
int temp;
scanf("%d",&n);
for(i=0;i<n;i++){
	
	scanf("%d",&d[i]);

}
for(i=0;i<n;i++){
	for(j=n-1;j>i;j--){
		if(d[j]>d[j-1]){
			
			temp=d[j];
			d[j]=d[j-1];
			d[j-1]=temp;
			
			
			
			
			
			
			
			
			
		}
		
		
		
		
		
		
		
	}
	
	
	
}

for(i=0;i<n;i++){
if(d[i]==d[i+1]){
	
	x++;
}
	
	z++;
}
printf("%d\n",z-x);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
//#include<cmath>
using namespace std;

typedef struct {
	string s;
	int t;
}Unit;

int main(void)
{
	int n, m;
	cin >> n;
	list<int> L;
	char s[20];
	for (int i = 0; i < n; i++) {
		scanf("%s %d", s, &m);
		if (s[0] == 'i') {
			L.push_front(m);
		}
		else if (strlen(s) == 6) {
			for (list<int>::iterator it=L.begin(); it != L.end(); it++) {
				if (*it == m) {
					L.erase(it);
					break;
				}
			}
		}
		else if (strlen(s) == 11) {
			L.pop_front();
		}
		else {
			L.pop_back();
		}
	}
	int i = 0;
	for (list<int>::iterator it = L.begin(); it != L.end(); it++) {
		if (i++)
			cout << " ";
		cout << *it;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 34376
use proconio::*;

#[fastout]
fn main() {
    input! {
        n: usize,
    };
    let mut ans = [0; 10001];

    for x in 1..=100 {
        for y in x..=100 {
            for z in y..100 {
                let t = x * x + y * y + z * z + x * y + y * z + x * z;
                if t <= n {
                    ans[t] += if x == y && y == z {
                        1
                    } else if x == y || y == z || x == z {
                        3
                    } else {
                        6
                    }
                }
            }
        }
    }

    for a in &ans[1..=n] {
        println!("{}", a);
    }
}


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

int main() {
  int n;
  long long S = 0;
  cin >> n;
  vector<int> v(n);
  for(int i = 0;i < n;i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end(), greater<>());
  for(int i = 0;i < n - 1;i++) {
    S += v[(int)((i + 1) / 2)];
  }
  cout << S << endl;
}

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

int main()
{
	string s;
	cin >> s;
	bool f = true;
	
	for(int i = 0; i < s.size(); i++)
		if(s[i] == s[i - 1])
			f = false;
	
	if(f)
		cout << "Good" << endl;
	else
		cout << "Bad" << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main{
	public static void main(String[] args) {
		Scanner stdin=new Scanner(System.in);
		Set<Integer> set=new HashSet<Integer>();

		int n=stdin.nextInt();
		for(int i=0;i<n;i++){
			int d=stdin.nextInt();
			set.add(d);
		}
		System.out.println(set.size());
	}
}

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

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

	long long q, h, s, d, n;
	cin >> q >> h >> s >> d >> n;

	long long c1 = min(min(4*q, 2*h), s);
	long long c2 = min(d, 2*s);

	long long ans = n * c1;

	if(n % 2 == 0) {
		ans = min(ans, c2 * (n/2));
	}
	else {
		ans = min(ans, c2 * (n/2) + c1);
	}

	cout << ans;

	return 0;
} 

Measured memory_bytes: 256
# 別変数の整数複数個
X, Y = [int(x) for x in input().strip().split(" ")]

if Y % 2 == 1:
    print("No")
else:
    turtles = (Y - 2 * X) // 2
    cranes = (4 * X - Y) // 2
    if (0 <= turtles <= X) and (0 <= cranes <= X):
        print("Yes")
    else:
        print("No")

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

using namespace std;

const int MOD = 1e9 + 7;

int a[105];
long long dp[2][100005], ps[100005];

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);

    dp[0][0] = 1;

    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= k; j++) {
            ps[j] = dp[(i - 1) & 1][j];
            if (j - 1 >= 0) ps[j] += ps[j - 1];
            ps[j] %= MOD;
        }

        for (int j = 0; j <= k; j++) {
            int l = max(0, j - a[i]);
            int r = j;
            long long sum = ps[r];
            if (l - 1 >= 0) sum -= ps[l - 1];
            sum += MOD;
            sum %= MOD;
            dp[i & 1][j] = sum;
        }
    }

    printf("%lld\n", dp[n & 1][k]);
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define Maxn 100005
#define Maxm 1000005
#define lowbit(x) x&(-x)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define PI acos(-1.0)
#define random(x) (rand()%x)+1
#define LL long long
#define Inf (1LL<<62)
#define inf 0x3f3f3f3f
#define eps 1e-12
#define input freopen("input.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
using namespace std;
const int mod=9901;
int s[Maxn],m[Maxn],l[Maxn];
int main(){
    //input;output;
    LL n;
    LL ans;
    while(~scanf("%lld",&n)){
        ans=0;
        for(int i=0;i<n;i++)
            scanf("%d",s+i);
        for(int i=0;i<n;i++)
            scanf("%d",m+i);
        for(int i=0;i<n;i++)
            scanf("%d",l+i);
        sort(s,s+n);
        sort(l,l+n);
        for(int i=0;i<n;i++){
            LL pos1=lower_bound(s,s+n,m[i])-s;
            LL pos2=upper_bound(l,l+n,m[i])-l;
            //cout<<pos1<<" "<<pos2<<endl;
            ans+=pos1*(n-pos2);
        }
        printf("%lld\n",ans);
    }
    return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    string S;
    cin >> S;
    if (S.length() == 3)
        swap(S[0], S[2]);
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc088/tasks/abc088_d
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MAX_N=100;

int h, w;
typedef pair<int, int> P;
vector<vector<char> > maze(MAX_N, vector<char>(MAX_N));
int sx, sy, gx, gy;

vector<vector<ll> > d(MAX_N, vector<ll>(MAX_N));

vector<int> dx = {1, 0, -1, 0};
vector<int> dy = {0, 1, 0, -1};

ll bfs(){
    queue<P> que;
    // すべての点をINFで初期化
    rep(x, w)
        rep(y, h) d.at(x).at(y) = INF;
    // スタート地点をqueに入れ、その点距離を0とする
    que.push(P(sx,sy));
    d.at(sx).at(sy) = 0;

    // queが空になるまでループ
    while(que.size()){
        //　キューの先頭を取り出す
        P p = que.front();
        que.pop();
        //　取り出してきた状態がゴールならば探索終了
        if(p.first == gx && p.second == gy) break;
        //　４方向をループ
        rep(i, 4){
            int nx = p.first + dx.at(i), ny = p.second + dy.at(i);

            //　移動が可能かどうかの判定とすでに訪れたことがあるかどうかの判定
            if(0 <= nx && nx < w && 0 <= ny && ny < h && maze.at(nx).at(ny) != '#' && d.at(nx).at(ny) == INF){
                //　移動可能ならばキューに追加、点の距離を+1して確定させる
                que.push(P(nx,ny));
                d.at(nx).at(ny) = d.at(p.first).at(p.second) + 1;
            }
        }
    }
    return d.at(gx).at(gy);
}

int main(){
    //　入力に注意すること!
    //　特に座標を-1することを忘れないこと!
    cin >> h >> w;
    sx = 0; sy = 0; gx = w-1; gy = h-1;
    int road = 0;
    rep(y, h){
        rep(x, w){
            cin >> maze.at(x).at(y);
            if(maze.at(x).at(y) == '.') road++;
        }
    }
    //rep(y, h){rep(x, w){cout << maze.at(x).at(y);}cout << "\n";}cout << "---\n";
    ll answer = bfs();
    //rep(y, h){rep(x, w){cout << d.at(x).at(y);}cout << "\n";}cout << "---\n";
    if(answer == INF) cout << -1 << endl;
    else cout << (road - answer - 1) << endl;
    //cout << maze.at(gx).at(gy) << endl;
}

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

int main(){
  int A,B,n1,n2,n3,n4,n5,count;
  cin>>A>>B;
  for(;A<=B;A++){
    n1=A/10000;
    n2=(A-n1*10000)/1000;
    n3=(A-n1*10000-n2*1000)/100;
    n4=(A-n1*10000-n2*1000-n3*100)/10;
    n5=A-n1*10000-n2*1000-n3*100-n4*10;
    if(n1==n5&&n2==n4){
      count++;
    }
  }
  cout <<count;
}


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

using namespace std;

#define ff first
#define ss second
#define pb push_back

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

const int oo = 1e8;
const int N = 1e3 + 5;

int b[N];
int a[N];
int n, m;
int dp[N][1 << 13];

int f(int id, int mask){
	if(__builtin_popcount(mask) == n) return 0;
	if(id == m) return oo;

	int &ret = dp[id][mask];
	if(ret != -1) return ret;
	return ret = min(f(id+1, mask), f(id+1, mask | b[id]) + a[id]);
}

int main(){
	scanf("%d %d", &n, &m);
	for(int i = 0; i < m; i++){
		int q;
		scanf("%d %d", &a[i], &q);
		for(int j = 0; j < q; j++){
			int x;
			scanf("%d", &x);
			b[i] |= 1 << x;
		}
	}
	memset(dp, -1, sizeof dp);
	int ans = f(0, 0);
	printf("%d\n", ans < oo ? ans : -1);
	return 0;
}


Measured memory_bytes: 32512