akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
typedef vector<vector<int>> Graph;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
vector<LL> make_divisors(LL n){vector<LL> divisors;for(int i = 1; i <= sqrt(n); i++) {if(n%i == 0){divisors.push_back(i);if(i != n/i){divisors.push_back(n / i);}}}return divisors;}
const LL MOD = 1e9 + 7;
const int INF = 1 << 30;
const LL LLINF = 1LL << 60;
using namespace std;

int main(void){
    double a, b, x;
    cin >> a >> b >> x;

    double input;

    //体積の半分より水の体積が小さい場合
    if(a*a*b/2 > x){
        input = a * b * b / (2 * x);
    }else{
        input = 2 * b / a - 2 * x / (a * a * a);
    }

    printf("%.9f\n", atan(input) * 180 / PI);
    return 0;
}


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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

void solve(){
   int n,a,b;
   cin >> n >> a >> b;
   int ans = min(n * a , b);
   cout << ans << "\n";
}

int32_t main(){
   fast;
   int t = 1;
   // cin >> t;
   while(t--)  solve();   
}

// 100 200 300 400  400 500 
// A    B    C  D    D   E

Measured memory_bytes: 3596
ans = input()
q = int(input())
top = 0
first = str()
last = str()

for i in range(q):
    li =input().split()
    if li[0] =="1":
        top = (top+1)%2
    else:
        if li[1] == "1":
            if top ==0:
                first += li[2]
            else:
                last += li[2]
        else:
            if top ==1:
                first += li[2]
            else:
                last += li[2]

if top == 0:
    ans = first[::-1] + ans + last
else:
    ans = last[::-1] + ans[::-1] + first

print(ans)


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

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

  int ans = 0;

  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    ans += min(x, K - x) * 2;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
n, m = map(int, input().split())
x, y, z = [0] * n, [0] * n, [0] * n
for i in range(n):
    x[i], y[i], z[i] = map(int, input().split())
ans = -(10 ** 9)
for i in range(8):
    # a,b,c それぞれ正負どちらに合わせるかを決める
    sort = []
    bit = [-1, -1, -1]
    if i % 2:
        bit[0] = 1
    if (i // 2) % 2:
        bit[1] = 1
    if (i // 4) % 2:
        bit[2] = 1
    for i in range(n):
        sort.append(x[i] * bit[0] + y[i] * bit[1] + z[i] * bit[2])
    sort.sort()
    ans = max(ans, sum(sort[n - m :]))
print(ans)


Measured memory_bytes: 3188
s=input()

l=len(s)

count=0
for i in range(2**(l-1)):
    memory=0
    for j in range(l-1):
        if ((i>>j)&1):
            #print(int(s[memory:j+1]))
            count+=int(s[memory:j+1])
            memory=j+1
    #print(int(s[memory:]))
    count+=int(s[memory:])

print(count)

Measured memory_bytes: 3060
using LIB;
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        Dictionary<string, bool[]> card = new Dictionary<string, bool[]>();

        card["S"] = new bool[13];
        card["H"] = new bool[13];
        card["C"] = new bool[13];
        card["D"] = new bool[13];
        for (int i = 0; i < 13; i++)
        {
            card["S"][i] = false;
            card["H"][i] = false;
            card["C"][i] = false;
            card["D"][i] = false;
        }
        int n = io.r<int>();
        string[] l = io.r<string>(n);
        for (int i = 0; i < n; i++)
        {
            string[] buf = l[i].Split(' ');
            card[buf[0]][int.Parse(buf[1]) - 1] = true;
        }
        foreach (string buf in card.Keys)
        {
            for (int i = 0; i < 13; i++)
            {
                if (card[buf][i] == false)
                {
                    io.w(buf + " " + (i + 1));
                }
            }
        }
        io.wflush();
    }
}

