akhauriyash/Code-Regression huggingface dataset:
using System;

namespace Watch
{
    class Program
    {
        static void Main(string[] args)
        {
            Time s = new Time();
            s.Hms(int.Parse(Console.ReadLine()));
            s.Show();
        }
    }
    class Time
    {
        int hour, minute, second;
        public void Hms(int num)
        {
            if (num >= 3600)
            {
                hour = num / 3600;
                num -= hour * 3600;
            }
            if (num >= 60)
            {
                minute = num / 60;
                second = num % 60;
            }
            else
            {
                second = num;
            }
        }
        public void Show()
        {
            Console.WriteLine(hour + ":" + minute + ":" + second);
        }
    }
}

Measured memory_bytes: 9148
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;
int n, m, x;
vector<bool> used;
vector<long long> solved;
vector<pair<int, long long>> c;
vector<vector<pair<int, long long>>> p;
bool strict = false;

bool dfs2(int id, long long x) {
  if (used[id]) {
    if (solved[id] != x)
      return false;
    else
      return true;
  }
  used[id] = true;
  solved[id] = x;
  if (solved[id] <= 0)
    return false;
  for (int i = 0; i < p[id].size(); i++) {
    if (!dfs2(p[id][i].first, p[id][i].second - x))
      return false;
  }
  return true;
}

bool dfs(int id, long long a, long long b) {
  if (used[id]) {
    if (c[id].first != a) {
      strict = true;
      x = (c[id].second - b) / (a - c[id].first);
      return true;
    } else {
      if (c[id].second == b)
        return false;
      else
        return true;
    }
  }
  used[id] = true;
  c[id].first = a;
  c[id].second = b;
  for (int i = 0; i < p[id].size(); i++) {
    if (dfs(p[id][i].first, -a, p[id][i].second - b))
      return true;
  }
  return false;
}

