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

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

bool ok(int n, vector<string> g, vector<string> cls) {
	vector<bitset<14>> inDeg(n), outDeg(n);

	for (int i = 1; i < n; i++) {
		if (cls[i].size() != i) {
			return false;
		}
		for (int j = 0; j < i; j++) {
			if (g[i][j] == '1') {
				outDeg[i][cls[i][j] - 'a'] = true;
				inDeg[j][cls[i][j] - 'a'] = true;
			} else {
				outDeg[j][cls[i][j] - 'a'] = true;
				inDeg[i][cls[i][j] - 'a'] = true;
			}
		}
	}

	bool ok = true;

	for (int i = 0; i < n && ok; i++) {
		for (int j = 0; j < 14; j++) {
			if (outDeg[i][j] && inDeg[i][j]) {
				ok = false;
				break;
			}
		}
	}

	return ok;
}

bool solvable(int n, const vector<string> &g) {
	mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
	int iter = 50000;

	while (iter--) {
		vector<string> cls(n);
		uniform_int_distribution<char> uid('a', 'n');
		vector<bitset<14>> inDeg(n), outDeg(n);

		for (int i = 1; i < n; i++) {
			for (int j = 0; j < i; j++) {
				cls[i] += uid(gen);

				if (g[i][j] == '1') {
					outDeg[i][cls[i][j] - 'a'] = true;
					inDeg[j][cls[i][j] - 'a'] = true;
				} else {
					outDeg[j][cls[i][j] - 'a'] = true;
					inDeg[i][cls[i][j] - 'a'] = true;
				}
			}
		}

		bool ok = true;

		for (int i = 0; i < n && ok; i++) {
			for (int j = 0; j < 14; j++) {
				if (outDeg[i][j] && inDeg[i][j]) {
					ok = false;
					break;
				}
			}
		}

		if (ok) {
			return true;
		}
	}

	return false;
}

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

#ifdef LOCAL
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	auto START = chrono::steady_clock::now();
#endif

	int n;
	cin >> n;

	vector<string> a(n);

	for (string& x : a) {
		cin >> x;
	}

	sort(a.begin(), a.end());

	cout << (unique(a.begin(), a.end()) - a.begin());

#ifdef LOCAL
	cerr << "Working time: " << chrono::duration_cast<chrono::milliseconds>(chrono::steady_clock::now() - START).count()
			 << " ms.";
#endif

	return 0;
}

Measured memory_bytes: 9544
#include <queue>
#include <tuple>
#include <vector>
#include <iostream>
using namespace std;
int H, W, sx, sy; vector<vector<char> > M;
const vector<char> dx = { 0, 1, 0, -1 };
const vector<char> dy = { 1, 0, -1, 0 };
int main() {
	while (true) {
		cin >> W >> H;
		if (H == 0 && W == 0) break;
		M = vector<vector<char> >(H, vector<char>(W));
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cin >> M[i][j];
				if (M[i][j] == '2') sx = j, sy = i;
			}
		}
		bool flag = false;
		queue<tuple<char, char, char, vector<vector<char> > > > que; que.push(make_tuple(sx, sy, 0, M));
		while (!que.empty()) {
			char x = get<0>(que.front());
			char y = get<1>(que.front());
			char t = get<2>(que.front());
			vector<vector<char> > M2 = get<3>(que.front()); que.pop();
			if (t >= 10) {
				break;
			}
			for (int i = 0; i < 4; i++) {
				char tx = x;
				char ty = y;
				char td = 0;
				while (true) {
					if (M[ty][tx] == '3') {
						cout << (int)(t + 1) << endl; flag = true; goto Exit;
					}
					if (0 <= ty + dy[i] && ty + dy[i] < H && 0 <= tx + dx[i] && tx + dx[i] < W) {
						if (M2[ty + dy[i]][tx + dx[i]] == '1') {
							if (td != 0) {
								if (t < 9) {
									vector<vector<char> > M3 = M2; M3[ty + dy[i]][tx + dx[i]] = '0';
									que.push(make_tuple(tx, ty, t + 1, M3));
								}
							}
							break;
						}
						tx += dx[i];
						ty += dy[i];
						td++;
					}
					else {
						break;
					}
				}
			}
		}
	Exit:;
		if (!flag) {
			cout << -1 << endl;
		}
	}
	return 0;
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;

vector<int> edge[100005];

int main() {
    int n, m;
    cin >> n >> m;
    REP(i, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }

    vector<int> ans(n);
    ans[0] = 0;
    vector<bool> visit(n, false);
    visit[0] = true;
    queue<int> que;
    que.push(0);

    while(que.size() > 0) {
        int loop = que.size();
        REP(i, loop) {
            int tugi = que.front();
            que.pop();
            for(auto room: edge[tugi]) {
                if(visit[room]) continue;
                visit[room] = true;
                ans[room] = tugi;
                que.push(room);
            }
        }
    }

    cout << "Yes" << endl;
    REPN(i, 1, n) {
        cout << ans[i]+1 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 10120
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a * b / gcd(a, b); }

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)