namespace LIB
{
    public class io
    {
        private const int WMAX = 1000;
        private static StringBuilder S = new StringBuilder();
        public static T r<T>() { return util.parse<T>(r()); }
        public static T[] r<T>(char s = ' ') { return r().Split(s).Select(util.parse<T>).ToArray(); }
        public static T[] r<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r<T>(); } return r; }
        public static T[][] r<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r<T>(s); } return r; }
        private static string r() { return Console.ReadLine(); }
        public static void w(object v, bool lf = true) { S.Append(util.parse<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } }
        public static void wflush() { Console.Write(S.ToString()); S.Length = 0; }
    }
    public class util
    {
        public static T parse<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); }
    }
    public class memo<Key, Result>
    {
        private Dictionary<Key, Result> R;
        public memo() { R = new Dictionary<Key, Result>(); }
        public Result exec(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; }
    }
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int n,m,q;cin>>n>>m>>q;

    VI a(q),b(q),c(q),d(q);

    REP(i,q){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--;
        b[i]--;
    }

    LL result = 0;

    VI f(10);
    f[0] = 1;
    for(f[1] = f[0]; f[1] <= m; f[1]++){

        for(f[2] = f[1]; f[2] <= m; f[2]++){

            for(f[3] = f[2]; f[3] <= m; f[3]++){

                for(f[4] = f[3]; f[4] <= m; f[4]++){

                    for(f[5] = f[4]; f[5] <= m; f[5]++){

                        for(f[5] = f[4]; f[5] <= m; f[5]++){

                            for(f[6] = f[5]; f[6] <= m; f[6]++){

                                for(f[7] = f[6]; f[7] <= m; f[7]++){

                                    for(f[8] = f[7]; f[8] <= m; f[8]++){

                                        for(f[9] = f[8]; f[9] <= m; f[9]++){
                                            LL point = 0;
                                            REP(i,q){
                                                if(f[b[i]] - f[a[i]] == c[i]){
                                                    point += d[i];
                                                }
                                            }

                                            result = max(result,point);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    cout<<result<<endl;
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int a[4][4];
int main()
{

    int i,j,cnt=0;

    for(i=0; i<3; i++)
    {
        for(j=0; j<3; j++)
        {
            scanf("%d",&a[i][j]);
        }
    }

    //let's hard code

    if((a[0][0]-a[0][1])!=(a[1][0]-a[1][1])) cnt++;
    if((a[1][0]-a[1][1])!=(a[2][0]-a[2][1])) cnt++;

    if((a[0][1]-a[0][2])!=(a[1][1]-a[1][2])) cnt++;
    if((a[1][1]-a[1][2])!=(a[2][1]-a[2][2])) cnt++;

    if((a[0][0]-a[1][0])!=(a[0][1]-a[1][1])) cnt++;
    if((a[0][1]-a[1][1])!=(a[0][2]-a[1][2])) cnt++;

    if((a[1][0]-a[2][0])!=(a[1][1]-a[2][1])) cnt++;
    if((a[1][1]-a[2][1])!=(a[1][2]-a[2][2])) cnt++;

    //printf("%d\n",cnt);

    if(cnt==0) printf("Yes");
    else printf("No");

    return 0;
}



Measured memory_bytes: 256
object Main {
  def main(args:Array[String]){
    try{
      while(true){
        var numAry=io.StdIn.readLine.split(" ").map(_.toInt).sorted
        if(numAry(1)==0) throw new Exception
        println(numAry.mkString(" "))
      }
    }
    catch{
      case _:Exception=>()
    }
  }
}



Measured memory_bytes: 47272
#include <stdio.h>
#include <queue>
#define large 1005
// #define large 50

using namespace std;

int h,w;
char a[large][large];
int vecx[]={1,-1,0,0};
int vecy[]={0,0,1,-1};
int visited[large][large]={};

queue<int> que;

void bfs(int x,int y)
{
    // if(visited[x][y]>0) return;
    for(int i=0;i<4;i++)
    {
        if(x+vecx[i]<0||x+vecx[i]>=h||y+vecy[i]<0||y+vecy[i]>=w) continue;
        else
        {
            if(a[x+vecx[i]][y+vecy[i]]=='.'&&visited[x+vecx[i]][y+vecy[i]]==0)
            // if(a[x+vecx[i]][y+vecy[i]]=='.')
            {
                visited[x+vecx[i]][y+vecy[i]]=visited[x][y]+1;
                a[x+vecx[i]][y+vecy[i]]='#';
                que.push(x+vecx[i]);
                que.push(y+vecy[i]);
            }
        }
    }
    return;
}

int main()
{
    scanf("%d %d",&h,&w);
    for(int i=0;i<h;i++)
        scanf("%s",a[i]);
    
    for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
    if(a[i][j]=='#')
    {
        que.push(i);
        que.push(j);
    }

    while(!que.empty())
    {
        // for(int j=0;j<h;j++)
        //     printf("%s\n",a[j]);
        // printf("\n");

        int tmpx=que.front();
        que.pop();
        int tmpy=que.front();
        que.pop();
        // printf("bfs(%d,%d)\n",tmpx,tmpy);
        bfs(tmpx,tmpy);
    }
    int ans=0;
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
        {
            if(visited[i][j]>ans) ans=visited[i][j];
        }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 11280
from itertools import product

N = int(input())
S = input()


def r(x):
    if x == 'S':
        return 'W'
    else:
        return 'S'


def f(x1, x2, s):
    if s == 'o':
        if x1 == 'S':
            return x2
        else:
            return r(x2)
    else:
        if x1 == 'S':
            return r(x2)
        else:
            return x2


ans = ['-1']
for x1, x2 in product('SW', repeat=2):
    res = [x1, x2]
    for i in range(N):
        x1, x2 = x2, f(x1, x2, S[i])
        res.append(x2)
    if res[:2] == res[-2:]:
        ans = res[1:-1]
        break
print(''.join(ans))


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

namespace ProconTemplate
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_c
    class abc169_a
    {
        public static void Main(string[] args)
        {
            //string s = Console.ReadLine();
            string[] asInput = Console.ReadLine().Split(' ');
            int A = int.Parse(asInput[0]);
            int B = int.Parse(asInput[1]);
            Console.WriteLine(A * B);
            return;
            ////int Q = int.Parse(asInput[2]);

            //int[] p = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();


            //for (int i = 0; i < N; i++)
            //{
            //    Console.WriteLine( Q - aiAns[i] >= K ? "No" : "Yes" );
            //}

        }
    }
}


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

int main(){
  int s, a, b, c, d;
  
  cin >> s;
  
  d = s % 10;
  s /= 10;
  c = s % 10;
  s /= 10;
  b = s % 10;
  s /= 10;
  a = s;
  
  if(a == b || b == c || c == d)
    cout << "Bad\n";
  else
    cout << "Good\n";
  
 return 0; 
}

Measured memory_bytes: 256
S = list(input())
K = int(input())
a = ord("a")
for i,s in enumerate(S):
    t = (a-ord(s))%26
    if K>=t:
        K-=t
        S[i] = "a"
if K>0:
    S[-1] = chr(a + (ord(S[-1])-a+K)%26)
print("".join(S))

Measured memory_bytes: 4148
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
int const INF = 1001001001;


int ans;
vi a,b,c,d;
int N,M,Q;
void dfs (vector<int> A,int v) {
    A.push_back(v);
    if(SZ(A) == N) {
        int cnt = 0;
        rep(i,Q) {
            if(A[b[i]] - A[a[i]] == c[i]) cnt += d[i];
        }
        chmax(ans, cnt);
    }
    else {
        for(int i = v; i <= M; ++i) {
            dfs(A, i);
        }
    }
}


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

cin >> N >> M >> Q;

rep(i,Q) {
    int aa,bb,cc,dd;
    cin >> aa >> bb >> cc >> dd;
    --aa; --bb;
    a.push_back(aa);
    b.push_back(bb);
    c.push_back(cc);
    d.push_back(dd);
}

ans = 0;
rrep(i,M) dfs({}, i);
cout << ans << endl;
return 0;
}

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

int main() {
  ll a,b,n;
  cin >> a >> b >> n;
  ll x;
  if (b<=n) {
    x = b-1;
  } else {
    x = n;
  }
  ll ans = (a*x)/b - a*(x/b);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,N) for(int i=0; i<N; i++){ ;
int main() {
    char c;
    cin>>c;
    if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
        cout<<"vowel"<<endl;
    }
    else
    cout<<"consonant"<<endl;
}


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

template <typename Abel> struct BIT {
    const Abel UNITY_SUM = 0;
    vector<Abel> dat;
    BIT(int n) : dat(n + 1, UNITY_SUM) { }  // [1, n]
    inline void add(int i, Abel x) {
        while (i < dat.size()) { dat[i] += x; i += i & -i; }
    }
    inline Abel sum(int i) {    // [1, i]
        Abel res = UNITY_SUM;
        while (i > 0) { res += dat[i]; i -= i & -i; }
        return res;
    }
    inline Abel sum(int a, int b) { return sum(b - 1) - sum(a - 1); }   // [a, b)
    /* debug */
    Abel operator[](int i) { return sum(i, i + 1); }
    void debug() {
        for (int i = 1; i < dat.size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

template<typename T> long long inversion_number(const vector<T> &a) {
    int n = a.size();
    vector<T> b = a;
    sort(begin(b), end(b)); b.erase(unique(begin(b), end(b)), end(b));
    long long res = 0;
    BIT<int> bit(n);
    for (T ai: a) {
        int order = lower_bound(begin(b), end(b), ai) - begin(b) + 1;
        res += bit.sum(order + 1, n + 1); bit.add(order, 1);
    }
    return res;
}

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int &ai: a) cin >> ai;
    cout << inversion_number(a) << endl;
    return 0;
}


Measured memory_bytes: 5232
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define endl "\n"
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define all(x) x.begin(), x.end()
#define arr(x) x, x + n
#define trav(a, x) for (auto &a : x)
#define rall(x) x.rbegin(), x.rend()
#define ll long long int
#define pb push_back
#define vi vector<int>
#define pii pair<int, int>

using namespace std;

const int mod = 1e9 + 7;
const int N = 1e6 + 5;

void solve() {
    int n; cin >> n;
    int a[n];
    rep(i, 0, n) cin >> a[i];
    ll ans = 0, x = 0;
    rep(i, 0, n) {
        ans = (ans + a[i] * x) % mod;
        x = (x + a[i]) % mod;
    }
    cout << ans << endl;
    return;
}

int main() {

    FIO
    solve();
    return 0;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int K = l[0], X = l[1];
            Console.WriteLine(500*K>=X?"Yes":"No");
        }
    }
}


Measured memory_bytes: 13268
import math
n=int(input())
p=list(map(int, input().split()))
q=list(map(int, input().split()))
a=1
b=1

for i in range(n-1):
  c=0
  d=0
  for j in range(i+1,n):
    if p[i]>p[j]:
      c+=1
    if q[i]>q[j]:
      d+=1
  a+=c*math.factorial(n-i-1)
  b+=d*math.factorial(n-i-1)
print(abs(a-b))

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 文字列の入力
		int n = sc.nextInt();
		int[] a = new int[n];

		for ( int i=0; i<n; i++ ) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);

		for ( int i=1; i<n; i++ ) {
			if ( a[i] == a[i-1] ) {
				System.out.println("NO");
				System.exit(0);
			}
		}

		System.out.println("YES");
	}
}

Measured memory_bytes: 66916
#include <bits/stdc++.h>
#define INF (int)1e9
#define endl "\n"
#define ll long long
#define ull unsigned long long

using namespace std;

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

    string a;
    cin >> a;
    int ans = 0;
    int n = 3;
    if (a[0] == 'R')
    {
        ans = max(ans, 1);
        if (a[1] == 'R')
        {
            ans = max(ans, 2);
            if (a[2] == 'R')
                ans = max(ans, 3);
        }
    }
    if (a[1] == 'R')
    {
        ans = max(ans, 1);
        if (a[2] == 'R')
            ans = max(ans, 2);
    }
    if (a[2] == 'R')
        ans = max(ans, 1);
    cout
        << ans;
}


Measured memory_bytes: 3644
#include<stdio.h>
int dp[50];
int main(){

  int n;
  scanf("%d",&n);

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

  return 0;
  
}

int fib(int n){
    if(dp[n]!=0)return dp[n];
  if(n==0 || n==1) return dp[n]=1;
  else return dp[n]=fib(n-1)+fib(n-2);
}




Measured memory_bytes: 2108
#include<iostream>
#include<numeric>
#include<cmath>
#include<vector>
#include<string>

using namespace std;

int main() {
   string N;
 
    cin>>N;
   for(int i=0;i<19;i++){
    if(N[i]==','){
       N[i]=' ';
    }
       cout<<N[i];
   }
    
    
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 101

int maxes(const int *n, int *max_array) // 要素数を返す(いくつ最大値があったか)
{
	int counter 	= 0;
	int max 	= 0;
	int i;
	for (i=0; i<N; i++) { // 最大値を取得するためのループ
		if (max < n[i]) {
			max = n[i];
		} 
	}
	for (i=0; i<N; i++) { 
		if (n[i] == max) {
			max_array[counter] = i;
			counter++;
		}
	}
	return counter;
}

int main(void)
{
	int n[N] 		= {0};
	int max_array[N]	= {0};
	int i;

	while (scanf("%d", &i) != EOF) {
		n[i]++;
	}

	int size = maxes(n, max_array);

	for (i=0; i<size; i++) {
		printf("%d\n", max_array[i]);
	}

	return 0;

}

Measured memory_bytes: 596
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <climits>
#include <bitset>
#include <cassert>

using namespace std;

const int SIZE = 1 << 17;

int pointer = SIZE;
char buffer[SIZE];

char Advance() {
    if (pointer == SIZE) {
        fread(buffer, 1, SIZE, stdin);
        pointer = 0;
    }
    return buffer[pointer++];
}

int Read() {
    int answer = 0,sign = 1;
    char ch = Advance();
    while (!isdigit(ch) && ch != '-')
        ch = Advance();
    if (ch == '-') {
        ch = Advance();
        sign = -1;
    }
    while (isdigit(ch)) {
        answer = answer * 10 + ch - '0';
        ch = Advance();
    }
    return answer * sign;
}

char ReadCh() {
    char ch = Advance();
    while (!isalpha(ch))
        ch = Advance();
    return ch;
}

int main() {
    //freopen("tema.in", "r", stdin);
    //freopen("tema.out", "w", stdout);
    int total = 0, q;
    scanf("%d", &q);
    for (int i = 1; i <= q; i++) {
        int n, k;
        scanf("%d%d", &n, &k);
        while (n >= k && n % k != 0) {
            int x = n / k;
            int y = x * k;
            if ((n - y) % (x + 1) == 0) {
                n = y;
                break;
            }
            int z = (n - y) / (x + 1);
            n -= (x + 1) * (z + 1);
        }
        if (n >= k)
            total ^= (n / k);
    }
    if (!total)
        printf("Aoki\n");
    else
        printf("Takahashi\n");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int calcOver(int, int);
int calcM(int, int ,int);

int main() {
  while(true) {
    int e;
    cin >> e;
    if(e == 0) break;
    int y = 0;
    int z = 0;
    int maxover = 0;
    int limity = pow(e, 1.0 / 2.0) + 1;
    int limitz = pow(e, 1.0 / 3.0) + 1;
    int maxy = limity;
    int maxz = limitz;
    int minm = e;
    bool flag = false;
    //cout << limity << ":" << limitz << endl;
    for(y = limity; y >= 0; --y) {
      for(int z = limitz; z >= 0; --z) {
        int m = calcM(e, y, z);
        //if((y + z <= m) && (m <= y + z + e)) {
        if(e >= calcOver(y, z)) {
          //cout << y << ":" << z << ":" << ":" << m << endl;
          if(minm > m) {
            maxy = y;
            maxz = z;
            minm = m;
          }
          break;
        }
      }
    }
    //cout << maxy << ":" << maxz << endl;
    cout << minm << endl;
  }
  return 0;
}

int calcOver(int y, int z) {
  return (y*y + z*z*z);
}
int calcM(int e, int y, int z) {
  return (e - y*y - z*z*z + y + z);
}

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

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define INF 10e7
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
using namespace std;

void solve(void)
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    string ans = "Balanced";
    if (a + b > c + d)
        ans = "Left";
    else if (a + b < c + d)
        ans = "Right";
    cout << ans << endl;
}
int main(void)
{
    solve();
}

Measured memory_bytes: 3604
#include <vector>
#include <string>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    string s;
    int k;
    cin >> s >> k;
    
    int n = s.size();
    vector<int> counts;
    int cnt = 1;
    for (int i = 1; i != n; ++i)
    {
        if (s[i] == s[i - 1])
            cnt++;
        else
        {
            counts.push_back(cnt);
            cnt = 1;
        }
    }
    counts.push_back(cnt);
    
    if (counts.size() == 1)
        cout << (1LL * k * counts[0]) / 2 << '\n';
    else if (s.front() == s.back())
    {
        long long ans = 0;
        for (int i = 1; i != counts.size() - 1; ++i)
            ans += 1LL * k * (counts[i] / 2);
        ans += 1LL * (k - 1) * ((counts.front() + counts.back()) / 2);
        ans += counts.front() / 2 + counts.back() / 2;
        cout << ans << '\n';
    }
    else
    {
        long long ans = 0;
        for (int cnt : counts)
            ans += 1L * k * (cnt / 2);
        cout << ans << '\n';
    }
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] x = sc.nextLine().split(" ");
        String[] d = sc.nextLine().split(" ");
        int a = Integer.parseInt(x[0]);
        int c = Integer.parseInt(x[2]);

        int count = 0;
        for (int i=c; i <= a; i++) {
            for (String e : d) {
                if (Integer.parseInt(e) == i) {
                    count++;
                }
            }
        }
        int count2 = 0;
        for (int i = c; i >= 0; i--) {
            for (String e : d) {
                if (Integer.parseInt(e) == i) {
                    count2++;
                }
            }
        }
        if (count < count2) {
            System.out.println(count);
        } else {
            System.out.println(count2);
        }
    }

    static int getInt(String val) {
        return Integer.parseInt(val);
    }
}

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

int main()
{
	string S,T;
	cin >> S >> T;
	int N = S.size();
	rep(i,N)
	{
		bool flag = true;
		rep(j,N)
		{
			if (S[(j+i)%N] != T[j]) flag = false;
		}
		if (flag)
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int N; cin >> N;
  vector<ll> A(N); REP(i, N) cin >> A[i];
  ll ans = 0;
  ll cnt = 0;
  REP(i, N) {
    if(A[i] < 0) cnt++;
  }
  REP(i, N) {
    if(A[i] < 0) A[i] = abs(A[i]);
  }
  sort(all(A));
  if(cnt % 2 == 0) {
    ans = accumulate(all(A), 0LL);
  } else if(cnt % 2 == 1) {
    ans = accumulate(all(A), 0LL);
    ans = ans - A[0] - A[0];
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
# coding: utf-8
# ALDS1_6_A: ?¨???°?????????
VMAX = 10_000

def countingSort a, b
  c = Array.new(VMAX+1) { 0 }
  a.each {|e|
    c[e] += 1
  }
  j = 0
  c.each_with_index {|e, i|
    e.times {
      b[j] = i
      j += 1
    }
  }
end

n = gets.to_i
a = gets.split.map(&:to_i)
b = Array.new(n)
countingSort a, b
puts b.join(' ')

Measured memory_bytes: 150792
#include<stdio.h>
#include<vector>
using namespace std;

int main()
{
	int n, m, q, min, max, l, r, table[500][500]{};

	scanf("%d%d%d", &n, &m, &q);
	for (int i = 0; i < m; ++i)
	{
		scanf("%d%d", &l, &r);
		l--;
		r--;
		for (int j = r; j < n; ++j)
			table[l][j]++;
	}
	for (int i = 0; i < q; ++i)
	{
		scanf("%d%d", &min, &max);
		min--;
		max--;
		int count = 0;
		for (int j = min; j <= max; ++j)
			count += table[j][max];
		printf("%d\n", count);
	}

	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = 0;
        
        for(int i=a;i<=b;i++){
            if(c%i == 0){
                d++;
            }
        }
        System.out.println(d);
	}
    
}


Measured memory_bytes: 26264
#include <bits/stdc++.h>
using namespace std;
const int MAXN=505;
char str[MAXN][15];
int in[26];
bool used[26][26];
int main(){
    int n, cnt;
    queue<int> q;
    while(cin>>n&&n){
        memset(in,0,sizeof in);
        memset(used,0,sizeof used);
        bool flag=true;
        for(int i=0; i<n; i++){
            scanf("%s",str[i]);
            int len=strlen(str[i]);
            if(i&&flag){
                for(int k=0; k<len; k++){
                    if(str[i][k]==str[i-1][k]){
                        continue;
                    }
                    if(!str[i][k]) goto ok;
                    int s1=str[i-1][k]-'a', s2=str[i][k]-'a';
//                    assert(s1>=0);assert(s2>=0);
                    if(used[s2][s1]) flag=false;
                    if(!used[s1][s2]){
                        used[s1][s2]=true;
                        in[s2]++;
                    }
                    goto ok;
                }
                if(str[i-1][len]) flag=false;
                ok:;
            }
        }
        if(!flag) goto failed;
        while(!q.empty()) q.pop();
        for(int i=0; i<26; i++){
            if(in[i]==0){
                q.push(i);
            }
        }
        cnt=0;
        while(!q.empty()){
            int now=q.front(); q.pop();
            for(int i=0; i<26; i++){
                if(used[now][i]){
                    in[i]--;
                    if(in[i]==0){
                        q.push(i);
                    }
                }
            }
            cnt++;
        }
        if(cnt!=26) goto failed;
        puts("yes");
        continue;
        failed:;
        puts("no");
    }
    return 0;
}

Measured memory_bytes: 1192
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//constants
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = 1<<28;


int main(int argc, char **argv) {
    long long i, o, t, j, l, s, z;
    cin >> i >> o >> t >> j >> l >> s >> z;

    long long ans1 = 0, ans2 = 0;
    ans1 += 4 * (i/2);
    ans1 += 2 * o;
    ans1 += 4 * (j/2);
    ans1 += 4 * (l/2);

    if(i&&j&&l){
        ans2 += 6;
        i--; j--; l--;
    }
    ans2 += 4 * (i/2);
    ans2 += 2 * o;
    ans2 += 4 * (j/2);
    ans2 += 4 * (l/2);

    cout << ((ans1>ans2) ? (ans1/2) : (ans2/2)) << endl;
    return 0;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define INF 1e9
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
using namespace std;

/*
int gcd(int a, int b)
{
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    
    return b ? gcd(b, a % b) : a;
}
*/
int gcd(int a,int b)
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
    }
}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k, tmp;
    long long sum=0;
    cin>>k;
/*
    for(int i = 1; i < k+1; i++){
        for(int j = i; j < k+1; j++){
            for(int l = j; l < k+1; l++){
                tmp = __gcd(i, j);
                tmp = __gcd(tmp, l);           
                if(i == j && j == l){
                    sum += tmp;
                }
                else{
                    sum += tmp*3;
                }
            }
        }
    }
*/
    for(int i = 1; i < k+1; i++){
        for(int j = 1; j < k+1; j++){
            for(int l = 1; l < k+1; l++){
                tmp = __gcd(i, j);
                tmp = __gcd(tmp, l);           
                sum += tmp;
            }
        }
    }
    cout<<sum<<endl;
    return 0;
} 


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

#define ll long long
#define pb push_back
#define eb emplace_back
#define REP(i, n) for(int i=0;i<(n);++i)
#define caset int ___T; cin >> ___T; while(___T--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define fast_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"

void solve() {
	int ans = 0;
	int curr = 0;

	string s;
	cin >> s;

	for (char c : s) {
		if (c == 'R') {
			curr++;
		} else {
			ans = max(ans, curr);
			curr = 0;
		}
	}
	ans = max(ans, curr);

	cout << ans << endl;
}

int main() {
	fast_IO;

	solve();

	cout << flush;
}


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

int isGood(int N, int sum)
{
    return (sum >= N);
}

int main() {

    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);
    
    int N, M;
    cin >> N >> M;
    
    int ans = 0;
    
    for(int i=1; i*i<=M; i++)
    {
        if(M % i)
            continue;
        
        if(isGood(N, M/i))
            ans = max(ans, i);
        
        if(isGood(N, i))
            ans = max(ans, M/i);
    }
    
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 500000

void merge(int *, int, int, int);
void mergeSort(int *, int, int);
int count = 0;

int main()
{
  int i,n,S[N];

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

  for(i = 0; i < n; i++){
    if(i > 0)printf(" ");
    printf("%d",S[i]);
  }
  printf("\n");
  printf("%d\n",count);


  return 0;
}

void merge(int A[], int left, int mid, int right)
{
  int n1,n2,L[mid-left],R[right-mid],i,j,k;

  n1 = mid - left;
  n2 = right - mid;

  for(i = 0; i < n1; i++){
    L[i] = A[left+i];
  }
  for(i = 0; i < n2; i++){
    R[i] = A[mid + i];
  }
  L[n1] = 10000000000;
  R[n2] = 10000000000;
  i = 0;
  j = 0;

  for(k = left; k < right; k++){
    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
      count++;
    }
    else{
      A[k] = R[j];
      j = j + 1;
      count++;
    }
  }
}

void mergeSort(int A[], int left, int right)
{
  int mid;
  
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}



Measured memory_bytes: 5688
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int a,b;
    cin>>a>>b;

    int mp=1;

    if(0<a&&a<=b){
        cout<< "Positive" <<endl;
    }
    else if(a<=b&&b<0){
        if(abs(b-a+1)%2==1){
            cout<< "Negative" <<endl;
        }
        else if(abs(b-a+1)%2==0){
            cout<< "Positive" <<endl;
        }
    }
    else 
        cout<< "Zero" <<endl;
   

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#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 all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
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; }
#define INF 1e9
#define PI (acos(-1))
#define mod (int)1e9+7
int main() {
    double max=0;
    int n,k;
    cin>>n>>k;
    vector<int> p(n);
    vector<double> q(n);
    REP(i,n){
        cin>>p[i];
        q[i]=((double)p[i]+1.0)/2;
    }
    double sum=0;
    REP(j,k)sum+=q[j];
    REP(i,n-k+1){
        if(i!=0){
            sum-=q[i-1];
            sum+=q[i+k-1];
        }
        if(max<sum)max=sum;
    }
    printf("%.12lf\n",max);
    return 0;
}

