akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main()
{
  long long N = 0;
  cin >> N;
  int count = 0;

  for(int i=1;i<N;i++){
    for(int j=1;j<N;j++){
      if(i*j>=N){
        break;
      }
      count++;
    }
  }
  cout << count;
}


Measured memory_bytes: 3636
N = int(input())
A = list(map(int,input().split()))
MOD = pow(10,9)+7

num = 1
ans = 1
for i in range(N):
  #print(num,(num-1)*2,A[i])
  if (num-1)*2 < A[i]:
    Flag = True
  else:
    while (num-1)*2 >= A[i]:
      ans = (ans*num)%MOD
      num -= 1
  if i < N-1:
    num += 1

#print(ans,num)
while num > 1:
  ans = (ans*num)%MOD
  num-=1
print(ans)
         

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

using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  set<char> st;
  for(char ch : s) {
    st.insert(ch);
  }
  if(st.size()==1) {
    cout << "No\n";
  } else {
    cout << "Yes\n";
  }
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>
#include <list>
#include <map>
using namespace std;

int main(){

    int N;
    cin >> N;

    int count = 0;
    for(char c : to_string(N)){
        count += c - '0';
    }

    if(count == 1){
        count = 10;
    }

    cout << count << endl;
}




Measured memory_bytes: 256
module Main where

import Data.List
import qualified Data.Map.Strict as Map
import Control.Monad
import Data.Ord

main = do
    printRes =<< solve <$> (readStrings =<< readInt)

readStrings :: Int -> IO [String]
readStrings n = replicateM n getLine

readInt :: IO Int
readInt = read <$> getLine

solve :: [String] -> [String]
solve strs = ret
    where
        sorted = sortOn (Down . snd) $ Map.toList $ Map.fromListWith (+) $ map (\s -> (s, 1)) strs
        maxVal = snd $ head sorted
        ret = map fst $ takeWhile ((== maxVal) . snd) sorted

printRes :: [String] -> IO ()
printRes [] = return ()
printRes (x:xs) = do
    putStrLn x
    printRes xs