int main() {
  cin >> n >> m;
  c.resize(n);
  used.resize(n);
  solved.resize(n);
  p.resize(n);
  for (int i = 0; i < m; i++) {
    int u, v, s;
    cin >> u >> v >> s;
    u--;
    v--;
    p[u].push_back(make_pair(v, s));
    p[v].push_back(make_pair(u, s));
  }
  if (dfs(0, 1, 0)) {
    used.clear();
    used.resize(n);
    if (strict && dfs2(0, x)) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  } else {
    long long minX = 0, maxX = 10000000000000;
    for (int i = 0; i < n; i++) {
      if (c[i].first == 1)
        minX = max(minX, -c[i].second + 1);
      else
        maxX = min(maxX, c[i].second - 1);
    }
    if (maxX - minX + 1 > 0)
      cout << maxX - minX + 1 << endl;
    else
      cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 14848
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {


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

	int buf = 0;
	int base = 1;
	int cnt = 0;
	
	while (n > 0) {
		buf += (n % k) * base;
		n /= k;
		base = base * 10;
		cnt++;
	}

	cout << cnt << endl;

	return 0;

}

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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;
using P = pair<int, int>;

int main() {
    int a, b;
    cin >> a >> b;
    cout << (a + b >= 24 ? a + b - 24 : a + b) << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++) 
#define int long long
using namespace std;
int dp[101][100009];
main(){
    int n,w;
    cin>>n>>w;
    int v[n+1],a[n+1];
    r(i,1,n+1)cin>>a[i]>>v[i];
    r(i,1,n+1)r(j,1,w+1){
        if(j<a[i])dp[i][j]=dp[i-1][j];
        else dp[i][j]=max(dp[i-1][j],dp[i-1][j-a[i]]+v[i]);
    }
    cout<<dp[n][w]<<endl;
}

Measured memory_bytes: 78336
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

//Time Trial
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int[][] d = {{-1,0},{0,1},{1,0},{0,-1}};
		int[][][] assign = new int[50][50][50];
		int[][] ref = new int[19600][3];
		int ID = 0;
		for(int i=0;i<50;i++)for(int j=i+1;j<50;j++)for(int k=j+1;k<50;k++){
			ref[ID][0] = i; ref[ID][1] = j; ref[ID][2] = k;
			assign[i][j][k]=ID++;
		}
		boolean[][] u = new boolean[19600][50];
		for(;;){
			int w = sc.nextInt(), h = sc.nextInt();
			if((w|h)==0)break;
			char[][] map = new char[h][];
			int[][] id = new int[h][w], rid = new int[50][2];
			int[] tile = new int[3], rock = new int[3];
			int kt = 0, kr = 0, start = 0, M = 0;
			for(int i=0;i<h;i++){
				map[i] = sc.next().toCharArray();
				for(int j=0;j<w;j++){
					if(map[i][j]=='@'){
						id[i][j] = M;
						rid[M][0] = i; rid[M][1] = j;
						start = M++;
					}
					else if(map[i][j]=='_'){
						id[i][j] = M;
						rid[M][0] = i; rid[M][1] = j;
						tile[kt++] = M++;
					}
					else if(map[i][j]=='*'){
						id[i][j] = M;
						rid[M][0] = i; rid[M][1] = j;
						rock[kr++] = M++;
					}
					else if(map[i][j]=='.'){
						rid[M][0] = i; rid[M][1] = j;
						id[i][j] = M++;
					}
					else id[i][j] = -1;
				}
			}
			int G = assign[tile[0]][tile[1]][tile[2]], S = assign[rock[0]][rock[1]][rock[2]];
			for(boolean[]a:u)Arrays.fill(a, false);
			u[S][start] = true;
			List<int[]> l = new ArrayList<int[]>();
			l.add(new int[]{S, start});
			int step = 0, res = -1;
			while(!l.isEmpty()){
				List<int[]> next = new ArrayList<int[]>();
				for(int[] a:l){
					if(G==a[0]){
						res = step; next.clear(); break;
					}
					int[] r = ref[a[0]], nr = new int[3];
					int pi = rid[a[1]][0], pj = rid[a[1]][1];
					for(int k=0;k<4;k++){
						int ni = pi+d[k][0], nj = pj+d[k][1], npos = id[ni][nj];
						if(npos==-1)continue;
						nr[0] = r[0]; nr[1] = r[1]; nr[2] = r[2];
						int mpos = id[ni+d[k][0]][nj+d[k][1]];
						if(r[0]==npos){
							if(mpos==-1||r[1]==mpos||r[2]==mpos)continue;
							nr[0] = mpos;
						}
						else if(r[1]==npos){
							if(mpos==-1||r[0]==mpos||r[2]==mpos)continue;
							nr[1] = mpos;
						}
						else if(r[2]==npos){
							if(mpos==-1||r[0]==mpos||r[1]==mpos)continue;
							nr[2] = mpos;
						}
						Arrays.sort(nr);
						int ns = assign[nr[0]][nr[1]][nr[2]];
						if(!u[ns][npos]){
							u[ns][npos] = true; next.add(new int[]{ns, npos});
						}
					}
				}
				step++;
				l = next;
			}
			System.out.println(res);
		}
	}

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

Measured memory_bytes: 19000
#include<stdio.h>
int main(void){
    int a,b,d,r;
    double f;
    scanf("%d %d",&a,&b);
    d=a/b;
    r=a%b;
    f=(double)a/b;
    printf("%d %d %lf",d,r,f);
return 0;
}

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

struct edge {
	int from, to;
	edge(int f, int t) : from(f), to(t) {}
};

using edges = vector<edge>;
using graph = vector<edges>;

void add_edge(graph& G, int f, int t) {
	G[f].emplace_back(f, t);
	G[t].emplace_back(t, f);
}

pair<vector<int>, edges> bridge(const graph& G) {
	const int n = G.size();
	int idx = 0, t = 0, k = 0;
	vector<int> ord(n, -1), stk, roots(n), cmp(n);
	vector<bool> onS(n);
	edges brdg;
	function<void(int, int)> dfs = [&](int v, int u) {
		ord[v] = idx++;
		stk.push_back(v);
		onS[v] = true;
		roots[t++] = v;
		for (auto& e : G[v]) {
			int w = e.to;
			if (ord[w] == -1) dfs(w, v);
			else if (u != w && onS[w])
				while (ord[roots[t - 1]] > ord[w]) --t;
		}
		if (v == roots[t - 1]) {
			brdg.emplace_back(u, v);
			while (true) {
				int w = stk.back(); stk.pop_back();
				onS[w] = false;
				cmp[w] = k;
				if (v == w) break;
			}
			--t;
			++k;
		}
	};
	for (int u = 0; u < n; ++u) {
		if (ord[u] == -1) {
			dfs(u, -1);
			brdg.pop_back();
		}
	}
	return make_pair(cmp, brdg);
}

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int V, E;
	cin >> V >> E;
	graph G(V);
	for (int i = 0, s, t; i < E; i++) {
		cin >> s >> t;
		add_edge(G, s, t);
	}
	auto br = bridge(G);
	vector<pair<int, int>> res;
	for (auto& e : br.second) {
		res.emplace_back(min(e.from, e.to), max(e.from, e.to));
	}
	sort(res.begin(), res.end());
	for (auto p : res) {
		printf("%d %d\n", p.first, p.second);
	}
	return 0;
}