int main() {
	ll a, b, c, x, y;
	ll p,ans;
	in(a);
	in(b);
	in(c);
	in(x);
	in(y);

	if (2*c < a+b ) {
		if (x < y) {
			ans = c * x * 2;
			if (2 * c < b) {
				ans += c * (y - x) * 2;
			}
			else {
				ans += b * (y - x);
			}
		}
		else {
			ans = c * y * 2;
			if (2 * c < a) {
				ans += c * (x - y) * 2;
			}
			else {
				ans += a * (x - y);
			}
		}
	}
	else {
		ans = a * x + b * y;
	}

	outn(ans);
	return 0;

	}
	

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#define N_MAX 100000
#define NAME_LEN 10

struct q {
	char name[NAME_LEN+1];
	int time;
	struct q *next;
};

int
main(void)
{
	int i, n, qtm;
	struct q *head = NULL;
	struct q *tail = NULL;
	int time = 0;

	scanf("%d", &n);
	scanf("%d", &qtm);
	for (i = 0; i < n; i++) {
		struct q *a = (struct q *)malloc(sizeof(struct q));
		if (a == NULL)
			return 1;
		scanf("%s", a->name);
		scanf("%d", &a->time);
		a->next = NULL;
		if (head == NULL)
			head = a;
		if (tail == NULL) {
			tail = a;
		} else {
			tail->next = a;
			tail = a;
		}
	}

	while (n) {
		if (head->time <= qtm) {
			struct q *a = head;
			time += a->time;
			printf("%s %d\n", a->name, time);
			head = a->next;
			free(a);
			n--;
			continue;
		}
		head->time -= qtm;
		time += qtm;
		tail->next = head;
		tail = head;
		head = head->next;
	}

  return 0;
}



Measured memory_bytes: 3248
/* kadai3_4
   Saikyo_Kazune
*/
#include <stdio.h>
 
 
int main(void){
   //int型　N,判定用にjudgeを宣言
   int num,judge=0;
   scanf("%d",&num);
   for(int i=1;i<=9;i++){
       for(int j=1;j<=9;j++){
           if(num==i*j){
               judge=1;
           }
       }
   }
   if(judge){
        printf("Yes\n");
   }
   else{
       printf("No\n");
   }
   return 0;
}

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

using namespace std;