Measured memory_bytes: 164860
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A,B;
  cin >> N >> A>> B;

  if ( A*N < B )  {
  cout << A*N <<endl;}
  else if ( A*N == B )  {
  cout << B <<endl;}
  else if ( A*N > B )  {
  cout << B <<endl;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b){
	while(b){
		a %= b;
		swap(a, b);
	}
	return a;
}
int main(){
	long long a, b;
	cin >> a >> b;
	a = gcd(a, b);
	vector<long long> can;
	for(long long i = 1; i * i <= a; i++){
		if(a % i == 0){
			can.push_back(i);
			if(i * i != a) can.push_back(a/i);
		}
	}	
	sort(can.begin(), can.end());
	int len = can.size();
	vector<int> used(len, 0);
	int ans = 0;
	for(int i = 0; i < len; i++){
		if(used[i]) continue;
		if(can[i] == 1) ans++;
		else{
			ans++;
			for(int j = i + 1; j < len; j++) if(can[j] % can[i] == 0)
				used[j] = 1;
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define INF (INT_MAX/2)
#define PI (2*acos(0.0))
#define EPS (1e-8)

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef int Cost;
struct Edge {
  int src, dst; Cost cst;
  Edge(int s, int d, Cost c) : src(s), dst(d), cst(c) {}
};
typedef vector<Edge>  Edges;
typedef vector<Edges> Graph;
typedef vector<Cost>  Array;
typedef vector<Array> Matrix;

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

vector<Cost> dijkstra(const Graph &g, int s) {
  const Cost inf = numeric_limits<Cost>::max() / 2;
  typedef tuple<Cost, int> State;
  priority_queue<State, vector<State>, greater<State>> q;
  vector<Cost> dist(g.size(), inf);
  dist[s] = 0; q.emplace(0, s);
  while (q.size()) {
    Cost c; int v;
    tie(c, v) = q.top(); q.pop(); c *= -1;
    if (dist[v] < c) continue;
    for (auto & e : g[v]) {
      if (dist[e.dst] > dist[v] + e.cst) {
        dist[e.dst] = dist[v] + e.cst;
        q.emplace(dist[e.dst], e.dst);
      }
    }
  }
  return dist;
}

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int v, e, r;
  int s, t, d;
  
  cin >> v >> e >> r;
  
  Graph g(v);
  for (int i = 0; i < e; i++) {
    cin >> s >> t >> d;
    g[s].push_back(Edge(s, t, d));
  }

  vector<Cost> c = dijkstra(g, r);
  for (int i = 0; i < (int)c.size(); i++) {
    if (c[i] == numeric_limits<Cost>::max() / 2) cout << "INF" << endl;
    else cout << c[i] << endl;
  }
  return 0; 
}

Measured memory_bytes: 15348
N,M = map(int, input().split())
hight_list = list(map(int, input().split()))
result_list = [True] * N

for i in range(M):
    a, b = map(int, input().split())
    if hight_list[a - 1] < hight_list[b - 1]:
        result_list[a - 1] = False
    elif hight_list[a - 1] == hight_list[b - 1]:
        result_list[a - 1] = False
        result_list[b - 1] = False
    else:
        result_list[b - 1] = False

print(result_list.count(True))



Measured memory_bytes: 19988
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n; cin >> n;
    vector<string> vo,ve;

    REP(i,n) {
        string x; cin >> x;
        if (i % 2 == 0) ve.push_back(x);
        else vo.push_back(x);
    }
    reverse(ALL(vo));
    vector<string> v(vo);
    v.insert(v.end(),ALL(ve));
    if (n % 2 == 1) reverse(ALL(v));

    string ans = "";
    REP(i,n-1) {
        ans += v[i] + " ";
    }
    ans += v[n-1];

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 17624
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,x,y;
	cin>>n>>m>>x>>y;
	vector<int>Xa;
	vector<int>Ya;
	for(int i=0;i<n;i++)
	{
		int xi;
		cin>>xi;
		Xa.push_back(xi);
	}
	for(int j=0;j<m;j++)
	{
		int yi;
		cin>>yi;
		Ya.push_back(yi);
	}
	sort(Xa.begin(),Xa.end());
	sort(Ya.begin(),Ya.end());
	bool cond = false;
	for(int i=x+1;i<=y;i++)
	{
		if(i>Xa[Xa.size()-1] && i<=Ya[0])
		{
			cond=true;
		}
		else
		{
			continue;
		}
	}
	if(!cond)
	{
		cout<<"War"<<"\n";
	}
	else
	{
		cout<<"No War"<<"\n";
	}
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    //Your code here!
    double r,a,b;
    scanf("%lf %lf %lf",&r, &a, &b);
    a=3.141592653589*r*r;
    b=3.14159265389*2*r;
    printf("%f %f\n",a,b);
    return 0;
}


Measured memory_bytes: 2124
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 998244353
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 100000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}
int a[200005];
vector<vector<int>>v;
int ans[200005];
void dfs(int i,multiset<int>&s,int par){
    s.insert(a[i]);
    auto it=s.lower_bound(a[i]);
    it++;
    int x=-1;
    if(it!=s.end()){
        x=*it;
        s.erase(it);
    }
    ans[i]=s.size();
    for(auto j:v[i]){
        if(j==par)continue;
        dfs(j,s,i);
    }
    if(x!=-1)s.insert(x);
    s.erase(s.lower_bound(a[i]));
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    v.resize(n);
    for(int i=0;i<n-1;i++){
        int x,y;
        cin>>x>>y;
        x--;y--;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    multiset<int>s;
    dfs(0,s,-1);
    for(int i=0;i<n;i++)cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 31680
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;

int main(){
    ll n,a,b;cin>>n>>a>>b;
    if(a>b||n==1&&a^b)cout<<0<<endl;
    else cout<<(n-2)*(b-a)+1<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int b[10000],c,i,m,l;
    long long a;
    scanf("%d",&c);
    for(i=0;i<c;i++){
        scanf("%d",&b[i]);
    }
    for(i=0;i<c;i++){
        a=a+b[i];
    }
    m=l=b[0];
    for(i=1;i<c;i++){
        if(b[i] < m) m = b[i];
        if(b[i] > l) l = b[i];
    }
    printf("%d %d %lld\n",m,l,a);
    return 0;
}

Measured memory_bytes: 636
import math
n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
    if i < k:
        coinCnt = math.ceil(math.log(k/i, 2))
        ans += 1 / 2 ** coinCnt
    else:
        ans += 1
ans /= n
print(ans)

Measured memory_bytes: 38768
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf 1e18

int max(int a, int b) {
    if (a >= b) return a;
    return b;
}

int min(int a, int b) {
    if (a >= b) return b;
    return a;
}


int knapSack() {
    int n, capacity;
    cin >> n >> capacity;

    int weight[n], val[n];
    int valSum = 0;
    for (int i = 0; i < n; i++) {
        cin >> weight[i] >> val[i];
        valSum += val[i];
    }

    int ans = 0;

    int dp[n + 1][valSum + 1];
    for (int i = 1; i <= valSum; i++)
        dp[0][i] = inf;
    dp[0][0] = 0;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= valSum; j++) {
            if (val[i] <= j)
                dp[i + 1][j] = min(weight[i] + dp[i][j - val[i]], dp[i][j]);
            else
                dp[i + 1][j] = dp[i][j];
            if (dp[i + 1][j] <= capacity)
                ans = max(ans, j);
        }
    }

    return ans;

}
int32_t main()
{
    cout << knapSack();
    return 0;
}


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


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}comb(100005);


