akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);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())

//#define LOCAL 0
//#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


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

//ここから編集する


int main() {
    int a,b;
    cin >> a >> b;
    cout << (a+b)/2 + (a+b)%2 << endl;
    return 0;
}


Measured memory_bytes: 256
main :: IO ()
main = do
  [a,b,k] <- map read . words <$> getLine
  putStrLn $ unwords $ map show $ solve a b k

solve :: Int -> Int -> Int -> [Int]
solve a b k = go a b k True
  where
    go x y 0 _ = [x,y]
    go x y n b | b && odd x = let x' = (x-1) `div` 2 in go x' (y+x') (n-1) (not b)
               | b && even x = let x' = x `div` 2 in go x' (y+x') (n-1) (not b)
               | odd y = let y' = (y-1) `div` 2 in go (x+y') y' (n-1) (not b)
               | otherwise = let y' = y `div` 2 in go (x+y') y' (n-1) (not b)


Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a;
    double sum = 0;
    for(int i=0;i<n;i++){
        cin>>a;
        sum += (double)1/a;
    }
    
    
    cout <<  1/sum << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int max = 0;
        int sum = 0;

        for(int i = 0; i < n; i++){
            int l = sc.nextInt();
            sum += l;
            max = Math.max(max, l);
        }

        System.out.println(max < sum - max ? "Yes" : "No");

    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
template<typename T>
struct Edge {
    int from, to;
    T cost;
    Edge(int from, int to, T cost) {
        this->from = from;
        this->to = to;
        this->cost = cost;
    }
};
bool operator == (Edge<int> e1, Edge<int> e2) {
    return e1.from == e2.from &&
            e1.to == e2.to &&
            e1.cost == e2.cost;
}
bool operator < (Edge<int> e1, Edge<int> e2) {
    return e1.cost > e2.cost;
}
template<typename T>
using Edges = std::vector<Edge<T>>;
template<typename T>
using Graph = std::vector<Edges<T>>;
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const ld eps = 1e-9;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
struct Elm {
  int idx, cnt, cost;
};
bool operator< (Elm e1, Elm e2) {
  return e1.cost > e2.cost;
}
void solve(int n, int m, int c) {
  Graph<int> g(n);
  for(int i=0;i<m;++i) {
    int a, b, w; cin >> a >> b >> w;
    a--; b--;
    g[a].push_back(Edge<int>(a, b, w));
  }
  vvi dp(n, vi(m+1, INF));
  priority_queue<Elm> pq;
  pq.push({0, 0, 0});
  dp[0][0] = 0;
  while(!pq.empty()) {
    auto now = pq.top(); pq.pop();
    int idx = now.idx, cnt = now.cnt, cost = now.cost;
    if(dp[idx][cnt] < cost) continue;
    for(int i=0;i<(int)(g[idx].size());++i) {
      int nxt = g[idx][i].to, w = g[idx][i].cost;
      if(dp[nxt][cnt] > cost + w) {
        dp[nxt][cnt] = cost + w;
        pq.push({nxt, cnt, cost + w});
      }
      if(cnt < m && dp[nxt][cnt+1] > cost) {
        dp[nxt][cnt+1] = cost;
        pq.push({nxt, cnt+1, cost});
      }
    }
  }
  int ans = m;
  for(int i=0;i<=m;++i) {
    if(dp[n-1][i] <= c) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  while(1) {
    int n, m, c; cin >> n >> m >> c;
    if(n == 0) break;
    solve(n, m, c);
  }
}



Measured memory_bytes: 5972
#include <stdio.h>
int main(void){
	int x,sugai;
	scanf("%d",&x);
	sugai=x%7;
	switch(sugai){
		case 2:
			printf("sat\n");
			break;
		case 3:
			printf("sun\n");
			break;
		case 4:
			printf("mon\n");
			break;
		case 5:
			printf("tue\n");
			break;
		case 6:
			printf("wed\n");
			break;
		case 0:
			printf("thu\n");
			break;
		case 1:
			printf("fri\n");
			break;
		default:
			break;
	}
	return 0;
}
		
		


Measured memory_bytes: 2684
#include<iostream>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    int checkNum = a * b % 2;
    if (checkNum == 0) {
        cout << "Even" << endl;
    }
    else {
        cout << "Odd" << endl;

    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace ABC175
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            if (S == "SSS")
            {
                Console.WriteLine(0);
            }
            else if (S == "RRR") 
            {
                Console.WriteLine(3);
            }
            else if(S == "RRS" ||S=="SRR")
            {
                Console.WriteLine(2);
            }
            else
            {
                Console.WriteLine(1);
            }
        }
    }
}