int main()
{
    string S;
    cin >> S;

    int count = 0;
    for(const auto& s : S){
        count++;

        if(count % 2 == 0){
            if(s!='i'){
                cout << "No" << endl;
                return 0;
            }
        }else if(count % 2 == 1){
            if(s!='h'){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    if(count % 2 != 0){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;

    return 0;
}

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

#define Khaled ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lli long long int
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define dbg(x) cout << x << endl
#define FOR(i, n) for (i = 0; i < n; i++)
#define FO(i,k,n) for(i = k; i <= n; i++)
#define in(v) for(auto &it : v) cin >> it;
#define out(v) for(auto it : v) cout << it << ' '; cout << endl;
#define all(arr) arr.begin(), arr.end()
#define rall(arr) arr.rbegin(), arr.rend()
#define PI acos(-1)
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define MAX 100005
 
using namespace std;

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<lli> vlli;

string let = "abcdefghijklmnopqrstuvwxyz";

void solve()
{
    lli i, j, n, m, a, b, c, d, x, y, z, k, l;
    cin >> n;
    a = 1;
    lli ans = 0;

    FO(i,1,n-1) {
        ans += ((n-1) / i);
    }
    dbg(ans);
    
    return;
}

int main()
{
    Khaled
    // freopen("input", "r", stdin);
    // freopen("output" , "w" , stdout);
    int t = 1,i;
    // cin >> t;
    FO(i,1,t) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3684
include Math
require 'prime'

n = gets.to_i
root_prime = Prime.each(10000).to_a
c = 0

n.times {
  catch(:next) do
    x = gets.to_i
    if (x <= 10000)
      c += 1 if (root_prime.index(x) != nil)
      throw :next
    end
    xs = sqrt(x).floor
    root_prime.each{ |rp|
      break if (rp > xs)
      throw :next if (x % rp == 0)
    }
    c += 1
  end
}
puts c

Measured memory_bytes: 9032
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var ir = new Resolver(new ConsoleReader());
            Console.WriteLine(ir.Resolve());
        }
    }

    public class Resolver
    {
        IInputReader InputReader { get; }
        public List<string> Messages { get; set; } = new List<string>();

        int s;

        public void ParseLines(){
            s = int.Parse(InputReader.ReadLine());
        }

        int myFunction(int n){
            if (n % 2 == 0) return n / 2;
            return 3 * n + 1;
        }


        public string Resolve()
        {
            int i = 1;
            var nums = new List<int>();
            nums.Add(s);

            while(true){
                i++;
                s = myFunction(s);
                if (nums.Contains(s)) break;
                nums.Add(s);
            }

            return i.ToString();
        }



        public Resolver(IInputReader inputReader)
        {
            InputReader = inputReader;
            ParseLines();
        }

    }

    public interface IInputReader
    {
        string ReadLine();
    }

    class ConsoleReader : IInputReader
    {
        string IInputReader.ReadLine()
        {
            return Console.ReadLine();
        }
    }
}


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

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

    long long ans = 0;
    for (long long i = 1; i < N + 1; i++) {
        if (i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
def main():
    s = input()
    t = input()
    ans = 'No'
    s2 = s * 2
    for i in range(len(s2)):
        if t == s2[i:i + len(s)]:
            ans = 'Yes'
            break
    print(ans)



if __name__ == '__main__':
    main()

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

int main(){
    int n,i,j;
    double d;
    cin>>n;
    int x[n],y[n],a[n];
    for(i=0; i<n; i++)
        cin>>x[i]>>y[i];
    for(i=0; i<n; i++)
        a[i]=i;
    do
    {
        for(i=1; i<n; i++)
        {
            int x2=x[a[i]]-x[a[i-1]],y2=y[a[i]]-y[a[i-1]];
            d+=sqrt((x2*x2)+(y2*y2));
        }

    }
    while(next_permutation(a,a+n));
    i=1;
    int n2=1;
    while(i<=n)
        n2*=i,i++;
    cout<<fixed<<setprecision(10)<<d/n2;
    return 0;
}


Measured memory_bytes: 3800
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
const int N=2005;

int n;
int a[N],b[N],ty[N*2],x[N*2];
int sa[N*2][N],sb[N*2][N];
int dp[N][N];
void up(int &x,int t) {if (t<x) x=t;}


int main()
{
	scanf("%d",&n);
	char s[2];
	for (int i=1;i<=n*2;i++)
	{
		scanf("%s",s);
		scanf("%d",&x[i]);
		if (s[0]=='W') a[x[i]]=i,ty[i]=0;else b[x[i]]=i,ty[i]=1;
	}

	for (int i=n*2;i>=1;i--) 
	for (int j=1;j<=n;j++) 
	{
		if (ty[i]==0)
		sa[i][j]=sa[i+1][j]+(j>=x[i]?1:0),sb[i][j]=sb[i+1][j];
		else 
		sb[i][j]=sb[i+1][j]+(j>=x[i]?1:0),sa[i][j]=sa[i+1][j];
		
		//printf("sa[%d][%d]=%d sb=%d\n",i,j,sa[i][j],sb[i][j]);
	}

	memset(dp,0x3f3f3f3f,sizeof(dp));
	dp[0][0]=0;
	for (int x=0;x<=n;x++)
		for (int y=0;y<=n;y++) 
		{
			if (x==n&&y==n) {printf("%d\n",dp[x][y]);return 0;}
			if (x<n) up(dp[x+1][y],dp[x][y]+sa[a[x+1]][x]+sb[a[x+1]][y] );
			if (y<n) up(dp[x][y+1],dp[x][y]+sa[b[y+1]][x]+sb[b[y+1]][y] );
		}
	return 0;
}

Measured memory_bytes: 78592
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
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; }
const long double PI = acos(-1.0);
// cout << fixed << setprecision(14);
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M, K;
	cin >> N >> M >> K;
	int A[N], B[M];
	rep(i,N){
		cin >> A[i];
	}
	rep(i,M) cin >> B[i];
	vector<int> dp1(N+1, 0), dp2(M+1, 0);
	rep(i,N){
		dp1[i+1] = dp1[i]+A[i];
	}
	rep(i,M){
		dp2[i+1] = dp2[i]+B[i];
	}
	int ans = 0;
	rep(i,N+1){
		int W = K - dp1[i];
		if(W < 0) continue;
		int ans1 = i+ (upper_bound(dp2.begin(), dp2.end(), W) - dp2.begin()) - 1;
		chmax(ans, ans1);
	}
	cout << ans << endl;
}

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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using plglg = pair<ll, ll>;
using tlglglg = tuple<ll, ll, ll>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
inline void yesno(bool ok, string yes = "Yes", string no = "No") {cout << (ok?yes:no) << endl;}


signed main() {
    //my-code
    int n; cin >> n;
    map<string, int> mp;
    REP(i, n) {
        string s; cin >> s;
        mp[s]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main() {
  
  int N;
  cin >> N;
  vector<string> vecN(N);
  
  for(int i = 0 ; i < N ; i++){
    cin >> vecN.at(i);
  }
  
  int M;
  cin >> M;
  vector<string> vecM(M);
  
  for(int i = 0 ; i < M ; i++){
    cin >> vecM.at(i);
  }
  
  vector<int> vecX(N);
  
  for(int i = 0 ; i < N ; i++ ){
    
    int sum = 0;
    
    for(int k = 0 ; k < N ; k++){
      if(vecN.at(i) == vecN.at(k)){
        sum ++;
      }
    }
      
    for(int k = 0 ; k < M ; k++){
      if(vecN.at(i) == vecM.at(k)){
         sum --;
      }
    }
    vecX.at(i) = sum;
  }
  
  if(N == 1){
    if(vecX.at(0) > 0){
      cout << vecX.at(0) << endl;
    }else{
      cout << 0 << endl;
    }
  }else{
    for(int i = 0 ; i < N-1 ; i++){
      if(vecX.at(i) > vecX.at(i+1)){
        vecX.at(i+1) = vecX.at(i);
      }
    }
    if(vecX.at(N-1) > 0){
      cout << vecX.at(N-1) <<endl;
    }else{
      cout << 0 << endl;
    }
  }
}

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

typedef pair<double,double> P;

list<P> li;

list<P>::iterator genTri(list<P>::iterator itr){
	P p1 = *itr;
	itr++;
	if(itr == li.end()){
		return itr;
	}
	P p2 = *itr;
	P s = make_pair((p1.first * (2.0/3.0) + p2.first / 3.0),(p1.second * (2.0/3.0) + p2.second / 3.0));
	P t = make_pair((p1.first / 3.0 + p2.first * (2.0/3.0)),(p1.second / 3.0 + p2.second * (2.0/3.0)));
	P center = make_pair((p1.first + p2.first) / 2.0,(p1.second + p2.second) / 2.0);
	double r = sqrt(3) / 2.0;
	double y = t.first - s.first;
	double x = -(t.second - s.second);
	P u = make_pair(center.first + r*x,center.second + r*y);

	itr = li.insert(itr,t);
	itr = li.insert(itr,u);
	itr = li.insert(itr,s);
	itr++; itr++; itr++; // itr = p2
	return itr;
}

void printList(){
	for(list<P>::iterator itr = li.begin(); itr != li.end(); itr++){
		P p = *itr;
		printf("%.8f %.8f\n",p.first,p.second);
	}
}

int main(){
	li = list<P>();
	li.push_back(make_pair(0.0,0.0));
	li.push_back(make_pair(100.0,0.0));

	int n;
	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		list<P>::iterator itr = li.begin();
		while(itr != li.end()){
			itr = genTri(itr);
		}
	}
	printList();
	return 0;
}



Measured memory_bytes: 3376
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		double p = Math.sqrt(m);
		int max = 1;
		
		for(int i = 1 ; i <= p ;i++) {
			if(m % i == 0) {
				int temp1 = m/i;
				int temp2 = i;
				int k = 1;
				if(temp1 >= n) {
					if(temp1 % n == 0) {
						k = temp1/n;
					}
					max = Math.max(temp2* k , max);
					k = 1;
				}
				if(temp2 >= n) {
					if(temp2 % n == 0) {
						k = temp2/n;
					}
					max = Math.max(temp1 * k, max);
				}
			}
		}
		System.out.println(max);
		}
	

}

Measured memory_bytes: 23764
#include<stdio.h>

int main(void)
{

    int a, b, c, d, p, x, y;

    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    scanf("%d", &d);
    scanf("%d", &p);

    x = a * p;
    y = b;
    if(p > c)
        y += (p - c) * d;

    if(x > y)
        printf("%d\n", y);
    else
        printf("%d\n", x);

    return 0;
}

Measured memory_bytes: 1844
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
  
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            List<int> Z = new List<int>();
            int tmp = 753;
            int tmpA = 753;
            for(int i = 0; i < S.Length-2; i++)
            {
                Z.Add(int.Parse(S.Substring(i, 3)));
            }
            for(int j = 0; j < Z.Count; j++)
            {
                tmpA = Math.Min(tmpA, Math.Abs(tmp - Z[j]));

            }
            Console.WriteLine(tmpA);
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
long long int max(long long int a,long long int b){

if(a>=b){
	return a;
}
return b;
}

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

	return 0;
}

