akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
 
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
  string s; cin>>s;
  cout<<count(s.begin(),s.end(),'+') - count(s.begin(),s.end(),'-') << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    int N = Integer.parseInt(br.readLine());
	    String[] line = br.readLine().split(" ");
	    int[] data = new int[line.length];

	    for (int i = 0; i < line.length; i++) {
	    	data[i] = Integer.parseInt(line[i]);
	    }

	    StringBuilder sb = new StringBuilder();
	    sb.append(disp(data)).append("\n");

	    for (int i = 1; i <= N - 1; i++) {
	    	int v = data[i];
	    	int j = i - 1;
	    	while (j >= 0 && data[j] > v) {
	    		data[j + 1] = data[j];
	    		j--;
	    	}
	    	data[j + 1] = v;
		    sb.append(disp(data)).append("\n");
	    }
	    System.out.print(sb.toString());
	}

	public static String disp(int[] data) {
	    StringBuilder sb = new StringBuilder();
    	for (int k = 0; k < data.length; k++) {
	    	sb.append(data[k]);
    		if (k != data.length - 1) {
    			sb.append(" ");
    		}
    	}
	    return sb.toString();
	}
}

Measured memory_bytes: 26460
#include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
typedef long long ll;

ll myISqrt(ll x){
  ll s, t;
  if (x <= 0) return 0;
  s = 1;  t = x;
  while (s < t) {  s <<= 1;  t >>= 1;  }
  do {
    t = s;
    s = (x / s + s) >> 1;
  } while (s < t);
  return t;
}


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

  ll y = (myISqrt(8*x+1)-1)/2 - 1;
  while(1){
    if((y*(y+1))/2 < x && ((y+2)*(y+1))/2 >= x)  break;
    y++;
  }

  cout << y+1 << endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
lista=list(map(int,input().split()))

goukei=0
count=0

for i in range(n):
    number=lista[i]+goukei
    if i%2==0:
        if number>=0:
            count=count+number+1
            goukei=-1
        else:
            goukei=number
    else:
        if number<=0:
            count=count+abs(number)+1
            goukei=1
        else:
            goukei=number

count1=count

goukei=0
count=0

for i in range(n):
    number=lista[i]+goukei
    if i%2==1:
        if number>=0:
            count=count+number+1
            goukei=-1
        else:
            goukei=number
    else:
        if number<=0:
            count=count+abs(number)+1
            goukei=1
        else:
            goukei=number
print(min(count,count1))

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for (int i = n - 1; i >= 0; i--)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

#define INF bit(60)
#define pb push_back
#define mod 1000000007

using namespace std;
using uif = uint_fast64_t;
using ll = long long int;
using tTree = __gnu_pbds::tree<ll, __gnu_pbds::null_type, less<ll>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

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

#define FACSIZE 200002

ll invfac[FACSIZE];
ll fac[FACSIZE];

template <class T>
bool chmax(T &, const T &);
template <class T>
bool chmin(T &, const T &);
ll gcd(ll, ll);
ll powLL(ll x, ll y);

ll mod_pow(ll, ll);
ll mod_add(ll, ll);
ll mod_mul(ll, ll);
ll mod_div(ll, ll);
ll comb(ll, ll);
void make_fact(ll);
void make_invfact(ll);
void fact_init();

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

  if (a > k)
  {
    cout << a - k << " " << b << endl;
  }
  else if (a + b > k)
  {
    cout << 0 << " " << b - (k - a) << endl;
  }
  else
  {
    cout << 0 << " " << 0 << endl;
  }

  return 0;
}

ll mod_pow(ll x, ll r)
{
  if (r == 0)
    return 1;
  else if (r == 1)
    return x % mod;
  else if (r % 2 == 0)
  {
    ll t = mod_pow(x, r / 2) % mod;
    return mod_mul(t, t);
  }
  else
  {
    ll t = mod_pow(x, r / 2) % mod;
    ll k = mod_mul(t, t);
    return (k % mod) * (x % mod);
  }
}
ll mod_add(ll a, ll b)
{
  return ((a % mod) + (b % mod)) % mod;
}

ll mod_mul(ll a, ll b)
{
  return ((a % mod) * (b % mod)) % mod;
}

ll mod_div(ll a, ll b)
{
  return mod_mul(a, mod_pow(b, mod - 2));
}

void fact_init()
{
  make_fact(FACSIZE - 1);
  make_invfact(FACSIZE);
}

void make_fact(ll n)
{
  fac[0] = 1;
  rep(i, n)
  {
    fac[i + 1] = mod_mul(fac[i], i + 1);
  }
}

void make_invfact(ll n)
{
  invfac[n] = mod_pow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; i--)
  {
    invfac[i] = mod_mul(invfac[i + 1], i + 1);
  }
}