Measured memory_bytes: 5308
#include <stdio.h>
int main()
{
    char a;
    int b=1,x;
    for (x=1;1;x++)
    {
    	a=getchar();
    	if (a!='\n')
    	{
    		if (x%2==1)
	    	{
	    		if (a=='L')
	    		{
	    			b=0;
	    			goto end;
				}
			}
			else
			{
				if (a=='R')
	    		{
	    			b=0;
	    			goto end;
				}
			}
		}
		else
		{
			goto end;
		}
	}
end:
	if (b)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<math.h>
using namespace std;
int main(){
  int D, N;
  cin >> D >> N;
  if(D == 0)
    if(N != 100)
    	cout << 1 * N << endl;
    else 
      cout << 1 * (N+1) << endl;
  else if(D == 1)
    if(N != 100)
    	cout << 100 * N << endl;
  	else
      cout << 100 * (N+1) << endl;
  else if(D == 2)
    if(N != 100)
    	cout << 10000 * N << endl;
    else 
      cout << 10000 * (N+1) << endl;
 return 0; 
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    int n; cin >> n;
    int ans = 1;
    for(int i = 2; i <= n; i*=2){
        ans = i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int n, q;
	cin >> n >> q;
	string s;
	cin >> s;
	int sum[100007] = {};
	int a[100007], b[100007];
	for (int i = 0; i < q; i++) {
		cin >> a[i] >> b[i];
	}
	for (int i = 0; i < n; i++) {
		if (s[i] == 'A' && s[i + 1] == 'C') {
			sum[i + 1] = 1;
		}

	}
	int sum2[100007] = {};
	for (int j = 0; j < n; j++) {
		if (j == 0) {
			sum2[j] = 0;
		}
		else {
			sum2[j] = sum2[j - 1] + sum[j];
		}
	}
	for (int i = 0; i < q; i++) {
		cout << sum2[b[i] - 1] - sum2[a[i] - 1] << endl;
	}
	return 0;

}



Measured memory_bytes: 2560
# 21:30-
n, x = gets.to_s.split.map{|t| t.to_i }
a    = gets.to_s.split.map{|t| t.to_i }.sort

a.each_with_index do |t, i|
  
  if x < t
    puts i
    exit
  end
  
  x -= t
end

if x != 0
  puts n - 1
else
  puts n
end

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

int main(){
    string S;
    int cnt = 0;
    cin >> S;
    if(S.length() == 1) cout << 0 << endl;
    else{
        for(int i = 0; i < S.length() - 1; i++){
            if(S[i] == S[i + 1]) {
                cnt++;
                if(S[i] == '1') S[i + 1] = '0';
                else S[i + 1] = '1';
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
#define mp make_pair
const int maxn=100;
int n,m;
char a[maxn+5];
int dfs(int k,int num,bool flag=true)
{
    if(k>n) 
    {
        if(num==0) return 1;
        return 0;
    }
    int ans=dfs(k+1,num,flag&&a[k]==0);
    if(num>0)
    {
        int limit=flag?a[k]:9;
        if(limit>=1)
        {
            ans+=(limit-1)*dfs(k+1,num-1,0);
            ans+=dfs(k+1,num-1,flag);
        }
    }
    return ans;
}
int main()
{

    scanf("%s",a+1);
    n=strlen(a+1);
    scanf("%d",&m);
    for(int i=1;i<=n;++i) a[i]-='0';
    cout<<dfs(1,m)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

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

double a[20];
int index[6], n;

bool ng(double a, double b, double c) {
  if (a + b <= c) return true;
  if (b + c <= a) return true;
  if (c + a <= b) return true;
  return false;
}
				       

double solve(int m) {
  if (m == 6) {
    if (ng(a[index[0]], a[index[1]], a[index[2]])) return 0;
    if (ng(a[index[0]], a[index[3]], a[index[4]])) return 0;
    if (ng(a[index[1]], a[index[4]], a[index[5]])) return 0;
    if (ng(a[index[2]], a[index[5]], a[index[3]])) return 0;
    double aa[3], bb[3], t, pi[4];
    aa[0] = a[index[0]];
    aa[1] = a[index[1]];
    aa[2] = a[index[2]];
    bb[0] = a[index[5]];
    bb[1] = a[index[3]];
    bb[2] = a[index[4]];
    t = 0;
    rep (i, 3) t += aa[i] * aa[i];
    rep (i, 3) t += bb[i] * bb[i];
    t = sqrt(max(t, 0.));
    pi[0] = aa[0] * aa[1] * aa[2];
    pi[1] = aa[0] * bb[1] * bb[2];
    pi[2] = aa[1] * bb[2] * bb[0];
    pi[3] = aa[2] * bb[0] * bb[1];
    double v = 0;
    rep (i, 3) v += aa[i] * aa[i] * bb[i] * bb[i] * (t * t- 2 * aa[i] * aa[i] - 2 * bb[i] * bb[i]);
    rep (i, 4) v -= pi[i] * pi[i];
    return sqrt(max(v, 0.)) / 12;
  }
  double res = 0;
  rep (i, n) {
    bool ok = true;
    rep (j, m) if (index[j] == i) ok = false;
    if (ok) {
      index[m] = i;
      res = max(solve(m + 1), res);
    }
  }
  return res;
}

int main() {
  while (true) {
    cin >> n;
    if (n == 0) break;
    rep (i, n) cin >> a[i];
    printf("%.12f\n", solve(0));
  }
  return 0;
}

Measured memory_bytes: 1244
#include<stdio.h>
#include<set>

int n,tmp;
std::set<int> a;

int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&tmp);
    if(a.count(tmp)){
      puts("NO");
      return 0;
    }
    else a.insert(tmp);
  }
  puts("YES");
  return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define MAXN 300000 + 3
using namespace std;

int main()
{
    int n;
    int l[MAXN];
    int r[MAXN];
    memset(l, 0, sizeof(l));
    memset(r, 0, sizeof(r));
    cin>>n;
    char c;
    for(int i=1; i<=n; i++) {
        cin>>c;
        l[i+1] = l[i];
        if(c == 'W')
            l[i+1] ++ ;
    }
    for(int i=n-1; i>=0; --i)
        r[i] = n - i - l[n+1] + l[i+1];
    int ans = n;
    for(int i=1; i<=n; i++)
        ans = min(ans,l[i] + r[i]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
long long fac[10000010], finv[10000010], inv[10000010]; 
long long P = 998244353;
long long Pow(long long int a, long long n) {
	long long tmp = a; 
	long long pow = n;
	long long Q = 1;  
  	while(pow > 0){
		if(pow & 1){
			Q *= tmp; Q %= P; 
		}
		tmp = tmp * tmp % P; 
     		pow >>= 1; 
  	}
	return Q;
} 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 10000005; i++) {
        fac[i] = fac[i - 1] * i % P;
        inv[i] = P - inv[P % i] * (P / i) % P;
        finv[i] = finv[i - 1] * inv[i] % P;
    }
}
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % P) % P;
}
int main(){
	int N; cin >> N; 
	COMinit(); 
	long long pow[5000010] = {}; 
	pow[0] = 1; 
	for(int i = 1; i <= N/2; i++){
		pow[i] = pow[i-1] * 2 % P; 
	}
	long long ans = Pow(3, N); 
	for(int i = 0; i < N/2; i++){
		long long tmp = 2 * COM(N, i) * pow[i] % P; 
		ans += P - tmp; 
		if(ans >= P) ans -= P; 
	}
	cout << ans << endl;  
}

Measured memory_bytes: 273664
a, b, c = gets.split.map &:to_i

if a == b
    if a != c
        print "Yes"
    else
        print "No"
    end
elsif b == c
    if b != a
        print "Yes"
    else
        print "No"
    end
elsif c  == a
    if c != b
        print "Yes"
    else
        print "No"
    end
else
    print "No"
end

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long n;
    string s;
 
    cin >> n;
    cin >> s;
 
    long long r[4001];
    long long g[4001];
    long long b[4001];
 
    long long rt = 0;
    long long gt = 0;
    long long bt = 0;
 
    for(int i = 0; i < n; i++) {
        if(s[i] == 'R') {
            rt += 1;
        }
        if(s[i] == 'G') {
            gt += 1;
        }
        if(s[i] == 'B') {
            bt += 1;
        }
    
    }
    //cout << rt + gt + bt << " " << n << endl; 
 
    for(int i = 0; i < n; i++) {
        if(s[i] == 'R') {
            rt -= 1;
        }
        if(s[i] == 'G') {
            gt -= 1;
        }
        if(s[i] == 'B') {
            bt -= 1;
        }
 
        r[i] = rt;
        g[i] = gt;
        b[i] = bt;
 
        //cout << r[i] + g[i] + b[i] << endl;         
    }
 
    long long t = 0;
    for(int i = 0; i < n - 2; i++) {
        for(int j = i + 1; j < n - 1; j++) {
            if(s[i] != s[j]) {
                //int add_t = 0;
                int k = 2 * j - i;
                if(s[i] != 'R' && s[j] != 'R' ) {
                    t +=  r[j];
                    if(k > j && k < n) {
                       if( s[k] == 'R') {
                            t--;
                        }
                    }
                }
                  //cout << b[j] << endl;
                else if(s[i] != 'G' && s[j] != 'G' ) {
                    t +=  g[j];
                    if(k > j && k < n) {
                       if( s[k] == 'G') {
                            t--;
                        }
                    }
                }
                else if(s[i] != 'B' && s[j] != 'B' ) {
                    t +=  b[j];
                    if(k > j && k < n) {
                       if( s[k] == 'B') {
                            t--;
                        }
                    }
                }
            }
        }
    }
 
    cout << t << endl;
    return 0;
}

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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

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

int W,H,N;
int sx,sy,gx,gy;
int cost[555][555][4];
int dist[555][555];

typedef pair<int,pint>node;

inline void add(int y,int x,int d){
    if(y>=0&&y<=H&&x>=0&&x<=W)cost[y][x][d]++;
}

inline int conv(char c){
    if(c=='U')return 0;
    if(c=='R')return 1;
    if(c=='D')return 2;
    return 3;
}

signed main(){
    cin>>W>>H>>N;
    cin>>sx>>sy>>gx>>gy;

    rep(latte,N){
        int x,y,t;
        string s;
        cin>>x>>y>>t>>s;
        rep(T,t){
            rep(i,s.size()){
                int d=conv(s[i]);
                int ny=y+dy[d],nx=x+dx[d];
                if(ny<0||ny>=H||nx<0||nx>=W)continue;
                if(d==0){
                    add(y,x,1);
                    add(y,x+1,3);
                }
                else if(d==1){
                    add(y,x+1,2);
                    add(y+1,x+1,0);
                }
                else if(d==2){
                    add(y+1,x,1);
                    add(y+1,x+1,3);
                }
                else{
                    add(y,x,2);
                    add(y+1,x,0);
                }
                y=ny;x=nx;
            }
        }
    }
    priority_queue<node,vector<node>,greater<node>>que;
    que.push(node(0,pint(sy,sx)));
    rep(i,H+1)rep(j,W+1)dist[i][j]=1001001001001001001ll;
    dist[sy][sx]=0;
    while(que.size()){
        int y=que.top().se.fi,x=que.top().se.se,c=que.top().fi;
        que.pop();
        if(dist[y][x]<c)continue;
        rep(i,4){
            int ny=y+dy[i],nx=x+dx[i];
            if(ny<0||ny>H||nx<0||nx>W||dist[ny][nx]<=c+cost[y][x][i])continue;
            dist[ny][nx]=c+cost[y][x][i];
            que.push(node(dist[ny][nx],pint(ny,nx)));
        }
    }
    cout<<dist[gy][gx]<<endl;
    return 0;
}

Measured memory_bytes: 19864
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;


int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    
    rep(i, n){
        int t;
        cin >> t;
        a[i] = {t, i+1};
    }
    sort(a.begin(), a.end());
    rep(i, n){
        cout << a[i].second << " ";
    }
    cout << endl;
}


Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;

    cout << 6 - a- b << endl;

    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int n, x, t;
    cin>>n>>x>>t;
    cout<<((n+x-1)/x)*t;
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 3652
import java.util.Scanner

object Main extends App {

  val sc = new Scanner(System.in)

  val n = sc.nextInt

  val a = (1 to n).map(_ => sc.nextInt)

  val ans = (0 to (n - 1)).foldLeft((0, 0)) {
    case ((cnt, cur), idx) => if (cur == a(idx)) {
      (cnt + 1, 0)
    } else {
      (cnt, a(idx))
    }
  }
    ._1

  println(ans)
}


Measured memory_bytes: 25924
def main():

    from bisect import bisect_left as bl, bisect_right as br, insort
    import sys,heapq,math
    from collections import defaultdict as dd, deque
    def data(): return sys.stdin.readline().strip()
    def mdata(): return list(map(int, data().split()))
    out = sys.stdout.write
    # sys.setrecursionlimit(100000)
    INF = int(1e9)
    mod = int(1e9)+7

    n=int(data())
    A=list(mdata())
    d1=dd(int)
    d2=dd(int)
    for i in range(n):
        if i+1+A[i]<n:
            d1[i+1+A[i]]+=1
        if i+1-A[i]>1:
            d2[i+1-A[i]]+=1
    ans=0
    for i in d1:
        ans+=d1[i]*d2[i]
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 126244
n,k=map(int,input().split())
s=input()
t=s[0]
ans=0
u=0
f=True
for i in range(1,n):
    if t==s[i]:
        ans+=1
    else:
        t=s[i]
        if f:
            f=False
        else:
            f=True
            u+=1
if k<=u:
    ans+=2*k
if k>u:
    ans=n-1
print(ans) 

Measured memory_bytes: 70660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=1e9; 
int main()
{
	int n;
	ll a=-inf,b=inf,c=-inf,d=inf;
	scanf("%d",&n);
	ll x,y;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&x,&y);
		a=max(x+y,a);
		b=min(x+y,b);
		c=max(x-y,c);
		d=min(x-y,d);
	}
	printf("%lld",max(a-b,c-d));
}