//nPk
 mint f(int n, int k) {
    if (n < 0) return 0;
    // nPk = nCk * k!
    mint res = comb(n,k);
    res *= comb.fact[k];
    return res;
}




//組み合わせの数nCrを計算
   int calcNumOfCombination(int n, int r){
       int num = 1;
       for(int i = 1; i <= r; i++){
           num = num * (n - i + 1) / i;
       }
       return num;
   }


int main() {
  ll n,k;
  cin>>n>>k;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  sort(a.rbegin(),a.rend());
  mint ans=0;
  mint test=comb(4,2);
  //cout<<test.x<<endl;
  rep(i,n){
    mint c=comb(n-1-i,k-1);
    //cout<<c.x<<endl;
    mint now=c*a[i];
  //  cout<<now.x<<endl;


    ans+=now;
    //cout<<ans<<endl;
  }
  reverse(a.begin(),a.end());
  rep(i,n){
    mint c=comb(n-1-i,k-1);
  //  cout<<c.x<<endl;
    mint now=c*a[i];
  //  cout<<now.x<<endl;

    ans-=now;
    //  cout<<ans<<endl;
  }
  cout<<ans.x;
}


Measured memory_bytes: 2560
/*
Author            : Md. Anwarul Habib
Dept. & Institute : CSE - 41st Batch , Ahsanullah University of Science & Technology
Problem Name      : Atcoder-Frog1
*/

#include<bits/stdc++.h>

using namespace std;

long long int i,j,k,l,m,t,a,b,c,d,x,y,sum=0,total=0,m1=0,m2=0;

long long int ar[100000];

long long int dp[10001]={-1};


long long int frog_jump(long long int n)
{
    dp[0]=0;
    dp[1]=abs(ar[1]-ar[0]);

    for(i=2 ; i<=n ; i++)
    {
        dp[i]=min(dp[i-1]+abs(ar[i]-ar[i-1]),dp[i-2]+abs(ar[i]-ar[i-2]));
    }
    return dp[n];

}

int main()
{
    long long int n;

    scanf("%lld",&n);

    for(i=0;i<n;i++)
    {
        scanf("%lld",&ar[i]);
    }

    sum=frog_jump(n-1);

    printf("%lld\n",sum);

}


