akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
/* contest template */

int main()
{
	string s;
	cin >> s;
	int cnt=0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '1') {
			cnt++;
		}
	}
	cout << cnt;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	int d[n];
	int sum = 0;
	for(int i = 0; i < n; i++){
		cin >> d[i];
		for(int j = 0; j < i; j++){
			sum += d[j] * d[i];
		}
	}
	
	cout << sum << endl;
}

Measured memory_bytes: 3572
n = int(input())
ds = list(map(int, input().split()))

from collections import defaultdict
d = defaultdict(int)

d[0] += 1
for d_ in ds:
    d[d_] += 1
    if (d_ == 12 or d_ == 0) and d[d_] == 2:
        print(0)
        exit()
    elif d[d_] == 3:
        print(0)
        exit()

def calcmin(tmp):
    n = len(tmp)
    ret = 1 << 50
    for i in range(n):
        for j in range(i+1,n):
            ret = min(ret, abs(tmp[i]-tmp[j]),24-abs(tmp[i]-tmp[j]))
    return ret

two = []
x = []

for k in d.keys():
    if d[k] == 2 or k == 12:
        two.append(k)
        two.append(24-k)
    elif d[k] == 1:
        x.append(k)

two = list(set(two))
n = len(x)
ans = 0
for i in range(1 << n):
    tmp = x[:]
    for j in range(n):
        if i & (1 << j):
            tmp[j] = 24-x[j]
    # print(tmp,two)
    tmp.extend(two)
    ans = max(calcmin(tmp), ans)

print(ans)



Measured memory_bytes: 3316
import sys
input=sys.stdin.readline
n=int(input())
pointx=[]
pointy=[]
for i in range(n):
    x,y=map(int,input().split())
    pointx.append((x,i))
    pointy.append((y,i))
pointx.sort()
pointy.sort()
G=[[] for i in range(n)]
for i in range(n-1):
    dx=abs(pointx[i+1][0]-pointx[i][0])
    G[pointx[i][1]].append((dx,pointx[i+1][1]))
    G[pointx[i+1][1]].append((dx,pointx[i][1]))
    dy=abs(pointy[i+1][0]-pointy[i][0])
    G[pointy[i][1]].append((dy,pointy[i+1][1]))
    G[pointy[i+1][1]].append((dy,pointy[i][1]))
import heapq
q=[]
check=[False]*n
INF=10**10
d=[INF]*n
ans=0
d[0]=0
heapq.heappush(q,(0,0))
while len(q)>0:
    now=heapq.heappop(q)
    if not check[now[1]]:
        ans+=now[0]
        check[now[1]]=True
        for i in G[now[1]]:
            if i[0]<d[i[1]]:
                d[i[1]]=i[0]
                heapq.heappush(q,i)
print(ans)




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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    string S; cin >>S;
    Yes(S[0]!=S[1]&&S[1]!=S[2]&&S[2]!=S[0]);
}


Measured memory_bytes: 256
import  java.util.*;

 class Main {
    public static void main(String[] args){
        
        Scanner sc =new Scanner(System.in);
        int a=sc.nextInt(),b=sc.nextInt(),x=sc.nextInt();
        if(a>x)
            System.out.println("NO");
        else{
            if(Math.abs(x-a)<=b)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
    }
}


Measured memory_bytes: 23636
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <set>
#include <map>
using namespace std;
#define ld long double
#define F first
#define S second
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define pb push_back
#define p1 1000000007
#define p 998244353
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define int ll
const int N=1e5+10;
const int inf=1e17+10;
 int dp[N];
int h[N];
 int n;
int rec(int i)
{
    if(i<=1) return 0;
    if(dp[i]!=inf) return dp[i];
   // cerr<<i<<" "<<dp[i]<<endl;
   if(i>2)
    return dp[i]=min(rec(i-1)+abs(h[i]-h[i-1]),rec(i-2)+abs(h[i]-h[i-2]));
    else if(i==2)
    return abs(h[2]-h[1]);
    else return 0;

   
}
int32_t main()
{
   
    cin>>n;
    
     
    for(int i=1;i<=n;i++){
        cin>>h[i];
        dp[i]=inf;
    }
   
    int  ans=rec(n);
    cout<<ans;
}


Measured memory_bytes: 3328
x=input()
y=x.split()

if y[0] == y[1] :
    if y[0] == y[2]:
        print("No")
    else:
        print("Yes")
elif y[0] == y[2] :
    print("Yes")
elif y[2] == y[1] :
        print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <stdio.h>

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

int main() {
    int X, A, B;
    scanf("%d %d %d", &X, &A, &B);

    printf("%d\n", (X - A) % B);

    return 0;
}


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

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<ll> l(n);
  rep(i, n) {
    if (i+a[i] < n)
      l[i+a[i]]++;
  }
  vector<ll> r(n);
  rep(i, n) {
    if (i-a[i] >= 0)
      r[i-a[i]]++;
  }
  ll ans = 0;
  rep(i, n)
    ans += l[i]*r[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7924
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A = 0, B = 0;
  cin >> N;
  
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  
  for(int i = 0; i < (N + 1) / 2; i++){
    int max1 = 0, max2 = 0;
    
    for(int j = 0; j < N; j++){
      if(max1 < a.at(j)){
        max1 = a.at(j);
      }
    }
    
    for(int j = 0; j < N; j++){
      if(max1 == a.at(j)){
        a.at(j) = 0;
        break;
      }
    }
    
    for(int j = 0; j < N; j++){
      if(max2 < a.at(j)){
        max2 = a.at(j);
      }
    }
    
    for(int j = 0; j < N; j++){
      if(max2 == a.at(j)){
        a.at(j) = 0;
        break;
      }
    }
    
    A += max1;
    B += max2;
  }
  
  cout << A - B << endl;
  
}

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

using namespace std;

int main() {

	long long int n;
	cin >> n;

	vector<long long int> a(n);

	bool h = false;

	for (long long int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] % 2 == 1) {
			h = true;
		}
	}

	if (h) {
		cout << "first" << endl;
	}
	else {
		cout << "second" << endl;
	}

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