Measured memory_bytes: 3820
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	/*int h, w; cin >> h;
	cout << 3 * h * h << endl;*/
	string str; cin >> str;
	vector<string> s(str.size()), ss(str.size());
	for (int i = 0; i < str.size(); i++) {
		s[i] = str[i];
	}
	ss = s;
	ssort(s);
	eerase(s);
	if (s.size() == 2) {
		int c = 0, d = 0;
		for (int i = 0; i < 2; i++) {
			c = count(ss.begin(), ss.end(), s[0]);
			d = count(ss.begin(), ss.end(), s[1]);
		}
		if (c == 2 && d == 2) cout << "Yes";
		else cout << "No";
		return 0;
	}else cout << "No";

	cout << endl;
	return 0;
}

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

using namespace std;

const int maxn=100;

int n;
int a[maxn],b[maxn],c[maxn];

int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)cin>>b[i];
	for(int i=1;i<n;i++)cin>>c[i];
	long long ans=0;
	for(int i=1;i<=n;i++){
		ans+=b[a[i]];
		if(i>1&&a[i]-a[i-1]==1)ans+=c[a[i-1]]; 
	}	
	cout<<ans;
	return 0;
} 

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

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
            var n = s[0];
            var k = s[1];
            var h = Console.ReadLine().Split().Select(i => long.Parse(i)).OrderByDescending(i => i).ToArray();

            var attack = h.Skip(k).Sum();
            Console.WriteLine(attack);
        }
    }
}


