akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)

struct Edge {
	int v, f, c;
	bool operator > (const Edge& e) const { return f > e.f; }
};

int c, n, m, s, d;
vector< vector< Edge > > edges;

int cost[111][11];

int djk() {
	for_(i,0,111) for_(j,0,11) cost[i][j] = (int)1e9;
	
	priority_queue< Edge, vector< Edge >, greater< Edge > > que;
	que.push(Edge{s, 0, c});
	cost[s][c] = 0;
	
	while (!que.empty()) {
		Edge e = que.top(); que.pop();
		
		for (Edge& ei : edges[e.v]) {
			if (cost[ei.v][e.c] > e.f + ei.f) {
				cost[ei.v][e.c] = e.f + ei.f;
				que.push(Edge{ei.v, e.f + ei.f, e.c});
			}
			
			if (e.c > 0 && cost[ei.v][e.c - 1] > e.f + ei.f / 2) {
				cost[ei.v][e.c - 1] = e.f + ei.f / 2;
				que.push(Edge{ei.v, e.f + ei.f / 2, e.c - 1});
			}
		}
	}
	
	int ans = (int)1e9;
	for_(i,0,11) ans = min(ans, cost[d][i]);
	
	return ans;
}

int main() {
	while (cin >> c >> n >> m >> s >> d, n) {
		--s; --d;
		
		edges.assign(n, vector< Edge >());
		
		for_(i,0,m) {
			int a, b, f;
			cin >> a >> b >> f;
			--a; --b;
			edges[a].push_back(Edge{b, f, 0});
			edges[b].push_back(Edge{a, f, 0});
		}
		
		cout << djk() << endl;
	}
}

Measured memory_bytes: 1272
#pragma region noncode
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SORT(v) sort(all(v))
#define TROS(v) sort(all(v), std::greater<Type>());
#pragma endregion

int main() {
    // template
    int m;cin>>m;
    cout<<48-m<<endl;
}


Measured memory_bytes: 3588
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

int main(){
    int n,k,q,ans=0;
    cin>>n>>k>>q;
    vector<int>a(1000000);
    vector<int>b(1000000);
    for(int i=0;i<n;i++){
        b[i]=k-q;
    }
    for(int i=0;i<q;i++){
    	cin>>a[i];
        b[a[i]-1]++;
    }
    for(int i=0;i<n;i++){
        if(b[i]<=0){
            cout<<"No"<<endl;
        }
        else{
            cout<<"Yes"<<endl;
        }
    }


   return 0;
}

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

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> d;
  vector<vector<int>> A;
  
  d.resize(K);
  A.resize(K,vector<int>());
  
  for(int i=0;i<K;i++){
    cin >> d[i];
    A[i].resize(d[i]);
    for(int j=0;j<d[i];j++){
      cin >> A[i][j];
    }
  }
  
  int ans=0;
  
  for(int i=1;i<=N;i++){
    bool have=false;
    for(int j=0;j<K;j++){
      for(int k=0;k<d[j];k++){
        if(i==A[j][k]){
          have=true;
        }
      }
    }
    if(have==false) ans++;
  }
  
  cout << ans << endl;
}


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

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
signed main(){
  char s;cin>>s;
  s+=1;
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var S, T string
	fmt.Scan(&S, &T)
	ans := len(T)
	for i := range S[:len(S)-len(T)+1] {
		tmp := 0
		for j, t := range T {
			if string(S[i+j]) != string(t) {
				tmp += 1
			}
		}
		if ans > tmp {
			ans = tmp
		}
	}
	fmt.Println(ans)
}


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

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

template <class T> using max_heap = priority_queue<T>;
template <class T> using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U> void chmax(T &a, U b) {
    if (a < b)
        a = b;
}
template <class T, class U> void chmin(T &a, U b) {
    if (b < a)
        a = b;
}

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 50);

void solve(long long N, long long K, std::vector<long long> p) {
    double ans = 0;
    double sum = 0;
    int cnt = 0;
    vector<double> q(N);
    rep(i, N) { q[i] = p[i] * (p[i] + 1) / 2.0 / (double)(p[i]); }
    rep(i, N) {
        if (cnt == K) {
            sum -= q[i - K];
            cnt--;
        }
        cnt++;
        sum += q[i];
        chmax(ans, sum);
    }
    cout << ans << endl;
}

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

    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    std::vector<long long> p(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &p[i]);
    }
    solve(N, K, std::move(p));
    return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <cmath>
using namespace std;
  
