akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

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

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}

ll combination(ll n,ll r){
    ll sum=1;
    rrep(i,min(r,n-r)) (sum*=(n-i+1))%=mod;
    return sum;
}

//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a,b,c;
    cin>>a>>b>>c;
    if(a==b && b==c && a%2==0){
        cout<<-1<<endl;
        return 0;
    }
    ll co=0;
    while(a%2==0 && b%2==0 && c%2==0){
        ll d=a/2,e=b/2,f=c/2;
        a = e+f;
        b = d+f;
        c = d+e;
        co++;
    }
    cout<<co<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] p = new int[n];
		for (int i = 1; i <= n; i++) {
			p[scanner.nextInt() - 1] = i;
		}
		for (int i = 0; i < n; i++) {
			System.out.print(p[i] + (i < n - 1 ? " " : "\n"));
		}
	}

}


Measured memory_bytes: 66080
#include <iostream>
#include <cmath>

int N, i;
int a[101];

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

  std::cin >> N;
  for (i=0; i<N; i++) std::cin >> a[i];

  int total=0;
  double count=0;

  for (i=1; i<N;i++){
    if (a[i]==a[i-1]){
      count += 1;
    }
    else{
      total += (count+(2-1))/2;
      count = 0;
    }
  }
  total += (count+(2-1))/2;
  std::cout << total << '\n';


}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]
use ascii::AsciiChar;
use ascii::AsciiStr;
use itertools::Itertools as _;
use permutohedron::LexicalPermutation as _;
use petgraph::algo::dijkstra;
use petgraph::algo::min_spanning_tree;
use petgraph::data::FromElements;
use petgraph::graph::NodeIndex;
use petgraph::graph::UnGraph;
use petgraph::unionfind::UnionFind;
use proconio::fastout;
use proconio::input;
use proconio::marker::Chars;
use proconio::marker::Usize1;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use superslice::Ext as _;

#[fastout]
fn main() {
    input! {
        N: usize,
        C: usize,
        K: i64,
        mut Ts: [i64; N],
    }

    Ts.sort();

    // 怒るギリギリまで粘るのが最適
    let mut most_waiting_p: usize = 0;
    let mut waiting_persons: usize = 1;
    let mut ans: usize = 0;

    for i in 1..N {
        if waiting_persons == 0 || Ts[i] < Ts[most_waiting_p] + K {
            eprintln!("{} : Wait", i);
            if waiting_persons == 0 {
                most_waiting_p = i;
            }
            waiting_persons += 1;
        } else {
            eprintln!("{} : Go", i);
            while waiting_persons > 0 && Ts[most_waiting_p] + K <= Ts[i] {
                if waiting_persons >= C {
                    let bus = waiting_persons / C;

                    ans += bus;
                    waiting_persons -= C * bus;
                    waiting_persons += 1;
                    most_waiting_p += C * bus;
                } else {
                    // バス1台パターン
                    if Ts[most_waiting_p] + K == Ts[i] {
                        // 飛び乗れる

                        ans += 1;

                        waiting_persons = 0;
                        most_waiting_p = std::usize::MAX; // ダミー
                    } else {
                        ans += 1;

                        waiting_persons = 1;
                        most_waiting_p = i;
                    }
                }
            }
        }
    }

    // 最後に、待っている人たちを全員乗せておわり (切り上げ)
    ans += (waiting_persons + C - 1) / C;

    println!("{}", ans);
}


Measured memory_bytes: 4236
#include <stdio.h>

void sort(int *data)
{
	int i, j, t;
	
	for (i = 0; i < 10; i++){
		for (j = 0; j < 9; j ++){
			if (data[j] < data[j + 1]){
				t = data[j];
				data[j] = data[j + 1];
				data[j + 1] = t;
			}
		}
	}
}