Measured memory_bytes: 5164
#include <stdio.h>
int main()
{
	int i, N, a[10], w[10], judge = 0;
    int Right_Ans = 2000,Left_Ans = 2000;//初期値は1000より上の数字
   
    scanf("%d",&N);//人数
	for (i = 0; i<N; i++) 
	{
		scanf("%d", &a[i]);
		judge += a[i];
	}
	if (judge == 0 || judge == N)//全員右利き or 全員左利き
	{
		printf("0\n");//不満度0で終了
		return 0;
    }  
     
    for(i=0;i<N;i++)
	{
        scanf("%d",&w[i]);//不満度
		if (a[i] == 0 && Right_Ans > w[i])
		{
			Right_Ans = w[i];//右利きの不満度最小値
		}
		else if (a[i] == 1 && Left_Ans > w[i])
		{
			Left_Ans = w[i];//左利きの不満度最小値
		}
    } 
    printf("%d\n",Right_Ans + Left_Ans);
    return 0;
}



Measured memory_bytes: 2104
from bisect import bisect
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    S = input()

    rgb = {'R': [], 'G': [], 'B': []}
    for i, s in enumerate(S):
        rgb[s].append(i)

    def count_(s1, s2):
        ret = 0
        x = bisect(rgb[s1], i)
        for j in rgb[s1][x:]:
            y = bisect(rgb[s2], j)
            d = j - i
            if j + d < N and S[j+d] == s2:
                ret += len_[s2] - y - 1
            else:
                ret += len_[s2] - y
        return ret

    ans = 0
    len_ = {'R': len(rgb['R']), 'G': len(rgb['G']), 'B': len(rgb['B'])}
    for i, s in enumerate(S):
        if s == 'R':
            for s1, s2 in (('G', 'B'), ('B', 'G')):
                ans += count_(s1, s2)
        elif s == 'G':
            for s1, s2 in (('R', 'B'), ('B', 'R')):
                ans += count_(s1, s2)
        else:
            for s1, s2 in (('R', 'G'), ('G', 'R')):
                ans += count_(s1, s2)
    print(ans)