Measured memory_bytes: 25956
#include<bits/stdc++.h>
using namespace std;
string s1,s2;
int n1,n2;
int dp[3001][3001];

int lcs(int i,int j){
	if(i>=n1 || j>=n2)
	return 0;
	
	if(dp[i][j]!=-1)
	return dp[i][j];
	
	if(s1[i]==s2[j])
		dp[i][j]=1+lcs(i+1,j+1);
	else
	    dp[i][j]=max(lcs(i+1,j),lcs(i,j+1));
	    
	return dp[i][j];    
}


int main()
{	
	cin>>s1>>s2;
	n1=s1.length();
	n2=s2.length();
	memset(dp,-1,sizeof(dp));
	lcs(0,0);
	
//	for(int i=0;i<n1;i++){
//		for(int j=0;j<n2;j++){
//			cout<<dp[i][j]<<" ";
//		}
//		cout<<endl;
//	}
	//for printing the LCS:: we backtrack::
	int i=0,j=0;
	string ans="";
	while(i<n1 && j<n2){
		if(s1[i]==s2[j]){
			ans.push_back(s1[i]);
			i++;
			j++;
		}
		else
	    if(dp[i+1][j]>dp[i][j+1])
			i++;
		else
		    j++;	
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 35712
#include<stdio.h>
int main(){
  int n,y,i,j;
  scanf("%d%d",&n,&y);
  y/=1000;
  for(i=y%5;i<=n;i+=5)
    for(j=0;j<=n-i;j++)
      if(i+5*j+10*(n-j-i)==y){
        printf("%d %d %d\n",n-i-j,j,i);
        return 0;
      }
  printf("-1 -1 -1\n");
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<double> point;
#define F first
#define S second

void br(ll n)
{
	ll r = 0;
	for (ll m = 1; m <= 2*n; ++m)
		if ((n/m) == n % m)
			r += m;
	cout << r << endl;
}

vector<pair<ll, int>> d[1000005];

int main()
{
	#ifdef DGC
		//freopen("a.txt", "r", stdin);
		//freopen("b.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	const int N = 1e6 + 4;
	vector<bool> p(N + 5);
	for (ll i = 3; i <= N; i += 2)
	    if (!p[i])
	        for (ll j = i * i; j <= N; j += 2 * i)
	            p[j] = true;

	for (int i = 4; i <= N; i += 2)
		p[i] = true;

	ll n, ans = 0;
	cin >> n;

	//br(n);

	if (n == 1)
	{
		cout << "0\n";
		return 0;
	}

	for (int i = 2; i <= N; ++i)
		if (!p[i])
			for (ll x = max((n-1000002 + i-1) / i, 1LL); x*i <= n; ++x)
				d[n - x*i].push_back({ i, 0 });

	ll b, e;
	int sz, R;
	function<void(int, ll)> gen = [&](int p, ll x)
	{
		if (x > e) return;
		if (p == sz)
		{
			if (x >= b && x > R)
				ans += x;
			return;
		}
		for (int i = 0; i <= d[R][p].S; ++i)
		{
			gen(p+1, x);
			x *= d[R][p].F;
		}
	};

	for (ll r = 1; r*r <= n; ++r)
	{
		e = (n)/r;
		b = (n)/(r+1) + 1;

		ll t = n-r;
		for (auto &i : d[r])
			while (t % i.F == 0) t /= i.F, ++i.S;
		if (t > 1)
			d[r].push_back({ t, 1 });

		sz = d[r].size();
		R = r;
		gen(0, 1);

		/*for (; b <= e; ++b)
			if ((n-r) % b == 0)
				ans += b;*/
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 116352
#include <stdio.h>
int main(void){
  int ans[4][2]={0},i,j;
  double l,r;
  while(scanf("%lf %lf",&l,&r)!=EOF){
    if(l>=1.1)ans[0][0]++;
    else if(l>=0.6)ans[1][0]++;
    else if(l>=0.2)ans[2][0]++;
    else ans[3][0]++;
    if(r>=1.1)ans[0][1]++;
    else if(r>=0.6)ans[1][1]++;
    else if(r>=0.2)ans[2][1]++;
    else ans[3][1]++;
  }
  for(i=0;i<4;i++)
    printf("%d %d\n",ans[i][0],ans[i][1]);
  return 0;
}

Measured memory_bytes: 628
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct UnionFind {
    vector<int> id;
    vector<vector<int> > groups;
    int gn; //number of groups
    UnionFind(int n){
        id = vector<int>(n);
        groups = vector<vector<int> >(n);
        gn = n;
        for(int i=0;i<n;++i){
            id[i]=i;
            groups[i]={i};
        }
    }
    void unite(int a, int b) {
        if(same(a,b)) return;
        gn--;
        int x = id[a];
        int y = id[b];
        if(groups[x].size()<groups[y].size()) swap(x,y);
        for(int j : groups[y]){
            id[j] = x;
            groups[x].push_back(j);
        }
        groups[y].clear();        
    }
    bool same(int a, int b) {
        return id[a] == id[b];
    }
};
vll ans;
vvint hasi;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    UnionFind uf(n);
    vll ans(m,1);
    vvint hasi(m);
    REP(i,m){
        int a,b;
        cin >> a >> b;
        hasi[i].pb(a-1);
        hasi[i].pb(b-1);
    }
    ans[m-1] = (n*(n-1))/2;
    for(int i=m-1;i>0;i--){
        int a = hasi[i][0];
        int b = hasi[i][1];
        ans[i-1]=ans[i];
        if(!uf.same(a,b)){
            ans[i-1]-=(ll)((uf.groups[uf.id[a]]).size())*(ll)((uf.groups[uf.id[b]]).size());
        }
        uf.unite(a,b);
    }
    REP(i,m){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 17272
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string str;
    cin >> str;
    long long sum = 0;
    for(int i=0; i< str.size() ; i++){
        sum += (str[i]-48);
    }
    if(sum % 9==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3704
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int bit = 0;
		for (int i= 0;i<n;i++) {
			bit|=sc.nextInt();
		}
		System.out.println(Integer.numberOfTrailingZeros(bit));

	}
}


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

typedef long long int ll;
typedef long double ld;

/// pair,set,vector
#define F first
#define S second
ll xs,ys,xt,yt,n;
pair<pair<ll,ll>,ll> cir[1005];
ld adj[1005][1005],dis[1005];ll mark[1005];
ld getdis(ll x1,ll y1,ll x2,ll y2){
    ld ret = (ld)sqrt(((ld)x1-(ld)x2)*((ld)x1-(ld)x2) + ((ld)y1-(ld)y2)*((ld)y1-(ld)y2));
    return ret;
}

void spt(){
    ///n,mark,dis,adj
    for(int i=1;i<=n;++i) dis[i]=(ld)1e17;
    dis[1]=0.0;
    for(int jj=1;jj<=n;++jj){
        ld curmin=(ld)1e17;ll ps;
        for(int i=1;i<=n;++i){
            if(mark[i]) continue;
            if(dis[i]<curmin){
                curmin=dis[i];
                ps=i;
            }
        }

        mark[ps]=1;
        for(int i=1;i<=n;++i){
            if(mark[i]) continue;
            dis[i]=min(dis[i],dis[ps]+adj[ps][i]);
        }



    }
}

int main()
{
    cin>>xs>>ys>>xt>>yt>>n;
    for(int i=1;i<=n;++i) cin>>cir[i+1].first.first>>cir[i+1].first.second>>cir[i+1].second;
    cir[1].first.first=xs;
    cir[1].first.second=ys;
    cir[1].second=0;

    cir[n+2].first.first=xt;
    cir[n+2].first.second=yt;
    cir[n+2].second=0;
    n+=2;
    for(int i=1;i<=n;++i) for(int j=1;j<=n;++j){
        adj[i][j]=(ld)(max((ld)0.0,getdis(cir[i].F.F,cir[i].F.S,cir[j].F.F,cir[j].F.S)-(ld)cir[i].S-(ld)cir[j].S));
    }
    spt();
    cout<<setiosflags(ios::fixed|ios::showpoint)<<setprecision(11);
    cout<<dis[n]<<endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

void solve() {
    string s;
    cin >> s;

    int cnt = count(s.begin(), s.end(), 'R');
    if (cnt == 1) cout << 1 << endl;
    else if (cnt == 2) {
        if (s.front() == 'R' && s.back() == 'R') cout << 1 << endl;
        else cout << 2 << endl;
    }
    else if (cnt == 3) cout << 3 << endl;
    else cout << 0 << endl;
}

int main() {
    // For fast I/O
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int T;
    T = 1;
    // cin >> T;
    while (T--) {
        solve();
    }

    return 0;
}

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

int main(){
  int A, B;
  cin >> A >> B;

  int count = 0;
  int i = 0;
  while (i < 1000000000){
    if (abs(A - i) == abs(B - i)){
      count++;
      break;
    }
    i++;
  }
  
  if (count != 0){
    cout << i << endl;
  }
  else{
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

typedef pair< double, double > PDD;

double cross( PDD p1, PDD p2 )
{
	return p1.fst * p2.snd - p1.snd * p2.fst;
}

PDD operator - ( PDD p1, PDD p2 )
{
	return MP( p1.fst - p2.fst, p1.snd - p2.snd );
}

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

	string line;

	while ( cin >> line )
	{
		REP( i, 0, line.size() )
		{
			if ( line[i] == ',' )
			{
				line[i] = ' ';
			}
		}

		vector< PDD > ps( 4 );

		ISS iss( line );

		REP( i, 0, 4 )
		{
			iss >> ps[i].fst >> ps[i].snd;
		}

		ps.insert( ps.end(), ps.begin(), ps.begin() + 2 );

		int res = 0;

		REP( i, 0, 4 )
		{
			res += cross( ps[i] - ps[ i + 1 ], ps[ i + 1 ] - ps[ i + 2 ] ) < 0 ? -1 : 1;
		}

		if ( abs( res ) == 4 )
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1240
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)

Measured memory_bytes: 39536
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

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

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

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    map<int, ll> mp;
    vector<int> a(n);
    for(auto &x : a){
        cin >> x;
        mp[x]++;
    }
    ll ans = 0;
    for(auto &x : mp){
        ans += (x.S * (x.S - 1)) / 2;
    }
    for(int i = 0; i < n; i++){
        ll yo = mp[a[i]];
        ll cur = ans - (yo * (yo - 1) / 2);
        yo -= 1;
        if(yo > 0) cur += yo * (yo - 1) / 2;
        cout << cur << nl;
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 10368
line = gets.split(' ')

a = line[0]
b = line[1]

a_s = ""
for i in 1..b.to_i do
  a_s += a
end

b_s = ""
for i in 1..a.to_i do
  b_s += b
end

ans = [a_s, b_s].sort

print ans[0]

Measured memory_bytes: 1788
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    vector<pair<int, int>> w;
    priority_queue<int> pq;
    int n, m;
    long long ans = 0;
    cin >> n >> m;
    REP(i, n)
    {
        int a, b;
        cin >> a >> b;
        w.push_back(make_pair(a, b));
    }
    sort(w.begin(), w.end());

    int j = 0;
    rep(i, 1, m + 1)
    {
        while (j < n && w[j].first <= i)
        {
            pq.push(w[j].second);
            j++;
        }
        if (pq.size() > 0)
        {
            ans += pq.top();
            pq.pop();
        }
    }

    /*
    for (int i = 0; i < n; i++)
    {
        cout << "a " << w[i].first << " b " << w[i].second << endl;
    }
*/
    cout << ans << endl;
}

Measured memory_bytes: 1908
n,x,y = map(int, input().split())

ans = [0]*n
for i in range(1,n):
    for j in range(i+1,n+1):
        v1 = j-i
        v2 = abs(x-i) + 1 + abs(y-j)
        v3 = abs(y-i) + 1 + abs(x-j)
        minv = min(v1,v2,v3)
        ans[minv] += 1

for a in ans[1:]:
    print(a)

Measured memory_bytes: 74888
#include <iostream>
#include <cstdio>
#include <cstring>
#define MAX 105
#define INF 1000000
using namespace std;

int n;
int color[MAX];//0 表示未进入 -1 表示在之中 1 表示已出去 
int p[MAX];
int M[MAX][MAX];
int d[MAX];

void dijkstra() {
	int i,j,u;
	d[0]=0;
	p[0]=-1;
	while(1) {
		int min=INF;
		u=-1;
		for(i=0;i<n;i++) {
			if(d[i]<min && color[i]!=1) {
				min=d[i];
				u=i;
			}
		}
		if(u==-1) break;
		color[u]=1;
		for(j=0;j<n;j++) {
			if(color[j]!=1 && d[j]>min+M[u][j]) {
				color[j]=-1;
				d[j]=min+M[u][j];
				p[j]=u;
			}
		}
	}
}

int main() {
	memset(d,INF,sizeof(d));
	memset(color,0,sizeof(color));
	memset(p,-1,sizeof(p));
	memset(M,INF,sizeof(M));
	int i,j,u,k,v,c;
	cin>>n;
	for(i=0;i<n;i++) {
		cin>>u>>k;
		for(j=0;j<k;j++) {
			cin>>v>>c;
			M[u][v]=c;
		}
	}
	dijkstra();
	for(i=0;i<n;i++) {
		cout<<i<<' '<<d[i]<<endl;
	}
	return 0;	
} 


Measured memory_bytes: 3128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
int main(){
	int n[2],ans=-1;
	bool flg=false;
	cin >>n[0]>>n[1];
	rep (i,2)
	if (!(1<=n[i]&&n[i]<=9))
		flg = true;
	if (flg)
		cout <<"-1"<<endl;
	if (!flg)
		cout <<n[0]*n[1]<<endl;
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    int counter = 0;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        if(a%4==0) counter += 2;
        else if(a%2==0) counter++;
    }

    if(counter >= n/2*2) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(size_t i = 0; i < (n); ++i)

int main()
{
    int N;
    cin >> N;
    vector<int> D(N);
    REP(i, N) cin >> D[i];
    int M;
    cin >> M;
    vector<int> T(M);
    REP(i, M) cin >> T[i];
    unordered_map<int, int> mp;
    REP(i, N)
    {
        ++mp[D[i]];
    }
    REP(i, M)
    {
        if(mp[T[i]] > 0)
        {
            --mp[T[i]];
        }
        else
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 12824
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;
const int N = 100 + 5;

set<int>s;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,k,d;
	cin>>n>>k;
	for(int i=1;i<=k;i++){
		cin>>d;
		for(int j=1;j<=d;j++){
			int x;cin>>x;
			s.insert(x);
		}
	}
	cout<<n-s.size()<<'\n';
	return 0;
}

Measured memory_bytes: 3640
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

ll gcd(ll a, ll b) {
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    vector<ll> v(3);
    in >> v[0] >> v[1] >> v[2];
    ll ans = 0;
    sort(v.begin(), v.end());
    ans = v[2]*10+v[1] + v[0];
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 256
n = int(raw_input())

output = ""
for i in range(1, n + 1):
  x = i
  if x % 3 == 0:
    output += " "
    output += str(i)
    continue

  while True:
    if x % 10 == 3:
      output += " "
      output += str(i)
      break
    else:
      x /= 10
      if x == 0:
        break
print output

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

int main() {
  int N;
  cin >> N;
  int result = 0;
  if (N<100) {
    if (N<10) result=N;
    else result = 9;
  } else if (N<10000) {
    result+=9;
    if (N<1000) result+=N-99;
    else result += 900;
  } else {
    result+=909;
    if (N<100000) result+=N-9999;
    else result += 90000;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
typedef long long LL;
string s;
LL cnt[30];

int main(){
	cin>>s;
	LL len=s.size();
	LL ans=len*(len-1)/2+1;
	for(int i=0;i<len;i++){
		cnt[s[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		ans-=cnt[i]*(cnt[i]-1)/2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
using namespace std;
int main(){
    string S;
    cin >> S;
    int ans = 0;
    for(int i=0; i<4; i++){
        if(S[i] == '+'){
            ans++;
        }else if(S[i] == '-'){
            ans--;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int N;
    cin >> N;
    vector<ll> T(N);
    rep(i,N) cin >> T[i];

    __int128 a = 1;
    rep(i,N){
        ll g = gcd(a,T[i]);
        ll l = a * T[i] / g;
        //cout << g << " " << l << endl;

        a = l;
    }

    ll ans = a;
    cout << ans << endl;
}



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

int main(){
  int N, K;
  string S;
  cin >> N >> K >> S;
  if(S.at(K-1)=='A') S.replace(K-1,1,"a");
  else if(S.at(K-1)=='B') S.replace(K-1,1,"b");
  else S.replace(K-1,1,"c");
  cout << S << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next().trim());
		int B = Integer.parseInt(sc.next().trim());
		int C = Integer.parseInt(sc.next().trim());
		int count = 0;
		
		while ( A != B || B != C || A != C ) {
			if (A > B && A > C) {
					B++;
					C++;
					count++;
			} else {
				if (A > B) {
					B+=2;
					count++;
				} else if (A > C) {
					C+=2;
					count++;
				}
			}
			
			if (B > A && B > C) {
				A++;
				C++;
				count++;
			} else {
				if (B > A) {
					A+=2;
					count++;
				} else if (B > C) {
					C+=2;
					count++;
				}
			}

			if (C > A && C > B) {
				A++;
				B++;
				count++;
			} else {
				if (C > A) {
					A+=2;
					count++;
				} else if (C > B) {
					B+=2;
					count++;
				}
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
#define MAX 10000
using namespace std;

int main(){
  string s;
  cin >> s;
  rep(i, 0, s.length()){
    if((i+1)&1){
      cout << s[i];
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int n,m;
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	if(n%2==1){
		for(int i=1;i<=m;i++){
			cout<<i<<" "<<(n-i+1)<<endl;
		}
	}
	else{
		for(int i=1;i<=m;i++){
			if(i%2==1) cout<<(n-i+1)/2<<' '<<(n+i+1)/2<<endl;
			else cout<<(i/2)<<' '<<n-(i/2)<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3656
// Author: Amey Bhavsar
// IDE: Geany/Ubuntu
// Platform:Practice 1  Vjudge

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

#define rep(i,a,b) for(auto i=a;i<b;i++)
#define repD(i,a,b) for(auto i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal
// traversal function to avoid long template definition
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)
//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())
// ll fe (ll x, ll y) {
	// ll ans = 1;
	// while (y>0) {
		// if (y&1) {
			// ans = (x*ans) % MOD;
		// }
		// y /= 2;
		// x = (x*x) % MOD;
	// }
	// return (ans % MOD);
// }

// ll modmul(ll a, ll b) {
    // return ((a%MOD) * (b%MOD)) % MOD;
// }

// ll modadd(ll a , ll b){
    // return((a%MOD)+(b%MOD)+MOD)%MOD;
// }

// ll modsub(ll a , ll b){
    // return((a%MOD) - (b%MOD) + MOD)%MOD;
// }
#define MOD 1000000007
// int n;
// vector<int> a;
// void solution() {
	// cin >> n;
	// a.resize(n);
	// for (auto& e:a) {
		// cin >> e;
	// }
// }
ll lcm(ll a, ll b) {
	return a/__gcd(a,b)*b;
}
int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	ll a,b;
	cin >> a >> b;
	cout << lcm(a,b) << '\n';
	return 0;
}


Measured memory_bytes: 3616
import sys
readline=sys.stdin.readline

X,Y,A,B,C=map(int,readline().split())
P=sorted(list(map(int,readline().split())))
Q=sorted(list(map(int,readline().split())))
R=sorted(list(map(int,readline().split())))

# X,Y個を越えたP,Qは使わない
P=P[-X:]
Q=Q[-Y:]
R=R[-(X+Y):][::-1]
#print(P,Q,R)
PQ=sorted(P+Q)
#print("PQ",PQ)

allsum=sum(PQ)
rsum=0 # rの総数
ind=0
# Rをいくつ使うかのループを回す
for i in range(len(R)):
  if allsum-PQ[i]+R[i]>allsum:
    allsum=allsum-PQ[i]+R[i]
  else:
    break
print(allsum)

Measured memory_bytes: 23896
using System.Linq;
using static System.Console;
using static System.Math;
class Z { static void Main() => new _K(); }
class _K
{
	int[] G => Strs.Select(int.Parse).ToArray();
	string[] Strs => ReadLine().Split();
	int K, L;
	readonly int[,,] sum;
	public _K()
	{
		var I = G;
		K = I[1];
		L = 4 * K;
		sum = new int[L + 1, L + 1, 2];
		var tot = new int[2];
		for (var i = 0; i < I[0]; i++)
		{
			var S = Strs;
			var c = S[2] == "B" ? 0 : 1;
			Add(int.Parse(S[0]) % (2 * K) + 1, int.Parse(S[1]) % (2 * K) + 1, c);
			tot[c]++;
		}
		for (var c = 0; c < 2; c++)
		{
			for (var x = 0; x < L; x++) for (var y = 0; y <= L; y++) sum[x + 1, y, c] += sum[x, y, c];
			for (var x = 0; x <= L; x++) for (var y = 0; y < L; y++) sum[x, y + 1, c] += sum[x, y, c];
		}
		var max = 0;
		for (var i = 0; i < K; i++) for (var j = 0; j < K; j++)
			{
				var a = Sum(i, j, 0);
				var b = Sum(i, j, 1);
				max = Max(max, Max(a + b, I[0] - a - b));
			}
		WriteLine(max);
	}
	void Add(int x, int y, int c)
	{
		sum[x, y, c]++;
		sum[x + 2 * K, y, c]++;
		sum[x + 2 * K, y + 2 * K, c]++;
		sum[x, y + 2 * K, c]++;
	}
	int Sum(int i, int j) => Sum(i, j, 0) + Sum(i, j, 1);
	int Sum(int i, int j, int c) => c == 0 ? Sum0(i, j, 0) + Sum0(i + K, j + K, 0) : Sum0(i, j + K, 1) + Sum0(i + K, j, 1);
	int Sum0(int i, int j, int c) => sum[i + K, j + K, c] - sum[i + K, j, c] - sum[i, j + K, c] + sum[i, j, c];
}


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

using namespace std;

int main() {

	string str;

	getline(cin, str);

	for (int i = 0; i < str.size(); i++) {
		if (str[i] >= 'A' && str[i] <= 'Z') {
			str[i] -= 'A' - 'a';
		}
		else if (str[i] >= 'a' && str[i] <= 'z') {
			str[i] += 'A' - 'a';
		}
	}
	cout << str << endl;

}


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

const int mod = 1000000007;
int c[2010][2010];

int main() {
	for (int i = 0; i < 2000; ++i) {
		c[i][0] = c[i][i] = 1;
		for (int j = 1; j < i; ++j)
			c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;
	}
	int S; scanf("%d", &S);
	int ans = 0;
	for (int i = 1; i <= S / 3; ++i)
		ans = (ans + c[S - 2 * i - 1][i - 1]) % mod;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 17620
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

int main() {
    int ans = 0;
    int tmp;
    int n,m;
    cin >> n >> m;
    cout << (n-1)*(m-1) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
const int N = 2e5 + 10;
int n, a[N];
long long sum[N], tot;
int main() {
    scanf("%d", &n);
    for(int i=1;i<=n;i++)scanf("%d", &a[i]),sum[a[i]]++;
    for(int i=1;i<=n;i++)tot+=sum[i]*(sum[i]-1)/2;
    for(int i=1;i<=n;i++)printf("%lld\n",tot-(sum[a[i]]-1));
    return 0;
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+50;
int gi(){
    char ch=getchar(); int x=0,q=0;
    while(ch<'0'||ch>'9') q=ch=='-'?1:q,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return q?-x:x;
}
int head[N],nn[N<<1][2],f[N],cnt;
#define link(u,v) (nn[++cnt][1]=v,nn[cnt][0]=head[u],head[u]=cnt)
void dfs(int x,int fa){
    f[x]=2;
    for (int i=head[x],y; i; i=nn[i][0])
	if ((y=nn[i][1])!=fa){
	    dfs(y,x);
	    if (f[y]==1) continue;
	    if (!f[y]) f[x]=0;
	    else{
		if (f[x]==2) f[x]=1;
		else f[x]=0;
	    }
	}
    return;
}
int main(){
    int n=gi(),a,b;
    for (int i=2; i<=n; ++i)
	a=gi(),b=gi(),link(a,b),link(b,a);
    dfs(1,0);
    if (f[1]!=1) cout<<"First";
    else cout<<"Second";
    return 0;
}


Measured memory_bytes: 2560
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        final List<Integer> divide = new ArrayList<>();

        for (int i = 1; ; i++) {
            final int tmp = (int) Math.pow(9, i);
            if (tmp > n) {
                break;
            }
            divide.add(tmp);
        }

        for (int i = 1; ; i++) {
            final int tmp = (int) Math.pow(6, i);
            if (tmp > n) {
                break;
            }
            divide.add(tmp);
        }

        divide.add(1);
        divide.sort(Comparator.naturalOrder());

        final int[][] dpTable = new int[divide.size()][n + 1];
        for (int i = 1; i < n + 1; i++) {
            dpTable[0][i] = i;
        }

        for (int i = 1; i < divide.size(); i++) {
            final int d = divide.get(i);
            for (int j = 0; j < n + 1; j++) {
                if (j < d) {
                    dpTable[i][j] = dpTable[i - 1][j];
                    continue;
                }

                dpTable[i][j] = Math.min(dpTable[i - 1][j], dpTable[i][j - d] + 1);
            }
        }

        System.out.println(dpTable[divide.size() - 1][n]);
    }
}


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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    LL x;
    cin >> x;
    LL p = x/11;
    if(x - p*11 == 0) {
        cout << 2*p << endl;
    }else if(x - p*11 <= 6){
        cout << 2*p + 1 << endl;
    }else{
        cout << 2*p + 2 << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#define MAX 1001
void c2s(char str[]){
	int i;
	for(i = 0; str[i] != 0; i++){
		if(str[i] == ','){
			str[i] = ' ';
		}
	}
}
void swap(int arr[], int x, int y){
	int k;
	k = arr[x];
	arr[x] = arr[y];
	arr[y] = k;
}
int main(void){
	int i;
	char x,y;
	char str[MAX];
	int arr[3] = {1,0,0};
	while(scanf("%s",str) != EOF){
		c2s(str);
		sscanf(str,"%c %c",&x,&y);
		swap(arr,x-'A',y-'A');
	}
	for(i = 0; i < 3; i++){
		if(arr[i]){
			printf("%c\n",i+'A');
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 0
// 基本テンプレート

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

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

signed main() {
    string s; cin >> s;
    int prev = -1, cnt = 0;
    rep(i,0,s.length()) {
        int c = s[i] - '0';
        if(prev != c) {
            prev = c;
            cnt = 1;
        }
        else cnt++;
        if(cnt >= 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

int main(){
    int a, b;
    int x;
    cin >> a >> b;
    if((a + b) % 2 == 0){
        x = (a + b) / 2;
        cout << x << endl;
    }else{
        x = (a + b) / 2;
        x++;
        cout << x << endl;
    }
}

Measured memory_bytes: 3524
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] s = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            s[i] = sc.nextInt();
            sum += s[i];
        }
        Arrays.sort(s);
        if (sum % 10 != 0) {
            System.out.println(sum);
        } else {
            boolean bre = false;
            for (int i = 0; i < n; i++) {
                if (s[i] % 10 != 0) {
                    System.out.println(sum - s[i]);
                    bre = true;
                    break;
                }
            }
            if (!bre) {
                System.out.println(0);
            }
        }
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define inf 1000000000 //1E+9
#define mod 1000000007
using std::cin;
using std::cout;
using std::endl;

int main(){
	int a,b,c,d,e;cin>>a>>b>>c>>d>>e;
	int f,g,h,i,j;
	if(a%10==0)f=10;else{f=a%10;a+=10-f;}
	if(b%10==0)g=10;else{g=b%10;b+=10-g;}
	if(c%10==0)h=10;else{h=c%10;c+=10-h;}
	if(d%10==0)i=10;else{i=d%10;d+=10-i;}
	if(e%10==0)j=10;else{j=e%10;e+=10-j;}
	if(f+g+h+i+j==0)cout<<a+b+c+d+e<<endl;
	else cout<<a+b+c+d+e-10+std::min({f,g,h,i,j})<<endl;
	return 0;
}

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

namespace ABC080A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, a, b, x;
            var word = Console.ReadLine().Split(' ');

            n = int.Parse(word[0]);
            a = int.Parse(word[1]);
            b = int.Parse(word[2]);

            x = a * n;
            if (x > b)
                x = b;

            Console.WriteLine(x);

            Console.ReadKey();

        }
    }
}

Measured memory_bytes: 13140
a = [input().split() for l in range(3)]
n = int(input())
b = [input() for i in range(n)]


for j in range(n):
    for p in range(3):
        for q in range(3):
            if(a[p][q] == b[j]):
                a[p][q] = 0

        '''
        try:
            pos = (y, row.index("G"))
            break
        except ValueError:
            pass
        '''
if (a[0][0] == 0 and a[0][1] == 0 and a[0][2] == 0):
    print("Yes")
elif(a[1][0] == 0 and a[1][1] == 0 and a[1][2] == 0):
    print("Yes")
elif(a[2][0] == 0 and a[2][1] == 0 and a[2][2] == 0):
    print("Yes")
elif(a[0][0] == 0 and a[1][0] == 0 and a[2][0] == 0):
    print("Yes")
elif(a[0][1] == 0 and a[1][1] == 0 and a[2][1] == 0):
    print("Yes")
elif(a[0][2] == 0 and a[1][2] == 0 and a[2][2] == 0):
    print("Yes")
elif(a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0):
    print("Yes")
elif(a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fozubaoyou    pass System Test!
*/


//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main(){
    int n;
    cin >> n;
    VI a(n);
    REP(i,n){
        cin >> a[i];
    }
    
    bool s = true;
    VI b;
    REP(i,n){
        if(a[i]%2==0) b.push_back(a[i]);
    }
    
    int m;
    m = b.size();
    
    REP(i,m){
        if( (b[i]%3==0) || (b[i]%5==0) ){
            s = true;
        }else{
            s = false;
            break;
        }
    }


    if(s){
        cout << "APPROVED";
    }else{
        cout << "DENIED";
    }

    cout << endl;
    
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int N,M;
  scanf("%d%d",&N,&M);

  int gcd=1;
  int p;//探索範囲
  p=M/N;
  int a=1;

  while(p>=2){
    a=1;
    for(int i=p;i>=2;i--){
      if(M%i==0){
        M=M/i;
        gcd=gcd*i;
        p=M/N;
        a=0;
        break;
      }
    }
    if(a==1) break;
  }

  printf("%d\n",gcd);
  return 0;
}


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

ll n, k;
vector<ll> v;

int main() {
    cin >> n >> k; v.resize(n);
    for (int i = 0; i < n; i++) scanf("%Ld", &v[i]);

    ll res = -(1e18);
    for (int i = 0; i <= min(k,n); i++) {
        for (int j = 0; j <= i; j++) {
            vector<ll> getj;
            for (int l = 0; l < j; l++) getj.push_back(v[l]); 
            for (int r = 0; r < i-j; r++) getj.push_back(v[n-1-r]);
            ll sum = accumulate(getj.begin(), getj.end(), 0);
            sort(getj.begin(), getj.end());
            for (int ii = 0; ii < min(k-i, (ll)getj.size()); ii++) {
                if (getj[ii] < 0) sum -= getj[ii];
            }
            res = max(res, sum);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256