akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
typedef long long ll;
typedef long double ld;
using namespace std;

ll mod=1000000007, kaku[500010];

const int SIZE=510000;
ll fac[SIZE], finv[SIZE], inv[SIZE];
void COMinit(ll m){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2; i<SIZE; ++i){
        fac[i]=(fac[i-1]*i)%m;
        inv[i]=m-(inv[m%i]*(m/i))%m;
        finv[i]=(finv[i-1]*inv[i])%m;
    }
}
ll COM(int n, int k, ll m){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return (fac[n]*((finv[k]*finv[n-k])%m))%m;
}


int main() {
	int N, M;
	cin >> N >> M;
	kaku[0]=1, kaku[1]=0;
	for(int i=2; i<=N; ++i){
		kaku[i]=((kaku[i-2]+kaku[i-1])%mod)*(i-1)%mod;
	}
	COMinit(mod);
	ll ans=1, now=1;
	for(int i=0; i<N; ++i) (ans *= M-i) %= mod;
	for(int i=N; i>0; --i){
		if(i&1){
			(ans += mod-(COM(N, i, mod)*now)%mod) %= mod;
		}
		else{
			(ans += (COM(N, i, mod)*now)%mod) %= mod;
		}
		(now *= M-i+1) %= mod;
	}
	for(int i=0; i<N; ++i) (ans *= M-i) %= mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 19436
N = int(input())
ite = 0
ans = 0
while(abs(N) > 0):
    if abs(N) % 2 != 0:
        ans += 10 ** ite
        if ite % 2 == 0:
            N -= 1
        else:
            N += 1
    N = N//2
    ite += 1

print(ans)


Measured memory_bytes: 2940
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

bool a[7368792];


int main(){
    while(1){
        int m,n;

        scanf("%d%d",&m,&n);
        if(m == 0 && n == 0)
            break;

        REP(i,7368792)
            a[i] = true;
 
        int start = m;

        int cou = 0;
        for(int i = start;cou < n;i++){
            if(a[i]){
                cou++;
                for(int j = i;j <= 7368791;j+=i){
                    a[j] = false;
                }
            }
        }
        int b;
        for(b = start;true;b++){
            if(a[b])
                break;
        }
        printf("%d\n",b);
    }
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<bool> c(N, false);
  for (int i = 0; i < K; ++i) {
    int d;
    cin >> d;
    for (int j = 0; j < d; ++j) {
      int a;
      cin >> a;
      c.at(a - 1) = true;
    }
  }
  int cnt = 0;
  for (auto it = c.begin(); it != c.end(); ++it) {
    if (*it) {
      ++cnt;
    }
  }
  cout << N - cnt << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <set>

using namespace std;

#define pb push_back
#define mp make_pair
#define x first
#define y second

typedef long long ll;

const ll INF = 1e9+5;
const ll MOD = 1e9+7;

int main() {
	int x;
	cin >>x;
	cout <<8-(x-400)/200;
	return 0;
}

Measured memory_bytes: 3616
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=1000000007 ;
const llint inf=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	llint n,m=1,ket=10,i,j,ans=0;
	cin>>n;
	while(ket<=n){ket*=10;m++;}//m は 桁数
	llint dp[10][10]={};
	int ns=n/(ket/10);
	
	int nt=n%10;
	for(int s=1;s<=9;s++){
		for(int t=1;t<=9;t++){
			ket=1;
			for(int k=1;k<=m;k++){
				ket*=10;
				if(k==1&&s!=t){continue;}
				if(k==1&&s<=n){dp[s][t]++;}
				else if(k==m){
					if(s<ns){dp[s][t]+=ket/100;}
					if(s==ns){
						dp[s][t]+=(n-s*(ket/10))/10;
						if(t<=nt){dp[s][t]++;}
					}
				}else{
					dp[s][t]+=ket/100;
				}
			}
			
		}
	}
	for(int A=1;A<=9;A++){
		for(int B=1;B<=9;B++){
			ans+=dp[A][B]*dp[B][A];
		}
	}
	cout<<ans<<endl;
}
//523 ket=1000

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

map<ll, ll> prime_factor(ll n)
{
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1)
    ret[n] = 1;
  return ret;
}