main()


Measured memory_bytes: 77900
// C - Write and Erase
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define all(x) (x).begin(),(x).end()

int main(){
	int N; cin>>N;
	vi A(N);
	rp(i, 0, N) cin>>A[i];
	sort(all(A));
	int ans = 0;
	int count = 1;
	rp(i, 0, N-1){
		if(A[i] == A[i+1]){
			count++;
		}
		else{
			if(count&1) ans++;
			count = 1;
		}
	}
	if(count&1) ans++;
	printf("%d\n", ans);
}

Measured memory_bytes: 640
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;


#[fastout]
fn main() {
    input! {
    s: Chars,
    t: Chars
    }
    for i in t {
        print!("{}", i)
    }
    for i in s {
        print!("{}", i)
    }
}



Measured memory_bytes: 2060
#include <iostream>
#include <utility>
#include <cstdio>
using namespace std;

int main(){
    int w, n, a, b;
    int amida[31];
    
    for(int i = 0;i < 31;i++){
        amida[i] = i;
    }
    
    cin >> w >> n;
    
    for(int i = 0;i < n;i++){
        scanf("%d,%d",&a,&b);
        swap(amida[a],amida[b]);
    }
    
    for(int i = 1;i <= w;i++){
        cout << amida[i] << endl;
    }
}

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

signed main(){
  priority_queue<int> pque;
  string s;cin>>s;
  while(s!="end"){
    if(s=="insert"){
      int a;cin>>a;
      pque.push(a);
    }
    else{
      cout<<pque.top()<<endl;
      pque.pop();
    }
    cin>>s;
  }
}



Measured memory_bytes: 6972
#include <iostream>
using namespace std;
int main(){
    int a,b;
    while(a!=0 || b!=0){
    cin >> a;
    cin >> b;
    for(int c=0; c<a; c++){
        for(int d=0; d<b; d++){
           cout << "#";
        }   
        cout << "\n";
    }
    if(a!=0 || b!=0){
        cout << "\n";
    }
    }
    return 0;
}


Measured memory_bytes: 2980
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>

using namespace std;

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

#define INF INT_MAX / 2 - 1
#define PI 2*acos(0.0)
#define ll long long

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

int main() {
	int n, m;
	cin >> n >> m;
	int c[20];
	REP(i, m)
		cin >> c[i];
	int dp[50001];
	fill_n(dp, 50001, INF);
	dp[0] = 0;
	REP(i, m)
	FOR(j, c[i], n+1)
		dp[j] = min(dp[j], dp[j-c[i]] + 1);
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1356
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];
    bool ok=true;
    for(int i=0; i<n; i++){
        if(a[i]%2==0){
            if(a[i]%3==0||a[i]%5==0){

            }else{
                ok=false;
            }
        }
    }
    if(ok) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double eps = 1e-11;
int64_t com[64][64];
int main() {
    com[0][0] = 1;
    for (int i = 1; i < 64; ++i) {
        for (int j = 0; j <= i; ++j) {
            com[i][j] += com[i - 1][j];
            if (j > 0) com[i][j] += com[i - 1][j - 1];
        }
    }

    int n, a, b; cin >> n >> a >> b;
    vector<uint64_t> values(n);
    for (auto &v: values) cin >> v;

    sort(values.begin(), values.end(), greater<>());

    uint64_t sum = 0;
    rep(i, a) {
        sum += values[i];
    }
    double avg = sum / (double) a;

    int64_t res = 0;
    int cnt = 0;
    for (auto &v: values) {
        if (v == values[a - 1]) ++cnt;
    }

    if (values[0] == values[a - 1]) {
        for (int j = a; j <= b; j++) {
            res += com[cnt][j];
        }
    } else {
        int x = 0;
        rep(i, a) if (values[i] == values[a - 1]) ++x;
        res += com[cnt][x];
    }
    printf("%.7f\n", avg);
    cout << res << endl;
}


Measured memory_bytes: 888
#include <stdio.h>
#include <iostream>
#include <algorithm>

using namespace std;
#define BUF (1000)

int a,b,c,d;
void input(void){
	cin >> a >> b >> c >> d ;
}

