akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        IceRinkGame solver = new IceRinkGame();
        solver.solve(1, in, out);
        out.close();
    }

    static class IceRinkGame {
        int[] A;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int K = in.nextInt();
            A = new int[K + 1];
            for (int i = 1; i <= K; i++) {
                A[i] = in.nextInt();
            }

            if (A[K] != 2) {
                out.println(-1);
                return;
            }

            long[] L = new long[K + 1];
            long[] R = new long[K + 1];

            L[K] = R[K] = 2;

            for (int k = K; k > 0; k--) {
//            if (divs(L[k], R[k], A[k]) < 1) {
//                out.println(-1);
//                return;
//            }
                long X = ((L[k] + A[k] - 1) / A[k]) * A[k];
                long Y = (R[k] / A[k]) * A[k];
                if (X > Y) {
                    out.println(-1);
                    return;
                }
                L[k - 1] = X;
                R[k - 1] = Y + A[k] - 1;
            }

            out.println(L[0] + " " + R[0]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 39780
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int gcd(int a, int b)
{
if (a%b == 0){
        return(b);
   }
   else
   {
        return(gcd(b, a%b));
   }
}
int main(){
  ll a,b;cin>>a;
  b=gcd(a,360);
  cout<<a*360/b/a;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 1000000007 // prime modulo value 

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, k,  m, y, q ;
string s, t, d;
ld w;

// <------------- Implement Functions Here ----------> //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> s >> t;
	cin >> n >> m;
	cin >> d;

	cout<<n-(s==d)<<" "<<m-(d==t);newl;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 3620
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
words = []
chk = True
for i in range(n):
    w = input()
    if i == 0:
        next = w[-1]
        words.append(w)
    else:
        if w[0] != next:
            chk = False
            words.append(w)
        else:
            if w in words:
                chk = False
                words.append(w)
            else:
                next = w[-1]
                words.append(w)
if chk == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3440
#define REP(i, t, n)  for (int i = t; i < n; i++)
#define ALL(n)        (n).begin(),(n).end()
#include <limits.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <functional>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <numeric>

using namespace std;

typedef bool               BOOL;
typedef short              WORD;
typedef unsigned short     U_WORD;
typedef long               DWORD;
typedef unsigned long      U_DWORD;
typedef long long          QWORD;
typedef unsigned long long U_QWORD;

#define INF (100000)

U_QWORD A, B, C, D;

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

DWORD addOne(U_QWORD a, U_QWORD num)
{
	if ((a % num) == 0) return 1;

	return 0;
}

void solve_main()
{
	U_QWORD AdivC, AdivD, AdivCD, BdivC, BdivD, BdivCD;
	U_QWORD NumC, NumD, NumCD;
	U_QWORD minMul_CD;
	cin >> A >> B >> C >> D;

	minMul_CD = C * D / gcd(C, D);

	AdivC = A / C;
	AdivD = A / D;
	AdivCD = A / minMul_CD;

	BdivC = B / C;
	BdivD = B / D;
	BdivCD = B / minMul_CD;

	NumC = BdivC - AdivC + addOne(A, C);
	NumD = BdivD - AdivD + addOne(A, D);
	NumCD = BdivCD - AdivCD + addOne(A, minMul_CD);

	cout << ((B - A + 1) - (NumC + NumD - NumCD)) << endl;
}

int main()
{
#ifdef FOR_IDE
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
#endif

	solve_main();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>

using namespace std;

const int N = 100010;

int n;

int dist[N];
deque<int> dq;

inline void Update(int u, int v, int w){
    if(dist[v] > dist[u] + w){
        dist[v] = dist[u] + w;
        if(w) dq.push_back(v);
        else dq.push_front(v);
    }
    return;
}

void Dijkstra(){
    memset(dist, 0x3f, sizeof(dist));
    dist[1] = 1;
    dq.push_back(1);
    while(!dq.empty()){
        int u = dq.front();
        dq.pop_front();
        Update(u, (u+1) % n, 1);
        Update(u, u*10%n, 0);
    }
    return ;
}

int main(){
    scanf("%d", &n);
    Dijkstra();
    printf("%d\n", dist[0]);
    return 0;
}


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



int main() {
    int n;
    cin >> n;
    
    long int sum = 0;
    for(int i = 1; i <= n; i++) {
        long int x = n / i;
        sum += (x * (i + x*i)) / 2;
    }
    
    cout << sum << endl;
    
    return 0;
}


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

namespace A_1116_B
{
    class Program
    {
        class A_2019_1123_B
        {
            public void run()
            {
                //入力部
                long N = long.Parse(Console.ReadLine());
                string[] strLength = Console.ReadLine().Split(' ');
                //string str = Console.ReadLine();
                long[] length = new long[N];
                for(int i=0;i<N;i++)
                {
                    length[i] = long.Parse(strLength[i]);
                }


                //処理
                long barLength =  length.Sum();
                long cost = 0;

                int j = 0;
                long totalLength = 0;
                for (j=0;j<N;j++)
                {
                    if (totalLength + length[j] > (double)barLength / 2) break;
                    totalLength += length[j];

                }

                if (totalLength <= barLength - length[j] - totalLength)
                {
                    cost = totalLength + length[j] - (barLength - length[j] - totalLength);
                }
                else
                {
                    cost = (barLength - totalLength) - totalLength;
                }

                //出力
                Console.WriteLine(cost);




            }
        }



        static void Main(string[] args)
        {
            A_2019_1123_B mainClass = new A_2019_1123_B();
            mainClass.run();


            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 31312
console.log((args=>{
  const [[N],A] = args.trim().split('\n').map(r=>r.split(' ').map(v=>v|0));
  if ( N === 2 ) return `${Math.max(...A)}`;
  const D = [A[0],A[1]];
  for ( let i = 0; i < 2; i++ ) {
    let a = A[i];
    for ( let j = 2; j*j <= a; j++ ) {
      if ( a % j ) continue;
      D.push( j, a / j );
    }
  }
  D.sort((a,b)=>b-a);
  DIVISOR: for( const d of D ) {
    let n = 0;
    for ( let i = 0; i < N; i++ ) {
      if ( A[i] % d && ++n > 1 ) continue DIVISOR;
    }
    return `${d}`;
  }
  return '1';
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 40320
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<cmath>
#include<assert.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define INF 0x3f3f3f3f3f3f3f3f
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod=1000000007;
const double PI = acos(-1.0);
const double epsilon = PI / 180.0;//角度转弧度 
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N = 1e6+10, M = 1e6+10;
int n;
VI a, b;
int main() {
	cin>>n;
	for(int i = 0;i < n;i++) {
		int x;
		cin>>x;
		a.pb(x);
	}
	for(int i = 0;i < n;i++) {
		int x;
		cin>>x;
		b.pb(x);
	}
	reverse(all(b));
	int l = n - 1, r = 0, c = 0;
	for(int i = 0;i < n;i++) {
		if(a[i] == b[i]) {
			c = a[i];
			l = min(l, i);
			r = max(r, i);
		}
	}
	for(int i = 0;i < n;i++) {
		if(a[i] != c&&b[i] != c&&l <= r) {
			swap(b[i], b[l]);
			l++;
		}
	}
	if(l <= r) {
		cout<<"No\n";
		return 0;
	} else {
		cout<<"Yes\n";
		for(int i = 0;i < n;i++) cout<<b[i]<<" ";
	}
	return 0;
}

Measured memory_bytes: 5596
/*
Author: Dynamic JQ

Problem:

Time & Date(start):

Verdict:

Tags:
*/
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#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 MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

map<LL, int> mp;

int main()
{
	int n, x;
	LL cur = 0, ans = 0;
	scanf("%d", &n);
	mp[0] ++;
	rep(i, n) {
		scanf("%d", &x);
		cur += x;
		ans += mp[cur];
		mp[cur] ++;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 12800
n = gets.chomp.to_i
arr = gets.chomp.split(" ").map(&:to_i)

count = 0
(0...n).each do |i|
    if arr[i] != i + 1
        count += 1
    end
end

if count == 0 || count == 2
    puts "YES"
else
    puts "NO"
end

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

int main()
{
    int a, b;
    cin >> a >> b;
    int add = a + b;
    int sub = a - b;
    int mul = a * b;

    int max = add;
    if (max < sub)
    {
        max = sub;
    }

    if (max < mul)
    {
        max = mul;
    }

    cout << max << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    vector<int> v1(4), v2(2);
    for (int i = 0; i < 4; ++i) {
        cin >> v1[i];
    }
    for (int i = 0; i < 2; ++i) {
        cin >> v2[i];
    }
    sort(v1.begin(), v1.end(), greater<int>());
    sort(v2.begin(), v2.end(), greater<int>());
    cout<<v1[0] + v1[1] + v1[2] + v2[0]<<endl;
    return 0;
}


Measured memory_bytes: 3160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N, X;
        public int[] A;
        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                N = line[0];
                X = line[1];
            }
            A = Input.ReadIntArray();

            Array.Sort(A);

            long ret = 0;
            for (int i = 0; i < N; i++)
            {
                if (i == N - 1)
                {
                    if (X == A[i])
                        ret++;
                }
                else
                {
                    if (X >= A[i])
                    {
                        X -= A[i];
                        ret++;
                    }
                }
            }

            Console.WriteLine(ret);

        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define rep(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007


using namespace std;

int main(void){
    int n,t;
    double max_hi=0.0;
    cin>>n>>t;
    rep(i,n){
        int x,h;
        cin>>x>>h;
        max_hi=max(max_hi,(double)h/x);
    }
    printf("%lf \n",max_hi*t);

}




Measured memory_bytes: 3232
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  auto s=readln.chomp.to!(char[]);
  int w; rd(w);

  auto t="".to!(char[]);
  int i=0;
  while(i<s.length){
    t~=s[i];
    i+=w;
  }

  writeln(t);

}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    int n;
    cin >>n;
    map<int,int>mapp;

    rep(i,n){
        int ai;
        cin>>ai;
        mapp[ai]++;
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    //cout<<ans<<endl;
    if(mapp.size() == n)cout << "YES" <<endl;
    else cout << "NO" <<endl;
    
    return 0;
}


Measured memory_bytes: 9600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int h = s.nextInt(), w = s.nextInt();
		int n = s.nextInt();
		int z = Math.max(h, w);
		System.out.println((n - 1) / z + 1);

	}
}


Measured memory_bytes: 21204
import java.util.Scanner;

/*
 * AtCoder Beginner Contest 101 C
 */
public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		double N = scanner.nextDouble();
		double K = scanner.nextDouble();

		int count = (int) Math.ceil((N - 1) / (K - 1));
		System.out.println(count);

		scanner.close();
	}

}


Measured memory_bytes: 22996
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define gt() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++)
#define pt(ch) (Top<1000000?St[Top++]=ch:(Out(),St[(Top=0)++]=ch))
#define Out() (fwrite(St,1,Top,stdout))
#define __R register
using namespace std;
int Top;static char St[1000000],buf[1000000],*p1=buf,*p2=buf;
const int maxn=505,maxm=(1e5)+5;
int N,M,D,T,Ans,vis[maxn],X[maxm],Y[maxm],No[maxn][maxn];
int Re(){
	int ret=0;char ch=gt();
	while(ch<'0'||ch>'9') ch=gt();
	while(ch>='0'&&ch<='9') ret=ret*10+(ch^'0'),ch=gt();
	return ret;
}
void Wri(int x){if(x<0) x=-x,pt('-');if(x>9) Wri(x/10);pt(x%10+'0');}
bool check(int x,int y){
	if(No[x][y]) return 0;
	vis[x]=vis[y]=++T;
	for(__R int i=D;i;i--){
		if(vis[X[i]]==T&&vis[Y[i]]==T) return 0;
		if(vis[X[i]]==T) vis[Y[i]]=T;
		if(vis[Y[i]]==T) vis[X[i]]=T; 
	}
	return 1;
}
int main(){
	N=Re(),M=Re();
	for(__R int i=1;i<=M;i++){
		X[++D]=Re(),Y[D]=Re();
		if(X[D]>Y[D]) swap(X[D],Y[D]);
		if(++No[X[D]][Y[D]]>2) No[X[D]][Y[D]]--,D--;
	}
	for(__R int i=1;i<=N;i++)
	  for(__R int j=i+1;j<=N;j++) if(check(i,j)) Ans++;
	printf("%d\n",Ans);
    return 0;
}

Measured memory_bytes: 2432
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
using namespace std;
int main(){
	int a, b;
	cin >> a >> b;
	if(a * b % 2 == 0){
		cout << "Even" << endl;
	}
	else{
		cout << "Odd" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
#include<cmath>
using namespace std;

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

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)
#define show(x) cout<< #x << " = " << (x) << endl
#define show_array(arr) REP(i,int((arr).size()))cout<< #arr << "["<<i<<"]"<<"="<<arr[i]<<endl

int main(){
	
	ios::sync_with_stdio(false);

	ll N,M;
	cin>>N>>M;
	ll ans;	
	
	if(N==1){
		ans = M - 2;
	}
	else if(M==1){
		ans = N - 2;
	}
	else{
		ans = N * M - (2 * N  + 2 * M - 4);
	}
	
	if(N==1 && M==1)ans = 1;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstring>
#include<string>
#include<iomanip>
#include<map>
#include<fstream>
#include<queue>
#include<set>
#include<deque>

using namespace std;

int main()
{
	int x, y, z;
	cin >> x >> y >> z;
	cout << (x - z) / (y + z) << endl;
}

Measured memory_bytes: 256
import math
nums = [int(input()) for _ in range(5)]
mn = float('inf')

for i in nums:
    if i%10!=0:
        mn = min(mn, i%10)
if mn == float('inf'):
    mn = 10

print(sum(list(map(lambda x: int(math.ceil(x/10)*10), nums)))-10+mn)


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

int main(){
    int M, D;
    cin >> M >> D;
    int counter=0;

    for(int i=1;i<=M;i++){
        for(int j=22;j<=D;j++){
            int d1=j%10;
            int d10=j/10;
            if(i==d1*d10 && d1>=2){
                counter++;
            }
        }
    }
    cout<<counter;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

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

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

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

int n, m, q;
vector<int> a(60), b(60), c(60), d(60);
int ans;

void dfs(int num, int level, vector<int> &A){

    if(level == n){
        int sum = 0;
        for(int i=0; i<q; i++){
            if(A[b[i]] - A[a[i]] == c[i]) sum += d[i];
        }
        chmax(ans, sum);
        return ;
    }

    for(int i=num; i<=m; i++){
        A.emplace_back(i);
        dfs(i, level + 1, A);
        A.pop_back();
    }

    return ;
}

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

    cin>>n>>m>>q;
    for(int i=0; i<q; i++) cin>>a[i]>>b[i]>>c[i]>>d[i], a[i]--, b[i]--;

    vector<int> A;
    dfs(1, 0, A);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
const ll MOD =  1000000007;
const ll INF =  1LL << 60;
int n, m, x, y;ll z = 0, w, h, sum = 0, ans = 0;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}
struct Corr {
    ll x;
    ll y;
    ll z;
};
int main(void) {
    cin >> n >> m;
    ll dp[110][110]; vector<Corr> a(m);
    Fill(dp, INF);
    rep(i, m) {
        cin >> x >> y >> z;
        x--; y--;
        dp[x][y] = z;
        dp[y][x] = z;
        a[i] = { x,y,z };
    }
    rep(i, n) dp[i][i] = 0;
    rep(i, n) {
        rep(j, n) {
            rep(k, n) {
                dp[j][k] = min(dp[j][k], dp[j][i] + dp[i][k]);
            }
        }
    }
    rep(i, m) {
        bool f = 0;
        rep(j, n) {
            if (dp[j][a[i].x] + a[i].z == dp[j][a[i].y]) {
                f = 1; break;
            }
        }
        if (!f) ans++;
    }cout << ans << endl;
}

Measured memory_bytes: 384
SIZE=1001; MOD=10**9+7 #998244353 #ここを変更する

SIZE += 1
inv = [0]*SIZE  # inv[j] = j^{-1} mod MOD
fac = [0]*SIZE  # fac[j] = j! mod MOD
finv = [0]*SIZE # finv[j] = (j!)^{-1} mod MOD
inv[1] = 1
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
for i in range(2,SIZE):
    inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD

def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0

# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

n,k = [int(i) for i in readline().split()]
a = [int(i) for i in readline().split()]

def product(p,q):
    res = [0]*(n+1)
    for i in range(n+1):
        for j in range(n-i+1):
            res[i+j] += p[i]*q[j]
            res[i+j] %= MOD
    return res
    

ans = [1]+[0]*n

for ai in a:
    q = [0]*(n+1)
    for j in range(n+1):
        q[j] = choose(n-j,n-ai)*finv[j]%MOD
    ans = product(ans,q)

res = ans[n]
for i in range(1,n+1):
    res *= i
    res %= MOD

print(res)











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

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>         vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)            for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

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

  vector<vector<ll>> a(2, vector<ll>(2));
  loop(2) vloop(j, 2) cin >> a[i][j];
  ll ans = -INFLL;
  loop(4) {
    ans = max(ans, a[0][i & 1] * a[1][(i & 2) >> 1]);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n, a[212345];

    cin >> n;
    REP(i, n)
    cin >> a[i];

    int res = 0;
    int m = 1;
    REP(i, n)
    {
        if (a[i] == m)
            m++;
        else
            res++;
    }

    if (m == 1)
        cout << -1 << endl;
    else
        cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%lld",&x);
int main(){
    ll n, a, b;
    sc(n) sc(a) sc(b)
    ll X[n];
    for (int i = 0; i < n; i++) sc(X[i])
    ll x,ans = 0;
    for (int i = 0; i < n - 1; i++){
        x = (X[i + 1] - X[i]) * a;
        ans += min(x, b);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>

int main()
{
    int d;
    std::cin >> d;
    
    std::string str;

    if (d == 25)
    {
        str = "Christmas";
    }
    else if (d == 24)
    {
        str = "Christmas Eve";
    }
    else if (d == 23)
    {
        str = "Christmas Eve Eve";
    }
    else if (d == 22)
    {
        str = "Christmas Eve Eve Eve";
    }

    std::cout << str << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

main()
{
	int n;
	int i;
	long min,max,sum;
	sum = 0;
	
	scanf("%d",&n);
	
	int a[n];
	for(i=0;i<n;i++){
		scanf(" %d",&a[i]);
	}
	
	max = a[0];
	min = a[0];
	
	for(i=0;i<n;i++){
		sum += a[i];
		if(max<a[i]){
			max = a[i];
		}
		if(min > a[i]){
			min = a[i];
		}
	}
	
	printf("%ld %ld %ld\n",min,max,sum);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 int mod = 1e9+7;
 
int main() {
int n;  cin>>n;
 vector< vector< int > >  comp(n+1, vector<int> (n+1));
 for(int i=0; i<n; ++i){
 	for(int j=0; j<n; ++j){
 		cin>>comp[i][j];
 	}
 }
 
 vector<int> dp(1<<n);
 dp[0]=1;
 for(int i=0; i<(1<<n) ; ++i ){
 	int m = __builtin_popcount(i);
 	for(int w=0; w<n; ++w){
 		if( !((i>>w)&1) && comp[m][w]==1 )
 	{	int j = (i|(1<<w));
 		dp[j]+=dp[i]%mod;
 		dp[j]%=mod;
 	}
 	
 	}
 	
 }
 cout<<( dp[(1<<n)-1] + mod)%mod<<'\n';
 
	return 0;
}


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

int main()
{
    int n ,k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr + n);
    long long int ans =0;
    for(int i=0;i<k;i++)
    {
        ans = ans + arr[i];
    }
    cout<<ans;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

const int nmax = 8;
bool graph[nmax][nmax]; //接続状況を格納する隣接行列

//dfsでパスを全探索
//vが今いるパス、Nが頂点の数
int dfs(int v, int &N, bool visited[nmax]) { //1を返すのでint
  bool all_visited = true; 
  FOR(i,0,N) {
    if (visited[i] == false) all_visited = false; //一つでも訪れていない頂点があればfalseに
  }
  if (all_visited) {
    return 1; //全頂点を訪れていたら、題意を満たすので1を返す
  }
  //ここまでが一つの流れを表してる？
  
  int ret = 0;
  
  //すべての遷移先について調べる(再帰、dfs)
  FOR(i,0,N) {
    //頂点iが接続されていない、あるいは既に探索済みであればi+1に進む
    if (graph[v][i] == false) continue;
    if (visited[i]) continue;
    //iに遷移する
    visited[i] = true;
    //iからの遷移を試す
    ret += dfs(i,N,visited);
    //iのフラグを取り消す
    visited[i] = false;
  }
  return ret;
}

int main() {
  int N, M;
  cin >> N >> M;
  FOR(i,0,M) {
    int a,b;
    cin >> a >> b;
    //接続状況のグラフ
    graph[a-1][b-1] = graph[b-1][a-1] = true;
  }
  bool visited[nmax];
  
  //visitedをfalseで初期化
  FOR(i,0,N) visited[i] = false;
  visited[0] = true;
  
  //頂点0から始まるパスの数を出力
  cout << dfs(0,N,visited) << endl;
  return 0;
}

Measured memory_bytes: 3620
S = gets.chomp.split("")

flag = true

(0...S.size).each{ |i|
	if i % 2 == 0 then
	# 奇数
		if S[i] == 'L' then
			flag = false
		end
	else
	# 偶数
		if S[i] == 'R' then
			flag = false
		end
	end
}

if flag then
	puts 'Yes'
else
	puts 'No'
end

Measured memory_bytes: 1788
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    ABC045CManyFormulas solver = new ABC045CManyFormulas();
    solver.solve(1, in, out);
    out.close();
  }

  static class ABC045CManyFormulas {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      String s = in.next();
      long res = 0;
      for (int i = 0; i < s.length(); i++) {
        for (int j = i + 1; j <= s.length(); j++) {
          // out.println(s.substring(i, j));
          String tmps = s.substring(i, j);
          long tmp = Long.parseLong(tmps);
          int pow = s.length() - 1 - (tmps.length() + 1);
          if (i == 0) {
            pow++;
          }
          if (j == s.length()) {
            pow++;
          }
          res += tmp * (long) Math.pow(2, pow);
          // out.println(res);
        }
      }

      out.println(res);
    }

  }
}



Measured memory_bytes: 21844
#
# 7c
#

def main():
    r, c = map(int, input().split())
    T = []
    S = [0 for _ in range(c+1)]
    for i in range(r):
        C = list(map(int, input().split()))
        C.append(sum(C))
        T.append(C)
    for i in range(r):
        for j in range(c+1):
            S[j] += T[i][j]
    T.append(S)
    for i in range(r+1):
        print(*T[i])


if __name__ == '__main__':
    main()


Measured memory_bytes: 6240
N = int(input())
A = list(map(int, input().split()))
D = {a:0 for a in set(A)}
for a in A:
  D[a] += 1
S = 0
for v in D.values():
  if v>=2:
    S += v*(v-1)//2
for a in A:
  d = D[a]
  if d==1:
    print(S)
  else:
    print(S-d*(d-1)//2+(d-1)*(d-2)//2)

Measured memory_bytes: 33260
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

int dp[100004][101];

int func(P arr[] , int curr , int total , int n){

    if(total < 0) return -1;

    if(total == 0) return 0;

    if(curr == n)  return 0;

    if(dp[total][curr] != -1) return dp[total][curr];


    int ans = 0;

    if(total - arr[curr].F >=0)
        ans = max(ans , arr[curr].S + func(arr , curr+1 , total - arr[curr].F , n));


    ans = max(ans ,  func(arr , curr+1 , total , n));

    dp[total][curr] = ans;

    return ans;
}


void solve(){

    int n,k,b,c, ans=0, count=0, sum=0;
    cin>>n>>k;
    P arr[n];
    for(int i=0;i<n;i++){
      cin>>arr[i].F;
      cin>>arr[i].S;
    }

    // for(int i=0;i<n;i++){
    // }




    fill(dp , -1);

    ans = func(arr , 0 , k , n);

    cout<<ans<<endl; 
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 79232
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	private static int[] root;

	public static void main(String[] args) {
		try {
			BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
			String[] input1 = bf.readLine().split(" ");
			int n = Integer.parseInt(input1[0]);
			int m = Integer.parseInt(input1[1]);

			// 計算式で結ばれているものは、Ax、Ayいずれか一つが分かればもう片方も分かる
			// 与えられた計算式からその親子関係をまとめる
			root = new int[n + 1];
			for (int i = 1; i <= m; i++) {
				String[] input2 = bf.readLine().split(" ");
				int ax = Integer.parseInt(input2[0]);
				int ay = Integer.parseInt(input2[1]);
				int axP = findMyRoot(ax);
				int ayP = findMyRoot(ay);

				if (root[ay] == 0) {

					// (? <- ... <-) Ax <- Ay
					if (axP != ay) {
						root[ay] = ax;
					}
				} else if (root[ax] == 0) {

					// (? <- ... <-) Ay <- Ax
					if (ayP != ax) {
						root[ax] = ay;
					}
				} else {

					// (? <- ... <-) Ax <- (? <- ... <-) Ay
					if (axP != ayP) {
						root[ayP] = ax;
					}
				}
			}

			// めくる必要がある回数を数える
			int cnt = 0;
			for (int i = 1; i <= n; i++) {
				if (root[i] == 0) {
					cnt++;
				}
			}
			System.out.println(cnt);
		} catch (IOException e1) {
		}
	}

	private static int findMyRoot(int child) {

		if (root[child] == 0) {
			return child;
		} else {
			return findMyRoot(root[child]);
		}
	}

}


Measured memory_bytes: 50484
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LEN 100005
 
typedef struct pp{
	char name[100];
	int t;
} P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
	Q[tail]=x;
	tail=(tail+1)%LEN;
}

P dequeue(){
	P x=Q[head];
	head=(head+1)%LEN;
	return x;
}

int min(int a,int b){
	return a<b?a:b;
}

int main(){
	int elaps=0,c;
	int i,q;
	P u;
	scanf("%d %d",&n,&q);
	
	for(int i=1;i<=n;i++){
		scanf("%s",Q[i].name);
		scanf("%d",&Q[i].t);
	} 
	
	head=1;tail=n+1;
	
	while(head!=tail){
		u=dequeue();
		c=min(q,u.t);
		u.t-=c;
		elaps +=c;
		if(u.t>0){
			enqueue(u); 
		}else{
			printf("%s %d\n",u.name,elaps);
		}
	}
	
	
	return 0;
}

Measured memory_bytes: 12892
#include <stdio.h>
#define N 100000

int main(void){
  int a, b, p[N], q[N],i=0, j=0;
  int k, l;

  while(scanf("%d %d", &a, &b), a!=0 && b !=0){
    p[i] = a;
    q[i] = b;
    i++;
  }

  while(j<i){
    for(k=1; k<=p[j]; k++){
      for(l=1; l<=q[j]; l++){
        printf("#");
      }
      printf("\n");
    }
    printf("\n");
    j++;
  }

  return 0;
}



Measured memory_bytes: 2052
#include <tuple>
#include <vector>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
using ll	= long long;
using ull	= unsigned long long;
using ld	= long double;
using pii	= pair<int,int>;
using pll	= pair<ll,ll>;
using vi	= vector<int>;
using vb	= vector<bool>;
using vc	= vector<char>;
using vvi	= vector<vi>;
using vvb	= vector<vb>;
using vpii	= vector<pii>;
using vpll	= vector<pll>;
using vll	= vector<ll>;
using vull	= vector<ull>;
#define ever (;;)
#define f first
#define s second
#define pb emplace_back
#define sz size()
#define graph vector<vertex>
#define deg(X) (int)G[X].e.size()
#define INF 1234567890
#define INFll 2000000000000000000
#define maxe(X, Y) if((Y) > (X)) (X) = (Y)
#define mine(X, Y) if((Y) < (X)) (X) = (Y)
#define rep(i, begin, end) for(__typeof(end) i = (begin); i < (end); ++i)
#define repr(i, begin, end) for(__typeof(end) i = (begin)-1; i >= (end); --i)
#define bend(X) X.begin(), X.end()
pii operator+(const pii& A, const pii& B) { return {A.f+B.f, A.s+B.s}; }
pii operator-(const pii& A, const pii& B) { return {A.f-B.f, A.s-B.s}; }
pii operator-(const pii& A) { return {-A.f, -A.s}; }

//
// END OF DEFINES
//

int n, w;
vpll T;
vll DP;

bool in() {
	scanf("%d %d", &n, &w);
	T.resize(n);
	DP.resize(w+1, -1);
	DP[0] = 0;
	rep(i, 0, n)
		scanf("%lld %lld", &T[i].f, &T[i].s);
	
	return true;
}

ll solve() {
	for(pll x : T) {
		repr(i, w+1, 0) {
			if(DP[i] >= 0 && i+x.f <= w)
				maxe(DP[i+x.f], DP[i]+x.s);
		}
	}
	
	ll R = 0;
	rep(i, 0, w+1)
		maxe(R, DP[i]);
	return R;
	
	return -INF;
}

int main() {
	int noOfTests = 1;
	//scanf("%d", &noOfTests);
	
	while(noOfTests --> 0) {
		if(!in()) {
			printf("popsute wejscie\n");
			continue;
		}
		ll result = solve();
		if(result == ll(-'t'))
			printf("TAK\n");
		else if(result == ll(-'n'))
			printf("NIE\n");
		else if(result != -INF)
			printf("%lld\n", result);
	}
	
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600
#define long long long // for codeforces

int main(){
  int a,b;
  cin>>a>>b;
  if(a+b<10) cout << a+b << endl;
  else cout << "error" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define lld long double
#define w(x) ll x;cin>>x;while(x--)
#define mod 1000000007
#define speed ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;

int main(){
    speed;
    ll n,k; cin>>n>>k;
    ll p[n];    for(auto &i:p)   cin>>i;
    sort(p,p+n);  ll sum=0;
    for(ll i=0;i<k;i++){
        sum+=p[i];
    }
    cout<<sum<<'\n';
    return 0;
}

Measured memory_bytes: 3628
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=5e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,a[200005]={},cnt=0,now=1,f=0;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    if(a[i]==1) {
      f=1;
    }
  }
  if(!f) {
    cout << -1 << endl;
    return 0;
  }
  for(int i=0; i<n; i++) {
    if(a[i]==now) {
      cnt++;
      now++;
    }
  }
  cout << n-cnt << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int L[50];

int main(){
  int n,k;
  cin >> n >> k;
  for(int i=0;i<n;++i){
    cin >> L[i];
  }
  sort(L,L+n);
  int len = 0;
  for(int i=n-1;i>n-1-k;--i){
    len += L[i];
  }
  cout << len << endl;
  return 0;
}

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

using namespace std;

	int n,a[105],ans;
	bool ou;

int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+1+n);ou=1;
	for(int i=n;i>=1;i--)
	{
		if(ou)
		{
			ans+=a[i];
			ou=0;
		}
		else
		{
			ans-=a[i];
			ou=1;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
let split_string ?(pattern=" ") = Str.split @@ Str.regexp pattern
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let ls = read_line () |> split_string |> List.map int_of_string |> List.sort compare |> List.rev |> Array.of_list

let rec loop ai bi l r =
  if r <= l then max 0 @@ l - bi - 1
  else
    let mid = (l + r) / 2 in
    let a, b, c = ls.(ai), ls.(bi), ls.(mid) in
    if a < b + c && b < c + a && c < a + b then loop ai bi (mid + 1) r
    else loop ai bi l mid

let () =
  let ans = ref 0 in
  for i = 0 to n - 3 do
    for j = i + 1 to n - 2 do
      ans := !ans + loop i j (j + 1) n
    done
  done;
  Printf.printf "%d\n" !ans

Measured memory_bytes: 2688
# 21:01
n,a,b = map(int,input().split())
if abs(b-a) % 2 == 0:
    print((b-a)//2)
else:
    ans = min(max(a-1,b-1),max(n-a,n-b))
    if (a-1) >= (n-b):
        t = (n-((n+1-b)+a))//2 + (n-b+1)
    else:
        t = (b-((a-1)+1)-1)//2 + (a-1+1)
    print(min(ans,t))

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

string tostring(int a){
    stringstream ss;ss<<a;return ss.str();
}


int toint(string s){
    stringstream ss(s);int d;ss>>d;return d;
}

int q(int a,int b){
    string A=tostring(a);
    string B=tostring(b);
    if(a<=b&&A<=B)return true;
    if(a>b&&A>B)return true;
    return false;
}


int q(int a){
    cout<<"? "<<a<<endl;
    char c;cin>>c;
    return c=='Y';
}

int L[20],R[20];

signed main(){


    L[0]=1;
    R[0]=9;
    for(int i=1;i<12;i++){
        L[i]=L[i-1]*10;
        R[i]=R[i-1]*10+9;
    }

    vint X(12),Y(12);
    rep(i,12){
        X[i]=q(L[i]);
        Y[i]=q(R[i]);
    }

    int mi=LLONG_MAX;
    int ma=LLONG_MIN;
    rep(i,12){
        if(X[i]&&Y[i]){
            chmin(mi,i);
            chmax(ma,i);
        }
    }

    int len;
    if(mi==0&&ma==11)len=0;
    else if(mi==0)len=ma;
    else len=mi;

    len++;
    string beet(15,'9');
    string ans(len,'0');

    for(int i=0;i<len;i++){
        int lb=-1,ub=9;
        while(ub-lb>1){
            int mid=(ub+lb)/2;
            beet[i]=mid+'0';
            if(q(toint(beet)))ub=mid;
            else lb=mid;
        }
        if(i==0)chmax(ub,1);
        ans[i]=ub+'0';
        beet[i]=ub+'0';
    }

    cout<<"! "<<ans<<endl;
}


Measured memory_bytes: 692
function Main(inputData) {
	init(inputData);
	
	var n = inI(),a = {};
	for(i=0;i<n;i++){
		var s = inS();
		a[s] = (s in a)? a[s]+1: 1;
	}

	var m = inI();
	for(i=0;i<m;i++){
		var s = inS();
		a[s] = (s in a)? a[s]-1: -1;
	}

	out(Math.max(0,Math.max.apply(null,arrayGetValues(a))));
}

function arrayGetValues(array) {
    var values = [];
 
    if (array) {
        for (var key in array) {
            values.push(array[key]);
        }
    }
 
    return values;
};

////////////////////////////////////////////////////////////////////////////////////
var input,inputCnt;

// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
	Main(document.getElementById("input").value);
}

function init(inputData){
    //配列inputに順番に代入
	input = inputData.replace( /\n/g , " " );
	input = input.split(" ");
	inputCnt = 0;
}
//output
const out = (output) => { console.log(output) }
const outln = (output) => { console.log(output+"\n") }

//input
const inS = () => {return input[inputCnt++]};
const inI = () => {return parseInt(inS(), 10)};
const inF = () => {return parseFloat(inS())};

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 9420
#include <iostream>
#include<string>

using namespace std;

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

	int count = 0;
	int max = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G') {
			count++;
			if (count > max) {
				max = count;
			}
		}
		else {
			count = 0;
		}
	}
	cout << max << endl;
}

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

int main(){
  int n,m;
  cin>>n>>m;
  int vec_a[n][m];
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin>>vec_a[i][j];
    }
  }
  int vec_b[m][1];
  for(int i=0;i<m;i++){
    cin>>vec_b[i][0];
  }
  int vec_c[n][1];
  for(int i=0;i<n;i++){
    int tmp=0;
    for(int j=0;j<m;j++){
      tmp+=vec_a[i][j]*vec_b[j][0];
    }
    vec_c[i][0]=tmp;
  }
  for(int i=0;i<n;i++){
    cout<<vec_c[i][0]<<endl;
  }
}

Measured memory_bytes: 3116