Measured memory_bytes: 2688
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int N, M;
int A[MAX_N];

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

  cin >> N >> M;
  REP(i, N) cin >> A[i];

  priority_queue<int> q;
  REP(i, N) q.push(A[i]);

  for (int i = 0; i < M; i++) {
    int a = q.top();
    q.pop();
    q.push(a / 2);
  }

  ll ans = 0;
  while (!q.empty()) {
    ans += q.top();
    q.pop();
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1276
#include  <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    ll x, ans;
    cin >> x;

    ans = (x/11) * 2;
    x %= 11;

    if(x >= 1 && x <= 6) ans++;
    if(x > 6)            ans += 2;

    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define REPS(i,n) for(int i=1;i<=(n);i++)
#define RREPS(i,n) for(int i=(n);i>0;i--)
#define mp make_pair
#define pb(a) push_back(a)
typedef long long ll;

int main(){
    int N;
    scanf("%d",&N);
    vector<int> a(N);
    ll S = 0;
    ll A = 0;
    REP(i,N){
        scanf("%d",&a[i]);
        S += a[i];
    }
    ll ans = 1e15;
    REP(i,N-1){
        A += a[i];
        S -= a[i];
        ans = min(ans,abs(A-S));
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1024
use std::collections::HashSet;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let it = s.trim().chars();

    let mut set = HashSet::new();
    for i in it {
        set.insert(i as u8);
    }

    for i in 97..123 {
        if !set.contains(&i) {
            println!("{}",i as char);
            return;
        }
    }

    println!("None");
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0), cin.tie(0)
#define RI(x) x = rit()
#define RII(a,b) a = rit(), b = rit()
#define RIII(a,b,c) a = rit(), b = rit(), c = rit()
#define REP(I, N) for(int I=0;I<(N);I++)
#define REPP(I, N) for(int I=1;I<=(N);I++)
#define SZ(x) (int)(x).size()
#define P pair<int, int>
#define F first
#define S second
#define PB(x) push_back(x)
#define endl "\n"
#define ll long long
//#define int long long

//===================================================//

#define N 100000
#define modn 1000000007

using namespace std;
inline int rit(){
    int f=0,key=1;
    char ch;
    do{
        ch = getchar();
        if(ch=='-') key=-1;
    }while(ch<'0'||ch>'9');
    do{
        f = f*10+ch-'0';
        ch = getchar();
    }while(ch>='0'&&ch<='9');
    return f*key;
}
string st, hi = "YAKI";
int32_t main(void){
    cin>>st;
    REP(i,4){
        if(st[i]!=hi[i]){
            puts("No");
            return 0;
        }
    }
    puts("Yes");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(idx, N) for (auto idx(0); idx < N; ++idx)
using namespace std;


int main()
{
  int x, a;
  cin >>x >> a;
  if (x < a) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#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
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<ll> a(n+1),b(n);
  rep(i,n+1) cin >> a[i];
  rep(i,n) cin >> b[i];
  ll ans=0;
  rep(i,n){
    ll c=min(a[i],b[i]);
    b[i]-=c,a[i]-=c;
    ans+=c;
    c=min(a[i+1],b[i]);
    b[i]-=c;
    a[i+1]-=c;
    ans+=c;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n,m; cin >> n >> m;
    cout<<abs(n*m-2*n-2*m+4)<<endl;
}

Measured memory_bytes: 256
/*

Author : AllKilled
Date   : 202001186 20:00:00 UTC+8

Website: https://atcoder.jp/contests/keyence2020
Contest: Keyence Programming Contest 2020.
Problem: Task A.
Result :

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

typedef long long LL;

const LL MAXN = 1e6+7;

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



int main()
{
    int H, W, N;
    cin >> H >> W >> N;
    int h = (N + W - 1) / W;
    int w = (N + H - 1) / H;
    int ans = min(h, w);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N, K = MAP()
l = LIST()

l.sort(reverse=True)
print(sum(l[:K]))

Measured memory_bytes: 5332
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int len = s.length();
		sc.close();
		String[] slist = new String[len];
		for (int i=0; i<len; i++){
			slist[i] = String.valueOf(s.charAt(i));			
		}
		
		int start = 0;
		int end = 0;
		int ans = 0;
		boolean first = true;
		
		for (int i=0; i<len; i++){
			if(first && (slist[i].equals("A") || slist[i].equals("T") || slist[i].equals("G") || slist[i].equals("C"))){
				start = i;
				first = false;
			}
			else if (!first && !slist[i].equals("A") && !slist[i].equals("T") && !slist[i].equals("G") && !slist[i].equals("C")){
				end = i;
				first = true;
			}
			ans = Math.max(ans, end-start);
		}
		if(!first) ans = Math.max(ans, len -start);
		System.out.println(ans);
	}
}


Measured memory_bytes: 22612
while n = gets.to_i
  break if n == 0
  m = []
  t = Array.new(n+1,0)

  n.times{
    a = gets.split(/ /).map(&:to_i).push(0)
    m.push(a)
    n.times{|i| t[i]+=a[i] }
  }

  m.push(t)

  (0..n).each{|i| m[i][n]=m[i].inject(:+)}

  m.each{|r| r.each{|c| print "%05s"%(c)};puts}
end

Measured memory_bytes: 8784
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;
typedef long long ll;

int main(){
    ll A, B, N; cin >> A >> B >> N;
    ll x = B-1;
    if(x>N) x = N;
    ll ans = (A*x)/B;
    cout << ans << endl;
}

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

int main(){
  int A,B;
  cin >> A >> B;
  if(A==1){
    if(B==2){
      cout << 3;
    }else{
      cout << 2;
    }
  }else if(A==2){
    if(B==1){
      cout << 3;
    }else{
      cout << 1;
    }
  }else{
    if(B==2){
      cout << 1;
    }else{
      cout << 2;
    }
  }
}

Measured memory_bytes: 256
p['   '];t['   '];n,x,j;main(i){for(;++i<998;)for(x=i;x<1e6;p[x+=i]=1);for(;scanf("%d%d",&n,&x)*n;memset(t,!printf(x<2?"NA\n":"%d\n",x),4e6)){for(;n--;)for(i=-scanf("%d",t);++i<x;)t[i+*t]|=t[i];for(;p[x]|!t[x];x--);}}

Measured memory_bytes: 0
n=int(input())
nn=n//2
vlist = [int(i) for i in input().split()]

vlista=[]
vlistb=[]

for i in range(n):
    if i%2==0:
        vlista.append(vlist[i])
    else:
        vlistb.append(vlist[i])

vlista=sorted(vlista)
vlistb=sorted(vlistb)

mae=0
ulista=[]
ulistb=[]

for i in range(nn):
    if vlista[i]==mae:
        ulista[-1][1]+=1
    else:
        ulista.append([vlista[i], 1])
    mae=vlista[i]

mae=0

for i in range(nn):
    if vlistb[i]==mae:
        ulistb[-1][1]+=1
    else:
        ulistb.append([vlistb[i], 1])
    mae=vlistb[i]

#print(ulista, ulistb)
ulista.sort(key=lambda dict: dict[1], reverse=True)
ulistb.sort(key=lambda dict: dict[1], reverse=True)

if len(ulista)==1 and len(ulistb)==1:
    if ulista[0][0]==ulistb[0][0]:
        print(nn)
    else:
        print(0)
else:
    if ulista[0][0]==ulistb[0][0]:
        if len(ulista)==1:
            print(n-ulista[0][1]-ulistb[1][1])
        elif len(ulistb)==1:
            print(n-ulista[1][1]-ulistb[0][1])
        else:
            print(min(n-ulista[1][1]-ulistb[0][1], n-ulista[0][1]-ulistb[1][1]))
    else:
        print(n-ulista[0][1]-ulistb[0][1])

Measured memory_bytes: 65900