akhauriyash/Code-Regression huggingface dataset:
package main
 
import (
  "bufio"
  "os"
  "strconv"
  "fmt"
)
 
var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  var line, buffer []byte
  var isPrefix bool = true
  var err error
  for isPrefix {
    line, isPrefix, err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
  }
  return string(buffer)
}
func NextInt() int {
  var n int
  n, _ = strconv.Atoi(NextLine())
  return n
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func Output() {
  _ = writer.Flush()
}

func main() {
  N := NextInt()
  S := NextLine()
  pre := ' '
  cnt := N - N
  for _, s := range S {
    if s != pre {
      pre = s
      cnt++
    }
  }
  Write(cnt)
  Output()
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
	class Program
	{
		static void Main(string[] args) {
			int N = Int32.Parse(Console.ReadLine());
			long w, h, n;
			w = 1;

			for (h = 1; h <= 3500; h++) {
				for (n = 1; n <= 3500; n++) {
					var x = (-N * n + 4 * h * n - h * N);
					if(x==0) continue;
					
					w = h * N * n / x;
					if(w<0) continue;
					if (4 * n * h * w == N * (h * n + n * w + h * w)) {
						Console.WriteLine(h+" "+n+" "+w);
						return;
						
					}
				}
			}
		}
	}
}


Measured memory_bytes: 13268
#include<stdio.h>
#include<algorithm>
using namespace std;
int p[200];
int main(){
	int a;
	scanf("%d",&a);
	for(int i=0;i<(a*(a-1)/2);i++){
		int b,c,d,e;
		scanf("%d%d%d%d",&b,&c,&d,&e);
		b--;c--;
		if(d>e)p[b]+=3;
		else if(e>d)p[c]+=3;
		else {p[b]++;p[c]++;}
	}
	for(int i=0;i<a;i++){
		int num=1;
		for(int j=0;j<a;j++){
			if(p[j]>p[i])num++;
		}
		printf("%d\n",num);
	}
}

Measured memory_bytes: 1032
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define EPS 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f3f3f3f3f
#define MEM(a, b) memset(a, b, sizeof(a))
#define PPER(i, n, m) for (int i = n; i >= m; i--)
#define REPP(i, n, m) for (int i = n; i <= m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define PER(i, n, m) for (int i = n; i > m; i--)
#define SA(n) scanf("%d", &(n))
#define SLLA(n) scanf("%lld", &(n))
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define DE(val) cout << #val << ": " << val << endl;
 
const int dx44[6] = {0, -1, -1, 1, 1};
const int dy44[6] = {0, -1, 1, -1, 1};
const int dx4[6] = {0, 1, 0,-1};
const int dy4[6] = {1, 0, -1,0};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int dx82[9] = {0, -1, -1, 1, 1, 2, 2, -2, -2};
const int dy82[9] = {0, 2, -2, 2, -2, 1, -1, 1, -1};

void update(ll& x,ll v){
    if(x==-1)x=v;
    else if(x>v)x=v;
}
 
ll po(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
void extgcd(ll a, ll b, ll &d, ll &x, ll &y)
{
    if (!b)
    {
        d = a;
        x = 1;
    }
    else
    {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
ll inverse(ll a, ll n)
{
    ll d, x, y;
    extgcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn = 2e5 + 15;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
/*************************************************************************/


 void solve() {
    int a,b;
    cin>>a>>b;
    cout<<6-a-b<<endl;
 }
  
int main()
{   
    //freopen("i.txt", "r", stdin);
    // freopen("o.txt", "w", stdout);
    solve();
    return 0;
 
}
 

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  char a[H+1][W+1];
  for(int i=0;i<H;i++){
    for(int k=0;k<W;k++){
      cin>>a[i][k];
    }
  }
  char ans[H+1][W+1];
  int countr=0;
  int countc=0;
  for(int i=0;i<H;i++){
    int juge=0;
    for(int k=0;k<W;k++){
      if(a[i][k]=='#'){
        juge=1;
      }
    }
    //cout<<juge<<endl;
    if(juge==1){
      for(int h=0;h<W;h++){
        ans[countr][h]=a[i][h];
        //cout<<ans[countr][h]<<endl;
      }
      countr++;
    }
  }
  char answ[H+1][W+1];
  for(int k=0;k<W;k++){
    int juge=0;
    for(int i=0;i<countr;i++){
      if(ans[i][k]=='#'){
        juge=1;
      }
    }
    if(juge==1){
      for(int h=0;h<countr;h++){
        answ[h][countc]=ans[h][k];
      }
      countc++;
    }
  }
  for(int i=0;i<countr;i++){
    for(int k=0;k<countc;k++){
      cout<<answ[i][k];
    }
    cout<<endl;

  }

return 0;
}


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

using namespace std;
typedef long long ll;

ll N;
string s;
ll dp[1000005][2];

int main(){
    cin >> s;
    reverse(s.begin(),s.end());
    s += '0';
    N = s.size();
    for(int i=0;i<=N;i++){
        for(int j=0;j<2;j++){
            dp[i][j] = 1e15;
        }
    }
    dp[0][0] = 0;
    for(int i=0;i<N;i++){
        ll n = s[i] - '0';
        for(int j=0;j<2;j++){
            for(int k=0;k<10;k++){
                ll a = k;
                if(j==1) a--;
                if(a - n < 0){
                    dp[i+1][1] = min(dp[i+1][1], dp[i][j] + k + (a-n+10));
                }else{
                    dp[i+1][0] = min(dp[i+1][0], dp[i][j] + k + (a-n));
                }
            }
        }
    }
    cout << dp[N][0] << endl;
    return 0;
}

Measured memory_bytes: 17028
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define ll_MAX LONG_LONG_MAX
#define ll_MIN LONG_LONG_MIN
#define pi pair<ll,ll>
#define endl "\n"
#define MAXN 100005
#define mod ((ll)(1e9 + 7))
using namespace std;

ll n,x,cnt;
vector<ll> v;

void solve()
{
    cin>>n;
    for(ll i=0;i<n;i++)
    {
        cin>>x;
        v.pb(x);
    }
    sort(v.begin(),v.end(),greater<ll>());
    vector<ll> v1;
    for(ll i=0;i<(n+1)/2;i++)
    {
        v1.pb(v[i]);
        if(i>0) cnt+=v1[i-1];
    }
    for(ll i=(n+1)/2;i<n;i++)
    {
        ll idx=i-(n+1)/2+1;
        if(idx==v1.size()) idx--;
        cnt+=(v1[idx]);
    }
    cout<<cnt<<endl;
}

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

Measured memory_bytes: 6624
N = int(input())
A, B = map(int,input().split())
P = list(map(int,input().split()))

count1 = 0
count2 = 0
count3 = 0

for i in range(N):
  if P[i] <= A:
    count1 +=1
  elif A < P[i] and P[i] <= B:
    count2 +=1
  else:
    count3 +=1

print(min(count1,count2,count3))

Measured memory_bytes: 3064
#include<iostream>
#include<bitset>
#include<cmath>
using namespace std;

int main()
{
  int money, k, d;
  cin >> money >> k;

  bitset<10> bad_num(0);
  for(int i = 0; i < k; i++){
    int num;
    cin >> num;
    bad_num = bad_num | bitset<10>(1 << num);
  }

  for(int i = money; i <= money * 10; i++){
    int digit = log10(i) + 1;
    int bad = 0;
    for(int d = 0; d < digit; d++){
      int num = (i / (int(pow(10, d)))) % 10;
      bad = (bad_num & bitset<10>(1 << num)).count();
      if(bad) break;
    } 
    if(bad) continue;
    cout << i << endl;
    break;
  }

  return 0;
}

Measured memory_bytes: 640
using System;

namespace abc065_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = new int[n];
            for (int i = 0; i < n; i++)
            {
                x[i] = int.Parse(Console.ReadLine());
            }
            bool[] flag = new bool[n];
            int now = 0;
            int ret = 0;
            while (!flag[now] && now != 1)
            {
                flag[now] = true;
                now = x[now] - 1;
                ret++;
            }
            Console.WriteLine(now == 1 ? ret : -1);
        }
    }
}

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

class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int[] abc = new int[3];
    for (int i = 0; i < 3; i++) {
      abc[i] = scanner.nextInt();
    }
    scanner.close();
    Arrays.sort(abc);
    int min = abc[0];
    int mid = abc[1];
    int max = abc[2];
    int ans = 0;
    if ((mid - min) % 2 != 0) {
      ans++;
      min++;
      max++;
    }
    ans += (2 * max - mid - min) / 2;
    System.out.println(ans);
  }

}


Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

