akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.C_Challenge
{
    class ABC_073
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            var array = new long[n];
            for(int i =0; i < n; i++)
            {
                array[i] = ReadLong();
            }
            var dict = new Dictionary<long, bool>();
            for(int i = 0; i < n; i++)
            {
                if (dict.ContainsKey(array[i]))
                {
                    dict.Remove(array[i]);
                }
                else
                {
                    dict.Add(array[i], false);
                }
            }
            Console.WriteLine(dict.Count);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 23004
import numpy as np

n, k = map(int, input().split())
A = np.array(input().split(), dtype = np.int64)
score = np.array([0 for i in range(n- k + 1)], dtype = np.int64)
wknum = 1
for i  in range(k):
    wknum *= A[i]

for i in range(n - k):
    wknum //= A[i]
    wknum *= A[k + i]
    if A[i] >= A[k + i]:
        print('No')
    else:
        print('Yes')


Measured memory_bytes: 53172
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define F first
#define S second
#define int long long
#define mod 1000000007
#define mmod 998244353
#define all(v) v.begin(), v.end()
#define INF LLONG_MAX/3
using namespace std;
int mypow(int fa, int fb, int fc) {
	if (fb == 0)return 1;
	if (fb % 2)return mypow(fa, fb - 1, fc)*fa%fc;
	int z = mypow(fa, fb / 2, fc);
	return z * z%fc;
}
int k(int fa) {
	int x = 0;
	while (fa) {
		x++;
		fa /= 10;
	}
	return x;
}
int gcd(int fa, int fb) {
	if (fb == 0)return fa;
	return gcd(fb, fa%fb);
}
signed main() {
	string s;
	cin >> s;
	if (s == "ABC")cout << "ARC" << endl;
	else cout << "ABC" << endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int INF = (1<<30);
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {
    int H,W,N;
    cin >> H >> W;
    cin >> N;
    int a[N];
    rep(i, N) cin >> a[i];
    vector<int> b;
    rep(i, N){
        rep(j, a[i]) b.push_back(i+1);
    }
    rep(i, H){
        if (i%2==0){
            rep(j, W){
                cout << b[i*W+j] << " ";
            }
        } else {
            for(int j=W-1; j>=0; j--) cout << b[i*W+j] << " ";
        }
        cout << "" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main() {
	int x=0,y=0,s=0;
	string a;
	cin>>a;
	for (int i=0; i<a.length(); i++)
		if (x==y) {
			x++;
			if(a[i]=='p')
				s--;
		} else {
			y++;
			if(a[i]=='g')
				s++;
		}
	cout<<s;
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(){
  int n,m;
  while(1){
    scanf("%d %d",&n,&m);
    if(n==0&&m==0)break;
    int i,c=0,oc=0,o[1000]={0};
    for(i=1;1;i++){
      if(i>n)i-=n;
      if(o[i]==0) c++;
      if(c==m){
	o[i]=1;
	oc++;
	c=0;//printf("\n");
      }//printf("%d %d,",i,c);
      if(oc==n){
	printf("%d\n",i);
	break;
      }
    }
  }
  return 0;
}  

Measured memory_bytes: 604
import java.util.Arrays;import java.util.Scanner;public class Main{public static void main(String[] args){int output=0;Scanner scanner=new Scanner(System.in);String s=scanner.nextLine();scanner.close();String[] str=s.split(" ",0);int[] input=new int[str.length];for(int i=0;i<str.length;i++){input[i]=Integer.parseInt(str[i]);}Arrays.sort(input);for(int i=0;i<input.length-1;i++){output+=input[i+1]-input[i];}System.out.println(output);}}

Measured memory_bytes: 23764
#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>;

vector<int> decompositPrime(int n)
{
  vector<int> out;
    // 割る数の初期値
   int a = 2;
    // √n ≧ a ( n ≧ a * a ) の間ループ処理
    while (n >= a * a) {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0) {
            out.push_back(a);
            n /= a;
        } else {
            a++;
        }
    }
    // 最後に残った n は素因数
    out.push_back(n);
  return out;
}

void Main()
{
  int N; cin >> N;
  vector<int> A(N);
  vector<int> freq(1000000);
  set<int> se;
  rep(i,N) {cin >> A[i]; se.insert(A[i]); freq[A[i]-1]++;}
  int cnt = 0;
  rep (i,N) {
    //cout << A[i] << endl;
    vector<int> soinsu = decompositPrime(A[i]);
    bool iscnt = true;
    int sqrtai = (int)sqrt(A[i]);
    if (A[i] == 1) {
      if (freq[0] >= 2) continue;
      else {cnt++; continue;}
    }
    if (freq[0] > 0) continue;
    for (int j = 2; j <= sqrtai; j++) {
      if ((A[i]%j == 0)and (freq[j-1] > 0 or freq[A[i]/j-1] > 0)) {iscnt = false; break;}
    }
    if (iscnt and freq[A[i]-1] <= 1) {cnt++; }//cout << "A" << endl;} 
  }
  cout << cnt << endl;
}

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


Measured memory_bytes: 17172
N,M=map(int,input().split())
ans=[-1]*N
flag=True
s=[]
c=[]
for i in range(M):
  s1,c1=map(int,input().split())
  s.append(s1)
  c.append(c1)
#sc = [map(int, input().split()) for _ in range(M)]
#s, c = [list(i) for i in zip(*sc)]
x=0
for i in range(M):
  s1=s[i]
  c1=c[i]
  if(ans[s1-1]==-1):
    ans[s1-1]=c1
  elif(ans[s1-1]!=c1):
    flag=False
  if(N>1 and s1==1 and c1==0):
    flag=False
if(flag==False):
  print("-1")
else:
  for i in range(N):
    if(N==1):
      if(ans[i]==-1):
        ans[i]=0
    else:
      if(i==0 and ans[i]==-1):
        ans[i]=1
      elif(ans[i]==-1):
        ans[i]=0
  for j in range(N):
    x+=ans[j]*(10**(N-j-1))
  print(x)

Measured memory_bytes: 3064
#import numpy as np
from sys import stdin
from copy import deepcopy
from functools import reduce
from fractions import gcd
import math
import itertools
from collections import Counter
from itertools import chain  ##list(chain.from_iterable(l)) ##flatten
from heapq import heappush, heappop

"""
N = int(input())
A, B = map(int,input().split())
A = list(map(int,input().split())) ## 横一列
A = [int(input()) for _ in range(N)] ## 縦一列
lst = [list(map(int,input().split())) for i in range(M)] ## 二次元
"""

N, L = map(int,input().split())

Sum = N * (N+2*L-1) // 2

if L > 0:
  ans = Sum - L
elif L + N - 1 < 0:
  ans = Sum - (L + N - 1)
else:
  ans = Sum
  
print(ans)



Measured memory_bytes: 5104
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
 
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
  ll a,b; cin >> a >> b;
  if(a<=8 && b<=8)cout << "Yay!"<< endl;
  else cout << ":(" << endl;
    return 0;
}

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

int main()
{
    std::ios::sync_with_stdio(false);
    ull N, K;
    vector<ull> H;

    cin >> N >> K;

    // 全員必殺技
    if(N <=K)
    {
        cout << 0;
        cout << "\n";
        return 0;
    }

    for(ull i=0; i<N; i++)
    {
        ull temp;
        cin >> temp;
        H.push_back(temp);
    }

    // 降順ソート
    sort(H.begin(), H.end());

    ull sum=0;

    for(ull i=0; i<N-K; i++)
    {
        sum = sum + H.at(i);
    }

    cout << sum;
    cout << "\n";

    return 0;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        long long int a,b,k;
        cin>>a>>b>>k;
        long long int a1=a;
        a=a-min(a,k);
        k=k-min(a1,k);
        b=b-min(k,b);
        cout<<a<<" "<<b<<endl;
    }


Measured memory_bytes: 256
import heapq
n,m = map(int,input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i]*=-1
h = a[0: n]
heapq.heapify(h)
for i in range(m):
    L=heapq.heappop(h)
    heapq.heappush(h,(L+1)//2)
print(sum(h)*(-1))

Measured memory_bytes: 14180
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=1000005;
const int MOD=998244353;

int n,m,ny[N],jc[N];

int C(int n,int m)
{
	return (LL)jc[n]*ny[m]%MOD*ny[n-m]%MOD;
}

int main()
{
	scanf("%d%d",&n,&m);
	if (n<m) swap(n,m);
	jc[0]=jc[1]=ny[0]=ny[1]=1;
	for (int i=2;i<=n+m;i++) jc[i]=(LL)jc[i-1]*i%MOD,ny[i]=(LL)(MOD-MOD/i)*ny[MOD%i]%MOD;
	for (int i=2;i<=n+m;i++) ny[i]=(LL)ny[i-1]*ny[i]%MOD;
	int ans=0;
	for (int i=1;i<=m;i++) ans+=(LL)C(n+m-i*2,n-i)*C(i*2,i)%MOD,ans-=ans>=MOD?MOD:0;
	ans=(LL)ans*ny[n+m]%MOD*jc[n]%MOD*jc[m]%MOD*ny[2]%MOD;
	printf("%d",(ans+n)%MOD);
	return 0;
}

Measured memory_bytes: 8064
D = int(input())
#(a, b) = map(int, input().split())

ans = ""
if D == 25:
    ans = "Christmas"
elif D == 24:
    ans = "Christmas Eve"
elif D == 23:
    ans = "Christmas Eve Eve"
elif D == 22:
    ans = "Christmas Eve Eve Eve"

print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <typeinfo>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

int main(){

    int n1, n2, n3, tmp;
    cin >> n1 >> n2 >> n3;

    if(n1<n2 && n2<n3){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


    return 0;
}



Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
bool Grid[100][100]; // 0: white, 1: black

void init()
{
  for (int i = 0; i < 100; i++)
  {
    for (int j = 50; j < 100; j++)
    {
      Grid[i][j] = 1;
    }
  }
}

int main()
{
  int64_t A, B;
  cin >> A >> B;
  A--, B--;
  init();
  for (int i = 1; i <= 98; i += 2)
  {
    for (int j = 1; j <= 48; j += 2)
    {
      if (B)
      {
        Grid[i][j] = 1;
        B--;
      }
    }
  }
  for (int i = 1; i <= 98; i += 2)
  {
    for (int j = 51; j <= 98; j += 2)
    {
      if (A)
      {
        Grid[i][j] = 0;
        A--;
      }
    }
  }
  cout << 100 << ' ' << 100 << endl;
  for (int i = 0; i < 100; i++)
  {
    for (int j = 0; j < 100; j++)
    {
      cout << (Grid[i][j] ? '#' : '.');
    }
    cout << endl;
  }
}


Measured memory_bytes: 3652
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

typedef long long ll; //64bit型
using namespace std;
const ll INF = 1LL << 20;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main()
{
        ll N, A, B, C, D, E;
        cin >> N >> A >> B >> C >> D >> E;
        ll neck = min({A, B, C, D, E});

        ll ans = (N + neck - 1) / neck + 4;
        cout << ans << endl;

        return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	int n;
	int a[100010];
	scanf("%d",&n);
	rep(i,n)scanf("%d",&a[i]);
	
	vector<int> vec;
	rep(i,n)vec.pb(a[i]);
	sor(vec);
	
	rep(i,n)a[i] = lb(vec,a[i]) - vec.begin();
	
	int cnt = 0;
	rep(i,n){
		if(i%2 == 0 && a[i]%2 == 1)cnt ++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 1404
/*
AtCoder AGC 033 Task C

Takahashi and Aoki will play a game on a tree. 
The tree has N vertices numbered 1 to N, and the i-th of the N edges connects Vertex ai and Vertex bi At the beginning of the game, 
each vertex contains a coin. 
 Starting from Takahashi, he and Aoki will alternately perform the following operation:
1.Choose a vertex v that contains one or more coins, and remove all the coins from v.
2.Then, move each coin remaining on the tree to the vertex that is nearest to v among the adjacent vertices of the coin's current vertex.
The player who becomes unable to play, loses the game. 
That is, the player who takes his turn when there is no coin remaining on the tree, loses the game. 
Determine the winner of the game when both players play optimally.

Input:
a1 b1
a2 b2
.
.
.
aN-1 bN-1

Output:
Print 'First' if Takahashi will win, and print 'Second' if Aoki will win.

*/

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

int head[200010],o=0,di=-1,ans=0,n;
bool vis[200010];
struct edge{
	int to,link;
}e[400010];

void add_edge(int u,int v){
	e[++o].link=head[u],e[o].to=v,head[u]=o;
	e[++o].link=head[v],e[o].to=u,head[v]=o;
}

void dfs(int u,int d,bool k){
	vis[u]=k;
	if(ans<d){
		ans=d;
		di=u;
	}
	for(int i=head[u];i;i=e[i].link){
		if(vis[e[i].to]!=k) dfs(e[i].to,d+1,k);
	}
}

int main(){
	scanf("%d",&n);
	for(int i=1,u,v;i<n;i++)
		scanf("%d %d",&u,&v),add_edge(u,v);
	dfs(1,1,1);
	dfs(di,1,0);
	if(ans%3==2)
		printf("Second\n");
	else
		printf("First\n");
}


Measured memory_bytes: 13696
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

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

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

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

void debug(VS &board){
	int h = board.size();
	rep(i,h){
		cout<<board.at(i)<<endl;
	}
	return;
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

LL lcm(LL a,LL b){
	return a*b/gcd(a,b);
}

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k<=a){
		cout<<k<<endl;
	}else if(k<=a+b){
		cout<<a<<endl;
	}else{
		cout<<2*a-k+b<<endl;
	}
	return 0;
}


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

int algo(int);
int main(){
    int x;
    cin >> x;
    cout << algo(x) << endl;
    return 0;
}

int algo(int price){
    int s100 = price / 100;
    int a100 = price % 100;
    if(a100 <= 5 * s100) return 1;
    else return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	
	string s,t;
	cin>>s>>t;
	
	int m=100000;
	int g=s.size();
	int h= t.size();
	
	for( int i=0;i+h<=g;i++)
	{  int cnt=0; int k=0;
		for( int j=i;j<g;j++)
		{  
		
		
		 
		   
			
			if(s[j]!=t[k] )
			
				cnt++,k++;
				else k++;
			if( k== h) break;
			
		}
			
			
		
			  m=min( m,cnt);
			
			
		
	}
	cout<<  m<<endl;
	
	
	
}

Measured memory_bytes: 3624
N,M=[int(x) for x in input().split()]
SSS=[]#二次元配列
for _ in range(M):
    SSS.append([int(x) for x in input().split()][1:])
    
ps=[int(x) for x in input().split()]

def dfs(L,num):
    if len(L)==N:
        bol=True
        for m,SS in enumerate(SSS):
            r=0
            for s in SS: 
                r+=L[s-1]
            if r%2!=ps[m]:
                bol=False
                break
        if bol:
            return num+1
        else:
            return num
    else:
        num=dfs(L+[1],num)
        num=dfs(L+[0],num)
        return num

result=0
result=dfs([1],result)
result=dfs([0],result)
print(result)


Measured memory_bytes: 41960
import java.io.*;
import java.math.*;
import java.util.*;
 
public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;
 
    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);
 
    private void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
 
        _out.println((a <= c && c <= b ? "Yes" : "No"));
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 23764
#include <iostream>

using namespace std;

int main(){
  int n,cnt=0;
  int p[20] = {0};
  cin >> n;

  for(int i = 0; i < n; i++)
    cin >> p[i];

  for(int i = 1; i < n-1; i++){
    if(p[i] < p[i-1] && p[i] >= p[i+1])
      cnt++;
    else if(p[i] < p[i+1] && p[i] >= p[i-1])
      cnt++;
  }
  cout << cnt;
  return 0;
}


Measured memory_bytes: 256
import kotlin.math.*

fun main() {
  val N = Integer.parseInt(readLine()!!)
  val h = readLine()!!.split(" ").map(Integer::parseInt)

  var dp = IntArray(N) { 0 }
  dp[0] = 0
  dp[1] = abs(h[0] - h[1])
  var n = 2

  while (true) {
    if (n == N) break
    val c1 = abs(h[n-1] - h[n]) + dp[n-1]
    val c2 = abs(h[n-2] - h[n]) + dp[n-2]
    dp[n] = min(c1, c2)
    n++
  }

  println(dp[N-1])
}


Measured memory_bytes: 49548
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  vector<int> d(n);
  for(int i=0;i<n;++i) {
    cin >> d[i];
  }
  ll su = 0;
  for(int i=0;i<n;++i) {
    for(int j=i+1;j<n;++j) {
      su += d[i] * d[j];
    }
  }
  cout << su << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 10

int main(){
	int H[N],i,j,a,b;

	for(i=0;i<10;i++){
		scanf("%d",&H[i]);	//山の高さの入力
	}

	for(i=0;i<3;i++){
		for(j=i;j<10;j++){
			if(H[i]<H[j]){
				a=H[i];
				H[i]=H[j];
				H[j]=a;
			}
		}
	}

	for(i=0;i<3;i++){
		printf("%d\n",H[i]);
	}
    return 0;
}

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

using namespace std;

int main()
{
    int n;
    double a,p;

    cin>>n;

    if(n%2==0)
    {
        a=n/2;
    }

    else
    {
    a=(n/2)+1;
    }

    p=a/n;

    printf("%.10lf\n",p);

    return 0;

}


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

using namespace std;

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

const double PI=3.14159265358979323846;

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

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

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

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

bool ok(s64 n, s64 k, vs64& a, double s)
{
    s64 cnt = 0;
    for (const auto& x : a)
    {
        cnt += ceil(x / s) - 1;
    }
    return cnt > k;
}

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

    s64 n;
    s64 k;
    cin >> n >> k;

    vs64 a(n); rep (i, n) cin >> a[i];

    double l, r;
    l = 0.0;
    r = 1e9;
    rep (i, 100)
    {
        double m = (l + r) / 2.0;
        if (ok(n, k, a, m)) l = m;
        else r = m;
    }

    cout << (s64)ceil(r) << "\n";
    return 0;
}



Measured memory_bytes: 4804
#!python3

from time import perf_counter
limit = 1.92
tick = perf_counter()

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from random import randrange
from bisect import bisect


def resolve():
    G = 26
    it = map(int, sys.stdin.read().split())
    D = next(it)
    C = [next(it) for i in range(G)]
    S = [[next(it) for i in range(G)] for i in range(D)]
    L = [[-1] for i in range(G)]
    T = [0] * D

    def update(di, qi):
        score = 0
        t0 = T[di]
        score += S[di][qi]-S[di][t0]

        a1 = li = L[t0][:]
        ii = li.index(di)
        la = D if len(li)-1 == ii else li[ii+1]
        score -= C[t0] * (di-li[ii-1])*(la-di)
        li.pop(ii)

        a2 = li = L[qi][:]
        ii = bisect(li, di)
        li.insert(ii, di)
        la = D if len(li)-1 == ii else li[ii+1]
        score += C[qi] * (di-li[ii-1])*(la-di)

        return score, (a1, a2)

    U = 7
    def calc(i, j):
        score = S[i][j]
        for k in range(G):
            u = k - L[k][-1]
            score -= C[k] * (u + u + U) * U // 2
        score += C[k] * U * (i-L[j][-1])
        return score

    def dswap(di, dj):
        qi, qj = T[di], T[dj]
        swap0 = (L[qi], L[qj])

        score, swap1 = update(di, qj)
        T[di] = qj
        L[qi], L[qj] = swap1
        diff, swap2 = update(dj, qi)

        score += diff

        if score > 0:
            T[dj] = qi
            L[qj], L[qi] = swap2
        else:
            score = 0
            T[di], T[dj] = qi, qj
            L[qi], L[qj] = swap0
        return score

    def fullscore():
        score = 0
        last = [-1] * 26
        for i, ti in enumerate(T):
            score += S[i][ti]
            last[ti] = i
            for ci, la in zip(C, last):
                score -= ci * (i-la)
        return score

    for di in range(D):
        i, score = 0, calc(di, 0)
        for qi in range(1, G):
            x = calc(di, qi)
            if x > score:
                i, score = qi, x
        T[di] = i
        L[i].append(di)

    t = 0
    #score = fullscore()
    while t < limit:
        ab = randrange(0, 100)
        if ab > 50:
            di, qi = randrange(0, D), randrange(0, G)
            diff, swap = update(di, qi)
            if diff > 0:
                #score += diff
                q0, T[di] = T[di], qi
                L[q0], L[qi] = swap
        else:
            di = randrange(0, (D-1)//2)
            dj = randrange(di+1, D)
            diff = dswap(di, dj)
            #if diff > 0: score += diff
        t = perf_counter() - tick

    print(*(i+1 for i in T), sep="\n")



if __name__ == "__main__":
    resolve()


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

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

  int N;
  std::cin >> N;
  std::vector<int> a(N);
  for (auto& v : a)std::cin >> v;
  int M = 0;
  std::vector<int> dp(N, 0);
  for (int i = N; i >= 1; --i) {
    if (dp[i - 1] % 2 == a[i - 1])continue;
    ++M;
    ++dp[i - 1];
    for (int j = 1; j * j <= i; ++j) {
      if (i % j)continue;
      ++dp[j - 1];
      int k = i / j;
      if (j == k)continue;
      ++dp[k - 1];
    }
  }

  std::cout << M << std::endl;
  for (int i = 0; i < N; ++i)
    if (dp[i] % 2 != a[i])std::cout << i + 1 << std::endl;

}


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

int main() {

  string s;
  cin >> s;

  vector<int> l(s.size()+1);
  vector<int> r(s.size()+1);

  int count = 0;

  for (int i = 0; i <= s.size(); i++) {
    l[i] = count;
    if (s[i] == '<') {
      count++;
    } else {
      count = 0;
    }
  }

  count = 0;

  for (int i = s.size(); 0 <= i; i--) {
    r[i+1] = count;
    if (s[i] == '>') {
      count++;
    } else {
      count = 0;
    }
  }
  r[0] = count;

  long answer = 0;

  /*
  for (int i = 0; i <= s.size(); i++) {
    cout << l[i] << " ";
  }
  cout << endl;

  for (int i = 0; i <= s.size(); i++) {
    cout << r[i] << " ";
  }
  cout << endl;
  */
 
  for (int i = 0; i <= s.size(); i++) {
    answer += max(l[i], r[i]);
  }
  
  cout << answer << endl;
  
}

Measured memory_bytes: 4740
#include <iostream>
#include <deque>
using namespace std;
bool solve(string str){
	deque<char> q;
	for(int i=0; i<str.length(); ++i){
		if(str[i]==')' || str[i]==']'){
			if(q.empty())	return false;
			char c=q.back();
			if(str[i]!=c)	return false;
			q.pop_back();
		}else if(str[i]=='(')	q.push_back(')');
		else if(str[i]=='[')	q.push_back(']');
	}
	return q.empty();
}
int main(){
	string str;
	while(getline(cin,str)){
		if(str==".")	break;
		cout << (solve(str)? "yes": "no") << endl;
	}
}

Measured memory_bytes: 1184
#from math import sqrt
#from heapq import heappush, heappop
#from collections import deque

#a, b = [int(v) for v in input().split()]


def main():
    N = int(input())
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))

    fullbit = (1 << N) - 1

    def full(ary, val, bit, ret):
        if bit == fullbit:
            ret.append(val)
            return
        for i in range(N):
            if bit & (1 << i) == 0:
                full(ary, val * 10 + ary[i], bit | (1 << i), ret)

    def to_i(ary):
        n = 0
        for v in ary:
            n = n * 10 + v
        return n

    def index_of(ary, val):
        lower = 0
        upper = len(ary) - 1
        while lower <= upper:
            mid = lower + (upper - lower) // 2
            v = ary[mid]
            if v < val:
                lower = mid + 1
            elif v > val:
                upper = mid - 1
            else:
                return mid

        return lower

    ret1 = []
    full(P, 0, 0, ret1)
    ret1.sort()
    a = index_of(ret1, to_i(P))

    ret2 = []
    full(Q, 0, 0, ret2)
    ret2.sort()
    b = index_of(ret2, to_i(Q))

    print(abs(a - b))


main()


Measured memory_bytes: 6424
#include<iostream>
#include<cstdio>
using namespace std;
int x,y;
int main()
{
	scanf("%d%d",&x,&y);
	int ans=0;
	if(x==1) ans+=30;
	else if(x==2) ans+=20;
	else if(x==3) ans+=10;
	if(y==1) ans+=30;
	else if(y==2) ans+=20;
	else if(y==3) ans+=10;
	if(x==1&&y==1) ans+=40;
	ans*=10000;
	printf("%d",ans);
	return 0;
}

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

using namespace std;

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    map<char, int> ok;
    for(auto it: s)
        ok[it] = 1;
    if(ok['W'] ^ ok['E'] || ok['N'] ^ ok['S'])
        cout << "No\n";
    else
        cout << "Yes\n";
    return 0;
}


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

using namespace std;

const int INF = 1e9 + 7;

struct UnionFind{
private:
  std::vector<int> data;

public:
  UnionFind(int n = 0) : data(n, -1){}

  int find(int x){
    return data[x] < 0 ? x : data[x] = find(data[x]);
  }

  bool unite(int x, int y){
    x = find(x); y = find(y);

    if(x == y) return false;
    else{
      if(data[x] > data[y]) std::swap(x, y);
      data[x] += data[y];
      data[y] = x;
      return true;
    }
  }

  bool is_same(int x, int y){
    return find(x) == find(y);
  }

  int size(int x){
    return -data[find(x)];
  }
};

int main(){
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>> grid(H, vector<char>(W, 0));
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> grid[i][j];
    }
  }
  
  UnionFind uf(H * W);
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(i + 1 < H && grid[i][j] == grid[i + 1][j]){
        uf.unite(i * W + j, (i + 1) * W + j);
      }
      if(j + 1 < W && grid[i][j] == grid[i][j + 1]){
        uf.unite(i * W + j, i * W + j + 1);
      }
    }
  }
  
  vector<vector<int>> dist(H, vector<int>(W, INF));
  dist[0][0] = 1;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(i + 1 < H){
        if(grid[i][j] == grid[i + 1][j]){
          dist[i + 1][j] = min(dist[i][j], dist[i + 1][j]);
        }else{
          dist[i + 1][j] = min(dist[i][j] + 1, dist[i + 1][j]);
        }
      }
      
      if(j + 1 < W){
        if(grid[i][j] == grid[i][j + 1]){
          dist[i][j + 1] = min(dist[i][j], dist[i][j + 1]);
        }else{
          dist[i][j + 1] = min(dist[i][j] + 1, dist[i][j + 1]);
        }
      }
    }
  }
  
  if(grid[0][0] == '.'){
    cout << dist[H - 1][W - 1] / 2 << endl;
  }else{
    cout << (dist[H - 1][W - 1] + 1) / 2 << endl;
  }
  
  return 0;
}

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

