akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int dist[2000];set<int>p[2000];
vector<pair<int,int>> vec[2000];
int n,m;
bool used2[2000];
vector<int>R[2000][2000];
int dst[2000][2000];
vector<int>shor[2000];
void dijkstra(int s){
	for(int i=0;i<2000;i++){dist[i]=999999999;p[i].clear();}
	priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>Q;
	Q.push(make_pair(0,s));dist[s]=0;
	while(!Q.empty()){
		int a1=Q.top().first,a2=Q.top().second;Q.pop();
		for(int i=0;i<(int)vec[a2].size();i++){
			int to=vec[a2][i].first,cost=vec[a2][i].second;
			if(dist[to]>a1+cost){
				p[to].clear();p[to].insert(a2);
				dist[to]=a1+cost;
				Q.push(make_pair(dist[to],to));
			}
			if(dist[to]==a1+cost && p[to].count(a2)==0){
				p[to].insert(a2);
			}
		}
	}
	for(int i=0;i<2000;i++){
		dst[s][i]=dist[i];
		for(auto a3 : p[i]){
			R[s][i].push_back(a3);
		}
	}
}
void solve(int s){
	queue<int>Q;
	bool used[2000];for(int i=0;i<2000;i++)used[i]=false;
	for(int i=0;i<(int)shor[s].size();i++){Q.push(shor[s][i]);used[shor[s][i]]=true;}
	while(!Q.empty()){
		int a1=Q.front();Q.pop();
		
		for(int i=0;i<R[s][a1].size();i++){
			int a2=R[s][a1][i];
			if(used[a2]==false){used[a2]=true;Q.push(a2);}
		}
	}
	for(int i=1;i<=n;i++){if(used[i]==true)used2[i]=true;}
}
int main(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int a,b,c;cin>>a>>b>>c;
		vec[a].push_back(make_pair(b,c));
		vec[b].push_back(make_pair(a,c));
	}
	for(int i=1;i<=n;i++)dijkstra(i);
	int maxn=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			maxn=max(maxn,dst[i][j]);
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(dst[i][j]==maxn)shor[i].push_back(j);
		}
	}
	for(int i=1;i<=n;i++)solve(i);
	int num=0;
	for(int i=1;i<=n;i++){if(used2[i]==false)num++;}
	cout<<num<<endl;
	for(int i=1;i<=n;i++){if(used2[i]==false)cout<<i<<endl;}
	return 0;
}

Measured memory_bytes: 191128
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def main():
    rr = []

    def f(p, q, a, n):
        r = 0
        fr = fractions.Fraction(p,q)
        q = [(fr, 0, 1)]
        if fr.numerator == 1 and fr.denominator <= a:
            r += 1
        n1 = n-1
        for i in range(1, 70):
            nq = []
            ti = fractions.Fraction(1, i)
            i2 = (i+1) ** 2
            for t, c, m in q:
                mik = m
                tt = t
                for k in range(1, n-c):
                    mik *= i
                    tt -= ti
                    if tt <= 0 or a < mik * i:
                        break
                    if tt.numerator == 1 and tt.denominator >= i and mik * tt.denominator <= a:
                        r += 1
                    if c+k < n1 and mik * (i ** max(math.ceil(tt / ti), 2)) < a:
                        nq.append((tt, c+k, mik))
                if m * (i ** max(math.ceil(t / ti), 2)) < a:
                    nq.append((t,c,m))
            if not nq:
                break
            q = nq
        return r

    while True:
        p, q, a, n = LI()
        if p == 0 and q == 0:
            break
        rr.append(f(p, q, a, n))

    return '\n'.join(map(str, rr))



print(main())