int main (void) {
  long double x1, y1, x2, y2, x3, y3, x4, y4;
  int n;
     
  cin >> n;
    
  for(int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long double t1 = (y1-y2)/(x1-x2);
    long double t2 = (y3-y4)/(x3-x4);
    //cout << t1 << " " << t2 << endl;
    if (t1==t2) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
    
  return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
//const int INF = 1e9;//INT_MAX=1<<31-1=2147483647
const ll INF = (ll)1e18;//1<<63-1=9223372036854775807
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define pb push_back
inline bool isnatural(double a) { return a>=0 && ceil(a)==floor(a); }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
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); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

signed main() {
	ll N,X;
	cin>>N>>X;
	vector<ll> ans(2*N-1,0);

	if(X==1||X==2*N-1){
		p("No");
		return 0;
	}

	if(N==2){
		ans[0]=1;
		ans[1]=2;
		ans[2]=3;
	}else if(X<2*N-2){
		ans[N-3]=X+2;
		ans[N-2]=X-1;
		ans[N-1]=X;
		ans[N]=X+1;
		ll c=1,i=0;
		while(c<2*N){
			if(c==X-1)c=X+3;
			if(ans[i]==0){
				ans[i]=c;
				c++;
			}
			i++;
		}
	}else{
		ans[N-3]=X-2;
		ans[N-2]=X+1;
		ans[N-1]=X;
		ans[N]=X-1;
		ll c=1,i=0;
		while(c<2*N-4){
			if(ans[i]==0){
				ans[i]=c;
				c++;
			}
			i++;
		}
	}

	p("Yes");
	rep(i,2*N-1)p(ans[i]);
	return 0;
}


Measured memory_bytes: 3072
from sys import stdin
n = int(stdin.readline().rstrip())
data = [[int(s) for s in stdin.readline().rstrip().split()] for _ in range(n)]
d = {}

for i in range(n):
  for j in range(i + 1, n):
    diff = (data[i][0] - data[j][0], data[i][1] - data[j][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1
    diff = (data[j][0] - data[i][0], data[j][1] - data[i][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1

if len(d) == 0:
  print(n)
else:
  print(n - max(d.values()))

Measured memory_bytes: 3444
#include <vector>
#include <iostream>
#include <algorithm>

using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::for_each;
using std::max_element;
using std::min_element;

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	for_each(v.begin(),v.end(),[](int &_e){cin >> _e;});
	int q; // amount of operations
	cin >> q;
	while (q--) {
		int op;
		int b;
		int e;
		cin >> op >> b >> e;
		if (op == 0) {
			cout << *min_element(v.begin() + b,v.begin() + e) << endl;
		}
		else {
			cout << *max_element(v.begin() + b,v.begin() + e) << endl;
		}
	}

}


Measured memory_bytes: 3104
n = int(input())
place = []
start_p = [0,0,0]
place.append(start_p)
for i in range(n):
    place.append(list(map(int, input().split())))

# print(place)

def can_reach(p1, p2):
    t = p2[0] - p1[0]
    dist =  abs(p2[1]-p1[1]) + abs(p2[2]-p1[2])
    if dist > t:
        return False
    elif dist == t:
            return True
    elif dist % 2 != t % 2:
            return False 
    elif can_reach(p1, [p2[0]-1, p2[1]+1, p2[2]]):
        return True
    elif can_reach(p1, [p2[0]-1, p2[1]-1, p2[2]]):
        return True
    elif can_reach(p1, [p2[0]-1, p2[1], p2[2]+1]):
        return True
    elif can_reach(p1, [p2[0]-1, p2[1], p2[2]-1]):
        return True
    else:
        return False

can = True
for i in range(n):
    if not can_reach(place[i], place[i+1]):
        can = False
        break

if can:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 27380
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void print(int l, int r) {
    if (l > r) swap(l,r);
    cout << l << " " << r << endl;
} 

void solve() {
    LL n,k;
    cin >> n >> k;
    if (k > (n-1)*(n-2)/2) {
        cout << -1 << endl;
        return;
    }

    cout << n - 1 + ((n-1)*(n-2)/2 - k) << endl;
    REP(i,0,n-1) print(i+1, n);
    int rem = (n-1)*(n-2)/2 - k;
    REP(i,0,n-1) REP(j,i+1,n-1) {
        if (rem-- <= 0) return;
        print(i+1, j+1);
    }
}

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <numeric>
#include <math.h>
#include <climits>
#include <stack>
#include <iomanip>
#include <sstream>

using namespace std;

template <typename T>
inline bool sign(T A) {
    return (A>0)-(A<0);
}
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SREP(i,s,n) for(int i=s; (n-i)*sign(n-s)>0; i+=sign(n-s))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

bool _less(pair<int, int> a, pair<int, int> b) {
    return a.second < b.second;
}

template <template<class,class,class...> class C, typename K, typename V, typename... Args>
V map_get(const C<K,V,Args...>& m, K const& key, const V & defval)
{
    typename C<K,V,Args...>::const_iterator it = m.find( key );
    if (it == m.end())
        return defval;
    return it->second;
}

#define MOD (1'000'000'000 + 7)



int main(void)
{
    ll K;
    cin >> K;
    vector<ll> A(K);
    REP(i, K) {
        cin >> A[i];
    }
    ll l = 2;
    ll u = 2;
    REP(i, K) {
        ll j = K - 1 - i;
        ll a = A[j];
        l = (l + a - 1) / a * a;
        u = u / a * a + a - 1;
    }
    if (l > u)
        cout << -1 << endl;
    else
        cout << l << ' ' << u << endl;
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
int main() {
	int R, G, B, N, c = 0;
	cin >> R >> G >> B >> N;
	rep(r, 0, N / R + 1) {
		rep(g, 0, N / G + 1) {
			if ((N - r * R - g * G) >= 0 && (N - r * R - g * G) % B == 0) {
				c++;
			}
		}
	}
	printf("%d\n", c);
	return 0;
}


Measured memory_bytes: 256
import sys


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


fin = sys.stdin.readline
N = int(fin())
A = [int(elem) for elem in fin().split()]
assert len(A) == N

g = gcd(A[0], A[1])
for item in A[2:]:
    g = gcd(g, item)
print(g)


Measured memory_bytes: 14168
import java.util.Scanner;

class Main {
public static void main (String[] args){

String intSort_abc = "null";

Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if (a >= 1 && a <= 10000){
if (b >= 1 && b <= 10000){
if (c >= 1 && c <= 10000){
if (a < b){
   if (b < c){
      intSort_abc = (a + " " + b + " " + c);
   } else {
      intSort_abc = (a + " " + c + " " + b);
   }
        if (c < a){
           intSort_abc = (c + " " + a + " " + b);
        }
}
if (b < a){
   if (a < c){
      intSort_abc = (b + " " + a + " " + c);
   } else {
      intSort_abc = (b + " " + c + " " + a);
   }
        if (c < b){
           intSort_abc = (c + " " + b + " " + a);
        }
}
System.out.println(intSort_abc);
}
}
}
}
}


Measured memory_bytes: 26080
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
ll N, H;
ll a[100000 + 10];
ll b[100000 + 10];
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> H;
  ll maxa = 0;
  for (int i = 0; i < N; ++i) {
    cin >> a[i] >> b[i];
    maxa = max(maxa, a[i]);
  }
  sort(b, b + N);
  reverse(b, b + N);
  ll ret = INT_MAX;
  ll psum = 0;
  for (ll i = 1; i <= N ; ++i) {
    H -= b[i - 1];
    if (H <= 0) {
      ret = min(ret, i);
      break;
    }
    ll ct = (H - 1) / maxa + 1;
    ret = min(ret, i + ct);
  }

  cout << ret;
}

Measured memory_bytes: 1792
#include <stdio.h>

int k, s;

int main() {
  scanf("%d%d", &k, &s);
  int count = 0;
  for(int x = 0; x <= k; x++) {
    for(int y = 0; y <= k; y++) {
      if(s - x - y >= 0 && s - x - y <= k) count++;
    }
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
ll LCM(ll a,ll b){return (a*b)/GCD(a,b);}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int n;
	cin >> n;
	int a[n];
	int ck = 0;
	ll sum = 0;
	int mind = INF;
	REP(i, n) cin >> a[i];
	REP(i, n){
		mind = min(mind, abs(a[i]));
		sum += abs(a[i]);
		if (a[i] < 0) ck++;
	}

	if (ck % 2 == 0) cout << sum << endl;
	else cout << sum - 2*mind << endl;


}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main () {
  int x1, y1;
  int x2, y2;
  int x3, y3;
  int x4, y4;

  cin >> x1 >> y1 >> x2 >> y2;

  x3 = x2 + (y1 - y2);
  y3 = y2 - (x1 - x2);

  x4 = x1 + (y1 - y2);
  y4 = y1 - (x1 - x2);

  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
 
int main()
{
 
   int n,l;
   scanf("%d%d",&n,&l);
   char s[n][l+1];
   char temp[l+1];
   int i,j;
   for(i=0;i<n;++i)
       scanf("%s",&s[i]);
       
   for(i=0;i<n;++i)
      {
          for(j=i+1;j<n;++j)
             {
                 if(strcmp(s[i],s[j])>0)
                   {
                       strcpy(temp,s[i]);
                       strcpy(s[i],s[j]);
                       strcpy(s[j],temp);
                   }
             }
      }
      
      for(i=0;i<n;++i)
         {
             printf("%s",s[i]);
         }
   
}

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

int main(){
  int n,a,b,c,d;

  cin >> n;
  a=n/1000;
  b=n/100%10;
  c=n/10%10;
  d=n%10;

  if(a-b==0|b-c==0|c-d==0)
    cout << "Bad" << endl;
  else
  	cout << "Good" << endl;

    
}

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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	int a, b;
	cin >> a >> b;
	cout << max(max(a + b, a - b), a * b) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
import java.math.*;

public class Main {
    private static Scanner sc;

    public static void main(final String[] args) {
        final Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null)
                br.close();
        }

        public String next() throws IOException {
            if (i < s.length)
                return s[i++];
            String st = br.readLine();
            while (st == "")
                st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }

        public long[] nextLongArray(int n) throws NumberFormatException, IOException {
            long[] ret = new long[n];
            for (int i = 0; i < n; i++) {
                ret[i] = nextLong();
            }
            return ret;
        }

        public int[] nextIntArray(int n) throws NumberFormatException, IOException {
            int[] ret = new int[n];
            for (int i = 0; i < n; i++) {
                ret[i] = nextInt();
            }
            return ret;
        }
    }

    private void solve() {
        try {
            long n = sc.nextLong();
            String s = "";

            while (true) {
                long t = n % 26;
                if (t == 0)
                    t = 26;
                s = String.valueOf((char) (t + 96)) + s;
                if (n <= 26)
                    break;
                n = n / 26;
                if (t == 26)
                    n--;
            }
            System.out.println(s);

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}


Measured memory_bytes: 37192
def main():
  N, K = map(int, input().split())
  A_list = input().split()

  root = [1]

  record = [-1]*N
  break_flag = 0
  for n in range(K):
    new = int(A_list[ int(root[n])-1 ])
    if record[new-1] <0:
      record[new-1]=1
      root.append(new)
    else:
      ind = root.index(new)
      break
  else:
    print(new)
    break_flag = 1
    
  if break_flag == 0:  
	  pre = len(root[:ind])
	  roop = len(root)-pre

	  print(root[ind:][(K-pre)%roop])
   
if __name__ == '__main__':
  main()

Measured memory_bytes: 32304
s = input()

MOD = 2019
d = [0] * MOD
d[0] = 1
r = 0
t = 1
for i in reversed(s):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    d[r] += 1

print(sum(i * (i - 1) // 2 for i in d))

Measured memory_bytes: 9220
N=parse(Int,readline())
xy=Pair{Int,Int}[]
for i=1:N
	x,y=map(x->parse(Int,x),split(readline()))
	push!(xy,x=>y)
end
M=Dict{Pair{Int,Int},Int}()
ans=N
M[0=>0]=-N
for (x1,y1)=xy,(x2,y2)=xy
	np=x1-x2=>y1-y2
	t=get(M,np,0)+1
	M[np]=t
	ans=min(ans,N-t)
end
println(ans)


Measured memory_bytes: 116844
from collections import deque
from math import log2
ans = []
while True:
    N, M = map(int, input().split())
    if (N,M) == (0,0):
        break
    a,b,c = 0,0,0
    for i in range(3):
        A = list(map(int, input().split()))
        if A[0]!=0:
            if i==0:
                for j in range(A[0]):
                    a += 1<<(A[1+j]-1)
            elif i==1:
                for j in range(A[0]):
                    b += 1<<(A[1+j]-1)
            else:
                for j in range(A[0]):
                    c += 1<<(A[1+j]-1)

    d = deque([(0,a,b,c,'')])

    while len(d)>0:
        cnt,a,b,c,prev = d.popleft()
        if cnt>M:
            ans.append(-1)
            break
        if a+b==0 or b+c==0:
            ans.append(cnt)
            break
        if a==0:
            amax = -1
        else:
            amax = int(log2(a))
        if b==0:
            bmax = -1
        else:
            bmax = int(log2(b))
        if c==0:
            cmax = -1
        else:
            cmax = int(log2(c))
        if amax>bmax and prev!='ba':
            d.append((cnt+1,a-(1<<amax),b+(1<<amax),c,'ab'))
        elif amax<bmax and prev!='ab':
            d.append((cnt+1,a+(1<<bmax),b-(1<<bmax),c,'ba'))
        if cmax>bmax and prev!='bc':
            d.append((cnt+1,a,b+(1<<cmax),c-(1<<cmax),'cb'))
        elif cmax<bmax and prev!='cb':
            d.append((cnt+1,a,b-(1<<bmax),c+(1<<bmax),'bc'))
print(*ans, sep='\n')


Measured memory_bytes: 6076
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define mod 1000000007
int main() 
{
    ll n;
    cin>>n;
    long double ans = 2*((double)3.141592)*n;
    cout<<setprecision(9)<<ans;
}


Measured memory_bytes: 3776
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  int c[3][3]; rep(i, 3)rep(j, 3) cin >> c[i][j];

  for (int i = 0; i <= 1; i++) {
    int sub = c[i][0] - c[i + 1][0];
    for (int j = 1; j < 3; j++) {
      if (c[i][j] - c[i + 1][j] != sub) {
        No();
        return;
      }
    }
  }

  for (int j = 0; j <= 1; j++) {
    int sub = c[0][j] - c[0][j + 1];
    for (int i = 1; i < 3; i++) {
      if (c[i][j] - c[i][j + 1] != sub) {
        No();
        return;
      }
    }
  }

  Yes();
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <numeric>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
#define fcout cout<<fixed<<setprecision(10)
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
//template<typename T>void pp(T x){cout<<x<<endl;}

using namespace std;
template<typename T> void test(vector<T> v){for(int i=0;i<v.size();i++){if(i)cout<<" ";cout<<v[i];}cout<<endl;}

int andd(int x,int y){
    int ret=0;
    rep(i,0,4){
        ret+=pow(2,i)*((x%2)&&(y%2));
        x/=2; y/=2;
    }
    return ret;
}

int orr(int x,int y){
    int ret=0;
    rep(i,0,4){
        ret+=pow(2,i)*((x%2)||(y%2));
        x/=2; y/=2;
    }
    return ret;

}

int hashh(string s,string ss){
    stack<int> st;
    int a,b,c,d;
    d=ss[3]-'0'; c=ss[2]-'0'; b=ss[1]-'0'; a=ss[0]-'0';
    reverse(all(s));
    rep(i,0,s.size()){
        if(s[i]=='a')st.push(a);
        else if(s[i]=='b')st.push(b);
        else if(s[i]=='c')st.push(c);
        else if(s[i]=='d')st.push(d);
        else if(s[i]=='+'){
            int x=st.top();
            st.pop();
            int y=st.top();
            st.pop();
            st.push(orr(x,y));
        }else if(s[i]=='*'){
            int x=st.top();
            st.pop();
            int y=st.top();
            st.pop();
            st.push(andd(x,y));
        }else if(s[i]=='^'){
            int x=st.top();
            st.pop();
            int y=st.top();
            st.pop();
            st.push(x^y);
        }
    }
    return st.top();
}
int main(){
    string s;
    while(cin>>s&&s!="."){
        string ss;
        cin>>ss;
        int ans=hashh(s,ss);
        cout<<ans<<" ";
        ss="0000";
        int ct=0;
        rep(i,0,10)rep(j,0,10)rep(k,0,10)rep(l,0,10){
            ss[0]='0'+i;
            ss[1]='0'+j;
            ss[2]='0'+k;
            ss[3]='0'+l;
            if(ans==hashh(s,ss)){
                ct++;
            }
        }
        cout<<ct<<endl;
    }
    return 0;
} 


Measured memory_bytes: 3260
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
const int MOD = 1e9+7;
// const int INF = 1e9;
const ll LINF = 1e18;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }


const ll INF = 1e18;
const int MAXV = 100100;

struct edge { int to, cost; };  // 辺
typedef pair<int, int> P;       // first: sからの最短距離, second: 頂点番号

int V;                          // 頂点数
vector<edge> G[MAXV];           // グラフ
int d[MAXV];                    // 頂点sからの最短距離

void dijkstra(int s){
  priority_queue<P, vector<P>, greater<P>> que;
  fill(d, d + V, INF);
  d[s] = 0;
  que.push(P(0, s));
  while(!que.empty()){
    P p = que.top(); que.pop();
    int v = p.second;
    if(d[v] < p.first) continue;
    for(int i = 0; i < G[v].size(); i++){
        edge e = G[v][i];
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}

signed main()
{
  int n,m; cin>>n>>m;
  V=n;
  vector<pair<pii,int>> ps;
  rep(i,m){
    int l,r,c; cin>>l>>r>>c;
    l--; r--;
    G[l].push_back(edge{r,c});
  }
  rep(i,n-1){
    G[i+1].push_back(edge{i,0});
  }
  dijkstra(0);
  
  if(d[n-1]==INF) cout<<-1<<endl;
  else cout<<d[n-1]<<endl;
  
}


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


int main() {
  vector<int> N(4);
  int i;
  for (i=0;i<4;i++){
    cin >> N.at(i);
  }

  vector<bool> flag(4, false);

  for (i=0;i<4;i++){
    if (N.at(i)==1){
      flag.at(0)=true;
    }else if (N.at(i)==9){
      flag.at(1)=true;
    }else if (N.at(i)==7){
      flag.at(2)=true;
    }else if (N.at(i)==4){
      flag.at(3)=true;
    }
  }

  bool ans = true;
  for (i=0;i<4;i++){
    if (!flag.at(i)){
      ans = false;
    }
  }

  if (ans){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
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 II(): return int(sys.stdin.readline())
def SI(): return input()

from collections import Counter

def main():
    N = II()
    A = []
    for _ in range(N):
        A.append(II())
    ans = 0
    tmp = 0
    for a in A:
        if a > 0:
            tmp += a
        else:
            ans += tmp // 2
            tmp = 0
    ans += tmp // 2

    return ans

print(main())

Measured memory_bytes: 7428
#include<bits/stdc++.h>
using namespace std;
int main()
{
   ios::sync_with_stdio(false);
   cin.tie(0);
   int n,k;
   cin>>n>>k;
   if(n>=1&&k>=1&&n<=100&&k<=100)
   {
       set<int>s;
      for(int ll=0;ll<k;ll++)
      {
            int j;
           cin>>j;
       for(int i=0;i<j;i++)
       {
            int m;
           cin>>m;
          s.insert(m);
      }
    } 
   if(n==s.size())
   {
      cout<<"0"<<endl;
   }
   else
    cout<<n-s.size()<<endl;
  }               
 return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 2000
i64 N;
i64 L[MAX_N];


int main() {
  cin >> N;
  REP(i, N) cin >> L[i];
  sort(L, L + N);

  i64 cnt = 0;
  i64 c;
  for (i64 high = N - 1; high >= 2; high--) {
    for (i64 mid = high - 1; mid >= 1; mid--) {
      auto ub = upper_bound(L, L + mid, L[high] - L[mid]);
      c = L + mid - ub;
      if (c > 0) {
        cnt += c;
      }
    }
  }

  assert((6 * cnt) <= (N * (N - 1) * (N - 2)));
  cout << cnt << endl;

  return 0;
}

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

long long n,a,m,k,q,b,c=1;
string ss,s1,s2;
int main(){
    cin>>ss;
    if (ss[0]==ss[1] or ss[1]==ss[2] or ss[2]==ss[3]){
        cout<<"Bad"<<endl;
    }
    else{
        cout<<"Good"<<endl;
    }
}


Measured memory_bytes: 256
using System;
 
class main{
  static void Main(string[] args){
    string[] s = Console.ReadLine().Split(" ");
    int apples = int.Parse(s[0]);
    int pieces = int.Parse(s[1]);
    
    Console.WriteLine(pieces/2 + (pieces%2 + apples*3) /2);
  }
}

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

void read_data(int n, vector<vector<int>> & Es){
    int u = 0, k = 0, v = 0;
    while (n--){
        cin >> u;
        cin >> k;
        while (k--){
            cin >> v;
            Es[u - 1].push_back(v - 1);
        }
    }
}

void display_result(int n, vector<int> & d, vector<int> & f)

{
    for (int i = 0; i != n; ++i){
        cout << i + 1 << ' ' << d[i] << ' ' << f[i] << endl;
    }
}

void dfs(int node, int & time, vector<vector<int>> & Es, vector<int> & d, vector<int> & f ){
    if (d[node]) return;
    d[node] = time;
    ++time;
    for (auto next_node : Es[node]){
        dfs(next_node, time, Es, d, f);
    }
    f[node] = time;
    ++time;
}

int main()
{
    ios::sync_with_stdio(false);
    int n = 0;
    cin >> n;
    vector< vector<int> > Es(n);
    vector<int> d(n, 0);
    vector<int> f(n, 0);
    read_data(n, Es);
    int time = 1;
    for (int node = 0; node != n; ++node) dfs(node, time, Es, d, f);
    display_result(n, d, f);
    
    return 0;
}

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

int main() {
    string s;
    cin >> s;
    string ans = "";
    
    rep(i, s.length()) {
        if (s[i] == 'B') {
            if (ans.length() > 0) {
                ans.erase(ans.length() - 1);
            }
        }
        else {
            ans += s[i];
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		long cntR = 0;
		long cntG = 0;
		long cntB = 0;
		for (int i = 0; i < n; ++i) {
			if (s.charAt(i) == 'R') {
				++cntR;
			} else if (s.charAt(i) == 'G') {
				++cntG;
			} else {
				++cntB;
			}
		}

		long ans = cntR * cntG * cntB;

		for (int i = 0; i < n; ++i) {
			for (int j = i + 1; j < n; ++j) {
				int k = 2 * j - i;
				if (k >= n) {
					continue;
				}

				char ci = s.charAt(i), cj = s.charAt(j), ck = s.charAt(k);
				if (ci != cj && cj != ck && ck != ci) {
					--ans;
				}
			}
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 36756
a,b,c,x,y = map(int, input().split())
if c*2 < (a+b):
    result_1 = c*(min(x,y))*2
    if x == y:
        print(result_1)
    elif x > y:
        result_2 = x-y
        result = result_1 + (result_2)*a
        print(result)
    elif x < y:
        result_2 = y-x
        if (result_2)*b <= result_2*2*c:
            result = result_1 + (result_2)*b
            print(result)
        else:
            result = result_1 + (result_2*2*c)
            print(result)
else:
    print(a*x+b*y)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mp(a,b) make_pair(a,b)
#define vi vector<int>
#define mii map<int,int>
#define mpi map<pair<int,int>,int>
#define vp vector<pair<int,int> >
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define F first
#define S second
#define endl "\n"
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define dom 998244353
#define pi 3.14159265
#define sl(a) (int)a.length()
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define pii pair<int,int> 
#define mini 2000000000000000000
#define time_taken 1.0 * clock() / CLOCKS_PER_SEC
//mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
void shikhar7s(int cas)
{
    int n,i;
    cin>>n;
    int x=0,a[n];
    fr(i,n)
    {
        cin>>a[i];
        x^=a[i];
    }
    fr(i,n)
    {
        cout<<(a[i]^x)<<" ";
    }
}
signed main()
{
    fast;
    int t=1;
    //cin>>t;
    int cas=1;
    while(cas<=t)
    {
    shikhar7s(cas);
    cas++;
    }
    return 0;
}

Measured memory_bytes: 4988
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
int a[100009], b[100009],n,k,j,maxi,ans,flag=1;
int main() {
    string s;
    cin>>n>>k;
    cin>>s;
    for(int i=0;i<n;i++){
        if(s[i]=='0'){
            flag=0;
            a[j] = i+1;
            while(s[i]=='0' && i<n)
                i++;
            b[j]=i+1;
            i--;
            j++;
        }
    }
    a[j]=n+1;
    for(int i=0;i<j;i++){
        // cout<<a[i]<<" "<<b[i]<<" ";
        ans = a[i+1]-1;
        if(i+1-k>0){
            ans -= (b[i-k]-1);
        }
        // cout<<"ans :"<<ans<<endl;
        if(ans>maxi)
            maxi=ans;
    }
    if(flag){
        cout<<n;
        return 0;
    }
    cout<<maxi<<endl;
}


Measured memory_bytes: 896
import java.util.*;
 
public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int p = sc.nextInt();
		int result = 0;
		
		result = (a*3 + p)/2;
		
	    System.out.println(result);
		
	  }
}

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

int N;
int a[100000+5];

int main()
{
    cin >> N;
    int count_2 = 0;
    int count_4 = 0;
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        if (a[i] % 4 == 0) {
            count_4++;
        } else if (a[i] % 2 == 0) {
            count_2++;
        }
    }

    int n = N;
    n -= count_4 * 2;

    // bool ok = false;
    if (n == 1) {
        cout << "Yes" << endl;
        return 0;
    }
    n -= count_2;
    if (n <= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
int main(){
	long long a;
	cin>>a;
	long long x=100;
	int year=0;
	while(x<a){
		x=x+x/100;
		year++;
	}
	cout<<year<<endl;
	return 0;
}

Measured memory_bytes: 3596
n=int(input())
import math
ans=[]
ans_i=[]
for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
        ans.append(i)
        ans_i.append(n//i)
v=max(ans[0],ans_i[0])
x=max(ans[-1],ans_i[-1])
print(len(str(min(v,x))))

Measured memory_bytes: 3064
#include <stdio.h>
#include <math.h>
int main(void)
{
	int angle,step;
	double angle_total=0,x=0,y=0;
	while(1)
	{
		scanf("%d,%d",&step,&angle);
		if(angle == 0 && step == 0)break;
		y += step*cos(-(angle_total*M_PI/180));
		x += -step*sin(-(angle_total*M_PI/180));
		angle_total += angle;
	}
	printf("%d\n",(int)(x));
	printf("%d\n",(int)(y));
	return 0;
}

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

int main(){
  float A,B,T;

  cin>>A>>B>>T;

  T+=0.5;

  int i,sum;

  sum=0;
  for(i=1;A*i<=T;i++){
    sum+=B;
  }

  cout<<sum<<endl;

}


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

struct Node {
  int key;
  Node *prev, *next;
};

class LinkedList {
  Node *NIL;
public:
  LinkedList() {
    NIL = new Node;
    NIL->prev = NIL;
    NIL->next = NIL;
  }
  
  void insert(int key) {
    Node *x = new Node;
    x->key = key;
    x->prev = NIL;
    x->next = NIL->next;
    NIL->next = x;
    x->next->prev = x;
  }

  void del(Node *x) {
    x->prev->next = x->next;
    x->next->prev = x->prev;
    delete x;
  }

  void delete_key(int key) {
    Node *x = NIL->next;
    while (x != NIL) {
      if (x->key == key) {
        del(x);
        break;
      }
      x = x->next;
    }    
  }

  void delete_first() {
    del(NIL->next);
  }

  void delete_last() {
    del(NIL->prev);
  }

  void print() {
    Node *x = NIL->next;

    if (x != NIL) cout << x->key;
    x = x->next;
    
    while (x != NIL) {
      cout << " " << x->key;
      x = x->next;
    }
    cout << endl;
  }
};
  

int main() {
  int n, key;
  string command;
  LinkedList ll;

  cin >> n;
  for (int i =  0; i < n; i++) {
    cin >> command;
    if (command[0] == 'i') {
      cin >> key;
      ll.insert(key);
    } else if (command == "delete") {
      cin >> key;
      ll.delete_key(key);
    } else if (command == "deleteFirst") {
      ll.delete_first();
    } else {
      ll.delete_last();
    }
  }

  ll.print();

  return 0;
}



Measured memory_bytes: 34428
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	
	int N;
	cin >> N;
	ll A[100000], B[100000];
	rep(i, N) {
		cin >> A[i];
	}
	sort(A, A + N);
	rep(i, N) {
		B[i] = A[i];
	}
	reverse(B, B + N);

	ll kotae = 0;;
	if (N % 2 == 0) {
		rep(i, N / 2) kotae -= A[i];
		rep(i, N / 2) kotae += B[i];
		kotae *= 2ll;
		kotae += A[N / 2 - 1] - B[N / 2 - 1];
	}
	else {
		ll kari1 = 0;
		ll kari2 = 0;

		rep(i, N / 2) kari1 += B[i];
		rep(i, N / 2 - 1) kari1 -= A[i];
		kari1 *= 2ll;
		kari1 -= A[N / 2 - 1] + A[N / 2];

		rep(i, N / 2) kari2 -= A[i];
		rep(i, N / 2 - 1) kari2 += B[i];
		kari2 *= 2ll;
		kari2 += B[N / 2 - 1] + B[N / 2];

		kotae = max(kari1, kari2);
	}

	co(kotae);
	Would you please return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<vector>
using namespace std;
#define N 50000
bool prime[N];
vector<int> primes;

void init(){
	primes.clear();
	memset(prime,true,sizeof(prime));
	prime[0] = prime[1] = true;
	for(int x=2;x<N;++x){
		if(prime[x]){
			primes.push_back(x);
			for(int i=x+x;i<N;i+=x){
				prime[i] = false;
			}
		}
	}
}

int main(){
	init();
	int c;
	while(cin>>c,c){
		int cnt = 0;
		for(int x=0;x<primes.size();++x){
			for(int y=x;y<primes.size();++y){
				if(primes[x]+primes[y]==c)cnt++;
				if(primes[x]+primes[y] > c)break;
			}
			if(primes[x] >= c ) break;
		}
		cout<<cnt<<endl;	
	}
	return 0;
}

Measured memory_bytes: 1324
// Anve$hi $hukla
#include <bits/stdc++.h>
using namespace std;
struct ${$(){ios_base::sync_with_stdio(false);cin.tie(NULL);}}$;

typedef long long LL;
const int Maxn = 200005;

int main() {
   string s;
   cin >> s;
   int c = s.length(), f = -1;
   for(int i = 0; i < s.length(); i++) {
      if(s[i] == 'C')  {
         c = min(c, i);
      } else if(s[i] == 'F')
         f = i;
   }   
   if(f > c && c != s.length() && f != -1) {
      cout << "Yes" << endl;
   } else
   cout << "No" << endl;
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
using namespace std;
const int maxn=110;
int table[maxn][maxn];
int d[maxn],vis[maxn];
int n;

void bfs(){
    queue<int> q;
    q.push(1);
    d[1]=0;
    vis[1]=1;
    while(!q.empty()){
        int v=q.front();
        q.pop();
        for(int i=1;i<=n;i++){
            if(!vis[i] && table[v][i]){
                vis[i]=1;
                d[i]=d[v]+1;
                q.push(i);
            }
        }
    }
}
int main(){
    int u,k,num;
    cin>>n;
    for(int i=1;i<=n;i++){
        d[i]=-1;
        vis[i]=0;
        cin>>u>>k;
        while(k--){
            cin>>num;
            table[u][num]=1;
        }
    }
    bfs();
    for(int i=1;i<=n;i++)
        cout<<i<<" "<<d[i]<<endl;

}


Measured memory_bytes: 3160
def bubble_sort(alist):
    """Sort alist by bubble sort.
    Returns (number of swap operations, sorted list)

    >>> bubble_sort([5, 3, 2, 4, 1])
    ([1, 2, 3, 4, 5], 8)
    """
    size = len(alist)
    count = 0

    for i in range(size-1):
        for j in reversed(range(i+1, size)):
            if alist[j] < alist[j-1]:
                count += 1
                alist[j-1], alist[j] = alist[j], alist[j-1]

    return (alist, count)


def run():
    _ = int(input()) # flake8: noqa
    nums = [int(i) for i in input().split()]

    (sorted_list, num_swap) = bubble_sort(nums)

    print(" ".join([str(i) for i in sorted_list]))
    print(num_swap)


if __name__ == '__main__':
    run()


Measured memory_bytes: 5616