akhauriyash/Code-Regression huggingface dataset:
N = input()

lim = len(N)
dp = [[0, 0] for _ in range(lim + 1)]
dp[0][1] = 1
for i in range(lim):
    n = int(N[i])
    dp[i + 1][0] = min(dp[i][0] + n, dp[i][1] + 10 - n)
    dp[i + 1][1] = min(dp[i][0] + n + 1, dp[i][1] + 10 - n - 1)

print(dp[-1][0])


Measured memory_bytes: 189768
#include <stdio.h>
#include <iostream>
using namespace std;

int search(int A[], int n, int key)
{
  int i = 0;
  A[n] = key;
  while (A[i] != key)
    i++;
  return i != n;
}

int main()
{
  int n;
  scanf("%d", &n);
  int S[n];
  for (int i = 0; i < n; i++)
  {
    scanf("%d", &S[i]);
  }
  int q;
  scanf("%d", &q);
  int T[q];
  for (int i = 0; i < q; i++)
  {
    scanf("%d", &T[i]);
  }
  int cnt = 0;
  for (int i = 0; i < q; i++)
  {
    cnt += search(S, n, T[i]);
  }

  printf("%d\n", cnt);
  return 0;
}



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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

long long x[1005], y[1005], r[1005];
long double dist[1005];
bool visited[1005];

long double getDist(int i, int j) {
    return max(sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])) - r[i] - r[j], 0.0);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int xs, ys, xt, yt, n;
    cin >> xs >> ys >> xt >> yt >> n;
    x[0] = xs;
    y[0] = ys;
    x[n+1] = xt;
    y[n+1] = yt;
    for (int i=1; i<=n; i++)
        cin >> x[i] >> y[i] >> r[i];

    priority_queue<pair<long double, int>, vector<pair<long double, int>>, greater<pair<long double, int>>> pq;
    for (int i=1; i<=n+1; i++)
        dist[i] = 1e18;
    pq.push({0, 0});
    while (!pq.empty()) {
        long double d = pq.top().first;
        int u = pq.top().second;
        pq.pop();
        if (visited[u])
            continue;
        visited[u] = true;
        for (int v=1; v<=n+1; v++)
            if (u != v) {
                long double newD = getDist(u, v);
                if (d + newD < dist[v]) {
                    dist[v] = d + newD;
                    pq.push({dist[v], v});
                }
            }
    }

    cout << fixed << setprecision(10) << dist[n+1] << "\n";

    return 0;
}


Measured memory_bytes: 11656
//ABC050B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	int h, w;
	cin >> h >> w;
	for(int i=0;i<h;i++){
		string s;
		cin >> s;
		cout << s << endl << s << endl;
	}
	return 0;
}

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

vector<LL> divs(LL n) {
  vector<LL> res;
  for(LL i = 1; i * i <= n; ++i) {
    if(n % i == 0) {
      res.push_back(i);
      if(i * i != n) res.push_back(n / i);
    }
  }
  return res;
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  LL n;
  cin >> n;
  set<LL> ans;
  for(auto x : divs(n - 1)) ans.insert(x);
  for(auto k : divs(n)) {
    LL nn = n;
    while(nn % k == 0 && k > 1) nn /= k;
    if(nn == 1 || (nn - 1) % k == 0) ans.insert(k);
  }
  ans.erase(1);
  cout << ans.size() << '\n';
}

Measured memory_bytes: 384
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M=MI()
    ans=[-1]*N
    f=1
    for i in range(M):
        s,c=MI()
        s-=1
        if ans[s]==-1:
            ans[s]=c
        else:
            if ans[s]==c:
               continue
            else:
                f=0
    if ans[0]==0 and N!=1:
        f=0      
      
    if f==0:
        print(-1)
    elif N==1 and (ans[0]==0 or ans[0]==-1):
        print("0")
        
    else:
        for i in range(N):
            if ans[i]==-1:
                ans[i]=0
                if i==0:
                    ans[i]=1
            
        print(''.join(map(str, ans)))

main()


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

const ll INF = 1LL << 60;

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> h(n + k);
  rep(i, n) cin >> h[i];

  vector<ll> dp(n + k, INF);

  dp[0] = 0;

  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
    }
  }

  cout << dp[n - 1] << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<VI> VVI;

