akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1000000007;

int main(){
    int n,m;
    cin>>n>>m;
    priority_queue<int, vector<int>, less<int>> A;
    rep(i,n){
        int a;
        cin>>a;
        A.push(a);
    }
    rep(i,m){//一番高い品物を、1枚の割引券と品物のセットにして値段を半分にする
        int a=A.top();
        A.pop();
        a/=2;
        A.push(a);
    }
    long long sum=0;
    rep(i,n){
        int a=A.top();
        A.pop();
        sum+=a;
    }
    cout<<sum<<endl;
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define mem0(x) memset(x, 0, sizeof(x))
#define asort(x) sort(x.begin(), x.end());
#define dsort(x, t) sort(x.begin(), a.end(), greater<t>());
#define mp make_pair
#define pb push_back

int main() {
    int N;
    string str;
    map<string, int> m;

    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> str;
        if(m.find(str) == m.end()) {
            m.insert(mp(str, 1));
        }
    }

    cout << m.size() << endl;

    return 0;
}

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

using namespace std;

string s[] = {"Sunny", "Cloudy", "Rainy"};

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

    string a;
    cin >> a;

    int i = 0;
    while (s[i] != a)
    {
        i++;
    }
    i = (i + 1) % 3;
    cout << s[i] << "\n";

}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <queue>
#include <set>

using namespace std;

int a,b;

int main () {
  cin >> a >> b;
  int count = a > 2*b ? a - 2*b : 0;
  cout << count << endl;
}


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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)

#define ll long long

#define pq(name,type) priority_queue<type> name
#define vec(name,type,length,value) vector<type> name(length,value)
#define vec2(name,type,length,width,value) vector<vector<type>> name(length,vector<type>(width,value));

int main(){
	int N;
	cin >> N;
  if(N >= 400 && N <= 599){
    cout << 8;
  }else if(N >= 600 && N <= 799){
      cout << 7;
  }else if(N >= 800 && N <= 999){
      cout << 6;
  }else if(N >= 1000 && N <= 1199){
      cout << 5;
  }else if(N >= 1200 && N <= 1399){
      cout << 4;
  }else if(N >= 1400 && N <= 1599){
      cout << 3;
  }else if(N >= 1600 && N <= 1799){
      cout << 2;
  }else if(N >= 1800 && N <= 1999){
      cout << 1;
  }
  cout << endl;
return 0;
}

Measured memory_bytes: 3644
N, K, Q = map(int, input().split())
X = list(map(int, input().split()))

r = 10**18
for y in X:
    tmp = []
    tmp2 = []
    for x in X:
        if x < y:
            tmp.sort()
            tn = len(tmp)
            if len(tmp) > K-1:
                tmp2 += tmp[:tn-K+1]
            tmp = []
            continue
        tmp.append(x)
    tmp.sort()
    tn = len(tmp)
    if tn-K+1 > 0:
        tmp2 += tmp[:tn-K+1]
    tmp2.sort()
    if len(tmp2) >= Q:
        r = min(r, tmp2[Q-1] - y)
print(r)


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

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

    // N=1は例外
    if (N == 1) {
        cout << "Yes" << endl;
        cout << 2 << endl;
        cout << 1 << " " << 1 << endl;
        cout << 1 << " " << 1 << endl;
        return 0;
    }

    // (S1, S2,...Sk)の組を完全グラフの頂点とみなすと、{1,2,...,N}はグラフの辺に対応する
    // {1,2,...N}の要素数Nは完全グラフの辺数=k * (k-1)/ 2 に一致する必要がある
    bool ok = false;
    int k = 0;
    while (k <= N) {
        if (N == k * (k - 1) / 2) {
            ok = true;
            break;
        }
        k++;
    }
    if (!ok) {
        cout << "No" << endl;
        return 0;
    }

    vector<vector<int>> ans(k, vector<int>());
    int edge = 1;
    rep(i, k) {
        rep(j, k) {
            if (i >= j) continue;
            ans[i].push_back(edge);
            ans[j].push_back(edge);
            edge++;
        }
    }

    cout << "Yes" << endl;
    cout << k << endl;
    for (auto s: ans) {
        cout << s.size() << " ";
        for (auto n: s) cout << n << " ";
        cout << endl;
    }
}


Measured memory_bytes: 2304
#include <stdio.h>

#define N 100
#define INFTY 2097152
#define LEN 1000


int Q[LEN],head, tail;
int n, M[N][N], d[N];

void enqueue(int x){

  Q[tail]=x;
  tail=(tail+1)%LEN;
  
}

void dequeue(){
   int x;

   x=Q[head];
   head=(head+1)%LEN;
   
}