Measured memory_bytes: 41472
/*
	0256:Points for a Perfect Scorer
*/
#include	<iostream>

using namespace std;

int main(void) {
	int sum = 0;
	for(int i = 0; i < 10; i++) {
		int n;
		cin >> n;
		
		sum += n;
	}
	cout << sum << endl;
	
	return 0;
}

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

const int N = 1e5 + 10;

int a[N];
vector <int> ans;

int main(){
	int n, L, p;
	scanf("%d %d",&n,&L);
	for (int i = 1; i <= n; i++) scanf("%d",&a[i]);
	p = 0;
	for (int i = 1; i < n; i++){
		if (a[i] + a[i + 1] >= L){
			p = i;
			break;
		}
	}
	if (!p){
		printf("Impossible\n");
		return 0;
	}
	printf("Possible\n");
	for (int i = p; i < n; i++) ans.push_back(i);
	for (int i = p - 1; i >= 1; i--) ans.push_back(i);
	for (int i = n - 2; i >= 0; i--) printf("%d\n", ans[i]);
	return 0;
}

Measured memory_bytes: 1784
H, W = map(int, input().split())
S = [input() for i in range(H)]
dd = ((0, -1), (-1, 0), (0, 1), (1, 0))
for i in range(H):
  for j in range(W):
    if S[i][j] == '.':
      continue
    for dx, dy in dd:
      nx = j + dx
      ny = i + dy
      if 0 <= nx < W and 0 <= ny < H and S[ny][nx] == '#':
        break
    else:
      print('No')
      quit()
