akhauriyash/Code-Regression huggingface dataset:
n = int(input())
p = list(map(int, input().split()))
p = [i-1 for i in p]

has_pair = 0
ans = 0
for i in range(n):
    if p[i]==i:
        if has_pair==0:
            has_pair=1
            ans+=1
        else:
            has_pair=0
    else:
        has_pair=0
print(ans)

Measured memory_bytes: 20612
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <limits>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-9)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;
const long long mod = 1000000007;

template<typename T>
void max_self(T& a, T b)
{
	a = max(a, b);
}
const int nmax = 305;
double p[nmax][nmax][nmax] = { 0 };
double ev[nmax][nmax][nmax] = { 0 };
int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
	int n;
	cin >> n;
	vi cnt(4);
	for (int i = 0; i < n; i++)
	{
		int cur;
		cin >> cur;
		cnt[cur]++;
	}
	p[cnt[1]][cnt[2]][cnt[3]] = 1;
	for (int c = n; c >= 0; c--)
		for (int b = n; b >= 0; b--)
			for (int a = n; a >= 0; a--)
			{
				if (a + b + c > n)
					continue;
				if (a == 0 && b == 0 && c == 0)
					continue;
				double p_waste = (double)(n - (a + b + c)) / n;
				double ev_waste = p_waste / (1 - p_waste) + 1;
				ev[a][b][c] += ev_waste * p[a][b][c];
				if (c > 0)
				{
					double p_go = (double)c / (a + b + c);
					p[a][b + 1][c - 1] += p[a][b][c] *  p_go;
					ev[a][b + 1][c - 1] += ev[a][b][c] * p_go;
				}
				if (b > 0)
				{
					double p_go = (double)b / (a + b + c);
					p[a + 1][b - 1][c] += p[a][b][c] * p_go;
					ev[a + 1][b - 1][c] += ev[a][b][c] * p_go;
				}
				if (a > 0)
				{
					double p_go = (double)a / (a + b + c);
					p[a - 1][b][c] += p[a][b][c] * p_go;
					ev[a - 1][b][c] += ev[a][b][c] * p_go;
				}
			}
	cout << ev[0][0][0];
	return 0;
}

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