ll comb(ll n, ll r)
{

  return mod_mul(mod_mul(fac[n], invfac[r]), invfac[n - r]);
}
template <class T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
  if (b < a)
  {
    a = b;
    return 1;
  }
  return 0;
}

ll qp(ll a, ll b)
{
  ll ans = 1LL;
  do
  {
    if (b & 1LL)
      ans = 1LL * mod_mul(ans, a) % mod;
    a = 1LL * mod_mul(a, a) % mod;
  } while (b >>= 1LL);
  return ans;
}
ll qp(ll a, ll b, ll mo)
{
  ll ans = 1LL;
  do
  {
    if (b & 1LL)
      ans = 1LL * (ans % mo) * (a % mo);
    a = 1LL * (a % mo) * (a % mo);
  } while (b >>= 1LL);
  return ans;
}
ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}
ll powLL(ll x, ll y)
{
  ll ans = 1LL;
  for (ll i = 0LL; i < y; i++)
    ans *= x;
  return ans;
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int mtr[100][100], vec[100], ans[100] = {};
    int n, m;
    cin >> n >> m;
    REP(i, n) {
        REP(j, m) {
            cin >> mtr[i][j];
        }
    }
    REP(i, m) {
        cin >> vec[i];
    }

    REP(i, n) {
        REP(j, m) {
            ans[i] += mtr[i][j] * vec[j];
        }
        cout << ans[i] << endl;
    }
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

map<char,ll> sz;
map<char,map<ll,ll> > a;

ll calc(const string& s,ll l,ll r){
  if(isdigit(s[l]))return stoll(s.substr(l,r-l));
  else{
    char name=s[l];
    ll idx=calc(s,l+2,r-1);
    if(idx==-1||idx>=sz[name]||a[name].find(idx)==a[name].end())return -1;
    else return a[name][idx];
  }
}

bool assi(const string& s,ll n){
  rep(i,n){
    if(s[i]=='='){
      char name=s[0];
      ll idx=calc(s,2,i-1);
      ll val=calc(s,i+1,n);
      if(val==-1||idx>=sz[name])return false;
      else{
        a[name][idx]=val;
        return true;
      }
    }
  }
  return false;
}

int main(){
  while(1){
    string s;
    cin>>s;
    if(s==".")break;
    sz.clear();
    a.clear();
    ll ans=INF,crt=1;
    do{
      ll n=s.size();
      bool isd=true;
      rep(i,n){
        if(s[i]=='=')isd=false;
      }
      if(isd){
        sz[s[0]]=calc(s,2,s.size()-1);
      }else{
        if(!assi(s,s.size()))minch(ans,crt);
      }
      crt++;
      cin>>s;
    }while(s!=".");
    if(ans==INF)cout<<0<<endl;
    else cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3084
import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
  std.functional, std.container, std.typecons;

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

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

void main() {
  auto input = readln.split.to!(ulong[]);
  ulong A = input[0], B = input[1], C = input[2], D = input[3];

  ulong f(ulong n) {
    return (B/n)-((A-1)/n);
  }

  ulong num = f(C) + f(D) - f(lcm(C, D));
  (B - A + 1 - num).writeln;
}


Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#include <vector>
#define MAX 1e5 + 1

int main() {
    int n, q, temp;
    long long sum = 0;
    std::cin >> n;
    std::vector<int> a(MAX, 0);

    for (int i = 0; i < n; i++) {
        std::cin >> temp;
        a.at(temp)++;
        sum += temp;
    }
    std::cin >> q;
    std::vector<long long> b(q), c(q);
    int x, y;
    for (int i = 0; i < q; i++) {
        // std::cin >> b[i] >> c[i];
        std::cin >> x >> y;
        b[i] = x;
        c[i] = y;
        if (b[i] <= 0 || c[i] <= 0) {
            std::cout << i << "  x:" << x << ":" << b[i] << "  y" << y << ":"
                      << c[i] << std::endl;
        }
    }
    // std::ofstream outputfile("out2.txt");

    for (int j = 0; j < q; j++) {

        sum -= b[j] * a.at(b[j]);
        sum += c[j] * a.at(b[j]);
        a.at(c[j]) += a.at(b[j]);
        a.at(b[j]) = 0;

        std::cout << sum << std::endl;
        // outputfile << sum << std::endl;
    }
    // outputfile.close();

    return 0;
}

Measured memory_bytes: 5336
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    class Ball {
        public int X { get; set; }
        public int Y { get; set; }
    }

    int N;

    public void Solve() {
        N = sc.nextInt();
        var red = new Ball[N];
        var blue = new Ball[N];
        for (int i = 0; i < N; i++) {
            var ball = new Ball { X = sc.nextInt(), Y = sc.nextInt() };
            red[i] = ball;
        }
        for (int i = 0; i < N; i++) {
            var ball = new Ball { X = sc.nextInt(), Y = sc.nextInt() };
            blue[i] = ball;
        }

        var ans = 0;
        var Red = red.ToList();
        var dist = new bool[N];
        blue = blue.OrderBy(b => b.X).ToArray();
        for (int i = 0; i < N; i++) {
            var ball = Red.Where(b => blue[i].X > b.X && blue[i].Y > b.Y)
                          .OrderByDescending(b => b.Y).FirstOrDefault();
            if (ball != null) {
                Red.Remove(ball);
                ans++;
            }

        }
        WriteLine(ans);
    }

}



class Scanner {
    string[] s;
    int i;

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

    public Scanner() {
        s = new string[0];
        i = 0;
    }

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

    public int nextInt() {


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

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

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

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

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

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}

Measured memory_bytes: 13524
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
map<int, int> mp;
using Graph = vector<vector<int>>; 
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

// ^= -> ビットごとの排他的論理和を計算する
int a[31];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string w; cin >> w;
	for (int i = 0; i < w.size(); i++) {
		int b = w.at(i) - 'a';
		a[b]++;
	}
	
	for (int i = 0; i < 30; i++){
		if (a[i] % 2 == 1) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=410;
const int M=1e5+10;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int n,m,x[M],y[M],c[N];
bitset<N> s[N];
int main() {
    n=gi(),m=gi();
    for(int i=1;i<=m;i++) x[i]=gi(),y[i]=gi();
    for(int i=1;i<=n;i++) {
        c[i]=1;
        s[i][i]=1;
        for(int j=m;j;j--) {
            if(!s[i][x[j]]&&!s[i][y[j]]) continue;
            if(s[i][x[j]]&&s[i][y[j]]) { c[i]=0;break; }
            s[i][x[j]]=s[i][y[j]]=1;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++)
        for(int j=i+1;j<=n;j++)
            if(c[i]&&c[j]&&!(s[i]&s[j]).count()) ++ans;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1024
using System;

class alds12a
{
    static void Main()
    {
        int  tn=int.Parse(Console.ReadLine());
        string[] input = Console.ReadLine().Split(' ');
        int[] num = new int[tn];
        int count = 0;
        for (int i = 0; tn > i; i++)
        {
            num[i] = int.Parse(input[i]);
        }
        for (int i = 0; tn > i; i++)
        {
            for (int j = tn - 1; j > i; j--)
            {
                if (num[j] < num[j - 1])
                {
                    int swap = num[j];
                    num[j] = num[j - 1];
                    num[j - 1] = swap;
                    count++;
                }
            }
        }
        for (int i = 0; tn - 1 > i; i++)
        {
            Console.Write(num[i]);
            Console.Write(' ');
        }
        Console.WriteLine(num[tn-1]);
        Console.WriteLine(count);
    }

}

Measured memory_bytes: 19952
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


int main()
{
	ll n, m;
	cin >> n >> m;

	vector<pair<ll, bool>> a(n);
	for (ll i = 0; i < n; i++)
	{
		a[i].first = 1;
		a[i].second = false;
	}

	a[0].second = true;

	for (ll i = 0; i < m; i++)
	{
		ll x, y;
		cin >> x >> y;

		x--;
		y--;

		a[y].first++;
		a[x].first--;

		if (a[x].second)
		{
			if (a[x].first == 0)
			{
				a[x].second = false;
			}
			a[y].second = true;
		}
	}

	ll cnt = 0;
	for (ll i = 0; i < n; i++)
	{
		if (a[i].second)
		{
			cnt++;
		}
	}

	println(cnt);
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long A = sc.nextLong();
		Long B = sc.nextLong();
		Long N = sc.nextLong();
		Long x;
		
		if (B <= N)
			x = B - 1;
		else
			x = N;
		Double temp = Math.floor((A * x) / B) - A * Math.floor(x / B);
		System.out.println(temp.longValue());
	}

}


Measured memory_bytes: 35700
#include <bits/stdc++.h>
    using namespace std;
    int main() {


  int A,B,C;
  cin>>A>>B>>C;
  if(A==B){
      cout<<C;
  } else if(A==C){
            cout<<B;
        } else if(C==B){
            cout<<A;
        }
        return 0;
    }



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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int at = 0, ax = 0, ay = 0;
  for (int i = 0; i < n; i++) {
    int t, x, y;
    cin >> t >> x >> y;
    int d = abs(ax - x) + abs(ay - y);
    if ((t - at) % 2 != d % 2 || (t - at) < d) {
      cout << "No" << endl;
      return 0;
    }
    at = t;
    ax = x;
    ay = y;
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val reader = System.`in`.bufferedReader()
    val s = reader.readLine()

    var now = s[0].toString()
    var cnt = 0

    s.split("").filter(String::isNotBlank).forEach { i ->
        if (!now.equals(i)) {
            cnt++
            now = i
        }
    }

    println(cnt)
}


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

int main() {
    int N;
    cin >> N;
    int64_t sum = 0;
    for (int i = 0; i < N; i++) {
        if ((i + 1) % 3 != 0 && (i + 1) % 5 != 0) {
            sum += (i + 1);
        }
    }

    cout << sum << endl;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;


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

	int A, B;
	cin >> A >> B;
	cout << A * B << endl;

	return 0;
}

Measured memory_bytes: 3596
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

template<class Weight>
struct Prim {
    int n;
    vector<vector<pair<int, Weight>>> G;
    vector<int> parent;
    vector<bool> vis;

    Prim() {}

    Prim(int n_) :n(n_), G(n), parent(n, -1) {}

    void addEdge(int u, int v, Weight w) {
        G[u].emplace_back(v, w);
        G[v].emplace_back(u, w);
    }

    Weight getMST(int start = 0) {
        Weight res = 0;
        using E = tuple<Weight, int, int>;
        priority_queue<E, vector<E>, greater<E>> Q;
        Q.push(E(0, start, start));
        while (!Q.empty()) {
            Weight w;
            int p, u;
            tie(w, p, u) = Q.top();
            Q.pop();
            if (parent[u] != -1)continue;
            parent[u] = p;
            res += w;
            for (auto &e : G[u]) {
                if (parent[e.first] == -1) {
                    Q.push(E(e.second, u, e.first));
                }
            }
        }
        return res;
    }
};

int N;
ll D;
vll A;

Prim<ll> prim;
ll INF = LLONG_MAX / 3;

void f(int l, int r) {
    if (r - l == 1)return;
    int m = (l + r) / 2;
    using P = pair<ll, int>;
    P lefMin(INF, -1), rigMin(INF, -1);
    FOR(i, l, m) smin(lefMin, P(A[i] - D * i, i));
    FOR(i, m, r) smin(rigMin, P(A[i] + D * i, i));
    FOR(i, l, m) prim.addEdge(i, rigMin.second, rigMin.first + A[i] - D * i);
    FOR(i, m, r) prim.addEdge(i, lefMin.second, lefMin.first + A[i] + D * i);
    f(l, m);
    f(m, r);
}

void solve() {
    cin >> N >> D;
    A.resize(N);
    rep(i, N)cin >> A[i];
    prim = Prim<ll>(N);

    f(0, N);
    cout << prim.getMST() << endl;
}

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

Measured memory_bytes: 234596
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>
 
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long int;
 
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;
 
 
 
void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}
 
void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}
 
void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}
 
void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}
 
void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

 
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if(b-a==c-b)
		puts("YES");
	else
		puts("NO");
	return 0;
}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans[] = new int[3];
        ans[0] = a + b;
        ans[1] = a - b;
        ans[2] = a * b;
        Arrays.sort(ans);
        System.out.println(ans[2]);
        sc.close();
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Solve s= new Solve();
		s.solve();
	}

}
class Solve{
	 Scanner sc = new Scanner(System.in) ;
	 void solve() {
		 int N=sc.nextInt();
		 int D=sc.nextInt();
		 int[][] X = new int[N][D];
		 int res=0;
		 
		 for(int i=0;i<N;i++) {
			 for(int j=0;j<D;j++) {
				 X[i][j]=sc.nextInt();
				 }
		 }
		 for(int i=0;i<N-1;i++) {
			 
			 
			 for(int j=N-1;j>i;j--) {
				 double dis=0;
				 for(int k=0;k<D;k++) {
					 dis += Math.pow((X[i][k]-X[j][k]), 2);
				 }
				 int judge=(int)Math.sqrt(dis);
				 
				 
				 if(judge*judge==dis) {
					 res++;
				 }
			}
		 }
		 



		 System.out.println(res);
	 }
}

