akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001; // > 10^9
const int MOD = (int)1e9 + 7;
const ll INFLL = 1001001001001001001;  // > 10^18
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {
  
  string s,t; cin >>s>>t;
  int a,b; cin >>a>>b;
  string u; cin >>u;

  if (u == s) {
    a -= 1;
  } else {
    b -= 1;
  }

  cout << a << " " << b << endl;
  
  return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int dp[300][300][301];

const int INF = 1e+5;

int main(){
    string S;
    int K;
    cin >> S;
    cin >> K;
    int N = S.size();
    for(int i = 0; i < N-1; i++){
        if(S[i] == S[i+1]) dp[i][i+1][2] = 0;
        else dp[i][i+1][2] = 1;
    }
    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            dp[i][j][0] = 0;
            dp[i][j][1] = 0;
        }
    }
    for(int k = 2; k <= N; k++){
        for(int i = 2; i < N; i++){
            for(int j = 0; i+j < N; j++){
                if(i+1 < k) continue;
                if(S[j] == S[j+i]) dp[j][j+i][k] = dp[j+1][j+i-1][k-2];
                else dp[j][j+i][k] = dp[j+1][j+i-1][k-2]+1;
                if(k <= i)dp[j][j+i][k] = min(min(dp[j+1][j+i][k], dp[j][j+i-1][k]), dp[j][j+i][k]);
                //cout << j << ' ' << j+i << ' ' << k << ' ' << dp[j][j+i][k] << endl;
            }
        }
    }
    int ans = 0;
    for(int k = 0; k <= N; k++){
        //cout << dp[0][N-1][k] << endl;
        if(dp[0][N-1][k] <= K) ans = k;
    }
    cout << ans << endl;
}

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

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> ac(n),wa(n);
  for(int i=0; i<m; i++){
    int p;
    string s;
    cin >> p >> s;
    p--;
    if(ac[p]) continue;
    if(s == "AC") ac[p] = 1;
    else wa[p]++;
  }
  int a=0,w=0;
  for(int i=0; i<n; i++) {
    a += ac[i];
    if(ac[i]) w += wa[i]; 
  }
  cout << a << " " << w << endl;
}

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

#define _USE_MATH_DEFINES

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <bitset>
#include <complex>
#include <limits>
#include <random>
#include<fstream>
#include<array>


using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;

const double EPS = 1e-9;

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

	int N, Q;
	cin >> N >> Q;

	int D = N, R = N;

	vector<pii> W, H;

	int ans = 0;
	int k, x;
	rep(i, 0, Q)
	{
		cin >> k >> x;
		if (k == 1)
		{
			int idx = lower_bound(all(W), mp(-x, INF)) - W.begin();
			if (idx == SZ(W))
			{
				ans += D - 2LL;
				R = x;
				W.push_back(mp(-x, D - 2LL));
			}
			else
			{
				ans += W[idx].second;
			}
		}
		else
		{
			int idx = lower_bound(all(H), mp(-x, INF)) - H.begin();
			if (idx == SZ(H))
			{
				ans += R - 2LL;
				D = x;
				H.push_back(mp(-x, R - 2LL));
			}
			else
			{
				ans += H[idx].second;
			}
		}
	}

	cout << (N - 2)*(N - 2) - ans << endl;

	return 0;
}


Measured memory_bytes: 7284
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = n / 2 + n % 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var cs = s.ToCharArray();
            bool isgood = true;
            for (int i = 1; i < cs.Length; i++)
            {
                if (cs[i] == cs[i - 1])
                {
                    isgood = false;
                }
            }
            if (isgood)
            {
                Console.WriteLine("Good");
            }
            else
            {
                Console.WriteLine("Bad");
            }
#if DEBUG
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
        }
    }
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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;}

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	string s;
	cin >> s;
	ll n=s.size();
	vvll dp(n+1,vll(13,0));
	dp[0][0]=1;
	rep(i,n){
		ll c=(s[i]=='?'?-1:s[i]-'0');
		rep(j,13){
			rep(k,10){
				if(c!=-1 && c!=k) continue;
				dp[i+1][(j*10+k)%13]+=dp[i][j];
			}
		}
		rep(j,13) dp[i+1][j]%=mod;
	}
	cout << dp[n][5] << endl;
	return 0;
}