print('Yes')


Measured memory_bytes: 3064
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int length, count, max = 0;
  	string str, sub1, sub2; 
  	cin >> length >>str;
  	for (int i = 1; i < length; i++){
    	sub1 = str.substr(0, i);
      	sub2 = str.substr(i, length - i);
      	count = 0;
      	for (char c = 'a'; c <= 'z'; c++){
        	if (sub1.find(c) != std::string::npos && sub2.find(c) != std::string::npos){
            	count++;
            }
          	if (count > max){
            	max = count;
            }
        }
    }
  	cout << max;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
using ll = long long;
 
int n;
string s;

int main(){
	cin >> s;
	n = (int)s[s.size()-1]-'0';
	if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9) cout << "hon" << endl;
	else if(n == 0 || n == 1 || n == 6 || n == 8) cout << "pon" << endl;
	else if(n == 3) cout << "bon" << endl;
}

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

void solve()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;

    ll res = a*c;
    res = max(res,a*d);
    res = max(res,b*c);
    res = max(res,b*d);

    cout<<res<<endl;
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
constexpr int MOD = 998244353;

template <int N>
struct Eratosthenes
{
    int w[N + 1];
    char sieve[N + 1];
    constexpr Eratosthenes() : w(), sieve()
    {
        //int idx = 0;
        w[0] = 0;
        w[1] = 1;
        for (int i = 2; i <= N; i++)
            w[i] = MOD - 1LL * w[MOD % i] * (MOD / i) % MOD;
        for (int p = 2; p <= N; p++)
        {
            if (sieve[p] == 0)
            {
                for (int k = N / p; k > 1; --k)
                {
                    if ((sieve[k * p] = 1, w[k * p] -= w[k]) < 0)
                        w[k * p] += MOD;
                }
                w[p] -= w[1];
            }
        }
    }
};

int main()
{
    constexpr int M = 1000000;
    constexpr auto prime = Eratosthenes<M>();
    //constexpr auto w = constexpr_w_function<M,78498>(prime.prime);
    long long N, ans = 0;
    int a[1000001] = {};
    cin >> N;
    for (int i = 0, j; i < N; i++)
    {
        cin >> j;
        if ((a[j] += j) >= MOD)
            a[j] -= MOD;
        if ((ans -= j) < 0)
            ans += MOD;
    }
    for (int p = 2; p <= M; p++)
        if (prime.sieve[p] == 0)
            for (int k = M / p; k > 0; --k)
                if ((a[k] += a[k * p]) >= MOD)
                    a[k] -= MOD;
    for (int i = 1; i <= M; i++)
    {
        ans += 1LL * a[i] * a[i] % MOD * prime.w[i] % MOD;
    }
    ans %= MOD;
    if (ans & 1)
        ans = (ans + MOD) >> 1;
    else
        ans = ans >> 1;
    cout << ans << endl;
}


Measured memory_bytes: 9472
package main

import (
	"strconv"
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	count := 0
	for i := 1; i <= n; i++ {
		if len(strconv.Itoa(i))%2 == 1 {
			count++
		}
	}
	fmt.Println(count)
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j,o;
  ll result=0,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  bool judge = true;
  string s;cin>>s;
  ans1((s[0]==s[1]||s[2]==s[3])&&s[1]==s[2]);


  return 0;
}

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

#define ll long long
#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)

//library----------------------------------------------