Measured memory_bytes: 9096
#include<iostream>
#include<cstring>
using namespace std;
bool x[10000];int a,b,c,d,e,p;
int main(){
	while(true){memset(x,true,10000);
		cin>>a>>b>>c;if(a==0){break;}
		d=a-1;
		x[c-1]=false;p=c-1;
		while(d>=2){
			e=b%d;if(e==0){e=d;}
			for(int i=0;i<e;i++){
				while(true){
					p++;
					if(x[p%a]==true){
						break;
					}
				}
			}
			x[p%a]=false;d--;
		}
		for(int i=0;i<a;i++){if(x[i]==true){p=i;}}cout<<p+1<<endl;
	}
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int main(){
  	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n,ans; cin>>n;
  	vector<int> v(n+1);  ans=0;
  	for(int i=1;i<=n;i++){ cin>>v[i];
        if(i%2==1 && v[i]%2==1) ans++;
                         }
  	cout<<ans;
 	return 0;
}
  

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
const int MAXN = 1000001;
int32_t main(){
    SPEED;
    string s;
    cin >> s;
    int ans = 0;
    string temp = "", cur = "";
    for(char c: s){
        cur += c;
        if(temp != cur) {
            ans++;
            temp = cur;
            cur = "";
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3748
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());

string foo(int a,int b,int c){
	if(max(a,max(b,c))==100) return "A";
	if((a+b)/2>=90) return "A";
	if((a+b+c)/3>=80) return "A";
	if((a+b+c)/3>=70) return "B";
	if((a+b+c)/3>=50&&max(a,b)>=80) return "B";
	return "C";
}


int main(){
	int n;
	while(cin>>n,n){
		int a,b,c;
		rep(i,n){
			cin>>a>>b>>c;
			cout<<foo(a,b,c)<<endl;
		}
	}
}

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

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

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

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

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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

template <typename T1, typename T2> 
inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  map<int, int> mp;
  rep(i, n) {
    int cnt;
    cin >> cnt;
    rep(j, cnt) {
      int a;
      cin >> a;
      mp[a]++;
    }
  }
  int ans = 0;
  for(auto x : mp) {
    if(x.second == n)
      ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3596
N, M, X = map(int, input().split())
a_point = list(map(int,input().split()))
lg = 0
sl = 0
for i in range(len(a_point)):
    if X < a_point[i]:
        lg  += 1
    else:
        sl += 1

if lg > sl:
    print(sl)
else:
    print(lg)


Measured memory_bytes: 9152
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<fstream>
#include<utility>
#include<bitset>
#define rep(N) for (int i = 0; i < N; i++)
#define For(i, N) for (i = 0; i < N; i++)
#define rev(N) 	for (int i = N - 1; i >= 0; --i)
#define all(v) v.begin(), v.end()
#define mod 1000000007
#define re return 0

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;

template<typename T>
void say(T s) {
	cout << s << endl;
}

template<typename T1, typename T2>
void say(T1 s1, T2 s2) {
	cout << s1 << " " << s2 << endl;
}

int main() {
	int N;
	int a;
	int ans;
	vi A1, A2;
	int a1, a2;
	cin >> N;
	rep(N) {
		cin >> a;
		A1.push_back(a);
	}
	rep(N) {
		cin >> a;
		A2.push_back(a);
	}
	a1 = A1[0];
	a2 = 0;
	for (int x : A2)a2 += x;
	ans = a1 + a2;
	for (int i = 1; i < N; ++i) {
		a1 += A1[i];
		a2 -= A2[i - 1];
		ans = max(ans, a1 + a2);
	}
	say(ans);
}



Measured memory_bytes: 256
#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 << ' ';
  pr(b);
}

int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{

  int a;
  cin >> a;
  if (a == 1)
    pr("Hello World");
  else
  {
    int a, b;
    cin >> a >> b;
    pr(a + b);
  }

  return 0;
}


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

#define ll long long
#define pb push_back

const int maxn = 2e3 + 20;
const int mod = 924844033;

int dp[maxn][maxn][2][2] , t[maxn] , fac[maxn] , pd[maxn] , tmp[maxn];

void mkay(int &a)
{
	if(a >= mod)
		a -= mod;
	else if(a < 0)
		a += mod;
}

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

	fac[0] = 1;
	for(int i = 1; i < maxn; i++)
		fac[i] = 1LL * fac[i - 1] * i % mod;

	int n , k;
	cin >> n >> k;

	for(int i = 0; i < n; i++)
		t[i % k]++;

	dp[1][0][0][0] = 1;

	for(int i = 2; i <= n; i++)
		for(int j = 0; j <= i; j++)
		{
			if(!j)
			{
				dp[i][j][0][0] = 1;
				continue;
			}

			for(int x = 0; x < 2; x++)
				for(int y = 0; y < 2; y++)
					mkay(dp[i][j][0][0] += dp[i - 1][j][x][y]);
			mkay(dp[i][j][0][1] = dp[i - 1][j - 1][0][1] + dp[i - 1][j - 1][0][0]);
			mkay(dp[i][j][1][0] = dp[i - 1][j - 1][1][0] + dp[i - 1][j - 1][0][0]);

			if(j >= 2)
				mkay(dp[i][j][1][1] = dp[i - 1][j - 2][0][0]);

			int s = 0;
			for(int x = 0; x < 2; x++)
				for(int y = 0; y < 2; y++)
					mkay(s += dp[i][j][x][y]);
		}

	int sum = 0;
	pd[0] = 1;

	for(int i = 0; i < k; i++)
	{
		for(int j = 0; j <= t[i]; j++)
			for(int k = 0; k <= sum; k++)
			{
				int s = 0;
				for(int x = 0; x < 2; x++)
					for(int y = 0; y < 2; y++)
						mkay(s += dp[t[i]][j][x][y]);
				
				mkay(tmp[j + k] += 1LL * s * pd[k] % mod);
			}

		sum += t[i];

		for(int j = 0; j <= sum; j++)
			pd[j] = tmp[j] , tmp[j] = 0;
	}

	int res = 0;
	for(int i = 0; i <= n; i++)
	{
		tmp[i] = (i % 2? 1 : -1);

		mkay(res += (1LL * -tmp[i] * fac[n - i] % mod) * pd[i] % mod);
	}

	cout << res << endl;
}


Measured memory_bytes: 61952
k,i,j,b[999];
main(n)
{
  for(;scanf("%d%d",&n,&k),n;)
    {
      for(i=0;i<k;i++)
	scanf("%d",&b[i]);
      for(;n--;)
	for(j=0;j<k;j++)
	  scanf("%d",&i),b[j]-=i;
      for(i=0;i<k-1;i++)
	if(b[i]<0)break;
      puts(b[i]<0?"No":"Yes");
    }
  exit(0);      
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main()
{
    string s,s1="abcdefghijklmnopqrstuvwxyz";
    int i,j,open=0;
    while(getline(cin,s))
    {
        sort(s.begin(),s.end());
        for(j=0;j<s1.size();j++)
        {
            open=0;
        for(i=0;i<s.size();i++)
        {
            if(s1[j]==s[i])
            {
                open=1;
                break;
            }
        }
        if(open==0)
        {
            printf("%c\n",s1[j]);
            break;
        }
        }
        if(j==s1.size())printf("None\n");
        s.clear();
        open=0;
    }
    return 0;
}


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

int calc(stack<int> &s, string op) {
  int a = s.top();
  s.pop();
  int b = s.top();
  s.pop();

  // switch case でかけなかった
  if (op == "+") {
    s.push (b + a);
  } else if (op == "-") {
    s.push (b - a);
  } else {
    s.push (b * a);
  }
}

int main() {
  string S;
  stack<int> s;

  while (cin >> S) {
    if (S == "+" || S == "-" || S == "*") {
      calc(s, S);
    } else {
      s.push(stoi(S));
    }
  }

  cout << s.top() << endl;
}



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

const int INF = 1e9;

int main() {
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  long ans=0;
  for(int i=0;i<n;i++) ans+= a[i]-1;
  cout<<ans<<endl;

}


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

using namespace std;

int main(){
    int n,m;
    int p[100000],y[100000];
    vector<int> yd[100001];

    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> p[i] >> y[i];
        yd[p[i]].push_back(y[i]);
    }
    for(int i = 0; i < n; i++){
        sort(yd[i+1].begin(),yd[i+1].end());
    }
    for(int i = 0; i < m; i++){
        int tmp = p[i];
        cout << setfill('0') << setw(6) << tmp;

        int ans = lower_bound(yd[p[i]].begin(), yd[p[i]].end(), y[i]) - yd[p[i]].begin() + 1;
        cout << setfill('0') << setw(6) << ans << endl;
    }
}


Measured memory_bytes: 7808
import scala.io.StdIn.{readInt, readLine}

object Main extends App {
  val n = readInt
  val nodes = Array.fill[Node](n)(new Node)
  for (_ <- 0 until n) {
    val Array(id, left, right) = readLine.split(" ").map(_.toInt)
    nodes(id).id = id
    nodes(id).left = left
    nodes(id).right = right
    if (left != -1) setSibling(nodes, id, left, right)
    if (right != -1) setSibling(nodes, id, right, left)
  }
  nodes.filter(_.parent == -1).foreach(rootNode => {setDepth(nodes, rootNode.id, depth = 0)})
  nodes.filter(_.degree == 0).foreach(leafNode => {setHeight(nodes, leafNode.id, height = 0)})
  println(nodes.mkString("\n"))

  def setSibling(nodes: Array[Node], id: Int, siblingId: Int, otherSiblingId: Int): Unit = {
    nodes(id).degree += 1
    nodes(siblingId).parent = id
    nodes(siblingId).sibling = otherSiblingId
  }

  def setDepth(nodes: Array[Node], id: Int, depth : Int): Unit = {
    nodes(id).depth = depth
    if (nodes(id).left != -1) setDepth(nodes, nodes(id).left, depth + 1)
    if (nodes(id).right != -1) setDepth(nodes, nodes(id).right, depth + 1)
  }

  def setHeight(nodes: Array[Node], id: Int, height : Int): Unit = {
    nodes(id).height = Math.max(nodes(id).height, height)
    if (nodes(id).parent != -1) {
      setHeight(nodes, nodes(id).parent, nodes(id).height + 1)
    }
  }

  class Node {
    var id = -1
    var parent = -1
    var sibling = -1
    var left = -1
    var right = -1
    var degree = 0
    var depth = 0
    var height = 0
    override def toString: String = {
      val nodeType = {
        if (parent == -1) "root"
        else if (degree == 0) "leaf"
        else "internal node"
      }
      s"node ${id}: parent = ${parent}, sibling = ${sibling}, degree = ${degree}, depth = ${depth}, height = ${height}, ${nodeType}"
    }
  }
}



Measured memory_bytes: 44152
// Created by ...
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'

#define vll vector< ll >
#define M 100000
#define MD 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= b; ++i)
#define fo(i,a,b) for(int i = a; i<= b; ++i)
#define pii pair<ll,ll> 
#define vec(a) vector<a >
#define all(a) a.begin(),a.end()
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;
using ll = long long;
ll md=MD;

ll exp(ll a,ll b){ll r=1ll;while(b>0){if(b&1){r=r*(a%md);r=(r+md)%md;}b>>=1;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll Min(ll a,ll b){if(a<b)return a; return b;}
ll Max(ll a,ll b){if(a>b)return a; return b;}
int32_t main() {
    IOS;

        ll n;
        cin>>n; string ans;
        while(n>0)
        {
        	--n;
        	ans+=('a'+n%26);
        	n/=26;
        }
        reverse(all(ans));
        cout<<ans;
        cout<<'\n';
    return 0;
}

Measured memory_bytes: 3668
N = int(input())
L = sorted(list(map(int, input().split())))
ans = [1 for i in range(N-2) for j in range(i+1, N-1) for k in range(j+1, N) if L[i]!=L[j] and L[j]!=L[k] and L[i]+L[j]>L[k]]
print(len(ans))

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define Mod 1000000007
#define REP(i,a,b) for (int i = a; i <= b; i++)

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    double x,t;
    vector<int>v(n);
    for(int i=0;i<n;i++) cin>>v[i];
    sort(v.begin(),v.end());
    x=v[0];
    for(int i=1;i<n;i++){
        t=v[i];
        x=(x+t)/2;
    }
    cout<<fixed<<setprecision(6)<<(x);
    return 0;
}


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

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

int main()
{
	int n,cnt;
	cnt = 0;
	cin >> n;
	int a[n];
	REP(i,n) cin >> a[i];

	bool flg = true;
	REP(i,n) {
		flg=true;
		while(flg){
			flg=false;
			if(a[i]%2==0) {
				a[i] = a[i]/2;
				cnt++;
				flg=true;
			}
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

#define max 8
#define Free -1
#define Not_Free 1

void initialize();
void printBoard();
void recursive(int);

int row[max];
int col[max];
int dpos[2 * max - 1];
int dneg[2 * max - 1];
int data[max][max];

int main(){
  int i,j,k,r,c;
  initialize();

  for(i = 0;i < max;i++){
    for(j = 0;j < max;j++){
      data[i][j] = 0;
    }
  }

  scanf("%d",&k);

  for(i = 0;i < k;i++){
    scanf("%d%d",&r,&c);
    data[r][c] = 1;
  }
  recursive(0);
  return 0;
}

void initialize(){
  int i;

  for(i = 0;i < max;i++){
    row[i] = Free;
    col[i] = Free;
  }

  for(i = 0;i < 2 * max - 1;i++){
    dpos[i] = Free;
    dneg[i] = Free;
  }
}

void printBoard(){
  int i,j;

  for(i = 0;i < max;i++){
    for(j = 0;j < max;j++){
      if(data[i][j]){
        if(row[i] != j){
          return;
        }
      }
    }
  }

  for(i = 0;i < max;i++){
    for(j = 0;j < max;j++){
      if(row[i] == j){
        printf("Q");
      }
      else{
        printf(".");
      }
    }
      printf("\n");
  }
}

void recursive(int i){
  int j;

  if(i == max){
    printBoard();
    return;
  }

  for(j = 0;j < max;j++){
    if(Not_Free == col[j] || Not_Free == dpos[i + j] || Not_Free == dneg[i - j + max - 1]){
      continue;
    }
    row[i] = j;
    col[j] = dpos[i + j] = dneg[i - j + max - 1] = Not_Free;
    recursive(i + 1);
    row[i] = col[j] = dpos[i + j] = dneg[i - j + max - 1] = Free;
  }
}



Measured memory_bytes: 2104
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
pA = []

for a in A:
    heapq.heappush(pA, -a)

for m in range(M):
    a = heapq.heappop(pA)
    heapq.heappush(pA, -(-a // 2))

print(-sum(pA))


Measured memory_bytes: 14180
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<string>

using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i=0;i<n;++i) cin >> s[i];
  int c1,c2,c3,c4;
  c1 = 0;
  c2 = 0;
  c3 = 0;
  c4 = 0;
  
  for(int i=0;i<n;++i){
    if(s[i] == "AC") c1++;
    if(s[i] == "WA") c2++;
    if(s[i] == "TLE") c3++;
    if(s[i] == "RE") c4++;
  }
  cout<<"AC x "<<c1<<endl;
  cout<<"WA x "<<c2<<endl;
  cout<<"TLE x "<<c3<<endl;
  cout<<"RE x "<<c4<<endl;
}

Measured memory_bytes: 6424
# input including new line and return list of int
def get_include_new_line_input():
	pass
	N = int(input())
	a = []
	for x in range(N):
		a.append(int(input()))
	return a


# input splitted by space and return list of int
def get_spilitted_space_input():
	a = list(map(lambda x:int(x), input().split()))
	return a

# input is list of num
# output is string meaning the sign
def which_sign(a):
	if a[0] <= 0 and 0 <= a[1]:
		return 'Zero'
	elif a[0] > 0:
		return 'Positive'
	else :
		if (a[1] - a[0]) % 2 == 0:
			return 'Negative'
		else:
			return 'Positive'

if __name__ == '__main__':
	input_list = get_spilitted_space_input()
	print(which_sign(input_list))


Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<map>
#include<set>
using namespace std;
int main()
{
	int L,R;
	while( scanf(" %d %d",&L,&R) != EOF ){
		int k = 1,flag = 0;
		int sum = 0,temp = R;
		for( int i = 0 ; ; i++ ){
			sum += (temp % 10) * k;
			k *= 10;
			temp /= 10;
			if( temp == 0 && flag == 0 ){
				temp = L;
				flag = 1;
			}
			else if( temp == 0 && flag == 1 )	break;
		}
		int M = sqrt(sum);
		if( M * M == sum )
			printf("Yes\n");
		else
			printf("No\n");
	}
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int H = sc.nextInt();
		int N = sc.nextInt();

		int[] A = new int[N];
		int[] B = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			B[i] = sc.nextInt();
		}

		sc.close();

		int[][] dp; 

		dp = new int[N + 10][H + 10010];

		for (int i = 0; i < dp.length; i++) {
			Arrays.fill(dp[i], Integer.MAX_VALUE >> 1);
		}

		for (int i = 0; i <= N; i++) {
			dp[i][0] = 0;
		}

		for (int i = 0; i < N; i++) {
			for (int j = 0; j < dp[i].length; j++) {
				dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j]);
				if (j >= A[i]) {
					dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i + 1][j - A[i]] + B[i]);
				}
			}
		}

		int ans = Integer.MAX_VALUE;
		for (int j = H; j < dp[N].length; j++) {
			ans = Math.min(ans, dp[N][j]);
		}
		out.println(ans);

	}

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


Measured memory_bytes: 128164
// IlyM

#include <bits/stdc++.h>
#define pb push_back
#define sp " "
#define sl "\n"
#define fi first
#define se second
#define mp make_pair
#define sz(a) ((int)a.size())
#define tra(a,b) for (auto a:b) 
#define fo(a,b,c) for (int a=b;a<=c;a++) 
#define ms(a,b) memset(a,b,sizeof(a)) 
#define all(a) a.begin(),a.end()
#define rev(a) reverse(a.begin(),a.end())
#define bit(i,j) (i&(1<<j))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;

const int N=2e5+5,mod=998244353;
ll n,a,b;
int main()
{
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	cin>>n;
	fo(i,1,n) if (i%3!=0 && i%5!=0) b+=i;
	cout<<b;
	return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;int a[205];int main(){int n;cin>>n;for(int i=0;i<n;i++){int k,p=0;cin>>k;while(k%2==0)p++,k/=2;a[i]=p;}sort(a,a+n);cout<<a[0]<<'\n';return 0;}

Measured memory_bytes: 256
def examA():
    D,T,S = LI()
    if (D-1)//S<T:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 77084
#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;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  string s;
  cin >> s;
  int siz = s.length();
  char cur = s[siz-1];
  int ans = 0;
  for (int i = siz-2; i >= 0; --i) {
    if (s[i] != cur) {
      ans++;
      cur = s[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;

#define lsc(x)      scanf("%lld",&x)
#define sc(x)       scanf("%d",&x)
#define lpr(x)      printf("%lld ",x)
#define pr(x)       printf("%d ",x)
#define n_l         printf("\n")
#define VI          vector<int>
#define VII         vector<long long int>
#define MI          map<int, int>
#define PI          pair<int, int>
#define m_p         make_pair
#define pb          push_back
#define fi           first
#define se           second
#define mset(x,y)   memset(x,y,sizeof(x))
#define sz(v)       (int)v.size()
#define all(v)      v.begin(), v.end()
#define fr(i, a, n) for(int i=a;i<=n;i++)
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
const int N=(int)1e5+5;
const int mod = 1000000007;
typedef long long ll;
// order_of_key (val): returns the no. of values strictly less than val
// find_by_order (k): returns the kth largest element iterator.(0-based)
// vector<int>::iterator itr=lower_bound(v.begin(),v.end(),x);
// s.substr(pos[0-indexed], len(default=till end))
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::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 trace(...)
#endif
ll dp[105][N], a[N];
int main(){
    int n, k;sc(n);sc(k);
    fr(i,1,n) lsc(a[i]);
    fr(i, 0, a[1]) dp[1][i] = 1;
    fr(i, 1, n) dp[i][0]=1;
    fr(i, 2, n){
        fr(j, 1, k){
            dp[i][j] = (dp[i][j-1] + dp[i-1][j])%mod;
            if (j>a[i]) dp[i][j] = (dp[i][j]+mod-dp[i-1][j-a[i]-1])%mod;
        }
    }
    lpr(dp[n][k]);
    return 0;
}



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

x = int(input())

def cond(x):
    q, r = x // 100, x % 100
    q5, r5 = r // 5, r % 5
    if r5 == 0:
        return q >= q5
    else:
        return q >= q5 + 1

if cond(x):
    print(1)
else:
    print(0)


Measured memory_bytes: 61644
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

typedef complex<double> P;

double cross(P a, P b) {
    return imag(conj(a) * b);
}

double dot(P a, P b) {
    return real(conj(a) * b);
}

// 0: counter-clockwise
// 1: clockwise
// 2: online_back
// 3: online_front
// 4: on_segment
int ccw(P p0, P p1, P p2) {
    if (cross(p1 - p0, p2 - p0) > 0) return 0;
    if (cross(p1 - p0, p2 - p0) < 0) return 1;
    if (dot(p1 - p0, p2 - p0) < 0) return 2;
    if (dot(p0 - p1, p2 - p1) < 0) return 3;
    return 4;
}

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

    double x0, y0, x1, y1;
    cin >> x0 >> y0 >> x1 >> y1;
    P p0(x0, y0), p1(x1, y1);
    int q;
    cin >> q;
    while (q--) {
        double x2, y2;
        cin >> x2 >> y2;
        P p2(x2, y2);
        switch (ccw(p0, p1, p2)) {
            case 0: cout << "COUNTER_CLOCKWISE" << endl; break;
            case 1: cout << "CLOCKWISE" << endl; break;
            case 2: cout << "ONLINE_BACK" << endl; break;
            case 3: cout << "ONLINE_FRONT" << endl; break;
            case 4: cout << "ON_SEGMENT" << endl; break;
        }
    }

}

Measured memory_bytes: 3300
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	int[] A;
	int N;
	boolean result = true;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		N = Integer.parseInt(in.readLine());
		A = new int[N];
		String[] tokens = in.readLine().split(" ");
		for (int i = 0; i < N; ++i) {
			A[i] = Integer.parseInt(tokens[i]);
		}
	}

	void calc() {
		for (int i = 0; i < N; ++i) {
			if (A[i] % 2 == 0) {
				if (A[i] % 3 == 0 || A[i] % 5 == 0) {

				} else {
					result = false;
				}
			}
		}
	}

	void showResult() {
		System.out.println(result ? "APPROVED" : "DENIED");
	}
}


Measured memory_bytes: 22100
x, y, z, k = map(int, input().split())
m = []
for _ in range(3):
    m.append(sorted(list(map(int, input().split())), reverse=True))
 
def sorted_sum(list_a, list_b):
    s = []
    for x in list_a:
        for y in list_b:
            s.append(x + y)
    return sorted(s, reverse=True)
 
ans = sorted_sum(sorted_sum(m[0], m[1])[0:k], m[2])[0:k]
for i in range(0, k):
    print(ans[i])

Measured memory_bytes: 185336
# ABC084B - Postal Code
a, b = list(map(int, input().rstrip().split()))
s = input()
if s[a] != "-":
    print("No")
else:
    for i in range(a + b + 1):
        if i == a:
            continue
        if s[i] not in "0123456789":
            print("No")
            break
    else:
        print("Yes")

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

int main() {
  cout << setprecision(20);
  int n; 
  cin >> n;
  vector<int> v(n);
  rep(i, n) {
    cin >> v[i];
  }
  vector<int> v_sorted = v;
  sort(v_sorted.begin(), v_sorted.end());
  int count = 0;
  rep(i, n) {
    if (v_sorted[i] != v[i]) count++; 
  }
  if (count == 2 || count == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

vector<int> a;

int main()
{
    int n;
    cin>>n;
    REP(i,n) {
        int ta;
        cin>>ta;
        a.push_back(ta);
    }
    //SORT(a);
    int ans = a[0];
    REP(i,n-1) {
        while (a[i] != a[i+1]) {
            if (a[i] < a[i+1]) {
                a[i+1] = (a[i+1] % a[i] == 0) ? a[i] : a[i+1] % a[i];
            } else {
                a[i] = (a[i] % a[i+1] == 0) ? a[i+1] : a[i] % a[i+1];
            }
        }
    }
    cout<<a[n-1]<<endl;

    return 0;
}


Measured memory_bytes: 892
from heapq import heappop, heappush


def dijkstra(costs, s, i):
    q = [(0, s)]
    while q:
        c, v = heappop(q)
        if costs[v] >= 0:
            continue
        costs[v] = c
        for link in links[v]:
            u = link[0]
            if costs[u] == -1:
                heappush(q, (c + link[i], u))


n, m, s, t = map(int, input().split())
links = [set() for _ in range(n)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    links[u - 1].add((v - 1, a, b))
    links[v - 1].add((u - 1, a, b))
s -= 1
t -= 1
yen_costs = [-1] * n
snk_costs = [-1] * n
dijkstra(yen_costs, s, 1)
dijkstra(snk_costs, t, 2)
total_costs = list(map(sum, zip(yen_costs, snk_costs)))
tmp = float('inf')
ans = []
ini = int(1e15)
for c in reversed(total_costs):
    tmp = min(tmp, c)
    ans.append(ini - tmp)
ans.reverse()
print('\n'.join(map(str, ans)))


Measured memory_bytes: 79700
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int a,b;
    cin>>a>>b;

    if(b>=a)
    {
        cout<<"unsafe"<<endl;
    }
    else
    {
        cout<<"safe"<<endl;
    }



    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll a, b, t;
  cin >> a >> b >> t;
  cout << b * (t/a) << 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)
        {

            int inputCount =  int.Parse(Console.ReadLine());

            List<int> numList = new List<int>();
            foreach (string tmp in Console.ReadLine().Split(' ')) {
                numList.Add(int.Parse(tmp));
            }

            bool flag = true;
            foreach (int num in numList) {
                if (num % 2 == 0) {
                    if (num % 3 != 0 && num % 5 != 0) {
                        flag = false;
                    }
                }
            }
            if (flag)
            {
                Console.WriteLine("APPROVED");
            }
            else { 
                Console.WriteLine("DENIED");
            }
        }
    }
}

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


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

int main(){
    long N;
    cin>>N;
    vector<long> P(0);
    
    for(long p=2;p<=N;p++){
        bool prime=true;
        for(int i=2;i<p;i++){
            if(p%i==0) prime=false;
        }
        if(prime) P.push_back(p);
    }
    long pnum=P.size();
    
    
    
    vector<long> preed(pnum,1);
    for(int n=1;n<=N;n++){
        for(int i=0;i<pnum;i++){
            long tn=n;
            while(tn%P.at(i)==0){
                preed.at(i)++;
                tn/=P.at(i);
            }
        }
    }
    
    vector<long> pd(100,0);
    for(int i=0;i<100;i++){
        for(int j=0;j<pnum;j++){
            if(preed.at(j)>=i) pd.at(i)++;
        }
    }
    
    cout<<pd.at(75)+pd.at(25)*(pd.at(3)-1)+pd.at(15)*(pd.at(5)-1)+pd.at(5)*(pd.at(5)-1)*(pd.at(3)-2)/2<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

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

using ll = long long int;
using pll = pair<ll, ll>;

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

    cout << (1000LL - (N % 1000LL)) % 1000LL << endl;

    return 0;
}


Measured memory_bytes: 3616
N = int(input())
h = list(map(int,input().split()))
#print(h)

dp = [0]*N
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for n in range(2,N):
	step1 = abs(h[n]-h[n-1])+dp[n-1]
	step2 = abs(h[n]-h[n-2])+dp[n-2]
	dp[n] =  min(step1,step2)

ans = dp[N-1]
print(ans)


Measured memory_bytes: 52208
#include <stdio.h>
int main()
{
	int a[3], b, c;
	a[0], a[1], a[2];
	scanf("%d %d %d", &a[0], &a[1], &a[2]);
	if (a[0] > a[1]){
		b = a[0];
		a[0] = a[1];
		a[1] = b;
	}
	if (a[1] > a[2]){
		c = a[1];
		a[1] = a[2];
		a[2] = c;
	}
	if (a[0] > a[1]){
		b = a[0];
		a[0] = a[1];
		a[1] = b;
	}
	if (a[1] > a[2]){
		c = a[1];
		a[1] = a[2];
		a[2] = c;
	}
	printf("%d %d %d\n", a[0], a[1], a[2]);
	return 0;
}

Measured memory_bytes: 2712
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<tuple>

int const MAXN = 60;
double const eps = 5e-7;

int x[MAXN], y[MAXN], c[MAXN], c2[MAXN], ix[MAXN], N, K;
double d2[MAXN];

double min_possible(double x1, double y1, double r1) {
  for(int i = 0; i < N; ++i) {
    double dx = x[i] - x1, dy = y[i] - y1;
    dx = std::max(std::fabs(dx) - r1, 0.0); // min of abs in [dx - r1, dx + r1]
    dy = std::max(std::fabs(dy) - r1, 0.0); // similar
    d2[i] = (dx*dx + dy*dy)*c2[i];
    //d2[i] = std::hypot(dx, dy)*c[i];
  }
  std::nth_element(d2, d2+K-1, d2+N);
  return std::sqrt(d2[K-1]);
  //return d2[K-1];
}

double calc(double xx, double yy) {
  for(int i = 0; i < N; ++i) {
    double dx = x[i] - xx, dy = y[i] - yy;
    d2[i] = (dx*dx + dy*dy)*c2[i];
    //d2[i] = hypot(dx, dy)*c[i];
  }
  std::nth_element(d2, d2+K-1, d2+N);
  return std::sqrt(d2[K-1]);
  //return d2[K-1];
}

int main() {
  std::cin >> N >> K;
  for(int i = 0; i < N; ++i) {
    std::cin >> x[i] >> y[i] >> c[i];
    c2[i] = c[i]*c[i];
  }
  std::queue<std::tuple<double, double, double>> q;
  q.emplace(0.0, 0.0, 1000.0);
  double ans = 1e9;
  while(q.size() > 0) {
    double xx, yy, rr;
    std::tie(xx, yy, rr) = q.front(); q.pop();
    double d = min_possible(xx, yy, rr);
    if((ans-d) <= eps*std::max(d, 1.0)) continue;
    ans = std::min(ans, calc(xx, yy));
    for(double rx:{-0.5, 0.5}) for(double ry:{-0.5, 0.5}) {
      q.emplace(xx+rx*rr, yy+ry*rr, rr*0.5);
    }
  }
  std::cout << std::setprecision(10) << std::fixed << ans << std::endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdbool.h>

bool is_three(int n)
{
    return (n % 3 == 0);
}

bool include_three(int n)
{
    if (n % 10 == 3)
    {
        return true;
    }
    while (n)
    {
        n /= 10;
        if (n % 10 == 3)
        {
            return true;
        }
    }
    return false;
}

void call(int n) //nまでの3の倍数と3を含む数を返す
{
    for (int i = 1; i <= n; i++)
    {
        if (is_three(i) || include_three(i))
        {
            printf(" %d", i);
        }
    }
}

int main(void)
{
    int n;
    scanf("%d", &n);
    call(n);
    printf("\n");

    return 0;
}


Measured memory_bytes: 2736
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll a[128];
ll n, m;
ll cnt2, cnt1;

int main()
{
    cin>>n>>m;
    for(ll i = 0; i < n; i++)
    {
        string s;
        cin>>s;
        for(ll j = 0; j < m; j++)
        {
            a[s[j]]++;
        }
    }
    cnt1 = (n % 2) * (m % 2);
    cnt2 = (n % 2) * m / 2 + (m % 2) * n / 2;
    for(ll i = 'a'; i <= 'z'; i++)
    {
        a[i] %= 4;
        if(a[i] >= 2) cnt2--;
        if(a[i] % 2 == 1) cnt1--;
    }
    if(cnt2 >= 0 && cnt1 >= 0) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
/*
  Vivek Rathi
  CSE 2nd Year
  MNNIT
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inf 1e17
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
ll n,a[401];
ll dp[401][401];
ll solve(ll l,ll r)
{
	if(l==r) return a[l];
	if(dp[l][r]!=-1) return dp[l][r];
	ll mini=inf,sum=0;
	for(ll i=l;i<=r;i++) sum+=a[i];
	for(ll i=l;i<r;i++)
	{
		ll temp = (solve(l,i)+solve(i+1,r))+sum;
		mini=min(temp,mini);
	}
	return dp[l][r]=mini;
}
int main()
{
	boost
	cin>>n;
	ll sum=0;
	memset(dp,-1,sizeof(dp));
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	cout<<solve(0,n-1)-sum<<endl;
	return 0;
}

Measured memory_bytes: 1536
char s[10];
hit,score,out;
main(){
	scanf("%*d");
	for(;~scanf("%s",s);){
		if(strcmp(s,"HIT")==0)
			if(++hit==4)
				score++,hit--;
		if(strcmp(s,"HOMERUN")==0)
			score+=hit+1,hit=0;
		if(strcmp(s,"OUT")==0)
			if(++out==3)
				printf("%d\n",score),hit=score=out=0;
	}
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstring>
#define ll unsigned long long

ll ans=0;
int did[100000000];

void search(char s[],int ins[]){
  ll a=0,b=0,m=0;

  for(int i=0;s[i+1]!=0;i++){
    m = m*2+ins[i];
  }
  if(did[m]==1)
    return;
  did[m]=1;

  for(int i=0;s[i]!=0;i++){
    a = a*10 + s[i]-'0';
    if(ins[i]==1){
      b += a;
      a = 0;
    }
  }
  b += a;
  ans += b;

  for(int i=0;s[i+1]!=0;i++){
    ins[i]=1;
    search(s,ins);
    ins[i]=0;
  }
}

int main(void){

  char s[100];

  scanf("%s",s);

  int ins[100]={};

  search(s,ins);

  printf("%llu\n",ans);

  return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x, y;
    while(cin >> x >> y) {
        ll d = abs(abs(x) - abs(y));
        ll ans = LLONG_MAX;
        if(x + d == y)smin(ans, d);
        if(-(x + d) == y)smin(ans, d + 1);
        if(-x + d == y)smin(ans, d + 1);
        if(-(-x + d) == y)smin(ans, d + 2);
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int c[3][3];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++) cin>>c[i][j];
  }

for(int a1=0;a1<100;a1++){
  int b1=c[0][0]-a1;
  int b2=c[0][1]-a1;
  int b3=c[0][2]-a1;
  int a2=c[1][0]-b1;
  int a3=c[2][0]-b1;  
  bool flag=true;
  if(a1+b1!=c[0][0]) flag=false;
  else if(a1+b2!=c[0][1]) flag=false;
  else if(a1+b3!=c[0][2]) flag=false;
  else if(a2+b1!=c[1][0]) flag=false;
  else if(a2+b2!=c[1][1]) flag=false;
  else if(a2+b3!=c[1][2]) flag=false;
  else if(a3+b1!=c[2][0]) flag=false;
  else if(a3+b2!=c[2][1]) flag=false;
  else if(a3+b3!=c[2][2]) flag=false;
  if(flag==true){ cout<<"Yes"; return 0; }
}

  cout<<"No";

}


Measured memory_bytes: 256
// I look at my watch
// it say nine twenty-five
// And I think oh God
// I'm still alive
 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) int((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(int i = int(a); i < int(b); ++i)
#define roF(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
 
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld;




int main(){	
	ll n,k;cin>>n>>k;
	ll ini=1;
	ll ans=-1;
	vector<ii>vec(n);
	For(i,0,n){
		ll val,c;cin>>val>>c;
		vec[i]={val,c};
	}
	sort(all(vec));
	For(i,0,n){
		ll val=vec[i].ff,c=vec[i].ss;
		ll l=ini,r=ini+c;
		if(l<=k&&k<r){
			ans=val;
			break;
		}
		ini=r;
	}
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int N,a,b,s[100010],vistied[100010] = {},g;
ll c,dist[100010] = {};
vector<vector<pair<int,ll>>> v(100010);
vector<int> gs;

bool dfs1(int n){
	vistied[n] = 1;
	s[n] = 1;
	bool judge = true;
	for(auto x:v[n]){
		if(vistied[x.first]==0){
			dfs1(x.first);
			s[n] += s[x.first];
			if(s[x.first]>N/2) judge = false;
		}
	}
	if(N-s[n]>N/2) judge = false;
	if(judge) gs.push_back(n);
}

void dfs2(int n){
	for(auto x:v[n]){
		if(dist[x.first]==-1){
			dist[x.first] = dist[n] + x.second;
			dfs2(x.first);
		}
	}
}

int main(){
	cin >> N;
	for(int i=1;i<N;i++){
		cin >> a >> b >> c;
		v[a].push_back({b,c});
		v[b].push_back({a,c});
		dist[i] = -1;
	}
	dist[N] = -1;
	dfs1(1);
	g = gs[0];
	dist[g] = 0;
	dfs2(g);
	sort(dist+1,dist+N+1);
	ll ans = 0;
	for(int i=1;i<=N;i++){
		ans += 2*dist[i];
	}
	if(gs.size()==1) ans -= dist[2];
	else{
		for(auto x:v[gs[0]]){
			if(x.first==gs[1]) ans -= x.second;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 14720
#include <iostream>
#include <vector>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> t(N);
  int sum = 0;
  for(int i = 0; i < N; i++){
    cin >> t[i];
    sum += t[i];
  }
  int M;
  cin >> M;
  for(int i = 0; i < M; i++){
    int p, x;
    cin >> p >> x;
    cout << sum - t[p-1] + x << endl;
  }
  return 0;

}


Measured memory_bytes: 256