akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i <= n; i++)
#define RREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define RREP1(i, n) for (ll i = n; i >= 1; i--)
#define FOR(i, a, b, c) for (ll i = a; i <= b; i += c)
#define RFOR(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define MAX(a, b) (a > b ? a : b)
#define MIN(a, b) (a < b ? a : b)
#define SORT(t, a, n) qsort(a, n, sizeof(t), ({ int _f (const void *_a, const void *_b) { return *(t *)_a - *(t *)_b; } _f; }))
#define RSORT(t, a, n) qsort(a, n, sizeof(t), ({ int _f (const void *_a, const void *_b) { return *(t *)_b - *(t *)_a; } _f; }))
#define SUM(a, n) ({ ll _s = 0; REP(_i, n) _s += a[_i]; _s; })
#define CNT(x, a, n) ({ ll _c = 0; REP(_i, n) if (a[_i] == x) _c++; _c; })
#define MAXM(t, a, n) ({ t _m = a[0]; REP(_i, n) _m = MAX(_m, a[_i]); _m; })
#define MINM(t, a, n) ({ t _m = a[0]; REP(_i, n) _m = MIN(_m, a[_i]); _m; })
#define INF 1145141919
typedef long long ll;

int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    
    if (c >= a && c <= b) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int X, Y, Z;
  cin >> X >> Y >> Z;
  cout << (X - Z) / (Y + Z) << endl;
}
  

Measured memory_bytes: 3592
N, Q = map(int, input().split())
S = str(input())
wa=[0]*N
p=0
for j in range(1,N):
    if S[j-1]=="A" and S[j]=="C":
        p+=1
        wa[j]=p
    else:
        wa[j]=wa[j-1]
for i in range(Q):
    k =input().split()
    l=int(k[0])
    r=int(k[1])
    print(wa[r-1]-wa[l-1])

Measured memory_bytes: 6084
#include <bits/stdc++.h>
#define MAXN 10010
using namespace std;

int n, a, ans;

int main() {
	scanf("%d", &n);
	for (register int i = 1; i <= n; ++i) {
		scanf("%d", &a);
		while (!(a & 1)) {
			++ans;
			a >>= 1;
		}
	}
	printf("%d", ans);
	return 0;
} 

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

int main()
{
	string n;
	int count = 0;

	cin >> n;
	for (int i = 0; i < 3; i++)
	{
		if (n[i] == '1')
			count++;
	}

	cout << count << endl;

	return 0;
}

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

const int INF = 1 << 30;
int S[500000];

int merge(int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	vector<int> L(n1+1), R(n2+1);
	for (int i = 0; i < n1; i++) L[i] = S[left+i];
	for (int i = 0; i < n2; i++) R[i] = S[mid+i];
	L[n1] = INF;
	R[n2] = INF;
	int i = 0, j = 0;
	for (int k = left; k <= right-1; k++) {
		if (L[i] <= R[j]) {
			S[k] = L[i];
			i++;
		}
		else {
			S[k] = R[j];
			j++;
		}
	}
	return right - left;
}

int mergeSort(int left, int right) {
	if (left + 1 >= right) return 0;
	int mid = (left + right) / 2;
	int ans = 0;
	ans += mergeSort(left, mid);
	ans += mergeSort(mid, right);
	ans += merge(left, mid, right);
	return ans;
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> S[i];
	int ans = mergeSort(0, n);

	cout << S[0];
	for (int i = 1; i < n; i++) cout << ' ' << S[i];
	cout << endl << ans << endl;
}



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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define SORT(v) sort(ALL(v))
//#define scanf scanf_s
typedef pair<int, int> P;

int n, m, p;