int main(){
  int H,W,h,w; cin>>H>>W>>h>>w;
  int ans = (H-h)*(W-w);
  printf("%d\n",ans);
  return 0;
}

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

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

    vector<long long> A(n);

    for (int i = 1; i <= n; i++) {
        for (int j = i; j <= n; j += i) {
            ++A[j - 1];
        }
    }

    long long ans = 0;
    rep(i, n) {
        ans += (i + 1) * A[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 81388
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>


using namespace std;
typedef long long ll;

#define mod 1000000007
#define INF 2000000000
#define LLINF 4000000000000000000
#define SIZE 100

int mo[5] = {0,1,0,-1,0};

int main(){
    int w,h,ans=0,af_f,af_s;
    int mm[110][110]={0};
    bool visited[110][110]={0};
    queue<pair<int,int> > que;
    
    scanf("%d%d",&w,&h);
    
    for(int i=0;i<=w+3;i++){
        visited[0][i] = true;
        visited[h+3][i] = true;
    }
    
    for(int i=0;i<=h+3;i++){
        visited[i][0] = true;
        visited[i][w+3] = true;
    }
    
    
    for(int i=2;i<=h+1;i++){
        for(int j=2;j<=w+1;j++){
            scanf("%d",&mm[i][j]);
        }
    }
    
    /*bfs*/
    que.push(make_pair(1,1));
    
    while(que.size()){
        pair<int,int> p = que.front();
        que.pop();
        
        for(int i=0;i<6;i++){
            
            
            af_f = p.first;
            af_s = p.second;
            
            if(i<4){
                af_f += mo[i];
                af_s += mo[i+1];
            }else{
                if(i==5) af_f-=1;
                else af_f+=1;
                
                if(((int)p.first)%2) af_s-=1;
                else af_s+=1;
            }
            
            if(mm[af_f][af_s]==1){
                ans++;
                
            }else if(visited[af_f][af_s]==false){
                que.push(make_pair(af_f,af_s));
                visited[af_f][af_s]=true;
            }
        }
        
    }
    
    printf("%d\n",ans);
    
    return 0;
}

Measured memory_bytes: 1272
n = int(input())
h = list(map(int, input().split()))

cnt = 0
anscnt = 0
for i in range(n - 1):
    if h[i] >= h[i + 1]:
        cnt += 1
    else:
        cnt = 0
    anscnt = max(anscnt, cnt)

print(anscnt)


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

long long gcd(long long x, long long y){
  if(x % y == 0){
    return y;
  }else{
    return gcd(y,x % y);
  }
}

long long lcm(long long x, long long y){
  return x * y / gcd(x,y);
}

int main(){
  long long a,b;
  long long kekka; 
  
  cin >> a >> b;
  
  kekka = lcm(a,b);
  
  cout << kekka;    
}

Measured memory_bytes: 256
def partition(A, p, r):
    x = int(A[r-1][1])
    i = p-1

    for j in range(p,r-1):
        if int(A[j][1]) <= x:
            i = i + 1
            A[i],A[j] = A[j],A[i]
    A[i+1],A[r-1] = A[r-1],A[i+1]
    return i + 1

def qsort(A,p,r):
    if p < r:
        q = partition(A,p,r)
        qsort(A,p,q)
        qsort(A,q+1,r)
    return A

def isStable(a):
    length = int(len(a))
    for i in range(length):
        for j in range(i+1,length-1) :
            if a[i][1] == a[j][1] and a[i][2] > a[j][2]:
                return False
                break
    return True

if __name__ == '__main__':
    cnt = int(input())
    A = []
    for i in range(cnt):
        N = input().split()
        N.append(i)
        A.append(N)
    p = 0
    r = len(A)
    B = qsort(A,p,r)
    if isStable(B):
        print("Stable")
    else:
        print("Not stable")
    for i in B:
        print ("{0} {1}".format(i[0],i[1]))

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl

using namespace std;

typedef long long ll;
typedef string str;

const ll MAXN = 2e5 + 10;
const ll MOD = 1e9 + 7;

ll mul(ll a, ll b){
	return (a * b) % MOD;
}
ll pw(ll b, ll P){
	if(P == 0) return 1;
	if(P & 1) return mul(b, pw(b, P ^ 1));
	return pw(mul(b, b), P >> 1);
}
ll f[MAXN], iv[MAXN];
ll nCr(ll n, ll r){
	return mul(f[n], mul(iv[r], iv[n - r]));
}
ll inv(ll x){
	return pw(x, MOD - 2);
}

ll ans = 0;

void calc(ll a, ll b, ll c, ll p1, ll p2){
	ll C = mul(100, inv(100 - c));
	//debug(C);
	ll prob = mul(nCr(p1 + p2 - 1, p1 - 1), mul(   pw( mul(b, inv(a + b)), p2 ), pw( mul(a, inv(a + b)), p1 )));
	ll wait = mul(C, p1 + p2);
	ans = (ans + mul(prob, wait)) % MOD;
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	f[0] = 1;
	for(int i = 1; i < MAXN; i++) f[i] = mul(f[i - 1], i);
	iv[MAXN - 1] = pw(f[MAXN - 1], MOD - 2);
	for(int i = MAXN - 2; i >= 0; i--) iv[i] = mul(iv[i + 1], i + 1);
	
	ll n, a, b, c;
	cin >> n >> a >> b >> c;
	for(int i = 0; i < n; i++) calc(a,b,c,n,i);
	for(int i = 0; i < n; i++) calc(b,a,c,n,i);
	cout << ans;
	return 0;
}


Measured memory_bytes: 3328
n = int(input())
a = list(map(int, input().split()))

import fractions
rui_l=[0]*n
rui_r=[0]*n

rui_l[0] = a[0]
for i in range(1,n):
    rui_l[i] = fractions.gcd(rui_l[i-1], a[i])

rui_r[-1]=a[-1]
for i in reversed(range(n-1)):
    rui_r[i] = fractions.gcd(rui_r[i+1], a[i])

ans=[]
ans.append(rui_r[1])
for i in range(1,n-1):
    ans.append(fractions.gcd(rui_l[i-1],rui_r[i+1]))
ans.append(rui_l[-2])

print(max(ans))

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

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


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

    vector<long double> A(N);
    rep(i,N) cin >> A.at(i);

    long double R = 0;

    rep(i,N){
        R += 1/A.at(i);
    }

    cout << fixed << setprecision(15) << 1/R << endl;
    
    

}

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

#define ll      long long
#define MAX     1000007
#define inf     99999999999999
#define MOD     1000000007
#define pii     pair<int,int>
#define FIN     freopen("input.txt","r",stdin);
#define FOUT    freopen("output.txt","w",stdout);

int main ()
{
    string a,b;
    cin>>a>>b;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end(),greater<char>());
    if(a==b)
    {
        printf("No\n");
        return 0;
    }
    int i;
    for( i=0; i<a.size(); i++)
    {
        if(a[i]<b[i])
        {
            printf("Yes\n");
            return 0;
        }
        else if(a[i]>b[i])
        {
            printf("No\n");
            return 0;
        }
    }
    if(i==a.size() )
    {
        printf("Yes\n");
            return 0;
    }
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long M = sc.nextLong();
		if(N==1&&M==1) System.out.println(1);
		else if(N==1) System.out.println(M-2);
		else if(M==1) System.out.println(N-2);
		else System.out.println((N-2)*(M-2));	
		return;
	}
}

