akhauriyash/Code-Regression huggingface dataset:
#pragma region

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
using vvb = vector<vector<bool>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  init();

  ll A, B, N;
  cin >> A >> B >> N;

  ll ans = A * min(B - 1, N) / B;

  out(ans);
}


Measured memory_bytes: 3640
from itertools import permutations

def g(a):
    if len(a) == 1: yield str(a[0])
    for i in range(1, len(a)):
        for l in g(a[:i]):
            for r in g(a[i:]):
                yield '({}+{})'.format(l, r)
                yield '({}-{})'.format(l, r)
                yield '({}*{})'.format(l, r)

def solve(a):
    for e in permutations(a):
        for s in g(e):
            if eval(s) == 10: return s
    return '0'

while True:
    a = list(map(int, input().split()))
    if a == [0,0,0,0]: break
    print(solve(a))

Measured memory_bytes: 6724
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;

void solve() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b) cout << c << endl;
	if (a == c) cout << b << endl;
	if (b == c) cout << a << endl;
	return;
}

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

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

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var S = ReadText();
            return S + (S.Last() == 's' ? "es" : "s");
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 26252
#include<iostream>

using namespace std;

int main(void){

  int T, D, L;
  int i;
  int ans;
  int tap;

  while(1){
    cin >> T >> D >> L;
    if(T==0 && D==0 && L==0)
      break;
    int x[T];
    ans=0;
    tap=0;
    
    for(i=0; i<T; i++){
      cin >> x[i];
    }
    for(i=0; i<T-1; i++){
      if(x[i]>=L)
	tap=D;
      
      tap--;
      
      if(tap>=0)
	ans++;
    }
    cout << ans << endl; 
  }
  return 0;
}


Measured memory_bytes: 3468
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ar array
 
int main() {
  ll a,b,n,x;
  cin>>a>>b>>n;
  cout<<(n>=b-1 ? (a * (b - 1))/b : (a*n)/b);
  
}

Measured memory_bytes: 3628
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def div_two(num):
    cnt = 0
    while num % 2 == 0:
        num = num // 2
        cnt += 1
    return cnt


def main():
    N = int(input())

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

    print(sum(div_two(i) for i in A))


if __name__ == "__main__":
    main()