Measured memory_bytes: 1152
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var XYZ = ReadInts();
            WriteLine(XYZ[2] + " " + XYZ[0] + " " + XYZ[1]);
        }

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


Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main () {
    string s;
    int q; 
    cin >> s >> q;
    string frontString;
    string backString;

    int direction = 0;

    for (int i = 0; i < q; i++) {
        int t; cin >> t;

        if (t == 1) {
            direction = 1 - direction;
        } else {
            int f;
            char c;
            cin >> f >> c;

            if (direction == 0) {
                if (f == 1) {
                    frontString.push_back(c);
                } else {
                    backString.push_back(c);
                }
            } else {
                if (f == 1) {
                    backString.push_back(c);
                } else {
                    frontString.push_back(c);
                }
            }
        }
    }

    int fl = frontString.size();
    int bl = backString.size();

    if (direction == 0) {
        for(int i = fl - 1; i >= 0; i--) cout << frontString[i];
        cout << s;
        for(int i = 0; i < bl; i++) cout << backString[i];
    } else {
        for(int i = bl - 1; i >= 0; i--) cout << backString[i];
        reverse(s.begin(), s.end());
        cout << s;
        for(int i = 0; i < fl; i++) cout << frontString[i];
    }

    cout << endl;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
bool judge(int n)
{
    for(int x=0;x<26;x++)
        for(int y=0;y<15;y++)
    {
        if(4*x+y*7==n)
            return true;
    }
    return false;
}
int main()
{
    int n;
    scanf("%d",&n);
    if(n==0)
    printf("Yes\n");
    else if(n<4)
      printf("No\n");
    else
    {
       if(judge(n))
        printf("Yes\n");
       else
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int n,y;
    cin>>n>>y;
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n-i;j++)
        {
            if(10000*i+5000*j+1000*(n-i-j)==y)
            {
                cout<<i<<" "<<j<<" "<<n-i-j<<endl;
                return 0;
            }
        }
    }
    cout<<"-1 -1 -1"<<endl;
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

# mv_array = [set() for _ in range(n)]
# score_mv_array = [[] for _ in range(n)]
# score_array = [0]*n

def get_sum(array):
    score_array = [0]
    for i, a in enumerate(array):
        score_array.append(score_array[i]+a)
    return max(score_array)

def get_max(array, q, mod):
    if q == 0:
        m_score = get_sum(array[:mod])
    else:
        m_score = get_sum(array+array[:mod])
        m_score = sum(array)*(q-1) + m_score
    return m_score

max_score = -float('inf')

for i in range(n):
    score = 0
    # max_score = c[i]
    score_mv_array = []
    pos = i
    start_pos = p[pos]-1
    for j in range(k):
        pos = p[pos]-1
        if j!=0 and pos == start_pos:
            # len_mv = len(score_mv_array)
            len_mv = j
            q, mod = divmod(k-j, len_mv)
            score += get_max(score_mv_array, q, mod)
            max_score = max(score, max_score)
            break
        score += c[pos]
        score_mv_array.append(c[pos])
        max_score = max(score, max_score)
    # score_array[i] = max_score

# print(max(score_array))
print(max_score)

Measured memory_bytes: 145056
# -*- coding: utf-8 -*-
def ex2019a():
     # 入力を受け取る
    n = raw_input().split(" ")
    a = int(n[0])
    b = int(n[1])
    c = int(n[2])

    if a == b and b == c:
        print "Yes"
    else:
        print "No"

def main():
    ex2019a()
	
if __name__ == '__main__':
    main()

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

using namespace std;
 
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
#define pb push_back;
#define mp make_pair;
#define fi first;
#define se second;
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define forin(i, n) for (auto& i : (n))
#define make_unique(x) sort(all((x))); (x).erase(unique(all((x))), (x).end()

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

const int INF = 1 << 29;
const int MOD = 1e9 + 7;
 
int main() {
  int n;
  cin >> n;
  map<int,int> mapa;
  priority_queue<int, vector<int>, greater<int>> q;
  forn(i,n){
    int k;
    cin >> k;
    mapa[k]=i+1;
    q.push(k);
  }
  forn(i,n){
    int k = q.top();
    q.pop();
    cout << mapa[k] << ' ';
  }
  
}


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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{

  cin >> s;
  s[3] = '8';
  pr(s);
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  unsigned int bin;
  unsigned int result;

  cin >> bin;
  while(bin != 0){
    unsigned int masu;
    masu = (bin&0x4 != 0) ? 1 : 0;
    result +=  masu;
    //cout << bin << " " <<  masu << endl;
    bin = bin / 10;
  }
  cout << result << endl;
}

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

int main(){
  int A,B; cin >>A >>B;
  if (A==1) A=14;
  if (B==1) B=14;

  if (A>B) cout <<"Alice" <<endl;
  else if (A<B) cout <<"Bob" <<endl;
  else cout <<"Draw" <<endl;
}


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

typedef long long ll;

int
main(void){

  int n; cin >> n;
  int arr[n];
  int arrx[n][n];
  int arry[n][n];
  for(int i = 0; i < n; ++i){
    cin >> arr[i];
    for(int j = 0; j < arr[i]; ++j) {
      cin >> arrx[i][j];
      arrx[i][j] -= 1;
      cin >> arry[i][j];
    }
  }

  int ans = 0;
  for(int bit = 0; bit < (1 << n); ++bit){
    bool flag = true;
    for(int i = 0; i < n; ++i){
      if(bit & (1 << i)){
        for(int j = 0; j < arr[i]; ++j){
          if(arry[i][j] == 0 && bit & (1 << arrx[i][j])){
            flag = false;
          } 
          if(arry[i][j] == 1 && !(bit & (1 << arrx[i][j]))){
            flag = false;
          } 
        }
      }
    }
    if(flag){
      int count = 0;
      for(int i = 0; i < n; ++i){
        if(bit & 1 << i) ++count;
      }
      if(ans < count){
        ans = count;
      }
    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

const int VMAX=100010;
int V,E,start,goal;
vector<pair<double,int>> edge[VMAX];
double dist[VMAX];
bool used[VMAX];

void dijkstra(){
    // 距離をLINFで初期化
    rep(to,VMAX) dist[to]=LINF;
    // 始点は0
    dist[start]=0;
    // フラグを下げる
    rep(v,VMAX) used[v]=false;
    // 優先度付きキュー:[距離,頂点]←距離の昇順
    priority_queue<pair<double,int>,vector<pair<double,int>>,greater<pair<double,int>>> q;
    // 距離0,始点
    q.push({0,start});
    // dijkstra
    while(q.size()){
        // 取り出してd=距離,v=頂点
        pair<double,int> p=q.top(); q.pop();
        double d=p.first;
        int from=p.second;
        if(used[from]) continue;
        used[from]=true;
        // 頂点から出る辺すべてについて
        for(auto e:edge[from]){
            double cost=e.first;
            int to=e.second;
            // 短縮できるとき
            if(d+cost<dist[to]){
                dist[to]=d+cost;
                q.push({dist[to],to});
            }
        }
    }
}

int main(){
    vector<pair<double,pair<double,double>>> v;
    double sx,sy,gx,gy; cin>>sx>>sy>>gx>>gy;
    int n; cin>>n;
    v.push_back({0,{sx,sy}});
    rep(i,n){
        double x,y,r; cin>>x>>y>>r;
        v.push_back({r,{x,y}});
    }
    v.push_back({0,{gx,gy}});
    start=0,goal=n+1;
    rep(i,n+2){
        double r1=v[i].first,x1=v[i].second.first,y1=v[i].second.second;
        rep(j,n+2){
            double r2=v[j].first,x2=v[j].second.first,y2=v[j].second.second;
            double d=max(0.0,sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))-(r1+r2));
            // cout<<d<<endl;
            edge[i].push_back({d,j});
            edge[j].push_back({d,i});
        }
    }
    dijkstra();
    // rep(i,n+2) cout<<dist[i]<<endl;
    printf("%.10f\n",dist[goal]);
    return 0;
}


Measured memory_bytes: 41840
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var an = readLine()!!.split(" ").map { it.toLong() }


    while (true) {
        var minValue = Long.MAX_VALUE
        var minIndex = 0
        for ((i, v) in an.withIndex()) {
            if (v != 0L && v < minValue) {
                minValue = v
                minIndex = i
            }
        }
        var newlist = mutableListOf<Long>()
        var allzero = true
        for ((i, v) in an.withIndex()) {
            if (i == minIndex) {
                newlist.add(v)
            } else {
                val q = v % minValue
                if (q == 1L) {
                    println(1)
                    return
                }
                if (q != 0L) {
                    allzero = false
                }
                newlist.add(q)
            }
        }
        if (allzero) {
            println(minValue)
            return
        }
        an = newlist
    }
}

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

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

using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<string> v(N);
  for(int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  sort(v.begin(), v.end());
  int cnt = 1;
  for(int i = 0; i < N-1; i++) {
    if(v.at(i) != v.at(i+1)) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 9596
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        vector<int> a(3);
        rep(i, 0, 3) cin >> a[i];

        sort(all(a));
        if (a.front() == a.back()) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
main = interact $ unlines . map (show . ac) . init . lines

ac = sum . compress change

change k1 k2 = if elem k1 left `xor` elem k2 left then 1 else 0
 where
  left = "qwertasdffgzxcvb"
  xor p q = (p || q) && not (p && q)

compress _ [x] = []
compress op (x1:x2:xs) = op x1 x2 : compress op (x2:xs)

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
int main(void){
    std::map<int, int> map;
    for (int x=1;x<=100;x++) {
        for (int y=1;y<=100;y++) {
            for (int z=1;z<=100;z++) {
                map[x*x+y*y+z*z+x*y+y*z+z*x]++;
            }
        }
    }
    int n;
    cin>>n;
    for (int i=1;i<=n;i++) {
        cout<<map[i]<<endl;
    }
}


Measured memory_bytes: 5440
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  map<int,int> mp;
  rep(i,n){
    mp[a.at(i)]++;
  }
  int ans = 0;
  for(auto p:mp){
    int x = p.first;
    int y = p.second;
    if(y<x){
      ans+=y;
    }else{
      ans+=y-x;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 5120
N = int(input())
A = list(map(int, input().split()))
sum_lst = [0] * N
sum_lst[-1] = A[-1]
for i in range(N-1, 0, -1):
    sum_lst[i-1] = sum_lst[i] + A[i-1]
# print(sum_lst)

ans = 0
for i in range(N-1):
    ans = (ans + A[i] * sum_lst[i+1]) % 1000000007
print(ans)

Measured memory_bytes: 31552
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;
 
int main() {
 
    int N; cin >> N;
 
    string pre1;
    cout << 0 << endl;
    cin >> pre1;
    if (pre1 == "Vacant") return 0;
    string pre2;
    cout << N - 1 << endl;
    cin >> pre2;
    if (pre2 == "Vacant") return 0;
    
    int l = 0, r = N - 1;
    while (r - l > 1) {
        int mid = (l + r) / 2;
        cout << mid << endl;
        string s; cin >> s;
        
        if (s == "Vacant") break;
        
        int dl = mid - l;
        if (dl % 2 == 1 && pre1 == s) {
            pre2 = s;
            r = mid;
            continue;
        }
        if (dl % 2 == 0 && pre1 != s) {
            pre2 = s;
            r = mid;
            continue;
        }

        int dr = r - mid;
        if (dr % 2 == 1 && pre2 == s) {
            pre1 = s;
            l = mid;
            continue;
        }
        if (dr % 2 == 0 && pre2 != s) {
            pre1 = s;
            l = mid;
            continue;
        }
    }

    return 0;
}

Measured memory_bytes: 852
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    VI A(N);
    REP(i,N) cin >> A[i];
    VI B = A;
    sort(B.begin(),B.end());
    map<int,int> mp;
    REP(i,N){
        mp[B[i]] = i;
    }
    int cnt = 0;
    REP(i,N){
        if(i%2 != mp[A[i]]%2) cnt++;
    }
    cout << cnt/2 << endl;

}


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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;
typedef vector<unordered_map<lli,lli>> graph;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    char a;
    cin >> a;
    if(a == 'A') puts("T");
    if(a == 'T') puts("A");
    if(a == 'C') puts("G");
    if(a == 'G') puts("C");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

int n, k, a[N], dp[2][N];

int f(int x, int d){
	int &r = dp[d][x];
	if(r != -1)
		return r;
	r = 1 - d;
	for(int i = 1; i <= n; i++){
		if(a[i] > x)
			continue;
		if(f(x - a[i], 1 - d) == d)
			r = d;
	}
	return r;
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	memset(dp, -1, sizeof dp);
	scanf("%d %d",&n ,&k);
	for(int i = 1; i <= n; i++)
		scanf("%d",a + i);
	if(f(k, 1))
		puts("First");
	else
		puts("Second");
	return 0;
}

Measured memory_bytes: 16256
import java.util.*

fun is_sq(n: Int): Boolean {
    val m = Math.sqrt(n.toDouble())
    val l = Math.floor(m)

    if (Math.abs(m - l) > 0.001) {
        return false
    } else {
        return true
    }
}

fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    val d = cin.nextInt()

    val a = Array<Array<Int>>(n, { Array<Int>(d, { cin.nextInt() }) })

    var ans = 0

    for (i in 0..n-2) {
        for (j in i+1..n-1) {
            var dist = 0
            for (k in 0..d-1) {
                dist += (a[i][k] - a[j][k])*(a[i][k] - a[j][k])
            }
            if (is_sq(dist)) {
                ans += 1
            }
        }
    }
    println(ans)
}

Measured memory_bytes: 31136
#include<stdio.h>

int main(){

int n[1001]={};
int m[1001]={};
int mm,nn,x;

scanf("%d %d",&nn,&mm);
for(int i=0;i<nn;i++)
scanf("%d",&n[i]);

for(int i=0;i<mm;i++)
{scanf("%d",&x);
for(int j=0;j<nn;j++)
	if(x>=n[j]){m[j]++;break;}
}
int t=0,tt=0;
for(int i=0;i<1000;i++)
	if(m[i]>tt){tt=m[i];t=i+1;}

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

return 0;
}

Measured memory_bytes: 1032
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <atcoder/all>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace atcoder;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 300;
const int K = 100000;
const int mod = 1e9 + 7;
int ans[N][N];
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, k;
    cin >> n >> k;
    mcf_graph <int, int> g(2 * n + 3);
    g.add_edge(2 * n + 2, 2 * n, n * k, 0);
    g.add_edge(2 * n, 2 * n + 1, n * k, 1e9);
    for (int i = 0; i < n; i++){
        g.add_edge(2 * n, i, k, 0);
        g.add_edge(n + i, 2 * n + 1, k, 0);
    }
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            int x;
            cin >> x;
            g.add_edge(i, n + j, 1, (int)1e9 - x);
        }
    }
    auto x = g.flow(2 * n + 2, 2 * n + 1);
    cout << x.F * (int)1e9 - x.S << endl;
    auto e = g.edges();
    for (auto x: e){
        if (x.flow == 1){
            if (x.to < 2 * n && x.from < 2 * n){
                ans[x.from][x.to - n] = 1;
            }
        }
    }
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            if (ans[i][j]){
                cout << "X";
            } else{
                cout << ".";
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 4060
#include <stdio.h>
int main(void)
{
    int a,b,op,i;
    for(i=0;i<=20000;i++){
    scanf("%d %c %d",&a,&op,&b);
    if(0<=a&&a<=20000&&0<=b&&b<=20000){
        if(op=='+'){
            printf("%d\n",a+b);
        }
        if(op=='-'){
            printf("%d\n",a-b);
        }
        if(op=='*'){
            printf("%d\n",a*b);
        }   
        if(op=='/'){
            printf("%d\n",a/b);
        }
        if(op=='?') break;
    }}
    return 0;
}


Measured memory_bytes: 2048
/******************************************
* AUTHOR : SHASHANK *
* NICK : lance_lot *
* INSTITUTION : BIT MESRA *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define N 100005
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl "\n"
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <ll, ll> pll;
const ll M=1e9+7;
ll inf=1e18;
ll w[105],v[105];
ll n;
ll dp[105][100005];
ll rec(ll i,ll V) {
    if(i >= n) {
        if(V == 0)
            return 0;
        return inf;
    }
    if(dp[i][V] != -1)
        return dp[i][V];
    if(V-v[i] >= 0)
        dp[i][V] = min(w[i]+rec(i+1,V-v[i]),rec(i+1,V));
    else
        dp[i][V] = rec(i+1,V);
    return dp[i][V];
}

int main() {
fast;
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll W;
    cin>>n>>W;
    for(ll i = 0;i < n;i++)
        cin>>w[i]>>v[i];
    for(ll i = 0;i < 105;i++) {
        for(ll j = 0;j < 100005;j++)
            dp[i][j] = -1;
    }
    ll ans = 0;
    ll curr = 0;
    for(ll i = 100000;i >= 0;i--) {
        curr = rec(0,i);
        if(curr <= W) {
            ans = i;
            break;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 82304
#include <bits/stdc++.h>
using namespace std;
 
bool chkx(vector<int> a,int x);

int main() {
  
  bool isFind = false,ism = true;
  int x = 0,n = 0,ans = 0;
  cin >> x >> n;
  cerr << x << " " << n << endl;
  vector<int> m(n);
  for(int i = 0;i<n;i++){
    cerr << i << endl;
    cin >> m.at(i);
    cerr << "raw" <<m.at(i) << endl;
    
  }
  //sort(m.begin(),m.end());
  if(chkx(m,x) == false){
    isFind = true;
    cout << x << endl;//配列になければｘを出力
  }
  int j = 1;//-にしない
  while(isFind == false){
    cerr << "while " << j << endl;
    if(chkx(m,x - j) == false){
      ans = x - j;
      isFind == true;
      cout << ans << endl;
      break;
    }
    if(chkx(m,x + j) == false){
      ans = x + j;
      isFind == true;
      cout << ans << endl;
      break;
    }
    j++;
  }
  
  
  
  
}
bool chkx(vector<int> a, int x){//xがあるか調べる trueならある
  for(int i : a){
    if(i == x) return true;
  }
  cerr << "false" << endl;
  return false;
}

      
      

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

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int i,three,th_h,th_t;
		for(i=3;i<=x;i++)
		{
			three=i/10;
			th_h=i/100;
			th_t=i/1000;
			if(i%3==0)
			{
				System.out.printf(" %d",i);
			}
			else if((three%10==3)||(th_h%10==3)||(th_t%10==3)||(i%10==3))
			{
				System.out.printf(" %d",i);
			}
		}
		System.out.printf("\n");
	}
}

Measured memory_bytes: 40712
N ,M = map(int, input().split())
ps = [list(input().split()) for i in range(M)]

ac = [0 for i in range(N)]
wa = [0 for i in range(N)]

for i in range(M):
    s = int(ps[i][0])-1
    if ps[i][1] == "WA" and ac[s] == 0:
        wa[s] += 1

    if ps[i][1] == "AC" and ac[s] == 0:
        ac[s] = 1

for i in range(N):
    if ac[i] == 0:
        wa[i] = 0

print(str(sum(ac)) + " " + str(sum(wa)))


Measured memory_bytes: 29576
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
vector<pair<int,int> >g[2100];
int v[2100];
int dp[2100];
int dp2[2100][2100][2][2];
int lis[2100];
int co[2100][2100];
int val[2100];
int sz;
void dfs(int a){
	lis[sz++]=a;
	v[a]=1;
	for(int i=0;i<g[a].size();i++){
		if(!v[g[a][i].first])dfs(g[a][i].first);
	}
}
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	for(int i=0;i<a;i++)for(int j=0;j<a;j++)co[i][j]=0;
	for(int i=0;i<b;i++){
		int p,q,r;scanf("%d%d%d",&p,&q,&r);
		p--;q--;
		g[p].push_back(make_pair(q,r));
		g[q].push_back(make_pair(p,r));
		if(r==0)co[p][q]=co[q][p]=114514;
		else co[p][q]=co[q][p]=r;
	}
	for(int i=0;i<2100;i++)dp[i]=-999999999;
	dp[0]=0;
	for(int i=0;i<a;i++){
		if(g[i].size()==0){
			v[i]=1;
			for(int j=c-1;j>=0;j--)dp[j+1]=max(dp[j+1],dp[j]);
		}
	}
	for(int i=0;i<a;i++){
		if(!v[i]&&g[i].size()==1){
			sz=0;
			dfs(i);
			for(int j=0;j<=sz;j++){
				for(int k=0;k<=sz;k++)for(int l=0;l<2;l++)for(int m=0;m<2;m++)
					dp2[j][k][l][m]=-999999999;
			}
			dp2[1][0][0][0]=0;
			dp2[1][1][1][1]=0;
			for(int j=1;j<sz;j++){
				for(int k=0;k<sz;k++)for(int l=0;l<2;l++)for(int m=0;m<2;m++){
					dp2[j+1][k][0][m]=max(dp2[j+1][k][0][m],dp2[j][k][l][m]);
					if(l&&co[lis[j-1]][lis[j]]==114514)continue;
					dp2[j+1][k+1][1][m]=max(dp2[j+1][k+1][1][m],dp2[j][k][l][m]+l*co[lis[j-1]][lis[j]]);
				}
			}
			for(int j=0;j<=sz;j++)val[j]=-999999999;
			for(int j=0;j<=sz;j++)for(int l=0;l<2;l++)for(int m=0;m<2;m++)
				val[j]=max(val[j],dp2[sz][j][l][m]);
			
			for(int j=2050;j>=0;j--){
				for(int k=0;k<=sz&&j+k<=c;k++){
					dp[j+k]=max(dp[j+k],dp[j]+val[k]);
				}
			}
		}
	}
	for(int i=0;i<a;i++){
		if(!v[i]){
			sz=0;
			dfs(i);
			for(int j=0;j<=sz;j++){
				for(int k=0;k<=sz;k++)for(int l=0;l<2;l++)for(int m=0;m<2;m++)
					dp2[j][k][l][m]=-999999999;
			}
			dp2[1][0][0][0]=0;
			dp2[1][1][1][1]=0;
			for(int j=1;j<sz;j++){
				for(int k=0;k<sz;k++)for(int l=0;l<2;l++)for(int m=0;m<2;m++){
					dp2[j+1][k][0][m]=max(dp2[j+1][k][0][m],dp2[j][k][l][m]);
					if(l&&co[lis[j-1]][lis[j]]==114514)continue;
					if(j==sz-1&&m&&co[lis[j]][lis[0]]==114514)continue;
					dp2[j+1][k+1][1][m]=max(dp2[j+1][k+1][1][m],dp2[j][k][l][m]+l*co[lis[j-1]][lis[j]]);
				}
			}
			for(int j=0;j<=sz;j++)val[j]=-999999999;
			for(int j=0;j<=sz;j++)for(int l=0;l<2;l++)for(int m=0;m<2;m++){
				val[j]=max(val[j],dp2[sz][j][l][m]+m*l*co[lis[sz-1]][lis[0]]);
			}
			for(int j=2050;j>=0;j--){
				for(int k=0;k<=sz&&j+k<=c;k++){
					dp[j+k]=max(dp[j+k],dp[j]+val[k]);
				}
			}
		}
	}
//	for(int i=0;i<=c;i++)printf("%d\n",dp[i]);
	if(dp[c]<-99999999)printf("Impossible\n");
else	printf("%d\n",dp[c]);
}

Measured memory_bytes: 85180
a,b = list(map(int,input().split()))
x = list(range(int(a//0.08+1), int((a+1)//0.08+1)))
y = list(range(int(b//0.1+1), int((b+1)//0.1+1)))
z = list(set(x) & set(y))
if not z:
  print(-1)
else:
    print(min(z))

Measured memory_bytes: 3064
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}


int gcd(int a,int b){
  if(a%b)return gcd(b,a%b);
  else return b;
}
int main(){
  int n;cin>>n;
  int mx = 0;
  int sm = 0;
  for(int i = 0; n > i; i++){
    int t;cin>>t;
    mx = max(mx,t);
    sm += t;
  }
  cout << sm-mx/2 << endl;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

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

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...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int n; cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int a; cin >> a;
		if (a % 2 == 1 and i % 2 == 1) ans++;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3188
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	int v[3]; 

	REP(i,3) scanf("%d", &v[i]);

	sort(v,v+3);

	bool ans = false;
	if(v[0] == 5 and v[1] == 5 and v[2] == 7) ans = true;

	if(ans) printf("YES\n");
	else printf("NO\n");


	return 0;

}


Measured memory_bytes: 256