Measured memory_bytes: 21844
using System;

namespace Application
{
	class Solution
	{
		static void Main(string[] args)
		{
			var inputWords = Console.ReadLine().Split(' ');
			var joinedNumber = int.Parse(string.Join("", inputWords));

			var sqrt =  Math.Sqrt(joinedNumber);

			var result = sqrt - Math.Floor(sqrt) == 0d ? "Yes" : "No";

			Console.WriteLine(result);
		}
	}
}

Measured memory_bytes: 13140
import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit(0)
else:
    diff = collections.defaultdict(int)
    A.sort()
    idx = N - 1
    if K > A[-1]:
        print("IMPOSSIBLE")
        exit(0)
    else:
        for i in range(N-1):
            if A[i] > K and idx == N - 1:
                idx = i
            if A[i+1] - A[i] != 0:
                diff[A[i+1] - A[i]] += 1

        diff_list = list(diff.keys())
        if 1 in diff_list:
            print("POSSIBLE")
            exit(0)
        else:
            diff_list.sort()
            for i in range(idx, N):
                for j in range(len(diff_list)):
                    if (K - A[i]) % diff_list[j] == 0:
                        print("POSSIBLE")
                        exit(0)
            print("IMPOSSIBLE")
            exit(0)


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

using namespace std;

int main() {
    /*入力 */
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        a[i] = x;
    }
    /*a()の最大公約数 */
    int ans;
    ans = __gcd(a[0], a[1]);
    for(int i = 1; i < n-1; i++) {
        ans = min (ans, __gcd(a[i], a[i+1]));
    }

    cout << ans << endl;


    return 0;
}

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

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
#define DRT() int t; si(t); while(t--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//# define M_PI           3.14159265358979323846264338327950288
// DSU
void IO(){
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
}

int main(){
	IO();
	LL n;
	cin>>n;
	LL sub = 0;
	LL u,v;
	rep(i,0,n-1){
		cin>>u>>v;
		if(u > v)
			swap(u,v);
		sub += u * (n - v + 1);
	}
	LL ans = (n*(n+1)*(n+2))/6- sub;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3672
icase=0
if icase==0:
    s=list(input())
    od={"R","U","D"}
    ev={"L","U","D"}
    yn=""
    for i in range(0,len(s),2):
        if not s[i] in od:
            yn="No"
            break
    if yn!="No":
        for i in range(1,len(s),2):
            if not s[i] in ev:
                yn="No"
                break
    if yn=="No":
        print("No")
    else:
        print("Yes")
        

Measured memory_bytes: 3064
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m; cin >> n >> m;
    unordered_set<ll> a;
    REP(i, m) {
        ll _a; cin >> _a;
        a.insert(_a);
    }
    vll d(n+1, 1);
    if (a.find(1) != a.end()) d[1] = 0;
    rep(i, 2, n+1) {
        if (a.find(i) != a.end()) d[i] = 0;
        else d[i] = (d[i-1] + d[i-2]) % MOD;
    }
    cout << d[n] << '\n';
    return 0;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cout << #x << " = " << (x) << "\n";

const int maxn = 3e5 + 5;
int n;
int a[maxn];

void solve() {
	cin >> n;
	FOR(i, 0, n + n + n) cin >> a[i];
	sort(a, a + n + n + n);
	long long ans = 0;
	FORd(i, n, 0) {
		ans += a[n + n + n - i - i - 2];
	}
	cout << ans << "\n";
}

int main() {
	ios_base::sync_with_stdio(0); //cin.tie(0);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}

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

using namespace std;

long long a, b, k;

int main() {
    cin >> k >> a >> b;
    if (a >= b - 1) cout << k + 1;
    else cout << 1LL * (b - a) * (max(0LL, k - a + 1) / 2) + a + max(0LL, k - a + 1) % 2;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;

// ALDS1_5_C
public class Main {
	void kochCurve(int n, Point p1, Point p2) {
		if (n != 0) {
			Point s = new Point((2*p1.x + p2.x)/3, (2*p1.y + p2.y)/3);
			Point t = new Point((p1.x + 2*p2.x)/3, (p1.y + 2*p2.y)/3);
			Point u = new Point((t.x - s.x)*Math.cos(Math.toRadians(60)) -
					(t.y - s.y)*Math.sin(Math.toRadians(60)) + s.x,
					(t.x - s.x)*Math.sin(Math.toRadians(60)) +
					(t.y - s.y)*Math.cos(Math.toRadians(60)) + s.y);
			kochCurve(n-1, p1, s);
			s.print();
			kochCurve(n-1, s, u);
			u.print();
			kochCurve(n-1, u, t);
			t.print();
			kochCurve(n-1, t, p2);
		}
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Point p1 = new Point(0, 0);
		Point p2 = new Point(100, 0);
		p1.print();
		kochCurve(n, p1, p2);
		p2.print();
		sc.close();
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

class Point {
	double x;
	double y;
	Point(double x, double y) {
		this.x = x;
		this.y = y;
	}
	
	void print() {
		System.out.printf("%.8f %.8f\n", x, y);
	}
}


Measured memory_bytes: 43432