Measured memory_bytes: 13568
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#include "cmath"
typedef long long ll;

int main(int argc, char const *argv[]) {
  ll A, B, K;

  std::cin >> A >> B >> K;

  for (size_t i = 0; i < K; i++) {
    if (i % 2 == 0) {
      if (A%2 == 1) {
        A += -1;
      }

      A /= 2;
      B += A;
    }else{
      if (B%2 == 1) {
        B += -1;
      }

      B /= 2;
      A += B;
    }




    // std::cout <<"iteration "<<"i"<<"  " <<A<<" "<<B << '\n';

  }

  std::cout << A<<" "<<B << '\n';


  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  bool a=false;
  for(int i=0;i<s.length();i++){
    if(s==t){
      a=true;
      break;
    }
    s=s.at(s.length()-1)+s.substr(0,s.length()-1);
  }
  if(a==true)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int change[24][6] = {
	{0,1,2,3,4,5},
	{0,2,4,1,3,5},
	{0,4,3,2,1,5},
	{0,3,1,4,2,5},
	{5,2,1,4,3,0},
	{5,4,2,3,1,0},
	{5,3,4,1,2,0},
	{5,1,3,2,4,0},
	{1,2,0,5,3,4},
	{1,0,3,2,5,4},
	{1,3,5,0,2,4},
	{1,5,2,3,0,4},
	{4,0,2,3,5,1},
	{4,3,0,5,2,1},
	{4,5,3,2,0,1},
	{4,2,5,0,3,1},
	{2,0,1,4,5,3},
	{2,4,0,5,1,3},
	{2,5,4,1,0,3},
	{2,1,5,0,4,3},
	{3,1,0,5,4,2},
	{3,0,4,1,5,2},
	{3,4,5,0,1,2},
	{3,5,1,4,0,2}
};
int n, x[100][6][24];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i][0][0] >> x[i][1][0] >> x[i][2][0] >> x[i][3][0] >> x[i][4][0] >> x[i][5][0];
		for (int j = 0; j < 24; j++) {
			for (int k = 0; k < 6; k++) {
				x[i][k][j] = x[i][change[j][k]][0];
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (i != j) {
				for (int k = 0; k < 24; k++) {
					for (int l = 0; l < 24; l++) {
						for (int m = 0; m < 6; m++) {
							if (x[i][m][k] != x[j][m][l]) {
								goto A;
							}
						}
						goto TRUE;
					A:;
					}
				}
			}
		}
	}
	goto FALSE;
TRUE:;
	cout << "No" << endl; goto Exit;
FALSE:; cout << "Yes" << endl;
Exit:;
	return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setpercision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
template<class T> inline bool chmin(T& a, T b){
    if(a>b){a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){
    if(a<b){a=b;return true;}return false;}
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    ll count=1;
    while(true){
        ll x,y;cin>>x>>y;
        if(x+y)cout<<min(x,y)<<" "<<max(x,y)<<endl;
        else break;
    }
    return 0;
}


Measured memory_bytes: 3084
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using static MyIO;


