akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramA
    {
        static void Main()
        {
            long n = NextLong, a = NextLong, b = NextLong;

            if ((b - a) % 2 == 0)
            {
                System.Console.WriteLine((b - a) / 2);
            }
            else
            {
                long tmp = Math.Min(a - 1, n - b);
                System.Console.WriteLine((b - a + 1) / 2 + tmp);
            }
        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 64
pair<ll, ll> p[N];
ll x[N], y[N];
bool u[N];

int main(){
	int n; scanf("%d", &n);
	REP(i, n) scanf("%lld%lld", &p[i].first, &p[i].second);
	sort(p, p+n);
	REP(i, n) x[i]=p[i].first, y[i]=p[i].second;
	int ans = INT_MAX;
	REP(ii, n) {
		FOR(jj, ii+1, n) { int i = ii, j = jj;
			if(x[i]>x[j]) swap(i, j);
			if(x[i]==x[j] && y[i]>y[j]) swap(i, j);
			ll p = x[j]-x[i], q = y[j]-y[i];
			DEBUG("p=%lld, q=%lld\n", p, q);
			int tmp = 0;
			fill(u, u+n, false);
			REP(k, n) {
				if(u[k]) continue;
				u[k] = true;
				tmp++;
				bool found;
				ll befx = x[k], befy = y[k];
				DEBUG("  %d(%lld, %lld)\n",  k, befx, befy);
				do {
					found = false;
					REP(l, n){
						if(u[l]) continue;
						if(befx + p == x[l] && befy + q == y[l]){
							found = true;
							befx = x[l], befy = y[l];
							u[l] = true;
							DEBUG("    => %d(%lld, %lld)\n",  l, befx, befy);
							break;
						}
					}
				}while(found);
			}
			DEBUG("tmp = %d\n", tmp);
			SML(ans, tmp);
		}
	}
	if(n==1) ans = 1;
	printf("%d\n", ans);
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
ll INF = 1e9 + 7;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    if(a[0] != 0)
    {
        cout << -1 << endl;
        return 0;
    }
    ll ans = 0;
    for(int i = 1; i < n; i++)
    {
        if(a[i] > a[i-1] + 1)
        {
            cout << -1 << endl;
            return 0;
        }
        ans += a[i];
        if(a[i] == a[i-1] + 1) ans -= a[i-1];
    }
    cout << ans << endl;
}


Measured memory_bytes: 4056
#include <stdio.h>

typedef long long var;

const int N = 210005;
const int MOD = 1e9 + 7;

int h, w, a, b;
var inv[N + 1], fac[N + 1], invfac[N + 1];

var f(int n, int m);
var c(int n, int m);

int main() {
  inv[0] = fac[0] = invfac[0] = inv[1] = 1;
  for (int i = 2; i <= N; ++i)
    inv[i] = ((MOD - MOD / i) * inv[MOD % i]) % MOD;
  for (int i = 1; i <= N; ++i) {
    fac[i] = (fac[i - 1] * i) % MOD;
    invfac[i] = (invfac[i - 1] * inv[i]) % MOD;
  }
  scanf("%d%d%d%d", &h, &w, &a, &b);
  var res = f(h, w);
  for (int i = 1; i <= a; ++i)
    (res -= (f(h - i + 1, b) * f(i, w - b)) % MOD) %= MOD;
  printf("%lld\n", (res + MOD) % MOD);
  return 0;
}

var f(int n, int m) { 
  return c((n - 1) + (m - 1), m - 1);
}

var c(int n, int m) {
  if (n < 0 || m < 0 || n < m) return 0;
  return (((fac[n] * invfac[m]) % MOD) * invfac[n - m]) % MOD;
}


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

signed main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  int a, b;
  cin >> a >> b;
  int g = __gcd(a, b);
  int ret = (a * b)/g;
  cout << ret << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;
bool check(int x){
    int sum = 0;
    while(x > 0){
        sum++;
        x = x / 10;
    }
    if(sum % 2 == 0) return false;
    else return true;
}
int main() {
    int n; cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; ++i){
        if(check(i)) ans++;
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
// Try NIKKEI Programming Contest 2019
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!(usize);
    let mut ss = vec![];
    for _ in 0..3 {
        ss.push(get().as_bytes());
    }
    let mut ans = 0;
    for i in 0..n {
        let mut s = std::collections::HashSet::new();
        for j in 0..3 {
            s.insert(ss[j][i]);
        }
        ans += s.len() as i32 - 1;
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define forn(i,a,b) for(long long i=a;i<=b;i++)
#define fork(i,a,b,k) for(long long i=a;i<=b;i+=k)
using namespace std;
typedef long long ll;
ll n,h[100005],dp[100005],k;
const ll inf=1e10;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>k;
	forn(i,1,n)cin>>h[i];
	dp[1]=0;
	forn(i,2,n)dp[i]=inf;
	forn(i,1,n-1) {
		ll lim=min(i+k,n);
		for(ll j=i+1; j<=lim; j++)
			dp[j]=min(dp[i]+abs(h[i]-h[j]),dp[j]);
	}
	cout<<dp[n];
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;

struct UnionFind {
	vector<int> par;

	UnionFind(int n) : par(n, -1) { }
	void init(int n) { par.assign(n, -1); }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

int main() {
	int N;
	cin >> N;
	vector<int>x(N);
	vector<int>y(N);
	for (int n = 0; n < N; ++n) {
		cin >> x[n] >> y[n];
	}

	// Kruskal 法で使用する枝
	using pint = pair<int, int>;
	using Edge = pair<long long, pint>;
	vector<Edge> edges;
	
	// x 軸方向にソートして隣接している部分のみ
	vector<int> ids(N);
	iota(ids.begin(), ids.end(), 0);
	sort(ids.begin(), ids.end(), [&](int i, int j) { return x[i] < x[j]; });
	for (int i = 0; i + 1 < ids.size(); ++i) {
		int u = ids[i], v = ids[i + 1];
		edges.push_back(Edge(x[v] - x[u], pint(u, v)));
	}

	// y 軸方向にソートして隣接している部分のみ
	sort(ids.begin(), ids.end(), [&](int i, int j) { return y[i] < y[j]; });
	for (int i = 0; i + 1 < ids.size(); ++i) {
		int u = ids[i], v = ids[i + 1];
		edges.push_back(Edge(y[v] - y[u], pint(u, v)));
	}

	// Kruskal 法
	sort(edges.begin(), edges.end());
	UnionFind uf(N);
	long long res = 0;
	for (auto e : edges) {
		int u = e.second.first, v = e.second.second;
		long long cost = e.first;
		if (uf.issame(u, v)) continue;
		uf.merge(u, v);
		res += cost;
	}
	cout << res << endl;
}


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

namespace Piza
{
    class Paiza
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string ans = "";
            for (int i = 0; i < s.Length; i++)
            {
                if(i % 2 == 0)
                {
                    ans += s[i].ToString();
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 34772
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)
#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define vi vector<int>
#define vl vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>

int main(){
    int n;
    string s;
    cin>>n;
    cin>>s;
    int ans=0;
    int cou =0;
    rep(i,n){
      char c = s[i];
      if(s[i]=='A'){
        if(i+1<n){
          if(s[i+1]=='B'){
            if(i+2<n){
              if(s[i+2]=='C'){
                ans++;
              }
            }
          }
        }
      }
      
      
    }

    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
num_of_prefectures, cities = gets.split.map &:to_i

history = Array.new(num_of_prefectures, 0)

#ans[n][0]: prefecture,          ans[n][1]: year
#ans[n][2]: i (ith information), ans[n][3]: j (jth city)
ans = Array.new(cities).map{Array.new(4, 0)}

cities.times do |i|

  prefecture, year = gets.split.map &:to_i

  ans[i][0] = "%06d" % prefecture
  ans[i][1] = year
  ans[i][2] = i

end

#Sort by year
ans = ans.sort_by { |a| a[1] }

cities.times do|i|

  ans[i][3] = "%06d" % (history[ans[i][0].to_i - 1] + 1)
  history[ans[i][0].to_i - 1] += 1

end

ans = ans.sort_by { |e| e[2] }

ans.each{ |c| puts [c[0], c[3]].join }


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

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(50) << setiosflags(ios::fixed);
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  int q;
  cin >> q;
  rep(qi, q)
  {
    int b, e, t;
    cin >> b >> e >> t;
    swap_ranges(a.begin() + b, a.begin() + e, a.begin() + t);
  }
  rep(i, a.size()) cout << a[i] << (i == a.size() - 1 ? "\n" : " ");
  return 0;
}



Measured memory_bytes: 3156
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


int main(){
  int i;
  char op[100];
  int num[100];
  for(i=0;i<100;i++){
    num[i]=0;
  }
  i=0;
  while(scanf("%s",op)!=EOF){	//scanf?????????????????§
    if(op[0]=='+'){
      num[i-2]=num[i-1]+num[i-2];
      i--;
    }else if(op[0]=='-'){
      num[i-2]=num[i-2]-num[i-1];
      i--;
    }else if(op[0]=='*'){
      num[i-2]=num[i-1]*num[i-2];
      i--;
    }else{
      num[i]=atoi(op);		//???????????°????????????
      i++;
    }
   // printf("%d \n",num[i-1]);
  }
  printf("%d\n",num[i-1]);

  return 0;
}

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 2020, mod = 2019;

int n;
int g[N][N];

int main()
{
    for(int i = 0; i < N; i++)
        for(int j = i + 1; j < N; j++)
            g[i][j] = i * j % mod;

    int l, r;
    cin >> l >> r;
    
    if(r - l > 2019)
    {
        puts("0");
        return 0;
    }
    
    l %= mod, r %= mod;

    int res = 0x3f3f3f3f;
    for(int i = l; i <= r; i++)
        for(int j = i + 1; j <= r; j++)
            res = min(res, g[i][j]);

    cout << res << endl;
    return 0;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    ll A;
    double B;
    cin >> A >> B;
    ll B2 = round(B * 100);
    cout << (A * B2) / 100ll << endl;
}


Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
const long long inf = 1e18;

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

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

    long long ans = 1;
    for(long long i=0; i<N; ++i){
        if(A.at(i) == 0){
            ans = 0;
            break;
        }
        
        if(A.at(i) <= inf / ans){
            ans *= A.at(i);
        } else {
            ans = -1;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4032
using System;

namespace ConsoleApp1
{

    class Program
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] dims = new int[n + 1];
            int[,] ls = new int[n + 1, n + 1];
            for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) ls[i, j] = -1;

            for (int i = 0; i < n; i++) {
                string[] temp = Console.ReadLine().Split(' ');
                dims[i] = int.Parse(temp[0]);
                dims[i + 1] = int.Parse(temp[1]);
            }
            Console.WriteLine(mcm(dims, 0, n, ls));
        }
        private static int mcm(int[] dims, int i, int j, int[,] ls) {
            if (j <= i + 1) return 0;

            int min = int.MaxValue;
            if (ls[i, j] == -1)
            {
                for (int k = i + 1; k <= j - 1; k++)
                {
                    int cost = mcm(dims, i, k, ls);
                    cost += mcm(dims, k, j, ls);
                    cost += dims[i] * dims[k] * dims[j];
                    if (cost < min) min = cost;
                }
                ls[i, j] = min;
            }

            return ls[i, j];
        }
    }
}




Measured memory_bytes: 17936
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <iostream>
using namespace std;


long long int h[100010];
long long int dp[100010];

int N;

long long int q(int k) {
    if (dp[k] != -1) return dp[k];

    if (k == 0 || k == 1) dp[k] = 0;
    else if (k == 2) dp[k] = fabs(h[N-k] - h[N-k+1]);
    else dp[k] = min(q(k-1) + fabs(h[N-k] - h[N-k+1]), q(k-2) + fabs(h[N-k] - h[N-k+2]));

    return dp[k];
}

int main() {
    int k;

    cin >> N;
    for (k = 0; k < N; k++) {
        cin >> h[k];
    }

    for (k = 0; k < 100010; k++) {
        dp[k] = -1;
    }

    cout << q(N) << endl;
}

Measured memory_bytes: 4096
#include <iostream>
#include <map>
using namespace std;
int main(void){
    int n, p = 0, ans = 0;
    map<int, int> m;
    cin >> n;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        m[a]++;
    }
    for(auto itr = m.begin(); itr != m.end(); itr++){
        int s = itr->second;
        if(s%2 == 0){
            p++;
        }else{
            ans++;
        }
    }
    if(p%2 == 0){
        ans += p;
    }else{
        ans += p;
        ans--;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define faster() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl '\n'

int main()
{
    faster();


    int a;
    cin>>a;
    int ans;
    ans = a + (a*a) + (a*a*a);
    cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> pii;

pii ants[20];

int main() {
	int n, l;
	while(cin >> n >> l, n and l) {
		rep(i,n) {
			char d;
			int p;
			cin >> d >> p;
			ants[i] = pii(p, (d=='L' ? -1 : 1));
		}
		int t=0, last=-1;
		for(;;) {
			bool goal = true, left=false;
			rep(i, n) {
				if(ants[i].first%l == 0) continue;
				goal = false;
				ants[i].first += ants[i].second;
				if(ants[i].first == 0) {
					left = true;
					last = i+1;
				}
				else if(ants[i].first == l && !left) {
					last = i+1;
				}
			}
			if(goal) break;
			rep(i, n) {
				for(int j=i+1; j<n; j++) {
					if( ants[i].first == ants[j].first && ants[i].first%l > 0 ) {
						ants[i].second *= -1;
						ants[j].second *= -1;
					}
				}
			}
			t++;
		}
		cout << t << " " << last << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n-1);i>=0;--i)
#define CO cout<<
#define EN <<endl
#define CI cin>>

using namespace std;

int main() {
	int g; CI g;
	set<char> s;
	REP(i, g) {
		char tmp; CI tmp; s.insert(tmp);
	}

	if (s.size() == 3)CO "Three" EN;
	else CO "Four" EN;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
   int i, j, n, q, sum=0;
   int S[10000], T[10000];

   scanf("%d", &n);
   for (i=0; i<n; i++)
      scanf("%d", &S[i]);

   scanf("%d", &q);
   for (i=0; i<q; i++)
      scanf("%d", &T[i]);

   for (j=0; j<q; j++){
      i = 0;
      while (S[i]!=T[j])
         i++;
      if (i<n)
         sum++;
   }

   printf("%d\n", sum);

   return 0;
}

Measured memory_bytes: 1892
N = int (input())
A = list(map(int,input().split()))
C = 0
T = 0

while T == 0:
 for i in range(N):
  if A[i] % 2 == 0:
   A[i] = A[i]/2
  else:
   T = 1
   break
  if T == 1:
   break
 C=C+1

print (C-1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
ll d;
  cin>>d;
  if(d==25) {
cout<<"Christmas"<<endl;
  }
  else if(d==24) {
cout<<"Christmas Eve"<<endl;
  }
  else if(d==23) {
cout<<"Christmas Eve Eve"<<endl;
  }
  else {
    cout<<"Christmas Eve Eve Eve"<<endl;
  }
}

Measured memory_bytes: 3608
#include <stack>
#include <iostream>

int main(){
  std::stack<int> train;
  int num;
  while(std::cin >> num){
    if(num != 0){
      train.push( num );
    }
    else {
      std::cout << train.top() << std::endl;
      train.pop();
    }
  }
  return 0;
}

Measured memory_bytes: 1200
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

#スペース入力
n = int(input())
a = input().split()

A = [int(element) for element in a]

A.sort()

a_min = A[0]
a_min2 = A[1]


a_min_divs = make_divisors(a_min)
a_min2_divs = make_divisors(a_min2)

a_min_divs.remove(1)
a_min2_divs.remove(1)

max_div = 1

results = [1]


for diver in a_min_divs:
    thr = 0
    for num in A:
        # print(num)
        # print(diver)
        # print(num % diver)
        if num % diver != 0:
            thr = thr+1
            if thr > 1:

                break
            else:
                continue
    if thr < 2:
        results.append(diver)

for diver in a_min2_divs:
    thr = 0
    for num in A:
        # print(num)
        # print(diver)
        # print(num % diver)
        if num % diver != 0:
            thr = thr+1
            if thr > 1:

                break
            else:
                continue
    if thr < 2:
        results.append(diver)



print(max(results))


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


// Morris-Pratt
template<typename T>
struct MP {
   int n;
   T t;
   vector<int> a;
   MP() {}
   MP(const T& t): t(t){
      n = t.size();
      a = vector<int>(n+1);
      a[0] = -1;
      int j= -1;
      for (int i = 0; i < n; ++i){
         while (j != -1 && t[j] != t[i]) j = a[j];
         j++;
         a[i+1] = j;
      }
   }
   int operator[](int i) { return a[i];}
   vector<int> findAll(const T& s) {
      vector<int> res;
      int j = 0;
      for (int i= 0; i < s.size(); ++i){
         while (j != -1 && t[j] != s[i]) j = a[j];
         j++;
         if (j == n) {
            res.push_back(i-j+1);
            j = a[j];
         }
      }
      return res;
   }
};

vector<int> f(vector<int>& a){
   int n = a.size();
   vector<int> res(n);
   rep(i,n) res[i] = a[i]^a[(i+1)%n];
   return res;
}

int main() {
   int n;
   cin >> n;
   vector<int> a(n), b(n);
   rep(i,n) cin >> a[i];
   rep(i,n) cin >> b[i];
   vector<int> xa = f(a);
   vector<int> xb = f(b);
   MP<vector<int>> mp(xa);
   xb.insert(xb.end(), xb.begin(), xb.end());
   vector<int> res = mp.findAll(xb);
   vector<int> ks;
   for (int p : res) ks.push_back(n-p);
   sort(ks.begin(), ks.end());
   for (int k:ks){
      if (k >= n) continue;
      int x = a[k]^b[0];
      printf("%d %d\n",k,x);
   }
   return 0;
}


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

using namespace std;

int main(void){

    int x, a, b;

    cin >> x >> a >> b;

    if(a - b >= 0) {
        printf("delicious \n");
    }

    if (a-b < 0 && -(a-b) <= x) {
        printf("safe \n");
    } 

    if (a-b < 0 && -(a-b) > x) {
        printf("dangerous \n");
    }

    return 0;
}

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

int main() {
  double a=0, b=0, x=0;
  cin >> a >> b;
  x = (a+b)/2;
  if (x - int(x) != 0){
    x = int(x) + 1;
  }
  cout << x << endl;

}


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

int main() {
    int n;
    while(cin>>n) {
        int count = 0;
    for(int a = 0; a < 10; a++) {
        for(int b = 0; b < 10; b++) {
            for(int c = 0; c <10; c++) {
                for(int d = 0; d < 10; d++) {
                    if(a+b+c+d == n) {
                        count++;
                    }
                }
            }
        }
    }
    cout<<count<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

A, B, C = get_ints

test = [A, B, C].sort

puts test[2].to_i * 10 + test[1] + test[0]


Measured memory_bytes: 14420
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

bool dfs(int start, int now, long long d,vector<vector<pair<int, long long> > > &neigh, vector<bool> &used, map<long long, long long> &dist){
    if(used[now]==true){
        long long key1 = (long long) start*100000+now;
        long long key2 = (long long) now*100000+start;
        if(dist.count(key1)){
            if(dist[key1]!=d){
                //cout << start << ' ' << now << ' ' << dist[key1] << ' ' << d << endl;
                return false;
            }
        }else if(dist.count(key2)){
            if(dist[key2]!=d){
                //cout << start << ' ' << now << ' ' << dist[key2] << ' ' << d << endl;
                return false;
            }
        }else{
            //cout << start << ' ' << now << ' ' << d << endl;
            dist[key1]=d;
            dist[key2]=-d;
        }
        return true;
    }
    used[now]=true;

    for(int i=0; i<(int) neigh[now].size(); i++){
        int next = neigh[now][i].first;
        long long di = neigh[now][i].second;
        if(dfs(start, next, d+di, neigh, used, dist))continue;
        else{
            return false;
        }
    }
    return true;
}

int main(){
    int N, M;
    cin >> N >> M;
    vector<vector<pair<int, long long> > > neigh(N,vector<pair<int, long long> >(0,pair<int, long long>()));
    for(int i=0; i<M; i++){
        long long L, R, D;
        cin >> L >> R >> D;
        L--;R--;
        neigh[L].push_back(make_pair(R, D));
        neigh[R].push_back(make_pair(L, -D));
    }

    /*
    for(int i=0; i<N; i++){
        for(int j=0; j<(int) neigh[i].size(); j++){
            cout << i << ' ' << neigh[i][j].first << ' ' << neigh[i][j].second << endl;;
        }
    }
    */

    map<long long, long long> m;
    vector<bool> used(N,false);

    for(int i=0; i<N; i++){
        if(dfs(i, i, 0, neigh, used, m))continue;
        else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

}

Measured memory_bytes: 35072
# print('input >>')
A, B, M = map(int,(input().split()))
al = list(map(int,(input().split())))
bl = list(map(int,(input().split())))
xyms = []
for _ in range(M):
    xyms.append(list(map(int,(input().split()))))


ans = min(al) + min(bl)
for xym in xyms:
    x = xym[0]
    y = xym[1]
    m = xym[2]
    ans = min(al[x-1] + bl[y-1] - m, ans)

# print('-----output-----')
print(ans)

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

const int H = 800 + 10;
const int W = 800 + 10;

char g[H][W];

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int h, w, k;
  while (cin >> h >> w >> k) {
    pair<int, int> ini;
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        cin >> g[i][j];
        if (g[i][j] == 'S') ini = make_pair(i, j);
      }
    }

    const int inf = 1 << 29;
    static int cost[H][W];
    fill(&cost[0][0], &cost[H - 1][W - 1] + 1, inf);
    cost[ini.first][ini.second] = 0;
    queue<pair<int, int>> q;
    for (q.push(ini); q.size(); q.pop()) {
      const int i = q.front().first;
      const int j = q.front().second;
      int di[] = {0, 0, -1, +1};
      int dj[] = {-1, +1, 0, 0};
      for (int d = 0; d < 4; ++d) {
        const int ni = i + di[d];
        const int nj = j + dj[d];
        unless (0 <= ni && ni < h) continue;
        unless (0 <= nj && nj < w) continue;
        if (cost[ni][nj] != inf) continue;
        if (g[ni][nj] == '#') continue;
        cost[ni][nj] = cost[i][j] + 1;
        q.push(make_pair(ni, nj));
      }
    }

    int mn = inf;
    
    for (int i = 0; i < h; ++i) {
      if (cost[i][0] < k || cost[i][w - 1] < k) mn = 1;
    }
    for (int j = 0; j < w; ++j) {
      if (cost[0][j] < k || cost[h - 1][j] < k) mn = 1;
    }

    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        if (cost[i][j] <= k) {
          int a = (h - i - 1 + k - 1) / k + 1;
          int b = (i + k - 1) / k + 1;
          int c = (j + k - 1) / k + 1;
          int d = (w - j - 1 + k - 1) / k + 1;
          mn = min({mn, a, b, c, d});
        }
      }
    }
    cout << mn << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3456
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;

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




//ユークリッド互除法
template<typename T>
T gcd(T x, T y) {

	if (y == 0) {
		return x;
	}
	else {
		return gcd(y, x % y);
	}
}
/*最小公倍数*/
template<typename T>
T lcm(T x, T y) {
	T tmp = gcd(x, y);
	return (x / tmp) * y;
}


/******************************************************************************************/


int main() {


	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	int ans = 0;
	for (int i = 1; i <= n - 2; i++)
	{
		if (a[i - 1] < a[i] && a[i] < a[i + 1] || a[i - 1] > a[i] && a[i] > a[i + 1]) {
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}


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

namespace AtCoder.Abc
{
    class A_Beginner_156
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            long n = inputLongArray[0];
            long r = inputLongArray[1];
            long result = 0;

            if (n >= 10)
            {
                result = r;
            }
            else
            {
                result = r + 100 * (10 - n);
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


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

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)

#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000

using namespace std;
typedef long long ll;

int main() {
    int H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    int H = H2 - H1;
    ll M = 0;
    if (M2 - M1 < 0){
        H -= 1;
        M = 60 + M2 - M1;
    }else{
        M = M2 - M1;
    }
    M = H * 60 + M - K;
    cout << M;
}

Measured memory_bytes: 3620
#include<cstdio>
int n,p[100010],m,x,r[100010],v[100010],beg[100010],cnt1,cnt2;
long long a[100010],k,ans[100010];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%lld",a+i),a[i-1]=a[i]-a[i-1],p[i-1]=i-1;
	scanf("%d%lld",&m,&k);
	for(int i=1;i<=m;++i)scanf("%d",&x),p[x]+=p[x-1],p[x-1]=p[x]-p[x-1],p[x]-=p[x-1];
	for(int i=0;i<n;++i)if(!r[i]){
		v[beg[++cnt2]=++cnt1]=i;r[i]=cnt2;
		for(int j=p[i];j!=i;j=p[j])v[++cnt1]=j,r[j]=cnt2;
	}beg[cnt2+1]=n+1;
	for(int i=1;i<=cnt2;++i){
		int len=beg[i+1]-beg[i];
		for(int j=beg[i];j<beg[i+1];++j)ans[v[j]]=v[(j-beg[i]+k)%len+beg[i]];
	}
	ans[0]=a[ans[0]];for(int i=1;i<n;++i)ans[i]=a[ans[i]]+ans[i-1];
	for(int i=0;i<n;++i)printf("%lld.0\n",ans[i]);
	return 0;
}

Measured memory_bytes: 4480
H, W = map(int,input().split())

if H == 1 or W == 1:
    print("1")
    quit()

if H % 2 == 0:
    print(int((H / 2) * W))
else:
    if W % 2 == 0:
        print(int(H * W / 2))
    else:
        print(int(H * (W - 1) / 2 + (H + 1) / 2))

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
ll maxi[100001];
int num[100001];

int main(int argc, char const* argv[])
{
  int n;
  ll t;
  cin >> n >> t;
  vector<ll> a;
  for(int i = 0; i < n; i++){
    ll x;
    cin >> x;
    a.pb(x);
  }
  maxi[n - 1] = a[n - 1];
  num[n - 1] = 1;
  for(int i = n - 2; i >= 0; i--){
    if(a[i] > maxi[i+1]){
      maxi[i] = a[i];
      num[i] = 1;
    }else if(a[i] == maxi[i+1]){
      maxi[i] = a[i];
      num[i] = num[i+1] + 1;
    }else{
      maxi[i] = maxi[i+1];
      num[i] = num[i+1];
    }
  }
  int res = 0;
  int mval = 0;
  for(int i = 0; i < n; i++){
    if(mval < maxi[i] - a[i]){
      mval = maxi[i] - a[i];
      res = num[i];
    }else if(mval == maxi[i] - a[i]){
      res += num[i];
    }
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 2292
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
#define num(a) a-'0'
#define charr(a) (a - 'A' + 1)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define maxs(a,b) if(b>a)a=b
#define mins(a,b) if(b<a)a=b
#define debug(x) cerr<<"["<<#x<<":"<<x<<"] "
#define debug2(a,b) debug(a);debug(b)
#define debug3(a,b,c) debug2(a,b);debug(c)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/(__gcd(a,b))
#define print(arr) for(auto it = arr.begin();it < arr.end();it ++){cout << *it << " ";}cout << ln;
#define all(a) (a).begin(), (a).end()
#define vi vector<long long>
#define v vector
#define p pair
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"
typedef long double ld;
typedef double d;
using namespace std;
int modF=1e9+7;
int INF=1e11;

void solve(){
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5]){
		cout<<"Yes\n";
	}
	else{
		cout<<"No\n";
	}
}

signed main(){
	boost_io;
	solve();
	return 0;
}

Measured memory_bytes: 3628
{-# LANGUAGE FlexibleContexts #-}

module Main where

import Debug.Trace
import Data.List
import qualified Data.Set as Set
import qualified Data.Sequence as Seq
import qualified Data.ByteString.Char8 as B
import Data.Int
import Data.Char
import Data.Array
-- import Data.Array.IO
import Data.Maybe
import qualified Data.Map as M
-- import Control.Monad.ST
-- import Data.STRef
import Data.Ord
import Data.Functor
import Control.Applicative
import Control.Monad
import Text.Printf

data Vertex = Vt Int Int deriving (Eq, Show) -- Vt <ID> <Distance>
instance Ord Vertex where
    compare (Vt ia da) (Vt ib db) =
        case (ia ,da, ib, db) of
         _  | ia == ib  -> EQ 
            | ia >  ib  -> GT 
            | otherwise -> LT

data Vertex' = Vt' Int Int deriving (Eq, Show) -- Vt' <ID> <Distance>
instance Ord Vertex' where
    compare (Vt' ia da) (Vt' ib db) =
        case (ia ,da, ib, db) of
         _  | da >  db  -> GT  
            | da <  db  -> LT
            | ia >  ib  -> GT
            | ia <  ib  -> LT
            | otherwise -> EQ
            
solve :: Int -> [[Int]] -> [Vertex]
solve n lst = iter Set.empty initialQ where
    iter r q 
        | Set.null (fst q) = Set.toAscList r
        | otherwise = iter r' q' where
            r' = Set.insert v r
            q' = iter restQ (adjacencyList!i) where
                    iter q [] = q
                    iter q ((j, d):rest) = case Set.lookupGE (Vt j 0) (fst q) of
                        Just (Vt k c')
                            | j == k -> iter q'' rest
                            | otherwise -> iter q rest  where
                                c'' = min (c+d) c'
                                q'' = (Set.insert (Vt j c'') (fst q),
                                        Set.insert (Vt' j c'') (Set.delete (Vt' j c') (snd q)))
                        Nothing -> iter q rest
            
            (v'@(Vt' i c), s)= Set.deleteFindMin (snd q)
            v = Vt i c
            restQ = (Set.delete v (fst q), s)
            
    initialQ = (Set.fromList $ [Vt 0 0] ++ [Vt x maxBound | x <- [1..n-1]],
                Set.fromList $ [Vt' 0 0] ++ [Vt' x maxBound | x <- [1..n-1]])

    adjacencyList = array (0, n-1) (setupAL [] lst)
    setupAL al [] =  al
    setupAL al ((u:_:vcs):lines) = setupAL ((iter [] vcs):al) lines where
        iter av [] = (u, av)
        iter av (v:c:rest) = iter ((v,c):av) rest

readIntLn:: IO Int
readIntLn = (fst . fromJust . B.readInt) <$> B.getLine

readIntList:: IO [Int]
readIntList = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

print' :: Vertex -> IO ()
print' (Vt x y) = putStrLn $ show x ++ " " ++ show y

main :: IO() 
main = do
    n  <- readIntLn
    l <- replicateM n readIntList
    mapM_ print' $ solve n l



Measured memory_bytes: 235520
module Factwithmod
  implicit none
  integer(16),allocatable,dimension(:)::Kaijo
  contains
subroutine initiationFactorial(maxnum,mo)
  implicit none
  integer(16)::maxnum
  integer(16)::mo
  integer(16)::i

  allocate(Kaijo(0:maxnum))
  Kaijo(0)=1
  do i=1,maxnum
    Kaijo(i)=mod(Kaijo(i-1)*i,mo)
  end do
end subroutine

function combination(n,k,l)
implicit none
integer(16),intent(in)::n,k,l
integer combination

combination=mod(Kaijo(N)*inv(Kaijo(K),l)*inv(Kaijo(N-K),l),l)

end function

function inv(K,L)
integer(16),intent(in)::k,l
integer(16) l2,y
integer(16) inv
inv=1
l2=l-2
y=k
do
  if(mod(l2,2)==1)inv=mod(inv*y,l)
  y=mod(y*y,l)
  l2=l2/2
  if(l2==0)exit
end do
end function

function permutation(n,k,mo)
implicit none
  integer(16)::n,k
  integer(16)::mo,permutation
  permutation=mod(Kaijo(N)*inv(Kaijo(N-K),mo),mo)
end function
end module
program ABC151E
    use Factwithmod
    implicit none
    integer(16)::N,K
    integer(16),allocatable,dimension(:)::A
    integer(16)::maxs=0,mins=0
    integer(16)::i,j
    integer(16)::mo=10**9+7
    read*,N,K
    allocate(A(N))
    read*,A
    call heapsort(N,A)
    call initiationFactorial(N,mo)
    do i=N,K,-1
        maxs=maxs+A(i)*combination(i-1,k-1,mo)
        maxs=mod(maxs,mo)
    end do
    do i=1,N-K+1
        mins=mins+A(i)*combination(N-i,K-1,mo)
        mins=mod(mins,mo)
    end do
    print"(i0)",modulo(maxs-mins,mo)

contains
subroutine heapsort(n,array)
  implicit none
!ここの入力は状況に応じて変更すること
  integer(16),intent(in) :: n
  integer(16),intent(inout) :: array(1:n)
  integer(16)::i,k,j,l
  integer(16):: t

  l=n/2+1
  k=n
  do while(k /= 1)
     if(l > 1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k == 1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j<=k)
        if(j < k)then
           if(array(j) < array(j+1))j=j+1
        endif
        if (t < array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo
  return
end subroutine heapsort
end program ABC151E 

Measured memory_bytes: 3968
#include <cstdio>
#include <math.h>

int main(){
	bool prime[10001];
	int n, p1, q1;
	for(int i = 0; i < 10001; i++){
		prime[i] = true;
	}
	prime[0] = prime[1] = false;
	for(int i = 2; i < sqrt(10001); i++){
		if(prime[i]){
			
			for(int j = 2; j * i < 10001; j++){
				prime[j*i] = false;
			}
		}
	}
	
	while(scanf("%d", &n) != EOF){
		if(n == 0) break;
		for(int i = n; i > 0; i--){
			if(prime[i] && prime[i-2]){
				p1 = i-2;
				q1 = i;
				break;
			}
		}
		
		printf("%d %d\n", p1, q1);
	}
	
	return 0;
}

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

typedef long long ll;

int t;
ll A, B, C, D;

ll gcd(ll x, ll y) { return x? gcd(y % x, x): y; }

int main()
{
	scanf("%d", &t);
	while (t--) {
		cin >> A >> B >> C >> D;
		if (A < B) printf("No\n");
		else if (D < B) printf("No\n");
		else if (C >= B) printf("Yes\n");
		else {
			ll g = gcd(B, D);
			ll k = (A - C + B - 1) / g;
			if (A - C - k * g < -C) printf("No\n");
			else printf("Yes\n");
		}
	}
	return 0;
}

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


#include <assert.h>    // LON
#include <math.h>    // sqrt()


using namespace std;
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

int main() {


    string s;
    cin >> s;

    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 1) continue;
        cout << s[i];
    }
    cout << endl;


}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N, K;

int main () {
  cin >> N >> K;
  vector<int> V[100];
  V[0].push_back(1);
  for (auto i = 0; i < N; ++i) {
    for (auto x : V[i]) {
      V[i+1].push_back(2 * x);
      V[i+1].push_back(x + K);      
    }
  }
  cout << *min_element(V[N].begin(), V[N].end()) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N, K;
    cin >> N >> K;
    vector<ll> P(N), C(N);
    rep(i,N){
        cin >> P[i];
        P[i]--;
    }
    rep(i,N){
        cin >> C[i];
    }
    ll ans = -1e18;
    /*rep(i,N){
        ll cur = i;
        ll sum = 0;
        vector<ll> s;
        while(1){
            cur = P[cur];
            s.push_back(C[cur]);
            sum += C[cur];
            if(cur == i) break;
        }
        ll l = s.size();
        ll t = 0;
        rep(j,l){
            t += s[j];
            if(j+1 > K) break;
            ll now = t;
            if(sum > 0){
                ll e = (K-(j+1))/l;
                now += sum*e;
            }
            cmax(ans, now);
        }
    }
    cout << ans << endl;*/
    
    rep(i,N){
        ll cur = P[i]; 
        ll cnt = 0;
        ll sum = 0;
        //ll sum = C[P[cur]];
        //cnt++;
        vector<ll> memo(N);
        vector<ll> S(N+10);
        //memo[P[cur]] = cnt;
        //S[cnt] = sum;
        //cmax(ans,sum);
        //cur = P[cur];
        while(1){
            if(memo[cur] > 0){
                break;
            }
            memo[cur] = 1;
            sum += C[cur];
            //memo[P[cur]] = cnt;
            cur = P[cur];
            cnt++;
        }
        //cmax(ans, sum);
        //if(K <= N) continue;
        //cnt = memo[cur] - memo[P[cur]] + 1;
        //sum = S[memo[cur]];
        ll t = 0;
        cur = P[i];
        rep(j,cnt){
            t += C[cur];
            if(j+1 > K)break;
            ll now = t;
            if(sum > 0){
                ll e = (K-(j+1))/cnt;
                now += sum*e;
            }
            cur = P[cur];
            cmax(ans,now);
        }
        /*
        if(sum <= 0) continue;
        
        ll q = ll(K/cnt) - 1;
        ll r = K%cnt;
        sum = sum*q;
        cur = i;
        rep(j, cnt+r){
            sum += C[P[cur]];
            cur = P[cur];
            cmax(ans, sum);
        }        
        cmax(ans, sum);*/
    }
    cout << ans << endl;
}

Measured memory_bytes: 3776
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] tokens = in.nextLine().split(" ");
		int a = Integer.parseInt(tokens[0]);
		int b = Integer.parseInt(tokens[1]);

		int result = (a * b) - (a + b - 1);
		System.out.println(result);

		in.close();

	}

}

Measured memory_bytes: 19796