int main(void){
	input();

	int fa=0;
	int fb=0;
	int cnt = 0;
	for(int i=0;i<=100;i++){
		fa=0;fb=0;
		if(a<=i && i<b) fa = 1;
		if(c<=i && i<d) fb = 1;
		if(fa==1 && fb==1) cnt++;
	}
	

	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
/*全てのリンゴを偶数にした側が勝利。0番目は犬とする*/

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

int main(){
  int N;
  cin>>N;
  int ans=0;
  
  vector <int> a(N);
  
  for(int i=0;i<N;i++){
    cin>>a.at(i);
     if(a.at(i) % 2 == 1){
      ans++;  
     }  
  }
  if(ans==0)
    cout<<"second"<<endl;
  else
    cout<<"first"<<endl;
}
 
    

Measured memory_bytes: 640
import std.stdio, std.algorithm, std.range, std.array, std.conv, std.string, std.math, std.container, std.typecons;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.to!(int[]);
    auto B = readln.split.to!(int[]);
    N.iota.map!(i => A[0..i+1].sum + B[i..$].sum).reduce!max.writeln;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int x;
    cin >> x;
    int a=x/100,b=x%100;
    if (a*5<b) cout << 0 << endl;
    else cout << 1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <map>
using namespace std;
 
 
int main() {
    string s;
    cin>>s;
    int num[4];
    for(int i=0; i<4; ++i) num[i]=s[i]-'0';

    char op[2]={'+', '-'};
    for(int i=0; i<2; i++) {
        for(int j=0; j<2; j++) {
            for(int k=0; k<2; k++) {
                int ans=num[0];
                if(i==0) ans+=num[1];
                else ans-=num[1];
                if(j==0) ans+=num[2];
                else ans-=num[2];
                if(k==0) ans+=num[3];
                else ans-=num[3];
                if(ans==7) {
                    cout<<num[0]<<op[i]<<num[1]<<op[j]<<num[2]<<op[k]<<num[3]<<"=7"<<endl;
                    return 0;
                }
            }
        }
    }

    return 0;
}

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 ac = 0;
      	int wa = 0;
      	int tle = 0;
      	int re = 0;
	  	List<String> judges = new ArrayList<String>();
      	for(int i = 0; i <= N; i++){
	 		judges.add(sc.nextLine());
      	}
      	for(String str: judges){
        	switch(str){
          		case "AC":
            		ac ++;
                	break;
          		case "WA":
            		wa ++;
                	break;
          		case "TLE":
            		tle ++;
                	break;
          		case "RE":
            		re ++;
                	break;
        	}
      	}   
      	System.out.println("AC x " + ac );
      	System.out.println("WA x " + wa );
      	System.out.println("TLE x " + tle );
      	System.out.println("RE x " + re );
      
	}
}

Measured memory_bytes: 65672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;

int main() {
    int n; cin >> n;
    vector<ll> As(n);
    rep(i,n) cin >> As.at(i);
    ll xorall = As.at(0);
    rep(i,n-1){
        xorall ^= As.at(i+1);
    }
    rep(i,n){
        ll ansi = xorall^As.at(i);
        cout << ansi << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 4780
#include<queue>
#include<ctime>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<memory.h>
#include<map>
#include<ctime>
#include<algorithm>
#include<ctime>
#include<set>
#define ll long long
#define For(i,j,k)  for(ll i=j;i<=k;++i)
#define FOr(i,j,k)  for(ll i=j;i>=k;--i)
#define rep(i,j,k)	for(ll i=j;i<k;++i)
#define ld double
using namespace std;
inline ll read(){   ll x=0,f=1;char ch=getchar();   while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}  return x*f; }
inline void wrote(ll x){    if (x<0) putchar('-'),x=-x; if (x>=10) wrote(x/10);   putchar(x%10+'0');  }
inline void writeln(ll x){ wrote(x);   puts("");   }
const ll N=100010;
char s[N];
ll n,l,r,ned;
int main(){
	scanf("%s",s+1);	n=strlen(s+1);
	ll l=1,r=n;
	while(l<r){
		if (s[l]==s[r])	l++,r--;
		else{
			if (s[l]=='x')	l++,ned++;
			else if (s[r]=='x')	r--,ned++;
			else	return puts("-1"),0;
		}
	}writeln(ned);
}

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

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    if(a + b >= c){
        cout << b + c << endl;
    }else{
        ll k = a + b + 1;
        cout << k + b << endl;
    }
}

Measured memory_bytes: 256
m = 2019
z = 48

h = Hash.new(0)
h[0] = 1

cur = 0
p10 = 1

ans = 0
gets.to_s.chomp.bytes.reverse_each do |c|
  cur = ( cur + ( c - z ) * p10 ) % m
  ans += h[cur]
  h[cur] += 1
  p10 = p10 * 10 % m
end

puts ans

Measured memory_bytes: 16208
n=int(input())
min_sum=1000000

