akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <algorithm>
#include <sstream>
using namespace std;

int L;
map<string,int> mp;

string fillDigit(string s){
  while(s.length() != L){
    s = "0" + s;
  }
  return s;
}

string itoa(int x){
  stringstream ss;
  ss << x;

  string res = ss.str();

  return fillDigit(res);
}

string next(string s){
  sort(s.rbegin(), s.rend());

  int upper = atoi(s.c_str());

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

  int lower = atoi(s.c_str());

  return itoa(upper - lower);
}

int main(){
  string s;

  while(cin >> s >> L, s != "0" || L){
    s = fillDigit(s);
    mp.clear();

    for(int i = 0; ; i++){
      if(mp.find(s) != mp.end()){
        cout << mp[s] << " " << atoi(s.c_str()) << " " << i - mp[s] << endl;
        break;
      }
      mp[s] = i;
      s = next(s);
    }
  }
}

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

int main() {
  int h,w;cin>>h>>w;
  vector<vector<char>> s(h,vector<char>(w));
  rep(i,h)rep(j,w)cin>>s[i][j];
  rep(i,h)rep(j,w){
    if(s[i][j]=='.'){
      s[i][j]='0';
      for(int x=-1;x<=1;x++)for(int y=-1;y<=1;y++){
        int dx=i+x,dy=j+y;
        if(0<=dx&&dx<h&&0<=dy&&dy<w&&s[dx][dy]=='#'){
          s[i][j]++;
        }
      }
    }
  }
    rep(i,h)rep(j,w){
      cout<<s[i][j];
      if(j==w-1)cout<<endl;
    }
}

Measured memory_bytes: 3652
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

long long solve(long long n) {
  if (n % 2 == 0)
    return n ^ ((n / 2) % 2);
  else
    return (((n + 1) / 2) % 2);
}

int main() {
  long long a, b;
  cin >> a >> b;
  cout << (solve(a - 1) ^ solve(b)) << endl;
  return 0;
}

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

using namespace std;

const char en = '\n';
using  ll =          long long;
using ull = unsigned long long;


using Bitset = bitset<100001>;
int n,k;

int main(){
	ios::sync_with_stdio(false);cin.tie();
	while(true){
		cin>>n>>k;
		if(n==0&&k==0) break;

		Bitset b;
		int buf;
		for(int i=0;i<k;i++){
			cin>>buf;
			b.set(buf);
		}
		deque<int> d;
		for(int i=1;i<=n;i++){
			if(!b[i])
				d.push_back(i);
		}
		d.push_front(0);
		d.push_back (n+1);


		int result=0;
		if(b[0]){

			int befA=d.front();	d.pop_front();
			int befB=d.front();	d.pop_front();
			while(!d.empty()){
				buf =d.front();	d.pop_front();
				result=max(result,buf-befA-1);
				befA=befB;
				befB=buf;
			}
			cout<<result<<en;

		}else{

			int before=d.front();	d.pop_front();
			while(!d.empty()){
				buf=d.front();	d.pop_front();
				result=max(result,buf-before-1);
				before=buf;
			}
			cout<<result<<en;

		}
		/*
		while(!d.empty()){
			cout<<d.front()<<en;
			d.pop_front();
		}
		cout<<en;
		*/
	}
	return 0;
}