int main(){
    char c; cin >> c;
    cout << char(c+1) << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
_ = [list(map(int, input().split())) for _ in range(n)]
_.insert(0, [0, 0, 0])

dt = [0] * n
dx = [0] * n
dy = [0] * n

for i in range(n):
    dt[i] = _[i + 1][0] - _[i][0]
    dx[i] = _[i + 1][1] - _[i][1]
    dy[i] = _[i + 1][2] - _[i][2]

ans = "Yes"

for i in range(n):
    man_d = abs(dx[i]) + abs(dy[i])
    if not (dt[i] >= man_d and (dt [i]- man_d) % 2 == 0):
        ans = "No"

print(ans)

Measured memory_bytes: 62936
#include <iostream>
#include <vector>
#include <algorithm>
 
#define rep(i, n) for(int i = 0; i < (n); ++i)
 
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int n;
int a[300000];
int v[300000];
ll c[300001];
ll s[300001];
ll p[300000];
ll q[300000];

void compress(){
    vector<P> z;
    rep(i, 3 * n){
        z.push_back(P(a[i], i));
    }
    sort(z.begin(), z.end());
    rep(i, 3 * n){
        a[z[i].second] = i;
        v[i] = z[i].first;
    }
}

void add(ll* b, int i, int x){
    while(i <= 3 * n){
        b[i] += x;
        i += i & -i;
    }
}

ll sum(ll* b, int i){
    ll s = 0;
    while(i > 0){
        s += b[i];
        i -= i & -i;
    }
    return s;
}

int find(){
    int l = 0;
    int r = 3 * n + 1;
    while(r - l > 1){
        int m = (l + r) / 2;
        if(sum(c, 3 * n) - sum(c, m) >= n){
            l = m;
        }
        else{
            r = m;    
        }
    }
    return l;
}

void solve(ll* p){
    rep(i, 3 * n){
        add(c, a[i] + 1, 1);
        add(s, a[i] + 1, v[a[i]]);
        int k = find();
        p[i] = sum(s, 3 * n) - sum(s, k);
    }
}

int main(){
    cin >> n;
    rep(i, 3 * n){
        cin >> a[i];
    }

    compress();

    solve(p);
    
    fill_n(c, 3 * n + 1, 0);
    fill_n(s, 3 * n + 1, 0);
    reverse(a, a + 3 * n);
    rep(i, 3 * n){
        a[i] = 3 * n - a[i] - 1;
    }
    reverse(v, v + 3 * n);
    solve(q);

    ll ans = p[n - 1] - q[2 * n - 1];
    rep(i, n + 1){
        ans = max(p[n - 1 + i] - q[2 * n - i - 1], ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12140
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
typedef long long ll;
#define pi 3.141592653589

int main(){
    fastio;
    int r;
    cin >> r;
    cout << 2 * pi * r << "\n";
    return 0;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>

// Remove GCC optimizer for codechef
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;



int32_t main()
{


    IOS



    int x,y;
    cin >> x >> y;

    if((4*x-y)%2 == 0 and (4*x-y) >=0)
    {
    	int a = (4*x-y)/2;
    	if(a >=0 and x-a >=0)
    	{
    		cout << "Yes";
    		return 0;
    	}

    }
    if(y-2*x >=0 and (y-2*x)%4 == 0)
    {
    	int a = (y-2*x)/4;
    	if(a >=0 and x-a >=0)
    	{
    		cout << "Yes";
    		return 0;
    	}
    }

    
    	cout << "No";
    




    return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1000000007;

int main(){
	int n,k;
	cin>>n>>k;
	int a[220000]={0};
	int arr[220000]={0};
	int cnt=0,kind=0;
	for(int i=0;i<n;i++)cin>>a[i];

	for(int i=0;i<n;i++){
		arr[a[i]-1]++;
	}
	for(int i=0;i<n;i++){
		if(arr[i] != 0) kind++;
	}
	sort(arr, arr+n);
	int i=0;
	while(kind>k){
		cnt += arr[i];
		kind -= min(arr[i], 1);
		i++;
	}

	cout<< cnt <<endl;

	return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){

  ll a,b,x;
  cin >> a >> b >> x;
  ll res = 0;
  res += b/x;
  if(a >= 1)res -= (a-1)/x;
  else res++;
  cout << res << endl;
  
  







  

  return 0;
}

Measured memory_bytes: 256
n = int(input())
s = []
for _ in range(n):
    s.append(input())


cnt = 0
tmpdic = {}
for i in s:
    tmp = "".join(sorted(i))
    if tmp in tmpdic.keys():
        cnt += tmpdic[tmp]
        tmpdic[tmp] += 1
    else:
        tmpdic[tmp] = 1


print(cnt)

Measured memory_bytes: 24976
#include <bits/stdc++.h>
using namespace std ;
const int N = 1e6 + 10 ;
unordered_map<int , pair<int , char> > mp ;
int a[N] , c[N] ;
char b[3 * N] ;
int main()
{
  string s ;
  string x ;
  int t , k , f , q , sum = 0 ;
  cin >> s >> q ;
  for(int i = 1; i <= q ;i ++)
   {
     scanf("%d" , &t) ;
     if(t == 1) a[i] = 1 , sum ++ ;
     else
      {
        cin >> f >> x ;
        mp[i] = {f , x[0]} ;
      }
   }
   c[0] = sum % 2 ;
   for(int i = 1; i <= q ;i ++)
    c[i] = c[i - 1] + a[i] ;
   int l = 3e5 , r = l - 1 ;
   if(sum % 2)
      for(int i = s.size() - 1 ;i >= 0 ;i --)
       b[++ r] = s[i] ;
   else for(int i =  0 ;i < s.size() ;i ++)
       b[++ r] = s[i] ;
//  for(int i = 1; i <= q ; i ++) cout << c[i] << " " ;
//  puts("") ;
   for(int i = 1 ; i <= q ;i ++)
    {
      if(a[i]) continue ;
      int f = mp[i].first ;
      char h = mp[i].second ;
      if(c[i] % 2 == f % 2)
       b[++ r] = h ;
      else b[-- l] = h ;
    }
   for(int i = l ;i <= r ;i ++) cout << b[i] ;
   puts("") ;
  return 0 ;
}


Measured memory_bytes: 12616
#include<bits/stdc++.h>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll  long long
#define ull unsigned long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x) 
#define gc getchar
#define pdd pair<dd,dd>
#define prec(x) cout<<fixed<<setprecision(x)
using namespace std;
 
vector<char> sol[200005];
int main(){
	ll n,k;
	cin>>n>>k;
	map<ll,ll> help;
	for(ll i=1;i<=k;i++){
		ll d;
		cin>>d;
		while(d--){
			ll j;
			cin>>j;
			help[j]++;
		}
	}
	ll ans=0;
	for(ll i=1;i<=n;i++)ans+=(help[i]==0);
	cout<<ans<<endl;
}

Measured memory_bytes: 8312
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> p(n);
  for (int i = 0; i < n; ++i)
    scanf("%d", &p[i]), --p[i];
  vector<int> inv_p(n);
  for (int i = 0; i < n; ++i)
    inv_p[p[i]] = i;
  int max_mid = 0;
  int cur = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (i + 1 < n && inv_p[i + 1] < inv_p[i])
      cur = 0;
    ++cur;
    max_mid = max(max_mid, cur);
  }
  int result = n - max_mid;
  printf("%d\n", result);
  return 0;
}


Measured memory_bytes: 1920
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  readln.chomp.count('2').writeln;
}


Measured memory_bytes: 256
h,w=map(int,input().split())
g=[input()for _ in range(h)]
M=10**9+7
dp=[[0]*(w+1)for _ in range(h+1)]
dp[0][1] = 1
for i in range(h):
	for j in range(w):
			dp[i+1][j+1]=(dp[i+1][j]+dp[i][j+1])*(g[i][j]==".")
print(dp[-1][-1]%M)

Measured memory_bytes: 157556
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#define rep(i, n) for(int i=0; i<n; i++)
#define rep_one(i, n) for(int i=1; i<n; i++)
using namespace std;
typedef long long ll;

int n, ans;
int m = 1000000+1010;

int main(){
    cin >> n;
    int a[m];
    int p[m];
    rep(i, m){
        a[i] = 0;
        p[i] = 0;
    }
    rep(i, n){
        int tmp;
        cin >> tmp;
        a[tmp]++;
    }
    for(int i=1; i<m; i++){
        for(int j=i; j<m; j+=i){
            p[j] += a[i];
        }
    }
    rep(i, m){
        if(p[i] == 1 && a[i] == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 11424
import java.util.Scanner;

public class Main {

    public Main() {
        Scanner scanner = new Scanner(System.in);
        long N = scanner.nextLong();

        String R = "";
        while(N > 0){
            char C = (char)(N%26L);
            if(C == 0) C = 26;
            N = (N - C) / 26L;
            C = (char)('a'+C-1);
            R = C + R;
        }

        System.out.println(R);
    }

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


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

int c2i(char c) { return c - '0'; }

bool isMonth(int x) { return (x > 0 && x < 13); }

int main(void) {
    int u, d;
    string s;
    cin >> s;
    u = 10 * c2i(s[0]) + c2i(s[1]);
    d = 10 * c2i(s[2]) + c2i(s[3]);

    if (isMonth(u) && isMonth(d)) {
        cout << "AMBIGUOUS" << endl;
    } else if (isMonth(u)) {
        cout << "MMYY" << endl;
    } else if (isMonth(d)) {
        cout << "YYMM" << endl;
    } else {
        cout << "NA" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
//package atcoder;
 
import java.util.*;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int H[] = new int [N];
		int A[][] = new int [M][2];
		
		for(int i=0;i<N;i++) {
			H[i] = sc.nextInt();
		}
		boolean ok[] = new boolean[N];
		Arrays.fill(ok,true);
		
		int a,b;
		for(int j=0;j<M;j++) {
			a = sc.nextInt()-1;
			b = sc.nextInt()-1;
			if(H[a] == H[b]) {
				ok[a] = false;
				ok[b] = false;
			}else if(H[a]>H[b]) {
				ok[b] = false;
			}else {
				ok[a] = false;
			}
		}
		int count = 0;
		for(int k=0;k<N;k++) {
			if(ok[k]) {
				count ++;
			}
		}
		System.out.println(count);
		
	}
}

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

int main(){
	string A;
	cin >> A;
	if(A[0]==A[1]&&A[1]==A[2]){
		cout<<"Yes"<<endl;
		return 0;
	}
	if(A[1]==A[2]&&A[2]==A[3]){
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int c, d[6] = {1, 5, 10, 50, 100, 500}, i, ans = 0;
  for(i = 0; i < 6; ++i) {
    scanf("%d", &c);
    ans += c * d[i];
  }
  if(ans >= 1000) printf("1\n");
  else printf("0\n");
  return 0;
}


Measured memory_bytes: 2668
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>

#define ALL(a)  (a).begin(),(a).end()

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();

    ll x, y;

    ll n1, n2;
    cin >> x >> y;

    if ((-x + 2 * y) % 3 != 0 || (2 * x - y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    }

    n1 = (-x + 2 * y) / 3;
    n2 = (2 * x - y) / 3;


    cout << COM(n1+n2, n1) << endl;
}


Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+10;
ll n,k;
vector<ll>v;
map<ll,ll>val;
ll a1[N],a2[N],a3[N];
ll res[N],tot;
int main()
{
	int flag=1;
	cin>>n>>k;
	for(ll i=k+2*n-1,j=1;i>=k+n&&j<=n;i--,j++)
	a2[j]=i;
	int z=1;
	for(ll i=k;i<k+n&&z<=n;i+=2,z++)
	a1[z]=i;
	for(ll i=k+1;i<k+n&&z<=n;i+=2,z++)
	a1[z]=i;
	for(int i=1;i<=n;i++)
	{
		a3[i]=a1[i]+a2[i];
		if(a3[i]>=k+2*n&&a3[i]<k+3*n)
		val[a3[i]]++;
	}
	for(ll i=k+2*n;i<k+3*n;i++)
	{
		if(!val.count(i))
		res[++tot]=i;
	}
	int pos=1;
	for(int i=1;i<=n;i++)
	{
		if(a3[i]>=k+3*n)
		{
			cout<<-1<<endl;
			return 0;
		}
		if(!val.count(a3[i]))
		{
			a3[i]=res[pos++];
			if(!(a3[i]>=k+2*n&&a3[i]<k+3*n&&a3[i]>=a1[i]+a2[i]))
			{
				cout<<-1<<endl;
				return 0;
			}
			continue;
		}
		else
		{
			if(val[a3[i]]>1)
			{
				val[a3[i]]--;
				a3[i]=res[pos++];
				if(!(a3[i]>=k+2*n&&a3[i]<k+3*n&&a3[i]>=a1[i]+a2[i]))
				{
					cout<<-1<<endl;
					return 0;
				}
			}
		}
	}
	for(int i=1;i<=n;i++)
	cout<<a1[i]<<" "<<a2[i]<<" "<<a3[i]<<endl;
        return 0;
}

Measured memory_bytes: 10880
H,W,K = map(int, input().split())

if W == 1:
    print(1)
    exit()

#dp[i][j]：左からj番目の縦棒で上からiの地点を訪れる場合の数
dp = [[0 for _ in range(W)] for _ in range(H+1)]
#最初は一番左上
dp[0][0] = 1

MOD = 10**9+7
for i in range(H):
    # 横棒のパターンを全探索。横棒は二つの縦棒の間にできるので、W-1箇所入れられるのでそれぞれについてあるORない
    # 1ならそこに横棒がある
    for yoko in range(2**(W-1)):
        if "11" in bin(yoko):
            continue
        
        yoko = bin(yoko)[2:].zfill(W-1)

        for j in range(W):
            #dp[i][j]からどこに行くか考える
            #print(j, len(yoko))
            # 左に行く横棒がある場合
            if j != 0 and  yoko[j-1] == "1":
                dp[i+1][j-1] += dp[i][j]
                dp[i+1][j-1] = dp[i+1][j-1] % MOD

            # 右に行く横棒がある場合
            
            elif j != W-1 and yoko[j] == "1":
                dp[i+1][j+1] += dp[i][j]
                dp[i+1][j+1] = dp[i+1][j+1] % MOD

            # そのまま降りる（横棒がない）場合
            else:
                dp[i+1][j] += dp[i][j]
                dp[i+1][j] = dp[i+1][j] % MOD


print(dp[-1][K-1])

Measured memory_bytes: 3064
h,w = map(int, input().split())

b = [0]*26

for i in range(h):
    a=input()
    for j in range(w):
        b[ord(a[j])-97]+=1

c = [0]*4
for i in range(len(b)):
    c[b[i] % 4] += 1

d = 1

if h%2==1 and w%2==1:
    if c[1]+c[3]!=1:
        d = 0
    elif c[2]+c[3]>h//2+w//2:
        d = 0
elif h%2==1:
    if c[1]+c[3]>0:
        d = 0
    elif c[2]>w//2:
        d = 0
elif w%2==1:
    if c[1]+c[3]>0:
        d = 0
    elif c[2]>h//2:
        d = 0
else:
    if c[1]+c[2]+c[3]>0:
        d = 0
print('Yes' if d else 'No')

Measured memory_bytes: 38896
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int g[11][5];
bool used[11][5];
int main(){
    int h;
    while(cin>>h,h){
        int s=0;
        rep(i,h)rep(j,5) cin>>g[i][j];
        while(1){
            bool update=false;
            rep(i,h){
                int cnt=1;
                FOR(j,1,5){
                    if(g[i][j]!=0&&g[i][j]==g[i][j-1]) ++cnt;
                    else{
                        if(cnt>=3){
                            s+=g[i][j-1]*cnt,update=true;
                            rep(k,cnt) g[i][j-1-k]=0;
                        }
                        cnt=1;
                    }
                }
                if(cnt>=3){
                    s+=g[i][4]*cnt,update=true;
                    rep(k,cnt) g[i][4-k]=0;
                }
            }
            if(!update) break;
            rep(j,5){
                int cnt=0;
                rep(i,h){
                    if(g[h-i-1][j]!=0){
                        swap(g[h-cnt-1][j],g[h-i-1][j]);
                        ++cnt;
                    }
                }
            }
        }
        cout<<s<<endl;
    }
    return 0;
}


Measured memory_bytes: 3088
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {
        x:usize,y:usize,
    }
    let mut now = x;
    let mut cnt = 1;
    while (now << 1) <= y {
        now <<= 1;
        cnt += 1;
    }
    println!("{}", cnt);
}


Measured memory_bytes: 2096
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using Int = int64_t;
using P = pair<Int, Int>;
const Int INF = 1<<30;
const Int MOD = (Int)1e9 + 7;
const Int MAX_N = (Int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
#define debug2(x, y) cout << #x << ": " << x << ", " << #y << ": " << y << endl;
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    Int a, b, c, d;
    cin >> a >> b >> c >> d;
    Int ans = b * d;
    ans = max(ans, b * c);
    ans = max(ans, a * c);
    ans = max(ans, a * d);
    cout << ans << endl;
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 3660
//Author - Rahil Malhotra
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int32_t main() {
    IOS;
    int n, k;
    cin >> n >> k;
    int arr[n], brr[n];
    for(int i = 0 ; i < n; i++) {
        cin >> arr[i];
    }
    for(int i = 0 ; i < n; i++) {
        cin >> brr[i];
    }

    sort(arr, arr + n);
    sort(brr, brr + n);

    int low = 0 ;
    int high = 1e16;
    while(low < high) {
        int mid = (low + high) / 2;

        int kk = k;
        for(int i = 0 ; i < n; i++) {
            int mul = arr[i] * brr[n - i -1];
            if(mul <= mid) {
                continue;
            }
            int reduceto = mid / brr[n - i - 1];
            kk -= (arr[i] - reduceto);
        }

        if(kk < 0) {
            low = mid + 1;
        } else {
            high = mid;
        }
    }
    print(low);
}   



Measured memory_bytes: 6692
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;
//DP用
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;
}
const long long INF = 1LL << 60;

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



Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int n  = sc.nextInt();
        int [] heap_list = new int [n+1];
        for(int i=1;i<=n;i++) heap_list[i] = sc.nextInt();
        for(int i=1;i<=n;i++){
            StringBuilder s = new StringBuilder();
            s.append("node "+i+": key = "+heap_list[i]+", ");
            if(i/2>0) s.append("parent key = "+heap_list[i/2]+", ");
            if(i*2<=n) s.append("left key = "+heap_list[i*2]+", ");
            if(i*2+1<=n) s.append("right key = "+heap_list[i*2+1]+", ");
            System.out.println(s);
        }
    }
}


Measured memory_bytes: 27692
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back
#define ll long long
using namespace std;
template<class T, class T1> int chkmin(T &x, const T1 &y) { return x > y ? x = y, 1 : 0; }
template<class T, class T1> int chkmax(T &x, const T1 &y) { return x < y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n , k, s= 0;
	cin>>n>>k;
	ll arr[n];
	for(int i = 0;i<n;i++)
	{
	    cin>>arr[i];
	}
	sort(arr,arr+n);
	for(int i = n-k;i<n;i++)
	{
	    s = s+arr[i];
	}
	cout<<s;
	return 0;
}

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

int main() {
    int N; cin >> N;
    vector<long long> sum(N + 1, 0);
    for(int i=1; i<=N; ++i) {
        int a; cin >> a;
        sum[i] = sum[i - 1] + a;
    }

    map<long long, int> cnt;
    cnt[0] = 1;
    long long res = 0;
    for(int i=1; i<=N; ++i) {
        res += cnt[sum[i]];
        cnt[sum[i]] += 1;
    }
    cout << res << '\n';
}

Measured memory_bytes: 14336
program abc110c
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: l,i, ci, ti
    integer(int32):: cnts(ichar('a'):ichar('z'))=0, cntt(ichar('a'):ichar('z'))=0
    character(200000):: s,t

    read*, s
    read*, t
    l = len_trim(s)

    do i=1,l
        ci = ichar(s(i:i))
        cnts(ci) = cnts(ci) + 1
        ti = ichar(t(i:i))
        cntt(ti) = cntt(ti) + 1
    end do

    call merge_sort(cnts,1,ichar('z')-ichar('a')+1)
    call merge_sort(cntt,1,ichar('z')-ichar('a')+1)

    do i=ichar('a'),ichar('z')
        if (cntt(i) /= cnts(i)) then
            print'(a)', 'No'
            stop
        end if
    end do

    print'(a)', 'Yes'

contains
    recursive subroutine merge_sort(ar, fst, lst)
        integer(int32),intent(inout):: ar(:)
        integer(int32),intent(in):: fst,lst
        integer(int32):: mdl

        if (lst-fst < 2) then
            if (ar(fst) > ar(lst)) call swap(ar(fst),ar(lst))
            return
        end if

        mdl = (fst+lst)/2
        call merge_sort(ar, fst, mdl)
        call merge_sort(ar, mdl+1, lst)
        call merge_(ar, fst, mdl, lst)
    end subroutine

    subroutine merge_(ar, fst, mdl, lst)
        integer(int32),intent(inout):: ar(:)
        integer(int32),intent(in):: fst, mdl, lst
        integer(int32),allocatable:: tmp(:)
        integer(int32):: li, ri, ti

        allocate(tmp(lst-fst+1))

        li=fst
        ri=mdl+1   
        ti=1

        do while (li <= mdl .and. ri <= lst)
            if (ar(li) <= ar(ri)) then
                tmp(ti) = ar(li)
                li=li+1
            else
                tmp(ti) = ar(ri)
                ri=ri+1
            end if
            ti=ti+1
        end do

        if (li <= mdl) then
            tmp(ti:) = ar(li:mdl)
        else
            tmp(ti:) = ar(ri:lst)
        end if

        ar(fst:lst) = tmp(:)
        deallocate(tmp)
    end subroutine

    subroutine swap(x,y)
        integer(int32),intent(inout):: x,y
        integer(int32):: tmp
        tmp = x
        x = y
        y = tmp
    end subroutine
end program abc110c

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

// #include <atcoder/all>

// #LIB#

using namespace std;
// using namespace atcoder;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#ifdef ONLINE_JUDGE
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');
#endif

int main() {
  ll l;
  cin >> l;
  vector<tuple<ll, ll, ll>> edges;
  ll gn = 1;
  while (l >= 2) {
    if (l & 1) {
      edges.emplace_back(gn, -1, l - 1);
      --l;
    }
    edges.emplace_back(gn, gn + 1, 0);
    edges.emplace_back(gn, gn + 1, l / 2);
    ++gn;
    l /= 2;
  }
  cout << gn << " " << edges.size() << endl;
  itr(e,edges){
    auto [ea, eb, ec] = e;
    cout << ea << " " << (eb == -1 ? gn : eb) << " " << ec << endl;
  }
}


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

int main(){
  int n;
  string s,t,u;
  cin >>n >>s;
  bool can = false;
  if(s.size()%2 == 0){
    rep(i,s.size()/2){
      t += s[i];
    }
    for(int i = s.size()/2; i<s.size(); i++){
      u += s[i];
    }
    if(t==u) can = true;
  }
  if(can) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = input().rstrip()
T = 'AKIHABARA'

def test(S,T):
    if len(T) == 0:
        return len(S) == 0
    if len(S) == 0:
        S += 'A'
    if S[0] == T[0]:
        return test(S[1:],T[1:])
    if T[0] != 'A':
        return False
    return test(S,T[1:])

bl = test(S,T)

answer = 'YES' if bl else 'NO'
print(answer)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
int main() {
    int N, K;
    int V[50];
    cin >> N >> K;
    for (int i=0; i<N; i++) cin >> V[i];

    // get Kl from left, Kr from right, remove Kx
    // Kl+Kr <= K
    int maxscore = 0;
    for (int Kl=0; Kl<=K; Kl++) {
        for (int Kr=0; Kr<=K; Kr++) {
            if (Kl + Kr > N) continue;
            if (Kl + Kr > K) continue;
            vector<int> item;
            int score = 0;
            for (int li=0; li<Kl; li++) {
                item.push_back(V[li]);
                score += V[li];
            }
            for (int ri=0; ri<Kr; ri++) {
                item.push_back(V[N-ri-1]);
                score += V[N-ri-1];
            }
            int turn = (K - Kl - Kr);
            // remove Kx
            sort(item.begin(), item.end());
            auto ite = item.begin();
            for (int t=0; t<turn && ite != item.end(); t++, ite++) {
                if (*ite < 0) score -= *ite;
                else break;
            }
            
            if (score > maxscore) maxscore = score;
        }
    }
                        
    cout << maxscore << endl;
        
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if(a == 5 && b == 5 && c == 7 ){ 
		printf("YES\n");
	}
	else  if(a == 5 && b == 7 && c == 5 ){ 
			printf("YES\n");
	}
	else if(a == 7 && b == 5 && c == 5 ){ 
				printf("YES\n");
	}
	else printf("NO\n");
	return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string a = sc.Next();

        string answer = a == string.Join("", a.Reverse()) ? "Yes" : "No";

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13268
#include <stdio.h>

int main()
{
	int n;
	float v,t,y;
	while(scanf("%f",&v)!=EOF){
	t=v/9.8;
	y=4.9*t*t;
	for(n=1;;n++)if((5*n-5)>=y)break;
	printf("%d\n",n); 
	}
	return 0;
}

Measured memory_bytes: 624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			if(String.valueOf(i).length()%2 == 1) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 26580
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.function.Consumer;

public class Main {
    private static final Scanner scanner = new Scanner(System.in);
    private static final Consumer<List<String>> consumer = solve();

    public static void main(String[] args) {
        consumer.accept(readInput());
    }

    private static List<String> readInput() {
        final List<String> lineList = new ArrayList<>();
        while (scanner.hasNextLine()) {
            lineList.add(scanner.nextLine());
        }
        return lineList;
    }

    private static Consumer<List<String>> solve() {
        return args -> {
            int a = Integer.valueOf(args.get(0).split(" ")[0]);
            int b = Integer.valueOf(args.get(0).split(" ")[1]);
            System.out.println(a >= b ? "10" : "0");
        };
    }

}


Measured memory_bytes: 26836
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();

        if(A>=13){
            System.out.println(B);
        }
        else if(A<=12 && A>=6){
            System.out.println(B/2);
        }
        else if(A<=5){
            System.out.println(0);
        }
    }
}

Measured memory_bytes: 21716
package main

import "fmt"

func main() {
	var r, D, x2k, xi, xi1 int
	fmt.Scan(&r, &D, &x2k)
	xi = x2k
	for i := 0; i < 10; i++ {
		xi1 = r*xi - D
		fmt.Println(xi1)
		xi = xi1

	}
}


Measured memory_bytes: 512
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let v = read_vec::<i64>();
    let (d, x) = (v[0], v[1]);
    let mut ans = x;
    for _ in 0..n {
        let a = read::<i64>();
        let mut day = 1;
        for i in 1..d + 1 {
            if i == day {
                ans += 1;
                day += a;
            }
        }
        debug!(ans);
    }

    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
n = int(input())
s = input()
r, g, b = 0, 0, 0
for c in s:
    if c == "R": r += 1
    elif c == "G": g += 1
    else: b += 1

ans = r * g * b
for i in range(n-1):
    for j in range(i+1, n):
        k = j + j-i
        if k >= n: continue
        if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]: ans -= 1

print(ans)

Measured memory_bytes: 9208
#!/usr/bin/python3
import copy

(n, m, x) = map(int, input().split())

b = []
for i in range(n):
    b.append(tuple(map(int, input().split())))


bss = [[ 0 for i in range(m + 1)]]
mc = -1

for i in range(n):
    nbss = copy.copy(bss)
    for bs in bss:
        #print(bs, b[i])
        nbs = list(map(lambda x, y: x + y, bs, b[i]))
        for j in range(1, m + 1):
            if nbs[j] < x:
                nbss.append(nbs)
                break
        else:
            if mc < 0:
                mc = nbs[0]
            else:
                mc = min(mc, nbs[0])
                
    bss = nbss

print(mc)


Measured memory_bytes: 70136
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string.h>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;
typedef unsigned long long ull;
typedef  long long ll;
#define INF  1e9
#define M 2000002
#define N 10100
const ll mod = 1e9+7;
ll ans,x,y,a[N];
string s;
int main(void){
	cin>>s;
	ll n= s.length();
	x = 0;y=1;
	a[x]++;
	for(ll i =n-1;i>=0;i--){
		x =(x+(s[i]-'0')*y)%2019;
		y =y*10%2019;
		a[x]++;
	}
	for(ll i = 0;i < 2019;i++){
		ans +=a[i]*(a[i]-1)/2;
	}
	cout<<ans<<endl;
	return 0;
}


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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef map<int,int> mii;

const int MOD = 1e9+7;

void solve () {
	int n,u,v;
	cin >> n;
	ll ans = 0;
	for (int i = 1;i <= n;++i) {
		ans += (ll)i*(n-i+1);
	}
	for (int i = 1;i <= n-1;++i) {
		cin >> u >> v;
		ans -= (ll)min(u,v)*(n-max(u,v)+1);
	}
	cout << ans << '\n';
}

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



Measured memory_bytes: 3664
/*input 
3 4 10 40
*/


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

 
 
#define int long long int
#define rep(i,n) \
    for(int i = 0; i < n; i++)
#define rep2(i, a, b) \
    for(int i = a; i < b; i++)
#define all(c) \
    c.begin(), c.end()
#define init(arr, num) \
    memset(arr, num, sizeof(arr))

#define fast\
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inputFile \
    freopen("input.txt", "r", stdin); 
#define outputFile \
    freopen("output.txt", "w", stdout);
#define modM 998244353
#define PI 3.1415926535897932
#define F first
#define S second  
#define pb push_back  
 
#ifdef gaviria
#define TRACE
#endif
#ifdef TRACE
#define trace(...) _f(#VA_ARGS, __VA_ARGS_)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std::endl;
 
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int, int > ii;
typedef unordered_set<int> usi;
 
ll n,i,j,k,m,x,c;
int a, k1;



void solve() 
{double a,b,h,m;
    cin>>a>>b>>h>>m;

    long double angle1=(m/60)* (2*M_PI);

    long double angle2=(h/12)* (2*M_PI)+(m/60)*(2*M_PI)/12;
    long double val=abs(angle2-angle1);
    
   

    cout<<fixed<<setprecision(10)<<sqrt(a*a+b*b-2*a*b*cos(val));

} 

 
 
 
signed main()
{
 
    // inputFile;
    fast;
    int T = 1;
//cin >> T;

    while(T--){
//cout<<"Case #"<<(h-T)<<": ";
        solve();
cout<<endl;
     
        
        
 
    }
    
    
    return 0;
 
}


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

int main()
{
	int A;
	cin >> A;
	string op;
	cin >> op;
	int B;
	cin >> B;
	if (op == "+")
	{
		cout << A + B << endl;
	}
	else if (op == "-")
	{
		cout << A - B << endl;
	}
	else
	{
		cout << "Eror" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
//combination(Nが小さい時はこれを使う)
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight(int n) {
	int ans = 1;
	while (n >= 10) {
		n /= 10;
		ans++;
	}
	return ans;
}
int dight_sum(int n) {
	int sum = 0;
	rep(i, 20)sum += (n % (int)pow(10, i + 1)) / (pow(10, i));
	return sum;
}
signed main() {
	string s, t;
	cin >> s >> t;
	int ans = 0;
	rep(i, 3) {
		if (s[i] == t[i])ans++;
	}
	cout << ans << endl;
	ggr
}


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

int main() {

  int H, W;
  // scanf("%d%d", &H, &W);
  double tmp;
  //int a,b;
  long long int ans;
  long long int N, M, X, Y, Z;
  long long int x[10000] = {0};
  long long int y[10000] = {0};
  int out = -1;
  int flag_A = -1;
  int flag_B = -1;
  scanf("%lld%lld%lld%lld", &N, &M, &X, &Y);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &x[i]);
  }
  for (int i = 0; i < M; i++) {
    scanf("%lld", &y[i]);
  }

  for (Z = X+1; Z <= Y; Z++) {
    flag_A = flag_B = 0;
    for (int i = 0; i < N; i++) {
      if (x[i] >= Z) {
        flag_A = -1;
      }
      else {
        ;
      }
    }

    for (int i = 0; i < M; i++) {
      if (y[i] < Z) {
        flag_B = -1;
      }
      else {
        ;
      }
    }
    //printf("%d:", Z);
    //printf("%d, %d\n", flag_A, flag_B);
    if (flag_A == 0 && flag_B == 0) {
      out = 0;
      break;
    }

  }
  if (out == -1) {
    puts("War");
  }
  else {
    puts("No War");
  }
  
  // long long int a, b, c;
  // long long int d, e, f;

  // scanf("%lld%lld%lld", &a, &b, &c);
  // d = (10*a) + b + c;
  // e = (10*b) + c + a;
  // f = (10*c) + b + a;
  // long long int t[3];
  // t[0] = d;
  // t[1] = e;
  // t[2] = f;
  
  // qsort(t, 3, sizeof(long long int), compare_int);
  // printf("%lld\n", t[2]);
  // if (d > e) {
  //   printf("%lld\n", d);
  // }
  // else {
  //   printf("%lld\n", e);

  // }    
  
  // if (H>W) {
  //   int tmm;
  //   tmm = W;
  //   H = tmm;
  //   W = H;
  // }

  
  // tmp = (double)((double)W / 3);
  // if (int(tmp - 0.5) == (int)tmp) {
  //   a = (int)tmp + 1;
  // }
  // else {
  //   a = (int)tmp;
  // }
  
  // b = (H / 2);
  // long long int S[3];
  
  // // printf("a = %d,, b = %d\n",a,b);
  // // printf("aa");
  // S[0] = (long long int)H * (long long int)a;
  // S[1] = (long long int)b * (long long int)(W - a);
  // S[2] = (long long int)(H - b) *(long long int) (W - a);

  // for (int i = 0; i < 3; i++) {
  //   // printf("S[%d] = %lld\n", i, S[i]);
  // }

  // qsort(S, 3, sizeof(long long int), compare_int);
  // for (int i = 0; i < 3; i++) {
  //    // printf("S[%d] = %lld\n", i, S[i]);
  // }

  // ans = S[2] - S[0];

  // if (W % 3 == 0 || H % 3 == 0) {
  //   ans = 0;
  // }
  // printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
int bp(int pow, int n){
    int d = 1;
    while(n)
    {
        if(n%2==1)d=(d*pow)%mod;
        pow=(pow*pow)%mod;
        n/=2;
    }
    return d;
}
void solve(){
    int n;
    cin>>n;
    cout<<fixed<<setprecision(2)<<2*n*pi;   
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
int frog[100005];
int main()
{
  int n;
  int h[100005];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  frog[0]=0;
  frog[1]=abs(h[0]-h[1]);
  for(int i=2;i<n;i++){
    frog[i]=min(abs(h[i]-h[i-1])+frog[i-1],abs(h[i]-h[i-2])+frog[i-2]);
  }
  cout<<frog[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 1024
H, W, K = map(int,input().split())
S = []
ans = [["" for _ in range(W)] for __ in range(H)]
checkBerry = []
cake = 1
for i in range(H):
    s = input()
    S.append(s)
    flag = False
    for ss in s:
        if ss == "#":
            flag = True
    checkBerry.append(flag)

LS = []
n = 0
lss = []
while(n < H):
    lss.append(n)
    if (checkBerry[n] == True):
        LS.append(lss.copy())
        lss = []
    n += 1

if lss != []:
    LS[-1].extend(lss)

for ls in LS:
    i = 0
    for l in ls:
        if checkBerry[l] == True:
            i = l
    firstBerry = False
    for j in range(W):
        if(S[i][j] == "#" and firstBerry == False):
            firstBerry = True
        elif(S[i][j] == "#" and firstBerry == True):
            cake += 1

        for l in ls:
            ans[l][j] = str(cake)
    cake += 1


for a in ans:
    print(" ".join(a))






Measured memory_bytes: 9332
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    al = list(map(int, input().split()))
    ans = 10**15
    for i in range(-100,101):
        y = i
        cost = 0
        for x in al:
            cost += (x - y) ** 2
        ans = min(ans, cost)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39792