public class C
{
	public static void Main()	
	{
		int N = GetInt();
		int K = GetInt();
		int mask = 0;
		for(int i = 0; i < K; i++)
			mask |= (1 << GetInt());

		for(int ans = N; ; ans++)
		{
			int tmp = ans;
			int flag = 0;
			while(tmp > 0)
			{
				flag |= (1 << (tmp % 10));
				tmp /= 10;
			}
			if((flag & mask) == 0)
			{
				Console.WriteLine(ans);
				return;
			}
		}
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 11092
S = input()
T = input()

l = len(T)

if l == len(S):
    cnt = 0
    for i in range(l):
        if S[i] != T[i]:
            cnt += 1
    print(cnt)
    exit()

ans = []
for i in range(len(S)-l):
    cnt = 0
    for n in range(l):
        if S[i+n] != T[n]:
            cnt += 1
    ans.append(cnt)
    
print(min(ans))

Measured memory_bytes: 9060
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
// const int mod=998244353;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

class UnionFind {
private:
	std::vector<int> par;
	std::vector<int> siz;
 
public:
	UnionFind(int sz_) : par(sz_), siz(sz_, 1) {
		for (int i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(int sz_) {
		par.resize(sz_);
		siz.resize(sz_, 1);
		for (int i = 0; i < sz_; ++i) par[i] = i;
	}
	int find(int x) {
		while (par[x] != x) x = par[x] = par[par[x]];
		return x;
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (siz[x] < siz[y]) std::swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		return siz[find(x)];
	}
};

void run(){
    int n,m;
    cin>>n>>m;
    UnionFind uf(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        uf.unite(a,b);
    }
    int ans=0;
    rep(i,n){
        ans=max(ans,uf.size(i));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6368
import sys


input = sys.stdin.readline

n, m = map(int, input().split())
broken = set()
for i in range(m):
    a = int(input())
    broken.add(a)

pattern = [0]*(n+1)
pattern[0] = 1
if 1 in broken:
    pattern[1] = 0
else:
    pattern[1] = 1

for i in range(2, n+1):
    if i in broken:
        pattern[i] = 0
    else:
        pattern[i] = pattern[i-1] + pattern[i-2]

print(pattern[n] % (10**9+7))


Measured memory_bytes: 460020
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;

class union_find {
private:
    vector<int> par;
    vector<int> ran;
    vector<ll> size;
public:
    union_find(int n);
    int find(int x);
    void unite(int x, int y);
    bool same(int x, int y);
    ll show_size(int x);
};

union_find::union_find(int n){
    par.resize(n);
    ran.resize(n);
    size.resize(n);
    REP(i,n) par[i] = i;
    REP(i,n) ran[i] = 0;
    REP(i,n) size[i] = 1;
};

int union_find::find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
};

void union_find::unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    ll t = show_size(x)+show_size(y);
    size[x] = size[y] = t;
    if (ran[x] < ran[y]) {
        par[x] = y;
        //size[y] += size[x];
    } else {
        par[y] = x;
        //ize[x] += size[y];
        if (ran[x]==ran[y]) ran[x]++;
    }
};

ll union_find::show_size(int x) {
    if (par[x] == x) return size[x];
    return show_size(par[x] = find(par[x]));
}

bool union_find::same(int x, int y) {
    return (find(x) == find(y));
};

int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    vector<int> b(m);
    REP(i,m) {
        int A, B;
        cin >> A >> B;
        a[i] = --A; b[i] = --B;
    }
    vector<ll> ans(m);
    union_find uf(n);
    ll fai = ((ll)n*(n-1))/2;
    ans[m-1] = fai;
    for (int i = m-2; i >= 0; --i) {
        if(!uf.same(a[i+1], b[i+1])) {
            ans[i] = ans[i+1]-uf.show_size(a[i+1])*uf.show_size(b[i+1]);
            uf.unite(a[i+1], b[i+1]);
        }
        else ans[i] = ans[i+1];
    }
    REP(i,m) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 4480
s=input()
l=len(s)
S=str()

cnt=0
ck=0

for i in range(l):
    if ck==l-1:
        if s[ck]==S:
            break
        else:
            cnt+=1
        break
    if i==0:
        cnt=cnt+1
        S=s[0]
        ck+=1
        continue
    if s[ck]==S:
        S=s[ck]+s[ck+1]
        ck=ck+2
        cnt=cnt+1
        if ck==l:
            break
        else:
            continue
    if s[ck]!=S:
        S=s[ck]
        ck=ck+1
        cnt=cnt+1
        continue

print(cnt)

Measured memory_bytes: 41948
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: August 19,2019
 * 
 */

#include <climits>
#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>
#include <cassert>
#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(x) for(auto i=0 ; i<(x); ++i)
#define _rep(a,b) for(auto i=(a); i<(b); ++i)
#define ef else if
#define wh while
#define el else
#define ivv(x) int x; cin>>x
#define lv(x) bint x; cin>>x
#define sv(x) string x; cin>>x
#define cv(x) char x; cin>>x
#define fv(x) float x; cin>>x
#define dv(x) double x; cin>>x
#define endl '\n'
using namespace std;




auto SOLUTION_FUNCTION( void ) ->void {
    // your solution goes here 
    ivv(n);
    vi v(n);
    iv(v);
    sort(all(v));
    double x = ((double)(v.at(0)+v.at(1)))/2.0f;
    for(int i=2;i<(int)v.size();++i){
        x = (x + (double)v.at(i))/2.0f;
    }
    cout<<x<<endl;

    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("input","r",stdin);
    freopen("output","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;

int32_t main(){
    IOS;
    int r;
    cin>>r;
    cout<<r*r<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<unordered_set>
#include<vector>
#include<math.h>
#include<iomanip>

using namespace std;

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

	int k, x;
	cin >> k >> x;
	if (k * 500 >= x) cout << "Yes";
	else cout << "No";
	
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define N 100005
using namespace std;
int a[N],b[N],n,m,d[N],c[N],n1,f[N];
map <int,int> h;
bool bz[N];
int getf(int k)
{
	if(f[k]==0||f[k]==k) return k;
	return (f[k]=getf(f[k])); 
}
int main()
{
	cin>>n;
	int v=0;
	fo(i,1,n) scanf("%d",&a[i]),v^=a[i],c[i]=a[i];
	a[n+1]=c[n+1]=v;
	bool pd=0;
	v=0;
	fo(i,1,n) scanf("%d",&b[i]),d[i]=b[i],v^=b[i];
	b[++n]=d[n]=v;
	sort(c+1,c+n+1),sort(d+1,d+n+1);
	n1=0;
	fo(i,1,n) 
	{
		if(c[i]!=d[i]) 
		{
			printf("-1\n");
			return 0;
		}
		if(h.count(c[i])==0) h[c[i]]=++n1;
		if(h.count(d[i])==0) h[d[i]]=++n1; 
	}
	int ans=0;
	fo(i,1,n) 
	{
		a[i]=h[a[i]],b[i]=h[b[i]];
		if(a[i]!=b[i]) 
		{
			if(i<n) ans++;
			int fx=getf(a[i]),fy=getf(b[i]);
			f[fx]=fy;
			bz[fx]=1,bz[fy]=1;
		}
	}
	if(ans==0) printf("0\n");
	else
	{
		bz[a[n]]=bz[b[n]]=1;
		fo(i,1,n1) if(bz[i]&&getf(i)==i) ans++;
		printf("%d\n",ans-1);
	}
}

Measured memory_bytes: 8576
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;
int main(){
  ll X;
  cin>>X;
  ll N = X;
  ll sum = 0;
  while(X!=0){
    sum+=X%10;
    X/=10;
    }
  if(N%sum==0)
    cout<<"Yes"<<endl;
  else 
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
p=lambda x:print(x,end="");a,b,c,d=map(int,input().split());l="URDL";e,f=d-b,c-a;
for i in[0,2]:p(l[i]*e+l[i+1]*(f))
for i in[0,2]:p(l[(i+3)%4]+l[i]*(e+1)+l[i+1]*(f+1)+l[(i+2)%4])

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
struct word
{
    std::string s;
    int count;
};

int main()
{
    long n, max = 0;

    std::cin >> n;
    std::vector<std::string> ans;
    std::map<std::string, int> words;
    std::string tmp;
    int i;
    for (i = 0; i < n; i++)
    {
        std::cin >> tmp;
        if (words.count(tmp) == 0)
        {
            words[tmp] = 1;
        }
        else
        {
            words[tmp]++;
        }
        if (words[tmp] == max)
        {
            ans.push_back(tmp);
        }
        else if (words[tmp] > max)
        {
            ans.clear();
            ans.push_back(tmp);
            max = words[tmp];
        }
    }

    std::sort(ans.begin(), ans.end());

    for (int i = 0; i < ans.size(); i++)
    {
        std::cout << ans[i] << std::endl;
    }
}

Measured memory_bytes: 27248
use std::env;
use std::io::*;
use std::str::*;
use std::mem;
use std::collections::HashMap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn read_char() -> char {
    let c = read::<String>();
    let c = c.chars().collect::<Vec<char>>();
    c[0]
}
fn read_String_Vec() -> Vec<char> {
    let S = read::<String>();
    S.chars().collect::<Vec<char>>()
}

fn vecchar_to_String(Vs: Vec<char>) -> String {
    let mut S = String::new();
    for i in 0..Vs.len() {
        S.push(Vs[i]);
    }
    S
}

/*
A : 65
Z : 90
a : 97
z : 122
*/

/*
let N = read::<i32>();
let S = read::<String>();
let S = read_String_Vec();
let C = read_char();
*/

/*
 .to_string() : * -> String
 &*S          : String -> &str
*/

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let S = read::<String>();
    let len = S.len();
    for i in 1..len {
        let length = len/2 - i;
        let (first, last) = S.split_at(length);
        let (second, last) = last.split_at(length);
        if first == second {
            println!("{}", length*2);
            break;
        }
    }


}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ll long long
using namespace std;
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second&&a.first<b.first);
}

void solve(){
    int n,x=0,ma=0;
    string s;
    cin>>n>>s;
    for(int i=0;i<n;i++){
        if(s[i]=='I')
            x++;
        else
            x--;
        ma=max(x,ma);
    }
    cout<<ma;
}


int main(){
    /*int t;
    cin>>t;
    while(t--)*/
        solve();


    return 0;
}
































































//1-(3+5-2+(3+19-(3-1-4+(9-4-(4-(1+(3)-2)-5)+8-(3-5)-1)-4)-5)-4+3-9)-4-(3+2-5)-10




















Measured memory_bytes: 3612
s = gets.chomp

unless s == s.reverse
  print "No"
  exit
end

n = s.size

f = s[0..((n - 1) / 2) - 1]
unless f == f.reverse
  print "No"
  exit
end

b = s[(n + 3) / 2 - 1 .. -1]
unless b == b.reverse
  print "No"
  exit
end

print "Yes"

Measured memory_bytes: 1788
Module Module1

    Sub Main()

        Dim S As String = Console.ReadLine()
        Dim ans As Boolean = kaibun(S)
        ans = ans And kaibun(Left(S, CInt((Len(S) - 1) \ 2)))
        ans = ans And kaibun(Mid(S, CInt((Len(S) + 3) \ 2)))

        If ans Then
            Console.WriteLine("Yes")
        Else
            Console.WriteLine("No")
        End If

    End Sub

    Function kaibun(s As String) As Boolean

        For i As Integer = 1 To CInt(Len(s) \ 2)
            If Mid(s, i, 1) <> Mid(s, Len(s) + 1 - i, 1) Then
                Return False
            End If
        Next

        Return True

    End Function

End Module


Measured memory_bytes: 21968
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1e6 + 5;
const ll MOD = 1e9 + 7;
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pis pair<ll,string>
#define F first
#define S second
#define LCM(a,b) ((a*b)/__gcd(a,b))
#define inf 1e15
#define test ll cse;cin>>cse;for(ll _i=1;_i<=cse;_i++)
#define PI 3.14159265
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const double EPS = 1E-9;
typedef vector< vector<double> > matrix;
typedef vector<int> vi;



int main() {
    fast;

    ll a, v;
    ll b, w;
    ll t;

    cin >> a >> v;
    cin >> b >> w;
    cin >> t;


    if(v <= w) cout << "NO\n";
    else {
        if((abs(a-b)+(v-w)-1)/(v-w) <= t) cout << "YES\n";
        else
            cout << "NO\n";
    }
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 
   
int main(){
    string s;
    cin >> s;
    bool a=false;
    bool b=false;
    int n=s.size();
    rep(i,n){
        if(s.at(i)=='C')a=true;
        if(s.at(i)=='F' && a)b=true;
    }
    if(a && b)cout << "Yes" << endl;
    else cout << "No" << endl;
} 

    

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))


ll calc(ll a,ll b,ll p){//a^(b) mod p   
	if(b==0)return 1;
	ll y = calc(a,b/2,p);y=(y*y)%p;
	if(b & 1) y = (y * a) % p;
	return y;
}
map<ll,ll> soinsubunkai(ll x){    // x = {first^second}*...
	map<ll,ll> ans;
	if(x==1){ans[1]++;return ans;}
	ll p=x;
	for(int i=2;i*i<=x;i++){
		while(p%i==0){
			p /= i;
			ans[i]++;
		}
	}
	if(p!=1)ans[p]++;
	return ans;
}
int main(){
	ll N;
	cin >> N;
	vector<ll> a(N);
	FOR(i,0,N) cin >> a[i];
	ll lc = 1;
	map<ll,ll> count;
	FOR(i,0,N){
		for(auto x:soinsubunkai(a[i])){
			count[x.first] = max(x.second,count[x.first]);
		}
	}
	for(auto x:count){
		lc *= calc(x.first,x.second,MOD);
		lc %= MOD;
	}
	ll ans = 0;
	FOR(i,0,N){
		ans += lc*calc(a[i],MOD-2,MOD);
		ans %= MOD;
	}
	cout << ans << endl;
}


Measured memory_bytes: 896
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

double l[30], a[30], b[30];
signed main() {
    double ans = 0.0;
    int n, m; cin >> n >> m;
    rep(i,0,n) cin >> l[i] >> a[i] >> b[i];
    rep(bit,0,1<<n) {
        if(__builtin_popcount(bit) != m) continue;
        vector<int> v;
        rep(i,0,n) if(bit >> i & 1) v.push_back(i);

        int sz = v.size();
        double temp = 0.0;
        rep(i,0,sz) rep(j,i+1,sz) {
            double x = fabs(l[v[i]] - l[v[j]]);
            double y = fabs(a[v[i]] - a[v[j]]);
            double z = fabs(b[v[i]] - b[v[j]]);
            temp += x*x + y*y + z*z;
        }
        ans = max(ans, temp);
    }
    printf("%.12f\n", ans);
    return 0;
}

Measured memory_bytes: 3340
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d[1000],f=0,g=0,h,i,j;
	scanf("%d",&a);
	for(i=0;i<9;i++) d[i]=0;
	for(i=0;i<a;i++){
		scanf("%d",&s);
		if(s<400) d[0]++;
		else if(s<800) d[1]++;
		else if(s<1200) d[2]++;
		else if(s<1600) d[3]++;
		else if(s<2000) d[4]++;
		else if(s<2400) d[5]++;
		else if(s<2800) d[6]++;
		else if(s<3200) d[7]++;
		else if(s>=3200) d[8]++;
	}
	for(i=0;i<8;i++) if(d[i]>0) f++;
	g=f+d[8];
	if(f==0) f=1;
	printf("%d %d\n",f,g);
	return 0;
}

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

    public class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(program1(new String[] { Console.ReadLine() }));
        }

        public static string program1(string[] args)
        {
            var sc = args[0].Split(' ').Select(long.Parse);
            var s = sc.First();
            var c = sc.Last();

            if (s * 2L <= c)
            {
                return (s + (c - s * 2L) / 4L) + "";
            }
            else
            {
                return (c / 2L) + "";
            }
        }
    }


Measured memory_bytes: 11348
N = int( input())
A = list( map( int, input().split()))
A.sort(reverse = True)
plus = 0
zero = 0
for i in range(N):
    if A[i] > 0:
        plus += 1
    elif A[i] == 0:
        zero += 1
minus = N - plus - zero
if plus + zero== N:
    print(sum(A)-A[-1]*2)
    now = A[-1]
    for i in range(N-2):
        print(now, A[i])
        now -= A[i]
    print(A[N-2], now)
elif minus + zero== N:
    print(A[0]*2 - sum(A))
    now = A[0]
    for i in range(1,N):
        print(now, A[i])
        now -= A[i]
elif plus+zero == 1:
    print( sum( list( map( abs, A))))
    now = A[0]
    for i in range(1,N):
        print(now, A[i])
        now -= A[i]
else:
    print( sum( list( map( abs, A))))
    now = A[N-1]
    k = N-1
    for i in range(1,N-1):
        if A[i] <= 0:
            k = i
            break
        print(now, A[i])
        now -= A[i]
    print(A[0], now)
    now = A[0] - now
    for i in range(k,N-1):
        if A[i] > 0:
            pass
        print(now, A[i])
        now -= A[i]

Measured memory_bytes: 14260
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}