for a in range(1,n):
  l_a=str(a)
  l_b=str(n-a)
  
  sum_a=0
  sum_b=0
  for e_a in l_a:
    sum_a+=int(e_a)
  for e_b in l_b:
    sum_b+=int(e_b)
  sum_ab = sum_a+sum_b
  
  if sum_ab<min_sum:
    min_sum=sum_ab
    
print(min_sum)


Measured memory_bytes: 9004
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std;
// dfmt on

void main()
{
    long X, Y;
    scan(X, Y);
    if (Y & 1)
    {
        writeln("No");
        return;
    }
    if (X * 2 <= Y && Y <= X * 4)
    {
        writeln("Yes");
        return;
    }
    writeln("No");
}


Measured memory_bytes: 3588
#pragma GCC optimize("O3")
#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>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    while(1){
        int t, d, l; cin>>t>>d>>l;
        if(t == 0) break;
        int wet = 0, ans = 0;
        for(int i=0; i<t; i++){
            int x; cin>>x;
            if(l <= x) wet = d;
            if(0 < wet && i != t - 1) ans++;
            wet--;
        }

        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 200001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
ll gcd(ll a, ll b) { if(a < b) swap(a, b); if(b <= 0) return a; return gcd(b, a % b); }

int H, W;
vector<string> grid;
int cnt[2000][2000];
bool visited1[2000][2000];
bool visited2[2000][2000];

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    cin >> H >> W;
    for(int i = 0; i < H; i++)
    {
        string s; cin >> s; grid.push_back(s);
    }
    
    for(int i = 0; i < H; i++)
    {
        for(int j = 0; j < W; j++)
        {
            if(grid[i][j] == '#') continue;
            int acc = 1;
            
            if(visited1[i][j] == false)
            {
                int nx = i + 1;
                while(nx < H && grid[nx][j] != '#')
                {
                    acc += 1;
                    nx += 1;
                }
                for(int k = i; k < nx; k++)
                {
                    visited1[k][j] = true;
                    cnt[k][j] += acc;
                }
            }
            
            acc = 1;
            
            if(visited2[i][j] == false)
            {
                int ny = j + 1;
                while(ny < W && grid[i][ny] != '#')
                {
                    acc += 1;
                    ny += 1;
                }
                for(int k = j; k < ny; k++)
                {
                    visited2[i][k] = true;
                    cnt[i][k] += acc;
                }
            }
        }
    }
    
    int ret = 1;
    
    for(int i = 0; i < H; i++)
        for(int j = 0; j < W; j++)
            ret = max(ret, cnt[i][j]);
    
    cout << ret - 1 << endl;
    
    return 0;
}


Measured memory_bytes: 27904
/*A*/
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;
#define lint long long
static const int INF = 1 << 22;
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
/*******source code below********/
int main(void) {


	long long a; cin >> a;
	long long b; cin >> b;
	long long c; cin >> c;

	if ((a < b) && (c <= b && c >= a)) {
		cout << "Yes" << endl;
	}
	else if ((a > b) && (c <= a && c >= b)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

public class Main {


    public Main(FastScanner in, PrintWriter out, int test) {
        int N = in.nextInt();

        int[] A = new int[N];
        int x = 0;
        for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
            x ^= A[i];
        }

        for (int i = 0; i < N; i++) {
            A[i] ^= x;
            out.printf("%d ", A[i]);
        }
        out.println();
    }

    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        // Scanner in = new Scanner(
                // new BufferedReader(new InputStreamReader(System.in)));
        FastScanner in = new FastScanner(System.in);

        // int T = in.nextInt();
        for (int t = 1; t <= 1; t++) {
            Main sol = new Main(in, out, t);
        }

        out.close();
    }
}


class FastScanner{
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public FastScanner(InputStream stream)
    {
        this.stream = stream;
    }