int main()
{
  ll n;
  cin >> n;

  ll ans = 0;
  for (auto p : prime_factor(n))
  {
    ll num = p.second;
    ll cnt = 1;
    while (p.second--) {
      num -= cnt;
      if (num < 0) break;
      ans++;
      cnt++;
    }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*                                                    
      I ♥ CLARICE STARLING...                                                               
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
const ll INF = (ll)2e18 + 77;
void solve()
{
    int n;cin>>n;
    map<string,int>M;
    while(n--)
    {
        string s;cin>>s;
        M[s]++;
    }
    cout<<"AC"<<" x "<<M["AC"]<<"\n";
    cout<<"WA"<<" x "<<M["WA"]<<"\n";
    cout<<"TLE"<<" x "<<M["TLE"]<<"\n";
    cout<<"RE"<<" x "<<M["RE"]<<"\n";
}
int main()
{
   fastio
   //Test_cases
   solve();
  return 0;
}
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
// Syntax to create a min heap for priority queue priority_queue <int, vector<int>, greater<int>>; 
//for modinverse use modularexponention(x,M-2,M);
//for "each" subtraction from ans(ans-k) if(ans<0) do ans+=MOD,ans%=MOD
//vector<vector<int>>dp(201,vector<int>(n+1)); A way to initialize vector of vector
//If wrong on pretest 2 means logically wrong


/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>


using namespace std;

int main() {
    long long int a, ans = 0;
    int N;
    cin >> N;

    for (int i = 0; i < N; i++) {
        cin >> a;
        ans += a - 1;
    }

    cout << ans;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>

/*struct pair {
	int x;
	int y;
};*/


int main() {
	int n, m;
	std::cin >> n >> m;
	if (n > 1) {
		n = (n * (n - 1)) / 2;
	}
	else {
		n = 0;
	}
	if (m > 1) {
		m = (m * (m - 1)) / 2;
	}
	else {
		m = 0;
	}
	std::cout << n + m << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define PB push_back
#define fi first
#define se second
using namespace std;
typedef pair<int,int> pii;
static const int inf =1ll<<60;
static const int MAX_N = 1e6;
struct edge{
    int to;
    int cost;
    edge(){}
    edge(int p1,int p2){
        to=p1;
        cost=p2;
    }
};

int N,M,C;
int maxx=0;
vector<pii> V;
vector<edge> G[MAX_N+5];
int d[MAX_N+5];
bool used[MAX_N+5];
int sum;
int ans=inf;

void dijkstra(){
    priority_queue<pii,vector<pii> ,greater<pii> > que;
    fill(d,d+MAX_N,inf);
    d[0]=0;
    que.push(pii(0,0));
    while(!que.empty()){
        pii p=que.top();
        que.pop();
        int v=p.se;
        if(d[v]<p.fi)continue;
        for(int i=0;i<G[v].size();++i){
            edge e = G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(pii(d[e.to],e.to));
            }
        }
    }
}

int score(int X){
    int res=X*C;
    int cnt=inf;
    for(int i=0;i<N;++i){
        if(d[i]<=X){
            //cout<<i<<endl;
            used[i]=true;
            continue;
        }
        cnt=min(cnt,i);
    }
    for(int i=0;i<N;++i){
        for(int j=0;j<G[i].size();++j){
            if(G[i][j].to<=i)continue;
            if(used[G[i][j].to]==true&&used[i]==true)continue;
            res+=G[i][j].cost;
        }
    }
    return res;
}

signed main(){
    cin>>N>>M>>C;
    for(int i=0;i<M;++i){
        int a,b,d;
        cin>>a>>b>>d;
        a--;b--;
        G[a].PB(edge(b,d));
        G[b].PB(edge(a,d));
        sum+=d;
    }
    dijkstra();
    //int X=0;
    for(int i=0;i<N;++i){
        V.PB(pii(d[i],i));
    }
    sort(V.begin(),V.end());
    fill(used,used+N,false);
    for(int i=0;i<V.size();++i){
        int now=V[i].se;
        for(int j=0;j<G[now].size();++j){
            edge e=G[now][j];
            if(used[e.to]==true){
                sum-=e.cost;
            }
            used[now]=true;
        }
        used[now]=true;
        ans=min(ans,V[i].fi*C+sum);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 45752
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
s = 0
s = sum(B)

for i in range(N-1):
    if(A[i+1] == A[i] + 1):

        s += C[A[i] -1]
    

print(s)


Measured memory_bytes: 3064
#include <iostream>
#include <set>
#include <math.h>
#include <list>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MAX_N 1005
#define MAX_M 100

int B[MAX_N];

int main()
{
    int N;
    int P[100];
    cin >> N;
    rep(i, N) cin >> P[i];

    int c = 0;
    rep(i, N)
    {
        if (P[i] != i + 1)
        {
            c++;
        }
    }

    if (c <= 2)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
int32_t main()
{
    ll x;
    cin>>x;
    vector<int> yen{5,10,50,100,500};
    vector<int>ans;
    for(int i=yen.size()-1;i>=0;i--)
    {
      while(x>=yen[i])
      {
        x-=yen[i];  // 1024- 524 24
      ans.pb(yen[i]);
      }

    }
    int total=0;
    for(auto x:ans)
    {
      if(x==500)
      {
        total+=1000;
      }
      else
      {
        total+=x;
      }
    }
    cout<<total;
}


Measured memory_bytes: 10220
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>

using namespace std;

#define TRACE(x) cerr << #x << " " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<

#define fst first
#define snd second

typedef long long llint;
typedef pair<int, int> pii;

const int B = 27397, MOD = 1e9 + 7;
const int B1 = 33941, MOD1 = 1e9 + 9;

const int n = 50;

llint k;
vector <llint> sol;

int main(void) {
  scanf("%lld", &k);

  for (int i = 0; i < n; ++i)
    sol.push_back(k/n + i);

  for (int i = 0; i < k % n; ++i) {
    sort(sol.begin(), sol.end());
    sol[0] += n;
    for (int j = 1; j < sol.size(); ++j)
      --sol[j];
  }

  printf("%d\n", n);
  for (auto x : sol) printf("%lld ", x);
  printf("\n");

  return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

int main()
{
  int n;
  scanf("%d", &n);
  int count = 0;
  int ba = 0;
  int b_ = 0;
  int _a = 0;
  char s[11];
  for (int i = 0; i < n; ++i)
  {
    scanf("%s", s);
    int j;
    for (j = 0; s[j]; ++j)
    {
      if (s[j] == 'A' && s[j + 1] == 'B')
      {
        ++count;
      }
    }
    if (*s == 'B' && s[j - 1] == 'A') ++ba;
    else if (s[j - 1] == 'A') ++_a;
    else if (*s == 'B') ++b_;
  }
  printf("%d\n", count + (_a + b_ > 0 ? ba + std::min(_a, b_) : std::max(ba - 1, 0)));
  return 0;
}

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

int main(void){
    long long n;
    cin >> n;
    vector<long long> lucas(n+1);
    lucas.at(0) = 2, lucas.at(1) = 1;
    for(int i=2; i<=n; i++){
        lucas.at(i) = lucas.at(i-1) + lucas.at(i-2);
    }
    cout << lucas.at(n) << endl;
    return 0;
}

Measured memory_bytes: 256
def LCS(x,y):
    n,m=len(x),len(y)
    DP=[0 for _ in range(m+1)]
    for i in range(n):
        tmp=DP[:]
        num=x[i]
        for j in range(m):
            if num==y[j]:DP[j+1]=tmp[j]+1
            elif DP[j+1]<DP[j]:DP[j+1]=DP[j]
    return DP[-1]


n=int(input())
for _ in range(n):
    print(LCS(input(),input()))


Measured memory_bytes: 5632
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
using namespace std;
#define forloop for(int i = 0; i < n; i++)
#define ll long long

int main(){
	int n; cin >> n;
	string s; cin >> s;
	int res = 1;
	for (int i = 1; i < s.size(); i++){
		if (s[i] != s[i - 1]) res++;
	}
	cout << res;
	getchar(); getchar();
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>

int main(){
  long long a =0;
  long long b =0;
  long long x =0;
  long long result = 0;
  scanf("%lld %lld %lld",&a,&b,&x);
  result = b/x - a/x ;
  if(a%x==0){
    result++;
  }
  printf("%lld",result);
  return 0;
}
  

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var N int
	fmt.Scan(&N)

	total := 1
	for i := 1; i < N+1; i++ {
		total = i * total % int(math.Pow10(9)+7)
	}

	fmt.Println(total)
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	char s;
	cin>>s;
	if(s=='A'){
		cout<<"T";
	}
	else if(s=='T'){
		cout<<"A";
	}
	else if(s=='C'){
		cout<<"G";
	}
	else{
		cout<<"C";
	}
	return 0;
}

Measured memory_bytes: 3496
using System;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            //Nは夏休み日数
            string[] N_M = Console.ReadLine().Split(' ');

            int N = int.Parse(N_M[0]);
            int M = int.Parse(N_M[1]);

            //宿題所要日数
            string[] A1_AM_TEMP = Console.ReadLine().Split(' ');
            int[] A1_AM = new int[A1_AM_TEMP.Length];

            for (int i = 0; i < A1_AM.Length; i++)
            {
                A1_AM[i] = int.Parse(A1_AM_TEMP[i]);
            }

            int D=0;

            for (int i = 0; i < A1_AM.Length; i++)
            {
                D += A1_AM[i];
            }

            int answer = N - D;
            
            if (answer < 0)
            {
                answer = -1;
            }
            Console.WriteLine(answer);
            
        }
    }
}


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

void solveA(){
  int a,b,c;
  cin >> a >> b >> c;
  cout << a*b/2 << endl;
}
void solveB(){
  int s;
  cin >> s;
  set<int> st;

  int m = 1;
  for(int i=0;i<2000000;i++){
    auto itr = st.find(s);
    if (itr != st.end()) {
      break;
    }

    st.insert(s);
    if (s%2 == 0) {
      s/=2;
    }
    else {s=3*s+1;}
    m++;
  }
  cout << m << endl;  
}

void solveC(){
  int n;
  cin >> n;

  int h[n];
  for (int i=0;i<n;i++){
    cin >> h[i];      
  }
  int ans = 0;
  bool flg = true;

  while(flg){
    int maxv=0;
    int maxp=0;
      for (int i=0;i<n;i++){
        if (h[i]>=maxv) {
	    maxv = h[i];
	    maxp = i;
	 }
      }
    ans += maxv;
    int downl = maxv;
    for (int i=maxp;i>=0;i--){
      int hi = h[i];
      h[i] = max(h[i]-downl,0);
      if (hi<downl) downl = hi;
    }
    
    int downr = maxv;
    for (int i=maxp+1;i<n;i++){
      int hi = h[i];
      h[i] = max(h[i]-downr,0);
      if (hi<downr) downr = hi;
    }

    flg = false;
    for (int i=0;i<n;i++){
      if (h[i]!=0) {
	flg = true;
      }
    }
  }
  cout << ans << endl;  
}
void solveD(){
}

int main(){
  solveC();
}


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

using namespace std;

void Solution()
{
    int cost[22][22] = {{0}};
    
    int n, m;
    int i, j, k;
    int a, b, c, d;
    
    char comma;
    
    cin>>n>>m;
    
    for(i = 1; i <= n; i++)
    {
        for(j = 1; j <= n; j++)
        {
            cost[i][j] = 1<<28;
        }
    }
    
    for(i=0; i < m; i++)
    {
        cin>>a>>comma>>b>>comma>>c>>comma>>d;
        
        cost[a][b] = c;
        cost[b][a] = d;
    }
    
    for(k=1;k<=n;k++)
    {
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=n;j++)
            {
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
            }
        }
        
    }
    
    cin>>a>>comma>>b>>comma>>c>>comma>>d;
    
    cout<<c - d- cost[a][b] - cost[b][a]<<endl;
}

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

Measured memory_bytes: 1160
#include<stdio.h>

#define MAX 200000

int main()
{
    long n,i,maxP=-20000000000;
    long a[MAX];
    long x,k;
    scanf("%ld", &n);
    for(i=0;i<n;i++)
    	scanf("%ld", &a[i]);
    for(i=1;i<n;i++)
    {
    	for(k=0;k<i;k++)
    	{
    		x = a[i] - a[k];
    		if(x>maxP)
    		    maxP = x;
		}
	}
	printf("%ld\n", maxP);
	return 0;
}

Measured memory_bytes: 2160
#include <bits/stdc++.h>
using namespace std;
int m, n, k;

int main() {
    cin >> n >> m >> k;
    int i;
    for(i=1;i<=n;i++)
        if(k-m*i==0||(n-2*i!=0&&(k-m*i)%(n-2*i)==0&&(k-m*i)/(n-2*i)>0&&(k-m*i)/(n-2*i)<=m))
            break;
    if(i>n)
        printf("No\n");
    else
        printf("Yes\n");

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import math

N=int(input())
T=[tuple(map(int,input().split())) for i in range(N)]

S=0

for i in range(N-1):
    for j in range(i+1,N):
        S+=math.sqrt((T[i][0]-T[j][0])**2+(T[i][1]-T[j][1])**2)

print(S/(N*(N-1)/2)*(N-1))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  if ((A + B) % 2 == 0) {
    cout << (A + B) / 2 << endl;
  }
  else {
    cout << "IMPOSSIBLE" << endl;
  }
}


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

using namespace std;

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

	int n;
	cin >> n;

	vector<long long> A(n), B(n);
	long long ans = 0;

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

	for(int i = n - 1; i >= 0; --i) {
		long long now = A[i] + ans;
		long long need = B[i];

		long long rem = now % need;
		if(rem == 0) continue;
		else ans += need - rem;
	}

	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 1792
import sys

readline = sys.stdin.readline

def main():
    N = int(readline())
    d = list(map(int, readline().split()))

    d.sort()
    bf = d[N//2-1]
    af = d[N//2]
    if bf == af:
        ans = 0
    else:
        ans = af-bf
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 14016
function Main(input){
	input = Number(input);
    if(input % 2 === 0){
      console.log((input/2)*(input/2));
    }else{
      console.log(((input-1)/2)*((input-1)/2+1));
    }
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define IOS             ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define read            freopen("in.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
#define loop(i,a,b)     for (ll i = a; i <= b; i++)
#define rloop(i,a,b)    for (ll i = a; i >= b; i--)
#define ms(a,x)         memset(a,x,sizeof a)
#define ll              long long int
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rall(a)         a.rbegin(),a.rend()
#define pb              push_back
#define nl              cout<<"\n"
#define gcd(a,b)        __gcd((a),(b))
#define lcm(a,b)        ((a)*(b))/(gcd(a,b))
#define sq(a)           (a)*(a)
#define sz(a)           a.size()
#define mod             1000000007
#define PI              2*acos(0.0)

int main()
{
    IOS
    int T=1;
    //cin>>T;
    while(T--)
    {
        string s,t;
        cin>>s>>t;
        ll ss=sz(s);
        ll tt=sz(t);
        if(s.find(t)!=string::npos)
        {
            cout<<0;
            return 0;
        }
        ll mn=LLONG_MAX;
        loop(i,0,ss-tt)
        {
            string a=s.substr(i,tt);
            ll cnt=0;
            loop(j,0,tt-1)
            {
                if(a[j]!=t[j]) cnt++;
            }
            mn=min(cnt,mn);
        }
        cout<<mn;

    }
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
int a[100010];
using namespace std;
int main(){
	memset(a,0,sizeof a);
	int n,k,q,b;
	cin>>n>>k>>q;
	for(int i=0;i<q;i++){
		cin>>b;
		a[b]++;
	}
	for(int i=1;i<=n;i++){
		if((q-a[i])>=k) cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
	return 0;
}

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

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

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	string s;
	cin >> s;
	int n = s.size();
	int ans = 0;
	int cnt = 0;
	FOR(i,0,n){
		if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
			cnt++;
			ans = max(ans,cnt);
		}else{
			cnt = 0;
		}
	}
	ANS(ans);
	return 0;
}


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

#define REP(i, n) for(int64_t i = 0; i < n; i++)
#define REPR(i, n) for(int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for(int64_t i = m; i < n; i++)
#define FORR(i, m, n) for(int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
template<class T>
inline bool chmax(T &a, T b) {if(a < b) {a = b;return true;}return false;}
template<class T>
inline bool chmin(T &a, T b) {if(a > b) {a = b;return true;}return false;}
const ll INF= 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
//----------------------------------------------------------

char C;

int main(){
    cin >> C;
    char b=C+1;
    cout << b << endl;
    return 0;
}

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

class Stack
{
    int a[100];
    int itr;
public:
    Stack() { itr = 0; }
    int pop(void) { return a[itr--]; }
    void push(int val) { a[++itr] = val; }
};

int main(void)
{
    string s;
    Stack stack;
    
    while (cin >> s) {
        if (string("+-*/").find(s[0]) != string::npos) {
            int b = stack.pop();
            int a = stack.pop();
            switch (s[0]) {
                case '+': stack.push(a+b); break;
                case '-': stack.push(a-b); break;
                case '*': stack.push(a*b); break;
                case '/': stack.push(a/b); break;
                default : break;
            }
        } else {
            stack.push(stoi(s));
        }
    }
    cout << stack.pop() << endl;

    return 0;
}



Measured memory_bytes: 3212
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int[] a_list = new int[N+1];
        int[] confirmed = new int[N+1];
        for(int i = 1; i < N+1; i++){
            a_list[i] = sc.nextInt();
        }
        
        int numOfMultiples = 1;
        int cnt = 2;
        List<Integer> ans = new ArrayList<Integer>();
        for(int i = N; i > 0; i--){
            if(i <= N/cnt){
                numOfMultiples ++;
                cnt ++;
            }
            
            if(numOfMultiples == 1){
                confirmed[i] = a_list[i];
            } else{
                int cnt2 = 2;
                int total = 0;
                while(i*cnt2 <= N){
                    total += confirmed[i*cnt2];
                    cnt2 ++;
                }
                confirmed[i] = total%2 == a_list[i] ? 0 : 1;
                total = 0;
            }
            if(confirmed[i] == 1){
                ans.add(i);
            }
        
        }
  
        System.out.println(ans.size());
        for(Integer i : ans){
            System.out.print(i + " ");
        }
    }
}


Measured memory_bytes: 93200
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)


















int main(){
    ll n;
    cin >> n;
    vector<ll> c(n);
    REP(i, n){
        cin >> c[i];
        c[i]--;
    }
    vector<vector<ll>> g(n);
    REP(i, n - 1){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<ll> a(n, n * (n + 1) / 2), d(n);
    ll s = 0;
    auto dfs = [&](auto &&dfs, ll now, ll par) -> void {
        ll tmp = s + d[c[now]];
        s++;
        for(auto &ch : g[now]){
            if(ch == par) continue;
            d[c[now]] = -s;
            dfs(dfs, ch, now);
            a[c[now]] -= (s + d[c[now]]) * (s + d[c[now]] + 1) / 2;
        }
        d[c[now]] = tmp - s;
    };
    dfs(dfs, 0, -1);
    REP(i, n){
        cout << a[i] - (s + d[i]) * (s + d[i] + 1) / 2 << endl;
    }
}

Measured memory_bytes: 34180
#define NDEBUG
NDEBUG


#include <algorithm>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <random>


typedef int64_t int64;


using namespace std;

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END


namespace template_util {
    

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    /// caide keep
    template<int N>
    struct bytetype {
        
    };

    /// caide keep
    template<>
    struct bytetype<4> {
        
    };

    /// caide keep
    template<>
    struct bytetype<3> {
        
    };

    /// caide keep
    template<>
    struct bytetype<2> {
        
    };

    /// caide keep
    template<>
    struct bytetype<1> {
        
    };

    /// caide keep
    template<>
    struct bytetype<0> {
        
    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}


template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}


int64 f(int64 a, int64 b, int64 c) {
    int64 res = a * b * (c % 2);
    return res;
}

void solve(istream& in, ostream& out) {
    int64 a = next<int64>(in);
    int64 b = next<int64>(in);
    int64 c = next<int64>(in);
    int64 res = min(f(a, b, c), min(f(a, c, b), f(b, c, a)));
    out << res << endl;
}


int main() {
    solve(cin, cout);
    return 0;
}



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

int main() {

    priority_queue<ll> A, B, C, P, Q;
    ll x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    ll p;
    rep(i,a) {
        cin >> p;
        A.push(p);
    }
    rep(i,b) {
        cin >> p;
        B.push(p);
    }
    rep(i,c) {
        cin >> p;
        C.push(p);
    }
    rep(i,x){
        P.push(A.top()); A.pop();
    }
    rep(i,y){
        Q.push(B.top()); B.pop();
    }
    C.push(0);
    P.push(0);
    Q.push(0);
    ll ans = 0;
    int k = x + y;
    while(k) {
       if(P.top() >= Q.top() && P.top() >= C.top()){
           ans += P.top(); P.pop();
       }else if (Q.top() > P.top() && Q.top() >= C.top()) {
           ans += Q.top(); Q.pop();
       } else {
           ans += C.top(); C.pop();
       }
        --k;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4852
#include <stdio.h>
int main() {
	int A, B;
	int a, b, c;

	scanf("%d %d", &A, &B);
	
	a = A + B;
	b = A - B;
	c = A * B;

	if (a > b && a > c) {
		printf("%d", a);
	} else if(b > c){
		printf("%d", b);
	} else {
		printf("%d", c);
	}

	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
  int i,j,count=0;
  char * p1 = (char*)malloc(sizeof(char)*1000);
  scanf("%s",p1);
  int n = strlen(p1);
  char * p = (char*)realloc(p1,sizeof(char)*(n+1));
  p[n] = '\0';
  for(i=0;i<n/2;i++)
  {
    if(p[i]!=p[n-i-1])
    {
      count++;
    }
  }
  printf("%d",count);
  return 0;
}
 	

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define MOD           1000000007
#define forn(i,s,n)   for(int i = s ; i < n ; i++)
#define mp            make_pair
#define pb            push_back  
#define st            first
#define nd            second
#define sz(v)         ((int)((v).size()))
const int SIZE=1000000;
const int OO = (int)1e9;
const double PI = acos(-1);
typedef vector<int> vi;
typedef long long int ll;  
typedef pair<int , int > ii;
typedef pair<int , int > Point;
typedef pair<pair<int, double> , int > iii;
int   C[SIZE+6];
bool f[SIZE+8];

int main(){
     
    int n ;
    vi A;
    scanf("%d" , &n);
    forn(i , 0 , n){
         int q;
         scanf("%d", &q);
         A.pb(q);
         
         
      //    forn(i , 0 , sz(A))printf("%d " , A[i]);
         // cout << endl;
    }
    for(int i = n-1 ; i>=0 ; i-=2)printf("%d " , A[i]);
    int st = 0;
    if(n&1)st=1;
    for(int i = st ; i <n ; i+=2)printf("%d " , A[i]);
 }

Measured memory_bytes: 3060
from collections import defaultdict, deque
import sys
sys.setrecursionlimit(10**9)


N, Q = map(int, input().split())
count = [0] * N
parent = defaultdict(int)
t = [[] for i in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    t[a - 1].append(b)
    t[b - 1].append(a)

for i in range(Q):
    p, x = map(int, input().split())
    count[p - 1] += x


f = [False] * N
q = deque([1])
while(q):
    n = q.popleft()
    f[n-1] = True
    for i in t[n-1]:
        if f[i-1]:
            continue
        q.append(i)
        count[i-1]+=count[n-1]
        f[i-1] = True
#for i in range(1, N):
#    count[i] += count[parent[i + 1] - 1]
#print(parent)
print(*count)


Measured memory_bytes: 56668
nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
 
if a > b:
    tmp = a
    a = b
    b = tmp
if b > c:
    tmp = b
    b = c
    c = tmp
if a > b:
    tmp = a
    a = b
    b = tmp
 
print(a, b, c)

Measured memory_bytes: 6724
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    int n;
    cin >> n;
    int a = 0, b = 0;
    REP(i, n){
        int x, y;
        cin >> x >> y;
        if(a < x) a = x, b = y;
    }

    cout << a + b << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define OUT(x) cout << (x) << endl
typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> g(n, vector<int>());
    vector<pair<int, int>> edges(n - 1, pair<int, int>());
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        edges[i] = {a, b};
    }
    vector<int> colors(n);
    vector<int> parents(n);
    int cnt = 0;
    queue<int> que;
    que.push(0);
    while (!que.empty()) {
        int parent = que.front();
        que.pop();
        int cur = 1;
        for (int child : g[parent]) {
            parents[child] = parent;
            if (cur == colors[parent]) cur++;
            colors[child] = cur;
            cnt = max(cnt, cur);
            cur++;
            que.push(child);
        }
    }
    OUT(cnt);
    for (auto p : edges) {
        if (parents[p.first] == p.second) {
            OUT(colors[p.first]);
        } else {
            OUT(colors[p.second]);
        }
    }
}


Measured memory_bytes: 6016
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int i,s,k;
		k=0;
		for(i=0; i<10; i++) {
			s = sc.nextInt();
			k = k+s;
			}
		System.out.println(k);
		}
	}

Measured memory_bytes: 17168
#include <stdio.h>
#define swap(type, x, y) do{ type t = x; x = y; y = t; }while(0)

void quick(int a[], int left, int right, int b[]){
  int pl = left, pr = right, x = a[(left + right) / 2];
  do{
    while(a[pl] < x)  pl++;
    while(a[pr] > x)  pr--;
    if(pl <= pr){
      swap(int, a[pl], a[pr]);
      swap(int, b[pl], b[pr]);
      pl++, pr--;
    }
  }while(pl <= pr);
  if(pl < right)  quick(a, pl, right, b);
  if(pr > left)   quick(a, left, pr, b);
}

int main(){
  int n;  scanf("%d", &n);
  int s[100005], g[100005];
  for(int i=1; i<=n; i++){
    int x, l;  scanf("%d %d", &x, &l);
    s[i] = x - l;  g[i] = x + l;
  }

  quick(g, 1, n, s);
  
  int count = 1, now = g[1], idx = 1;
  do{
    while(s[idx] < now)  idx++;
    if(idx <= n)  count++;
    now = g[idx];
  }while(idx <= n);

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

  return 0;
}


Measured memory_bytes: 2488
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int>A(n);
	int ans=0;
	for(int i=0;i<n;i++)
		cin>>A[i];
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(i!=j)
				ans=max(ans,abs(A[i]-A[j]));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll ans = 0;
    for(ll i = 2; i * i <= N; i++) {
        if(N % i != 0) continue;
        ll num = 0;
        while(N % i == 0) {
            N /= i;
            num++;
        }
        for(ll j = 1; ; j++) {
            if(num >= j) {
                num -= j;
                ans++;
            } else break;
        }
    }
    if(N != 1) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
#define FRO freopen("in.txt","r",stdin);

vector<vector<int>>adj;
vector<int>dp;

int fun(int n)
{
        if(dp[n]!=-1) return dp[n];
        dp[n]=0;
        for(auto child: adj[n])
        {
                dp[n]=max(dp[n],fun(child)+1);
        }
        return dp[n];
}

int main()
{
        int n,i,j,t,tcs=0,k,m,u,v;
        cin>>n>>m;
        adj.resize(n+1);
        dp.assign(n+1,-1);

        while(m--)
        {
                cin>>u>>v;
                adj[u].push_back(v);
        }
        int mx=-1;
        for(i=1;i<=n;i++)
                mx=max(mx,fun(i));
        cout<<mx;

	return 0;
}


Measured memory_bytes: 8192
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>

int main() {
	int n; std::cin >> n;
	std::vector<int> permutation(n);
	for (auto& p : permutation) std::cin >> p;
	int count = 0;
	for (auto i = 1; i + 1 < n; ++i) {
		if ((permutation[i] < permutation[i - 1] || permutation[i] < permutation[i + 1]) && (permutation[i] > permutation[i - 1] || permutation[i] > permutation[i + 1])) {
			++count;
		}
	}
	std::cout << count << std::endl;
}


Measured memory_bytes: 256
#include<stdio.h>
        #include <stdlib.h>
        int main(){
        	int a = 0, b = 0, N = 0, i, t[110000], x[110000], y[110000];
        	int q = 1;
        	scanf("%d", &N);
        	t[0] = 0;
        	x[0] = 0;
        	y[0] = 0;
        	for (i = 0; i < N; i++) {
        		scanf("%d %d %d", &t[i + 1], &x[i + 1], &y[i + 1]);
        	}
        	for (i = 0; i < N; i++) {
        		 a = t[i + 1] - t[i];
        		 b = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
        		 if (a < b) {
        			 q = 0;
        		 }
        		 if(a % 2 != b % 2){
        			 q = 0;
        		 }
        	}
        	if (q == 1) {
        		printf("Yes");
        	}else{
              printf("No");
            }
        }

Measured memory_bytes: 2916
#include<stdio.h>

int check(int str[]){
  int se=0;
  int fi=0;
  for(int i=0;i<3;++i){
    if(str[i]==7){
      se+=1;
    }
    else if(str[i]==5){
      fi+=1;
    }
  }
  /*printf("%d",se);
  printf("%d",fi);*/
  if(se==1 && fi==2){
    return 1;
  }
  return 0;
}

int main(){
  int a,b,c,ch;
  int d[3];
  scanf("%d",&a);scanf("%d",&b);scanf("%d",&c);
  d[0]=a;d[1]=b;d[2]=c;
  /*printf("%d",d[0]);
  printf("%d",d[1]);
  printf("%d",d[2]);*/
  ch=check(d);
  if(ch==1){
    printf("YES");
  }
  else{
    printf("NO");
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();
		System.out.println((long)((1900 * M + (100 * (N - M))) * Math.pow(2, M)));
		scan.close();

	}

}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define len(x) ((int)(x).size())
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;

const ll LINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9+7;

/// command for char arrays with spaces -> scanf(" %[^\n]", text);
 
////////////////////////// Solution starts below. //////////////////////////////

int main(){

	fastio;
	int n, p;
	cin >> n >> p;
	vector<ll> valor(n), peso(n);
	for(int i = 0; i < n; i++){
		cin >> peso[i] >> valor[i];
	}
	vector<vector<ll>> dp(n+1, vector<ll>(p+1, 0));
	for(int i = 1; i <= n; i++){
		dp[i-1][0] = 0LL;
		for(int j = 1; j <= p; j++){
			dp[i][j] = dp[i-1][j];
			if(peso[i-1] <= j) dp[i][j] = max(dp[i][j], dp[i-1][j-peso[i-1]] + valor[i-1]);
		}
	}
	cout << dp[n][p] << '\n';
    return 0;
}

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

int main() {
int A, B, C; cin >> A >> B >> C;
int K; cin >> K;
int M = max(A, max(B, C));
int S = A + B + C;
cout << S - M + (M << K) << '\n';
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        
        
        long[] L=new long[87];
        L[0]=2;
        L[1]=1;
        for(int i=2;i<87;i++){
            L[i]=L[i-1]+L[i-2];
        }
        
        System.out.println(L[sc.nextInt()]);
    }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(int i=1;i<=n;i++)
#define FORl(i,l,n) for(int i=l;i<n;i++)
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14

ll power(ll num,ll g,ll mod){
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}

int main(){
    int n;
	cin >> n;
	string s;
	cin >> s;
	vi v;
	FOR0(i,n){
		if(s[i] == 'R')	v.pb(i);
	}
	int m = v.size();
	if(m == n || m == 0){
		cout << "0" << endl;
		return 0;
	}
	int j = m-1, cnt = 0;
	FOR0(i,n){
		if(s[i] == 'W' && v[j] > i){
			cnt++;
			j--;
		}
		if(j < 0) break;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 5572
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

void solveSingleCase(int caseNo)
{
    int N;
    cin >> N;
    VEC(int) V(N);
    READVEC(V);
    VEC(int) O(ALL(V));
    sort(ALL(V));

    map<int, int> ans;
    FOR(i, 0, N) {
        int x = V[i];
        if (i >= N / 2) {
            ans[x] = V[N / 2 - 1];
        } else {
            ans[x] = V[N / 2];
        }
    }

    for (int x : O)
        cout << ans[x] << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


Measured memory_bytes: 12928
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>

using namespace std;

#define REP(i,n) for((i)=0;(i)<(int)(n);++(i))
#define REP1(i,n) for((i)=1;(i)<=(int)(n);++(i))

int main() {
    //clock_t start = clock();
    ios::sync_with_stdio(false); cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int a, b; cin >> a >> b;
    cout << (a+b)%24 << endl;
    //clock_t stop = clock();
    //cout << (double)(stop-start)/CLOCKS_PER_SEC << " (s)" << endl;
    return 0;
}


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

import static java.lang.System.in;

public class Main {
    public static void main(String[] args)throws IOException{
        Scanner sc = new Scanner(System.in);
        int K =sc.nextInt(),A=sc.nextInt(),B=sc.nextInt();
        long ans = help(K,A,B);
        System.out.println(ans);
    }
    static long help(long K, long A, long B){
        if(B-A<=2) return K+1;
        if(K==1) return 2;
        if(1+K-2<A) return 1+K; // after K-2 operations still can't reach A biscuits
        long ans = A;
        K -= A-1;
        ans += K/2*(B-A)+K%2;
        return ans;
    }
}


Measured memory_bytes: 21844