struct UnionFind {
  private:
  vector<int> child,tree;
  vector<vector<int>> list;

public:
  UnionFind(int v) {
    tree.resize(v);
    list.resize(v);
    REP(i,v) tree[i] = i, list[i].push_back(i);
  }

  int root(int i){
    if(i == tree[i]){
      REP(j,child.size()) tree[child[j]] = i;
      child.clear(); 
      return i;
    }
    else{
      child.push_back(i);
      return i = root(tree[i]);
    }
  }

  int size(int i){
    return list[root(i)].size();
  }

  vector<int> nodes(int no){
    return list[root(no)];
  }

  bool unit(int x, int y){
    x = root(x);
    y = root(y);
    if(x==y) return false;
    if(list[x].size() < list[y].size()) swap(x,y);
    for(int no:list[y]) list[x].emplace_back(no);
    tree[y] = x;
    return true;
  }

  bool isUnit(int x, int y){
    return root(x) == root(y);
  }
};

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,m,k;
    cin>>n>>m>>k;
    UnionFind uf(n);
    vec tyoku(n);
    vec ans(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        tyoku[a]++;
        tyoku[b]++;
        uf.unit(a,b);
    }
    rep(i,n){
        ans[i]=uf.size(i)-tyoku[i];
    }
    rep(i,k){
        int c,d;
        cin>>c>>d;
        c--;d--;
        if(uf.isUnit(c,d)){
            ans[c]--;
            ans[d]--;
        }
    }
    rep(i,n){
        cout<<ans[i]-1<<endl;
    }
    
    
}