void bfs(int s){
  int i,u,v;

  enqueue(s);
  
  for(i=0;i<n;i++){
    d[i]=INFTY;
  }
  d[s] = 0;

  while(head!=tail){
    u=Q[head];
    dequeue();
    for(v=0;v<n;v++){
      if(M[u][v]==0)continue;
      if(d[v]!=INFTY)continue;
      d[v]=d[u]+1;
      enqueue(v);
    }
  }

  for(i=0;i<n;i++){
    printf("%d %d\n",i+1,((d[i]==INFTY) ? (-1):d[i]));
  }
}

int main(){
  int i,j,u,k,v;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }
  
  bfs(0);
  
  return 0;
}



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

#define M 1000003

long long StrToID(std::string str){
	long long id = 0;
	for (int i = 0; i < str.length(); ++i){
		switch(str[i]){
			case 'A': id = 1 + id*10; break; 
			case 'C': id = 2 + id*10; break;
			case 'G': id = 3 + id*10; break;
			case 'T': id = 4 + id*10; break;
			default : break;
		}
	}
	return id;
}

bool includeNum(long long fig, std::vector<long long> S){
	for (int i = 0; i < S.size(); ++i){
		if(S[i]==fig) return true;
	}
	return false;
}

int main(int argc, char const *argv[]){
	std::vector< std::vector<long long> > Dictionary(M);
	int N,key;
	long long id;
	std::string cmd,str;
	std::cin >> N;

	for (int i = 0; i < N; ++i){
		std::cin >> cmd >> str;
		id = StrToID(str);
		key = id % M;
		if(cmd=="insert"){
			if(!includeNum(id,Dictionary[key])) Dictionary[key].push_back(id);
		}else if(cmd=="find"){
			if(includeNum(id,Dictionary[key])){
				std::cout << "yes" << std::endl;
			}else{
				std::cout << "no" << std::endl;
			}
		}else{
			//exception
		}
	}
	return 0;
}


Measured memory_bytes: 31128
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;

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

            long N = long.Parse(Console.ReadLine());
            long[] t = new long[N];
            for(var i = 0; i < N; i++)
            {
                t[i] = long.Parse(Console.ReadLine());
            }

            Array.Sort(t);
            var c = new Calculation();
            

            long ans = t[0];
            if (t.Length > 1)
            {
                long gcd;
              for(var i = 1; i < N; i++)
                {
                    gcd = c.GetGcdL(ans, t[i]);
                    ans /= gcd;
                    ans *= t[i];
                }
            }
            Console.WriteLine(ans);
             


            Console.Out.Flush();
        }
    }



    public class Calculation
    {
        public long GetGcdL(long a, long b)//最大公約数long
        {
            if (b == 0)
            {
                return a;
            }
            return GetGcdL(b, a % b);
        }

        public long GetGcdOfSortedArrayL(long[] array)//ソート済み配列の最大公約数long
        {
            if (array.Length == 1) { return array[0]; }
            long g = array[0];
            for (var i = 1; i < array.Length; i++)
            {
                long newg = GetGcdL(g, array[i]);
                g = newg;
            }
            return g;
        }
    }
}


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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'

int n, m, k, e;
int cnt[50] = {0};