    int read()
    {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars){
            curChar = 0;
            try{
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    boolean isSpaceChar(int c)
    {
        return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
    }

    boolean isEndline(int c)
    {
        return c=='\n'||c=='\r'||c==-1;
    }

    int nextInt()
    {
        return Integer.parseInt(next());
    }

    long nextLong()
    {
        return Long.parseLong(next());
    }

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String next(){
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do{
            res.appendCodePoint(c);
            c = read();
        }while(!isSpaceChar(c));
        return res.toString();
    }

    String nextLine(){
        int c = read();
        while (isEndline(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do{
            res.appendCodePoint(c);
            c = read();
        }while(!isEndline(c));
        return res.toString();
    }
}

Measured memory_bytes: 99100
#include<iostream>
int main(){
	int a[5],i,j,t;

	for(i=0;i<5;i++){	
	std::cin>>a[i];
	
	}
	for(i=0;i<4;i++){	
		for(j=i+1;j<5;j++){
			if(a[i]<a[j]){
				t=a[i];
				a[i]=a[j];
				a[j]=t;
		
			}
		}
	}	
		std::cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<" "<<a[3]<<" "<<a[4]<<std::endl;

return 0;
}

Measured memory_bytes: 1164
(defun get-read-nth (n)
  (loop :as i
	  :below n
   	:collect (list (read) i)))

(defun car-asc (a b)
  (> (car a)
     (car b)))

(let* ((n (read))
       (l (get-read-nth n))
       (sorted (sort (copy-list l) #'car-asc)))
  (loop	:as c
	  :in l
	:do (format t
                    "~A~%"
                    (if (= (cadr c)
                           (cadr (car sorted)))
                       	(car (cadr sorted))
                       	(caar sorted)))))

Measured memory_bytes: 69348
#include<bits/stdc++.h>
#define ll long long int 
#define mod 1000000007
#define se second
#define fi first
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971
#define MAX 9223372036854775807
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
//	cout<<fixed<<setprecision(15);
	string s,t;
	cin>>s>>t;
	ll x=0;
	for(int a=0;a<s.size();a++)
	{
		if(s[a]!=t[a])
		x++;
	}
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 3800
#intの場合
N = int(input()) #ここで標準入力

A = list(map(int, input().split()))

# multiple = 1
# for i in range(N):
#     multiple *= A[i]



# if multiple <= 10 ** 18 :
#     print(multiple)
# else:
#     print(-1)

def main():
    if 0 in A:
        print(0)
        return

    output = 1
    for a in A:
        output *= a

        if output > (10 ** 18):
            print(-1)
            return

    print(output)

main()


Measured memory_bytes: 21748
/*
Author : N_o_o_B
Created : March 08 2020 17:32:50 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n1,n2,m;
    cin >> n1 >> n2 >> m;
    vi a(n1),b(n2);
    fori(i,n1){
        cin >> a[i];
    }
    fori(i,n2) cin >> b[i];
    int ans = *min_element(all(a)) + *min_element(all(b));
    fori(i,m){
        int x,y,c;
        cin >> x >> y >> c;
        --x;--y;
        ans = min(ans,a[x]+b[y]-c);
    }
    ans = max(ans,0);
    cout << ans << endl;

    time_taken();
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
vector<pii> g[125252];
ll dep[125252];

int q,k;

void dfs(int p,int bef,ll len){
  dep[p] = len;
  for(pii P : g[p]){
    int to = P.first;
    ll nlen = len + P.second;
    if(to==bef)continue;
    dfs(to,p,nlen);
  }
}

int main(){
  scanf("%d",&n);
  REP(i,n-1){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    --a;--b;
    g[a].push_back(pii(b,c));
    g[b].push_back(pii(a,c));
  }
  scanf("%d%d",&q,&k);--k;
  dfs(k,-1,0ll);
  while(q--){
    int x,y;
    scanf("%d%d",&x,&y);
    --x;--y;
    ll ans = dep[x]+dep[y];
    printf("%lld\n",ans);
  }
  return 0;
}


Measured memory_bytes: 13312
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e16;
int Td;
long long n, A, B, C, D;

struct Node{
	long long x, rs;
	Node(long long x = 0, long long rs = 0) : x(x), rs(rs) {}
	bool operator < (const Node & b) const{
		return x < b.x;
	}
};

set<Node> G;
set<Node>::iterator it;

long long dfs(long long x) {
	if(x == 0) return 0;
	if(x == 1) return D;
	it = G.lower_bound(Node(x, 0));
	//cerr << x << endl;
	if((it != G.end()) && it->x == x) return it->rs;
	long long rs = INF, tmp = INF, y;
	if(x <= INF / D) rs = x * D;
	y = x % 5;
	tmp = dfs((x - y) / 5);
	rs = min(rs, tmp + y * D + C);
	y = 5 - x % 5;
	tmp = dfs((x + y) / 5);
	rs = min(rs, tmp + y * D + C);
	y = x % 3;
	tmp = dfs((x - y) / 3);
	rs = min(rs, tmp + y * D + B);
	y = 3 - x % 3;
	tmp = dfs((x + y) / 3);
	rs = min(rs, tmp + y * D + B);
	y = x % 2;
	tmp = dfs((x - y) / 2);
	rs = min(rs, tmp + y * D + A);
	if(x > 2) {
		y = 2 - x % 2;
		tmp = dfs((x + y) / 2);
		rs = min(rs, tmp + y * D + A);
	}
	G.insert(Node(x, rs));
	//printf("%lld, %lld\n", x, rs);
	return rs;
}

int main() {
	scanf("%d", &Td);
	while(Td--) {
		scanf("%lld%lld%lld%lld%lld", &n, &A, &B, &C, &D);
		G.clear(); 
		printf("%lld\n", dfs(n));
	}
	return 0;
}

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

using Int = long long;
Int powmod(Int a_, Int n_, Int mod_) {
	Int r = 1;
	while (n_) r = r * ((n_ % 2) ? a_ : 1) % mod_, a_ = a_ * a_%mod_, n_ >>= 1;
	return r;
}

int main(void) {
	Int m, n;
	cin >> m >> n;
	cout << powmod(m, n, 1'000'000'007) << endl;
	return 0;
}


Measured memory_bytes: 3104