int top;
int S[1000];

void initialize() {
    top = 0;
}

int isEmpty() {
    return top == 0;
}

int isFull() {
    return top >= 1000 - 1;
}

void push(int x) {
    if (isFull()) {
        printf("Error");
    }
    S[++top] = x;
}

int pop() {
    if (isEmpty()) {
        printf("Error");
    }
    top--;
    return S[top + 1];
}

int main(void) {
    int a, b;
    char s[1000];
    initialize();

    while( cin >> s ) {
        if (s[0] == '+') {
            a = pop();
            b = pop();
            push(a + b);
        } else if (s[0] == '-') {
            a = pop();
            b = pop();
            push(b - a);
        } else if (s[0] == '*') {
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(s));
        }
    }

    cout << pop() << endl;

    return 0;
}


Measured memory_bytes: 3112
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed 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
def main():
    N, M = (int(_) for _ in input().split())
    P = [int(_) for _ in input().split()]
    swap = [[int(_) for _ in input().split()] for __ in range(M)]

    par = [i for i in range(N+1)]
    rank = [0] * (N+1)

    # 要素xの親ノードを返す
    def find(x):
        if par[x] == x:
            return x
        par[x] = find(par[x])
        return par[x]

    # 要素x, yの属する集合を併合
    def unite(x, y):
        x, y = find(x), find(y)
        if x == y:
            return
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1
        return

    # xとyが同じ集合に属するか？
    def same(x, y):
        return find(x) == find(y)

    for a, b in swap:
        unite(a, b)

    ret = 0
    for i, p in enumerate(P, 1):
        if same(i, p): ret += 1
    print(ret)
    return