int main()
{
	IOS;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> k;
		for (int  j = 0; j < k; j++) {
			cin >> e;
			cnt[e]++;
		}
	}
	int ans = 0;
	for (int i = 1; i <= m; i++) {
		if (cnt[i]==n) ans++;
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

int main() {
	int n, max_weight; std::cin >> n >> max_weight;
	std::vector<long long int> memo(max_weight + 1, 0);
	for (auto i = 0; i < n; ++i) {
		int w, v; std::cin >> w >> v;
		for (int j = max_weight; j >= w; --j) {
			memo[j] = std::max(memo[j], memo[j - w] + v);
		}
	}
	std::cout << memo.back() << std::endl;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
long long int loop(long long int);
int main(){
  int n;
  long long int ans;
  cin >> n;
  ans=loop(n);
  cout << ans << endl;
}

long long int loop(long long int n){
  if(n==1){
    return 1;
  }
  return n*loop(n-1);
}

Measured memory_bytes: 1152
import java.util.Scanner;

class Main {
    private static void solve() {
        Scanner scanner = new Scanner(System.in);

        while (true) {
            int q = scanner.nextInt();
            if (q == -1) {
                break;
            }
            double x = q / 2;
            while (Math.abs(x * x * x - q) >= 0.000001 * q) {
                x = x - (x * x * x - q) / (3 * x * x);
            }
            System.out.println(String.format("%f", x));
        }
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define PRECISION(x) cout << fixed << setprecision(x); 
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(i,n) for (int i = 0; i < n; ++i)
#define DO(X) while(X--)
#define DRI(X) int (X); cin >> X
#define DRII(X, Y) int X, Y; cin >> X >> Y
#define DRIII(X, Y, Z) int X, Y, Z; cin >> X >> Y >> Z
#define read(X) for(int &ele : (X)) cin >> ele
#define readI(X) for(int idx = 1; idx < SZ((X)); ++idx) cin >> (X)[idx]
#define debug(x) cerr << '>' << #x << ':' << x << endl
#define MP make_pair
#define PB push_back
#define F first
#define S second

using namespace std;
typedef long long LL;
const int INF = 1<<29;
inline int in() { int x; cin >> x; return x; }
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }

int main(){
	FAST_IO 
	DRIII(N, tPos, aPos);
	vector<vector<int>> adjList(N + 1);
	REP(rep, N){
		DRII(oneV, secV);
		adjList[oneV].push_back(secV);
		adjList[secV].push_back(oneV);
	}
	vector<int> distance(N + 1, INF);
	queue<int> BFS;
	BFS.push(aPos);
	distance[aPos] = 0;
	while(!BFS.empty()){
		int curPos = BFS.front(); BFS.pop();
		for(int adj : adjList[curPos]){
			if(distance[adj] > distance[curPos] + 1){
				distance[adj] = distance[curPos] + 1;
				BFS.push(adj);
			}
		}
	}
	vector<int> _distance(N + 1, INF);
	int maxAllowed = 0;
	if(distance[tPos] > 0){
		BFS.push(tPos);
		_distance[tPos] = 0;
	}
	while(!BFS.empty()){
		int curPos = BFS.front(); BFS.pop();
		max_self(maxAllowed, distance[curPos]);
		for(int adj : adjList[curPos]){
			if(_distance[adj] > _distance[curPos] + 1 && distance[adj] > _distance[curPos] + 1){
				_distance[adj] = _distance[curPos] + 1;
				BFS.push(adj);
			}
		}
	}
	cout << max(maxAllowed - 1, 0) << endl;
	return 0;
}

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


int main(){
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(n*a, b) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
//cout << fixed << setprecision(20) << *** << endl;
#define rep(i,N) for(int i=0;i<(int)N;++i)
typedef long long ll;
using namespace std;
int main()
{
	ll A,B,C,ANS=0;
	cin>>A>>B>>C;
	if(A+B+1<=C)ANS=ANS+A+B+1;
	else ANS=ANS+C;
	ANS=ANS+B;
	cout<<ANS<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
vector<tuple<int,int,int>>v;
lli dp[100000][3];
#define m_t make_tuple
#define pb push_back
lli count(int i,int n,char prev)
{
    if(i==n)
        return 0;
    
    lli mx=0;
    if(dp[i][prev-65]!=-1)
    return dp[i][prev-65];
    if(prev=='D')
    {
    mx=max(mx,get<0>(v[i])+count(i+1,n,'A'));
    mx=max(mx,get<1>(v[i])+count(i+1,n,'B'));
	mx=max(mx,get<2>(v[i])+count(i+1,n,'C'));
	}
    else if(prev=='A')
    {
    mx=max(mx,get<1>(v[i])+count(i+1,n,'B'));
	mx=max(mx,get<2>(v[i])+count(i+1,n,'C'));
	}
	else if(prev=='B')
	{
	mx=max(mx,get<0>(v[i])+count(i+1,n,'A'));
	mx=max(mx,get<2>(v[i])+count(i+1,n,'C'));
	}
	else
	{
	mx=max(mx,get<0>(v[i])+count(i+1,n,'A'));
	mx=max(mx,get<1>(v[i])+count(i+1,n,'B'));
	}
	
	return dp[i][prev-65]=mx;
}

int main()
{
	int n,i,a,b,c;
	cin>>n;
	for(i=0;i<n;i++)
	{
	cin>>a>>b>>c;
	v.pb(m_t(a,b,c));
	}
	memset(dp,-1,sizeof(dp));
	cout<<count(0,n,'D');
	return 0;
}

Measured memory_bytes: 14520
#include <iostream>
#include<utility>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<cfloat>
#include<functional>
#include<string>
#include<numeric>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<cctype>
#include<iterator>
#include <stdio.h>
#include <string.h>
#include <sstream>
// #include <bits/stdc++.h>
//#include<conio.h>
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define MEGA_MIND ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define M_PI 3.14159265358979323846
#define mod 1000000007
#define endl "\n"
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;


const int N = 1e5 + 5, inf = 9e9;
vector<int> adj[N];
bool visited[N];
int nodesNum;
int dp[N];
int mx = 0;
void dfs(int node)
{
	
	visited[node] = true;
	for (int child : adj[node])
	{
		if(!visited[child])
			dfs(child);

		dp[node] = max(dp[node], 1 + dp[child]);
	}
}


int main()
{
	MEGA_MIND
	
		int edges;
	cin >> nodesNum >> edges;
	while (edges--)
	{
		int x, y;
		cin >> x >> y;
		adj[x].push_back(y);
	}
	for (int i = 1; i <= nodesNum; i++)
	{
		if (!visited[i])
			dfs(i);
	}
	for (int i = 1; i <= nodesNum; i++)
	{
		mx = max(mx, dp[i]);
	}
	cout << mx << endl;
	return 0;
}

Measured memory_bytes: 8320
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>
 
// #include <unordered_set>
// #include <unordered_map>
 
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
 
#define pb push_back
#define mp make_pair
 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
 
typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;
 
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
using namespace std;
 
#define int long long

int memo[1000001]={0};


int fib(int x){
    if(memo[x]!=0)return memo[x];
    else if(x==1)return 2;
    else if(x==2)return 1;
    memo[x]=(fib(x-1)+fib(x-2));
    return memo[x];
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cin高速化


    int n;
    cin>>n;

    cout<<fib(n+1)<<endl;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

import copy
import itertools

from functools import lru_cache
#@lru_cache(maxsize = None)

PPP = 1000000007

# 整数の入力
#n = int(input())

# スペース区切りの整数の入力
#a = [int(x) for x in input().split()]
W, H, x, y = map(int, input().split())
#print("sp", n, k, file=sys.stderr)
#p, q, r = map(int, input().split())
#l = [int(x) for x in input().split()]

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))
#  a.append([int(x) for x in input().split()])
#p = [int(x) for x in input().split()]
#a.sort()
#print(l, file=sys.stderr)

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

#cache = dict()

import re

def doit():
  res = [0, 0]
  res[0] = W * H / 2
  if W / 2 == x and H / 2 == y:
    res[1] = 1
  else:
    res[1] = 0
  return res

#print(doit([0] * 4))
#doit(s)
try:
  res = doit()
  print(res[0], res[1])
except Exception as e:
  print("e", e, file=sys.stderr)


Measured memory_bytes: 3952
<?php
fscanf(STDIN, "%d %d %d", $n, $a, $b);
$ret = [];
for($i = 1; $i <= $n; $i++) {
    $len = strlen($n);
    $tmp = sprintf("%0{$len}d", $i);
    $sum = 0;
    for($j = 0; $j < $len; $j++) {
        $sum += $tmp[$j];
    }
    if($sum >= $a && $sum <= $b) {
        $ret[] = $tmp;
    }
//    var_dump($ret);
}
echo array_sum($ret). "\n";

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

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define debug(x) cout << #x <<" = " << x << endl
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define printvpair(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i].first  <<" " << v[i].second << endl;
#define printv(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i] << " "; cout << endl;

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = 1000000000;

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

const int N = 100001;
int a[N];
int main() {
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	forn(i,n)cin >> a[i];
	sort(a,a + n);
	cout << a[n - 1] - a[0] << endl;
  	return 0;
}




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

int main() {
  int N,A,B,S;
  cin >> N >> A >> B;
  S = N*A;
  if ( S > B ){
    cout << B << endl;
  }
  else if ( S == B ){
    cout << S << endl;
  }
  else {
    cout << S << endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int digitsum(int num)
{
    int d,sum=0;
    while(num>0)
    {
        d=num%10;
        num=num/10;
        sum+=d;
    }
return(sum);
}

int main()
{
    int n,a,b,p;
    scanf("%d %d %d",&n,&a,&b);
    int i,s=0;
    for(i=1;i<=n;i++)
    {   p=digitsum(i);
        if(p>=a && p<=b)
        {
            s=s+i;
        }
    }
    printf("%d",s);
}


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

int main(){
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    ll dist = abs(a-b);
    if(w*t + dist <= v*t){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S,T;
    cin >> S >> T;
    cout << T << S << endl;
}

Measured memory_bytes: 256
// --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstring>

using namespace std;

int main(int argc, char* argv[]) {

	int N;
	int ans = 0;
	int deg100;
	int deg10;
	int deg1;

	cin >> N;

	deg100 = N / 100;
	deg10 = (N - (100 * deg100)) / 10;
	deg1 = (N - (100 * deg100) - (10 * deg10)) / 1;

	if (deg100 >= deg10) {
		if(deg10 >= deg1 || deg100 >= deg1){
			ans = deg100 * 100 + deg100 * 10 + deg100;
		}else{
			ans = (deg100 + 1) * 100 + (deg100 + 1) * 10 + (deg100 + 1);
		}
	}
	else {
		ans = (deg100 + 1) * 100 + (deg100 + 1) * 10 + (deg100 + 1);
	}

	cout << ans << endl;

	return 0;

}




Measured memory_bytes: 256
fun main() = repeat(readInt()) {
	val (n, a, b, c, d) = readLongs()
	val price = longArrayOf(a, b, c)
	val coef = intArrayOf(2, 3, 5)
	val memo = mutableMapOf(0L to 0L)

	fun solve(m: Long): Long {
		memo[m].also { if (it != null) return it }
		var ans = Long.MAX_VALUE
		if (ans / d > m) ans = m * d
		for (i in 0..2) {
			val c = coef[i]
			val p = price[i]
			val r = m % c
			val q = m / c
			ans = minOf(ans, solve(q) + p + r * d)
			if (r == 0L) continue
			if (q + 1 >= m) continue
			ans = minOf(ans, solve(q + 1) + p + (c - r) * d)
		}
		memo[m] = ans
		return ans
	}
	println(solve(n))
}

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }
private fun readLongs() = readStrings().map { it.toLong() }


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

enum mod = 10L^^9 + 7;

void main() {
    int n, a, b, c, d;
    scan(n, a, b, c, d);

    auto fact = new long[](n + 1);
    auto rfact = new long[](n + 1);
    fact[0] = 1;
    foreach (i ; 1 .. n + 1) {
        fact[i] = (fact[i-1] * i) % mod;
    }
    rfact[n] = inv(fact[n]);
    foreach_reverse (i ; 0 .. n) {
        rfact[i] = (rfact[i+1] * (i + 1)) % mod;
    }

    long perm(int n, int k) {
        return fact[n] * rfact[n-k] % mod;
    }

    debug {
        //writeln(fact);
        //writeln(rfact);
    }

    auto dp = new long[][](n + 1, n + 1);
    foreach (i ; 0 .. n/a + 1) {
        if (i != 0 && (i < c || i > d)) {
            continue;
        }
        dp[a][i*a] = perm(n, i*a) * powmod(rfact[a], i) % mod * rfact[i] % mod;
    }

    foreach (i ; a + 1 .. b + 1) {
        foreach (j ; 0 .. n + 1) {
            foreach (k ; 0 .. min(d, j/i) + 1) {
                if (k != 0 && (k < c || k > d)) {
                    continue;
                }
                (dp[i][j] += dp[i-1][j - i*k] * perm(n - j + i*k, i*k)
                    % mod * powmod(rfact[i], k) % mod * rfact[k] % mod)
                %= mod;
            }
        }
    }

    debug {
        writefln("%(%(%s %)\n%)", dp);
    }

    long ans = dp[b][n];

    writeln(ans);
}

long powmod(long x, long y) {
    return y > 0 ? powmod(x, y>>1)^^2 % mod * x^^(y&1) % mod : 1;
}

long inv(long x) {
    return powmod(x, mod - 2);
}


void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


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

int main(){
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    sort(s.begin(),s.end());
    rep(i,n) cout << s[i];
    cout << endl;
    return 0;
}

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

int main(){
  /*vector<vector<int>> a(3,vector<int>(3));
  cin>>a.at(0).at(0)>>a.at(0).at(1)>>a.at(0).at(2)>>a.at(1).at(0)>>a.at(1).at(1)>>a.at(1).at(2)>>a.at(2).at(0)>>a.at(2).at(1)>>a.at(2).at(2);
  if(a.at(0).at(0))*/
  int a,b,c,d,e,f,g,h,i;
  cin>>a>>b>>c>>d>>e>>f>>g>>h>>i;
  if(a-d==b-e&&b-e==c-f&&d-g==e-h&&e-h==f-i&&a-b==d-e&&d-e==g-h&&b-c==e-f&&e-f==h-i)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}
    

Measured memory_bytes: 256
transforms = []
for i, sides in enumerate(((3,1,2,4),(2,0,3,5),(4,0,1,5),(1,0,4,5),(3,0,2,5),(2,1,3,4))):
	for j in range(4):
		r = sides[j:] + sides[:j]
		transforms.append((i, r[1], r[2], r[0], r[3], 5-i))

possibilities = set()
for _ in range(int(input())):
	die = input().split()
	new_possibilities = {tuple(die[t] for t in transform) for transform in transforms}
	if new_possibilities.intersection(possibilities):
		print('No')
		break
	possibilities.update(new_possibilities)
else:
	print('Yes')



Measured memory_bytes: 5928
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    ll n, x, m;    cin >> n >> x >> m;
    vector<ll> v;   ll f, g = -1;
    set<ll> st;
    int k = 0;
    for (ll y = x; k < min(m+1, n); k++) {
        //cout << y << " ";
        if (st.find(y) != st.end()) {
            f = y;
            g = k;
            break;
        }
        
        st.insert(y);
        v.push_back(y);
        y = (y * y) % m;
    }
    //cout << endl << g << endl;

    if (g == -1) {
        ll ans = 0, y = x;
        for (int i = 0; i < n; i++) {
            ans += y;
            y = y*y % m;
        }
        cout << ans << endl;
        return 0;
    }

    int j;
    for (int i = 0; i < v.size(); i++) {
        if (f == v[i]) {
            j = i;
            break;
        }
    }
    //cout << j << endl;
    
    ll ans = 0 ,l = g-j;
    //cout << endl; 
    for (ll i = 0; i < v.size(); i++) {
        if (i < j) {
            ans += v[i];
        }
        else {
            //cout << v[i] << " " << (n-1-i)/l + 1 << endl;
            //cout << v[i] * ((n-1-i)/l + 1) << endl;
            ans += v[i] * ((n-1-i)/l + 1);
        }
    }
    cout << ans << endl;
    return 0;
}

//小数点精度
//cout << fixed << std::setprecision(15) << y << endl;

Measured memory_bytes: 5988
import static java.lang.Math.*;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] sum = new long[n];
        sum[0] = sc.nextLong();
        for (int i = 1; i < n; i++) {
            sum[i] = sc.nextLong() + sum[i-1];
        }
        long ans = Long.MAX_VALUE;
        for (int i = 0; i < n - 1; i++) {
            ans = min(ans, abs(sum[n-1] - sum[i] *2));
        }


        System.out.println(ans);
        sc.close();
    }
}


Measured memory_bytes: 65500
#include<iostream>
#include<string>
#include<algorithm>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define repm(i, m, n) for (int i = (m); i < (n); i++)
#define rep_rev(i, n) for (int i = int (n); i >= 0; i--)
typedef long long ll;
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << max(0, c - (a - b)) << endl;
	return 0;
}

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

int main() {
  string S;
  cin>>S;
  if(S.at(0)==S.at(1)&&S.at(2)==S.at(3)&&S.at(0)!=S.at(3)){
    cout<<"Yes"<<endl;
  }
  else if(S.at(0)==S.at(2)&&S.at(1)==S.at(3)&&S.at(0)!=S.at(3)){
    cout<<"Yes"<<endl;
  }
  else if(S.at(0)==S.at(3)&&S.at(2)==S.at(1)&&S.at(0)!=S.at(1)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  ll n, ans = 0;
  cin >> n;
  vector<ll> l(n);
  REP(i, n) { cin >> l[i]; }
  sort(ALL(l));

  for (ll a = 0; a < n; a++) {
    for (ll b = a + 1; b + 1 < n; b++) {
      if (l[l.size() - 1] < l[a] + l[b]) {
        ans += l.size()-b-1;
      } else
        ans += (ll)(lower_bound(ALL(l), l[a] + l[b]) - l.begin()) - b - 1;
    }
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 3612
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
//#include <unordered_set>
//#include <unordered_map>
//#include <bits/stdc++.h>

#define MP(A,B) make_pair(A,B)
#define PB(A) push_back(A)
#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define fi first
#define se second

using namespace std;

template<typename T>inline bool upmin(T &x,T y) { return y<x?x=y,1:0; }
template<typename T>inline bool upmax(T &x,T y) { return x<y?x=y,1:0; }

typedef long long ll;
typedef unsigned long long ull;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod eps=1e-11;
const lod pi=acos(-1);
const int oo=1<<30;
const ll loo=1ll<<62;
const int mods=998244353;
const int MAXN=100005;
const int INF=0x3f3f3f3f;//1061109567
/*--------------------------------------------------------------------*/
inline int read()
{
	int f=1,x=0; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c>='0'&&c<='9') { x=(x<<3)+(x<<1)+(c^48); c=getchar(); }
	return x*f;
}
inline char getch()
{
	char c=getchar();
	while (c<'A'||c>'Z') c=getchar();
	return c;
}
PR a[4005];
int f[2005][2005],s0[4005][2005],s1[4005][2005],pos[2][4005],n;
int main()
{  
	n=read();
	for (int i=1;i<=n*2;i++)
	{
		int opt=(getch()=='B'),x=read();
		a[i]=MP(opt,x);
		pos[opt][x]=i;
	}
	for (int i=1;i<=n*2;i++)
		for (int j=0;j<=n;j++)
			s0[i][j]=s0[i-1][j]+(a[i-1].fi==0&&a[i-1].se>j),
			s1[i][j]=s1[i-1][j]+(a[i-1].fi==1&&a[i-1].se>j);
	for (int i=0;i<=n;i++)
		for (int j=0;j<=n;j++) f[i][j]=INF;
	f[0][0]=0;
	for (int i=0;i<=n;i++)
		for (int j=0;j<=n;j++)
		{
			int x=pos[0][i],y=pos[1][j];
			if (i) upmin(f[i][j],f[i-1][j]+s0[x][i-1]+s1[x][j]);
			if (j) upmin(f[i][j],f[i][j-1]+s1[y][j-1]+s0[y][i]);
		}
	printf("%d\n",f[n][n]);
	return 0;
}

Measured memory_bytes: 82064
#include <bits/stdc++.h>
#define cina(a, n) for (int i = 0; i < n; ++i){ cin >> a[i]; }
#define ll long long
#define ld long double

using namespace std;

int main () {
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll n, k, x, y, cost = 0;
	cin >> n >> k >> x >> y;
	cost += min(n, k) * x;
	n -= min(n, k);
	if (n) {
		cost += n * y;
	}
	cout << cost;
	return 0;
}

Measured memory_bytes: 3656
N, M = list(map(int, input().split()))
suuji = [-1 for _ in range(N)]

for _ in range(M):
  s, c = list(map(int, input().split()))
  if any([suuji[s-1] not in [-1, c], s > N, all([s==1, c==0, N>1])]):
    print(-1)
    break
  else:
    suuji[s-1] = c
else:
  if suuji[0] == -1 and N > 1:
    suuji[0] = 1
  elif suuji[0] == -1 and N == 1:
    suuji[0] = 0
  for i in range(1,N):
    if suuji[i] == -1:
      suuji[i] = 0
  print(int(''.join([str(i) for i in suuji])))

Measured memory_bytes: 3188
#include<stdio.h>
int main(void)
{
	int x,y,z;

	scanf("%d", &x); scanf("%d", &y); scanf("%d", &z);

	if (z >=x&&z <= y) 
	{
		printf("Yes\n");
	}
	else
	{
		puts("No");
	}
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys


def solve(ABCD: str):
    num_str = ABCD
    N = len(num_str) - 1

    for bit in range(2 ** N):
        tmp = num_str[0]
        for i in range(N):
            if bit & 1 << i:
                tmp += "+"
            else:
                tmp += "-"
            tmp += num_str[i + 1]
        res = eval(tmp)

        if res == 7:
            print(tmp + "=7")
            return

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    ABCD = next(tokens)
    solve(ABCD)

if __name__ == '__main__':
    main()


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

using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define sz(s) (int)s.size()

int main() {
    int n;
    cin >> n;
    int t;
    cin >> t;
    int z;
    cin >> z;
    int ans = 0;
    rep(i, 1, n) {
        int x;
        cin >> x;
        int nz = z + t;
        if (x < z) continue;
        if (x >= nz) {ans += t; z = x; nz = x + t; continue;}
        ans += x - z;
        z = x;
        nz = x + t;
    }
    ans += t;
    cout << ans << '\n';
}

Measured memory_bytes: 256
#include <iostream>

#include <algorithm>

using namespace std;

int main(void)

{
	long long int n,i,k,a1,a2;
	
	cin >> n;
	
	long long int input[n],big=0,secbig=0;
	
	for(i=0;i<n;i++)
	{
		cin >> input[i];
	}
	
	sort(input,input+n);
	
	for(i=n-1;i>=0;i--)
	{
		if(input[i]==input[i-1]&&input[i]>=big)
		{
			
			secbig = big;
			
			big = input[i];
			
			i--;
		}
		else if(input[i]==input[i-1]&&input[i]<=big&&secbig==0)
		{
			secbig = input[i];
			
			i--;
		}
	}
	
	if(secbig==0||big==0)
	{
		cout << "0\n";
	}
	else
	{
		cout << big * secbig;
	}
	
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
r = []
index = 0
for i in range(n):
  s, p = input().split()
  r.append([s,int(p),i+1])
rp = sorted(r, key=lambda x:x[1], reverse=True)
for j in sorted(rp, key=lambda x:x[0]):
  print(j[2])

Measured memory_bytes: 3060
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:(input())

"""========main code==============="""

a,b,c,d=ml()
i=0
while(a>0 and c>0):
    if(i%2==0):
        c-=b
    else:
        a-=d
    i+=1    
if(a<=0):
    print("No")
elif c<=0:
    print("Yes")

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

int n;

void solve() {
  if (n / 10 == 9 || n % 10 == 9) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

int main() {
  cin >> n ;

  solve();

  return 0;
}

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

int main() {
  int n, m; cin >> n >> m;
  int ans = m, S = m;
  for (int i = 0; i < n; i++) {
    int e1, e2; cin >> e1 >> e2;
    S += e1 - e2;
    if (S > ans) ans = S;
    if (S < 0) {
      ans = 0;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3108
import itertools
N=int(input())
A=list(map(int,input().split()))
if len(A)<3:
  print('0')
  exit()
L=list(itertools.combinations(A,3))
l=map(list,L)
ans=0
for i in l:
  if len(set(i))==3 and i[0]+i[1]>i[2] and i[1]+i[2]>i[0] and i[0]+i[2]>i[1]:
    ans+=1
print(ans)


Measured memory_bytes: 20536
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vvi = V< V<int> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif

using P = pair<ll,ll>; using vp = V<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
//////////

void solve(){
  set<int> s;
  ini(N);
  rep(i , N) {ini(x); s.insert(x);}

  out(s.size());
}


Measured memory_bytes: 7804
#include <stdio.h>

int main()
{
	int	x[4], y[4];
	int	vx, vy;

	scanf("%d %d %d %d", &x[0], &y[0], &x[1], &y[1]);

	vx = x[1] - x[0];
	vy = y[1] - y[0];
	x[2] = x[1] - vy;
	y[2] = y[1] + vx;
	x[3] = x[2] - vx;
	y[3] = y[2] - vy;

	printf("%d %d %d %d\n", x[2], y[2], x[3], y[3]);

	return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <cassert>
#include <algorithm>    
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
// #define int long long
using namespace std;

typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef unsigned long long ull; 
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const int M = 1e9 + 7;
//__int128


signed main()
{
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  const int maxn = 1e5 + 5;
  bitset<64> a[maxn], sum;
  for(int i = 0; i < n; ++i) {
  	long long x;
  	cin >> x;
  	a[i] = x;
  	sum ^= a[i];
  }
  sum.flip();
  for(int i = 0; i < n; ++i) {
  	a[i] &= sum;
  }
  long long base[64] = {0};
  for(int i = 0; i < n; ++i) {
  	long long t = a[i].to_ullong();
  	for(int j = 60; j >= 0; --j) {
  		if(t >> j & 1) {
  			if(base[j]) {
  				t ^= base[j];
  			} else {
  				base[j] = t;
  				break;
  			}
  		}
  	}
  }
  long long res = 0;
  for(int i = 63; i >= 0; --i) {
  	if(base[i] && !(res >> i & 1)) {
  		res ^= base[i];
  	}
  }
  res <<= 1;
  sum.flip();
  res += sum.to_ullong();
  cout << res << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

#define MAX 101


int main(){

  int n;
  scanf("%d%*c", &n);

  int a[MAX], b[MAX];
  int i,j,k;
  for(i = 0; i < n; i++){
    scanf("%d%*c", &a[i]);
  }

  int count = 0;
  int minj;
  int tmp;
  
  for(i = 0; i < n; i++){
    minj = i;
    for(j = i; j < n; j++){
      if(a[j] < a[minj]) minj = j;
    }

    if(minj != i){
      tmp = a[i];
      a[i] = a[minj];
      a[minj] = tmp;
      count++;
    }
  }

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

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long double ld;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
//function area
ld area(int a, int b, int theta){
    return (ld)(0.5 * a * b * sinl(theta * M_PI / 180));
}
ld length(int a, int b, int theta){
    return a + b + (ld)(sqrtl(a*a + b*b - 2*a*b*cosl(theta * M_PI / 180)));
}
ld high(int a, ld S){
    return (ld)(S / (a * 0.5));
}
//main area
int main(){
    int a, b, theta;
    cin >> a >> b >> theta;
    ld S = area(a, b, theta), l = length(a, b, theta), h = high(a, S);
    cout << fixed << setprecision(6) << S << endl << l << endl << h << endl;
}


Measured memory_bytes: 3576
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#define re register
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define MAXN 4000007
#define mo 998244353
#define ll long long
using namespace std;
typedef unsigned long long ull;
#define ms(arr) memset(arr, 0, sizeof(arr))
const int inf = 0x3f3f3f3f;
ll f[4002][4002],g[2002][2002],b[5001],n,k,maxx;
int main()
{
	cin>>k>>n;
	f[0][0]=1;
	for(re int i=1;i<=k+n;i++){
		f[i][0]=1;
		for(re int j=1;j<=i;j++){
			f[i][j]=(f[i-1][j-1]+f[i-1][j])%mo;
		}
	}
	b[0]=1;
	for(re int i=1;i<=n;i++) b[i]=f[k+i-1][k-1];
	for(re int i=2;i<=2*k;i++){
		ll ans=b[n],t=0;
		if(i%2==0) t=min(i/2-1,k-i/2);
		else t=min(i/2,k-i/2);
		for(int j=1;j<=(i%2==0?t+1:t) && n>=j*2;j++) {
			ll x=(f[t][j]+(i%2==0?f[t][j-1]:0))%mo*b[n-j*2]%mo;
			ans=(ans+(j%2==0?1:-1)*x+mo)%mo;
		}
		cout<<ans%mo<<endl;
	}
	return 0;
}

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

using namespace std;
 
typedef pair<int, int> P;
 
int main()
{
    int n;
    while (cin >> n, n) {
	vector<P> v, b;
	for (int i = 0; i < n; i++) {
	    int m, s, sum = 0, num;
	    cin >> num;
	    for (int j = 0; j < 4; j++) {
		cin >> m >> s;
		sum += m*60 + s;
	    }
	    v.push_back(P(-sum, num));
	    b.push_back(P(sum, num));
	}
	sort(v.begin(), v.end());
	sort(b.begin(), b.end());
	cout << b[0].second << endl;
	cout << b[1].second << endl;
	cout << v[1].second << endl;
    }
    return 0;
}

Measured memory_bytes: 3216
#include<iostream>
#include<algorithm>
using namespace std;
int a,b,c;
int main()
{
    cin>>a>>b;
    c=b;
	int l=0;
	while(1)
    {
    	l++;
    	if(b<10)
    	  break ;
    	b/=10;
    }
    b=1;
    for(int i=1;i<=l;i++)
    {
    	b*=10;
    }
    a*=b;
    a+=c;
    for(int i=1;;i++)
    {
    	if(i*i==a)
    	{
    		cout<<"Yes"<<endl;
    		return 0;
    	}
    	if(i*i>a)
    	  break;
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256