Measured memory_bytes: 4148
#include<stdio.h>
 int main(void)
 {
     int N,K,X,Y;
     int $=0;

     scanf("%d%d%d%d",&N,&K,&X,&Y);

     if(N>K) $=K*X+(N-K)*Y;
     else $=N*X;

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

     return 0;
 }



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(){
    int n;
    cin>>n;
    vector<int> dp(n+1,n+10);
    dp.at(0)=0;
    dp.at(1)=1;
    for(int i=2;i<=n;i++){
        chmin(dp.at(i),dp.at(i-1)+1);
        int a=6,b=9;
        while(a<=i){
            chmin(dp.at(i),dp.at(i-a)+1);
            a*=6;
        }
        while(b<=i){
            chmin(dp.at(i),dp.at(i-b)+1);
            b*=9;
        }
    }
    cout<<dp.at(n)<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(V, v) for (auto &&V : v)
#define all(x) (x).begin(), (x).end()
using lint = long long;
const int INF = 1 << 30;
const int INFL = 1LL << 62;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;

using namespace std;

int main(void) {
  int q;
  cin >> q;
  vector<int> t(q), a(q), b(q);
  rep(i, q) {
    cin >> t[i];
    if (t[i] == 1) cin >> a[i] >> b[i];
  }
  multiset<int, greater<int>> l;
  multiset<int> r;
  int lmax = -INF, rmin = INF;
  lint lsum = 0, rsum = 0, bsum = 0;
  int mid;
  bool mid_ava = false;
  rep(i, q) {
    if (t[i] == 1) {
      if (mid_ava) {
        if (a[i] < mid) {
          r.insert(mid);
          rmin = mid;
          rsum += mid;
          l.insert(a[i]);
          lmax = max(lmax, a[i]);
          lsum += a[i];
        } else {
          l.insert(mid);
          lmax = mid;
          lsum += mid;
          r.insert(a[i]);
          rmin = min(rmin, a[i]);
          rsum += a[i];
        }
      } else {
        if (a[i] < lmax) {
          l.erase(l.begin());
          mid = lmax;
          l.insert(a[i]);
          lmax = *l.begin();
          lsum += a[i] - mid;
        } else if (a[i] > rmin) {
          r.erase(r.begin());
          mid = rmin;
          r.insert(a[i]);
          rmin = *r.begin();
          rsum += a[i] - mid;
        } else {
          mid = a[i];
        }
      }
      mid_ava = !mid_ava;
      bsum += b[i];
    } else {
      cout << (mid_ava ? mid : lmax) << " " << rsum - lsum + bsum << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 12032
#!/usr/bin/env python
# coding: utf-8

# In[38]:


N = int(input())
s = []
for _ in range(N):
    s.append(int(input()))


# In[39]:


flag0 = True

sorted_s = sorted(s)
sum_s = sum(sorted_s)
if sum_s%10 != 0:
    print(sum_s)
    flag0 = False
else:
    for i in range(N):
        if sorted_s[i]%10 != 0:
            print(sum_s - sorted_s[i])
            flag0 = False
            break

if flag0:
    print(0)


# In[ ]:






Measured memory_bytes: 3060
#include <map>
#include <algorithm>
#include <cassert>
#include <climits>
#include <complex>
#include <cstdio>
#include <string>
#include <iostream>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
#define DEBUG(X) cerr<<"  "<<#X<<" = "<<X<<endl;
#define DUMP(A, n) for (auto x=begin(A); x!=begin(A)+n;x++){cout <<*x<< ' ';} cout<<endl;
#define DUMPP(A, n, m) for (auto x=begin(A); x != begin(A)+n;x++) {for (auto y=begin(*x); y != begin(*x)+m;)cout <<*y++<< ' '; cout<<endl;};
#define DUMPM(M) for (auto itr=mp.begin(); itr!=mp.end(); itr++) {cout<<itr->first<<" -> "<<itr->second<<endl;}
#define FOR(i,x,y) for(int i=(x);i<(int)(y);i++)
#define FORP(i,x,y) for(int i=(x);i<=(int)(y);i++)
#define REP(i,y) for(int i=0;i<(int)(y);i++)
#define REPP(i,y) for(int i=1;i<=(int)(y);i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)

int n,k;
int x[500];
int y[500];


bool area(int x1, int x2, int y1, int y2) {
  int cnt = 0;
  REP(i,n) {
    if (x1<=x[i]&&x[i]<=x2&&y1<=y[i]&&y[i]<=y2) cnt++;
  }
  return k<=cnt;
}

int x1q[100];
int x2q[100];
int y1q[100];
int y2q[100];

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

  REP(i,n) {
    cin >> x[i] >> y[i];
    x1q[i] = x[i];
    y1q[i] = y[i];
  }

  sort(x1q,x1q+n);
  sort(y1q,y1q+n);

  ll ans = 9223372036854775807;
  FOR(x1,0,n) {
    FOR(x2,x1,n) {
      FOR(y1,0,n) {
        FOR(y2,y1,n) {
          if (area(x1q[x1],x1q[x2],y1q[y1],y1q[y2]))
            chmin(ans,(x1q[x2]-x1q[x1])*1LL*(y1q[y2]-y1q[y1] ));
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        solve();
    }
    static Scanner cin;
    static int N;

    static void input()
    {
        cin = new Scanner();
        N = cin.nextInt();
    }
    static void solve()
    {
        input();

        if (N == 1)
            WriteLine(0);
        else
        {
            WriteLine(((long)N - 1) * N / 2);
        }
    }
    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }
        
        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }

        public double[] ArrayDounble(int N, int add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13140
N = input()
if N[-1] == "3":
    print("bon")
elif N[-1] == "0":
    print("pon")
elif N[-1] == "1":
    print("pon")
elif N[-1] == "6":
    print("pon")
elif N[-1] == "8":
    print("pon")
elif N[-1] == "2":
    print("hon")
elif N[-1] == "4":
    print("hon")
elif N[-1] == "5":
    print("hon")
elif N[-1] == "7":
    print("hon")
elif N[-1] == "9":
    print("hon")

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

#define PI 3.141592653589793238
int N;

int main()
{
    double x = 0.0, y = 0.0;
    int N, L;
    cin >> N;
    cin >> L;
    vector<int> T(N);
    for (int i = 0; i < N; i++)
        cin >> T[i];
    //for (int i = 0; i < N ; i++){
    //    fprintf(stderr, "%f, %f\n", cos(2 * PI * T[i]/(double)L), sin(2 * PI * T[i]/(double)L));
        
    //}
    for (int i = 0; i < N - 1; i++){
        for (int j = i + 1; j < N; j++){
            int coef2 = j - i - 1;
            int coef1 = N - 2 - coef2;
            double x0 = (coef1 - coef2) * cos(2 * PI * (T[i] + T[j])/(double)(2*L));
            double y0 = (coef1 - coef2) * sin(2 * PI * (T[i] + T[j])/(double)(2*L));
            //fprintf(stderr, "%d, %d: %f, %f\n", i, j, x0, y0);
            x += x0;
            y += y0;
        }
    }
    x /= N *(N - 1.) * (N - 2)/6.0;   
    y /= N *(N - 1.) * (N - 2)/6.0;
    //x *= 3.0;
    //y *= 3.0;
    //cout<<setprecision(10)<<x<<' '<<y<<endl;
    fprintf(stdout, "%.15f %.15f\n", x, y);
    //cout << x << " " << y << endl;
    return 0;    
}


Measured memory_bytes: 384
def main():
  if 'get_ipython' not in globals():  
    a,b = map(int,input().split())
  else:
    a,b = 5,3
    s = "test"
 
  # 以下にコード本体を書く
  def get(a,b, count, ans):
    if count == 0:
      return(ans)
    
    if a >= b:
      return(get(a-1, b, count -1, ans + a))
    else:
      return(get(a, b-1, count -1, ans + b))
  
  print(get(a, b, 2, 0))
  
main()

Measured memory_bytes: 3060
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define mod (int)1000000007
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define all(V) V.begin(),V.end()
#ifdef int
constexpr int INF = LLONG_MAX / 5;
#else
constexpr int INF = INT_MAX / 10;
#endif
constexpr double eps = DBL_EPSILON;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
using namespace std;
inline int gcd(int a, int b) {
	while (b) {
		int c = a;
		a = b; b = c % b;
	}
	return a;
}
inline int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
bool isprime(int n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
int mypow(int a, int b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	int memo = mypow(a, b >> 1);
	return memo * memo;
}
int modpow(int a, int b, int m = mod) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	int memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
int n, k, a[200010], b, c;
vector<int> vec[2];
signed main() {
	cin >> n >> k;
	rep(i, n) {
		cin >> a[i];
		if (a[i] < 0) {
			b++;
			vec[0].push_back(-a[i]);
		}
		if (a[i] > 0) {
			c++;
			vec[1].push_back(a[i]);
		}
	}
	sort(all(vec[0]));
	sort(all(vec[1]));
	if (b * c >= k) {
		int mi = 0, ma = INF;
		while (mi + 1 < ma) {
			int md = (mi + ma) / 2;
			int cnt = 0;
			for (int i : vec[0]) {
				cnt += vec[1].end() - lower_bound(all(vec[1]), (md + i - 1) / i);
			}
			if (cnt < k)ma = md;
			else mi = md;
		}
		cout << -mi << endl;
	}
	else if (b * c + (n - b - c) * (b + c) + (n - b - c) * (n - b - c - 1) / 2 >= k) {
		cout << 0 << endl;
	}
	else {
		k -= b * c + (n - b - c) * (b + c) + (n - b - c) * (n - b - c - 1) / 2;
		int mi = 0, ma = INF;
		while (mi + 1 < ma) {
			int md = (mi + ma) / 2;
			int cnt = 0;
			rep(i, vec[0].size()) {
				cnt += upper_bound(vec[0].begin() + i + 1, vec[0].end(), md / vec[0][i]) - vec[0].begin() - i - 1;
			}
			rep(i, vec[1].size()) {
				cnt += upper_bound(vec[1].begin() + i + 1, vec[1].end(), md / vec[1][i]) - vec[1].begin() - i - 1;
			}
			if (cnt < k)mi = md;
			else ma = md;
		}
		cout << ma << endl;
	}
	return 0;
}

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

int main()
{
	int n,m;
	cin>>n>>m;
	int a,b;
	int s[n+1];
	bool check=true;
	
	memset(s,-1,sizeof(s));
	
	if(n==1 && m==0)
	{
		cout<<0<< endl;
		return 0;
	}
	else if(n==2 && m==0)
	{
		cout<<10<< endl;
		return 0; 
	}
	else if(n==3 && m==0)
	{
		cout<<100<< endl;
		return 0;
	}
	
	for(int i=1; i<=m; i++)
	{
		cin>>a>>b;
		
		if(s[a]!=-1 && b!=s[a])
			check=false;
		else if(n>1 && a==1 && b==0)
			check=false;
		else
			s[a]=b;
	}
	
	if(s[1]==-1)
		s[1]=1;
	
	if(check==false)
	{
		cout<<"-1"<< endl;
		return 0;
	}
	
	for(int i=1; i<=n; i++)
	{
		if(s[i]==-1)
			s[i]=0;
	}
	
	int i=1;
	if(n>1)
		while(s[i]==0) i++;
	
	for(int j=i; j<=n; j++)
		cout<<s[j];
	
	return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

double dp[4010][4010];
signed main() {
    int N; cin >> N;

    dp[0][0] = 1;
    for(int i=0; i<N; i++) {
        double p; cin >> p;
        for(int j=0; j<=i; j++) {
            // おもて
            dp[i+1][j+1] += dp[i][j] * p;

            // うら
            dp[i+1][j] += dp[i][j] * (1 - p);
        }
    }

    double ans = 0;
    for(int i=N/2+1; i<=N; i++) ans += dp[N][i];
    printf("%.12f\n", ans);
    return 0;
}


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

using namespace std;

int n,i,j,a[100005],cnt[100005];

int main(){
	scanf("%d", &n);
	
	vector <int> num;
	
	for(i = 0; i < n; i++){
		scanf("%d", &a[i]);
		num.push_back(a[i]);
	}
	
	sort(num.begin(), num.end());
	num.resize(unique(num.begin(), num.end()) - num.begin());
	
	for(i = 0; i < n; i++){
		a[i] = lower_bound(num.begin(), num.end(), a[i]) - num.begin();
		cnt[a[i]]++;
	}
	
	int mx = 0;
	int mx1 = 0;
	
	for(i = n - 1; i >= 0; i--){
		if(cnt[i] >= 2){
			cnt[i] -= 2;
			mx = num[i];
			break;
		}
	}
	
	for(i = n - 1; i >= 0; i--){
		if(cnt[i] >= 2){
			mx1 = num[i];
			break;
		}
	}
	
	printf("%lld\n", 1LL * mx * mx1);
}


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


int main() {
	int N, i, p, j, k, Y;	//ひなあられの個数
	bool Four = false;
	string test[100];

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> test[i];
		if (test[i] == "Y")
			Four = true;
	}

	if (Four)
		cout << "Four" << endl;

	else
		cout << "Three" << endl;
}

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

const int N=3e6+10;
const long double PI=acos(-1);
typedef complex<double> Complex;
struct FastFourierTransform  {
    Complex omega [N], omegaInverse [N] ;
    void init ( int n )  {
        for ( int i = 0 ; i < n ; ++ i )  {
            omega [i] = Complex ( cos ( 2 * PI / n * i), sin ( 2 * PI / n * i ) ) ;
            omegaInverse [i] = conj(omega [i]);
        }
    }
    void transform ( Complex *a, int n, const Complex* omega ) {
        for ( int i = 0, j = 0 ; i < n ; ++ i )  {
            if ( i > j )  swap ( a [i], a [j] ) ;
                for( int l = n >> 1 ; ( j ^= l ) < l ; l >>= 1 ) ;
	    }
        for ( int l = 2 ; l <= n ; l <<= 1 )  {
            int m = l >> 1;
            for ( Complex *p = a ; p != a + n ; p += l )
                for ( int i = 0 ; i < m ; ++ i )  {
                    Complex t = omega [n / l * i] * p [m + i] ;
                    p [m + i] = p [i] - t ;
                    p [i] += t ;
                }
        }
    }
    void dft ( Complex *a, int n )  {
        transform ( a, n, omega ) ;
    }
    void idft ( Complex *a, int n )  {//逆变换
        transform ( a, n, omegaInverse ) ;
        for ( int i = 0 ; i < n ; ++ i ) a [i] /= n ;
    }
} fft ;
Complex a[N];

typedef long long ll;
ll P=200003;
ll c[N];
int idx[200003];
int Pow[200003];

int main(){
    ll tmp=1;
    for(int i=0;i<=P-2;++i){
        idx[tmp]=i;
        Pow[i]=tmp;
        tmp=tmp*2%P;
    }
    int n;
    scanf("%d",&n);
    ll ans=0;
    for(int i=0;i<n;++i){
        scanf("%lld",c+i);
        if(c[i]==0)continue;
        a[idx[c[i]]]+=Complex(1,0),ans-=c[i]*c[i]%P;
    }
    
    tmp=1;
    n=2*P;
    while(tmp<n)tmp<<=1;
    n=tmp;
    fft.init(n);
    fft.dft(a,n);
    for(int i=0;i<n;++i)a[i]*=a[i];
    fft.idft(a,n);
    
    for(int i=0;i<n;++i){
        ans+=(ll)(a[i].real()+0.5)*Pow[i%(P-1)];
    }
        
    ans/=2;
    printf("%lld",ans);
    return 0;
}
/*
3
2019 2020 200002
*/

Measured memory_bytes: 31832
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
   long long int n;
   cin>>n;
   long long int arr[n+1],arr1[n+1];
   for(int i=0;i<n;i++)
   {
       cin>>arr[i];
       arr1[arr[i]-1]=i+1;
   }
   for(int i=0;i<n;i++)
   {
       cout<<arr1[i]<<" ";
   }
   cout<<endl;
}


Measured memory_bytes: 5088
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,l,ans;
    cin>>n>>l;
    ans=n*(l+l+n-1)/2;
    if(l>0){
        cout<<ans-l;
    }
    else if(l+n-1<0){
        cout<<ans-(l+n-1);
    }
    else{
        cout<<ans;
    }
}




Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <set>
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define vii vector<pair<int, int> >
#define si stack<int>
#define pb push_back
#define mp make_pair
#define ALL(T) (T).begin(), (T).end()
#define MODU 1000000007
typedef long long ll;
using namespace std;

ll intmax = (1LL<<32)-1;
ll llmax = (1LL<<60)-1;

const int INF = 1e9 + 5;

class fastio{
public:
	fastio(){
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
	}
} __fastio;

template <typename T>
T abs(T x){
	if(x<0)	return -x;
	else return x;
}

void DFSVisit(int u, vector<int> g[], vector<bool> &visited){ 
    visited[u] = true;
    for(int i=0; i<g[u].size(); i++){
        if(!visited[g[u][i]]){
            DFSVisit(g[u][i], g, visited); 
        }
    }
} 
  
void DFS(vector<int> adj[], int V){
    vector<bool> visited(V, false); 
    for(int u=0; u<V; u++) 
        if(!visited[u]) 
            DFSVisit(u, adj, visited);
}


void solve(){
	
}

int main(){
	char p, c;
	cin >> p;
	for(int i=0; i<3; i++){
		cin >> c;
		if(p == c){
			cout << "Bad";
			return 0;
		}
		p = c;
	}
	cout << "Good";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
struct fast_ios { fast_ios(){cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast_ios_;

int main()
{
    int X;
    cin >> X;
    int x500 = X/500;
    int x5 = (X-x500*500)/5;
    cout << x500*1000 + x5*5 << endl;
    
    return 0;
}

Measured memory_bytes: 256
use proconio::{input, fastout};
use num_traits::pow;

#[fastout]
fn main() {
  input!{
      a:i32,
      b:i32,
      c:i32,
      k:usize
  }
  let mut ans : bool = false;
  for i in 0..=k {
      for j in 0..=k {
          for l in 0..=k {
              let na = a*pow(2,i);
              let nb = b*pow(2,j);
              let nc = c*pow(2,l);
              if i+j+l == k && nc > nb && nb > na {
                ans = true;
              }
          }
      }
  }
  println!("{}",if ans {"Yes"} else {"No"});
}


Measured memory_bytes: 2144
i =0
ans = 1
N = int(input())
a = list(map(int,input().split()))
if 0 in a:
  print(0)
else:
  while ans<10**18 and i<len(a):
    ans*=a[i]
    i+=1
  if(ans<= 10 ** 18):
    print(ans)
  else:
    print(-1)

Measured memory_bytes: 21484
n=int(input())
C=[]
for i in range(9):
    C.append([0]*9)
for i in range(1,n+1):
    l=int(str(i)[0])
    r=int(str(i)[-1])
    if r!=0:
        C[l-1][r-1]+=1
ans=0
for i in range(9):
    for j in range(9):
        ans+=C[i][j]*C[j][i]
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;
const int MAXN = 2000010;
int n;
ll x[MAXN];
ll sortedX[MAXN];

void solve() {
  sort(sortedX, sortedX + n);
  int mid = n / 2;
  for (int i=0;i<n;i++) {
    if (x[i] <= sortedX[mid-1]) {
      cout << sortedX[mid] << endl;
    } else {
      cout << sortedX[mid-1] << endl;
    }
  }
}

int main() {
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> x[i];
    sortedX[i] = x[i];
  }
  solve();
}


Measured memory_bytes: 7808
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <deque>
#include <string.h>
#include <math.h>

using namespace std;

#define PI 4.0*atan(1.0)
#define epsilon 0.000000001
#define INF 1000000000000000000
#define MOD 1000000007

int N;
long long arr [200010], ret = 2e14;

int main(){
    //freopen("necklace.in", "r", stdin); freopen("necklace.out", "w", stdout);
    scanf("%d", &N); arr[0] = 0ll;
    for(int i = 1; i < N+1; i++){
        scanf("%lld", &arr[i]);
        arr[i] += arr[i-1];
    }
    for(int i = 1; i < N; i++) ret = min(ret, abs(arr[N]-2ll*arr[i]));
    cout << ret << '\n';
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int a,b;
  cin>>a>>b;
  if(a!=1&&b!=1) cout<<"1"<<endl;
  else if(a!=2&&b!=2) cout<<"2"<<endl;
  else cout<<"3"<<endl;
}	


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define MOD 1000000007
#define MOD2 1000000009
#define sp fixed<<setprecision
#define sz(x) (int)(x).size()
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
ll fpow(ll x,ll y,ll p=MOD){x=x%p;ll sum=1;while(y){if(y&1)sum=sum*x;sum%=p;y=y>>1;x=x*x;x%=p;}return sum;}
ll inv(ll a,ll m=MOD){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
ll add(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return (a%MOD + b%MOD + MOD)%MOD;}
ll sub(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return (a%MOD - b%MOD + MOD)%MOD;}
ll mul(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return ((a%MOD)*(b%MOD) + MOD)%MOD;}
void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if (sz(name)) {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}
ll spf[1000005];
int main(){
    setIO();
    for(int i=0;i<1000005;i++)
      spf[i]=i;
    for(int i=2;i<=sqrt(1000005);i++){
      for(int j=i;j<1000005;j+=i)
        spf[j]=min(spf[j],(ll)(i));
    }

    ll n;
    cin>>n;
    ll res=0;
    for(int i=1;i<n;i++){
      ll x  = n-i;
      map<ll,ll>m;
      while(spf[x]>1){
        m[spf[x]]++;
        x/=spf[x];
      }
      ll tmp=1;
      for(auto u:m){
        tmp*=(u.se+1);
      }
      res+=tmp;
    }
    cout<<res;
}


Measured memory_bytes: 11468
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

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

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

int main()
{
    int n;
    cin>>n;
    double p[n],a[n+1][n+1];
    int i,j,k,l;
    double w=0;
    //cout<<1;
    //cout<<n<<endl;
    for(i=0;i<n;i++) {
        //cout<<i<<endl;
        cin>>p[i];
    }
    //cout<<2;
    memset(a, 0.0, sizeof(a));
    //cout<<3;
    a[0][0]=1.0;
    for(i=1;i<n+1;i++) {
        a[i][0]=a[i-1][0]*(1-p[i-1]);
    }
    //cout<<4;
    for(i=1;i<n+1;i++) {
        for(j=1;j<n+1;j++) {
            a[i][j]=(a[i-1][j]*(1-p[i-1]))+(a[i-1][j-1]*p[i-1]);
        }
    }
    //cout<<5;
    for(i=n/2+1;i<n+1;i++) {
        w+=a[n][i];
    }
    cout<<fixed<<setprecision(10)<<w<<endl;

    return 0;
}


Measured memory_bytes: 74128
//Snake JOI
#include <iostream>
#include <vector>
#include <queue>
#include <climits>

using namespace std;

static const int MAX = 10000;

enum TYPE {
    COLD = 0,
    CONFORTABLE = 1,
    HOT = 2
};

struct Corridor {
    int target, cost;
    Corridor(int target, int cost): target(target), cost(cost) {}
};

struct Room {
public:
    int id, type;
    vector<Corridor> edge;
    Room() {}
    Room(int id, int type): id(id), type(type) {}
};

struct State {
    int id, time, prev_type, d;
    State(int id, int time, int prev_type, int d): id(id), time(time), prev_type(prev_type), d(d) {}
    bool operator < (const State &s) const {
        return time > s.time;
    };
};

int N, M, X;
Room rooms[MAX];
int min_time[MAX][2][201];

int dijkstra() {
    priority_queue<State> PQ;
    for(int i = 0; i < MAX; i++) {
        for(int j = 0; j < 2; j++) {
            for(int k = 0; k < 201; k++) min_time[i][j][k] = INT_MAX;
        }
    }
    min_time[0][0][0] = 0;
    PQ.push(State(0, 0, COLD, 0));
    int ans = INT_MAX, next_time, next_type, next_d;
    while(!PQ.empty()) {
        if(PQ.top().id == N - 1) {
            ans = min(ans, PQ.top().time);
            PQ.pop();
            continue;
        }
        if(PQ.top().time > ans) break;
        for(auto c: rooms[PQ.top().id].edge) {
            next_d = min(X, PQ.top().d + c.cost);
            next_time = PQ.top().time + c.cost;
            if(abs(PQ.top().prev_type - rooms[c.target].type) > 1 && next_d < X) continue;
            if(rooms[c.target].type == CONFORTABLE) {
                next_type = PQ.top().prev_type;
                if(min_time[c.target][next_type / 2][next_d] <= next_time) continue;
                min_time[c.target][next_type / 2][next_d] = next_time;
                PQ.push(State(c.target, next_time, next_type, next_d));
            } else {
                next_type = rooms[c.target].type;
                if(min_time[c.target][next_type / 2][0] <= next_time) continue;
                min_time[c.target][next_type / 2][0] = next_time;
                PQ.push(State(c.target, next_time, next_type, 0));
            }
        }
        PQ.pop();
    }
    return ans;
}

int main() {
    int t, a, b, d;
    scanf("%d %d %d", &N, &M, &X);

    for (int i = 0; i < N; i++) {
        scanf("%d", &t);
        rooms[i] = Room(i, t);
    }

    for (int i = 0; i < M; i++) {
        scanf("%d %d %d", &a, &b, &d);
        a--;
        b--;
        rooms[a].edge.emplace_back(Corridor(b, d));
        rooms[b].edge.emplace_back(Corridor(a, d));
    }

    cout << dijkstra() << endl;
}


Measured memory_bytes: 19860
#!/usr/bin/env python3

def main():
    # Failed to predict input format
    N = int(input())
    x = [ [] for i in range(N+1)]
    for i in range(N):
        a = int(input())
        for j in range(a):
            x[i].append(list(map(int, input().split())))

    ans = 0
    for i in range(1<<N):
        y = [[] for k in range(N+1)]
        for j in range(N):
            if (i>>j) &1:
                for k in range(len(x[j])):
                    a, b = x[j][k]
                    # print(a-1, b)
                    y[a].append(b)

        if all([j == [] or j.count(1) == len(j) or j.count(0) == len(j) for j in y[1:]]):
            f = True
            for idx, k in enumerate(y[1:], 1):
                if k == []:
                    continue

                elif k[0] == 0 and not i>>(idx-1)&1:
                    continue

                elif k[0] == 1 and i>>(idx-1)&1:
                    continue

                else:
                    f = False
            if f:
                ans = max(ans, '{:05b}'.format(i).count('1'))
                
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
const ll C = 1e9+7;

int main() {
    vector<int> N(3);
    cin >> N[0] >> N[1] >> N[2];

    sort(N.begin(), N.end());
    ll div = N[2] - N[1] + N[2] - N[0];

    if(div % 2 == 0) {
        cout << div / 2 << endl;
    }
    else {
        cout << div / 2 + 2 << endl;
    }
}

Measured memory_bytes: 3568
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;

using namespace std;

int main() 
{
    int ans = INF;
    int m, n, x; cin >> n >> m >> x;

    v_int a(m);
    v_int s(n+1,0);
    irep(i, m) { 
        cin >> a[i]; 
        s[a[i]] += 1;
    }
    
    int cost = 0;
    for(int i = x; i <= n; i++) {
        if(s[i]) { cost++; }
    }
    ans = min(cost, ans);
    cost = 0;
    for(int i = x; i >= 0; i--) {
        if(s[i]) { cost++; }
    }

    ans = min(cost, ans);
    cout << ans << endl;

    return 0;
}
    



Measured memory_bytes: 256
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
template<typename T> ll min(ll a, const T&& b) { return a < b ? a : b; }
template<typename T> ll min(const T&& a, ll b) { return a < b ? a : b; }
template<typename T> ll max(ll a, const T&& b) { return a > b ? a : b; }
template<typename T> ll max(const T&& a, ll b) { return a > b ? a : b; }
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

vector<ll> dijkstra(const vector<vector<P>>& G, const ll s) {
  const ll n = G.size();
  vector<ll> dist(n, linf);
  dist[s] = 0;
  priority_queue<P, vector<P>, greater<P>> Q;
  Q.push(P(0, s));
  while ( !Q.empty() ) {
    P p = Q.top(); Q.pop();
    ll cost, v; tie(cost, v) = p;
    if (cost > dist[v]) continue;
    each(e, G[v]) {
      if (dist[v] + e.second < dist[e.first]) {
        dist[e.first] = dist[v] + e.second;
        Q.push(P(dist[e.first], e.first));
      }
    }
  }
  return dist;
}

void solve() {
  ll n; cin >> n;
  vector<vector<P>> G(n);
  rep(i, n-1) {
    ll a, b, c; cin >> a >> b >> c; --a, --b;
    G[a].eb(b, c);
    G[b].eb(a, c);
  }
  ll Q, K; cin >> Q >> K; --K;
  vector<ll> dist = dijkstra(G, K);
  rep(q, Q) {
    ll x, y; cin >> x >> y; --x, --y;
    cout << dist[x] + dist[y] << endl;
  }
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define 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 VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

typedef tuple<ll, ll, ll> T;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    map<int,int>mp;
    REP(i,n){
        int k;cin>>k;
        REP(j,k){
            int a;cin>>a;
            mp[a]++;
        }
    }
    int ans=0;
    REP(i,m+1){
        if(mp[i]>=n) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std ;
using ll = long long ;

ll sa(ll a,ll b){return max(a,b)-min(a,b) ;}

int main(){
	ll n,m ;
	cin >> n >> m ;
	vector<pair<ll,ll>> stu(n) ;
	for(int i=0;i<n;i++) cin >> stu.at(i).first >> stu.at(i).second ;
	vector<pair<ll,ll>> pnt(m) ;
	for(int i=0;i<m;i++) cin >> pnt.at(i).first >> pnt.at(i).second ;
	for(int i=0;i<n;i++){
		ll mn = 2000000000000100000 ;
		ll pos = 0 ;
		for(int j=0;j<m;j++){
			ll d = sa(stu.at(i).first,pnt.at(j).first)+sa(stu.at(i).second,pnt.at(j).second) ;
			if(mn>d){
				mn = d ;
				pos = j ;
			}
		}
		cout << pos+1 << endl ;
	}
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean flag[] = new boolean[31];
		
		for(int i = 0; i < 28; i++) {
			flag[sc.nextInt()] = true;
		}
		
		for(int i = 1; i <= 30; i++) {
			if (!flag[i]) {
				System.out.println(i);
			}
		}
	}
}

Measured memory_bytes: 26352
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a,b,c,n,m;
	cin>>a>>b>>c>>n>>m;
	int out=0;
	int t=min(n,m);
	n-=t,m-=t;
	out+=t*min(a+b,2*c);
	if(n)out+=n*min(a,2*c);
	if(m)out+=m*min(b,2*c);
	cout<<out<<endl;
}



Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;
using System.Linq;

class abc122_B
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine();
        var regex = new Regex(@"([ATCG]+)", RegexOptions.Compiled);
        
        var matches = regex.Matches(input);
        var result = matches.Cast<Match>().SelectMany(g => g.Captures.Cast<Capture>()).Select(s => s.Length).DefaultIfEmpty(0).Max();

        Console.WriteLine(result);

    }
}

Measured memory_bytes: 16076
#include<iostream>
#include<string>
#define COL 12
#define ROW 12
using namespace std;
	int field[COL][ROW];

void mapping(int y, int x){
	//cout<<"mapping("<<y<<", "<<x<<")\n";
	if(field[y][x]==1){
		field[y][x]=0;
		if(y+1<COL) mapping(y+1,x);
		if(x+1<COL) mapping(y,x+1);
		if(y-1>=0)  mapping(y-1,x);
		if(x-1>=0)  mapping(y,x-1);
	}
	return;
}

int main(){
	string str;
	int i, j,cnt;
	bool loop = true;
	while(true){
		for(i=0;i<COL;i++){
			cin>>str;
			if(cin.eof()){
				loop = false;
				break;
			}
			for(j=0;j<ROW;j++){
				field[i][j] = str[j] - '0';
			}
		}
		if(loop==false) break;
		cnt=0;
		for(i=0;i<COL;i++){
			for(j=0;j<ROW;j++){
				if(field[i][j]==1){
					mapping(i,j);
					cnt++;
				};
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}

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

bool huiwen(string a)
{
	string b=a;
	reverse(a.begin(),a.end());
	if(a.compare(b)==0)
	return true;
	else
	return false;
} 

bool strongp(string t)
{
	if(!huiwen(t))
	return false;
	else{
		int n=t.size();
		int nn=(n-1)/2;
		string ts=t.substr(0,nn);
		if(!huiwen(ts))
		return false;
		else{
			int nnn=(n+3)/2-1;
			n-=nnn;
			string st=t.substr(nnn,n);
			if(huiwen(st))
			return true;
			else
			return false;
		}
	}
}

int main()
{
	string S;
	cin>>S;
	if(strongp(S))
	cout<<"Yes\n";
	else
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#define reg register
#define LL long long
inline LL read(){
	LL x=0,y=1;
	char c=std::getchar();
	while(c<'0'||c>'9'){if(c=='-') y=0;c=std::getchar();}
	while(c>='0'&&c<='9'){x=x*10+(c^48);c=std::getchar();}
	return y?x:-x;
}
char s[1000006];
int main(){
	std::scanf("%s",s+300001);
	int head=300001,tail=std::strlen(s+300001)+300000;
	reg int q=read(),rev=0;
	while(q--){
		int op=read();
		if(op==1) rev^=1;
		else{
			op=read();char c;std::scanf("%c",&c);
			if(op==1) rev?s[++tail]=c:s[--head]=c;
			else rev?s[--head]=c:s[++tail]=c;
		}
	}
	if(!rev) for(reg int i=head;i<=tail;i++) std::putchar(s[i]);
	else for(reg int i=tail;i>=head;i--) std::putchar(s[i]);
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 998244353
#define MAX 200003

int main(){
  ll X,K,D;
  cin>>X>>K>>D;

  if(X<0){
    X=-X;
  }

  if((double)K*(double)D>=1e18){
    int x=X/D;
    X-=x*D;
    K-=x;
    if(K%2==0){
      cout<<X<<endl;
    }else{
      cout<<D-X<<endl;
    }
  }else{
    if(X-K*D<0){
      int x=X/D;
      X-=x*D;
      K-=x;
      if(K%2==0){
        cout<<X<<endl;
      }else{
        cout<<D-X<<endl;
      }
    }else{
      cout<<X-K*D<<endl;
    }
  }
}


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

#define mod 1000000007

vector<vector<long>> multiply(vector<vector<long>> a, vector<vector<long>> b)
{
  int n=a.size();
  vector<vector<long>> res(n,vector<long>(n,0));
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<n;j++)
    {
      for(int k=0;k<n;k++)
      {
        res[i][j]+=(a[i][k]*b[k][j])%mod;
        res[i][j]%=mod;
      }
    }
  }
  return res;
}

vector<vector<long>> power(vector<vector<long>>&a, long k)
{
  if(k==1)
    return a;
  vector<vector<long>> res=power(a,k/2);
  if(k%2)
    return multiply(a,multiply(res,res));
  return multiply(res,res);
}

int main(){
  int n;
  cin>>n;
  long long k;
  cin>>k;
  vector<vector<long>> graph(n,vector<long>(n));
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<n;j++)
      cin>>graph[i][j];
  }
  
  vector<vector<long>> ansmat=power(graph,k);
  long ans=0;
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<n;j++)
    {
      ans+=ansmat[i][j];
      ans%=mod;
    }
  }
  cout<<ans;
  
  
  /*vector<long> dp(n+1,1);
  for(int i=0;i<k;i++)
  {
    vector<long> dpnew(n+1);
    for(int i=1;i<=n;i++)
    {
      for(int j=1;j<=n;j++)
      {
        if(graph[i][j])
          dpnew[j]+=dp[i]%mod;
        dpnew[j]%=mod;
      }
    }
    dp=dpnew;
  }
  long ans=0;
  for(int i=1;i<=n;i++)
  {
    ans+=dp[i];
    ans%=mod;
  }
  cout<<ans;*/
  
}

Measured memory_bytes: 512
R, G, B, N = map(int, input().split())

ans = 0
for r in range(0, 3001):
    for g in range(0, 3001):
        if (N - r * R - g * G) // B >= 0 and (N - r * R - g * G) % B == 0:
            ans += 1
print(ans)


Measured memory_bytes: 68316
//10.0.3.47 perfec
#include<set>
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<cstdio>
#include<cstring>
#include<climits>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define LL long long
#define ULL unsigned long long
using namespace std;
int read(){
	int f=0,x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f?-x:x;
}
#define MAXN 100
#define INF 0x3f3f3f3f
int main(){
	int a=read(),b=read(),c=read();
	printf("%d\n",max(0,c-a+b));
	return 0;
}


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

int main() {
#ifdef HOME
	freopen("agc2a.in", "r", stdin);
	freopen("agc2a.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int a, b;

	cin >> a >> b;

	if (a <= 0 && 0 <= b) {
		cout << "Zero\n";
		return 0; }

	if (a > 0) {
		cout << "Positive\n";
		return 0; }

	if ((b - a) % 2)
		cout << "Positive\n";
	else
		cout << "Negative\n";

	return 0; }


Measured memory_bytes: 256