if __name__ == '__main__':
    main()


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

using namespace std;
typedef long long ll;
int main(){
    ll n;cin>>n;
    for(int i=-120;i<=120;i++){
        for(int j=-120;j<=120;j++){
            ll x=(i*i*i*i*i)-(j*j*j*j*j);
            if(x==n){
                cout << i <<" "<<j<<endl;
                return 0;
            }
        }
    }
}


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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

string s;

int main()
{
    cin>>s;
    if (s[0]=='S') cout<<"Cloudy";
    else if (s[0]=='C') cout<<"Rainy";
    else cout<<"Sunny";
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> dp(2 * N + 1, 1000000001);
  dp[0] = 0;
  for (int i = 0; i < N; ++i) {
    dp[i + 1] = min(dp[i] + 1, dp[i + 1]);
    for (int j = 6; j <= N; j *= 6)
      dp[i + j] = min(dp[i] + 1, dp[i + j]);
    for (int k = 9; k <= N; k *= 9)
      dp[i + k] = min(dp[i] + 1, dp[i + k]);
  }
  cout << dp[N] << endl;
}


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

namespace abc175.b
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = getIntParam();
            long[] paramArray = getLongParams();

            int ret = 0;
            for (int i = 0; i < num; i++)
            {
                for (int j = i + 1; j < num; j++)
                {
                    for (int k = j + 1; k < num; k++)
                    {
                        long[] comb = new long[] { paramArray[i], paramArray[j], paramArray[k] };
                        Array.Sort(comb);

                        if ((comb[0] != comb[1]) && (comb[0] != comb[2]) && (comb[1] != comb[2]))
                        {
                            if (comb[0] + comb[1] > comb[2])
                            {
                                ret++;
                            }
                        }
                    }
                }
            }
            Console.WriteLine(ret);
        }

        //↓↓↓ shared function ↓↓↓
        static int getIntParam()
        {
            return int.Parse(Console.ReadLine());
        }
        static int[] getIntParams()
        {
            return Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
        }
        static long getLongParam()
        {
            return long.Parse(Console.ReadLine());
        }
        static long[] getLongParams()
        {
            return Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
        }
        static string getStringParam()
        {
            return Console.ReadLine();
        }
        static string[] getStringParams()
        {
            return Console.ReadLine().Split(' ');
        }
    }
}


Measured memory_bytes: 35644
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define space ' '
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn = 300;
ll n,m,l;
ll g[maxn][maxn];
ll dis[maxn][maxn];
int q;
int ans[maxn*maxn];