Measured memory_bytes: 10740
#include<iostream>
using namespace std;
string s;
char c;
main(){
  cin>>s;
  for(c='a';c<='z';c++){
    bool f=0;
    for(int i=0;i<s.size();i++)f|=c==s[i];
    if(!f){
      cout<<c<<endl;
      return 0;
    }
  }
  cout<<"None"<<endl;
}

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

using namespace std;

using lli = long long int;

lli f(lli A) {
    int mod = A%4;
    if(mod == 0) return A;
    if(mod == 1) return 1;
    if(mod == 2) return A+1;
    if(mod == 3) return 0;
}

int main() {
    lli A,B;
    cin >> A >> B;
    lli ans = f(B) ^ f(A-1);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#![allow(dead_code,unused_variables,unused_imports)]
use proconio::{fastout, input};
use proconio::marker::Chars;
use std::cmp::{max,min};
use std::collections::{HashSet,HashMap};

#[fastout]
fn main() {
    input!{
        a:f64,
        b:f64,
        h:f64,
        m:f64,
    }

    let long = 2f64 * std::f64::consts::PI * m / 60f64;
    let short = 2f64 * std::f64::consts::PI * (60f64 * h + m) / 720f64;

    let t_cos = (long - short).cos();
    let ans = a*a + b*b - 2f64*a*b*t_cos;
    println!("{:.12}",ans.sqrt());
}

Measured memory_bytes: 3056
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    char c[2][3];
    for(int i=0;i<2;i++){
        for(int j=0;j<3;j++)
            cin>>c[i][j];
    }
    bool abc=1;
    for(int i=0;i<3;i++)
    {
        if(c[0][i]!=c[1][2-i])
            abc=0;
    }
    if(abc==0)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define DEBUG
#ifdef DEBUG
#define debug(...) __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...);
	}