int main(){
 	int n,m;cin>>n>>m;
  	int a,b;
  int v[n+5]={0};
  for(int i=0;i<m;i++){
  	cin>>a>>b;
    v[a]++;
    v[b]++;
  }
  for(int i=1;i<=n;i++){
  	cout<<v[i]<<endl;
  }
}

Measured memory_bytes: 256
fun main(args: Array<String>){
    val inp = readLine()!!.toInt()
    var ans = 0
    repeat(inp){
        val n = readLine()!!.toLong()
        if (isPrime(n)) ans++
    }
    println(ans)
}

fun isPrime(num: Long): Boolean {
    if (num == 1L) return false
    if (num in listOf(2L, 3L)) return true
    if (num % 6 in listOf(0L, 2L, 3L, 4L)) return false
    val sqrt = Math.sqrt(num.toDouble()).toLong()
    for (n in 5..sqrt step 6) {
        if (num % n == 0L) return false
    }
    for (n in 7..sqrt step 6) {
        if (num % n == 0L) return false
    }
    return true
}



Measured memory_bytes: 33696
'use strict';
process.stdin.on('data', function(chunk) {
    var inputs = chunk.toString().trim().split(' ');
    var a = Number(inputs[0]);
    var b = Number(inputs[1]);
    var c = Number(inputs[2]);
    var sortTable = [a, b, c].sort(function(a, b) {
        return a - b;
    });
    console.log(sortTable.join(' '));
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 15408
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/

#pragma comment(linker, "/STACK:268435456")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define endl ("\n")
#define deb(n) cerr << #n << " = " << (n) << '\n'
#define PI (3.141592653589)
#define ordered_set tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define MOD 1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed;
    cout.precision(10);
    // Those who forgive themselves, and are able to accept their true nature...THEY ARE THE STRONG ONES

    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    sort(arr, arr + n);
    int sol = INT_MAX;
    for (int i = 1; i <= 100; i++)
    {
        int curr = 0;
        for (auto num : arr)
        {
            curr += (num - i) * (num - i);
        }
        sol = min(sol, curr);
    }
    cout << sol;
    return 0;
}

Measured memory_bytes: 256
// C - Grand Garden

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int H[100];
int h[100];

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

	for (int i=0; i<N; i++) {
		cin >> H[i];
	}

	int ans = 0;
	while(1) {
		bool finish = true;

		for (int i=0; i<N; i++) {
			if (h[i] < H[i]) {
				finish = false;
				ans++;
				for (int j=i; j<N; j++) {
					if (h[j] < H[j]) h[j]++;
					else break;
				}

				if (finish == false) break;
			}
		}

		if (finish) break;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3648
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  int a,b;
  cin >> a>>b;
  int ans = 0;
  
  for(int i=a;i<=b;i++){
  string s = to_string(i);
  string copy = s;
  reverse(all(copy));
    if(s==copy) ans++;
  }
  
  
  cout << ans << endl;
  
}

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

int main () {
  int N, A, B;
  int count = 0;
  bool ans = false;
  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> A >> B;
    if (A == B) {
      count++;
    } else {
      if (count >= 3) {
        ans = true;
      }
      count = 0;
    }
  }
  if (count >= 3) {
    ans = true;
  }
  cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin>>A>>B;
  int a,b,d,e,s;
  s=0;
  for(int i=A;i<=B;i++){
    b=i/1000%10;
    d=i%100/10;
    if(b!=d) continue;
    a=i/10000;
    e=i%10;
    if(a==e) s++;
  }
  cout<<s;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
PS=[list(input().split()) for _ in range(M)]
wa=[0]*(N+1)
ac=[0]*(N+1)
ac_cnt=set()
for ps in PS:
    if ps[1]=='AC':
        ac_cnt.add(ps[0])
        ac[int(ps[0])]=1
    if ps[1]=='WA' and ac[int(ps[0])]==0:
        wa[int(ps[0])]+=1
for i in range(1,N+1):
    if str(i) not in ac_cnt:
        wa[i]=0
print(sum(ac),sum(wa))


Measured memory_bytes: 33584
num = int(input())
list1 = [int(i) for i in input().split()]
sum1 = sum(list1)
flag = True
for x in range (num):
    if list1[x]>=(sum1-list1[x]):
        flag = False
        break

if flag == True:
    print ("Yes")
else:
    print ("No")

Measured memory_bytes: 3060
from collections import deque

n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(lambda x: int(x)-1, input().split())
    g[a].append(b)
    g[b].append(a)

visited = [False] * n
q = deque()
q.append((0, -1))
ans = [0] * n

while q:
    v, pv = q.popleft()
    ans[v] = pv+1
    for nv in g[v]:
        if visited[nv]: continue
        visited[nv] = True
        q.append((nv, v))

print("Yes")
print(*ans[1:], sep="\n")


Measured memory_bytes: 40988
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define M 10086

int d[M];

int cmp(int a,int b)
{
    return a<b;
}

int main()
{
    int n;
    while(cin>>n)
    {
        int i=0;
        while(n--)
            cin>>d[i++];
        sort(d,d+i,cmp);
        int s=d[i-1]-d[0];
        cout<<s<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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



Measured memory_bytes: 26184
from collections import Counter
a_list = list(range(1,10**4+1))
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      a_list.append(i**2+j**2+k**2+i*j+j*k+k*i)
count = Counter(a_list)
N=int(input())
for i in range(N):
  print(count[i+1]-1)

Measured memory_bytes: 158196
S= input()

if S.count('RRR') == 1:
    print(3)
elif S.count('RR') == 1:
    print(2)
elif S.count('RSR') == 1 or S.count('RSS') == 1 or S.count('SRS') == 1 or S.count('SSR') == 1:
    print(1)
else:
    print(0)


Measured memory_bytes: 9096
/*
    Author : Wasi Ur Rahman
*/
#include <bits/stdc++.h>
using namespace std;
// defines
#define ll long long int
#define ull unsigned long long int
#define MOD 100000
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define sc scanf
#define pf printf
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(d, min(a, min(b, c)))
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(d, max(a, max(b, c)))
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
#define PI 3.141592653589793238462643
#define no cout << "NO" << endl;
#define yes cout << "YES" << endl;
#define elif else if
/* important funct */
ll Int()
{
    ll c;
    cin >> c;
    return c;
}
#define Int Int()
void sortString(string &str)
{
    sort(str.begin(), str.end());
}
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i < n; i++)
        if (n % i == 0)
            return false;
    return true;
}
ll ManualGcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll ManualLcm(ll a,ll b)
{
    return((a)*(b)/gcd(a,b));
}
ll fact(ll n)
{
    ll res = 1;
    for(ll i = n; i>=1; i--)
        res *= i;
    return res;
}
ll nCr(ll n,ll r)
{
    return (fact(n)/(fact(r)*fact(n-r)));
}
ll nPr(ll n,ll r)
{
    return fact(n)/fact(n-r);
}
// Main
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll m=Int;
    ll n=Int;
    ll i,j;
    ll cnt = 0;
    string str;
    if(m == n)
    {
        str = to_string(n);
        for(i = 1;i<=m;i++)
            cout << str;
        cout << endl;
    }
    else if(n > m)
    {
        str = to_string(m);
        for(i = 1;i<=n;i++)
            cout << str;
        cout << endl;
    }
    else if(m > n)
    {
         str = to_string(n);
        for(i = 1;i<=m;i++)
            cout << str;
        cout << endl;
    }
}


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