int main(){
    
    cin >> n>>m>>l;
    
    rep(i,n){
        rep(j,n){
            if(i==j)dis[i][j]=dis[j][i]=g[i][j]=g[j][i]=0;
            else dis[i][j]=dis[j][i]=g[i][j]=g[j][i]=INF;
        }
    }
    
    rep(i,m){
        int s,t;
        ll c;
        cin >> s>>t>>c;
        dis[s-1][t-1]=dis[t-1][s-1]=c;
    }
    
    rep(k,n){
        rep(i,n){
            rep(j,n){
                dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
            }
        }
    }
    
    rep(i,n){
        rep(j,n){
            if(i!=j&&dis[i][j]<=l)g[i][j]=g[j][i]=1;
        }
    }
    
    rep(k,n){
        rep(i,n){
            rep(j,n){
                g[i][j]=g[j][i]=min(g[i][j],g[i][k]+g[k][j]);
            }
        }
    }
    
    cin >> q;
    
    rep(i,q){
        int s,t;
        cin >> s>>t;
        s--;t--;
        if(g[s][t]!=INF)ans[i]=g[s][t]-1;
        else ans[i]=-1;
    }
    
    rep(i,q){
        cout << ans[i]<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 2304
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String first = str.substring(0, 1);
    String fin = str.substring(str.length() - 1, str.length());
    
    int len = str.length() - 2;
    
    
    System.out.println(first + len + fin);
  }
}

Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

bool fn_is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

bool isOK(int index, int key, vector<ll>& a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key, vector<ll>& a) {
    int ng = -1;
    int ok = a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key, a)) ok = mid;
        else ng = mid;
    }
    return ok;
}

struct UnionFind {
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }

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

ll calc(ll a, ll b, ll p) {
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll d = calc(a, b/2, p);
        return (d * d) % p;
    } else {
        return (a * calc(a, b-1, p)) % p;
    }
}
     
int main()
{
    int m; cin >> m;
    cout << 24 + (24-m) << endl;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long int a[100005],i,j,n,k,ans;ans=0;
    memset(a,0,sizeof(a));
    scanf("%ld",&n);
    for(i=1;i<=n;i++)
        scanf("%ld",&a[i]);
    sort(a+1,a+n+1);
    if(n%2==1)
    {

        j=2;
        for(i=2;i<=n;)
        {
            if(a[1]!=0||a[1]==a[2])
        {
            ans=-1;
            break;
        }
            if(a[i]!=a[i+1]||a[i]!=j)
            {

                ans=-1;
                break;}
                j=j+2;
                i=i+2;

        }

    }
    else
    {
        j=1;
        for(i=1;i<n;)
        {

           if(a[i]!=a[i+1]||a[i]!=j)
            {

                ans=-1;
                break;}
                j=j+2;
                i=i+2;

        }
    }
    if(ans==-1)
        ans=0;
    else
    {ans=1;
       for(i=1;i<=n/2;i++)
        {ans=ans*2;
       ans=ans%1000000007;}
    }

    printf("%ld",ans);
    return 0;




}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)

const long long  int INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
#define COUT(x) cout<<x<<"\n"

void Main()
{
	ll N;
	VS S(3);
	REP(i, 3) cin >> S[i];
	COUT(S[0][0]<<S[1][1]<<S[2][2]);
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  int d,t,s;
  cin >> d >> t >> s;
  if(d<=t*s){
    cout <<"Yes";
  }else{
    cout << "No";
  }
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;

#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()

#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;
#define nl endl

#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)

#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)

#define MAXN        100000007
#define INF 0x3f3f3f3f
bool mark[100005];vi prime;
void seive(ll N){for(int i=2;i<=N;i++){if(mark[i]==false){prime.pb(i);for(int j=i+i;j<N;j+=i)mark[j]=true;}}}
//freopen("input.txt", "r", stdin);

int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  long long total=b-a+1;

  ll cb=b/c;
  ll db=b/d;
  ll ca=--a/c;
  ll da=a/d;

  ll tc=cb-ca;ll td=(db-da);

  ll lcm=(c/__gcd(c,d))*d;
  ll tla=a/lcm;
  ll tlb=b/lcm;
  ll tl= tlb-tla;

  cout<<total-(tc+td-tl)<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0; i < n; i++)
#define REPR(i, n) for(long long i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(long long i = m; i <= n; i++)
#define FORR(i, m, n) for(long long i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;