int main(void)
{
	int data[10];
	int i;
	
	for (i = 0; i < 10; i++){
		scanf("%d", &data[i]);
	}
	sort(data);
	printf("%d", data[0] + data[1] + data[2]);

	for (i = 0; i < 10; i++){
		scanf("%d", &data[i]);
	}
	sort(data);
	printf(" %d\n", data[0] + data[1] + data[2]);

	return (0);
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#define rep(i, n)	for(int i = 0; i < (n); i++)
using namespace std;

int main(){
    /*input*/
    int n;  cin >> n;
    /*calculation*/
    int fn = 0;
    int tmp = n;
    while(tmp){
	fn += tmp%10;
	tmp = (tmp - (tmp%10))/10;
    }
    /*output*/
    if(n%fn){
	cout << "No" << endl;
    }else{
	cout << "Yes" << endl;
    }
}


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

using namespace std;

bool alldiv(const vector<int>& v) {
    bool res = true;
    for (int i = 0; i < v.size(); i++) {
        res &= (v[i] % 2 == 0);
    }

    return res;
}

int main() {
    int n;
    while(cin >> n) {

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

        int ans = 0;
        while (alldiv(v)) {
            for (int i = 0; i < v.size(); i++) {
                v[i] /= 2;
            }
            ans++;
        }
        cout << ans << endl;

    }

    return 0;
}

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

int main(void){
	int n;
	int counter=0;

	cin >> n;

	int p[n];

	for(int i=0;i<n;i++){
		cin >> p[i];
	}
	
	for(int i=1;i<n-1;i++){
		if((p[i-1]<=p[i] && p[i]<=p[i+1]) || (p[i-1]>=p[i] && p[i]>=p[i+1])){
			counter++;
		}
	}

	cout << counter << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include <cstdio>
#include<map>
#include<string>
#include<assert.h>
#include<unordered_map>
#include <cstring>//memset();
#define Amr_Abdelazim ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back
#define ll long long
#define ld long double
#define pll pair<ll,ll> 
#define vll vector<ll> 
#define vvll vector<vector<ll> >  
#define vpll vector<pair<ll,ll> > 
#define all(v) v.begin(),v.end()
#define rep(i,n)   for(int i=0;i<n;i++)
#define repp(s,i,n)   for(int i=s;i<n;i++)
#define print(v) for(auto i:v)cout<<i<<" ";cout<<"\n"; 
#define mkp make_pair
#define clr(ar,v) memset(ar,v,sizeof(ar));
#define TC ll t;cin>>t;while(t--)
#define in_vec ll n;cin>>n;vll v(n);rep(i,n)cin >> v[i];
#define EPS 1e-9
using namespace std;
const int mod = 1000000007;
const int N = 1000005;
class cmp{
public:
	bool operator() (pair<ll, pll> &A, pair<ll, pll> &B){
		return A > B;
	}
};
bool by_sec(pll &A, pll &B){
	return A.second < B.second;
}
bool is(pll a, pll b){
	return !((a.first > b.second&&a.second > b.second) || (a.first < b.first&&a.second < b.first));
}
ld dist(pll p1, pll p2){
	return (ld)sqrt((ld)(p1.first - p2.first)*(p1.first - p2.first) + (ld)(p1.second - p2.second)*(p1.second - p2.second));
}
vvll dp(100000 + 2,vector<ll>(100+1,0));
vector<ll>W(100 + 9),val(100+9);
vvll vis(100000 + 2, vector<ll>(100 + 1, 0));
ll n, w;
ll knap(ll d,ll x){
	if (d <= 0)return 0;
	if (x >= n)return 10000000000;
	if (vis[d][x])return dp[d][x];	
	vis[d][x] = 1;
	 dp[d][x] = min(knap(d, x + 1), W[x] + knap(d - val[x], x + 1));
	return dp[d][x];
}
int main()
{
	Amr_Abdelazim	
	cin >> n >> w;	
	rep(i, n)cin >> W[i] >> val[i];
	for (int i = 100000 + 1; i >= 0; i--){
		ll ans = knap(i, 0);
		if (ans<=w)return cout << i << "\n", 0;
	}
	return 0;
}

Measured memory_bytes: 166400
#include <iostream>
#include <cmath>

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

    int n;

    std::cin >> n;
    
    for (; n--;) {
        int h, m;
        char tmp;
        std::cin >> h >> tmp >> m;

        double angle_h, angle_m, diff;

        angle_h = 30. * h + 0.5 * m;
        angle_m = 6. * m;

        diff = std::abs(angle_h - angle_m);

        if (diff > 180.) {
            diff = 360. - diff;
        }

        if (diff < 30.) {
            std::cout << "alert" << std::endl;
        }
        else if (diff < 90.) {
            std::cout << "warning" << std::endl;
        }
        else {
            std::cout << "safe" << std::endl;
        }
    }

    return 0;
}

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

int main()
{
  int cnt =0;
  string s;
  cin >> s;

  for(int i=0;i<4;i++)
    {
      if(s[i] == '+')cnt++;
      else cnt--;
    }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
s = []

for i in range(h):
    S = list(input().split())
    s.append(S)

for i in range(h):
    for j in range(w):
        if s[i][j] == "snuke":
            l = str.upper(chr(ord("a") + j))
            print(l + str(i + 1))
            exit()

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

using namespace std;
typedef long long ll;
int a[200001];
int b[200001];
int n,m;

bool check = false;


int main(){
    
    cin >> n >> m;
    int x,y;
    for(int i=0;i<m;++i){
        cin >> x >> y;
        if(x==1)a[y]=1;
        if(y==1)a[x]=1;
        if(x==n)b[y]=1;
        if(y==n)b[x]=1;
    }
    for(int i=1;i<=n;++i)if(a[i]==1&&b[i]==1)check=true;
    if(check)cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n;
  cin >> n;
  ll a[n], b[n], c[n];
  REP(i,n) cin >> a[i];
  REP(i,n) cin >> b[i];
  REP(i,n) cin >> c[i];
  sort(a,a+n);
  sort(b,b+n);
  sort(c,c+n);
  ll ans = 0;
  REP(i,n){
    ll c_cnt = n - (upper_bound(c,c+n,b[i])- c);
    ll a_cnt = lower_bound(a,a+n,b[i])-a;
    ans += c_cnt*a_cnt;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vv vector<ll>
#define pp pair<ll,ll>
#define ff first
#define ss second
#define vp vector<pp>
#define ld long double
#define pb push_back
#define mp make_pair

int main() 
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ld n,k;
    cin>>n>>k;
    ld ans=0;
    for(ll i=1;i<=n;i++)
    {
    	ll h=i;
    	ll f=0;
    	while(h<k)
    	{
    		h=h*2;
    		f++;
		}
		ans= ans + (1/n)*(1/pow(2,f));
	}
	cout<<fixed<<setprecision(12)<<ans;
    return 0;
}

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;
/* using namespace atcoder; */

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

int main() {
  int k;
  cin >> k;
  rep(i, k) {
    cout << "ACL";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
using namespace std;
int arr[107];

int main(){
	int a , b, c;
	cin >> a >> b >> c;
	int cnt = 0;
	for(int i = 100; i >= 1; i--){
		if(a % i == 0 && b % i == 0){
			cnt++;
			if(cnt == c){
				cout << i;
				break;
			}

		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

ll gcd(ll a, ll b) {
	if (a < b)
		swap(a, b);
	while (ll r = a % b)
		a = b, b = r;
	return b;
}

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

	ll modinv(ll a)
	{
		ll b = max, u = 1, v = 0;
		while (b)
		{
			ll t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= max;
		if (u < 0)
			u += max;
		return u;
	}

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> p(n);
	for (int i = 0; i < n; i++)
		cin >> p[i];

	double sum[1001];
	sum[0] = 0;
	for (int i = 1; i <= 1000; i++)
		sum[i] = sum[i - 1] + i;
	for (int i = 1; i <= 1000; i++)
		sum[i] /= i;

	vector<double> s(n + 1);
	s[0] = 0;
	for (int i = 0; i < n; i++)
		s[i + 1] = sum[p[i]];
	for (int i = 0; i < n; i++)
		s[i + 1] += s[i];
	double r = 0;
	for (int i = 0; i + k <= n; i++)
		if (s[i + k] - s[i] > r)
			r = s[i + k] - s[i];

	printf("%lf", r);

	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

const int maxN = 200000 + 5;
const double PI = acos(-1);
#define ll long long

class TaskC {
private:
	Debugger debugger;

public:
	void solveOne(int it){
		int n;
		cin >> n;
		vector<int> nums(n);
		for(int i = 0; i < n; i++) {
			cin >> nums[i];
		}
		int last = nums[0];
		ll ans = 0;
		for(int i = 0; i < n; i++) {
			if(nums[i] < last) {
				ans += last - nums[i];
			} else {
				last = nums[i];
			}
		}
		cout << ans << endl;

	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskC solver;
	solver.solve();
	return 0;
}


Measured memory_bytes: 4024
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[] a = new int[N];
        int[] b = new int[N];
        int[] c = new int[M];
        int[] d = new int[M];

        for(int i = 0 ;i < N;i++){
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        for(int i = 0 ;i < M;i++){
            c[i] = sc.nextInt();
            d[i] = sc.nextInt();
        }
        int manhattan = 0;
        int manhattan_min = 1000000000;
        int manhattan_count = 0;
        for(int i = 0; i < N; i++){
            manhattan_min = 1000000000;
                for(int j = 0; j < M; j++){
                    manhattan = Math.abs(a[i] - c[j]) + Math.abs(b[i] - d[j]);
                if(manhattan < manhattan_min ){
                    manhattan_min = manhattan;
                    manhattan_count = j;
                }
            }
            System.out.println(manhattan_count + 1);
        }
    }
}

Measured memory_bytes: 23508
R,G,B,N=map(int,input().split())
r,g,b,count=0,0,0,0
for b in range(N+1):
	for g in range(N+1):
		r=-G*g-B*b+N
		if r<0:break
		if (r%R==0): count+=1
print(count)

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

class i_rating
{
public:
	void setNR()
	{
		cin >> N >> R;
	}
	void calculateR()
	{
		if (N < 10)
		{
			cout << R + 100 * (10 - N) << endl;;
		}
		else
		{
			cout << R << endl;
		}
	}
private:
	int N;
	int R;
};

int main()
{
	i_rating r;
	r.setNR();
	r.calculateR();

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int>a(m);
	repp(i, 0, m) {
		cin >> a[i];
		if (i)if (a[i] - 1 == a[i - 1]) {
			cout << "0" << endl;
			return 0;
		}
	}
	ll f[100000];
	f[0] = f[1] = 1;
	for (int i = 2; i <= n; ++i)f[i]= f[i - 1]%mod + f[i - 2]%mod;
	a.push_back(-1); a.push_back(n + 1);
	sort(a.begin(), a.end());
	ll sum = 1;
	for (int i = 1; i < a.size(); ++i) {
		sum *= (f[a[i] - a[i - 1] - 2] % mod);
		sum %= mod;
	}
	cout << sum << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    veci res(3);
    REP(i,3) cin >> res[i];
    sort(res.begin(),res.end());
    cout << (res[2]*10)+res[0]+res[1] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n;cin>>n;
    vector<ll>a(n+1);
    rep(i,n){
        ll b;cin>>b;
        a[b]=i+1;
    }
    set<ll>st1,st2;
    ll ans=0;
    REP(i,1,n+1){
        ll r=n,l=1;
        ll now=a[i];
        auto itr1=st1.lower_bound(now),itr2=st2.lower_bound(-now);
        if(itr1!=st1.end()){
            r=*itr1-1;
        }
        if(itr2!=st2.end()){
            l=1-*itr2;
        }
        //cout<<now<<' '<<l<<' '<<r<<endl;
        ans+=(r-now+1)*(now-l+1)*i;
        st1.insert(now);
        st2.insert(-now);
    }
    cout<<ans<<endl;
}

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

#define ll long long

using namespace std;


int a, b;
int main() {
    cin >> a >> b;
    int sol = 0, c = 1;
    while (c < b) {
        sol++;
        c += a - 1;
    }
    cout << sol;
    return 0;
}


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

int main()
{
  int i,N;
  cin >> N;
  int x,y,ans=0;
  for (i=0;i<N;i++)
  {
    cin >> x >> y;
    ans += y-x+1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n,wei,i,j,k,x,y;
  cin>>n>>wei;
  long long int w[n+2];
  long long int dp[n+2][wei+2];
  for(i=0;i<n+1;i++)
  {
      for(j=0;j<wei+1;j++)
      {
          dp[i][j]=0;
      }
  }
  vector<pair<int,int>> v;
  v.push_back(make_pair(0,0));w[0]=0;
    for(j=0;j<n;j++)
    {
      cin>>x>>y;
      v.push_back(make_pair(x,y));
      w[j+1]=x;
    }
    k=n+1;
  sort(v.begin(),v.end());
  sort(w,w+k);
  for(i=1;i<n+1;i++)
  {
    for(j=1;j<wei+1;j++)
    {
      if(j>=w[i])
      {
        dp[i][j]=max(max(dp[i][j-1],v[i].second+dp[i-1][j-w[i]]),max(dp[i-1][j],dp[i][j-1]));
      }
      else
      {
        dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
      }
    }
  }
  cout<<dp[n][wei];
  return 0;
}

Measured memory_bytes: 79488
//cycle?
//ans=inf:there exists a postive cycle
//ans<inf:the longest path does not contain a cycle:
//postive cycle:inf
//negative cycle:have better answer
//feasible path length<=n-1
#include<cstdio>
#include<cstring>
using namespace std;
const long long inf=2e12;
long long max(long long a,long long b){return a>b?a:b;}
bool pos[1010];
int n,m,i,k,a[2010],b[2010];
long long f[1010],c[2010];
int main()
{
	scanf("%d%d",&n,&m);
	f[1]=0;
	for (i=2;i<=n;i++) f[i]=-inf;
	for (i=1;i<=m;i++) scanf("%d%d%lld",&a[i],&b[i],&c[i]);
	for (k=1;k<=n;k++)
	  for (i=1;i<=m;i++)
	  {
	    if (f[a[i]]==-inf) continue; 
	    f[b[i]]=max(f[b[i]],f[a[i]]+c[i]);
	  }
	long long ans=f[n];
	//pos[n]:positve cycle in some path from 1 to n?
	//postive cycle starting from i to itselt?
	//update the maximum by adding at most n-1 edges?
	memset(pos,0,sizeof(pos));
	for (k=1;k<=n;k++)
      for (i=1;i<=m;i++)
      {
      	if (f[a[i]]==-inf) continue;
      	if (f[a[i]]+c[i]>f[b[i]])
      	{
      		f[b[i]]=f[a[i]]+c[i];
      		pos[b[i]]=1;
		}
		if (pos[a[i]]) pos[b[i]]=1;
	  }
    if (pos[n]) printf("inf\n");
    else printf("%lld\n",ans);
}

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

int gcd(int a,int b)
{
    while(b!=0)
    {
        int tmp=a%b;
        a=b;
        b=tmp;
    }
    return a;
}

int main(void){
    // Your code here!
    int N;
    int ans;
    cin>>N;
    vector<int> a(N);   
    vector<int> v(N,0);
    vector<int> w(N,0);
    
    for(int i=0;i<N;i++)
    {
        cin>>a[i];
    }
    
    v[0]=a[0];
    
    for(int i=1;i<N;i++)
    {
        v[i]=gcd(a[i],v[i-1]);  //i番目までの最大公約数を求めて格納
    }
    
    w[N-1]=a[N-1];
    
    for(int i=N-2;i>=0;i--)
    {
        w[i]=gcd(w[i+1],a[i]);   //i番目からの最大公約数を求めて格納
    }
    
    ans=w[1];
    
    for(int i=1;i<N;i++)
    {
        ans=max(ans,gcd(v[i-1],w[i+1]));    //i番目を排除したときの公約数を順次求め、最大値をansに格納
    }
    
    cout<<ans;
    
    
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;}
using ll = long long;

ll n,m,k,a,sum;
string s,t;
set<string> se;

int main() {
  cin >> n;
  rep(i,n) cin >> s, se.insert(s);
  cout << se.size() << endl;
}

Measured memory_bytes: 19228
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
int main()
{

    int n;
    cin>>n;
    int a[n];

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

    sort(a,a+n);
    int c = 0;

    for(int i = 0;i<n;i++)
    {
        for(int j = i+1;j<n;j++)
        {
            for(int k = j+1;k<n;k++)
            {
                if(a[i]!=a[j] && a[j]!=a[k])
                if( ( (a[i]+a[j])>a[k]) && ((a[k]+a[j])>a[i]) && ((a[k]+a[i])>a[j]))
                {

                    c++;
                }
            }
        }
    }
    cout<<c;
}


Measured memory_bytes: 3600
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define MOD 1000000007
typedef long long ll;
using namespace std;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    ll x; 
    cin >> n >> x;
    ll A[100100];
    for(int i=0;i<n;i++) cin >> A[i];
    ll B[100100];
    B[0] = A[0] > x ? x : A[0];
    for(int i=0;i<n-1;i++){
        if(B[i]+A[i+1] > x) B[i+1] = x - B[i]; 
        else B[i+1] = A[i+1];
    }   
    ll ans = 0;
    for(int i=0;i<n;i++) ans += abs(A[i] - B[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

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




Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

int main() {

    ll cnt = 0;
    string s;
    cin >> s;
    ll ans = 0;
    set<char> lis = {'A', 'C', 'G', 'T'};
    for (ll i=0;i<s.length();i++){
        auto memo = lis.find(s[i]);
        if(memo == lis.end()){
            cnt = 0;
        }else{
            cnt += 1;
        }
        if(cnt > ans){
            ans = cnt;
        }
    }
    if(cnt > ans){
        ans = cnt;
    }
    cout << ans << endl;


}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int t,sum;
  cin>>t;
  if(t%1000==0)
  {
    cout<<0<<endl;
  }
  else
  {
    sum=t/1000;
    sum=sum+1;
    sum=(sum*1000)-t;
    cout<<sum<<endl;
   
  }
  return 0;
  
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;  //単位は円
  int A;  //1円玉の枚数
  cin >> N;
  cin >> A;
  
  //500円で割った余り
  int s;
  s = N % 500;
  
  if (s <= A ) {
  	cout << "Yes" << endl;
  } else {
  	cout << "No" << endl;
  }
}

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

int main() {
  int n;
  std::cin >> n;
  int a[n];
  
  for(int i=0; i<n; i++) {
    std::cin >> a[i];
  }
  
  int i = 0;
  int flag = 0;
  int count = 0;
  while(1) {
    for(int ii=0; ii<n; ii++) {
      if(a[ii]%2 == 1) {
        flag = 1;
        break;
      }
      else
        a[ii] /= 2;
    }
    if(flag == 0)
      count++;
    else
      break;
  }
  std::cout << count;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    int d[100], n;
    int mochi_size, buff, max_ichi, count;
    int i,j;
    int ret;
    
    memset(d,0,sizeof(d));
    count = 0;
    mochi_size = 0;
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++)
    {
         ret = scanf("%d",&d[i]);
         if ( ret == EOF )
         {
               d[i] = 0;
               //break;
         }
    }
    
    for(i=0;i<n;i++)
    {
         mochi_size = 0;
         
         for(j=i;j<n;j++)
         {
             if(d[j]>mochi_size)
             {
                 mochi_size = d[j];
                 max_ichi = j;
             }
         }
                  
         buff = d[i];
         d[i] = mochi_size;
         d[max_ichi] = buff;
    }
   
    for(i=1;i<n;i++)
    {
         if(d[i]<d[i-1]){
              count++;
         }
    }
    
    printf("%d",count+1);
    
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
const lli mod=1e9+7;
const lli INT=1e15;
const lli pINF=LLONG_MAX;
const lli nINF=-LLONG_MAX;
void fast() {std::ios::sync_with_stdio(false);cin.tie(NULL);}
lli power(lli a,lli b){lli ans=1;while(b!=0){ if(b%2==1){ans*=a;}b/=2;a*=a;} return ans;}
lli invmod(lli a) {return pow(a,mod-2);}
#define vi vector<int>
#define vlli vector<lli>
#define PII pair<int,int>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define sli(n) scanf("%lld",&n)
#define printi(n) printf("%d\n",n)
#define printli(n) printf("%lld\n",n)
#define all(v) v.begin(),v.end()
#define forn(i,n) for(int i=0;i<n;i++)
void print(int a[],int n){for(int i=0;i<n;i++) cout<<a[i]<<" ";}
int a[100005];
map<int,int> m;

int main()
{
    int n;
    si(n);
    
    for(int i=0;i<n;i++){
        si(a[i]);
        m[a[i]]++;
    }
    
    sort(a,a+n);
    lli ans=0;
    int x=0;
    for(int i=n-1;i>=0;i--){
        if(m[a[i]]>=4){
            if(x==1) ans*=1LL*a[i];
            else ans=1LL*a[i]*a[i];
            cout<<ans<<endl;
            return 0;
        }
        else if(m[a[i]]>=2 && m[a[i]]<4){
            if(x==0) ans=1LL*a[i];
            else{
                ans*=1LL*a[i];
                cout<<ans<<endl;
                return 0;
            }
            x=1;
            m[a[i]]-=2;
        }
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5376
S = input()

ame = 0
if S[0] =="R":
    ame = 1
    if S[1] == "R":
        ame = 2
        if S[2] == "R":
            ame = 3
else:
    if S[1] == "R":
        ame = 1
        if S[2] == "R":
            ame = 2
    elif S[2] == "R":
        ame = 1
print(ame)


Measured memory_bytes: 61648
s = input()
t = input()

s = sorted(s)
t = sorted(t, reverse = True)

s = list(map(lambda x : ord(x), s))
t = list(map(lambda x : ord(x), t))

i = 0
while i < min(len(s), len(t)):
    if s[i] < t[i]:
        print('Yes')
        break
    elif s[i] == t[i]:
        i += 1
    else:
        print('No')
        break
if i == min(len(s), len(t)):
    if len(s) < len(t):
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String S = sc.nextLine();

		int count = 0;
		char preC = S.charAt(0);
		char[] sChar = S.toCharArray();
		for (int i = 1; i < S.length(); i++) {
			char c = sChar[i];
			if (c == preC) {
				count++;
				if (c == '0') {
					preC = '1';
				} else {
					preC = '0';
				}
			} else {
				preC = c;
			}
		}

		System.out.println(count);
	}

}

Measured memory_bytes: 26180
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int main(){
  int N;
  cin >> N;
  int ans = 0;
  set<int> st;
  rep(i,0,N - 1){
    int a;
    cin >> a;
    a /= 400;
    if(a >= 8){
      ans++;
    }
    else{
      st.insert(a);
    }
  }

  if(st.size() > 0){
    cout << st.size() << " ";
  }
  else{
    cout << 1 << " ";
  }

  cout << st.size() + ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define li long long
#define itn int
 
using namespace std;
 
inline int nxt(){
	int n;
	scanf("%d", &n);
	return n;
}

template <typename T>
ostream& operator <<(ostream& ostr, const vector<T>& a) {
	ostr << "(";
	for (size_t i = 0; i < a.size(); ++i) {
		if (i) {
			ostr << ", ";
		}
		ostr << a[i];
	}
	ostr << ")";
	return ostr;
}

int main() {
	int q = nxt(), h = nxt(), s = nxt(), d = nxt(), n = nxt();
	h = min(h, q * 2);
	s = min(s, h * 2);
	d = min(d, s * 2);
	cout << 1ll * (n / 2) * d + n % 2 * s << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
while(1){
    int h,w;
    scanf("%d%d",&h,&w);
    if(h==0&&w==0)
    break;
    
    int i,j;
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            printf("#");
        }
        printf("\n");
    }
    printf("\n");
}
return 0;
}

Measured memory_bytes: 2600
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
max = 0
for i in range(n):
    if(sum(a[:i+1]) + sum(b[i:]) > max):
        max = sum(a[:i+1]) + sum(b[i:])
print(max)

Measured memory_bytes: 3060
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		for(int i = 0; i < s.length; i++) {
			if(i % 2 == 0 && s[i] == 'L') {
				System.out.println("No"); return;
			}
			else if(i % 2 != 0 && s[i] == 'R') {
				System.out.println("No"); return;
			}
		}
		System.out.println("Yes");
	}

}


Measured memory_bytes: 23764
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;


/* TEMPLATE ENDS HERE */

int main() {
	cout << fixed << setprecision(12);	
	int l, r, d;
	cin >> l >> r >> d;
	int ret = 0;
	for (int i = l; i <= r; i++) {
		if (i % d == 0) {
			ret++;
		}
	}
	cout << ret << endl;
	return 0;
}


ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
		x %= MOD;
	}
	
	mod& operator=(const ll & tx) {
		x = tx % MOD;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return mod((x + m2.x) % MOD);
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return mod((x - m2.x + MOD) % MOD);
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return mod((x * m2.x) % MOD);
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return (*this) * m2.inv();
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}



Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<stdlib.h>
using namespace std;

int main() {
  string str;
  long int sum = 0;
  cin >> str;
  for(int i = 0; i < str.length(); i++) {
    sum += (int)(str.at(i)) - 48;
  }
  if(sum % 9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

class Program
{
    public static void Main()
    {
        var n = ReadLine().Split().Select(int.Parse).ToArray();
        var h = n[0];
        var w = n[1];
        var k = n[2];
        var a = new bool[h, w];
        var work = new bool[h, w];
        int sum = 0;
        for(int i = 0; i < h; i++)
        {
            var s = ReadLine();
            for(int j = 0; j < w; j++)
            {
                a[i, j] = s[j] == '#';
            }
        }
        for(int i = 0; i < 1 << h; i++)
        {
            for(int j = 0; j < 1 << w; j++)
            {
                for(int y = 0; y < h; y++)
                {
                    for(int x = 0; x < w; x++)
                    {
                        work[y, x] = a[y, x];
                    }
                }

                var s = Convert.ToString((byte)i, 2).PadLeft(h, '0');
                for(int y = 0; y < h; y++)
                {
                    if(s[y] == '1')
                    {
                        for(int x = 0; x < w; x++)
                        {
                            work[y, x] = false;
                        }
                    }
                }
                s = Convert.ToString((byte)j, 2).PadLeft(w, '0');
                for(int x = 0; x < w; x++)
                {
                    if(s[x] == '1')
                    {
                        for(int y = 0; y < h; y++)
                        {
                            work[y, x] = false;
                        }
                    }
                }
                int temp = 0;
                for(int y = 0; y < h; y++)
                {
                    for(int x = 0; x < w; x++)
                    {
                        if(work[y, x])
                            temp++;
                    }
                }
                if(temp == k)
                    sum++;
            }
        }

        WriteLine(sum);
        ReadLine();
    }
}


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

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

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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 (a>b) { a=b; return 1; } return 0; }

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

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cerr<<v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

struct neg{
	ll base, a, b;
	bool operator<(const neg &right)const{
		return base < right.base;
	}
};

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

    ll N;
    cin >> N;
    vector<string> S(N);
    REP(i, N) cin >> S[i];

    vector<pll> pos_task, neg_task;
    REP(i, N){
        ll tomi = 0;
        ll tot = 0;
        REP(j, S[i].size()){
            if(S[i][j] == '(') tot++;
            else tot--;

            chmin(tomi, tot);
        }

        ll x;
        if(tomi<0) x = -tomi;
        else x = 0;
        ll y = tot;

        //dump(x)
        //dump(y)

        if(y>=0) pos_task.push_back({x, y});
    	else neg_task.push_back({x, y});
    }

    ll r = 0;
    sort(pos_task.begin(), pos_task.end());
    REP(i, pos_task.size()){
    	if(pos_task[i].first <= r){
    		r += pos_task[i].second;
    	}else{
    		cout << "No" << endl;
    		return 0;
    	}
    }

    ll m = neg_task.size();
    vector<neg> negs;
    REP(i, m){
    	neg tmp = {max(neg_task[i].first+neg_task[i].second, 0ll), neg_task[i].first, neg_task[i].second};
    	negs.push_back(tmp);
    }
 
    sort(negs.rbegin(), negs.rend());
    REP(i, m){
    	if(negs[i].a <= r){
    		r += negs[i].b;
    	}else{
    		cout << "No" << endl;
    		return 0;
    	}
    }

    if(r==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 68508
#include <bits/stdc++.h>
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<28;
const long long MOD =1000000000+7;
void solve(int a){cout<<( a?"Yes":"No")<<endl;}
int main(){
    int n;
    cin >>n;
    string last="\0";
    string bef;
    int most=0;
    map<string,int> vote;
    for(int i=0;i<n;i++){
        cin >>bef;
        vote[bef]+=0;
        vote[bef]+=1;
    } 

    for (auto itr= vote.begin(); itr != vote.end(); itr++){
        chmax(most,itr->second);
    }
    for (auto itr = vote.begin(); itr != vote.end(); itr++)
    {
       if(itr->second==most){
           cout<<itr->first<<endl;
       }
    }
}

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

int main() {
	int n, k, x = 1;
	cin >> n >> k;
	for(int i = 0; i < n; i++) {
		if(x > k) {
			x +=k;
		}
		else {
			x *= 2;
		}
	}
	cout << x << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int ,int> P;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	int N;
	cin >> N;
	int minimum = k_mod;
	int cnt = 0;
	rep(i,0,N){
		int input;
		cin >> input;
		if (input <= minimum){
			cnt++;
		}
		minimum = min(minimum, input);
	}
	cout << cnt << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


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

int solnA(int n,vector<int>& arr){
	int dp[n];
	if(n<2) return 0;
	dp[n-1]=0;
	dp[n-2]=abs(arr[n-1]-arr[n-2]);
	for(int i=n-3;i>=0;i--){
		dp[i] = min(abs(arr[i]-arr[i+1])+dp[i+1],abs(arr[i]-arr[i+2])+dp[i+2]);
	}
	return dp[0];
}
int main(){
	int n;
	cin>>n;
	vector<int> arr(n);
	for(int i=0;i<n;i++) cin>>arr[i];
	cout<<solnA(n,arr)<<endl;
}

Measured memory_bytes: 4012
#include <iostream>
using namespace std;
int main(){
    int a,b,c,count=0,n;
    cin>>n;
    while(cin>>a>>b>>c){
        count++;
    if(a*a==b*b+c*c||b*b==c*c+a*a||c*c==a*a+b*b)  cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
        if(count==n)break;
    }
}

Measured memory_bytes: 3128
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep4(i, a, b, c) for (int i = int(a), i##__b = int(b), i##__c = int(c); i < i##__b; i += i##__c)
#define rep1(n) rep4(i, 0, n, 1)
#define rep2(i, n) rep4(i, 0, n, 1)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define REP(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep3(i, a, b) for (int i = int(b) - 1, i##__a = int(a); i >= i##__a; i--)
#define rrep1(n) rrep3(i, 0, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep4(i, a, b, c) for (int i = int(a + (b - a - 1) / c * c), i##__a = int(a), i##__c = int(c); i >= i##__a; i -= i##__c)
#define RREP(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define FOR(i, x) for (auto &i : x)
#define ALL(v) (v.begin()), (v.end())
#define pb(x) emplace_back(x)
#define mp(x, y) make_pair(x, y)
#define mt make_tuple
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vbool = vector<bool>;
using vvbool = vector<vector<bool>>;
using vstring = vector<string>;
template <class T> using vec = vector<T>;
template <class T> using vv = vector<vector<T>>;
template <class T> using pq = priority_queue<T>;
template <class T> using rpq = priority_queue<T, vector<T>, greater<T>>;
#define vvint(A, H, W) vvint A(H, vint(W))
const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
const ll LINF = 1e18;
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;}
template <class T> void print(T x){cout<<x<<endl;}
// clang-format on

int N;
vint w;
vvint dp;

int rec(int l = 0, int r = N) {
    int d = r - l;
    if (d <= 1) return 0;
    if (d == 2) {
        if (abs(w[l] - w[l + 1]) <= 1)
            return 2;
        else
            return 0;
    }

    int &ret = dp[l][r];
    if (ret != -1) return ret;
    if (abs(w[l] - w[r - 1]) <= 1 && rec(l + 1, r - 1) == d - 2) {
        chmax(ret, d);
    } else {
        REP(i, l + 1, r) {
            chmax(ret, rec(l, i) + rec(i, r));
        }
    }
    return ret;
}

int main() {
    while (cin >> N && N) {
        w.resize(N);
        REP(N) {
            cin >> w[i];
        }
        dp.assign(N + 2, vint(N + 2, -1));
        print(rec());
    }
}


Measured memory_bytes: 3252
program division_by_two_with_something
  implicit none
  integer(8), parameter :: md = 998244353_8
  integer :: n, i, j, k, w, x(200000) = 0, s(200000)
  character(200000) :: tmp
  integer(8) :: a(200000) = 0_8, ans = 0_8, pow(0:200000) = 0_8
  logical :: ok
  pow(0) = 1_8
  read(*,*) n
  read(*,*) tmp
  do i = 1, n
    pow(i) = mod(2_8*pow(i-1),md)
    x(i) = ichar(tmp(i:i))-48
    ans = mod(2_8*ans+int(x(i),8),md)
  end do
  ans = mod((ans+1_8)*int(2*n,8),md)
  do i = n-1, 1, -1
    if (mod(n,i) /= 0 .or. mod(n/i,2) == 0) cycle
    s = 0
    do j = 1, i
      w = x(j)
      if (w == 1) a(i) = mod(a(i)+pow(i-j),md)
      do k = j, n, i
        s(k) = w
        w = xor(w,1)
      end do
    end do
    ok = .true.
    do j = 1, n
      if (s(j) /= x(j)) then
        ok = s(j) < x(j)
        exit
      end if
    end do
    if (ok) a(i) = mod(a(i)+1_8,md)
  end do
  do i = 1, n-1
    if (mod(n,i) /= 0 .or. mod(n/i,2) == 0) cycle
    ans = modulo(ans-int(2*(n-i),8)*a(i),md)
    do j = 2*i, n-1, i
      a(j) = modulo(a(j)-a(i),md)
    end do
  end do
  write(*,'(i0)') ans
end program division_by_two_with_something

Measured memory_bytes: 5388
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  if(n == 3 || n == 5 || n == 7)cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
import sys
from heapq import *
sys.setrecursionlimit(10**8)

input = sys.stdin.readline

tree = [[] for _ in range(200001)]
res = [0]*200001

def dfs(p, pre):
    for child in tree[p]:
        if child == pre: continue
        res[child] += res[p]
        dfs(child, p)

def main():
    """ main """
    N, Q = map(int, input().split())
    for _ in range(N-1):
        a,b = map(int, input().split())
        tree[a].append(b)
        tree[b].append(a)
    for _ in range(Q):
        p,x = map(int, input().split())
        res[p] += x
    dfs(1, 0)

    print(*res[1:N+1])

if __name__ == '__main__':
    main()


Measured memory_bytes: 230956
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#include<queue>
#define int long long
using namespace std;

const int INF = 1e10;
const int ZERO = 0;

signed main() {
	int N,A,B;
	cin >> N >> A >> B;
	if((B - A - 1) % 2 == 1) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Borys" << endl;
	}
}	



Measured memory_bytes: 256