#else
#define debug(...)
#endif

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

#define FAST_IO std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define ld long double
#define sz(a) (ll)(a).size()
#define endl "\n"

// priority_queue<ll, vector<ll>, less<ll>>pq;     // Max Heap
// priority_queue<ll, vector<ll>, greater<ll>>pq;  // Min Heap

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest
//cout << k << "kth (1 based indexing) smallest: " << *A.find_by_order(k - 1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

const int MAXN = 1e5 + 5;
ll n, a, b, ans, h[MAXN];

bool check(ll tot)
{
	if(!tot) return false;
	ll val = 0;
	for(int i=0;i<n;i++)
	{
		if(h[i] <= tot * b) continue;
		ll temp = (h[i] - tot * b + a - b - 1) / (a - b);
		val += temp;
	}
	if(val <= tot) return true;
	return false;
}

ll bs(ll start, ll end)
{
	ll mid = (start + end) / 2;
	bool f1 = check(mid);
	bool f2 = check(mid - 1);
	if(f1 && !f2) return mid;
	else if(f2) end = mid - 1;
	else start = mid + 1;
	return bs(start, end);
}

int main()
{
	FAST_IO;

 	cin >> n >> a >> b;
 	for(int i=0;i<n;i++) cin >> h[i];
 	cout << bs(1, 1e9) << endl;
    return 0;
}