// head

const int N=1010000;
int n;
ll fac[N],fnv[N],way[N],ret;
int main() {
	scanf("%d",&n);
	fac[0]=1;
	rep(i,1,n+1) fac[i]=fac[i-1]*i%mod;
	fnv[n]=powmod(fac[n],mod-2);
	per(i,1,n+1) fnv[i-1]=fnv[i]*i%mod;
	--n;
	for (int j=0;2*j<n;j++) {
		int i=n-2*j;
		way[i+j]=fac[i+j-1]*fnv[i-1]%mod*fnv[j]%mod;
	}
	rep(i,1,n+1) {
		way[i]=way[i]*fac[i]%mod*fac[n-i]%mod;
	}
	rep(i,1,n+1) ret=(ret+(way[i]-way[i-1])*i)%mod;
	if (ret<0) ret+=mod;
	printf("%lld\n",ret);
}

Measured memory_bytes: 23808
package main

import (
	"fmt"
	"math"
)

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	p := make([]float64, N)
	for i := range p {
		fmt.Scan(&p[i])
		p[i] = (p[i] + 1) / 2
	}
	wa := make([]float64, N+1)
	for i := 0; i < N; i++ {
		wa[i+1] = wa[i] + p[i]
	}
	max := 0.0
	for i := K; i < N+1; i++ {
		max = math.Max(max, wa[i]-wa[i-K])
	}
	fmt.Println(max)
}


Measured memory_bytes: 8036
#include <stdio.h>
#include <math.h>


double eps = 1e-10 ;
int main()
{
  double x1, x2, x3, y1, y2, y3, xp, yp;
  double s, s1, s2, s3;

  while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) != EOF){
    //?????§????¢??????¢???
    s  = ((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)) / 2; 
    s1 = ((xp - x1) * (y2 - y1) - (yp - y1) * (x2 - x1)) / 2;
    s2 = ((xp - x1) * (y3 - y1) - (yp - y1) * (x3 - x1)) / 2;
    s3 = ((xp - x2) * (y3 - y2) - (yp - y2) * (x3 - x2)) / 2;

    s  = fabs(s);
    s1 = fabs(s1);
    s2 = fabs(s2);
    s3 = fabs(s3);

    if (fabs(s - (s1 + s2 + s3)) <= eps) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 1040
import bisect
N = int(raw_input())
a = sorted(map(int,raw_input().split()))
s = [0]*(N+1)
for i in xrange(N):
    s[i+1] = s[i]+a[i]
s += [10**9]

M = int(raw_input())
b = map(int,raw_input().split())
c = map(int,raw_input().split())

for i in xrange(M):
    p = bisect.bisect(a,b[i])
    print "Yes" if s[p] >= c[i] else "No"

Measured memory_bytes: 59564
# 小数点は丸め誤差があるので、整数に直して最後に割る
# もしくは、decimalモジュールを使用する

a, b = input().split()
a = int(a)
b = float(b)

# b=float(b)の時点で丸め誤差が生じている
# b * 100　だと丸め誤差が残ったままになる
# 整数へキャストされるときに暗黙的に切り捨てが起こるので、0.5を足す
b_100 = int(b * 100 + 0.5)

print(a * b_100 // 100)


Measured memory_bytes: 9152
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int n,i,j,r;
            cin>>n>>r;
            if(n>=10)
                cout<<r<<endl;
            else
                cout<<r+100*(10-n)<<endl;
        }
        return 0;
    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007;
int dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};
ll dp[100100][13];

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int n = 100,a2 = a;
    while(n--){
        if(a % b == c){
            cout << "YES" << endl;
            return 0;
        }
        a += a2;
    }
    cout << "NO" << endl;
    return 0;
}

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