int main()
{
	while (cin >> n >> m >> p, n)
	{
		int cnt = 0;
		m--;
		int bet;
		int atari;
		REP(i, n)
		{
			cin >> bet;
			cnt += bet;
			if (i == m) atari = bet;
		}
		int pool = cnt * (100-p);
		if (atari == 0) cout << 0 << endl;
		else cout << pool / atari << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const int MOD = 1000000007;
ll cnt =0,ans=0;
bool graph[8][8];

 int main(){
     int n,k;
     cin >> n >> k;

     priority_queue<int,vector<int>,greater<int>> p;
     int a;
     for(int i=0;i<n;i++){
         cin >> a;
         p.push(a);
     }
     for(int i=0;i<k;i++){
         ans+=p.top();
         p.pop();
     }
     cout << ans << endl;
     
    }

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

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

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

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


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

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (k == 0) return 1;
	return n * COM(n - 1, k - 1) / k;
}

int main(){
    int n,p;
    cin >> n >> p;
    VI a(n);
    rep(i,n) cin >> a[i];
    int even = 0, odd = 0;
    rep(i,n){
        if(a[i] % 2 == 0) even++;
        else odd++;
    }
    ll evenSum = 0;
    for(int i = 0; i <= odd; i+= 2){
        evenSum += COM(odd,i)*(1LL<<even);
    }
    if(p == 0){
        cout << evenSum << endl;
    }else{
        cout << (1LL<<n) - evenSum << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
typedef long long ll;
typedef long double f80;
 
// #define int long long
#define pii pair<int,int>
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ef emplace_front
#ifndef LOCAL
#define endl '\n'
#endif

const int mod = 1e9 + 7;

ll pwr(ll a, ll b) {
    ll ans = 1;
    while(b) {
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

const int N = 2e5 + 5;
set<int> b[N][2];
int comp[N][2];
bool vis[N];
vector<pii> g[N];

map<pii,int> m;

void dfs(int u,int k,int c) {
    vis[u] = 1;
    comp[u][k] = c;
    b[c][k].insert(u);
    for(pii v : g[u]) {
        if(!vis[v.fi] && v.se == k) {
            dfs(v.fi, k, c);
        }
    }
}

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    #ifdef LOCAL
        freopen("inp.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    int n, k, l;
    cin >> n >> k >> l;
    fr(i, 1, k) {
        int u, v;
        cin >> u >> v;
        g[u].pb({v, 0});
        g[v].pb({u, 0});
    }
    fr(i ,1, l) {
        int u, v;
        cin >> u >> v;
        g[u].pb({v, 1});
        g[v].pb({u, 1});
    }
    fill(vis + 1, vis + n + 1, 0);
    int c = 0;
    fr(i, 1, n) {
        if(!vis[i]) {
            c++;
            dfs(i, 0, c);
        }
    }
    fill(vis + 1, vis + n + 1, 0);
    c = 0;
    fr(i, 1, n) {
        if(!vis[i]) {
            c++;
            dfs(i, 1, c);
        }
    }
    fr(i, 1, n) {
        m[{comp[i][0], comp[i][1]}]++;
    }
    fr(i, 1, n) {
        cout << m[{comp[i][0], comp[i][1]}] << " ";
    }
    return 0;
}

Measured memory_bytes: 60928
N = int(input())


def dfs(s):
    if int(s) > N:
        return 0

    ret = 1 if all(s.count(c) > 0 for c in '753') else 0  # s自体が753数なら+1
    for c in '753':
        ret += dfs(s + c)
    return ret


print(dfs('0'))


Measured memory_bytes: 3316
// AOJ 0184: Tsuruga Castle
// 2017.8.2 bal4u@uu
// 2017.11.12

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char buf[10];
int cnt[7];
int tr['9'+1]['9'+1]['9'+1];

void init()
{
	int n1, n2, n3;
	
	// age >= 100
	n1 = '1'; for (n2 = '0'; n2 <= '9'; n2++) for (n3 = '0'; n3 <= '9'; n3++)
		tr[n1][n2][n3] = 6;

	// age < 10
	n3 = 0; for (n1 = '0'; n1 <= '9'; n1++) for (n2 = 0; n2 < ' '; n2++) tr[n1][n2][n3] = 0;

	// 10 <= age < 100
	for (n1 = 1; n1 <= 9; n1++) for (n2 = '0'; n2 <= '9'; n2++) {
		for (n3 = 0; n3 < ' '; n3++) tr[n1+'0'][n2][n3] = (n1 <= 6) ? n1 : 6; 
	}
}

int main()
{
	register int n;

	init();	
	while (fgets(buf, 10, stdin) && *buf != '0') {
		memset(cnt, 0, sizeof(cnt));

		n = atoi(buf);
		while (n--) {
			buf[2] = 0, fgets(buf, 10, stdin);
			cnt[tr[buf[0]][buf[1]][buf[2]]]++;
		}

		for (n = 0; n < 7; n++) printf("%d\n", cnt[n]);
	}
	return 0;
}

Measured memory_bytes: 1772
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<vector>
using namespace std;

int main()
{
	int i,N,H,P;
	cin>>H>>N;
	vector<int> A(N);
	P=0;
	for(i=0;i<N;i++){
		cin >> A[i];
		P+=A[i];
	}
	
	if(P>=H){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 640
// 入力関数
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()
}

use std::cmp;
// 以下main
fn main() {
    let s: String = read();

    let n = s.len();
    let s0 = &s.replace("1", "");
    let n0 = s0.len();

    println!("{}", 2 * cmp::min(n0, n - n0));
}


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

long long gcd(long long a, long long b)
{
    long long x=a % b;
    while(x)
    {
        a=b;
        b=x;
        x=a % b;
    }
    return b;
}
int main()
{
    int n;
    scanf("%d", &n);
    long long a[105], ans;
    for(int i = 0; i < n; ++i)
    {
        scanf("%lld", &a[i]);
    }
    ans = a[0];
    for(int i = 1; i < n; ++i)
    {
        ans = ans  / gcd(ans, a[i]) * a[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const int INF = 1e9+1;


int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int res = 1;
    for (int i = 0; i < N; i++) {
        if (i == N-1) break;
        if (S[i+1] != S[i]) res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 512
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
long long A[110000];
long long B[110000];
int main(){
	int a;scanf("%d",&a);

	for(int i=0;i<=a;i++){
		scanf("%lld",A+i);
	}
	for(int i=0;i<a;i++){
		scanf("%lld",B+i);
	}
	long long ret=0;
	for(int i=0;i<a;i++){
		long long L=min(A[i],B[i]);
		ret+=L;
		B[i]-=L;
		long long R=min(A[i+1],B[i]);
		ret+=R;
		A[i+1]-=R;
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int n, k;
    string s;
    cin >> n >> s >> k;
    k--;

    rep(i, n) {
        if(s[i] != s[k]) {
            s[i] = '*';
        }
    }

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    int N, A, B;
    cin >> N >> A >> B;
    int ans = 0;
    FOR(i, 1, N+1){
        int x = i;
        int tmp = 0;
        tmp += x%10;
        while(x /= 10) tmp += x%10;
        if(A <= tmp && tmp <= B) ans+=i;
    }

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

Measured memory_bytes: 256
<?php

define("MOD", 998244353);

while ($stdin = fgets(STDIN)) {
    $line[] = trim($stdin);
}
foreach ($line as $key => $value) {
    $data[] = explode(' ', $value);
}

foreach ($data as &$line) {
    $line = array_map(function($val) { return (int)$val; }, $line);
}

$N = $data[0][0];
$M = $data[0][1];

$counts = array_fill(1, $N , 1);
$statuses = array_fill(2, $N - 1 , false);
$statuses[1] = true;
/*
* POSSIBLE
* NOTHING
*/

for ($i = 1; $i <= $M; $i++) {
    $opes[$i - 1] = $data[$i];
}


foreach ($opes as $ope) {
    $from = $ope[0];
    $to = $ope[1];

    $counts[$from]--;
    $counts[$to]++;

    if ($statuses[$from]) {
        $statuses[$to] = true;
    }

    if ($counts[$from] === 0) {
        $statuses[$from] = false;
    }

}

$ans = count(array_filter($statuses, function($status) { return $status; }));
printf('%d', $ans);


Measured memory_bytes: 78696
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(p,a,b)    for(int p=a;p<b;p++)
#define INF 0x3f3f3f3f
#define mul(x) x*x*(x-=1)


int main() {
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("o2.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll n,m,x,i,j,temp,k,ans=INF,curr,flag;
    cin>>n>>m>>x;

    vector< vector<ll> > a(n,vector<ll>(m));
    vector<int> c(n);
    for(i=0 ; i<n ; i++)
    {
        cin>>c[i];
        for(j=0 ; j<m ; j++)cin>>a[i][j];
    }

    for(i=0 ; i<(1<<n) ; i++)
    {
        temp=i;
        curr=0;
        vector<ll> strength(m);

        for(j=0 ; j<=n ; j++)
        {
            if((temp & (1<<j)))
            {
                curr += c[j];
                for(k=0 ; k<m ; k++)strength[k] += a[j][k];
            }
        }

        flag=1;
        for(k=0 ; k<m ; k++)if(strength[k]<x){flag=0;break;}

        if(flag)ans = min(ans,curr);
    }

    if(ans==INF)cout<<"-1";
    else cout<<ans;
    
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <array>
#include <vector>

using namespace std;

int main() {
  int t;
  cin >> t;
  for ( int i = 0; i < t; i++ ) {
	int n;
	cin >> n;
	int down = 0;
	int up = 0;
	int cur;
	cin >> cur;
	for ( int i = 0; i < n - 1; i++ ) {
	  int val;
	  cin >> val;
	  if ( cur > val ) {
		down = max( down, cur - val );
	  } else {
		up = max( up, val - cur );
	  }
	  cur = val;
	}
	cout << up << " " << down << endl;
  }
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdlib>
#include <cmath>

const int ms = 100100;

int a[ms];
long long cost[ms];

int main() {
	int n;
	std::cin >> n;
	for(int i = 1; i <= n; i++) {
		std::cin >> a[i];
		cost[i] = cost[i - 1] + abs(a[i] - a[i - 1]);
	}
	cost[n + 1] = cost[n] + abs(a[n]);
	for(int i = 1; i <= n; i++) {
		std::cout << cost[n + 1] - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1]) << '\n';
	}
}

Measured memory_bytes: 2432
n = int(input())
A = list(map(int,input().split()))

num = [0]*(10**6+1)
for a in A:
    num[a] += 1

bai = [False]*(10**6+1)
cnt = 0
A = list(set(A))
A.sort()
for a in A:
    if bai[a]:
        continue

    if num[a] == 1:
        cnt += 1

    for i in range(a, 10**6+1, a):
        bai[i] = True
print(cnt)

Measured memory_bytes: 47812
#include <iostream>
using namespace std;
int main() {
    int n, m; cin >> n >> m;
    const long long M = (long long)1e9 + 7;
    long long xsum = 0, ysum = 0, xans = 0, yans = 0;
    for (int i = 0; i < n; i++) {
        long long x; cin >> x;
        xans = (xans + x * i - xsum) % M;
        xsum = (xsum + x) % M;
    }
    for (int i = 0; i < m; i++) {
        long long x; cin >> x;
        yans = (yans + x * i - ysum) % M;
        ysum = (ysum + x) % M;
    }
    cout << xans * yans % M << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
int N;
int a[MAX_N];

bool judge(){

    int c = a[0];
    int n;
    if(a[N-1] == c) return (N >= 2 * c) || (N == c+1);
    if(a[N-1] != c+1) return false;
    rep(i, N){
        if(a[i] == c+1){n = i; break;}
    }

    int c2 = c + 1 - n;
    if(c2 <= 0) return false;
    return (N - n) >= c2 * 2;

}

int main() {
    cin >> N;
    rep(i, N){cin >> a[i];}
    sort(&a[0], &a[N]);

    cout << (judge() ? "Yes" : "No") << endl;
}

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

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

using ll = long long int;
const ll MOD = 1e9 + 7;

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

  ll ans = 1;
  ll T = 1000000000000000000LL;
  bool over = false;
  rep(i, N) {
    ll A;
    std::cin >> A;
    if(A == 0) {
      std::cout << 0 << '\n';
      return 0;
    }

    if(ans <= 0 || A > T / ans) {
      over = true;
    }
    ans *= A;
  }

  std::cout << (over ? -1LL : ans) << '\n';
}


Measured memory_bytes: 3632
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W, x, y, z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;

int main() {
	double r;
	cin >> r;
	cout << r * 2 * 3.1415926535;
}

Measured memory_bytes: 3784
count p  = length . filter p

rInt :: String -> Int
rInt str = read str :: Int

main :: IO ()
main = do
    s <- map read . words <$> getLine
    let five = count (\ x -> x == 5) s
    let seven = count (\ x -> x == 7) s
    if five == 2 && seven == 1 then
        putStrLn "YES"
    else
        putStrLn "NO"

Measured memory_bytes: 508
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;

#define PI 3.14159265358979323846264338327950L

string res = "Yes";

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

    int A, B;
    string S;
    cin >> A >> B >> S;
    for (int i = 0; i < A; i++)
    {
        if (
            S[i] != '1' &&
            S[i] != '2' &&
            S[i] != '3' &&
            S[i] != '4' &&
            S[i] != '5' &&
            S[i] != '6' &&
            S[i] != '7' &&
            S[i] != '8' &&
            S[i] != '9' &&
            S[i] != '0')
        {
            res = "No";
            break;
        }
    }
    if (S[A] != '-')
    {
        res = "No";
    }
    for (int i = 0; i < B; i++)
    {
        if (
            S[A + 1 + i] != '1' &&
            S[A + 1 + i] != '2' &&
            S[A + 1 + i] != '3' &&
            S[A + 1 + i] != '4' &&
            S[A + 1 + i] != '5' &&
            S[A + 1 + i] != '6' &&
            S[A + 1 + i] != '7' &&
            S[A + 1 + i] != '8' &&
            S[A + 1 + i] != '9' &&
            S[A + 1 + i] != '0')
        {
            res = "No";
            break;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#復習用
a, b, h, m = gets.split(" ").map(&:to_i)
rh = h * 30.0 + m * 0.5
rm = m * 6.0
r = (rh - rm).abs
r = 360 - r if r > 180.0
ans = (a ** 2) + (b ** 2) - (2 * a * b * Math.cos(r / 180 * Math::PI))
puts Math.sqrt(ans)

Measured memory_bytes: 14744
A=[]
for i in [0]*3:
    A+=list(map(int,input().split()))
N=int(input())
B=[0]*9
for i in range(N):
    i=int(input())
    if i in A:
        B[A.index(i)]=1
res=0
for i in range(3):
    res+=B[3*i]*B[3*i+1]*B[3*i+2]
    res+=B[i]*B[i+3]*B[i+6]
res+=B[0]*B[4]*B[8]+B[2]*B[4]*B[6]
print(['No','Yes'][res>0])

Measured memory_bytes: 3064
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;

procedure Solve is
   R : Integer;
begin
   Get (R);
   if R < 1200 then
      Put_Line ("ABC");
   elsif R < 2800 then
      Put_Line ("ARC");
   else
      Put_Line ("AGC");
   end if;
end Solve;

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

struct Dice{
  int dice[6];
  void roll(char c){
    int b;
    if(c == 'E'){
      b = dice[0];
      dice[0] = dice[3];
      dice[3] = dice[5];
      dice[5] = dice[2];
      dice[2] = b;
    }
    if(c == 'W'){
      b = dice[0];
      dice[0] = dice[2];
      dice[2] = dice[5];
      dice[5] = dice[3];
      dice[3] = b;
    }
    if(c == 'N'){
      b = dice[0];
      dice[0] = dice[1];
      dice[1] = dice[5];
      dice[5] = dice[4];
      dice[4] = b;
    }
    if(c == 'S'){
      b = dice[0];
      dice[0] = dice[4];
      dice[4] = dice[5];
      dice[5] = dice[1];
      dice[1] = b;
    }
    if(c == 'R'){
      b = dice[1];
      dice[1] = dice[2];
      dice[2] = dice[4];
      dice[4] = dice[3];
      dice[3] = b;
    }
  }
  int top() {
    return dice[0];
  }
  int right(){
    return dice[2];
  }
  int left(){
    return dice[3];
  }
  int front(){
    return dice[1];
  }
};
bool same(Dice a,Dice b){
  for(int i=0;i<6;i++){
    if(a.dice[i]!=b.dice[i]){
        return false;
    }
  }
  return true;
}

int main(){
  Dice d[2];
  for(int j = 0; j < 2; j++){
    for(int i = 0; i < 6; i++){
      cin >> d[j].dice[i];
    }
  }
  bool f = false;
  for(int i = 0; i < 4; i++){
    d[1].roll('R');
    for(int j = 0;j < 4;j++){
      d[1].roll('N');
      if(same(d[0],d[1])){
         f = true;
      }
    }
  }
  d[1].roll('E');
  for(int j = 0; j < 4; j++){
    d[1].roll('N');
    if(same(d[0],d[1])){
      f = true;
    } 
  }

  d[1].roll('W');
  d[1].roll('W');
  for(int j = 0; j < 4; j++){
    d[1].roll('N');
    if(same(d[0],d[1])){
      f=true;
    }
  }
  
  cout << (f?"Yes":"No") << endl;
  return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <string>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FFOR(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
#define RREP(i,b) FFOR(i,1,b)
#define PB push_back
#define F first
#define S second
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef LL ut;
typedef long double ld;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef vector<ut> VI;
typedef pair<ut,pr> ppr;
typedef priority_queue<pr,Vpr, greater<pr> > PQ;
const int SIZE=5+3*1e+4;
const ut INF=1<<30;
const ld eps=1e-6;
const LL p=7+1e+9;

int main(){
  int n, x, y, b, q;
  cin >> n;
  REP(i,n){
    cin >> x >> y >> b >> q;
    int sum = 0;
    if(b >= 5 && q >= 2){
      sum = x * b * 0.8 + y * q * 0.8;
    }
    else{
      sum = min(x * b + y * q, (int)(max(b, 5) * x * 0.8 + max(q, 2) * y * 0.8));
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 1160
package main

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

const size = 1000000
var reader = bufio.NewReaderSize(os.Stdin,size)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextInts() (int,int) {
  var x,y int
  var s []string = strings.Split(NextLine()," ")
  x,_ = strconv.Atoi(s[0])
  y,_ = strconv.Atoi(s[1])
  return x,y
}

func main() {
  var n,k int = NextInts()
  var x,y,px,py []int
  x = make([]int,n)
  y = make([]int,n)
  px = make([]int,n)
  py = make([]int,n)
  for i:=0;i<n;i++ {
    x[i],y[i] = NextInts()
    px[i],py[i] = x[i],y[i]
  }
  sort.Ints(x)
  sort.Ints(y)
  var m int64 = int64(x[n-1]-x[0])*int64(y[n-1]-y[0])
  for ib:=0;ib<n-1;ib++ {
    for it:=ib+1;it<n;it++ {
      for jb:=0;jb<n-1;jb++ {
        for jt:=jb+1;jt<n;jt++ {
          var c int
          for p:=0;p<n;p++ {
            if px[p] < x[ib] || x[it] < px[p] ||
            py[p] < y[jb] || y[jt] < py[p] { c++ }
            if c > n-k { break }
          }
          if c <= n-k {
            var t int64 = int64(x[it]-x[ib])*int64(y[jt]-y[jb])
            if m > t { m = t }
          }
        }
      }
    }
  }
  fmt.Println(m)
}

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

int main(){
  int n;
  string s;
  
  cin >> n >> s;
  
  rep(i, s.size()){
    s.at(i) += n;
    if((int)s.at(i) > (int)'Z') s.at(i) -= 26;
  
  }
  cout << s << endl;
}

Measured memory_bytes: 256
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

import string

def main():
    a  = string.ascii_lowercase
    s = s_input()
    for i in a:
        if i not in s:
            print(i)
            exit()
    print("None")


if __name__=="__main__":
    main()


Measured memory_bytes: 10028
// g++ A.cpp -Wall -Wextra -Woverflow -Wshadow -O2
#include <iostream>
#include <algorithm>
#include <utility>
#include <map>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <cmath>
#include <iomanip>
#include <set>
#include <bitset>

using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, pii> edge;

const int MAXN = 2 * 100005;
int n;
LL a[MAXN];
LL pref[MAXN];
LL get(int a, int b) {
  return pref[b] - pref[a - 1];
}
int find(int L, int R) {
  int b1 = L, b2 = R;
  while (L + 1 < R) {
    int mid = (L + R) / 2;
    LL v1 = get(b1, mid);
    LL v2 = get(mid + 1, b2);
    if (v1 < v2) {
      L = mid;
    } else if (v1 > v2) {
      R = mid;
    } else {
      L = mid;
      R = mid;
      break;
    }
  }
  if (abs(get(b1, L) - get(L + 1, b2)) < abs(get(b1, R) - get(R + 1, b2))) {
    return L;
  }
  return R;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pref[i] = pref[i - 1] + a[i];
  }
  LL ans = LLONG_MAX;
  for (int i = 2; i <= n - 2; i++) {
    int L = find(1, i);
    int R = find(i + 1, n);
    LL B = get(1, L);
    LL C = get(L + 1, i);
    LL D = get(i + 1, R);
    LL E = get(R + 1, n);
    LL diff = max(B, max(C, max(D, E))) - min(B, min(C, min(D, E)));
    ans = min(ans, diff);
  }
  cout << ans << endl;
} 

Measured memory_bytes: 6736
# -*- coding: utf-8 -*-

n = input()

M = [[float("inf") for j in xrange(n)] for i in xrange(n)]
color = ['WHITE' for i in xrange(n)]
d = [float("inf") for i in xrange(n)]
p = [-1 for i in xrange(n)]

for i in xrange(n):
    tmp = map(int, raw_input().split())
    for j in xrange(n):
        if tmp[j] != -1:
            M[i][j] = tmp[j]

d[0] = 0
p[0] = -1

while 1:
    mincost = float("inf")
    for i in xrange(n):
        if color[i] != "BLACK" and d[i] < mincost:
            mincost = d[i]
            u = i

    if mincost == float("inf"):
        break

    color[u] = "BLACK"

    for v in xrange(n):
        if color[v] != "BLACK" and M[u][v] != -1 and M[u][v] < d[v]:
            d[v] = M[u][v]
            p[v] = u
            color[v] = "GRAY"


sum = 0

for i in xrange(n):
    sum += d[i]

print sum

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

#define MAX (1<<31)-1
#define SIZE 1000000

int N;
int* table;

void init(int firstN){
    while(N < firstN)
        N *= 2;
}

void update(int loc, int value){
    loc += N - 1;
    table[loc] = value;
    if(N == 1)
        return;
    int parent = (loc - 1) / 2;
    while(true){
        table[parent] = min(table[2 * parent + 1], table[2 * parent + 2]);
        if(parent == 0)
            break;
        else
            parent = (parent - 1) / 2;
    }
}

int query(int searchLeft, int searchRight, int nodeId, int nodeLeft, int nodeRight){
    if(searchRight < nodeLeft || searchLeft > nodeRight)
        return MAX;
    if(searchLeft <= nodeLeft && searchRight >= nodeRight)
        return table[nodeId];
        
    int leftMin = query(searchLeft, searchRight, 2*nodeId+1, nodeLeft, (nodeLeft+nodeRight)/2);
    int rightMin = query(searchLeft, searchRight, 2*nodeId+2, (nodeLeft+nodeRight)/2+1, nodeRight);
    
    return min(leftMin, rightMin);
}

int main(void){
    int firstN, Q;
    int com, left, right;
    table = new int[SIZE];
    N = 1;
    
    cin >> firstN >> Q;
    
    init(firstN);
    
    for(int i = 0; i <= 2*N-2; ++i)
        table[i] = MAX;
    
    for(int i = 0; i < Q; ++i){
        cin >> com >> left >> right;
        if(com == 0)
            update(left, right);
        else if(com == 1)
            cout << query(left, right, 0, 0, N - 1) << endl;
    }
}


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

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

  vector<long long> c(N, 0);
  long long sum = 0;
  for(int i=0; i<N; i++){
    c[i] = (A[i]*(A[i]-1))/2;
    sum += c[i];
  }

  for(int i=0; i<N; i++){
    int index = b[i];
    long long ans = sum - c[index] + ((A[index]-1)*(A[index]-2))/2;
    cout << ans << endl;
  }
}

Measured memory_bytes: 6528
#include <stdio.h>

int main(void){
	int n, r, p, c, i, j, z, hanahuda[50], buf;

	while (1){
		scanf("%d %d", &n, &r);
		if (n == 0 && r == 0) {
			break;
		}

		for (i = 0; i < n; i++){
			hanahuda[i] = i + 1;
		}

		for (i = 0; i < r; i++){
			scanf("%d %d", &p, &c);
			if (p != 1){
				for (j = n - p - c + 1; j <= n - p; j++){
					buf = hanahuda[n - p - c + 1];
					for (z = n - p - c + 1; z < n - 1; z++){
						hanahuda[z] = hanahuda[z + 1];
					}
					hanahuda[n - 1] = buf;
				}
			}
		}
		printf("%d\n", hanahuda[n - 1]);
	}

	return 0;
}

Measured memory_bytes: 600
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder.Contests.ABC155
{
    /// <summary>
    /// 
    /// </summary>
    static class A
    {
        static void Main(string[] args)
        {
            var a = NextInt();
            var b = NextInt();
            var c = NextInt();

            if ((a == b && a != c) || (a == c && a != b) || (b == c && a != b))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            
        }

        #region Console
        static int _index = 0;
        static string[] _buffer;

        static string Next()
        {
            if (_buffer == null || _index >= _buffer.Length)
            {
                _buffer = Console.ReadLine().Split();
                _index = 0;
            }

            return _buffer[_index++];
        }
        static int NextInt()
        {
            return int.Parse(Next());
        }
        static long NextLong()
        {
            return long.Parse(Next());
        }
        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        static int[] ReadIntArray(int n)
        {
            var a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadInt();
            }
            return a;
        }
        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        static long[] ReadLongArray(int n)
        {
            var a = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadLong();
            }
            return a;
        }
        static List<T> ReadObjects<T>(int n, Func<int[], T> creator)
        {
            var l = new List<T>(n);

            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                l.Add(creator(a));
            }

            return l;
        }

        static int[,] ReadMatrix(int n, int m)
        {
            var r = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                for (int j = 0; j < m; j++)
                {
                    r[i, j] = a[j];
                }
            }
            return r;
        }
        #endregion
    }
}


Measured memory_bytes: 11092
#include <algorithm>
#include <iostream> //入出力
#include <cstdio>
#include <map>
#include <set>
#include <string>
#include <cmath> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
// #include <bits/stdc++.h>

using namespace std;
typedef long long ll; //64bit型

const int INF = 1050000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

const int N_MAX = 2010;

#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(a) (a).begin(), (a).end()

int main() //input->compute->output
{
    double a, pi = 3.141592653589;
    cin >> a;
    printf("%f %f\n", a * a * pi, pi * a * 2);

    return 0;
}



Measured memory_bytes: 3192
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (1e+18) + 7;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
	int n, k; cin >> n >> k;
	int ans = 0;
	while (n > 0) {
		n /= k; ans++;
	}
	cout << ans << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init_f();
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	stop
	return 0;
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

const int INF = 1 << 30;

int main(){
    int N,L;

    cin >> N >> L;

    int all = 0;
    int ans = 0;

    for(int i = 0;i < N;i++){
        all += i + L;
    }

    for(int i = 0;i < N;i++){
        int n = 0;
        for(int j = 0;j < N;j++){
            if(i == j)continue;
            n += j + L;
        }
        if(abs(ans - all) > abs(n - all)){
            ans = n;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n, k = map(int,input().split())
h = [int(input()) for i in range(n)]
m = max(h)-min(h)
h.sort()

for i in range(len(h)-k+1):
	if(h[i+k-1]-h[i] < m):
		m = h[i+k-1]-h[i]

print(m)

Measured memory_bytes: 7384
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "p", long, "dist");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    long h, w;
    scan(h, w);
    auto alphabets = new long[](26);
    foreach (_; iota(h))
    {
        auto s = sread();
        foreach (e; s)
            alphabets[e - 'a']++;
    }
    long only, two, four;
    foreach (e; alphabets)
    {
        if (e % 2)
            only++;
        else if (e % 4)
            two++;
        else
            four++;
    }
    if (h % 2 && w % 2)
    {
        if (only == 1 && two <= h / 2 + w / 2)
            writeln("Yes");
        else
            writeln("No");
    }
    else if (h % 2)
    {
        if (only == 0 && two <= w / 2)
            writeln("Yes");
        else
            writeln("No");
    }
    else if (w % 2)
    {
        if (only == 0 && two <= h / 2)
            writeln("Yes");
        else
            writeln("No");
    }
    else
    {
        if (only == 0 && two == 0)
            writeln("Yes");
        else
            writeln("No");
    }

}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


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

using namespace std;
#define ll long long
#define M 1000000007


int main()
{
    ll n;
    cin>>n;
    vector<ll>arr(n+1,0);
    for(ll i=1;i<=n;i++)
    {
        cin>>arr[i];
    }
    vector<ll>dp(n+1,0);
    dp[n-1]=abs(arr[n]-arr[n-1]);
    for(ll i=n-2;i>=0;i--)
    {
        dp[i]=min(abs(arr[i]-arr[i+1])+dp[i+1],abs(arr[i]-arr[i+2])+dp[i+2]);
    }
    cout<<dp[1]<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
vl d;
ll t;
ll ret = 0;

void input() {
  IN(N);
  REP(i, N) {
    IN(t);
    d.pb(t);
  }
}

void solve() {
  FOR(i, 0, N) {
    FOR(j, i+1, N) {
      ret += d[i] * d[j];
    }
  }
  PRINT(ret);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net.Mail;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            return int.Parse(Next());
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            var array = Array();
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }
        public long[] LongArray()
        {
            var array = Array();
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }
    }


    class Program
    {
        private int N;
        private string S;
        private void Scan()
        {
            var sc = new Scanner();
            N = sc.NextInt();
            S = sc.Next();
        }

        public void Solve()
        {
            Scan();
            int[] cnt = new int[N];
            cnt[0] = 0;
            int[] cnt2 = new int[N];
            cnt[N - 1] = 0;
            for (int i = 1; i < N; i++)
            {
                cnt[i] = cnt[i - 1] + (S[i - 1] == 'E' ? 0 : 1);
                cnt2[N - i - 1] = cnt2[N - i] + (S[N - i] == 'W' ? 0 : 1);
            }

            int ans = int.MaxValue;
            for (int i = 0; i < N; i++)
            {
                ans = Math.Min(ans, cnt[i] + cnt2[i]);
            }
            Console.WriteLine(ans);
        }

        static void Main() => new Program().Solve();
    }
}

Measured memory_bytes: 14944
#include <iostream>
#include <bits/stdc++.h>
#define pb push_back
#define ob pop_back
#define xx first
#define yy second
#define dob double
#define int long long int
#define gcd __gcd
#define ss size()
using namespace std;
const long long M = 998244353 , maxn = 3e3+10 ;

int n , m , k , x , y , q ,ans , dp[maxn][maxn];

pair <int, int> par[maxn][maxn];

int bpow(int a , int b){
    	if(!b)
	    	return 1;
	x = bpow(a , b/2);
	x = 1ll * x * x % M;
	if(b&1)
	    	x = 1ll * x * a % M;
	return x;
}

int32_t main(){

      ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	
	string s , t;

	cin >> s >> t;

	n = s.ss , m = t.ss;
	
	for(int i = 1 ; i <= n ; i++){
	    for(int j = 1 ; j <= m ; j++){
	    	if(s[i-1] == t[j-1]){
		    	dp[i][j] = dp[i-1][j-1] + 1;
				par[i][j].xx = i-1;
				par[i][j].yy = j-1;
			}
			else if(dp[i][j-1] >= dp[i-1][j]){
		    	dp[i][j] = dp[i][j-1] ;
				par[i][j].xx = i;
				par[i][j].yy = j-1;
			}
			else{
		    	dp[i][j] = dp[i-1][j] ;
				par[i][j].xx = i-1;
				par[i][j].yy = j;
			}	
		}
	}

	vector <char> v;


	int i = n , j = m;

	while(i > 0 && j > 0){
	    	if(par[i][j].xx == i-1 && par[i][j].yy == j-1){
		    	v.pb(s[i-1]);
		}
		int i1 = i , j1 = j;
		i = par[i1][j1].xx;
		j = par[i1][j1].yy;
	}

	for(int i = v.ss-1 ; i >= 0 ; i--)
	    	cout << v[i] ;

	
	return 0;
}


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

typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; ++i) {
        int v;
        cin >> v;
        d[i] = v;
    }
    sort(d.begin(), d.end());

    int ans = d[n / 2] - d[n / 2 - 1];

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b;
    cin >> a >> b;
    if (b >= a) {
        cout << a << endl;
    } else {
        cout << a - 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
if a==1 and b==2 or a==2 and b == 1:print(3)
elif a==2 and b == 3 or a ==3 and b== 2:print(1)
elif a==3 and b == 1 or a==1 and b==3:print(2)

Measured memory_bytes: 3060