akhauriyash/Code-Regression huggingface dataset:
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#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>

#if __cplusplus >= 201103L
#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>
#endif

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#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(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main(void){
    ll n=0;
    ll ans=0;
    cin >> n;
    for (ll i = 1; i <= n;  i++)
    {
        if( (i%2) == 0){
            continue;
        }
        ll count=0;
        for (ll j = 1; j <= n ; j++)
        {
            if( (i%j)==0){
                count++;
            }
        }
        if(count == 8){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

int main(void) {
    int n;
    while (cin >> n) {
        int ans = 0;
        for (int a = 0; a < 10; a++) {
            for (int b = 0; b < 10; b++) {
                for (int c = 0; c < 10; c++) {
                    for (int d = 0; d < 10; d++) {
                        if (a + b + c + d == n) ans++;
                    }
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int main() {
    int n;
    string s;
    cin >> n >> s;
    set<char> st1;
    int ans = -1;
    rep(i, n){
        int cnt = 0;
        st1.insert(s[i]);
        set<char> st2;
        for(int j = i+1; j < n; j++){
            if(st1.find(s[j]) != st1.end() && st2.find(s[j]) == st2.end()) {
                cnt++;
                st2.insert(s[j]);
            }
            ans = max(ans, cnt);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<cstdlib>
using namespace std;
int n,a[201],ans;
bool e;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]%2) e=1;
	} 
	while(!e){
		if(!e) for(int i=1;i<=n;i++) a[i]/=2;
		ans++;
		for(int i=1;i<=n;i++) if(a[i]%2) e=1;
	}
	cout<<ans<<endl;
 	return 0;
}

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

def check(l, r):
    res = 0
    for i, j in zip(l, r):
        if i != j:
            res += 1
    return res
ans = float("inf")
for i in range(len(s)-len(t)+1):
    ans = min(ans, check(s[i:len(t)+i], t))
print(ans)

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

int main() {
    int64_t K, N;
    cin >> K >> N;
    vector<int64_t> A(N);
    for (int64_t& a : A) {
        cin >> a;
    }

    int64_t ans = A[N - 1] - A[0];
    for (int64_t i = 1; i < N; i++) {
        //iから出発する
        //終わりがi-1
        ans = min(ans, K - (A[i] - A[i - 1]));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define R(i,a,n) for(int i=a;i<n;i++)
#define int long long
main(){
  long long a,c=100000,p=0,g=0,cc=0;
  cin>>a;
  g=a;
  while(g){
    p++;
    g/=10;
  }
  p=(p+1)/2;p--;//cout<<p;
  g=a;//p--;
  while(p){p--;g/=10;}p=1000;//cout<<g;
  for(int i=1;i<=g;i++){
    if(a%i==0){//cout<<i<<endl;
      cc=0;
      c=max(a/i,i);
      while(c){
        cc++;
        c/=10;
      }
      p=min(cc,p);
    }
  }
  cout<<p<<endl;
}

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

int A, B, C, D, E, F;

typedef pair< int, int > iP;

double density(iP st) {
    if(st.second == 0) return 0;
    return (double)100 * st.second / (st.first + st.second);
}

int main() {

    cin >> A >> B >> C >> D >> E >> F;

    bool dp1[3001] = {false}, dp2[3001] = {false};
    dp1[100 * A] = dp1[100 * B] = true;
    dp2[0] = dp2[C] = dp2[D] = true;
    for(int i = 1; i * 100 <= F; i++) {
        if(dp1[i * 100]) {
            dp1[(i + A) * 100] = dp1[(i + B) * 100] = true;
        }
    }
    for(int i = 1; i <= F; i++) {
        if(dp2[i]) {
            dp2[i + C] = dp2[i + D] = true;
        }
    }

    iP ans = iP(0, 0);
    for(int i = 100; i <= F; i += 100) {
        for(int j = 0; i + j <= F; j++) {
            if(dp1[i] && dp2[j] && j <= E * (double)(i / 100)) {
                if(density(ans) <= density(iP(i, j))) {
                    ans = iP(i, j);
                }
            }
        }
    }

    cout << ans.first + ans.second << " " << ans.second << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=998244353;
ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}
int main()
{
	int n; cin>>n;
  ll a[100000];
  for(int i=0; i<n; i++) cin>>a[i];
  sort(a, a+n);
  ll ans=a[0];
  for(ll i=1; i<n; i++){
    ans=ans*gcd(a[i], i)%MOD;
  }
  cout<<ans<<endl;
	return 0;
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}
 
int main() {
  ll n , c, k ; 
  cin >> n >> c >> k;
  
  vector<ll>t(n);
  rep(i,n) cin>>t[i];
  sort(t.begin(),t.end());
  
  ll ans=1;
  ll cnt=0;
  ll time=0;
  rep(i,n){
    if(t[i]<=t[time]+k && cnt<c) cnt++;
    else{
      time=i;
      cnt=1;
      ans++;
    }
  }
  cout<<ans<<endl;
}
  



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

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

int N, A, B, C, X;
int next(int x){
  return (A*x+B)%C;
}

int main(){
  while(true){
    cin>>N>>A>>B>>C>>X;
    if(N==0 && A==0 && B==0 && C==0 && X==0)break;
    int x=X;
    int Y[N];
    rep(i,N) cin>>Y[i];
    int flame=0, y=0;
    while(flame!=10001){
      if(Y[y]==x){
        y++;
        if(N==y)break;
      }
      x=next(x);
      flame++;
    }
    if(flame==10001)cout<<"-1"<<endl;
    else cout<<flame<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
n = int(input())

arr = [int(x) for x in input().split()]

left = [0]
for i in range(1,n):
  left.append(left[-1]^arr[i-1])
arr = arr[::-1]
right = [0]
for i in range(1,n):
  right.append(right[-1]^arr[i-1])
right = right[::-1]
arr  = arr[::-1]

ans = []
for i in range(n):
  ans.append(left[i]^right[i])

for num in ans:
  print(num,end=" ")

Measured memory_bytes: 40380
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProCon
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            string[] input = Console.ReadLine().Split(' ');
            int min = 0;
            int max = 0;
            bool[] flags = new bool[8];
            for(int i = 0; i < 8; ++i)
            {
                flags[i] = false;
            }
            for (int i = 0; i < input.Length; ++i)
            {
                int t = int.Parse(input[i]);
                if(t < 3200)
                {
                    if (!flags[t / 400])
                    {
                        flags[t / 400] = true;
                        min += 1;
                        max += 1;
                    }
                }
                else
                {
                    max++;
                }
            }
            if(min == 0)
            {
                min = 1;
            }
            Console.WriteLine(min + " " + max);
        }
    }
}


Measured memory_bytes: 13140
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
using namespace std;
signed main()
{
	int n;
	cin>>n;
	double p_head;
	double dp[n+1]={0};
	dp[0]=1;
	for(int coins=1;coins<=n;coins++)
	{
		cin>>p_head;
		for(int i=coins;i>=0;i--)
		{
			dp[i]=(i==0 ? 0 : dp[i-1]*p_head )+dp[i]*(1-p_head);
	//		cout<<"i :"<<i<<" "<<dp[i]<<endl;
		}
	}
	double ans=0;
	for(int i=1;i<=n;i++)
	{
		if(i>n-i)
			ans+=dp[i];
	}
	cout<<fixed<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 256
import sys
import itertools
import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

alphabet = [chr(ord('a') + i) for i in range(26)]
S = read().decode('utf8').rstrip().lower()
for i in alphabet:
    print(f'{i} : {S.count(i)}')



Measured memory_bytes: 5660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
#define FRO freopen("in.txt","r",stdin);


int main()
{
        int n,i,j,t,tcs=0,k,m,u,v;
        string s1,s2;
        cin>>s1>>s2;
        int len1=s1.size(),len2=s2.size();

        int arr[len1][len2];
        bool flag=0;
        for(i=0;i<len1;i++)
        {
                if(flag || s1[i]==s2[0])
                {
                        flag=1;
                        arr[i][0]=1;
                }
                else arr[i][0]=0;
        }
        flag=0;
        for(i=0;i<len2;i++)
        {
                if(flag || s1[0]==s2[i])
                {
                        flag=1;
                        arr[0][i]=1;
                }
                else arr[0][i]=0;
        }

        for(i=1;i<len1;i++)
        {
                for(j=1;j<len2;j++)
                {
                        arr[i][j]=max(max(arr[i-1][j],arr[i][j-1]),arr[i-1][j-1]+(s1[i]==s2[j]));
                }
        }
        stack<char>stk;
        i=len1-1; j=len2-1;
        while(0<=i && 0<=j)
        {
                if(arr[i][j]==arr[i-1][j]) i--;
                else if(arr[i][j]==arr[i][j-1]) j--;
                else
                {
                        stk.push(s1[i]);
                        i--;
                        j--;
                }
        }
        while(!stk.empty())
        {
                cout<<stk.top();
                stk.pop();
        }

	return 0;
}



Measured memory_bytes: 35456
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int N;
    cin >> N;
    int tmp = 1;
    int count = 0;
    if ((N / tmp) % 10 == 2)
    {
        count++;
    }
    for (int i = 0; i < 3; i++)
    {
        tmp *= 10;
        if ((N / tmp) % 10 == 2)
        {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

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

int main(){
 int n,m;
  cin>>n>>m;
  vector<int> a(n,0),b(n,0);
  int c=0,w=0;
  for(int i=0;i<m;i++){
    int p;
    string s;
    cin>>p>>s;
    p--;
    if(a[p]==1) continue;
    if(s=="WA") b[p]++;
    if(s=="AC") {c++; w+=b[p]; a[p]=1;}
  }
  cout<<c<<" "<<w<<endl;
}

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

using namespace std;
class carditem{
public:
	char suits;	//???????????????'S'???????????????'H'???????????????'C'???????????????'D'
	int value;	//0???9
	int index;
	void setIndex() {
		index = g_index++;
	}
private:
	static int g_index;
};
int carditem::g_index = 0;

void InputCard(std::vector<carditem> & a) {
	int n;
	cin >> n;
	a.resize(n);
	for(int i=0;i<n;++i) {
		carditem & card = a.at(i);
		card.setIndex();
		string s;
		cin >> s;
		card.suits = s.at(0);
		cin >> card.value;
	}
}

void Printf(std::vector<carditem> & a) {
	for(int i=0;i<(int)a.size();++i) {
		carditem & card = a.at(i);
		cout  << card.suits << " " << card.value << std::endl;
	}
}

bool isStable(std::vector<carditem> & a) {
	for(int i=0,j;i<(int)a.size();++i) {
		if (i==0 || a.at(j).value != a.at(i).value){
			j = i;
		} else if (a.at(j).index > a.at(i).index){
			return	false;
		}
	}
	return true;
}

template<class T>
int Partition(std::vector<T> & A, int p,int r)
{
	T x = A[r];
	int i = p-1;
	for (int j = p; j <=r-1;++j) {
		if (A[j].value <= x.value) {
			i = i+1;
			swap(A[i],A[j]);
		}
	}
	swap(A[i+1],A[r]);
	return i+1;
}
template<class T>
void QuickSort(std::vector<T> & A, int p,int r)
{
	if (p < r) {
		int q = Partition(A, p, r);
		QuickSort(A,p,q-1);
		QuickSort(A,q+1,r);
	}
}

int main(){
	std::vector<carditem> A;
	::InputCard(A);
	QuickSort<carditem>(A, 0, (int)A.size()-1);

	bool isstable = ::isStable(A);
	cout  << (isstable ? "Stable" : "Not stable") << std::endl;
	::Printf(A);
}

Measured memory_bytes: 2324
#include <stdio.h>

int main(void)
{
	int sort[5];
	int i, j, tmp;
	
	for (i = 0; i < 5; i++){
		scanf("%d", &sort[i]);
	}
	
	for (i = 0; i < 5; i++){
		for (j = 0; j < 4; j++){
			if (sort[j] < sort[j + 1]){
				tmp = sort[j];
				sort[j] = sort[j + 1];
				sort[j + 1] = tmp;
			}
		}
	}
	
	for (i = 0; i < 5; i++){
		printf("%d", sort[i]);
		if (i != 4){
			printf(" ");
		}
		else {
			printf("\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 600
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
e=[[] for i in range(3*10**5+10)]

[n,m]=i2()
for i in range(m):
 [u,v]=i2()
 u-=1
 v-=1
 e[3*u].append(3*v+1)
 e[3*u+1].append(3*v+2)
 e[3*u+2].append(3*v)
 
[s,t]=i2()
s-=1
t-=1
from collections import deque
d=[-1 for i in range(3*10**5+10)]
def bfs(v):
   d[v]=0
   q=deque([v])
   while len(q):
    v=q.popleft()
    for i in e[v]:
      if d[i]<0:
         d[i]=d[v]+1
         q.append(i)
   if d[3*t]>-1:
     return d[3*t]//3
   return d[3*t]  
print(bfs(3*s))

Measured memory_bytes: 102924
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
cost = [None,2,5,5,4,5,6,3,7,6]

Aset = {}
for a in A:
    c = cost[a]
    Aset[c] = max(Aset[c], a) if c in Aset else a
A = sorted([v for k,v in Aset.items()])

dp = [None]*(N+1)
dp[0] = (0,[0]*len(A))

for ia, a in enumerate(A):
    c = cost[a]
    for i in range(c, N+1):
        t = dp[i-c]
        if t and (dp[i]==None or t[0]+1>=dp[i][0]):
            dp[i] = (t[0]+1, t[1].copy())
            dp[i][1][ia] += 1
      	
l=[]
for i in range(len(A)):
    l += [A[len(A)-1-i]]*dp[N][1][len(A)-1-i]

print(*l, sep='')

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

int main()
{
	string S;
	cin >> S;
	if (S[S.size()-1] == 's') cout << S << "es" << endl;
	else cout << S << "s" << endl;
	return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define EVEL 1

#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const int INF = 2000000000;

    string A,B,C;
    int N,M,K,X,Y,W,H;
    int ans;
    string S;
    int temp[100]={0};
    bool f=true;
    bool fir=true;

int main(){
    cin>>A>>B>>C;
    ((A[A.size()-1]==B[0])&&
    (B[B.size()-1]==C[0]))
    ?cout<<"YES":cout<<"NO";
    return 0;

}


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


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

    if(a+b>c+d)cout<<"Left"<<endl;
    else if(a+b<c+d)cout<<"Right"<<endl;
    else cout<<"Balanced"<<endl;
    


    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

int main(void) {
    int a, b, c, d;
    std::scanf("%1d%1d%1d%1d", &a, &b, &c, &d);
    if (a + b + c + d == 7) {
        std::printf("%d+%d+%d+%d=7\n", a, b, c, d);
    }
    else if (a + b + c - d == 7) {
        std::printf("%d+%d+%d-%d=7\n", a, b, c, d);
    }
    else if (a + b - c + d == 7) {
        std::printf("%d+%d-%d+%d=7\n", a, b, c, d);
    }
    else if (a + b - c - d == 7) {
        std::printf("%d+%d-%d-%d=7\n", a, b, c, d);
    }
    else if (a - b + c + d == 7) {
        std::printf("%d-%d+%d+%d=7\n", a, b, c, d);
    }
    else if (a - b + c - d == 7) {
        std::printf("%d-%d+%d-%d=7\n", a, b, c, d);
    }
    else if (a - b - c + d == 7) {
        std::printf("%d-%d-%d+%d=7\n", a, b, c, d);
    }
    else if (a - b - c - d == 7) {
        std::printf("%d-%d-%d-%d=7\n", a, b, c, d);
    }
    return 0;
}

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

using namespace std;

const int maxi = 1e6 + 10;
int a[maxi];
int n;
int d[maxi];
int main()
{
   cin>>n;

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

    d[n] = 0 ;
    int ans = 0;
   for (int i= n-1 ;i>0;i--){
    if (a[i]>=a[i+1]) d[i] = d[i+1] + 1; else
     d[i] = 0;
     ans = max (ans, d[i]);
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 4736
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let  s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        c: [[i32; 3]; 3]
    }
    let s = [
        c[0][0] + c[1][1] + c[2][2],
        c[0][1] + c[1][2] + c[2][0],
        c[0][2] + c[1][0] + c[2][1]
    ];

    println!(
        "{}",
        if s[0] == s[1] && s[1] == s[2] {
            "Yes"
        } else {
            "No"
        }
    );
}


Measured memory_bytes: 4352
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

		for(int i=0;i<n;i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		Arrays.sort(a);

		for(int j =0 ;j<n-1;j++) {
			if(a[j] == a[j+1]) {
				System.out.println("NO");
				return;
			}
		}

		System.out.println("YES");

	}

}

Measured memory_bytes: 66844
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
int dx[4] = { 0,  0, 1, -1 };
int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

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

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

typedef pair<char, char> TRS;

int main(void)
{
	int n;
	while(1)
	{
		TRS currTrs;
		vector<TRS> trsArr;
		cin >> n;
		if(n == 0)break;
		for(int i=0; i<n; i++)
		{
			cin >> currTrs.first >> currTrs.second;
			trsArr.push_back(currTrs);
		}
		
		char c;
		string s;
		cin >> n;
		for(int i=0; i<n; i++)
		{
			cin >> c;
			cin.clear();
			for(size_t trsId=0; trsId<trsArr.size(); trsId++)
			{
				if(c == trsArr[trsId].first)
				{
					c = trsArr[trsId].second;
					break;
				}
			}
			s.push_back(c);
		}
		cout << s.c_str() << endl;
	}
	return 0;
}

Measured memory_bytes: 1332
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int n; cin >> n;

	vector<int64_t> prev = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
	set<int64_t> ls = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
	int64_t d = 1;
	while (ls.size() <= 100000) {
		vector<int64_t> next;
		FOR_LT(i, 0, prev.size()) {
			int64_t m = prev[i] / d;
			if (m != 0) {
				next.push_back(prev[i] + (m - 1) * d * 10);
			}
			next.push_back(prev[i] + m * d * 10);
			if (m != 9) {
				next.push_back(prev[i] + (m + 1) * d * 10);
			}
		}
		for (auto e : next) {
			ls.insert(e);
		}
		prev = next;
		d *= 10;
	}

	auto it = ls.begin();
	FOR_LT(i, 0, n) {
		it++;
	}
	cout << *it << endl;

	return 0;
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define PI 3.141592653589793
ll R;
ll i, j, k;
int main(){
    scanf("%lld", &R);
    printf("%.12lf", R * 2 * PI);

    return 0;
}

Measured memory_bytes: 3784
N = int(input())
cake = N // 4
donuts = N // 7
calcs = False
for i in range(cake + 1):
  for j in range(donuts + 1):
    s = i * 4 + j * 7
    if s == N:
      calcs = True
      break
print('Yes' if calcs is True else 'No')

Measured memory_bytes: 2940
X = []
for i in range(3):
  N = list(map(int, input().split()))
  X.extend(N)
# print(X)

import collections
c = collections.Counter(X)
# print(c)
X = list(c.values())
X = sorted(X)
if X == [1,1,2,2]:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------
int N;
int a[110];

int main() {
  cin >> N;
  rep(i, 0, N) { cin >> a[i]; }
  sort(a, a + N);
  cout << a[N - 1] - a[0];
}


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

const ll MAXN = 200000;
const ll INF = 1001001001;
const ll MOD = 1000000007;

ll N, ans=0, tmp=0;
string S;
vector<vector<ll>> DP;

signed main(){
    cin >> S;
    //cout << S << endl;
    S = '0'+S;
    //cout << S << endl;
    DP.resize(1000005);
    for(int i=0;i<1000005;i++) {
        DP[i].resize(2,INF);
    }
    DP[0][0] = 0;
    for(int i=0;i<S.size();i++) {
        ll num = S[S.size()-1-i]-'0';
        for(int j=0;j<2;j++) {
            num += j;
            DP[i+1][0] = min(DP[i+1][0],DP[i][j]+num);
            DP[i+1][1] = min(DP[i+1][1],DP[i][j]+10-num);
        }
    }
    //cout << DP[1][0] << endl;
    cout << DP[S.size()][0] << endl;
    return 0;
}

Measured memory_bytes: 58880
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int N,Q;
  cin>>N>>Q;
  vector<int> A(N,N-2),B(N,N-2);
  int mna=N-2,mnb=N-2,ans=0;
  while(Q--){
    int a,x;
    cin>>a>>x;
    x--;
    if(a==1){
      if(mna>=x){
        for(int i=mna;i>=x-1;i--)A[i]=A[mna];
        mna=x-1;
      }
      ans+=A[x];
      B[mnb]=min(B[mnb],x-1);
      A[x]=0;
    }else{
      if(mnb>=x){
        for(int i=mnb;i>=x-1;i--)B[i]=B[mnb];
        mnb=x-1;
      }
      ans+=B[x];
      A[mna]=min(A[mna],x-1);
      B[x]=0;
    }
  }
  cout<<(N-2)*(N-2)-ans<<endl;
}

Measured memory_bytes: 6312
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
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;}

const int INF = 100000; 

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

    if(a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0){
        cout << "Possible" << endl;
    }else{
        cout << "Impossible" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	static long MOD = 1000_000_000 + 7;

	void run() {
		solver();
	}

	long calc(int[] len, int n) {
		long[][][] dp = new long[4][800][200];

		for (int idx = 0; idx < 4; idx++) {
			if (len[idx] > 0)
				len[idx]--;
			else
				continue;
			dp[idx][0][0] = 1;
			for (int length = 1; length <= 4; length++) {
				for (int k = 0; k < len[length - 1]; k++) {
					for (int i = 799; i >= length; i--) {
						for (int j = 199; j >= 1; j--) {
							if (dp[idx][i - length][j - 1] > 0) {
								dp[idx][i][j] += dp[idx][i - length][j - 1] * j;
								dp[idx][i][j] %= MOD;
							}
						}
					}
				}
			}
			len[idx]++;
		}
		long ans = 0;

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 800; j++) {
				for (int k = 0; k < 200 && n - 1 - k >= 0; k++) {
					if (dp[i][j][k] > 0) {
						ans = (ans + dp[i][j][k] * pow10[j] % MOD * sum[i] % MOD * perm[(n - 1) - k]) % MOD;
					}
				}
			}
		}
		return ans;
	}

	void solver() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] len = new int[4];
		sum = new long[4];
		int zero_idx = -1;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			if (a[i] == 0)
				zero_idx = i;
			len[(a[i] + "").length() - 1]++;
			sum[(a[i] + "").length() - 1] += a[i];
		}

		pow10[0] = 1;
		for (int i = 1; i < pow10.length; i++) {
			pow10[i] = (pow10[i - 1] * 10) % MOD;
		}
		for (int i = 0; i < 200; i++) {
			long factorial = 1;
			perm[i] = 1;
			for (int j = i; j >= 1; j--) {
				factorial = (factorial * j) % MOD;
				perm[i] = (perm[i] + factorial) % MOD;
			}
		}

		long ans = calc(len, n);
		if (zero_idx != -1) {
			len[0]--;
			ans = (ans - calc(len, n - 1) + MOD) % MOD;
		}
		System.out.println(ans);
	}

	long[] pow10 = new long[810];
	long[] sum;
	long[] perm = new long[200];
}

Measured memory_bytes: 39092
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class Task{
public:
    void solve(istream& in, ostream& out){
        int ab, bc, ca;
        in>>ab>>bc>>ca;
        out<<ab*bc/2<<'\n';
    }
};

int main(){
    istream& in(cin);
    ostream& out(cout);
    ios_base::sync_with_stdio(false);
    in.tie(nullptr), out.tie(nullptr);
    Task solver;
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <iomanip>
#include <valarray>
#include <vector>
#include <sstream>

void output(std::vector<int> values){
    for(int i = 0; i < values.size()-1; ++i){
        std::cout << values[i] << " ";
    }
    std::cout << values[values.size()-1] << std::endl;
}


int main(int argc, char *argv[])
{
    int n;
    std::cin >> n;
    std::vector<int> values;

    for(int i = 0; i < n; ++i){
        int val;
        std::cin >> val;
        values.push_back(val);
    }

    output(values);

    for(int i = 1; i < n; ++i){
        int key = values[i];
        int j = i-1;
        while(j >= 0 && values[j] > key){
            values[j+1] = values[j];
            --j;
        }
        values[j+1] = key;
        output(values);
    }

}

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

// pbds
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
// gp_hash_table<int, int> table;

using namespace std;

#define vec vector
#define ALL(x) begin(x), end(x)

typedef unsigned long long ull;
typedef unsigned int ui;
typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef pair< long long, long long > pll;

const int inf = 1000 * 1000 * 1000;
const ll inf64 = 1e18;

int main() {

#ifdef debug
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, a, b;

    cin >> n >> a >> b;

    int cnt[3] = {0};

    for(int x, i = 0;i < n;i++) {
        cin >> x;
        if(x <= a) cnt[0]++;
        else if(x > 0 && x <= b) cnt[1]++;
        else cnt[2]++;
    }

    cout << min({cnt[0], cnt[1], cnt[2]}) << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int H, W;
vector<string> S;

void input() {
  int x, y, z;
  cin >> H >> W;
  S.resize(H);
  rep(i, 0, H - 1) { cin >> S[i]; };
}

int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[8] = {-1, 0, 1, 1, -1, -1, 0, 1};
int cnt(int h, int w) {
  int ret = 0;
  rep(i, 0, 7) {
    int hh = h + dx[i];
    int ww = w + dy[i];
    if (hh >= 0 && hh < H && ww >= 0 && ww < W) {
      if (S[hh][ww] == '#') ret++;
    }
  }
  return ret;
}
void solve() {
  ;
  rep(i, 0, H - 1) {
    rep(j, 0, W - 1) {
      if (S[i][j] != '#')
        cout << cnt(i, j);
      else
        cout << S[i][j];
    }
    cout << endl;
  };
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<iostream>
#include<map>
#include<queue>
#include<climits>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define mkp make_pair
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
/*
ll bin(ll i,ll j){
	ll mid=(i+j)/2;
	if(a[mid]==x)reutrn mid;
	else if(ans>x)return bin(i,mid-1);
	else return bin(mid+1,j);
}/*
ll power(ll base,ll power){
    ll res=1;
    base=base%mod;
    while(power>0){
    	if(power&1){
    		res=(res*base)%mod;
		}
		power=power>>1;
		base=(base*base)%mod;
	}
	return res;
}
*/
/*
int nCr(int x, int y){
	if(y>x)return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=mod;
	num*=invfact[x-y];
	num%=mod;
	return num;
}
*/
/*bool prime[n+1];
void SieveOfEratosthenes(int n){
	rep(i,0,n+1)prime[i]=true
    for (int p=2;p*p<=n;p++)
        if (prime[p])
            for (int i=p*p;i<=n;i+=p)prime[i]=false;
}*/
/*
int gcd(int a,int b){
	if(b==0)return a;
	else return gcd(b,a%b);
}
*/
int solve(){
    int n,m;
    cin>>n>>m;
    vector<vector<int> > vec(n+1);
    rep(i,0,m){
    	int a,b;
    	cin>>a>>b;
    	vec[a].pb(b);
    	vec[b].pb(a);
	}
	queue<int> q;
	q.push(1);
	vector<int> ans(n+1,-1);
	vector<int> vst(n+1,-1);
	vst[1]=1;
	while(!q.empty()){
		int u=q.front();
		q.pop();
		rep(i,0,vec[u].size()){
			if(vst[vec[u][i]]==-1){
				ans[vec[u][i]]=u;
				vst[vec[u][i]]=1;
				q.push(vec[u][i]);
			}
		}
	}
	rep(i,2,n+1)if(ans[i]==-1)return cout<<"No"<<endl,0;
	cout<<"Yes"<<endl;
	rep(i,2,n+1)cout<<ans[i]<<endl;
	return 0;
}
int main(){
    waste;
    int t;
    //cin>>t;
    t=1;
    while(t--){
       	solve();
    }
}


Measured memory_bytes: 10684
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long 
#define mod 1000000007

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

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int desc(const void *a, const void *b) {
  return *(int *)b - *(int *)a;
}

int main(void){
    int n,i,r=1,before;
    int arr[999];
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&arr[i]);
    qsort(arr,n,4,desc);
    before=arr[0];
    for(i=1;i<n;i++){
        if(before!=arr[i]){
            before=arr[i];
            r++;
        }
    }
    printf("%d\n",r);
    return 0;
}

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

using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    cout << (N + 1) / 2 * 1.0 / N << endl;
}

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

int main() {

  while(1) {

    int h,w,tan;

    cin >> h >> w;

    if(h == 0 && w == 0) break;
    tan = h*h+w*w;
    int ai = 1,aj = 1;
    int tan2;
    bool f=0;
    
    for(int i=1;i<h+101;i++) {
      for(int j=1;j<w+101;j++){
	tan2 = i*i+j*j;
	if(tan2 > tan){
	  if(i==1){
	    aj=j;
	    break;
	  }
	  else if(ai*ai+aj*aj > tan2 && i<j){ 
	    ai=i;
	    aj=j;
	  }
	}
	else if(tan==tan2 && i>h && i<j){
	  ai=i;
	  aj=j;
	  f=1;
	  break;
	}
      }
      if(f==1) break;
    }
    cout << ai <<" "<< aj << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <queue>
#include <map>
using namespace std;
int main(){
	int t,data[16][16],flag[16][16];
	for(cin>>t;t>0;t--){
		int x,y,n,x1,y1,x2,y2;
		cin>>x>>y;
		for(int i=0;i<=y;i++)for(int j=0;j<=x;j++)flag[j][i]=data[j][i]=0;
		data[x][y]=1;
		queue<int>X;
		queue<int>Y;
		X.push(x);
		Y.push(y);
		map<int,int>out;
		for(cin>>n;n>0;n--){
			cin>>x1>>y1>>x2>>y2;
			out[x1*1000000+y1*10000+x2*100+y2]=1;
			out[x2*1000000+y2*10000+x1*100+y1]=1;
		}
		while(X.empty()==0){
			x=X.front();
			y=Y.front();
			if(flag[x][y]==0){
				flag[x][y]=1;
				if(y>0)if(out[x*1000000+y*10000+x*100+y-1]==0)data[x][y-1]+=data[x][y],X.push(x),Y.push(y-1);
				if(x>0)if(out[x*1000000+y*10000+(x-1)*100+y]==0)data[x-1][y]+=data[x][y],X.push(x-1),Y.push(y);
			}
			X.pop();
			Y.pop();
		}
		if(data[0][0]==0)cout<<"Miserable Hokusai!"<<endl;
		else cout<<data[0][0]<<endl;
	}
	return 0;
}


Measured memory_bytes: 1228
s=input()
if len(s)%2==1:
    s=s[:-1]
else:
    s=s[:-2]

for i in range(len(s)):
    n=len(s)
    if s[:n//2]==s[n//2:]:
        print(n)
        break
    else:
        s=s[:-2]
else:
    print(-1)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
	char N[5];
	cin >> N;
	if((N[0] == N[1] && N[1] == N[2]) || (N[1] == N[2] && N[2] == N[3])) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.println(a * b + " " + (a * 2 + b * 2));
		
	}
				
	

}


Measured memory_bytes: 26052
public class Main {
 
  private static void solve() {
    int k = ni();

    out.println((k / 2) *( (k + 1) / 2));
  }
 
  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }
 
  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;
 
  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
 
  private static double nd() {
    return Double.parseDouble(next());
  }
 
  private static long nl() {
    return Long.parseLong(next());
  }
 
  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }
 
  private static char[] ns() {
    return next().toCharArray();
  }
 
  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }
 
  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }
 
  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }
 
  private static int ni() {
    return Integer.parseInt(next());
  }
 
  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
 }

Measured memory_bytes: 21204
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
///                                Q                          ///
///                     ______    /|\                         ///
///                     (_     Z.(o\_)=="#                    ///
///                     __Z        / \                        ///
///                    |()|        \  \                       ///
///                    |__|        ~   ~                      ///
///                                                           ///
///                                                           ///
///    ██▓ ███▄    █   ██████  ▄▄▄     ▓██   ██▓ ███▄    █    ///
///   ▓██▒ ██ ▀█   █ ▒██    ▒ ▒████▄    ▒██  ██▒ ██ ▀█   █    ///
///   ▒██▒▓██  ▀█ ██▒░ ▓██▄   ▒██  ▀█▄   ▒██ ██░▓██  ▀█ ██▒   ///
///   ░██░▓██▒  ▐▌██▒  ▒   ██▒░██▄▄▄▄██  ░ ▐██▓░▓██▒  ▐▌██▒   ///
///   ░██░▒██░   ▓██░▒██████▒▒ ▓█   ▓██▒ ░ ██▒▓░▒██░   ▓██░   ///
///   ░▓  ░ ▒░   ▒ ▒ ▒ ▒▓▒ ▒ ░ ▒▒   ▓▒█░  ██▒▒▒ ░ ▒░   ▒ ▒    ///
///    ▒ ░░ ░░   ░ ▒░░ ░▒  ░ ░  ▒   ▒▒ ░▓██ ░▒░ ░ ░░   ░ ▒░   ///
///    ▒ ░   ░   ░ ░ ░  ░  ░    ░   ▒   ▒ ▒ ░░     ░   ░ ░    ///
///    ░           ░       ░        ░  ░░ ░              ░    ///
///                                     ░ ░                   ///
///                                                           ///
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////

#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define test int t; cin >> t;
using namespace std;

signed main() {
    quickie

    int n ;

    cin >> n ;

    int a[n][3], s[n][3] ;

    cin >> a[0][0] >> a[0][1] >> a[0][2] ;

    s[0][0] = a[0][0] ;

    s[0][1] = a[0][1] ;
    
    s[0][2] = a[0][2] ;

    rep(i, 1, n) {

        cin >> a[i][0] >> a[i][1] >> a[i][2] ;

        s[i][0] = max((a[i][0]+s[i-1][1]), (a[i][0]+s[i-1][2])) ;

        s[i][1] = max((a[i][1]+s[i-1][0]), (a[i][1]+s[i-1][2])) ;

        s[i][2] = max((a[i][2]+s[i-1][0]), (a[i][2]+s[i-1][1])) ;  

    }
    int l = max(s[n-1][0], s[n-1][1]) ;
    cout << max(l, s[n-1][2]) << endl ;

}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
#define PR(x) cout << (x) << "\n"
#define PS(x) cout << (x) << " "
const long long INF = numeric_limits<long long>::max();

ll GCD(ll a, ll b) {
    if (a > b) swap(a, b);
    while (b != 0) {
        ll c = b;
        ll d = a % b;
        a    = c;
        b    = d;
    }
    return a;
}

int main() {
    ll N, X;

    ll d;
    cin >> N >> X;
    ll ans = 0;
    REP(i, N) {
        cin >> d;
        ans = GCD(ans, abs(d - X));
    }

    PR(ans);

    return 0;
}

Measured memory_bytes: 3624