namespace Atcoder
{
    class ABC129_A
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int p = int.Parse(str[0]);
            int q = int.Parse(str[1]);
            int r = int.Parse(str[2]);
            int[] intNumbers = new int[] { p, q, r };
            int intMax = intNumbers.Max();
            Console.WriteLine(p + q + r - intMax);
        }
    }
}

Measured memory_bytes: 13268
#include <iostream>

using namespace std;

int main()
{
    unsigned long long H, W;

    cin >> H >> W;

    if (H == 1 || W == 1)
    {
        cout << 1 << endl;
        return 0;
    }

    unsigned long long ans = H * W % 2 == 0 ? H * W / 2 : H * W / 2 + 1;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> cpx;
#define pi acos(-1)
int p,ncr[3000][3000],pw[3000][3000];
void fft(vector<cpx>& a,bool inv)
{
	int n=a.size();
	if (n==1)
	return;
	vector<cpx> even(n/2),odd(n/2);
	for (int i=0;i<n/2;i++)
	{
		even[i]=a[2*i];
		odd[i]=a[2*i+1];
	}
	fft(even,inv);
	fft(odd,inv);
	double angle=2*pi/n*(inv? -1:1);
	cpx w(1,0),wn(cos(angle),sin(angle));
	for (int i=0;i<n/2;i++)
	{
		a[i]=even[i]+w*odd[i];
		a[i+n/2]=even[i]-w*odd[i];
		if (inv)
		{
			a[i]/=2;
			a[i+n/2]/=2;
		}
		w*=wn;
	}
}
void mul(vector<cpx> &a,vector<cpx> b)
{
	int n=max(a.size(),b.size()),tmp=1;
	while (tmp<n)
	tmp*=2;
	tmp*=2;
	int as=a.size(),bs=b.size();
	for (int i=0;i<tmp-as;i++)
	a.push_back(0);
	for (int i=0;i<tmp-bs;i++)
	b.push_back(0);
	fft(a,0);
	fft(b,0);
	for (int i=0;i<tmp;i++)
	a[i]*=b[i];
	fft(a,1);
	for (int i=0;i<tmp;i++)
	a[i]=cpx(round(real(a[i])),0);
	while (a.size()>p)
	{
		a[(int)a.size()-p]+=a.back();
		a.pop_back();
	}
	for (int i=0;i<a.size();i++)
	a[i]=cpx((long long)round(real(a[i]))%p,0);
}
int main()
{
	scanf("%d",&p);
	vector<int> cur({1});
	for (int i=0;i<p;i++)
	{
		int r;
		scanf("%d",&r);
		if (!r)
		{
			cur.push_back(0);
			vector<int> tmp(cur.size());
			tmp[0]=(cur[0]*(p-i))%p;
			for (int j=1;j<cur.size();j++)
			tmp[j]=(cur[j-1]+cur[j]*(p-i))%p;
			cur=tmp;
		}
	}
	while (cur.size()>p)
	{
		cur[(int)cur.size()-p]+=cur.back();
		cur.pop_back();
	}
	vector<cpx> ans,res({cpx(1,0)});
	for (int i:cur)
	ans.push_back(cpx(i,0));
	for (int i=0;i<15;i++)
	{
		if ((p-1)&(1<<i))
		mul(res,ans);
		mul(ans,ans);
	}
	for (int i=0;i<p;i++)
	printf("%d ",(int)round(real(res[i])));
}

Measured memory_bytes: 1068
def fanction(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def main():
    N = int(input())
    z_list=[]
    arr = fanction(N)
    k=0
    for i in range(len(arr)):
        p=arr[i][1]
        for j in range(1,arr[i][1]+1):
            if p>=j:
                z = arr[i][0]
                z_list.append(z)
                k+=1
                p-=j
    if N==1:
        k=0
    print(k)

main()        

Measured memory_bytes: 9512
types = ['AC', 'WA', 'TLE', 'RE']
cntLn = [0] * 4
N = int(input())
for i in range(N):
    tmp = input()
    try:
        idx = types.index(tmp)
        cntLn[idx] += 1
    except ValueError as err:
        print("This is value error. -> ", err)
        exit()
for num, value in enumerate(types):
    print(value, "x", str(cntLn[num]))


Measured memory_bytes: 8860
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  string s, t;
  cin >> s >> t;

  string ss = s + s;

  int size = t.size();
  auto dp = vector<ll>(size + 100);
  dp[0] = 0;
  int start = 0;
  REP(i, t.size()) {
    string subs = ss.substr(start, s.length());
    dp[i + 1] = dp[i] + (ll)subs.find_first_of(t[i]) + 1;
    if(string::npos == subs.find_first_of(t[i])) {
      cout << -1 << endl;
      return 0;
    }
    start = dp[i + 1] % s.length();
  }

  cout << dp[size] << endl;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  int k,a,b;
  cin >> k >> a >>b;
  int ans=k;
  rep(i,b){
    if(ans>=a&&ans<=b){
      cout << "OK" << endl;
      return 0;
    }
    ans = ans+k;
  }
  cout << "NG" << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

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

ll a,b,c,x;

int main(){
	cin >> a >> b >> c >> x;
	ll ans = 0;
	rep(i,a+1){
		rep(j,b+1){
			rep(k,c+1){ 
				if(500 * i + 100 * j + 50 * k == x)ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256