Measured memory_bytes: 3280
#-swank
(unless (member :child-sbcl *features*)
  (quit
    :unix-status
    (process-exit-code
      (run-program *runtime-pathname*
                   `("--control-stack-size" "128MB"
                     "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                     "--eval" "(push :child-sbcl *features*)"
                     "--script" ,(namestring *load-pathname*))
                   :output t :error t :input t))))

(defparameter *hash-memo* (make-hash-table :test #'equal))

(defmacro dp (&body func)
  `(let* ((f (quote func))
          (num (gethash f *hash-memo*)))
     (if num
       num
       (setf (gethash f *hash-memo*) ,func))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(let* ((d (read))
       (querys (read))
       (a (loop repeat d collect (read))))
  (dotimes (query-cnt querys)
    (let* ((n (1- (read)))
           (x (read))
           (m (read))
           (ans n)
           (sum (mod x m)))
      (loop for i below d
            for j in a
            do
            (let ((num (mod j m))
                  (cnt (floor (- (+ n d) i 1) d)))
              (if (zerop num)
                (decf ans cnt)
                (incf sum (* num cnt)))))
      (format t "~a~%" (- ans (floor sum m))))))


Measured memory_bytes: 35896
#include <bits/stdc++.h>
using namespace std;
int A,B,C;

int main() {

  cin >> A >> B >> C;

  if (A	== B){
    if (A != C){
      cout << "Yes" << endl;
    }
    if (A == C){
      cout << "No" << endl;
    }
  }
  else if (B == C){
    if (A != C){
        cout << "Yes" << endl;
    }
    if (A == C){
      cout << "No" << endl;
    }
  }
  else if (C == A){
    if (B != C){
      cout << "Yes" << endl;
    }
    if (B == C){
      cout << "No" << endl;
    }
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

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

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

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

    string ans = "";
    for (auto s: ss) {
        ans += s;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
inline void write(int x)
{
    if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n=read(),m=read(),tot=(n-2)*(n-1)/2-m;
    if(tot<0){pr2(-1);return 0;}
    pr2(n-1+tot);
    for(int i=2;i<=n;i++)pr1(1),pr2(i);
    for(int i=2;i<=n;i++)
    {
    	for(int j=i+1;j<=n;j++)
    	{
    		if(!tot)break;
    		tot--;pr1(i),pr2(j);
    	}if(!tot)break;
    }
   	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#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 ALL(a) (a).begin(), (a).end()

int main() {
    int H1, H2, M1, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    cout << H2 * 60 + M2 - (H1 * 60 + M1) - K << endl;
    return 0;
}

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

template<typename T>
istream& operator >> (istream& istr, vector<T>& vec){
    for(T& x: vec) istr >> x;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& vec){
    if(!vec.empty()){
        ostr << vec.front();
        for(auto itr = ++vec.begin(); itr != vec.end(); itr++)
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    ostr << p.first << " " << p.second;
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
// vll x(n); x[i]=a;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll>> vpll;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
#define EPS 1e-12
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

int main(){
    ll n, ans = 1;
    cin >> n;
    vc s(n);
    cin >> s;
    REP(i,n-1){
        if(s[i]!=s[i+1]) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 3e5 + 10;
int T;
ll n, a, b, c, d;
map<ll, ll>mp;
ll dfs(ll n) {
	if (n == 0)return 0;
	if (n == 1ll)return d;
	if (mp.count(n))return mp[n];
	ll res = inf;
	if (n < res / d)res = n * d;
	ll l2 = n / 2, r2 = l2 + (n & 1);
	ll l3 = n / 3, r3 = l3 + (n % 3 != 0);
	ll l5 = n / 5, r5 = l5 + (n % 5 != 0);
	res = min(res, abs(l2*2 - n)*d + a + dfs(l2));
	res = min(res, abs(r2*2 - n)*d + a + dfs(r2));
	res = min(res, abs(l3*3 - n)*d + b + dfs(l3));
	res = min(res, abs(r3*3 - n)*d + b + dfs(r3));
	res = min(res, abs(l5*5 - n)*d + c + dfs(l5));
	res = min(res, abs(r5*5 - n)*d + c + dfs(r5));
	mp[n] = res;
	return res;
}
int main() {
	scanf("%d", &T);
	while (T--) {
		mp.clear();
		scanf("%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d);
		printf("%lld\n", dfs(n));
	}
	return 0;
}

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

const int N = 400005;
int vet[N];

int main()
{
	int k, n;
	scanf("%d %d", &k, &n);
	for (int i=0; i<n; i++){
		scanf("%d", &vet[i]);
	}
	for (int i=n; i<2*n; i++){
		vet[i] = vet[i-n] + k;
	}
	int ans = 1000000000;
	for (int i=n-1; i<2*n-1; i++){
		ans = min(ans, (vet[i] - vet[i-n+1]));
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 1792
#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;

int main() {
    int n; cin >> n;
    vector<int> nums;
    for(int i = 0; i < n; ++i){
        int x; cin >> x;
        nums.push_back(x);
    }
    int ans = 0;
    for(int i = 1; i < n - 1; ++i){
        if(nums[i] > nums[i - 1] && nums[i] < nums[i + 1]) ans++;
        if(nums[i] < nums[i - 1] && nums[i] > nums[i + 1]) ans++;
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 998244353;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var I = G;
		var C = I[2];
		Array.Sort(I);
		WriteLine(I[1] == C ? "Yes" : "No");
	}
}


Measured memory_bytes: 13396
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.Comparator;

public class Main{
	
	public int index;
	public int value;
	public String name;
	
	
	
	public int getIndex() {
		return index;
	}


	public void setIndex(int index) {
		this.index = index;
	}


	public int getValue() {
		return value;
	}


	public void setValue(int value) {
		this.value = value;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	Main(int value,String name,int index){
		this.value=value;
		this.name=name;
		this.index=index;
	}
	

	public static void main(String[] args) {
		
	Scanner sc=new Scanner(System.in);
	int N=sc.nextInt();
	String[] S=new String[N];
	List list=new ArrayList();
	int[] P=new int[N];
	int[] sr=new int[N];
	for(int i=0;i<N;i++) {
		S[i]=sc.next();
		P[i]=sc.nextInt();
		Main main=new Main(P[i],S[i],i+1);
		list.add(main);
	}
	Collections.sort(list, new Comparator<Main>() {
	    public int compare(Main v1, Main v2) {
	        return v1.name.compareTo(v2.name);
	    }
	});
	
	Collections.sort(list, new Comparator<Main>() {
	    public int compare(Main v1, Main v2) {
	        if(v1.name.equals(v2.name)) {
	        	
	        	return v2.value-v1.value;
	        }
	        return 0;
	    }
	});
	
	for(int i=0;i<N;i++) {
		System.out.println(((Main)list.get(i)).getIndex());
	}
	
	


	}
	

	
}
	

Measured memory_bytes: 21716
#define DEBUG 0

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

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

int dist[200][200];
int colour[200];
int main() {
    int i,j;
    int N;
    char c;
    scanf("%d",&N);
    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) scanf(" %c",&c),dist[i][j] = (i == j) ? 0:((c == '1') ? 1:1e9);
    }

    int k,no = 0;
    colour[0] = 0;
    for (i = 1; i < N; i++) colour[i] = -1;
    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) {
            for (k = 0; k < N; k++) {
                if ((dist[j][k] == 1) && (colour[j] != -1)) {
                    if (colour[k] == colour[j]) no = 1;
                    colour[k] = !colour[j];
                }
            }
        }
    }
    for (k = 0; k < N; k++) {
        for (i = 0; i < N; i++) {
            for (j = 0; j < N; j++) dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j]);
        }
    }
    int ans = 0;
    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) ans = max(ans,dist[i][j]);
    }
    printf("%d\n",no ? -1:ans+1);

    return 0;
}



Measured memory_bytes: 384
N,X=map(int,input().split())
m=[]
for i in range(N):
    m.append(int(input()))
m.sort()
a=0
if X>sum(m):
    a+=len(m)
    X-=sum(m)
    while X>=0:
        a+=1
        X-=min(m)
    print(a-1)
else:
    for i in range(N):
        a+=1
        X-=m[i]
        if X<m[i]:
            break
    print(a)

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

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

  if (A == B && A != C){
    cout << C << endl;
  }
  else if (A == C && A != B)
  {
    cout << B << endl;
  }
  else
  {
    cout << A << endl;
  }
  
  
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int sum = 0;
  for(int i = 0; i < N; i++) {
    if(i % 2 == 0) sum += a.at(i);
    else sum -= a.at(i);
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#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 D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;

    ll fill = (n / (a + b));
    ll rem = n - fill * (a + b);
    cout << fill * a + min(rem, a) << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        if (a > b) Console.WriteLine("a > b");
        else   if (a == b) Console.WriteLine("a == b");
        else Console.WriteLine("a < b");


    }
}

Measured memory_bytes: 8744
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	VE l(n + 1), r(n + 1);
	rep(i, n)l[i + 1] = gcd(l[i], a[i]);
	for (int i = n - 1; i >= 0; i--) {
		r[i] = gcd(r[i + 1], a[i]);
	}
	int ans = 0;
	rep(i, n) {
		chmax(ans, gcd(l[i], r[i + 1]));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void cookieClickerA(ll &A, ll &K) {
    if (A == 0 || K == 0) return;

    if (A < K || A == K) {
        K -= A; A = 0;
        return;
    } else if (K < A) {
        A -= K; K = 0;
        return;
    }
}

void cookieClickerB(ll &B, ll &K) {
    if (B == 0 || K == 0) return;

    if (B < K || B == K) {
        K -= B; B = 0;
        return;
    } else if (K < B) {
        B -= K; K = 0;
        return;
    }
}

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

    cookieClickerA(A, K);
    cookieClickerB(B, K);
    
    cout << A << " " << B << endl;
}

Measured memory_bytes: 3604
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		long [] in = new long [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }
        Arrays.sort(in);
		long ans = 1;
        String str = "1000000000000000000";
        long max = Long.parseLong(str);
        for(int i=0;i<a;i++){if(in[i]==0){ans=0;break;}
                             if(in[i]<=max/ans){ans*=in[i];
                                             }else{ans=-1;break;}
                            }
		System.out.println(ans);
	}
}


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

int main(){
    int a,b;
    cin>>a>>b;
    int x,y,z,w;
    if(a%2==1){
        x=a*25/2+1;
        y=x+11;
    }else {
        x=a*25/2;
        y=x+12;
    }
    z=b*10;
    w=z+9;
    if(x>w||y<z){
        cout<<-1;
        return 0;
    }
    if(x>z) {
        cout<<x;
    }  else{
        cout<<z;
    }
}

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

int main() {
  int n,i;cin >> n;
  vector<pair<int,int>> c(n);
  rep(i,n) cin >> c[i].second >> c[i].first;
  sort(c.begin(),c.end());
  int cnt=0;
  rep(i,n){
    cnt+=c[i].second;
    if(cnt > c[i].first){
      cout<<"No";
      return 0;
    }
  }
  cout<<"Yes";
}


Measured memory_bytes: 1792
N=int(input())
rest={}
for i in range(N):
    S,P=input().split(" ")
    P=int(P)
    tmp=rest.get(S,[])
    tmp.append((P,i+1))
    rest[S]=tmp
for key in sorted(rest.keys()):
    Rs=rest[key]
    for s in sorted(Rs,reverse=True):
        print(s[1])


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 20000005
#define eps 1e-10
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
int H,W,a[405][405],cnt[2];
char s[405][405];
bool vis[405][405];
int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};
bool in_range(int x,int y) {
	return x >= 1 && x <= H && y >= 1 && y <= W;
}
void dfs(int x,int y) {
	cnt[a[x][y]]++;vis[x][y] = 1;
	for(int k = 0 ; k < 4 ; ++k) {
		int tx = x + dx[k],ty = y + dy[k];
		if(in_range(tx,ty)) {
			if(!vis[tx][ty] && a[tx][ty] != a[x][y]) {
				dfs(tx,ty);
			}
		}
	}
}
void Solve() {
	read(H);read(W);
	for(int i = 1 ; i <= H ; i++) {
		scanf("%s",s[i] + 1);
		for(int j = 1 ; j <= W ; ++j) {
			if(s[i][j] == '#') a[i][j] = 1;
			else a[i][j] = 0;
		}
	}
	int64 ans = 0;
	for(int i = 1 ; i <= H ; ++i) {
		for(int j = 1 ; j <= W ; ++j) {
			if(!vis[i][j]) {
				cnt[1] = 0;cnt[0] = 0;
				dfs(i,j);
				ans += 1LL * cnt[1] * cnt[0];
			}
		}
	}
	out(ans);enter;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Solve();
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
#define MAX_V 20000

int V;
vector<int> G[MAX_V];     // グラフの隣接リストを表現
vector<int> rG[MAX_V];    // 変の向きを逆にしたグラフ
vector<int> vs;           // 帰りがけ順の並び

bool used[MAX_V];
int comp[MAX_V];

void add_edge(int from, int to){
  G[from].push_back(to);
  rG[to].push_back(from);
}

void dfs(int v){
  used[v] = true;
  for(int i = 0; i < G[v].size(); i++){
    if(!used[G[v][i]]) dfs(G[v][i]);
  }
  vs.push_back(v);
}

void rdfs(int v, int k){
  used[v] = true;
  comp[v] = k;
  for(int i = 0; i < rG[v].size(); i++){
    if(!used[rG[v][i]]) rdfs(rG[v][i], k);
  }
}

int scc(){
  memset(used, 0, sizeof(used));
  vs.clear();
  for(int v = 0; v < V; v++){
    if(!used[v]) dfs(v);
  }
  memset(used,0,sizeof(used));
  int k = 0;
  for(int i = vs.size() - 1; i >= 0; i--){
    if(!used[vs[i]]) rdfs(vs[i],k++);
  }
  return k;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int E;
  cin >> V >> E;
  rep(i,E){
    int s,t;
    cin >> s >> t;
    add_edge(s,t);
  }
  scc();
  int Q;
  cin >> Q;
  //rep(i,V) cout << i << ": " << comp[i] << endl;
  rep(i,Q){
    int u,v;
    cin >> u >> v;
    cout << ((comp[u] == comp[v]) ? 1 : 0) << endl;
  }
  return 0;
}



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

int main()
{
  int x, y, tmp;
  while (true) {
    cin >> x >> y;

    if (x == 0 && y == 0) break;

    if (x > y) {
      tmp = x;
      x = y;
      y = tmp;
    }

    printf("%d %d\n", x, y);
  }


  return 0;
}


Measured memory_bytes: 3216
#include <cstdio>
using namespace std;

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

int w, h;
char B[20][21];

int dfs(int i, int j) {
   B[i][j] = '#';
   int res = 1;
   for (int k = 0; k < 4; k++) {
      int y = i + dy[k], x = j + dx[k];
      if (y >= 0 && y < h && x >= 0 && x < w && B[y][x] == '.') res += dfs(y, x);
   }
   return res;
}

int main() {
   for (; scanf("%d%d", &w, &h), w;) {
      for (int i = 0; i < h; i++) {
         scanf("%s", B[i]);
      }
      for (int i = 0; i < h; i++) {
         for (int j = 0; j < w; j++) {
            if (B[i][j] == '@') printf("%d\n", dfs(i, j));
         }
      }
   }
}



Measured memory_bytes: 2608
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        
        var sc = new Scanner(System.in);
    
        int n = Integer.parseInt(sc.next());
        long d = Long.parseLong(sc.next());
        
        int ans = 0;
        for(int i = 0; i < n; i++){
            long x = Long.parseLong(sc.next());
            long y = Long.parseLong(sc.next());
            if(x*x + y*y <= d*d) ans++;
        }
    
        System.out.println(ans);
    }
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x, y) CPP_CAT_I(x, y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x, y) x##y

#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'017LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

#define M5 100007
#define M9 1000000000

// util {{{
#define FOR(i, start, end) for (i64 i = (start), CPP_CAT(i, xxxx_end) = (end); i < CPP_CAT(i, xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f, c, ...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ##__VA_ARGS__); })(c))
#define ll long long int
#define VI vector<int>
template <typename C>
i64 SIZE(const C &c)
{
    return static_cast<i64>(c.size());
}

template <typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

template <typename T, typename U, typename Comp = less<>>
bool chmax(T &xmax, const U &x, Comp comp = {})
{
    if (comp(xmax, x))
    {
        xmax = x;
        return true;
    }
    return false;
}

template <typename T, typename U, typename Comp = less<>>
bool chmin(T &xmin, const U &x, Comp comp = {})
{
    if (comp(x, xmin))
    {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit
{
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit()
    {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if (AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

bool isOK(int mid, double key)
{
}

int binary_search(double key)
{
    int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int right = 2000000000;
    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1)
    {
        int mid = left + (right - left) / 2;

        if (isOK(mid, key))
            right = mid;
        else
            left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}

bool isKaibun(string st)
{
    bool ans = true;
    int n = st.length();
    REP(i, n / 2)
    {
        if (st[i] != st[n - i - 1])
        {
            return false;
        }
    }
    return true;
}

int toInt(char a)
{
    return a - '0';
}

int gcd(int a, int b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

int lcm(int a, int b)
{
    return a * b / gcd(a, b);
}

void solve()
{
    int X, Y;
    cin >> X >> Y;
    int ansx = 4 * X - Y;
    int ansy = Y - 2 * X;
    if (ansx >= 0 && ansx % 2 == 0 && ansy >= 0 && ansy % 2 == 0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}

signed main()
{

    solve();

    return 0;
}


Measured memory_bytes: 3648
#include<iostream>

int main() {
	int a, ans;

	std::cin >> a;
	
	if(a<10){
		std::cout << a << std::endl;
	}
	else if(a<100){
		std::cout << 9 << std::endl;
	}
	else if(a<1000) {
		std::cout << 9 + a % 100 + (a / 100)*100 - 99 <<std::endl;
	}
	else if (a < 10000) {
		std::cout << 9 + 900 << std::endl;
	}
	else if (a < 100000) {
		std::cout << 9 + 900 + a % 10000 + (a / 10000) * 10000 - 9999 << std::endl;
	}
	else if (a == 100000) {
		std::cout << 9 + 900 + 90000 << std::endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 2005
#define reg register
#define inf INT_MAX
#define int long long

using namespace std;

const int mod = 1e9 + 7, inv_2 = 500000004;
long long K, N;
int a[MAX], inv[MAX];

inline int Rd() {
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') { if(ch == '-') f = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9') x = x * 10 + (ch ^ 48), ch = getchar();
	return x * f;
}

#define lowbit(x) x & -x
int BIT[MAX];
inline void upd(int p, int v) {
	for(reg int i = p; i <= 2000; i += lowbit(i)) BIT[i] += v;
	return;
}
inline int sigma(int p) {
	int res = 0;
	for(reg int i = p; i; i -= lowbit(i)) res += BIT[i];
	return res;
}

inline long long calc(long long str, long long delta) {
	return ((K - 1) * delta % mod + 2ll * str) % mod * K % mod * inv_2 % mod;
}

signed main() {
//	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	N = Rd(), K = Rd();
	for(reg int i = 1; i <= N; ++i) a[i] = Rd(), upd(a[i], 1);
	for(reg int i = 1; i <= N; ++i) {
		for(reg int j = 1; j < i; ++j) {
			if(a[j] > a[i]) ++inv[i];
		}
	}
	long long ans = 0;
	for(reg int i = 1; i <= N; ++i)
		(ans += calc(inv[i], N - sigma(a[i]))) %= mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include<iostream>
using namespace std;

#define int long long int
#define all(x) (x).begin(), (x).end()
#define removeDuplicates(a) a.resize(unique(all(a))-a.begin())
#define endl '\n'

template<typename Type>
istream &operator>>(istream &in,vector<Type>&vec){
	int n=vec.size();	
	for(int i=0;i<n;i++)
		in>>vec[i];
	return in;
}
template<typename Type>
ostream &operator<<(ostream &out,vector<Type>&vec){
	for(auto val:vec)
		out<<val<<" ";
	out<<endl;
	return out;
}

const int mod=1e9+7;

void solve(){
	int h,w;
	cin>>h>>w;
	vector<vector<char>>mat(h,vector<char>(w));
	cin>>mat;
	vector<vector<int>>dp(h,vector<int>(w));
	dp[0][0]=1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(i>0 && mat[i-1][j]!='#'){
				dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;
			}
			if(j>0 && mat[i][j-1]!='#'){
				dp[i][j]=(dp[i][j]+dp[i][j-1])%mod;
			}
		}
	}
	cout<<dp[h-1][w-1]<<endl;
}

int32_t main(){

	//remove for interactive problems
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	solve();
	cerr<<"Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";

	return 0;
}

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

int main(){
  int n,sum=0,sqsum=0;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
    sum+=a[i];
    sqsum+=a[i]*a[i];
  }
  cout << (sum*sum-sqsum)/2 << endl;
}


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

using namespace std;

#define _int64 long long

char s[10000];

int main()
{
  int w,i,n;
  scanf("%s%d",s,&w);
  n=strlen(s);
  for (i=0;i<n;i+=w)
    printf("%c",s[i]);
  printf("\n");
  return 0;
}

Measured memory_bytes: 256
ct = 0
A = int(input()) ##500円
B = int(input()) ##100円
C = int(input()) ##50円
X = int(input())
for i in range(A,-1,-1):
    for j in range(B,-1,-1):
        for k in range(C,-1,-1):
            if (500*i) + (100*j) + (50*k) == X:
                ct += 1

print(ct)


Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define srt(x) sort((x).begin(), (x).end());
#define rsrt(x) sort((x).rbegin(), (x).rend());
#define deb(x) cout<<#x<<" = "<<(x)<<" (L"<<LINE<<")"<<endl;
#define vdeb(x) {cout<<#x<<" = { "; rep(i, x.size()) cout<<x[i]<<' '; cout <<'}'<<" (L"<<LINE<<")"<<endl;}
using namespace std;
using ll = long long;
using vi = vector<int>;
using vivi = vector<vi>;
using vll = vector<long long>;
using vllvll = vector<vll>;
using vs = vector<string>;
using um = unordered_map<long long, long long>;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;

int main()
{
       ll A, B, C, X, Y;
       cin >> A >> B >> C >> X >> Y;

       ll mn = INF;
       rep(i, 0, X+1) {
           ll asum = A*i;
           ll b = i + (Y-X);
           if (b<0) continue;
           ll bsum = B*b;
           
            ll c = 2*(X - i);
            ll csum = C*c;
            ll sm = asum + bsum + csum;
            if (sm < mn) {
                mn = sm;
            }
            // cout << i << ' ' << b << ' ' << c << endl; 
       }
            ll sm = C*2*max(X, Y);
            if (sm < mn) {
                mn = sm;
            }
\
       cout << mn << endl; 
}

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

int main() {
  long long N,A,B;
  cin>>N>>A>>B;
  long long z=0,count=0;//Z：a+bの繰り返し回数
  z=N/(A+B);
  count += z*A;
  if(N-(A+B)>0){
    if(N<z*(A+B)+A){
  	long long c=N-z*(A+B);
  	count += c ;
    }
    else {
      count+= A;
    }
  }
  else if(N<A){
    count=N;
  }
  else{
    count=A;
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

int main()
{
  	//FIO
  	string s;
  	cin >> s;
  	
  	deque<char> d;
  	for(int i=0;i<s.length();i++)
      	d.push_back(s[i]);
  
  	int q;
  	scanf("%d",&q);
  	int c = 1;
  	while(q--)
    {
      	int t;
      	scanf("%d",&t);
      	
      	if(t==1)	
          c^=1;
      	else
        {
          	int f;
          	char k;	
          	scanf("%d %c",&f,&k);
          	f--;
          	if(!c)
              f^=1;
          	
          	if(f)
              d.push_back(k);
          	else	
              d.push_front(k);
        }
   	}
  	string s1="";
  	for (auto it = d.begin(); it != d.end(); ++it) 
        s1 += *it;
  	if(!c)
    {
      	reverse(s1.begin(),s1.end());
      	cout << s1 << endl;
    }
  	else	
    	cout << s1 << endl;
  
  	return 0;
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
//#define print(ele) cout << (ele) << "\n"
#define print10(ele) cout << fixed << setprecision(10) << (ele) << "\n"

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail)
{
  cout << head;
  if (sizeof...(tail) != 0)
    cout << " ";
  print(forward<Tail>(tail)...);
}

ll powmod(ll x, ll y)
{
  ll res = 1;
  for (ll i = 0; i < y; i++)
  {
    res = res * x % mod;
  }
  return res;
}

int main()
{
  int n;
  cin >> n;
  ll ans = powmod(10, n) - powmod(9, n) - powmod(9, n) + powmod(8, n);
  ans %= mod;
  ans = (ans + mod) % mod;
  print(ans);
  return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define Rep(i,n) for(int i=1;i<=(n);++i)
using LL = long long;
using ULL = unsigned long long;

const int INF = 0x3f3f3f3f;
const double pi = acos(-1.0);

int main()
{
    LL a, b;
    double c;
    cin >> a >> c;
    b = (LL)(round(c*100));
    cout << a * b / 100 << endl;
    return 0;
}


Measured memory_bytes: 3780
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a[] = new int[3];
        int min = 101;
        for (int i = 0; i < 3; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < 3; i++) {
            int total = 0;
            for (int j = 0; j < 3; j++) {
                if (i != j) total += Math.abs(a[i] - a[j]);
            }
            if (total < min) min = total;
        }
        System.out.println(min);
    }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
 
 
struct UF{
    int N;
    vint par;
    void init(int n){
        N=n;
        par.resize(N);
        rep(i,N)par[i]=i;
    }
    int find(int x){
        return x==par[x]?x:par[x]=find(par[x]);
    }
    void unite(int x,int y){
        par[find(y)]=find(x);
    }
};
 
const int SIZE=100000;
int N,M;
int w[SIZE],sz[SIZE];
vint G[SIZE];
 
bool used[SIZE];
int ord[SIZE],low[SIZE];
vpint bridge;
 
void dfs(int v,int p,int &k){
    used[v]=true;
    ord[v]=k++;
    low[v]=ord[v];
 
    for(auto to:G[v]){
        if(!used[to]){
            dfs(to,v,k);
            low[v]=min(low[v],low[to]);
            if(ord[v]<low[to])bridge.pb(pint(min(v,to),max(v,to)));
        }
        else if(to!=p){
            low[v]=min(low[v],ord[to]);
        }
    }
}
    //return   no return
int dp[SIZE],dp2[SIZE];
void dfs2(int v,int p){
    for(auto to:G[v]){
        if(to==p)continue;
        dfs2(to,v);
        dp[v]+=dp[to];
    }
    int sum=dp[v];
    if(dp[v]||sz[v]>1)dp[v]+=w[v];
 
    for(auto to:G[v]){
        if(to==p)continue;
        chmax(dp2[v],sum-dp[to]+dp2[to]);
    }
    dp2[v]+=w[v];
}
 
signed main(){
    scanf("%lld%lld",&N,&M);
    rep(i,N)scanf("%lld",&w[i]);
    rep(i,M){
        int a,b;
        scanf("%lld%lld",&a,&b);
        a--;b--;
        G[a].pb(b);G[b].pb(a);
    }
    int K;
    dfs(0,-1,K);
 
    sort(all(bridge));
    UF uf;uf.init(N);
    rep(v,N)for(auto to:G[v])if(v<to){
        if(binary_search(all(bridge),pint(v,to)))continue;
        uf.unite(v,to);
    }
    vint ps;
    rep(i,N)if(uf.find(i)==i)ps.pb(i);
    rep(i,N)G[i].clear();
    for(auto &p:bridge){
        int u=lower_bound(all(ps),uf.find(p.fi))-ps.begin();
        int v=lower_bound(all(ps),uf.find(p.se))-ps.begin();
        G[u].pb(v);G[v].pb(u);
    }
    int ww[SIZE]={0};
    rep(i,N){
        int p=lower_bound(all(ps),uf.find(i))-ps.begin();
        ww[p]+=w[i];
        sz[p]++;
    }
    N=ps.size();
    rep(i,N)w[i]=ww[i];
 
    int s=lower_bound(all(ps),uf.find(0))-ps.begin();
    dfs2(s,-1);
    cout<<dp2[s]<<endl;
    return 0;
}

Measured memory_bytes: 29128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
#define int long long
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

signed main() {
    int n;
    cin >> n;
    int ans = 1000 - (n % 1000);
    if (ans == 1000) ans = 0;
    cout << ans << "\n";
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
int main()
{
    int n, q, c = 0;
    scanf("%d", &n);
    vector<int> s(n + 1);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &s[i]);
    }
    scanf("%d", &q);
    for (int i = 0; i < q; i++)
    {
        int j = 0;
        scanf("%d", &s[n]);
        for (; s[n] != s[j]; j++);
        if(j != n)
        {
            c++;
        }
    }
    printf("%d\n", c);
}


Measured memory_bytes: 3176
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REPR(i,n) for(int i=n-1; i>=(int)(0); i--)
#define FOR(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define FORR(i,a,b) for(int i=(int)(b)-1; i>=(int)(a); i--)
#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()
//**関数リスト**//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) {
	ll keta = 1;
	while (F / 10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
ll gcd(ll x, ll y) {
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll isPrime(ll x) {
	ll i;
	if (x < 2) {
		return 0;
	}
	else if (x == 2) {
		return 1;
	}
	else if (x % 2 == 0) {
		return 0;
	}
	else {
		for (i = 3; i * i <= x; i += 2) {
			if (x % 1 == 0) {
				return 0;
			}
		}
		return 1;
	}
}
void eratos(vl isPrime) {
	//(注)isPrimeのサイズはN+1にする！実際にはmain内に配置して使用
	ll i, j;
	REP(i, isPrime.size()) {
		isPrime[i] = 1;
	}
	isPrime[0] = 0; isPrime[1] = 0;
	for (i = 2; i * i <= isPrime.size() - 1; i++) {
		if (isPrime[i] == 1) {
			j = i * 2;
			while (j <= isPrime.size() - 1) {
				isPrime[j] = 0;
				j = j + i;
			}
		}
	}
}
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
void bitSearch(ll n) {
	//実際にはコピーして中身を改変して使う
	ll i;
	REP(i, pow(2, n)) {
		ll p = i;
		REP(i, n) {
			cout << p % 2;
			p /= 2;
		}
		cout << endl;
	}
}
void dfs(ll now) {
	//中身は毎回書き換えて使用
	stack <ll> S;
	//flagは初期値0
	S.push(now);
	//flag[now]=1;
	while (!S.empty()) {
		ll u = S.top();
		//ll v = ;
		//if(flag[v]==0){flag[v]=1;S.push[v];}else{S.pop();}
	}
}
void bfs(ll now) {
	//中身は毎回書き換えて使用
	queue<ll> Q;
	Q.push(now);
	ll u;
	while (!Q.empty()) {
		u = Q.front();
		Q.pop();
		//ll v=;
		//Q.push(v);
	}
}
//**定義場所**//
ll i, j, k, l, m, n;
ll N, M, K, H, W;
ll MOD = 1000000007;
ll ans = 0;
//***********//
int main() {
	ll A, B, C;
	cin >> A >> B >> C >> K;
	if (K % 2 == 1) {
		cout << B - A;
	}
	else {
		cout << A - B;
	}
}

Measured memory_bytes: 256
N = int(input())
sn = [int(input()) for _ in range(N)]
not10 = [s for s in sn if s % 10 != 0]
not10.sort()
score = sum(sn)
i = 0
try:
    while score % 10 == 0:
        score -= not10[i]
        i += 1
except IndexError:
    score = 0
print(score)


Measured memory_bytes: 3060