Measured memory_bytes: 4428
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        HashMap<Integer, Integer> count = new HashMap<>();
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
            int c = count.getOrDefault(a[i], 0);
            count.put(a[i], ++c);
        }
        long allpair = 0;
        for (int i : count.values()) {
            if (i > 0) {
                allpair += (long) i * ((long) i - 1) / 2;
            }
        }
        for (int i = 0; i < N; i++) {
            int num = a[i];
            if (count.get(num) > 1) {
                System.out.println(allpair - (count.get(num) - 1));
            } else {
                System.out.println(allpair);
            }
        }
    }
}

Measured memory_bytes: 126200
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def main():
    N, X = map(int, input().split())
    ans = 0
    mini = INF
    for _ in range(N):
        m = int(input())
        mini = min(mini, m)
        X -= m
        ans += 1

    print(ans + X // mini)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3956
#include<iostream>
#include<cmath> 
using namespace std;
const int maxn=100;
int main(){
	long long n,flag=11;
	cin>>n;
	if(n<=6) cout<<1;
	else if(n<=flag) cout<<2;
	else{
		if(n%flag==0) cout<<(n/flag)*2;
		else{
			long long temp=n%flag;
			long long cnt=n/flag;
			if(temp>6)
				cout<<2*cnt+2;
			else cout<<2*cnt+1;
		}
	}
	return 0;
} 

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    int counter = 0;

    while (input.ready())
    {
      String[] inputStr = input.readLine().split(" ");

      if (inputStr[0].equals("0") && inputStr[1].equals("0"))
      {
        break;
      }

      if (counter > 0)
      {
        System.out.println();
      }
      counter++;

      ArrayList<Integer> ansList = leapYearCount(Integer.parseInt(inputStr[0]),
          Integer.parseInt(inputStr[1]));

      if (ansList.size() == 0)
      {
        System.out.println("NA");
        continue;
      }

      for (Integer each : ansList)
      {
        System.out.println(each);
      }
    }

  }

  private static ArrayList<Integer> leapYearCount(int fromYear, int toYear)
  {
    ArrayList<Integer> yearList = new ArrayList<>();
    for (int i = fromYear; i <= toYear; i++)
    {
      if (isLeapYear(i))
      {
        yearList.add(i);
      }
    }
    return yearList;
  }

  private static boolean isLeapYear(int year)
  {
    if (year % 4 != 0)
    {
      return false;
    }
    
    if (year % 400 == 0)
    {
      return true;
    }

    if (year % 100 == 0)
    {
      return false;
    }
    
    return true;
  }
}

Measured memory_bytes: 25760
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long lcmValue = sc.nextLong();
    for (int i = 0; i < N-1; i++) {
      long t = sc.nextLong();
      lcmValue = lcm(t, lcmValue);
    }
    
    System.out.println(lcmValue);
  }
  
  private static long lcm(long a, long b) {
    long gcdValue = gcd(a, b);
    return a/gcdValue * b;
  }
  
  private static long gcd(long a, long b) {
    if (a < b) {
      long tmp = b;
      b = a;
      a = tmp;
    }
    if (b == 0) {
      return a;
    }
    return gcd(b, a % b);
  }
}

Measured memory_bytes: 23764
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>

using namespace std;

int main()
{
    int N, R;
    cin >> N >> R;
    if (N >= 10) {
        cout << R << endl;
    }
    else {
        cout << R + 100 * (10 - N) << endl;
    }
    return 0;
}

Measured memory_bytes: 256