Measured memory_bytes: 23892
class UnionFind:
    def __init__(self,N):
        self.par =[-1 for i in range(N)]
    def find(self,x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return
        if self.par[x] > self.par[y]:
            x,y = y,x
        self.par[x] +=self.par[y]
        self.par[y] = x

    def size(self,x):
        return -self.par[self.find(x)]
    def same(self,x,y):
        return self.find(x)==self.find(y)

N,M,K=map(int,input().split(' '))
Friend = UnionFind(N)
pull = [-1] * N
for i in range(M):
    a,b = map(int,input().split(' '))
    Friend.unite(a-1,b-1)
    pull[a-1] -= 1
    pull[b-1] -= 1
for i in range(K):
    c,d=map(int,input().split(' '))
    if Friend.same(c-1,d-1):
        pull[c-1] -=1
        pull[d-1] -=1
print(' '.join([str(Friend.size(i)+pull[i]) for i in range(N)]))

Measured memory_bytes: 15256
#include <stdio.h>

int
main(int argc, char *argv[])
{
  char s[16];
  scanf("%s", s);
  int k = 0; int cnt = 0;
  while(s[k] != '\0'){
    if(s[k] == 'x')cnt++;
    k++;
  }
  if(cnt >= 8)printf("NO\n");
  else printf("YES\n");

  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<iterator>
#include<map>
#include<utility>
#include<functional>
int main(){
  	using p = std::pair<int,int>;
	int n;
	std::cin >> n;
  
  	auto m = std::map<std::string,std::vector<p> >();
	std::string s;
    
	for (int i = 0; i < n; i++)
	{
		int num;
		std::cin >> s >> num;	
		m[s].emplace_back(std::make_pair(i,num));
	}
	
	for(auto &i : m){
		std::sort(i.second.begin(),i.second.end(),[](p n1,p n2){
			return n1.second > n2.second;
		});
		for(auto &j : i.second){
			std::cout << j.first + 1 << std::endl;
		}
    }
    
}



Measured memory_bytes: 256
A = sum([list(map(int, input().split())) for i in range(3)], [])
N = int(input())
b = [int(input()) for i in range(N)]
card = [False for j in range(9)]

def bingo_check(card):
    naname = (card[0] and card[4] and card[8]) \
                or (card[2] and card[4] and card[6])
    yoko = all(card[0:3]) or all(card[3:6]) or all(card[6:9])
    tate = all(card[0::3]) or all(card[1::3]) or all(card[2::3])
    return naname or yoko or tate

for i in range(N):
    if b[i] in A:
        index = A.index(b[i])
        card[index] = True

print('Yes' if bingo_check(card) else 'No')


Measured memory_bytes: 38256
n = int(input())
ans = 0
a = 1
na = n
if n % 2 == 1:
    print(0)
else:
    # for i in range(3):
    #     n100 = n // 100
    #     n50 = n // 50
    #     n = n // 10
        
    #     ans += n + n50 - n100
    #     print(n,n50,n100)
    # print(ans)


        # for i in range(1,20):
        #     for j in range(1,40):
        #         ans += (n // ((5**j)*(10**i)))
        #     # ans += (n //(5*10**i))
        # n10 = n // 10
        # print(ans+n10)

    for j in range(1,40):
        ans += (n // ((5**j)*10))
    n10 = n // 10
    print(ans+n10)

# while na != 0:
#     a *= na
#     na -= 2
# # print(a)
# a = list(str(a))
# i = -1
# cnt = 0
# # print(a)
# while a[i] == "0":
#     cnt += 1
#     i -= 1
# print(cnt)

Measured memory_bytes: 38444
#include <stdio.h>
#include<math.h>
using namespace std;

int main(){

	int count[101],tmp,max=-1;
	for(int i=0;i < 101;i++)count[i] = 0;

	while(scanf("%d",&tmp)!=EOF){
		count[tmp]++;
		max = (max >= count[tmp])?max:count[tmp];
	}

	for(int i=0;i<101;i++){
		if(count[i] == max)printf("%d\n",i);
	}
    return 0;
}



Measured memory_bytes: 2620
import bisect
from collections import deque
from collections import defaultdict
from fractions import gcd
#from math import factorial
from math import sqrt
from math import ceil
from itertools import permutations
from heapq import *

#N=int(input())
A,B=map(int,input().split())

print(max(2*A-1,A+B,2*B-1))


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

int main()
{
 int n;
  cin>>n;
  vector<int> v(n);
  for(int &i:v)
      cin>>i;
  sort(v.rbegin(),v.rend());
  int x = v[0],y=0;
  for(int i=1;i<n;i++)
    y+=v[i];
  if(x<y)
    cout<<"Yes\n";
  else
    cout<<"No\n";
  
  
  return 0;
}

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

using namespace std;

char field[40][101] = {'\0'};

int main() {
  int white=501, black=501;
  for (int i=0;i<20;i+=2){
      for (int j=0;j<100;j+=2){
          field[i  ][j] = '.'; field[i  ][j+1] = '#'; 
          field[i+1][j] = '#'; field[i+1][j+1] = '#'; 
      }
  }
  for (int i=20;i<40;i+=2){
      for (int j=0;j<100;j+=2){
          field[i  ][j] = '.'; field[i  ][j+1] = '.'; 
          field[i+1][j] = '#'; field[i+1][j+1] = '.'; 
      }
  }
  int a, b;
  cin >> a >> b;
  for (int i=0;i<20;i+=2) {
      for (int j=0;j<100;j+=2) {
          field[i][j] = '#';
          white--;
          if (a == white) goto WHITE_BREAK;
      }
  }
WHITE_BREAK:
  for (int i=20;i<40;i+=2) {
      for (int j=0;j<100;j+=2) {
          field[i+1][j] = '.';
          black--;
          if (b == black) goto BLACK_BREAK;
      }
  }
BLACK_BREAK:

  printf("40 100\n");
  for (int i=0;i<40;i++) {
      printf("%s\n",field[i]);
  }
  return 0;
}

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if( a < b ) {
    if( b < c ) {
      cout<<a<<" "<<b<<" "<<c<<endl;
    }
    else {
      if( a < c ) {
	cout<<a<<" "<<c<<" "<<b<<endl;
      }
      else {
	cout<<c<<" "<<a<<" "<<b<<endl;
      }
    }
  }
  else {
    if( a < c ) {
      cout<<b<<" "<<a<<" "<<c<<endl;
    }
    else {
      if( b < c ) {
	cout<<b<<" "<<c<<" "<<a<<endl;
      }
      else {
	cout<<c<<" "<<b<<" "<<a<<endl;
      }
    }
  }
}



Measured memory_bytes: 3076
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

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

	int n;
	scanf("%d", &n);
	vector<int> a(n+1), b(n);
	for (int i = 0; i <= n; i++) scanf("%d", &a[i]);
	for (int i = 0; i < n; i++) scanf("%d", &b[i]);

	long long ans = 0;
	for (int i = n-1; i >= 0; i--) {
		if (b[i] <= a[i+1])
			ans += b[i];
		else {
			ans += a[i+1];
			b[i] -= a[i+1];
			ans += min(a[i], b[i]);
			a[i] -= min(a[i], b[i]);
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
	int i;
	FOR(i,0,b) a[i]=c;
	return;
}
int a[300][300];
int used[300];
int n,m,res=INF;
void dfs(int cnt){
	int b[300],num=0,max,i,j;
	if(cnt==m) return;
	FOR(i,0,m) b[i]=0;
	FOR(i,0,n){
		FOR(j,0,m){
			if(!used[a[i][j]]){
				b[a[i][j]]++;
				break;
			}
		}
	}
	FOR(i,0,m){
		if(num<b[i]){
			num=b[i];
			max=i;
		}
	}
	res=MIN(res,num);
	used[max]=1;
	dfs(cnt+1);
	return;
}
int main(void)
{
	int i,j;
	scanf("%d%d",&n,&m);
	FOR(i,0,n){
		FOR(j,0,m){
			scanf("%d",&a[i][j]);
			a[i][j]--;
		}
	}
	dfs(0);
	printf("%d\n",res);
	return 0;
}

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

using ll = long long;
#define f first
#define s second

#ifndef LOCAL
	#define cerr if(0) cerr
#endif

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(nullptr);
	
	char c;
	cin >> c;

	if (c < 'a')
		cout << "A\n";
	else
		cout << "a\n";
	// you should actually read the stuff at the bottom
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smthn instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Measured memory_bytes: 3664
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = list(map(int, sys.stdin.readline().split()))
T = list(map(int, sys.stdin.readline().split()))

T = np.array(T)

a = np.minimum(np.diff(T), M)
print(a.sum() + M)


Measured memory_bytes: 35084
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  string ans = "";
  ans += string(ty - sy, 'U') + string(tx - sx, 'R');
  ans += string(ty - sy, 'D') + string(tx - sx, 'L');
  ans += "L" + string(ty - sy + 1, 'U') + string(tx - sx + 1, 'R') + "D";
  ans += "R" + string(ty - sy + 1, 'D') + string(tx - sx + 1, 'L') + "U";
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>

using namespace std;

const ll N = 3e5+100;
const ll MOD = 1e9+7;

int main()
{

	ll x;
	cin>>x;
	for(;;x++){
		bool poss=true;
		for(ll j = 2;j<=sqrt(x);j++){
			if(x%j==0){
				poss=false;break;
			}
		}
		if(poss)return cout<<x<<endl,0;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <vector>

using namespace std;

int main() {
    int a,b;
    scanf("%d%d",&a,&b);
    if(a*b%2) {
        printf("Odd\n");
    }else{
        printf("Even\n");
    }
    return 0;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  int l_max = 0, r_min=100001;
  for(int i=0;i<m;i++){
    int l,r;
    cin >> l >> r;
    if(l > l_max) l_max=l;
    if(r < r_min) r_min=r;
  }
  if(l_max <= r_min){
    cout << r_min-l_max+1;
  }else{
    cout << 0;
  }
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

#define X second
#define Y first

using namespace std;
using ll = long long;
using P = pair<int, int>;

const double PI = 3.14159265358979;

int cost[52][52];

void solve()
{
  int h, w;
  cin >> h >> w;

  int road_num = 0;
  vector<string> mp(h);
  for(int i = 0; i < h; ++i)
  {
    cin >> mp[i];
    for(const auto& c : mp[i])
    {
      if (c == '.') road_num++;
    }
  }
  
  queue<P> que;
  que.push(P(0, 0));
  cost[0][0] = 1;

  int dx[4] = {0, 1, 0, -1};
  int dy[4] = {1, 0, -1, 0};
  while(!que.empty())
  {
    P now = que.front();
    que.pop();
    int now_cost = cost[now.Y][now.X];
    for(int i = 0; i < 4; ++i)
    {
      P next = P(now.Y + dy[i], now.X + dx[i]);
      if (next.Y < 0 || h <= next.Y || next.X < 0 || w <= next.X) continue;
      if (mp[next.Y][next.X] == '#' || cost[next.Y][next.X] > 0) continue;

      cost[next.Y][next.X] = now_cost + 1;
      que.push(next);
    }
  }
  if  (cost[h - 1][w - 1] == 0) cout << -1;
  else cout << road_num - cost[h - 1][w - 1];
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3664
/** Which of the favors of your Lord will you deny ? **/

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

#define LL long long
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define MP make_pair
#define F first
#define S second

#define ALL(x) (x).begin(), (x).end()
#define DBG(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << endl
#define READ        freopen("alu.txt", "r", stdin)
#define WRITE       freopen("vorta.txt", "w", stdout)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class TIn>using indexed_set = tree<TIn, null_type, less<TIn>,rb_tree_tag, tree_order_statistics_node_update>;

/**

PBDS
-------------------------------------------------
1) insert(value)
2) erase(value)
3) order_of_key(value) // 0 based indexing
4) *find_by_order(position) // 0 based indexing

**/

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);

inline void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int nmax = 2e5+7;
const LL LINF = 1e17;

template <class T>
string to_str(T x)
{
    stringstream ss;
    ss<<x;
    return ss.str();
}

//bool cmp(const PII &A,const PII &B)
//{
//
//}

int match[25][25];

const LL mod = 1e9+7;

void add_self(LL &a,LL b)
{
    a += b;
    if(a>=mod) a -= mod;
}

LL dp[22][1<<22];
int n;

LL solve(int m,int mask)
{
    LL &ret = dp[m][mask];

    if(ret!=-1) return ret;

    if(m==n) return ret = (mask==(1<<n)-1); /// n pair is matched

    ret = 0;

    for(int w=0;w<n;w++)
    {
        if(match[m][w] && !(mask&(1<<w)))
            add_self(ret , solve(m+1,mask |(1<<w)));
    }

    return ret;
}

int main()
{
    optimizeIO();

    cin>>n;

    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            cin>>match[i][j];

    memset(dp,-1,sizeof dp);

    cout<<solve(0,0)<<endl;

    return 0;
}

/**

**/

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}




Measured memory_bytes: 724528
#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b){
    return *(int *)a-*(int *)b;
}

int main(){
    int board,n,i,j,m[100];
    char s[101];

    while(scanf("%d%s",&n,s),n){
        for(i=0;i<n;i++)m[i]=0;
        board=0;

        for(i=0,j=0;j!=100;i++,j++){
            if(i==n)i=0;
            
            m[i]++;
            switch(s[j]){
                case 'M':
                    break;
                case 'S':
                    board+=m[i];
                    m[i]=0;
                    break;
                case 'L':
                    m[i]+=board;
                    board=0;
                    break;
            }
        }
        qsort(m,n,sizeof(int),cmp);
        for(i=0;i<n;i++)printf("%d ",m[i]);
        printf("%d\n",board);
    }
    return 0;
}

Measured memory_bytes: 608
// cand <genesis?>
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
const ll base = 7;
const ll N = 1e2 + 9;
const ll inf = 1000100009;
typedef pair<ll,ll> LL;

ll n,m,x,a[N][N],C[N];
ll i,j,A[N],minn = inf;
ll skill[N];
void chk(){
    memset(skill,0,sizeof(skill));
    ll cnt = 0;
    for (ll i = 1;i <= n;i++){
        if (A[i] != 0){
            cnt += C[i];
            for (ll j = 1;j <= m;j++) skill[j] += a[i][j];
        }
    }
    if (*min_element(skill + 1,skill + m + 1) >= x) minn = min(minn,cnt);
}
void f(ll i){
    if (i > n){
        chk();
        return;
    }
    A[i] = 0; f(i + 1);
    A[i] = 1; f(i + 1);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    //freopen("test.INP", "r", stdin);
    cin>>n>>m>>x;
    for (i=1;i<=n;i++){
        cin>>C[i];
        for (j=1;j<=m;j++) cin>>a[i][j];
    }
    f(1);
    if (minn != inf) cout<<minn;
    else cout<<-1;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(){
  int n,x;
  cin >> n >> x;
  while(n!=0||x!=0){
    int i,j,k;
    int o=0;
    for(i=1;i<=n;i++){
      for(j=i+1;j<=n;j++){
	for(k=j+1;k<=n;k++){
	  if(i+j+k==x) o++;
	}
      }
    }

    cout << o << endl;

    cin >> n >> x;
  }


  return 0;
}


Measured memory_bytes: 3084
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int total0 = 0;
		int totalN = 0;
		for (int i = 0; i < m; i++) {
			int z = sc.nextInt();
			if (z < x) {
				total0++;
			} else {
				totalN++;
			}
		}
		if (total0 < totalN) {
			System.out.println(total0);
		} else {
			System.out.println(totalN);
		}
	}
}


Measured memory_bytes: 21844
N = int(input())
m1 = -1
m2 = -1
As = []
for i in range(N):
    n = int(input())
    As.append(n)
    if n > m1:
        m2 = m1
        m1 = n
    else:
        if n > m2:
            m2 = n

for a in As:
    if a == m1:
        print(m2)
    else:
        print(m1)
       

Measured memory_bytes: 68952
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <string>

typedef long long ll;
using namespace std;
const int mod = 1000000007;

int main() {

    ll N, A, B;

    cin >> N >> A >> B;

    ll diff = B - A;

    if (diff % 2 == 0) {
        ll ans = diff / 2;
        cout << ans << '\n';
    }
    else {
        ll ans = 0;
        if (A - 1 <= N - B) {
            ans += A - 1;
            B -= A - 1;
            B--;
            ans++;
            ans += (B - 1) / 2;
        }
        else {
            ans += N - B;
            A += N - B;
            A++;
            ans++;
            ans += (N - A) / 2;
        }
        cout << ans << '\n';
    }
}



Measured memory_bytes: 256
//coded b vishal mourya - the legendary coder
#include<bits/stdc++.h>
#define ll long long int
#define vec vector<ll>
#define f(a,b) for(ll i = a ; i < b ; i++ )
#define fj(a,b) for(ll j = a ; j < b ; j++ )
#define fk(a,b) for(ll k = a ; k < b ; k++ )
#define fasthoja ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main(void){
    fasthoja;
    ll k; cin >> k;
    ll x; cin >> x;
    
    ll hero = 500 * k;
    
    if( x <= hero ) cout << "Yes\n";
    else cout << "No\n";
 return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
ll power(ll a,ll b)
{ll result=1;
while(b>0)
{if(b%2==1)
 result*=a;
 a*=a;
 b/=2;
}
return result;
}
bool isDiv(string num){
   ll n = num.length();
   ll sum = accumulate(begin(num), end(num), 0) - '0' * n;
   if(sum % 9 == 0)
      return true;
      return false;
}
int main()
{ios_base::sync_with_stdio(false);
    cin.tie(NULL);
string s;
cin>>s;
if(isDiv(s)==true)
cout<<"Yes";
else
cout<<"No";
}


Measured memory_bytes: 3740
#include<stdio.h>
#include<math.h>
int main()
{
    double x1, x2, y1, y2, x, y, kyori;
  
    scanf(" %lf %lf %lf %lf", &x1, &y1, &x2, &y2);
  
    x = x2 - x1;
    y = y2 - y1;
  
    x = pow(x,2);
    y = pow(y,2);
  
    kyori = x + y;
  
    kyori = sqrt(kyori);
  
    printf("%f", kyori);
  
    return 0;
}

Measured memory_bytes: 652
#include <iostream>
#include <stdio.h>

#define rep(i,min,sup) for(int i=min;i<sup;i++)
#define per(i,min,sup) for(int i=(sup-1);i>=min;i--)
#define swap(a,b) {a+=b;b=a-b;a-=b;}
#define ll long long

using namespace std;

main(){
  int A,B;
  scanf("%d %d",&A,&B);
  int ans=-1;
  rep(i,10*B,10*(B+1)){
    if(i*8/100==A){
      ans=i;
      break;
    }
  }
  printf("%d",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18;

int main()
{
	boost;
	ll n, i;
	cin >> n;
	ll arr[n];
	fo(i, 0, n)
	cin >> arr[i];
	int cnt = 0;
	for(ll x : arr) {
		if(x == 0)
		cnt++;
	}
	if(cnt) {
		cout << 0;
		return 0;
	}
	ll res = 1;
	fo(i, 0, n) {
		if(inf64 / res < arr[i]) {
			cout << -1;
			return 0;
		}
		res *= arr[i];
	}
	cout << res;
}


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

int main() {
  int N, l, r;
  int sum = 0;
  cin >> N;

  for (int i = 0; i < N; i++) {
    cin >> l >>r;
    sum += r - l +1;
  }

  cout << sum << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  bool ans = false;
  for(int i=1;i<10;++i) {
    for(int j=1;j<10;++j) {
      if(i*j==N) ans = true;
    }
  }
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}



Measured memory_bytes: 3644