int main(){FIN

    ll ans=0;
    ll mn=10;
    REP(i,5){
        ll a; cin>>a;

        if (a%10==0) ans+=a;
        else{
            mn = min(mn,a%10);
            ans+=(a-(a%10)+10);
        }
    }
    if(mn!=10){
        ans -= (10-mn);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(int argc,char* argv[]){
  int dis[101],flag[101];
  vector<queue<int> > vec(101);
  int n,id,cnt,x,val=0;

  memset(dis,255,sizeof(dis));
  memset(flag,0,sizeof(flag));

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>id>>cnt;
    queue<int> tmp;
    for(int l=0;l<cnt;l++){
      cin>>x;
      tmp.push(x);
    }
    vec[id]=tmp;
  }

  queue<int> que;
  que.push(1);
  while(!que.empty()){
    queue<int> tmp=que;
    while(!que.empty())
      que.pop();
    int p;

    while(!tmp.empty()){
      p=tmp.front();tmp.pop();
      if(dis[p]==-1)
	dis[p]=val;

      while(!vec[p].empty()){
	que.push(vec[p].front());
	vec[p].pop();
      }
    }
    val++;
  }

  for(int i=1;i<=n;i++)
    printf("%d %d\n",i,dis[i]);

  return 0;
}

Measured memory_bytes: 1304
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
import queue
import copy
import bisect


def dfs(s, prev, pre):
  val[s] += Ope[s] + prev
  for i in G[s]:
    if(i == pre):
      continue
    dfs(i, val[s], s)

def bfs(sx, sy, n):
  que = deque([[sy,sx]])
  while que:
    y,x = que.popleft()
    for i,j in D:
      if(x+i<0 or y+j<0 or x+i>W-1 or y+j>H-1):
        continue
      dist = G[y+j][x+i]
      if(G[y+j][x+i] != "X"):
        if(type(G[y+j][x+i]) is str):
          G[y+j][x+i] = G[y][x]+1
          que.append([y+j,x+i])
        elif(dist>G[y][x]+1):
          G[y+j][x+i] = G[y][x]+1
          que.append([y+j,x+i])
        

#X = str(input()).split()
#a = [int(x) for x in input().split()]
#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]

S = str(input())
ans = "Yes"

if(S=="AAA" or S=="BBB"):
  ans = "No"
  

print(ans)


Measured memory_bytes: 38764
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <utility>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

string S, T;
set<pair<char, char> > s;

void replace(char c1, char c2) {
  rep(i, S.size()) {
    if (S[i] == c1) S[i] = c2;
    else if (S[i] == c2) S[i] = c1;
  }
}

int main() {
  cin >> S >> T;
  rep(i, S.size()) {
    if (s.find(make_pair(S[i], T[i])) != s.end()) {
      continue;
    } else {
      s.insert(make_pair(S[i], T[i]));
    }
    replace(S[i], T[i]);
    if (S == T) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 904
# jsc2019-qualB - Kleene Inversion
from collections import Counter


def main():
    N, K = tuple(map(int, input().split()))
    A = tuple(map(int, input().split()))
    MOD = 10 ** 9 + 7
    C = Counter(A)
    x = sum(sum(j > i for j in A) * c for i, c in C.items())
    y = sum(sum(b > a for b in A[i + 1 :]) for i, a in enumerate(A[:-1]))
    ans = (x * K * (1 + K) // 2) % MOD
    ans = (ans - y * K) % MOD
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3564
#include <iostream>
using namespace std;
typedef long long ll;
ll n, k, a, x;
int main(void){
    // Your code here!
    cin >> n >> k;
    for (ll i = 0; i < n; i++) {
        cin >> a;
        if (a == 1) x = i;
    }
    cout << (n - 2) / (k - 1) + 1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
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 REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define V vector<int>
#define VLL vector<long long>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	int N, K;  cin >> N >> K;
	int R, S, P;  cin >> R >> S >> P;
	string T;  cin >> T;
  	bool keep[100000];
  	fill(keep, keep + N, true);
	ll ans = 0;
	for(int i = 0 ; i < T.size() ; i++){
		if(i - K >= 0 && T[i] == T[i - K] && keep[i - K]){
          keep[i] = false;
          continue;
        }

		switch(T[i]){
			case 'r' :  ans += P;  break;
			case 's' :  ans += R;  break;
			case 'p' :  ans += S;  break;
		}
	}

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

Measured memory_bytes: 592
s = gets.chomp.to_i

pre = s
t = { s => 1}
range = 2..1000000
range.each do |i|
    n = pre
	if n % 2 == 0
		v = pre / 2
	else
		v = 3 * n + 1
	end

	if t[v]
		puts i
		break
	end

	t[v] = i
	pre = v
end




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

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

Measured memory_bytes: 256
def main():
    N = int(input())
    D = [int(input()) for i in range(N)]
    C = [1] * N
    T = [0] * N
    DI = {}
    for i in range(len(D)):
        DI[D[i]] = i
    D = sorted(D)
    P = [-1] * N
    while len(D) > 1:
        d = D.pop()
        i = DI[d]
        nd = d - N + C[i] * 2
        if nd in DI:
            ni = DI[nd]
        else:
            print(-1)
            return
        P[i] = ni
        C[ni] += C[i]
        T[ni] += T[i] + C[i]
    
    if D[0] == T[DI[D[0]]]:
        for i in range(N):
            if P[i] >= 0: print(i+1, P[i]+1)
    else:
        print(-1)

main()

Measured memory_bytes: 26256
k,n=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
    if i == 0:
        d=k-a[n-1]+a[i]
        maxd=d
    else:
        d=a[i]-a[i-1]
        maxd=max(maxd,d)
print(k-maxd)

Measured memory_bytes: 26420
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a,b,c;
  cin>>a;
  cin>>b;
  cin>>c;
  a[0]=a[0]-32;
  b[0]=b[0]-32;
  c[0]=c[0]-32;
  cout<<a[0]<<b[0]<<c[0];
  cout<<"\n";
}


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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    while(1){
        //高橋君の攻撃
        c -= b;
        if(c<=0){
            cout << "Yes" << endl;
            break;
        }
        //青木君の攻撃
        a -= d;
        if(a <=0){
            cout << "No" << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3636
import java.util.*;
class Main {
    public static void main (String[] args){
        Scanner sc = new Scanner (System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();
        if ( (x - r >= 0) && (x + r <= W) && (y - r >= 0) && (y + r <= H))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 26352
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 130000;
char cn[CM + 10], * ci = cn + 10, * owa = cn + CM;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	char c = ci[8];
	ci[8] = 0;
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci[8] = c;
	ci += (64 - dig >> 3) + 1;

	if (ci - owa > 0) {
		memcpy(cn, owa, 10);
		ci -= CM;
		fread(cn + 10, 1, CM, stdin);
	}
	return tmp;
}

char* di = cn;
const int MAX = 200000;
class shuturyoku_unko {
public:
	char C[MAX * 6 - 100000];
	int K[MAX + 10];
	constexpr shuturyoku_unko() : C(), K() {
		auto di = C + 1;
		C[0] = '0';
		K[1] = 1;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			K[i + 1] = K[i] + keta;
		}
	}
} f;
inline void putint(ll X) {
	int ue = X / 100000;
	if (ue) {
		memcpy(di, f.C + f.K[ue], f.K[ue + 1] - f.K[ue]);
		di += f.K[ue + 1] - f.K[ue];
		int sita = X - ue * 100000ll;
		rep(i, 5 - f.K[sita + 1] + f.K[sita])* di++ = '0';
		memcpy(di, f.C + f.K[sita], f.K[sita + 1] - f.K[sita]);
		di += f.K[sita + 1] - f.K[sita];
	}
	else for (int i = f.K[X]; i < f.K[X + 1]; i++)* di++ = f.C[i];
	*di++ = '\n';
}

int B[200001];

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


	fread(ci, 1, CM, stdin);

	int N = getint();
	ll kotae = 1;
	int A[200000];
	rep(i, N) kotae += B[(A[i] = getint())]++;
	int *a = A;
	
	int amari = N % 10800;
	int shou = N / 10800;
	rep(j, shou) {
		rep(k, 10800) putint(kotae - B[*a++]);
		fwrite(cn, 1, di - cn, stdout);
		di = cn;
	}
	rep(k, amari) putint(kotae - B[*a++]);
	fwrite(cn, 1, di - cn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 3712
#pragma region TEMPLATE
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <iomanip>
#include <climits>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;

#define all(x) x.begin(), x.end()
#define mp(x, y) make_pair((x), (y))
#define dbg(x)

#ifdef _DEBUG

#define dbg(x) cerr << x << endl

#endif // _DEBUG

template<typename T>
ostream& operator<<(ostream& os, vector<T>&& object)
{
	for (auto& i : object)
	{
		os << i << " ";
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector<vector<T>>&& object)
{
	for (auto& i : object)
	{
		os << i << endl;
	}
	return os;
}

const size_t MAX_N = (ll)512;

/*--------------------------------------TEMPLATE-------------------------------------*/
#pragma endregion

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll q;
	cin >> q;
	ll op, a, b;
	cin >> a >> a >> b;
	multiset<ll> a_set;
	a_set.insert(a);
	auto fa = a_set.begin();
	ll asd = 0, bs = b;
	for (size_t ii = 1; ii < q; ii++)
	{
		cin >> op;
		if (op == 1)
		{
			cin >> a >> b;
			a_set.insert(a);
			if (a_set.size() & 1)
			{
				if (a >= *fa)
				{
					fa++;
				}
				asd += abs(*fa - a);
			}
			else if (a < *fa)
			{
				asd += abs(*fa - a);
				fa--;
			}
			else
			{
				asd += abs(*fa - a);
			}
			bs += b;
		}
		else
		{
			cout << *fa << " " << asd + bs << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 13040
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n, long long m, std::vector<long long> a){
    i64 res = n - accumulate(a.begin(), a.end(), 0LL);
    cout << (res < 0 ? -1 : res) << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


Measured memory_bytes: 3772
#include <iostream>

using namespace std;

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


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

int main() {
  int N;
  cin >> N;
  
  int l, r, cnt = 0;
  rep(i, N) {
    cin >> l >> r;
    cnt += r - l + 1;
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const ll mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

int f[105][15];
int p[105][15];

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

    int n;
    cin >> n;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < 10; ++j){
            cin >> f[i][j];
        }
    }
    for(int i = 0; i < n; ++i){
        for(int j = 0; j <= 10; ++j){
            cin >> p[i][j];
        }
    }
    ll res = -1e+13;
    for(int i = 1; i < (1 << 10); ++i){
        vector<int> open;
        for(int d = 0; d < 10; ++d){
            if(i & (1 << d))    open.push_back(d);
        }
        int sz = open.size();
        ll hoge = 0;
        for(int j = 0; j < n; ++j){
            int cnt = 0;
            for(int k = 0; k < sz; ++k){
                if(f[j][open[k]] == 1)  ++cnt;
            }
            hoge += p[j][cnt];
        }
        chmax(res, hoge);
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int a,b,c;
  scanf("%d %d %d", &a, &b, &c);
  int flag = 0;
  for (int i = 0; i < b; i++) {
    if ((a*i)%b == c) {
      flag = 1;
      break;
    }
  }
  if (flag == 1) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <unordered_map>

using namespace std;

int main() {
  int N;
  cin >> N;
  unordered_map<int, int> m;
  bool ok = true;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    m[x]++;
    if (m[x] > 1) {
      ok = false;
      break;
    }
  }
  cout << (ok ? "YES" : "NO") << endl;
  return 0;
}

Measured memory_bytes: 8520
#include <stdio.h>

#define N 500000
#define MAX 2147483647

int s[N], count, i,n,left,right;

void Merge(int *s,int left,int mid,int right){
  int i,n1,n2,k,j;
  n1=mid-left;
  n2=right-mid;

  int L[n1+1],R[n2+1];

  for(i=0;i<n1;i++){
    L[i]=s[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=s[mid+i];
  }
  L[n1]=MAX;
  R[n2]=MAX;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      s[k]=L[i];
      i++;
    }
    else{
      s[k]=R[j];
      j++;
    }
    count++;
  }
}

void MergeSort(int *s,int left,int right){
  long mid;
  if(left+1<right){
    mid=(left+right)/2;
    MergeSort(s,left,mid);
    MergeSort(s,mid,right);
    Merge(s,left,mid,right);
  }
}


int main(){
  scanf("%d",&n);
  left=0;
  right=n;
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
  }
  MergeSort(s,left,right);
  for(i=0;i<n-1;i++) printf("%d ",s[i]);
  printf("%d\n%d\n",s[n-1],count);
  return 0;
}

Measured memory_bytes: 6584
<?php
fscanf(STDIN, '%d %d', $n, $m);
$arr = array_fill(1, $n, [false, 0]);
for ($i  = 0; $i < $m; $i++) {
    fscanf(STDIN, '%d %s', $p, $s);
    if ($arr[$p][0]) continue;

    if ($s === 'AC') {
        $arr[$p][0] = true;
    } elseif ($s === 'WA') {
        $arr[$p][1]++;
    }
}
$ans = [0, 0];
for ($i = 1; $i <= $n; $i++) {
    if ($arr[$i][0]) {
        $ans[0]++;
        $ans[1] += $arr[$i][1];
    }
}
echo implode(' ', $ans);

Measured memory_bytes: 45560
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
)

//=====I/O=====

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInt64() int64 {
	sc.Scan()
	a,_ := strconv.ParseInt(sc.Text(),10,64)
	return a
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//=====main=====

func main() {
	sc.Split(bufio.ScanWords)

	n, m, l := scanInt(), scanInt(), scanInt()

	g := make([][]int, n)
	for i := 0; i < n; i++ {
		g[i] = make([]int, n)
		for j := 0; j < n; j++ {
			g[i][j] = 1 << 31 - 1
		}
	}

	for i := 0; i < m; i++ {
		a,b,c := scanInt()-1, scanInt()-1, scanInt()
		g[a][b] = c
		g[b][a] = c
	}

	for k := 0; k < n; k++ {
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				g[i][j] = min(g[i][j], g[i][k] + g[k][j])
			}
		}
	}

	g2 := make([][]int, n)
	for i := 0; i < n; i++ {
		g2[i] = make([]int, n)
		for j := 0; j < n; j++ {
			g2[i][j] = 1 << 31 -1
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if g[i][j] <= l {
				g2[i][j] = 1
			}
		}
	}

	for k := 0; k < n; k++ {
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				g2[i][j] = min(g2[i][j], g2[i][k] + g2[k][j])
			}
		}
	}

	q := scanInt()

	for i := 0; i < q; i++ {
		s,t := scanInt()-1, scanInt()-1
		if g2[s][t] == (1<<31-1) {
			fmt.Fprintln(wr,-1)
		} else {
			fmt.Fprintln(wr,g2[s][t]-1)
		}
	}

	wr.Flush()

	// fmt.Println(g2)
}

func min(a ...int) int {
	res := a[0]
	for i := 1; i < len(a); i++ {
		if res > a[i] { res = a[i] }
	}
	return res
}

func max(a ...int) int {
	res := a[0]
	for i := 1; i < len(a); i++ {
		if res < a[i] { res = a[i] }
	}
	return res
}


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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = n - 2; i >= 0; i--) {
        if (a[i] > a[i + 1]) {
            a[i]--;
        }
        if (a[i] > a[i + 1]) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

    return 0;
}

Measured memory_bytes: 640
import sys


def resolve(in_):
    n, d = map(int, next(in_).split())
    xy = list(map(int, line.split()) for line in in_)
    
    ret = 0
    for x, y in xy:
        distance = (x ** 2 + y ** 2) ** 0.5
        if distance <= d:
            ret += 1

    return ret

def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()


Measured memory_bytes: 90228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

#include <bits/stdc++.h>
using namespace std;

string to_string(string s)
{
    return '"' + s + '"';
}

string to_string(const char *s)
{
    return to_string((string)s);
}

string to_string(bool b)
{
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p)
{
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v)
{
    bool first = true;
    string res = "{";
    for (const auto &x : v)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << " " << to_string(H);
    debug_out(T...);
}

int H, W;

int dist(pair<int, int> p, pair<int, int> q)
{
    return (abs(p.first - q.first) + abs(p.second - q.second));
}

int main()
{
    cin >> H >> W;

    int left = W, right = 0, up = H, down = 0;
    vector<string> grid(H);
    for (int i = 0; i < H; i++)
    {
        cin >> grid[i];
        for (int j = 0; j < W; j++)
        {
            if (grid[i][j] == 'B')
            {
                left = min(left, j);
                right = max(right, j);
                up = min(up, i);
                down = max(down, i);
            }
        }
    }

    set<pair<int, int>> st;
    for (int i = 0; i < W; i++)
    {
        if (grid[up][i] == 'B')
            st.insert({up, i});
        if (grid[down][i] == 'B')
            st.insert({down, i});
    }

    for (int i = 0; i < H; i++)
    {
        if (grid[i][left] == 'B')
            st.insert({i, left});
        if (grid[i][right] == 'B')
            st.insert({i, right});
    }

    vector<pair<int, int>> v;
    for (auto &p : st)
    {
        v.push_back(p);
    }

    int ans = 0;
    int N = v.size();
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (i == j)
                continue;
            ans = max(dist(v[i], v[j]), ans);
        }
    }

    //debug_out(v);
    cout << ans << endl;
}



Measured memory_bytes: 3248
def main():
    N = int(input())
    P = tuple(map(int,input().split()))
    a = 1
    minP = P[0]
    for i in range(1, N):
        if minP < P[i]:
            pass
        else:
            minP = P[i]
            a += 1
    print(a)
if __name__ == '__main__':
    main()

Measured memory_bytes: 24872
N,Y= map(int,input().split())
ans = 0
for i in reversed(range(N+1)):
    for j in reversed(range(N-i+1)):
        k = N -i-j
        if i * 10000 + j * 5000 + k *1000 == Y and k>-1:
            print(str(i)+" "+str(j)+" "+str(k))
            exit()
print("-1 -1 -1")

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

int main(){

  int N, K, A, B, result;
  cin >> N >> K;
  result = 1;
  for (int i = 0; i < N; i++){
    A = result * 2;
    B = result + K;
    if (A <= B){
      result = A;
    }
    else{
      result = B;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 256