int main() {
    int r, c;
    VVI table;
    cin >> r >> c;
    for(int i=0; i<r; i++) {
        VI row;
        int sum_row = 0;
        for(int j=0; j<c; j++) {
            int temp;
            cin >> temp;
            row.push_back(temp);
            sum_row += temp;
        }
        row.push_back(sum_row);
        table.push_back(row);
    }
    c += 1;
    
    VI sums_columns;
    for(int i=0; i<c; i++) {
        int sum_column = 0;
        for(int j=0; j<r; j++) {
            sum_column += table[j][i];
        }
        sums_columns.push_back(sum_column);
    }
    table.push_back(sums_columns);
    r += 1;
    
    for(int i=0; i<r; i++) {
        for(int j=0; j<c; j++) {
            cout << table[i][j];
            if(j != c-1) cout << " ";
        }
        cout << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3160
#include<stdio.h>

int main(void){
   int N,i;
   int count=0;
   scanf("%d",&N);
   char S[N];
   scanf("%s",S);
   for(i=0;i<N-2;i++){
      if(S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C'){
         count+=1;
      }
   }
   printf("%d",count);
   return 0;
      

   
}


Measured memory_bytes: 1732
n=io.read("*n")
h={}
for i=1, n do
  table.insert(h, io.read("*n"))
end

ans=0
s=0
for i=1, n-1 do
  if h[i] < h[i+1] then
    s=0
  else
    s=s+1
  end

  if ans < s then
    ans=s
  end
end

print(ans)

Measured memory_bytes: 1280
A,B,K = (int(i) for i in input().split())

for i in range(K):
    if i%2 == 0:
        if A%2 != 0:
            A = A - 1
        A = A // 2
        B += A
    else:
        if B%2 != 0:
            B = B - 1
        B = B//2
        A += B
    #print(A,B)

print(A,B)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int N;
    cin >> N;
    string ans;
    string S,T;
    cin >> S >> T;
    REP(i,N) {
        string s{S[i]};
        string t{T[i]};
        ans+=s;
        ans+=t;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<algorithm> 
using namespace std;
int main()
{
	int n;
	cin>>n;
	set<int> h;
	int number=0;
	while(n--)
	{
		int x;
		cin>>x;
		if(h.count(x)==0)
		{
			h.insert(x);
			number+=1;
		}
		else
		{
			h.erase(x);
			number-=1;
		}
	}
	cout<<number<<endl;
	 
	return 0;
	
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, n) for (int i = 1; i <= (n); i++)
#define pp(v) cout << #v << "=" << (v) << endl;
#define div_ceil(a,b) ((a) + ((b) - 1)) / (b)

int main() {
  int n; cin >> n;
  vector<int> h(n);
  rep(i,n) cin >> h[i];

  int max_h = 0;
  rep(i,n) max_h = max(max_h, h[i]); 

  int ans = 0;
  repi(i,max_h) {
    bool on = false;
    rep(j,n) {
      if (h[j] >= i) {
        if (on) continue;
        ans++;
        on = true;
      } else {
        on = false;
      }
    }
  }
  cout << ans << endl;
  // pp(n);
  // rep(i,n) pp(h[i]);
}


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

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

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  int n;
  string s;
  cin >> n >> s;
  int wCnt = 0;
  rep(i,n){
    if(s[i] == '.') wCnt++;
  }
  int ans = wCnt;
  int bCnt = 0;
  rep(i,n){
    if(s[i] == '#'){
      bCnt++;
    }else wCnt--;
    ans = min(ans,wCnt+bCnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
lis = []
n = int(input())
for i in range(n):
    p = input()
    lis.append(p)
ac = lis.count("AC")
wa = lis.count("WA")
tle = lis.count("TLE")
re = lis.count("RE")
print("AC x",ac)
print("WA x",wa)
print("TLE x",tle)
print("RE x",re)


Measured memory_bytes: 16088
#include <stdio.h>

using namespace std;

int main(){
	int n;
	scanf("%d",&n);
	int A[n];

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

	for(int i = n-1; i > 0; i--) printf("%d ",A[i]);
	printf("%d\n",A[0]);
}




Measured memory_bytes: 2740
#include <iostream>

using namespace std;

#define MOD 1000000007
typedef long long ll;

ll mod_pow(ll x, ll n, ll mod)
{
    if (n == 0) {
        return 1;
    }
    ll res = mod_pow(x * x % mod, n/2, mod);
    if (n & 1) res = res * x % mod;
    return res;
}

int main()
{
    ll m, n;
    cin >> m >> n;
    cout << mod_pow(m, n, MOD) << endl;
    return 0;
}

Measured memory_bytes: 1156
import numpy as np

if __name__ == '__main__':
    N, M = map(int, input().split(' '))

    nums = []
    for i in range(N):
        nums.append(list(map(int, input().split(' '))))

    chs = [[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],
           [-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]

    res = 0
    for ch in chs:
        temp_nums = np.array(nums) * ch
        temp_col = np.sum(temp_nums, axis=1)
        temp_col = np.sort(temp_col)[::-1]

        temp = np.sum(temp_col[:M])
        if temp > res:
            res = temp

    print(res)

Measured memory_bytes: 20864
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class C
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int K = GetInt();
		int N = GetInt();
		var A = GetInts(N);
		int max = (A[0] - A[N - 1] + K) % K;
		for(int i = 0; i < N - 1; i++)
			chmax(ref max, A[i + 1] - A[i]);

		WriteLine(K - max);
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define lint long long
#define FOR(i,a,b) for(lint i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009

typedef pair<int, int> P;

lint ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
class UnionFind {
public:
vector<int> Parent;
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
int size(int A) {
return -Parent[root(A)];
}
bool connect(int A, int B){
A = root(A);
B = root(B);
if(A == B) {
return false;
}
if(size(A)<size(B)) swap(A,B);
Parent[A] += Parent[B];
Parent[B] = A;
return true;
}
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
	int n, m; cin>>n>>m;
	vector<int> p(n);
	REP(i,n) cin>>p[i];
	UnionFind Uni(n);
	REP(i,m){
		int x, y; cin>>x>>y;
		Uni.connect(x-1,y-1);
	}
	int ans = 0;
	REP(i,n){
		if(Uni.root(i)==Uni.root(p[i]-1)) ans++;
	}
	cout<<ans<<endl;
    return 0;
}

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


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

Measured memory_bytes: 3632
N_str, q_str = raw_input().split()
N = int(N_str)
q = int(q_str)

A = []
B = []

for i in range(N):
    a = raw_input().split()
    A.append([a[0], int(a[1])])

total_time = 0
while A:
    name, time = A.pop(0)
    if time <= q:
        total_time += time
        B.append("%s %d" % (name, total_time))
    else:
        time -= q
        A.append([name, time])
        total_time += q
print '\n'.join(B)

Measured memory_bytes: 17396
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (ll)1e9 + 7;
const int MAX_N = (ll)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll S, T, D; cin >> S >> T >> D;
    vector<ll> w(D);
    ll cycle = 0;
    for(ll i = 0; i < D; i++)
    {
        cin >> w[i];
        cycle += w[i];
    }
    bool flag = false;
    ll tmp = S - T;
    vector<ll> sum(D + 1, 0LL);
    vector<pair<ll, ll>> v;
    v.push_back(make_pair(0LL, 0LL));
    for(ll i = 0; i < D; i++)
    {
        tmp += w[i];
        sum[i + 1] += sum[i] + w[i];
        if(sum[i + 1] < 0 and v.back().first < -sum[i + 1])
        {
            v.push_back(make_pair(-sum[i + 1], i + 1));
        }
        if(tmp <= 0) flag = true;
    }
    if(flag == false and cycle >= 0)
    {
        cout << -1 << endl;
        return 0;
    }
    v.erase(v.begin());
    sort(v.begin(), v.end());
    ll ans = 0;
    while(S > T)
    {
        ll pos = lower_bound(v.begin(), v.end(), make_pair(S - T, 0LL)) - v.begin();
        if(pos < v.size())
        {
            ans += v[pos].second;
            break;
        }
        S += cycle;
        ans += D;
    }
    cout << ans << endl;
    return 0;
}




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



using namespace std;

#define SIZE 10


int main(void)
{/*
    int a1, a2;
    cin >> a1 >> a2;

    if(a1 < 10 && a2 < 10 && a1 > 0 && a1 > 0){
        cout << a1*a2 << endl;
    }else{
        cout << -1 << endl;
    }

    return 0;
*/

    int N;
    cin >> N;

    int flag = 0;

    int A[SIZE][SIZE];
    int id;
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            //A[i][j] = i*j;
            //printf("A[%d][%d] = %d \n", i, j, A[i][j]);
            if(i*j == N){
                flag = 1;
                break;
            }       
        }
        if(flag == 1) break;
    }

    if(flag == 1){
        cout << "Yes" << endl;
    }else if(flag == 0){
        cout << "No" << endl;
    }else{
        cout << "Error" << endl;
    }

    return 0;

}

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

using namespace std;

int main()
{
	int n;
	long long q, h, s, d;
	scanf("%lld%lld%lld%lld", &q, &h, &s, &d);
	scanf("%d", &n);
	long long cnt_q = n / 0.25,
			cnt_h = n / 0.5,
			cnt_s = n,
			cnt_d = n / 2;
	long long ans_q = cnt_q * q,
			ans_h = cnt_h * h,
			ans_s = cnt_s * s,
			ans_d = cnt_d * d;
	long long ans = min(min(ans_q, ans_h), min(ans_s, ans_d));
	if (ans == ans_d && n & 1)
	{
		printf("%lld\n", ans_d + min(s, min(4 * q, 2 * h)));
		return 0;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
def main():
    Q,H,S,D = map(int,input().split())
    N = int(input())
    L_L = min(D,S*2,H*4,Q*8)
    L = min(S,H*2,Q*4)
    if N%2 == 0:
        print(L_L*(N//2))
    else:
        print(L_L*(N//2)+L)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
<?php

$N = trim(fgets(STDIN));
$S = trim(fgets(STDIN));
$s_count = strlen($S);

$alphabet_map = array(1=>"A",2=>"B",3=>"C",4=>"D",5=>"E",6=>"F",7=>"G",8=>"H",9=>"I",10=>"J",11=>"K",12=>"L",13=>"M",14=>"N",15=>"O",16=>"P",17=>"Q",18=>"R",19=>"S",20=>"T",21=>"U",22=>"V",23=>"W",24=>"X",25=>"Y",26=>"Z");
$reverse_alphabet_map = array("A"=>1,"B"=>2,"C"=>3,"D"=>4,"E"=>5,"F"=>6,"G"=>7,"H"=>8,"I"=>9,"J"=>10,"K"=>11,"L"=>12,"M"=>13,"N"=>14,"O"=>15,"P"=>16,"Q"=>17,"R"=>18,"S"=>19,"T"=>20,"U"=>21,"V"=>22,"W"=>23,"X"=>24,"Y"=>25,"Z"=>26);

$s_number_array = array();
for ( $i=0; $i<$s_count; $i++ ) {

    //$s_number_array[$i] = $reverse_alphabet_map[$S[$i]];
    $new_alphabet_number = $reverse_alphabet_map[$S[$i]]+$N;
    if ( $new_alphabet_number > 26 ) {
        array_push($s_number_array,$new_alphabet_number - 26); 
    }
    else{
        array_push($s_number_array,$new_alphabet_number);
    }
    

}

$answer_array = array();
for ( $i=0; $i<+count($s_number_array); $i++ ) {
    array_push($answer_array,$alphabet_map[$s_number_array[$i]]);
}
$answer = implode($answer_array);

echo($answer)."\n";

?>

Measured memory_bytes: 16828
#include <stdio.h>
struct dice{
    int d[6], tmp[6];
};
struct dice dice1;
struct dice dice2;
void init1(int n[6]){
    int i;
    for (i=0;i<6;i++){
        dice1.d[i]=n[i];
    }
}
void init2(int n[6]){
    int i;
    for (i=0;i<6;i++){
        dice2.d[i]=n[i];
    }
}
void throwdice(char c){
    int i;
    for(i=0;i<6;i++){
        dice1.tmp[i]=dice1.d[i];
    }
    if(c=='N'){
        dice1.d[0]=dice1.tmp[1];
        dice1.d[1]=dice1.tmp[5];
        dice1.d[2]=dice1.tmp[2];
        dice1.d[3]=dice1.tmp[3];
        dice1.d[4]=dice1.tmp[0];
        dice1.d[5]=dice1.tmp[4];
    }
    else if(c=='E'){
        dice1.d[0]=dice1.tmp[3];
        dice1.d[1]=dice1.tmp[1];
        dice1.d[2]=dice1.tmp[0];
        dice1.d[3]=dice1.tmp[5];
        dice1.d[4]=dice1.tmp[4];
        dice1.d[5]=dice1.tmp[2];
    }
    else if(c=='W'){
        dice1.d[0]=dice1.tmp[2];
        dice1.d[1]=dice1.tmp[1];
        dice1.d[2]=dice1.tmp[5];
        dice1.d[3]=dice1.tmp[0];
        dice1.d[4]=dice1.tmp[4];
        dice1.d[5]=dice1.tmp[3];
    }
    else if(c=='S'){
        dice1.d[0]=dice1.tmp[4];
        dice1.d[1]=dice1.tmp[0];
        dice1.d[2]=dice1.tmp[2];
        dice1.d[3]=dice1.tmp[3];
        dice1.d[4]=dice1.tmp[5];
        dice1.d[5]=dice1.tmp[1];
    }
    else if(c=='R'){
        dice1.d[0]=dice1.tmp[0];
        dice1.d[1]=dice1.tmp[3];
        dice1.d[2]=dice1.tmp[1];
        dice1.d[3]=dice1.tmp[4];
        dice1.d[4]=dice1.tmp[2];
        dice1.d[5]=dice1.tmp[5];
    }
}
int compare(){
    int i;
    for(i=0;i<6;i++){
        if(dice1.d[i]!=dice2.d[i]){
            return 0;
        }
    }
    return 1;
}
int main()
{
    int n[6];
    int i,j;
    int ok=0;
    for(i=0;i<6;i++){
        scanf("%d",&n[i]);
    }
    init1(n);
    for(i=0;i<6;i++){
        scanf("%d",&n[i]);
    }
    init2(n);
    for(i=0;i<4;i++){
        for(j=0;j<4;j++){
            throwdice('N');
            throwdice('E');
            throwdice('S');
            if(compare()) ok=1;
        }
        throwdice('N');    
    }
    throwdice('E');
    for(i=0;i<2;i++){
        for(j=0;j<4;j++){
            throwdice('N');
            throwdice('E');
            throwdice('S');
            if(compare()) ok=1;
        }
        throwdice('W');    
        throwdice('W');    
    }
    if(ok) puts("Yes");
    else puts("No");
    return 0;
}



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



int main() {
	int l, r;
	cin >> l >> r;
	int d, ans = 0;
	cin >> d;
	for(int i=l; i<=r; i++) {
		if(i % d == 0) {
			ans ++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(i);
// sort(arr, arr+n, greater<int>());
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}


int main(void)
{
	fast();
  int x,a;
  cin>>x>>a;
  if(x<a)
  {
    cout<<0<<endl;
  }
  else
  {
    cout<<10<<endl;
  }
}

Measured memory_bytes: 256
n = int(input())
p = list(map(int,input().split()))

ans = 0
for i in range(n-2):
	cur_p = p[i:i+3]
	if cur_p[0] < cur_p[1] < cur_p[2] or cur_p[0] > cur_p[1] > cur_p[2]:
		ans += 1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
 
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;
 
const ll MOD=1000000007;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >>s;
    bool t=true;
    int n=s.size();
    if (s[0]!='1' || s[n-1]!='0') t=false;
    rep(i,0,n-1){
        if (s[i]!=s[n-2-i]) t=false;
    }
    if (!t) cout <<-1 << "\n";
    else{
        int a=1;
        rep(i,0,n-1){
            cout << a <<" "<<i+2<<"\n";
            if(s[i]=='1') a=i+2;
        }
    }
}

Measured memory_bytes: 1616
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define print(x) cout << (x) << endl;
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INF = 1<<29;
const int MOD = 1000000007;
 
void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};


int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    string N;
    cin >> N;
    int ans = 0;
    rep(i,N.size()){
      if(N[i] == '2') ans++;
    }
    print(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;

int main(void) {
  long N;
  cin >> N;
  long H[N];
  for (int i = 0; i < N; i++) { cin >> H[i]; }
  long m = 0;
  for (int i = 0; i < N; i++) {
    if (m > H[i]) {
      cout << "No" << endl;
      return 0;
    }
    m = max(m, H[i] - 1);
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long int ll;
#define rep(i,n) for (int i = 0; i< (n); i++)
#define Rep(i,n,m) for (int i = (n); i< (m); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
using namespace std;


int main() {
    int n, m;
    
    cin>>n>>m;
    
    
    
    cout<<(n * (n-1)/2) + (m*(m-1)/2)<<endl;
    
    return 0;
}


Measured memory_bytes: 256
from collections import deque

def solve(h, w, S):
    cands = ((0, 1), (0, -1), (1, 0), (-1, 0))
    q = deque(maxlen = h * w)
    q.append((1, 1, 1))
    s = {(1, 1)}
    min_len = -1
    while len(q) > 0:
        x, y, d = q.popleft()
        for dx, dy in cands:
            if x + dx == w and y + dy == h:
                min_len = d + 1
                q.clear()
                break
            if  1 <= x + dx <= w \
                and 1 <= y + dy <= h \
                and S[y + dy - 1][x + dx - 1] == '.' \
                and (x + dx, y + dy) not in s:
                q.append((x + dx, y + dy, d + 1))
                s.add((x + dx, y + dy))
    return (sum(l == '.' for s in S for l in s) - min_len) if min_len >= 0 else -1

_h, _w = map(int, input().split())
_S = [input() for _ in range(_h)]
print(solve(_h, _w, _S))


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

ll h,w,d;
ll a[303][303];
ll q,l,r;
ll x[90009],y[90009];
ll res[90009];

int main(){
    cin >> h >> w >> d;
    for(ll i=0;i<h;i++){
        for(ll j=0;j<w;j++){
            cin >> a[i][j];
            x[a[i][j]]=i;
            y[a[i][j]]=j;
        }
    }
    for(ll i=0;i<=d;i++) res[i]=0;
    for(ll i=d+1;i<=h*w;i++){
        res[i]=res[i-d]+abs(x[i]-x[i-d])+abs(y[i]-y[i-d]);
    }
    cin >> q;
    for(ll i=0;i<q;i++){
        cin >> l >> r;
        cout << res[r]-res[l] << endl;
    }
}


Measured memory_bytes: 6396
#include <stdio.h>

int main() {
	int A, B;
	int coins = 0;
	int i;

	scanf("%d", &A);
	scanf("%d", &B);

	for(i = 0; i < 2; i++) {
		if(A < B) {
			coins += B;
			B--;
		} else {
			coins += A;
			A--;
		}
	}

	printf("%d\n", coins);

	return 0;
}



Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main() {
    int h,w;

    while (true) {
        cin >> h >> w;

        if (h == 0 && w == 0)
            break;

        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (i != 0 && i != h-1 && j != 0 && j != w-1){
                    cout << ".";
                } else {
                    cout << "#";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
s = input()
type_A = 0
type_B = 0
for i in range(len(s)):
  if i%2 == 0:
    if int(s[i])!=0:
      type_A += 1
  else:
    if int(s[i])!=1:
      type_A += 1

for i in range(len(s)):
  if i%2 == 0:
    if int(s[i])!=1:
      type_B += 1
  else:
    if int(s[i])!=0:
      type_B += 1

if type_A > type_B:
  print(type_B)
else:
  print(type_A)

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    ll n, x;
    cin >> n >> x;
    vector<int> a, b(n);
    vin(a, n);
    ll ans = 0;
    rep(i, n) {
        b[i] = a[i];
        ans += a[i];
    }
    rep(k, n) {
        ll tmp = k * x;
        rep(i, n) b[i] = min(b[i], a[(i - k + n) % n]);
        rep(i, n) tmp += b[i];
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}


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

int main() {
  int n;
  ll ans = 0;
  cin >> n;
  vector<int> t(n),a(n);
  REP(i,n) cin >> t[i] >> a[i];

  ll tt = t[0], aa = a[0];
  for (int i = 1; i < n; i++) {
    if (t[i] == t[i-1] && a[i] == a[i-1]) continue;
    ll div = max(tt/t[i], aa/a[i]);
    while (t[i]*div < tt || a[i]*div < aa) div++;
    tt = t[i]*div; aa = a[i]*div;
  }
  cout << tt + aa << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define xrep(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define vl vector<long long>
#define vs vector<string>

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

    rep(i,S.size()){
        S[i] = 'x';
    }

    cout << S << endl;
}

Measured memory_bytes: 3628
/*
 * atcoder/abc112/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

int N;
vector<ll> X, Y, H;

ll height(ll n, ll cx, ll cy) {
  return H[n] + abs(cx - X[n]) + abs(cy - Y[n]);
}

void solve() {
  cin >> N;
  ll x, y, h;
  loop(n,0,N) {
    cin >> x >> y >> h;
    if (h > 0) {
      X.push_back(x); Y.push_back(y); H.push_back(h);
    }
  }
  N = H.size();
  if (N == 1) {
    cout << X[0] << " " << Y[0] << " " << H[0] << endl;
    return;
  }

  loop(cx,0,101) {
    loop(cy,0,101) {
      bool isCenter = true;
      ll h = height(0, cx, cy);
      loop(n,1,N) {
        isCenter &= h == height(n, cx, cy);
      }
      if (isCenter) {
        cout << cx << " " << cy << " " << h << endl;
        return;
      }
    }
  }
}
int main() {
  // cout.precision(15);
  // cout << fixed << double

  solve();

  return 0;
}


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

int main(){
    int N, M, solve=0, pena=0;
    cin >> N >> M;
    vector<int> WA(N+1, 0), AC(N+1, -1);
    vector<int> a(M);
    vector<string> b(M);
    for(int i=0; i<M; i++){
	cin >> a[i] >>b[i];
    }

    for(int i=0; i<M; i++){
	if(b[i]=="WA")
	    WA[a[i]]++;
	else{
	    if(AC[a[i]]==-1){
		AC[a[i]]=0;
		solve++;
		pena += WA[a[i]];
	    }
	}
    }
    
    cout << solve <<" " <<pena<< endl;
}


Measured memory_bytes: 6912
[a,b,k] = [int(i) for i in input().split()]

for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a = a - 1
        b = b + a / 2
        a = a / 2
    else:
        if b % 2 == 1:
            b = b - 1
        a = a + b / 2
        b = b / 2
print(int(a),int(b))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
 
#define ll                    long long int
#define ll_MAX                LLONG_MAX
#define ll_MIN                LLONG_MIN
#define pi                    3.14159265358979323846
#define count_1(n)            __builtin_popcountll(n)
#define MOD                   1000000007
#define MAX                   1e9
#define MIN                   -1e9
#define itoc(c)               ((char)(((int)'0')+c))
#define mid(s,e)              (s+(e-s)/2)
const int MX=10010896;
const int lmt=3164;
const int N=10000001;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll extgcd(ll a,ll b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extgcd(b,a%b,y,x);y-=a/b*x;return g;}}
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
#define print_upto(a,n)        for(int i=0;i<n;i++)    cout<<a[i]<<" "; cout<<endl
#define print(a)        for (auto x : a) cout << x << " "; cout << endl

inline void solve(){
  ll n,x,t;cin>>n>>x>>t;
  ll ans=(ll)ceil((double)n/(double)x);
  cout<<t*ans<<"\n";
}

int main()
{
	cout<<fixed<<setprecision(12);
	fastio;ll  t=1,tc=1;
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout);
	#endif
	//cin>>t;
	while(t--){solve();}return 0;
}

Measured memory_bytes: 3728
#include <iostream>

using namespace std;

void solve()
{
	int a, b;
	bool firstFlag = true;
	while(cin >> a >> b)
	{
		if(a == 0 && b == 0)
		{
			break;
		}
		if(!firstFlag)
		{
			cout << endl;
		}
		bool existFlag = false;
		for(int i = a; i <= b; ++i)
		{
			if(i % 4 == 0 && i % 100 != 0 || i % 400 == 0)
			{
				cout << i << endl;
				existFlag = true;
			}
		}
		if(!existFlag)
		{
			cout << "NA" << endl;
		}
		firstFlag = false;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1156
H, W = map(int,input().split())
src = [list(input()) for i in range(H)]
 
dxy = [(-1,0),(0,-1),(0,1),(1,0)]

for h in range(H):
  count = 0
  for w in range(W):
    count = 0
    if src[h][w] == ".":
      continue
    
    for dx,dy in dxy:      
      count += 1
      if w + dx < 0 or w + dx > W-1 or h + dy < 0 or h + dy > H-1:
        continue
      
      if src[h + dy][w + dx] == "#":
        break
      
      if count == 4:
        print("No")
        exit()
        
print("Yes")

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
    double a,b,c,S,L,h;
    cin>>a>>b>>c;
    double l=2*acos(-1)*c/360;
    S=a*b*sin(l)/2;
    h=b*sin(l);
    L=a+b+sqrt(a*a+b*b-2*a*b*cos(l));
    printf("%.8f\n%.8f\n%.8f",S,L,h);
    return 0;
}


Measured memory_bytes: 3376
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define fs first
#define sc second

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

int main(){
	int r; cin >> r;
	cout << r * r * 3 << endl;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;


int main(){
    string A;
    cin >> A;
    int t = A[0] -'a';
    if(t>=0&& t<26){
        cout <<"a" << endl; 
    }else{
        cout<<"A" << endl;
    }
    return 0;
}


Measured memory_bytes: 3624
from collections import Counter
from operator import itemgetter

def sub(prefers, canceled):
    res = Counter()
    for pref in prefers:
        pt = -1
        while pref[pt] in canceled:
            pt -= 1
        res[pref[pt]] += 1
    return max(res.items(), key=itemgetter(1))

def solve(m, prefers):
    canceled = set()
    ans = float('inf')
    for _ in [0] * m:
        s, c = sub(prefers, canceled)
        canceled.add(s)
        ans = min(ans, c)
    return ans

if __name__ == '__main__':
    N, M = map(int, input().split())
    A = [list(map(int, input().split()))[::-1] for _ in [0] * N]
    print(solve(M, A))

Measured memory_bytes: 4580
H, W = map(int, input().split())
A = []
for _ in range(H):
  A.append(list(input()))
Hlist = []
Wlist = []

for h in range(H): #行から見ていきます
  f = True
  for w in range(W):
    if A[h][w] != ".":
      f = False
  if not f:
    Hlist.append(h)
for w in range(W): #行から見ていきます
  f = True
  for h in range(H):
    if A[h][w] != ".":
      f = False
  if not f:
    Wlist.append(w)

Aout = []

for h in Hlist:
  a = ""
  for w in Wlist:
    a += A[h][w]
  Aout.append(a)

for aout in Aout:
  print(aout)

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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

vector<string> field;
int h, w, k;

vector<int> IntegerToVector(int bit, int N) {
  vector<int> S;
  for (int i = 0; i < N; ++i) {
    if (bit & (1 << i)) {
      S.push_back(i);
    }
  }
  return S;
}

bool find2(VI vec, int key) {
  auto result = find(vec.begin(), vec.end(), key);
  if (result == vec.end()) {
    return false;
  } else {
    return true;
  }
}

int count_black(VI delete_col, VI delete_row) {
  int ret = 0;
  REP(i, h) {
    REP(j, w) {
      if(field[i][j]=='#' && !find2(delete_col,j) && !find2(delete_row,i)){
        ret++;
      }
    }
  }
  return ret;
}

int main() {
  cin >> h >> w >> k;

  REP(i, h) {
    string tmp;
    cin >> tmp;
    field.push_back(tmp);
  }

  int ans = 0;
  for (int bit_col = 0; bit_col < (1 << w); ++bit_col) {
    for (int bit_row = 0; bit_row < (1 << h); ++bit_row) {
      VI delete_col = IntegerToVector(bit_col, w);
      VI delete_row = IntegerToVector(bit_row, h);
      if(count_black(delete_col, delete_row)==k){
        ans++;
      }
    }
  }

  ANS(ans);
  return 0;
}


Measured memory_bytes: 3632
n = int(input())
d = {}
for i in range(n):
    s = str(input())
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1

#d_ = sorted(d.items(), key=lambda x:x[1], reverse=True)
#print(d_)

l_ = []
max_ = max(d.values())
#print(max_)
for k, v in d.items():
    if v == max_:
        l_.append(k)

l_.sort()
for i in range(len(l_)):
    print(l_[i])

Measured memory_bytes: 32220
import java.util.*;
import java.io.*;

import static java.lang.Character.isUpperCase;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String str = in.next();

           if(str.equals("AAA")|| str.equals("BBB"))
           {
               System.out.println("No");
           }

            else
                {
                    System.out.println("Yes");
                }
    }


 }












Measured memory_bytes: 35336
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <map>
#define mp make_pair
#define pb push_back
#define p push
#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long int
#define abs(x) (x<0 ? (-x) : x)
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getLL(a,b) scanf("%lld%lld",&a,&b)
#define BEND(c) (c).begin(),(c).end()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);


#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long,long long>> vpl;
typedef pair<int,int> pii;
typedef pair <ll,ll> pll;


int main(){
    ll n;cin >>n;
    cout << n*n;



    return 0;
}




    /*

    int gcd(int a, int b) {
        while (a > 0 && b > 0)
            if (a > b) a %= b;
            else b %= a;
        return a + b;
    }

    int lcm(int a, int b) {
        return a*b / gcd(a,b);
    }
    long long fast_exp(long long n,long long k){
        if(k == 0)
            return 1;
        if(k==1)
            return n;

        long long temp = fast_exp(n,k>>1);
        if((k&1)==1)
            return (n*temp*temp);
        return (temp*temp);

    }

     */

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;

typedef long long ll;
#define READ(a) int a; cin >> a;
#define READARR(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define READMAT(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
#define print(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	READ(n);
	READARR(a, n);
	int mn = inf, cnt = 0;
	FOR (i, 1, n)
	    if (mn > a[i]) mn = a[i], cnt++;
	
	cout << cnt;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define F first
#define S second
#define X real()
#define Y imag()
#define PB push_back 
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef complex<int> cld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef vector<ut,pr> ppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
typedef vector<ppr> Vppr;
const int SIZE=1+1e+5;
const int INF=1<<30;
const int SEGSIZE=3*1e+8;
int num[SIZE];
Vpr leasts,mosts;
int start[SIZE],ender[SIZE];
int least[SIZE],most[SIZE];
bool isfirst[SIZE];
map<int,int> BIT;
PQ qu;
void add(int x,int p){
	while(x<=SEGSIZE){
		BIT[x]+=p;
		x+=x&-x;
	}
}
int query(int x){

	int sum=0;
	while(x>0){
		if(BIT.find(x)!=BIT.end()) sum+=BIT[x];
		x-=x&-x;
	}
	return sum;
}
int query(int a,int b){
	return query(b)-query(a-1);
}
int main(){
	int D,l,r,e,Q;
	cin >> D;
	FOR(i,1,D+1)
		cin >> num[i];
	REP(i,SIZE)
		isfirst[i]=true;
	cin >> Q;
	REP(i,Q){
		cin >> l >> r >> e;
		least[i]=min(num[l],num[r])-e-1;
		most[i]=max(num[l],num[r])+e+1;
		if(l-1>0) qu.push(pr(l-1,i));
		else isfirst[i]=false;
		qu.push(pr(r,i));
	}
	int side=1e+8+1;
	FOR(i,1,D+1){
		add(num[i]+side,1);
		while(!qu.empty() && qu.top().F==i){
			int target=qu.top().S;
			qu.pop();
			if(isfirst[target])
				start[target]=query(least[target]+side)+query(most[target]+side,SEGSIZE);
			else
				ender[target]=query(least[target]+side)+query(most[target]+side,SEGSIZE);
			isfirst[target]=false;
		}
	}
	REP(i,Q){
		printf("%d\n",ender[i]-start[i]);
	}
}

Measured memory_bytes: 35408
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}
int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}
/*
 
 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
int a=0, b=0, c = 0;

int main(void) {
	Rapid;//固定高速

	vint a(9);
	vcin(a, 9);
	int n;
	cin >> n;
	vbool ans(9,false);
	rep(i, n) {
		int x = 0;
		cin >> x;
		rep(j, 9) {
			if (x == a[j])ans[j]=true;
		}
	}
	Yes(ans[0] && ans[1] && ans[2] ||
		ans[3] && ans[4] && ans[5] ||
		ans[6] && ans[7] && ans[8] ||
		ans[0] && ans[3] && ans[6] ||
		ans[1] && ans[4] && ans[7] ||
		ans[2] && ans[5] && ans[8] ||
		ans[0] && ans[4] && ans[8] ||
		ans[2] && ans[4] && ans[6]);

	please AC;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll l,r;
	cin>>l>>r;
	ll cnt=0;
	ll ans=INF;
	for(ll i=l;i<=r;i++){
		for(ll j=i+1;j<=r;j++){
			cnt++;
			ans=min(ans,i%2019*j%2019);
			if(cnt==100000000){
				cout <<ans;
				return 0;
			}
		}
	}
		cout << ans;
	// your code goes here
	return 0;
}

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

using namespace std;

int main() {

	string a, b;
	int n, m;
	cin >> a >> b >> n >> m;
	string u;
	cin >> u;
	if (u == a)
	{
		n--;
	} else {
		m--;
	}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int n,m,cnt=0,aa[220000],cntl=0;
pair<int,int> p[220000];
string s,ss[110000];
char c;
signed main(){
    cin>>n>>m;
    rep(i,n){
        cin>>aa[i];
        cnt+=aa[i];
    }
    rep(i,n){
        if(aa[i]*4*m>=cnt){
            cntl++;
        }
    }
    if(cntl<m){
        cout<<"No";
    }else{
        cout<<"Yes";
    }
}

Measured memory_bytes: 1152