int main() {
    int a ,b;
    cin >> a >> b;
    if ( a < b ) {
    	cout << "a < b" << endl;
    } else if (a>b) {
    	cout << "a > b" << endl;
    } else {
        cout <<"a == b" << endl;
    	
    }
    
    return 0;
}


Measured memory_bytes: 3032
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		// ?????°??¨?????°?????????
		int line = in.nextInt();
		int column = in.nextInt();

		// ????????????????´??????????????????¨???
		int[][] matrix = new int[line + 1][column + 1];

		// ?????????????????????????´?
		for(int l = 0; l < line; l++){

			for(int c = 0; c < column; c++){

				matrix[l][c] = in.nextInt();

				matrix[l][column] += matrix[l][c];

			}
		}

		for(int c = 0; c < column; c++){

			for(int l = 0; l < line; l++){

				matrix[line][c] += matrix[l][c];

				matrix[line][column] += matrix[l][c];

			}

		}

		// ???????????????????????????
		for(int l = 0; l <= line; l++){

			for(int c = 0; c < column; c++){

				System.out.print(matrix[l][c] + " ");

			}

			System.out.println(matrix[l][column]);

		}

	}

}

Measured memory_bytes: 41800
#include<stdio.h>
#include<algorithm>
using namespace std;
#define N 3 
int main()
{
	int n,a,b,xmax,xmin;
		scanf("%d%d%d",&n,&a,&b);
	xmax=a<b?a:b;
	xmin=a+b-n;
	if(xmin<0)
		xmin=0;
	printf("%d %d",xmax,xmin);
}

Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))
all = abs(A[0]) + abs(A[N-1])
for i in range(1, N):
    all += abs(A[i] - A[i-1])

for i in range(N):
    answer = all
    if i == 0:
        prev = 0
    else:
        prev = A[i-1]
    if i == N-1:
        next = 0
    else:
        next = A[i+1]
    curr = A[i]
    if prev > curr and curr < next:
        if prev >= next:
            answer -= abs(curr - next) * 2
        else:
            answer -= abs(curr - prev) * 2
    elif prev < curr and curr > next:
        if prev >= next:
            answer -= abs(curr - prev) * 2
        else:
            answer -= abs(curr - next) * 2
    print(answer)

Measured memory_bytes: 14172
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,i,ans=0,max;
    cin>>n;
    ll arr[n];
    for(i=0;i<n;i++)
        cin>>arr[i];
    max=arr[0];
    for(i=1;i<n;i++){
        if(arr[i]>=max)
            ans+=1;
        if(arr[i]>max)
            max=arr[i];
    }
    cout<<ans+1<<endl;
    return 0;
}


Measured memory_bytes: 256
from io import StringIO
from collections import *
from functools import *
import sys


def main(inputs):
    n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    n0 = n // 100
    n1 = (n % 100)

    if ismonth(n0) and ismonth(n1):
        return "AMBIGUOUS"

    if ismonth(n0):
        return "MMYY"

    if ismonth(n1):
        return "YYMM"
    
    return "NA"

def ismonth(m):
    return 0 < m and m <= 12


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass


Measured memory_bytes: 3820
line1 = input().split()
line1 = list(map(int,line1))
ate = None
if line1[1] > 0:
    ate = line1[1]
elif line1[1] == 0:
    ate = 0
else:
    if abs(line1[1]) < line1[0]:
        ate = 0
    elif abs(line1[1]) >= line1[0]:
        ate = line1[0] + line1[1] - 1

print(sum(range(line1[1],line1[1]+line1[0])) - ate)

Measured memory_bytes: 3064
N = int(input().split()[0])
a_list = list(map(int, input().split()))
t = 1
if 0 in a_list:
    t = 0
else:
    for a in a_list:
    	t *= a
    	if t > 10**18:
        	t = -1
        	break
print(t)


Measured memory_bytes: 21620
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cassert>
#define MAXN 5010
#define int long long
const int INF = (~0ull) >> 1;
int n, k, q, a[MAXN], b[MAXN], ans = INF;
std::vector<std::pair<int, int>> V;

inline int calc(int l, int r, int max){
    int len = r - l + 1;
    int mc = len - k + 1;
    int ret = 0;
    for(int i = l;i <= r;i++)if(a[i] <= max)ret++;
    return std::max(std::min(ret, mc), 0LL);
}

inline bool judge(int min, int max){
    int L = -1, R = -1;
    V.clear();
    for(int i = 1;i <= n;i++){
        if(a[i] < min){
            if(~L)V.push_back({L, R});
            L = R = -1;
        }else{
            if(!~L)L = i;
            R = i;
        }
    }
    if(~L)V.push_back({L, R});
    int ret = 0;
    for(auto x : V){
        assert(x.first <= x.second);
        ret += calc(x.first, x.second, max);
    }
    return ret >= q;
}
signed main(){
    scanf("%lld%lld%lld", &n, &k, &q);
    for(int i = 1;i <= n;i++)scanf("%lld", &a[i]);
    memcpy(b, a, sizeof(a));
    std::sort(b + 1, b + n + 1);
    for(int i = 1;i <= n;i++){
        if(i + q - 1 > n)break;
        int l = i + q - 1, r = n, tmp = INF;
        while(l <= r){
            int mid = (l + r) >> 1;
            if(judge(b[i], b[mid])){
                tmp = b[mid] - b[i];
                r = mid - 1;
            }else{
                l = mid + 1;
            }
        }
        ans = std::min(ans, tmp);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#define MAX 1000000
using namespace std;

int main()
{	
	bool p[MAX];
	fill(p, p + MAX, 1);
	
	p[0] = p[1] = 0;
	for (int i = 2; i < sqrt(MAX) + 1; i++) {
		if (p[i]) {
			for (int j = i * 2; j < MAX; j += i)
				p[j] = 0;
		}
	}
	
	int n;
	while (cin >> n) {
		int sum = 0;
		while(n) sum += p[n--];
		cout << sum << endl;;
	}
		
	return 0;
}

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

int main(){
  int N;
  cin>>N;
  long long ans=0;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    while(a%2==0){
      a/=2;
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, string> P;
typedef tuple<int, string, string> T;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;

string solve() {
    switch (n%10) {
    case 3: return "bon";
    case 0: case 1: case 6: case 8: return "pon";
    }
    return "hon";
}

void input() {
    cin >> n;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 3116
#include <stdio.h>

/* 選択ソート (0オリジン) */
int selectionSort(int A[], int N) {
  int i, j, t, sw = 0, mini;
  for(i=0; i<N-1; i++) {
    mini = i;
    for(j=i; j<N; j++) {
      if(A[j] < A[mini]) mini = j;
    }

  	t = A[i];
  	A[i] = A[mini];
  	A[mini] = t;

  	if(i != mini) sw++;
  }
  return sw;
}

int main(void) {
  int A[100], N, i, sw;
  scanf("%d", &N);
  for(i=0;i<N;i++) scanf("%d",&A[i]);

  sw = selectionSort(A,N);

  for(i=0;i<N;i++) {
    if(i>0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n", sw);

  return 0;
}


Measured memory_bytes: 2104
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    int n;
    cin >> n;
    int a1[110]={},a2[110];
    rep(i,n){
        cin >> a1[i];
    }
    rep(i,n){
        cin >> a2[i];
    }
    int res = 0;
    if(n==1){
        cout << a1[0]+a2[0] << endl;
        return 0;
    }
    for(int i=0;i<n;i++){
        int sum1=0,sum2=0;
        for(int j=0;j<=i;j++){
            sum1+=a1[j];
        }
        for(int j=i;j<n;j++){
            sum2+=a2[j];
        }
        res = max(res,sum1+sum2);
    }
    cout << res << endl;
    return 0;
}

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

#define ll long long
#define mod 1000000007
#define debug1(x) cerr<<#x<<" : "<<x<<"\n";
#define debug2(x,y) cerr<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    freopen("input.txt", "rt" , stdin);
//    freopen("output.out", "wt",stdout);


int main() {
    IOS;
    string str;
    cin>>str;
    ll ans=0;
    for(ll i=0;str[i]!='\0';i++)ans+=(str[i]-'0');
    if(ans%3==0)cout<<"Yes"<<endl;else cout<<"No"<<endl;
    return 0 ;
}


Measured memory_bytes: 3780
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import Text.Printf
import GHC.ST
-- import System.IO.Unsafe
 
-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
whenM :: Monad m => m Bool -> m () -> m ()
whenM c a = c >>= flip when a
unconsU :: [a] -> (a, [a])
unconsU (x:xs) = (x, xs)
-- templete



main = do
    ds <- sort . map (fmap (apply2 (,)) . unconsU) <$> replicateM 2 getInts
    let [(y,md),(yy,mmdd)] = ds
    print $ yy - y + (cond 1 0 $ mmdd>md)


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

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    vi c(4, 0);
    int n;
    cin >> n;
    REP(i, n) {
        string s;
        cin >> s;
        if (s == "AC") c[0] ++;
        if (s == "WA") c[1] ++;
        if (s == "TLE") c[2] ++;
        if (s == "RE") c[3] ++;
    }

    cout << "AC x " << c[0] << endl;
    cout << "WA x " << c[1] << endl;
    cout << "TLE x " << c[2] << endl;
    cout << "RE x " << c[3] << endl;

    return 0;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vl vaector<long>
#define vll vector<long long int>
#define vC  vector<char>
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
ll pow(ll x, ll y,ll m) { ll res = 1;x=x%m; while (y > 0) { if (y & 1) res = ((res%m) * (x%m))%m; y = y >> 1; x = ((x%m) * (x%m))%m; } return res%m; }
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
const ll INF = 0xFFFFFFFFFFFFFFFL;
clock_t time_p=clock();
void abhigyan10()
{time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}
ll seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline ll rnd(ll l=0,ll r=INF){return uniform_int_distribution<ll>(l,r)(rng);}
#define clrbuf cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define preciset(x) cout<<setprecision(x)<<fixed;
const ll mod =1000000007;
ll cal(ll h)
{
	if(h==1)
		return 1;
	else
		return ((2LL)*cal(h/2LL))+1LL;
}
int main()
{
    
	
        FastIO
        ll h;
        cin>>h;
        cout<< cal(h);
        return 0;
    }

Measured memory_bytes: 256
word = list(input())
new_word = list(reversed(word))
front = word[0:int((len(word)-1)/2)] 
new_front = list(reversed(front))
rear = word[int(((len(word)-1)/2)+1):]
new_rear = list(reversed(rear))
ans = 0
if front == new_front and rear == new_rear:
  ans += 1
if word == new_word:
  ans += 1
  
if ans == 2:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 38384
import Data.List
import qualified Data.ByteString.Char8 as B
import Control.Monad
import Data.Ord

main :: IO ()
main = breads >>= main'
    where
        main' (n : _) = replicateM n (edit <$> breads) >>= print . solve
        edit [s, t, c] = (s, t, c)

solve :: [(Int, Int, Int)] -> Int 
solve = fst . foldl' ff (0, 0) . groupBy gf2 . sortBy (comparing fst) . concatMap mf . groupBy gf . sortBy sf
    where
        sf (ls, lt, lc) (rs, rt, rc) = compare lc rc `mappend` compare ls rs `mappend` compare lt rt
        gf (_, _, lhs) (_, _, rhs) = lhs == rhs
        gf2 (lt, _) (rt, _) = lt == rt
        mf ((xs, xt, c) : y@(ys, yt, _) : zs)
            | xt == ys = mf $ (xs, yt, c) :zs
            | otherwise = (2 * xs - 1, 1) : (2 * xt, -1) : mf (y : zs)
        mf ((xs, xt, _) : _) = (2 * xs - 1, 1) : (2 * xt, -1) : []
        mf _ = []
        ff (acc, current) xs = (max acc next, next)
            where
                next = v + current
                v = sum $ fmap snd xs


breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)

Measured memory_bytes: 51580
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

using namespace std;

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

typedef long long ll;
typedef unsigned long long ull;

void factorize(int n, map<int, int> &primes) {
  for (int d = 2; n != 1; d++) {
    if (n % d != 0) continue;
    int cnt = 0;
    while (n % d == 0) {
      cnt++;
      n /= d;
    }
    primes[d] += cnt;
  }
}

int dfs(int n, int _75, vector<int> &exps) {
  if (n == exps.size())
    return _75 == 1;

  int res = 0;

  if (_75 % 3 == 0 && exps[n] >= 3)
    res += dfs(n + 1, _75 / 3, exps);
  if (_75 % 5 == 0 && exps[n] >= 5)
    res += dfs(n + 1, _75 / 5, exps);
  if (_75 % 15 == 0 && exps[n] >= 15)
    res += dfs(n + 1, _75 / 15, exps);
  if (_75 % 25 == 0 && exps[n] >= 25)
    res += dfs(n + 1, _75 / 25, exps);
  if (_75 % 75 == 0 && exps[n] >= 75)
    res += dfs(n + 1, _75 / 75, exps);

  res += dfs(n + 1, _75, exps);

  return res;
}

int main(void) {
  int N; cin >> N;
  map<int, int> primes;
  REP(i, 2, N + 1) factorize(i, primes);
  vector<int> exps;
  for(auto &p : primes) {
    int _, c;
    tie(_, c) = p;
    exps.push_back(c + 1);
  }
  cout << dfs(0, 75, exps) << endl;
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
const int MOD = 1e9 + 7;

int main(){
    fast;
    string s, t;
    cin >> s >> t;
    ll n = s.size(), m = t.size();
    ll lcs[n+1][m+1];
    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= m; ++j){
            if(i == 0 || j == 0)
                lcs[i][j] = 0;
            else if(s[i-1] == t[j-1])
                lcs[i][j] = lcs[i-1][j-1] + 1;
            else
                lcs[i][j] = max(lcs[i-1][j], lcs[i][j-1]);
        }
    }
    string h=t;
    string ans;
    // cout << "haha";
    int i = n, j = m;
    while(i > 0 && j > 0){
        if(lcs[i][j] > max(lcs[i-1][j], lcs[i][j-1])){
            ans.push_back(h[j-1]);
            --i;
            --j;
        }
        else if(lcs[i][j] == lcs[i-1][j])
            --i;
        else
            --j;
    }
    // cout << "yo";
    for(int i = ans.size() - 1; i >= 0; --i)
        cout << ans[i];
    return 0;
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;



struct edge { int to, cost; };
struct dijkstra {
    vector<vector<edge>> g;
    vector<int> d;
    int V;
    
    dijkstra(int v){
        V = v;
        d.resize(V);
        g.resize(V);
    }
    
    void solve_d(int s){
        pq1<pii> que;
        rep(i,V) d[i] = infi;
        d[s] = 0;
        que.push({0,s});
        
        while (!que.empty()) {
            pii p = que.top();
            que.pop();
            int v = p.se;
            if(d[v] < p.fi) continue;
            rep(i,int(g[v].size())){
                edge e = g[v][i];
                if(d[e.to] > d[v] + e.cost){
                    d[e.to] = d[v] + e.cost;
                    que.push({d[e.to],e.to});
                }
            }
        }
    }
    
    int dis(int a){
        return d[a];
    }
};




int main()
{
    int N,M;
    cin >> N >> M;
    
    dijkstra G(3*N);
    
    rep(i,M){
        int u,v;
        cin >> u >> v;
        u--,v--;
        G.g[3*u].pb({3*v+1,1});
        G.g[3*u+1].pb({3*v+2,1});
        G.g[3*u+2].pb({3*v,1});
    }
    int S,T;
    cin >> S >> T;
    
    S--,T--;
    S = 3*S;
    T = 3*T;
    G.solve_d(S);
    
    
    if(G.d[T] == infi) cout << -1 << endl;
    else if(G.d[T]) cout << G.d[T]/3 << endl;
    

    
    
    
    

    return 0;
}


Measured memory_bytes: 17792
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> N;
    map<int, int> mp;
    REP(i, 10) {
        REP(j, 10) {
            mp[i * j] = 1;
        }
    }
    if (mp[N])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
#define x1 0
#define y1 1
#define x2 2
#define y2 3
#define x3 4
#define y3 5

int main()
{
	int n;
	double xy[6],a,b,c,d,e,f,x,y,r;

	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<6;j++)
			cin>>xy[j];

		a=2.0*(xy[x2]-xy[x1]);
		b=2.0*(xy[y2]-xy[y1]);
		c=2.0*(xy[x3]-xy[x2]);
		d=2.0*(xy[y3]-xy[y2]);
		e=xy[y2]*xy[y2]-xy[y1]*xy[y1]+xy[x2]*xy[x2]-xy[x1]*xy[x1];
		f=xy[y3]*xy[y3]-xy[y2]*xy[y2]+xy[x3]*xy[x3]-xy[x2]*xy[x2];

		x=(d*e-b*f)/(a*d-b*c);
		y=(a*f-c*e)/(a*d-b*c);
		r=sqrt((xy[x1]-x)*(xy[x1]-x)+(xy[y1]-y)*(xy[y1]-y));

		

		printf("%.3f %.3f %.3f\n",x,y,r);
	}
}

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int n;
	cin >> n;
	map<int, int> ans;

	For(x,1,100){
		For(y,1,100){
			For(z,1,100){
				ll tmp = x * x + y * y + z * z;
				tmp += x * y;
				tmp += z * y;
				tmp += x * z;
				ans[tmp]++;
			}
		}
	}
	For(i,1,n+1){
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 5384
#include <cstdio>
#include <iostream>
using namespace std;
#define mod 1000000007;

int main(){
  int n, m;
  cin >> n >> m;
  if (m > n) swap(n, m); // n >= m
  long long ans = 0;
  if (n - m == 1) {
    ans = 1;
    for (int i = n; i > 0; i--) {
      ans = ans * i;
      ans %= mod;
    }
    for (int i = m; i > 0; i--) {
      ans = ans * i;
      ans %= mod;
    }
  } else if (n - m == 0) {
    ans = 2;
    for (int i = n; i > 0; i--) {
      ans = ans * i;
      ans %= mod;
    }
    for (int i = m; i > 0; i--) {
      ans = ans * i;
      ans %= mod;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 200000
int main()
{
  int prime[N];
  for(int i=0;i<N;i++)
  {
    prime[i]=1;
  }
  prime[0]=0;
  prime[1]=0;
  for(int i=2;i<N;i++)
  {
    if(prime[i]==1)
    {
      for(int j=2;i*j<N;j++)
        prime[i*j]=0;
    }
  }
  int x;
  cin>>x;
  for(int i=x;;i++)
  {
    if(prime[i]==1)
    {
      cout<<i;
      break;
    }
  }

}
  


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<vector>
using namespace std;
bool is_Prime(int n)
{

    if (n <= 1)
        return false;


    for (int i = 2; i < n; i++)
        if (n % i == 0)
            return false;

    return true;
}
int main()
{
    int x;
    cin>>x;

    int i;
    for(i=x;;i++)
    {
       if(is_Prime(i))
       {
           cout<<i;
           break;
       }
    }

}


Measured memory_bytes: 256
n = int(input())
a_lst = list(map(int,input().split()))
odd = 0
count = 0

for i in range(n):
    number = a_lst[i]

    if number%2==0:
        odd += 1
        if number%3==0 or number%5==0:
            count += 1

if odd==count:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int r, g, b; std::cin >> r >> g >> b;
  int n = 100*r + 10*g + b;
  if ( n % 4 == 0 ) std::cout << "YES" << std::endl;
  else std::cout << "NO" << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
#include <set>
#include <list>
#include <string>
#include <memory.h>
#include <bitset>
#include <stack>
#include <assert.h>
#include <ctime>
#include <unordered_set>
using namespace std;
#define ll long long
#define ppi pair<int, int>
#define mp make_pair
const int N = 2e5 + 1111 , BN = 3e7 + 11, K = 20;
const int mod = 1e9 + 7;
ll ans[N];
int idx = 0;
void bfs()
{
	const int com = 1e5 + 11;
	queue<ll> q;
	for (int i = 1; i <= 9; i++)
		q.push(i);
	while (idx != com)
	{
		ll u = q.front();
		q.pop();
		ans[idx++] = u;
		ll l = u % 10;
		for (int i = -1; i <= 1; i++)
		{
			if (l + i >= 0 && l + i <= 9)
			{
				q.push(u * 10 + l + i);
			}
		}
	}
}
int main()
{
#ifndef ONLINE_JUDGE
	//freopen("inp.txt", "r", stdin);
#endif
	bfs();
	int n;
	cin >> n;
	cout << ans[n - 1];
}


Measured memory_bytes: 2560
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Tarek
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CMultiplication3 solver = new CMultiplication3();
        solver.solve(1, in, out);
        out.close();
    }

    static class CMultiplication3 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            BigDecimal a = new BigDecimal(in.next());
            BigDecimal b = new BigDecimal(in.next());
            out.println(a.multiply(b).longValue());
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 33172
//Dragon_warrior7(IITK)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define deb(x) cout << #x << " " << x << "\n"
#define pll pair<ll, ll> 
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}

void print(vector<ll> v)
{
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << " ";
}
ll n,m,a,b,c,t,temp,x,y;
string str;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	ll dp[n+100][5];
	for(int i=0;i<=n;i++)
	{
	    for(int j=0;j<4;j++)
	    dp[i][j]=0;
	}
		ll v[4];
	for(int i=1;i<=3;i++)
	{
	    cin>>v[i];
	}
	dp[1][1]=v[1];
	dp[1][2]=v[2];
	dp[1][3]=v[3];
	for(int i=2;i<=n;i++)
	{
	    for(int i=1;i<=3;i++)
	   {
	    cin>>v[i];
	   }
	    for(int j=1;j<=3;j++)
	    {
	        for(int x=1;x<=3;x++)
	        {
	            if(x==j)
	            continue;
	            dp[i][j]=max(dp[i-1][x]+v[j],dp[i][j]);
	        }
	    }
	    //cout<<dp[i][3];
	    //nl;
	}
	ll mx=0;
	for(int i=1;i<=3;i++)
	{
	    mx=max(mx,dp[n][i]);
	}
	cout<<mx;
}

Measured memory_bytes: 4224
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<string>
#include<algorithm>
#include<math.h>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<list>
#include<set>
#include<map>
#include<bitset>
#include<iterator>
#include <stack>
#define ll long long
typedef long double ld;
#define all(v) ((v).begin()),((v).end())
#define vec2(n,m) vector<vector<ll>>vv(n + 10, vector<ll>(m + 10, 0));
#define p_q1   priority_queue<int,vector<int>,greater<int>>pq1;
#define format(n) fixed<<setprecision(n)
#define ll_min LLONG_MIN;
#define ll_max LLONG_MIN;
#define endl "\n"
#define F first 
#define S second
#define mkpr(x,y)  make_pair(x,y)
using namespace std;
void weza()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
int main()
{
	weza();
	ll t, n, m, k,a,b;
    cin >> n >> m;
    if (n <= m)
        cout << "unsafe" << endl;
    else
        cout << "safe" << endl;
}


Measured memory_bytes: 3104
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
//再帰的に計算すると大変なので、これも式を圧縮する
//何回使うか=x
//1)(辺の本数)*x=(n-1)*n!
//2)辺の本数=nC2=n(n-1)/2
//x=2*(n-1)!
namespace C
{
    class Program
    {
        static public int[,] P;
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            P = new int[n, 2];
            for (int i = 0; i < n; i++)
            {
                string[] In = Console.ReadLine().Split(' ');
                P[i, 0] = int.Parse(In[0]);
                P[i, 1] = int.Parse(In[1]);
            }
            double ans = 0;
            int times = 2 * Fact(n-1);
            for(int i = 0; i < n-1; i++)
            {
                for(int j = i + 1; j < n; j++)
                {
                    ans += Dis(i, j) * times;
                }
            }
            ans /= Fact(n);
            Console.WriteLine(ans);
        }
        public static int Fact(int x)
        {
            int sum = 1;
            while (x >= 2)
            {
                sum *= x;
                x -= 1;
            }
            return sum;
        }
        static public double Dis(int xi, int yi)
        {
            return Math.Sqrt(Math.Pow(P[xi, 0] - P[yi, 0], 2) + Math.Pow(P[xi, 1] - P[yi, 1], 2));
        }
    }
}
//namespace C
//{
//    class Program
//    {
//        public static int  n;
//        public static int[,] P;
//        static void Main(string[] args)
//        {
//            n = int.Parse(Console.ReadLine());
//            P = new int[n, 2];
//            for(int i = 0; i < n; i++)
//            {
//                string[] In = Console.ReadLine().Split(' ');
//                P[i, 0]= int.Parse(In[0]);
//                P[i, 1]= int.Parse(In[1]);
//            }
//            double ans= 0;
//            for(int i=0; i < n; i++)
//            {
//                var N = new List<bool>();
//                N = Enumerable.Repeat(false, n).ToList();
//                N[i]=true;
//                while (N.Count != 0)
//                {

//                }
//            }
//            Console.WriteLine(ans/2);
//        }
//        static public double Dis(int xi, int yi)
//        {
//            return Math.Sqrt(Math.Pow(P[xi,0]-P[yi,0],2)+ Math.Pow(P[xi, 1] - P[yi, 1], 2));
//        }
//        static public bool HaveNoFalse(List<bool> B)
//        {
//            foreach(var b in B)
//            {
//                if (!b) return false;
//            }
//            return true;
//        }
//    }
//}

//static public double Comb(bool[] N, double sum, int bef)
//{
//    if (HaveNoFalse(N)) return sum;
//    for (int i = 0; i < n; i++)
//    {
//        if (!N[i])
//        {
//            for (int j = 0; j < n; j++)
//            {
//                if (!N[j])
//                {
//                    sum += Dis(bef, i);
//                    N[i] = true;
//                    Console.WriteLine($"{P[bef, 0]},{P[bef, 1]}=>{P[i, 0]},{P[i, 1]}={Dis(bef, i)}");
//                    return Comb(N, sum, i);
//                }
//            }
//        }
//    }
//    return 0;
//}


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

int main() {
  int N;
  cin >> N;
  vector<string> blue(N);
  for(int i = 0; i < N; i++) cin >> blue.at(i);
  int M;
  cin >> M;
  vector<string> red(M);
  for(int i = 0; i < M; i++) cin >> red.at(i);

  int sum = 0;
  for(int i = 0; i < N; i++) {
    string s = blue.at(i);
    if(s == "") continue;

    int b = 0;
    for(int j = 0; j < N; j++) {
      if(blue.at(j) == s) {
        blue.at(j) == "";
        b++;
      }
    }
    
    for(int j = 0; j < M; j++) {
      if(red.at(j) == s) b--;
    }
    
    if(b > sum) sum = b;
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 3616