akhauriyash/Code-Regression huggingface dataset:
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0){
				break;
			}
			int[][] students = new int[n][n];
			boolean[][] tallest = new boolean[n][n];
			boolean[][] shortest = new boolean[n][n];
			int[][] x = new int[n][n];
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					students[i][j] = sc.nextInt();
				}
			}
			
			for(int i = 0; i < n; i++){
				int columnMax = -1;
				for(int j = 0; j < n; j++){
					if(columnMax < students[j][i]){
						columnMax = students[j][i];
                    }
				}
/*				if(columnMax == students[maxj][i]){
					tallest[maxj][i] = true;
					x[maxj][i] |= 2;
				}
*/				for(int j = 0; j < n; j++){
					if(columnMax == students[j][i]){
						tallest[j][i] = true;
						x[j][i] |= 2;
					}
				}
			}
			for(int i = 0; i < n; i++){
				int rowMin = Integer.MAX_VALUE;
				for(int j = 0; j < n; j++){
					if(rowMin > students[i][j]){
						rowMin = students[i][j];
                    }
				}
/*				if(rowMin == students[i][minj]){
					shortest[i][minj] = true;
					x[i][minj] |= 1;
				}
*/				for(int j = 0; j < n; j++){
					if(rowMin == students[i][j]){
						shortest[i][j] = true;
						x[i][j] |= 1;
					}
				}
			}
			
			Set<Integer> both = new HashSet<Integer>();
            for(int i = 0;i < n;i++){
                for(int j = 0;j < n;j++){
                    if(x[i][j] == 3){
                        both.add(students[i][j]);
                    }
                }
            }
			
            if(both.size() == 1){
            	StringBuilder sb = new StringBuilder();
                for(int v : both){
                    sb.append(v + " ");
                }
                sb.deleteCharAt(sb.length() - 1);
                System.out.println(sb);
            }else{
            	System.out.println(0);
            }
/*			boolean noAns = true;
			StringBuilder sb = new StringBuilder();
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					if(shortest[i][j] && tallest[i][j]){
						sb.append(students[i][j] + " ");
						noAns = false;
					}
				}
			}
			
			if(noAns){
				System.out.println(0);
			}else{
				sb.deleteCharAt(sb.length() - 1);
				System.out.print(sb);
			}
*/		}
		
	}
}

Measured memory_bytes: 19984
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;
int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    ll ans = 0;
    rep(i, n - 1)
    {
        ans += min(a * (v[i + 1] - v[i]), b);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
//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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;


void chmax(pii *a, pii b) {
	VI tmp;
	tmp.push_back(a->first);
	tmp.push_back(a->second);
	tmp.push_back(b.first);
	tmp.push_back(b.second);
	rSORT(tmp);
	*a = { tmp[0],tmp[1] };
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N; cin >> N;
	VI A(1 << N);
	VP dp;
	REP(i, 1 << N) {
		cin >> A[i];
		dp.push_back(pii(A[i], -INF));
	}

	REP(i, N) {
		REP(j, (1 << N)) {
			if (j&(1 << i))chmax(&dp[j], dp[j ^ (1 << i)]);
		}
	}
	

	int ans = -INF;
	FOR(i, 1, 1 << N) {
		//cout << dp[i].first << " " << dp[i].second << endl;;
		ans = max(ans, dp[i].first + dp[i].second);
		cout << ans << '\n';
	}

	return 0;
}



Measured memory_bytes: 9324
h,w=map(int,input().split())
M=[]
for i in range(h):
    s=input()
    H=[]
    for j in range(w):
        H.append(0) if s[j]=="." else H.append(1)
    M.append(H)

def make2D(x,y):
    aM=[]
    for i in range(h):
        aH=[]
        for j in range(w):
            aH.append(0) if M[i][j]==0 else aH.append(-1)
        aM.append(aH)
    return aM

from collections import deque
ans=0
for i in range(h):
    for j in range(w):
        if M[i][j]==1:
            continue
        aM=make2D(h,w)
        q=deque()
        q.append([i,j])
        while q:
            now=q.popleft()
            for a,b in ([0,1],[1,0],[0,-1],[-1,0]):
                if 0<=now[0]+a<h and 0<=now[1]+b<w:
                    if aM[now[0]+a][now[1]+b]==0 and (now[0]+a!=i or now[1]+b!=j):
                        aM[now[0]+a][now[1]+b]=aM[now[0]][now[1]]+1
                        q.append([now[0]+a,now[1]+b])
            if len(q)==0:
                break
        m=0
        for z in range(h):
            m=max(m,max(aM[z]))
        ans=max(ans,m)
print(ans)

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

bool is5theq1st(int a){
    //11011の最初の値と最後の値
    return (a / 10000 == a % 10);
}

bool is4theq2nd(int a){
    //11011の最初の2番目と後ろから2番目の値
    int tmp = a / 10000;//tmp = 1
    int b = a - (tmp * 10000);//b = 1011
    tmp = a / 100;//tmp = 110
    int c = a - (tmp * 100);//11011-11000 = 11
    // b / 1000 == 1 
    //c / 10 == 1
    return (b / 1000 == c / 10); 
}

int main(){
    int a;
    int b;
    cin >> a;
    cin >> b;
    int count = 0;
    for(; a <= b; a++){
        if(is5theq1st(a) && is4theq2nd(a)){
           count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-10;
const vi emp;

int n,m;
vi a;

void cut(int t){
	for(int i=0;i<t;i++){
		a.push_back(a[i]);
	}
	a.erase(a.begin(),a.begin()+t);
}

void shuffle(){
	vi tmp(2*n);
	for(int i=0;i<2*n;i++){
		if(i%2==0) tmp[i]=a[i/2];
		else tmp[i]=a[i/2+n];
	}
	a=tmp;
}

int main(){
	cin>>n>>m;
	a=vi(2*n);
	for(int i=1;i<=2*n;i++) a[i-1]=i;
	int t;
	for(int i=0;i<m;i++){
		cin>>t;
		if(t) cut(t);
		else shuffle();
	}
	for(auto i=a.begin();i!=a.end();i++) cout<<*i<<endl;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return 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 (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;


int main(){
    ll A, B, C, X;
    cin >> A >> B >> C >> X;
    ll res = 0;
    REP(a, A+1) {
        REP(b, B+1) {
            REP(c, C+1) {
                if (X == 500*a+100*b+50*c) res++;
            }
        }
    }
    cout << res << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 998244353;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
int N;
struct Bit {
  vector<int> bit;
  Bit(int N) : bit(N+1) {};
  void add(int a, int w) {
    while(a <= N) {
      bit[a] += w;
      a += a & -a;
    }
  }
  int sum(int a) {
    int s = 0;
    while(a > 0) {
      s += bit[a];
      a -= a & -a;
    }
  return s;
  }
};
lint power(lint x, lint n, lint mod) {
  lint ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  vector<P> p(N);
  REP(i, N) {
    lint X, Y;
    cin >> X >> Y;
    //X = i ; Y = i;
    p[i] = make_pair(X, Y);
  }
  sort(ALL(p), [](auto const &a, auto const &b) { return a.second < b.second; });
  map<lint, lint> ymap;
  REP(i, N) ymap[p[i].second] = i;
  sort(ALL(p));
  vector<lint> y(N);
  REP(i, N) y[i] = ymap[p[i].second];
  vector<lint> cnt(N);
  Bit bitleft(N);
  Bit bitright(N);
  FOR(i, 1, N+1) bitright.add(i, 1);
  REP(i, N) {
    cnt[i] = (cnt[i] + power(2, i, MOD) - 1 + MOD) % MOD;
    cnt[i] = (cnt[i] + power(2, N-1-i, MOD) - 1 + MOD) % MOD;
    cnt[i] = (cnt[i] + power(2, y[i], MOD) - 1 + MOD) % MOD;
    cnt[i] = (cnt[i] + power(2, N-1-y[i], MOD) - 1 + MOD) % MOD;
    bitright.add(y[i]+1, -1);
    cnt[i] = (cnt[i] - power(2, bitleft.sum(y[i]+1), MOD) + 1 + MOD) % MOD;
    cnt[i] = (cnt[i] - power(2, bitleft.sum(N) - bitleft.sum(y[i]+1), MOD) + 1 + MOD) % MOD;
    cnt[i] = (cnt[i] - power(2, bitright.sum(y[i]+1), MOD) + 1 + MOD) % MOD;
    cnt[i] = (cnt[i] - power(2, bitright.sum(N) - bitright.sum(y[i]+1), MOD) + 1 + MOD) % MOD;
    bitleft.add(y[i]+1, 1);
  }
  lint ans = 0;
  REP(i, N) ans = (ans + power(2, N, MOD) - 1 - cnt[i] + MOD) % MOD;
  cout << ans << endl;
}

Measured memory_bytes: 21888
#include<iostream>
#include<vector>

using namespace std;

int dfs(int u, int dp[], vector<int> adj[]){
    if(dp[u]!=-1)
        return dp[u];
    int ans = 0;
    if(adj[u].empty()){
        dp[u] = 0;
        return dp[u];
    }
    for(auto itr:adj[u]){
        ans = max(ans , dfs(itr, dp, adj));
    }
    dp[u] = ans+1;
    return dp[u];
}

int main(){
    int i,n,m,u,v,ans=0;
    cin>>n>>m;
    vector<int> adj[n+1];
    for(i=0;i<m;i++){
        cin>>u>>v;
        adj[u].push_back(v);
    }
    int dp[n+1];
    for(i=1;i<=n;i++)
        dp[i]=-1;
    for(i=1;i<=n;i++){
        ans = max(ans, dfs(i, dp, adj));
    }
    cout<<ans;
}

Measured memory_bytes: 8832
#include<iostream>
#include<algorithm>
#include<iomanip>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <new>
#include <cmath>
#include<fstream>
using namespace std;
const long long MAXN = 200, mod = 1000000007, inff = 1000000007;
long long n, m, x1, yy, x2, y2, x, y , d, z , mini, dist[MAXN], di[MAXN][MAXN], edg[MAXN][MAXN], inf = 1000000000000000000;
pair <long long, pair<long long, long long> > edge[100000];
bool is[MAXN][MAXN];
bool iscycle()
{
	for (int i = 0; i < n; i++)
	{
		dist[i] = inf;
	}
	dist[0] = 0;
	long long mmm = m + n + 1;
	while (mmm--)
	{
		for (int i = 0; i < m; i++)
		{
			x = edge[i].second.first;
			y = edge[i].second.second;
			d = edge[i].first;
			if (dist[x] != inf)
			dist[y] = min(dist[y], dist[x] + d);
		}
	}
	for (int i = 0; i < m; i++)
	{
		x = edge[i].second.first;
		y = edge[i].second.second;
		d = edge[i].first;
		if (dist[x] != inf && dist[y] > dist[x] + d)
		{
			return true;
		}
	}
	return false;
}
int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		cin >> x >> y >> d;
		edg[x][y] = d;
		edge[i].first = d;
		edge[i].second.first = x;
		edge[i].second.second = y;
		is[x][y] = true;
	}
	if (iscycle())
	{
		cout << "NEGATIVE CYCLE" << endl;
	}
	else
	{
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				if (i == j) di[i][j] = 0;
				else if (is[i][j]) di[i][j] = edg[i][j];
				else di[i][j] = inf;
			}
		}
		for (int k = 0; k < n; k++)
		{
			for (int i = 0; i < n; i++)
			{
				for (int j = 0; j < n; j++)
				{
					if (di[i][k] != inf && di[k][j] != inf)
					di[i][j] = min(di[i][j], di[i][k] + di[k][j]);
				}
			}
		}
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				if (di[i][j] == inf) cout << "INF";
				else cout << di[i][j];
				if (j != n-1)cout << " ";
			}
			cout << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3596
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int H, W, Q;
bool S[3000][3000];
int T[3000][3000];

int tate[3000][3000];
int yoko[3000][3000];

int nodes(int ax, int ay, int bx, int by) {
  int n = T[bx][by];
  if (ax>0) n -= T[ax-1][by];
  if (ay>0) n -= T[bx][ay-1];
  if (ax>0&&ay>0) n += T[ax-1][ay-1];
  return n;
}

int edges_tate(int ax, int ay, int bx, int by) {
  by--;
  int n = 0;
  if(bx>=0&&by>=0) n += tate[bx][by];
  if(ax>0&&by>=0) n -= tate[ax-1][by];
  if(ay>0&&bx>=0) n -= tate[bx][ay-1];
  if(ax>0&&ay>0) n += tate[ax-1][ay-1];
  return n;
}

int edges_yoko(int ax, int ay, int bx, int by) {
  bx--;
  int n = 0;
  if(bx>=0&&by>=0) n += yoko[bx][by];
  if (ax>0&&by>=0) n -= yoko[ax-1][by];
  if (ay>0&&bx>=0) n -= yoko[bx][ay-1];
  if (ax>0&&ay>0) n += yoko[ax-1][ay-1];
  return n;
}
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> H >> W >> Q;
  rep(y, H) {
    rep(x, W) {
      char c;
      cin >> c;
      S[x][y] = c == '1';
      T[x][y] = S[x][y];
    }
  }
  rep(y, H) {
    rep(x, W-1) {
      if (S[x][y] && S[x+1][y]) yoko[x][y]++;
    }
  }
  rep(x, W) {
    rep(y, H-1) {
      if (S[x][y] && S[x][y+1]) tate[x][y]++;
    }
  }
  rep(y, H) {
    for (int x=1; x<W; x++) {
      T[x][y] += T[x-1][y];
      yoko[x][y] += yoko[x-1][y];
      tate[x][y] += tate[x-1][y];
    }
  }
  rep(x, W) {
    for (int y=1; y<H; y++) {
      T[x][y] += T[x][y-1];
      yoko[x][y] += yoko[x][y-1];
      tate[x][y] += tate[x][y-1];
    }
  }
  rep(i, Q) {
    int ax, ay, bx, by;
    cin >> ay >> ax >> by >> bx;
    ax--, ay--, bx--, by--;
    //cout<<"("<<ax<<","<<ay<<")->("<<bx<<","<<by<<")\n";
    int n = nodes(ax, ay, bx, by);
    int e = edges_tate(ax, ay, bx, by)+edges_yoko(ax, ay, bx, by);
    //cout<<"nodes="<<n<<", edges="<<e<<"\n";
    cout<<n-e<<"\n";
  }
  return 0;
}


Measured memory_bytes: 83712
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main(void) {
	int R[MAX], n;

	cin >> n;
	for (int i = 0; i < n; i++)cin >> R[i];
	
	int maxv = -2000000000;
	int minv = R[0];

	for (int i = 1; i < n; i++) {
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}

	cout << maxv << endl;

	return 0;
}

Measured memory_bytes: 3864
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

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



Measured memory_bytes: 512
# coding: utf-8
# Your code here!
a,b=map(int,input().split())
S=list(input())
ans='Yes'
for i in range(a+b):
    if i==a:
        if S[i]!='-':
            ans='No'
            break
        else:
            continue
    if S[i]=='0'or S[i]=='1' or S[i]=='2'or S[i]=='3' or S[i]=='4'or S[i]=='5' or S[i]=='6'or S[i]=='7' or S[i]=='8'or S[i]=='9':
        continue
    else:
        ans='No'
        break
print(ans)
#print(S)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
long long n,a,b,ans;
int main()
{
	scanf("%lld%lld%lld",&n,&a,&b);
	ans=n/(a+b)*a; n%=(a+b);
	printf("%lld\n",ans+min(n,a));
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
	int n;
	double v,t,sokudo;
	while(scanf("%lf",&sokudo)!=EOF)
	{
		n=0;
		while(1)
		{
			t=(5*n-5)/4.9;
			t=sqrt(t);
			v=9.8*t;
			if(v>=sokudo)
				break;
			n++;
		}
		printf("%d\n",n);
	}
	return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n, k;
    cin >> n >> k;

    vs32 a(n); rep(i, n) cin >> a[i];

    for (int i = k; i < n; ++i)
    {
        if (a[i - k] < a[i]) cout << "Yes\n";
        else cout << "No\n";
    }

    return 0;
}



Measured memory_bytes: 3988
# 市の6桁はぜんぶ取得してソートしてインデックス入れ替え（座圧的な）
n, m = gets.chomp.split.map(&:to_i)
prefs_citis = {}
citis = []  # 出てきた順番を保存
m.times do
  pi, ci = gets.chomp.split.map(&:to_i)
  citis << [pi, ci]
  if prefs_citis.has_key?(pi)
    prefs_citis[pi] << ci
  else
    prefs_citis[pi] = [ci]
  end
end
prefs_citis.each do |k, v|
  table = {}  # rubyのhashは順番も保つらしい
  v.sort.uniq.each.with_index do |vi, idx|
    table[vi] = idx+1 # 座圧ぽいやつここ
  end
  prefs_citis[k]=table
end
citis.each do |pi, ci|
  kami6 = pi.to_s.rjust(6, "0")
  simo6 = prefs_citis[pi][ci].to_s.rjust(6, "0")
  puts kami6+simo6
end

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;

/*isOK関数は条件を自由に変えれば良い*/
bool isOK_a(int index,ll key,vector<ll> &v){
  if(v.at(index)<key)return true;
  else return false;
}

bool isOK_c(int index,ll key,vector<ll> &v){
  if(v.at(index)>key)return true;
  else return false;
}

//Aからはkey未満の最大ののインデックスを求める。つまりはleftが条件を満たす領域
int binary_search_a(ll key, vector<ll> &v){
  ll right = v.size();
  ll left = -1;

  while(right-left>1){
    ll mid = left+(right-left)/2;
    if(isOK_a(mid,key,v))left = mid;
    else right = mid;
  }
  return left;
}

//Cからはkeyより大きいの最小のインデックスを求める。つまりはrightが条件を満たす領域
int binary_search_c(ll key, vector<ll> &v){
  ll right = v.size();
  ll left = -1;

  while(right-left>1){
    ll mid = left+(right-left)/2;
    if(isOK_c(mid,key,v))right = mid;
    else left = mid;
  }
  return right;
}

int main(){
  ll n;
  cin >> n;
  vector<ll> A(n),B(n),C(n);
  rep(i,n)cin >> A.at(i);
  rep(i,n)cin >> B.at(i);
  rep(i,n)cin >> C.at(i);
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  sort(C.begin(),C.end());
  ll ans = 0;
  rep(i,n){
    //aはkey未満の最大のインデックスを求めそれに1足せば良い
    //cはkeyより大きい最小のインデックスを求め、nから引けば良い
    
    //ll a = binary_search_a(B.at(i),A)+1;
    //ll c = n-binary_search_c(B.at(i),C);
    
      
    //具体例で考えればeasy
    ll a = distance(A.begin(),lower_bound(A.begin(),A.end(),B.at(i)));
    ll c = distance(upper_bound(C.begin(),C.end(),B.at(i)),C.end());
    ans += a*c;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2560
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		String str1 = sc.nextLine();
		String str2 = sc.nextLine();

		Map<Character,Character> c = new HashMap<Character,Character>();
		for(int i=0;i<str1.length();i++) {
			char c1 = str1.charAt(i);
			char c2 = str2.charAt(i);

			if(c.containsKey(c1)) {
				char temp = c.get(c1);
				if(c2 != temp) {
					System.out.println("No");
					return;
				}
			}else if(c.containsValue(c2)) {
				System.out.println("No");
				return;
			}else {
				c.put(c1, c2);
			}
		}
		System.out.println("Yes");
	}
}

Measured memory_bytes: 29048
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;

void main(){

    string n = readln();
    while(true){
	char[5][8] s;
	for(int i=0;i<5;i++){
	    s[0][i] = '*';
	    s[1][i] = ' ';
	    s[2][i] = '=';
	    s[3][i] = ' ';
	    s[4][i] = '*';
	    s[5][i] = '*';
	    s[6][i] = '*';
	    s[7][i] = '*';
	}
	n =  n.chomp();
	int si = to!int(n.length);
	for(int i=si-1;i>=0;i--){
	    int m = to!int(n[i]-'0');
	    if(m >= 5){
		s[0][5-si+i] = ' ';
		s[1][5-si+i] = '*';
		m -= 5;
	    }
	    s[3][5-si+i] = '*';
	    s[4][5-si+i] = '*';
	    s[5][5-si+i] = '*';
	    s[6][5-si+i] = '*';
	    s[7][5-si+i] = '*';
	    s[3+m][5-si+i] = ' ';
	}
	foreach(i;s){
	    foreach(j;i) write(j);
	    writeln();
	}
	n = readln();
	if(stdin.eof()) break;
	writeln();

    }


}

Measured memory_bytes: 2292
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<map>
#include<cmath>
using namespace std;
typedef long long ll;
const ll MaxN = 100;

int num[MaxN + 5];

bool cmp(int a, int b){
	return a > b;
}

int main()
{
	int n;
	cin >> n;
	for(int i = 1;i <= n;i++)
		cin >> num[i];
	sort(num + 1, num + 1 + n, cmp);
	int sum = 0;
	for(int i = 1;i <= n;i+=2){
		sum += num[i];
	}
	for(int i = 2;i <= n;i+=2){
		sum -= num[i];
	}
	cout << sum << endl;
	return 0;
}

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

#define ll long long
#define ld long double
 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
 
#define err() cout<<"--------------------------"<<endl; 
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>
 
#define endl "\n"
 
const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e18;
#define PI 3.14159265
 
const ll N = 500005;

ll C[N];
ll ans[N];

int block_size = 1000;

struct Query {
    ll l, r, idx;
    bool operator<(Query other) const
    {
        return make_pair(l / block_size, r) <
               make_pair(other.l / block_size, other.r);
    }
};

vector<Query> Q;

ll cnt = 0;
ll A[N];

void add(ll idx){
	if(A[C[idx]] == 0){
		cnt++;
	}
	A[C[idx]]++;
}

void remove(ll idx){
	A[C[idx]]--;
	if(A[C[idx]] == 0){
		cnt--;
	}
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n, q;
    cin >> n >> q;
    rep(i,0,n)	cin >> C[i];
    Q.resize(q);

    rep(i,0,q){
    	cin >> Q[i].l >> Q[i].r;
    	Q[i].l--;
    	Q[i].r--;
    	Q[i].idx = i;
    }

    sort(all(Q));
    
    int cur_l = 0;
    int cur_r = -1;
    
    for (Query q : Q) {
        while (cur_l > q.l) {
            cur_l--;
            add(cur_l);
        }
        while (cur_r < q.r) {
            cur_r++;
            add(cur_r);
        }
        while (cur_l < q.l) {
            remove(cur_l);
            cur_l++;
        }
        while (cur_r > q.r) {
            remove(cur_r);
            cur_r--;
        }
        ans[q.idx] = cnt;
    }
    rep(i,0,q)	cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 27156
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

struct island{
    int way[1010];
    bool kaku;
};

void slove(int n,int k){
    int a,b,c,d;
    pair<int,int> pa;
    island isl[1010]={0};
    
    for(int i=0;i<k;i++){
        scanf("%d%d%d",&a,&b,&c);
        
        if(a==0){
            priority_queue< pair<int,int> > pq;
            pq.push(make_pair(0,b));
            while(1){
                if(pq.empty()){
                    printf("-1\n");
                    break;
                }
                
                pa=pq.top();
                pq.pop();
                
                if(pa.second==c){
                    printf("%d\n",-1*pa.first);
                    break;
                }
                
                isl[pa.second].kaku=true;
                for(int i=1;i<=n;i++){
                    if(isl[pa.second].way[i]<0 && !isl[i].kaku){
                        pq.push(make_pair(isl[pa.second].way[i]+pa.first,i));
                    }
                }
            }
            
            for(int j=1;j<=n;j++){
                isl[j].kaku=false;
            }
            
        }else{
            scanf("%d",&d);
            if(isl[b].way[c]<-1*d  || isl[b].way[c]==0){
                isl[b].way[c]=-1*d;
                isl[c].way[b]=-1*d;
            }
        }
    }
    
    return;
}

int main(){
    int ina,inb;
    while(1){
        scanf("%d%d",&ina,&inb);
        if(ina+inb==0)
            break;
        slove(ina,inb);
    }
    return 0;
}

Measured memory_bytes: 5224
#include<bits/stdc++.h> 
#define ll                 long long                            
#define ra                 return a;                                          
#define pb                 push_back                                                     
#define sti                stack<ll>
#define spi                stack<pair<ll,ll>>
#define S                  second
#define msi                map<string,ll >
#define msi                map<string,ll >
#define mii                map<ll ,ll >
#define dbg(x)             { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y)          { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z)        { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define mis                map<ll , string>
#define rep(i,a,b)         for(ll  i=a;i<b;i++)
#define mpi                map<pair<ll ,ll >,ll >                                                
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define F                  first 
#define vi                 vector<ll >
#define vii                vector<pair<ll , ll >>
#define pqi                priority_queue<ll>
#define si                 set <ll>
#define vs                 vector<string>
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define hell               1000000007
#define bs                 binary_search
#define mp                 make_pair
#define qi                 queue<ll>
#define qs                 queue<string>
#define qpi                queue<pair<ll,ll>>
#define qps                queue<pair<ll,string>> 
#define inf                1e18L+1
#define endl               '\n' 
#define itr(a,it)          for(typeof(a.begin()) it=a.begin();it!=a.end();it++)// This will produce const_iterator for const object and normal iterator for non-const object
#define ss                 set<string>
using namespace std;
#define N  300005
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll tests=1;
//    cin>>tests;
    while(tests--)
{
    ll n;
    cin>>n;
    cout<<n*n*n;
}
    return 0;
}

Measured memory_bytes: 256
//Tag : #
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>

#define Inf                     1001001001
using namespace std;

typedef long long int           ll;
typedef pair<ll, ll>            p_ll;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;
typedef unsigned char           uchar;
typedef unsigned int            ui;
typedef unsigned long long int  ull;
/*************************************************/
int N, ans;
vi A, B;

void input() {
    cin >> N;
    A.resize(N);
    B.resize(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];
    for (int i = 0; i < N; i++)
        cin >> B[i];
}

void sol() {
    vi start;
    ll i1(0), i2(0);
    for (int i = 1; i <= N; i++)
        start.push_back(i);
    ll idx = 1;
    do {
        if (start == A || start == B)
            if (!i1)
                i2 = (i1 = idx);
            else
                i2 = idx;
        idx++;
    } while (next_permutation(start.begin(), start.end()));

    cout << abs(i1 - i2);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(); cout.tie();
    input();
    sol();
    return 0;
}


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

int main(){
  int n; cin>>n;
  unordered_map<string,int> str;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    str[s]++;
  }
  
  long long ans = 0;
  for(auto& p:str){
    int a = p.second;
    ans+=(long long)a*(a-1)/2;
  }
  cout<<ans<<endl;
  return 0;
}

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

int n,m,d;

int main(){
	cin>>n>>m>>d;
	if(d==0)
		printf("%.9f\n",(double)(m-1)/n);
	else
		printf("%.9f\n",(m-1)*(double)(n-d)*2/n/n);
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const lb PI=3.14159265359;

int main(){

  ll a,b,k;cin>>a>>b>>k;

  ll count=0;
  repr(i,max(a,b),1){
    if(a%i==0&&b%i==0)count++;

    if(count==k){
      out(i);
      return 0;
    }
  }

  return 0;
}


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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){

  ll n,m;cin>>n>>m;
  COMinit();

  out(COM(n,2)+COM(m,2));



  return 0;
}


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

int main()
{
    int n;
    scanf("%d", &n);
    int *a = new int[n];
    for (int i = 0; i < n; i++) scanf("%d", a + i);

    for (int i = n - 1; i >= 0; i -= 2)
    {
        if (i != n - 1) printf(" ");
        printf("%d", a[i]);
    }
    for (int i = n % 2; i < n; i += 2)
    {
        printf(" %d", a[i]);
    }
    printf("\n");

    delete[] a;
    return 0;
}

Measured memory_bytes: 2944
import java.util.Scanner;                      

class Main {                                  
	public static void main(String[] args) {   
		Scanner scanner = new Scanner(System.in);      

		int n = scanner.nextInt();
		int[][][] a; 
		a = new int[4][3][10];    //部屋の場所を表す３次元配列の作成

		for(int i= 0;i<n;i++){
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			a[b-1][f-1][r-1]=a[b-1][f-1][r-1]+v;//各場所に入居者の増減を入力
		}
		for(int b=0;b<4;b++){
			if(!(b == 0)){
				System.out.println("");
				for(int i=0;i<20;i++){
					System.out.print("#");
				}
				System.out.println("");
			}
			for(int f=0;f<3;f++){
				if(! (f == 0)){
					System.out.println("");
				}
				for(int r=0;r<10;r++){
					System.out.print(" "+a[b][f][r]); //10部屋の出力を階数、棟の数分繰り返し、各処理の間に改行と#を挿入
				}
			}
		}
		System.out.println("");
		scanner.close();
	}
}


Measured memory_bytes: 29572
require 'prime'

n = gets.chomp.to_i

answer = Prime.each(n).map { |pr|
  1.step.lazy.map { |m| pr ** m }.take_while { |m| m <= n }.map { |m| n / m }.sum
}.inject(1) do |acc, m|
  (acc * (1 + m)) % 1_000_000_007
end

puts answer


Measured memory_bytes: 14464
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    int n,l; cin >> n >> l;
    vector<string> v;
    rep(i,n){
        string s; cin >> s;
        v.pb(s);
    }
    sort(ALL(v));
    rep(i,n) cout << v[i];
    cout << endl;
}


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

using namespace std;
bool bad[1080];
int main(){
	int n, k, m, b, r, p, q;
	int bunny[1080];
	cin >> n >> k;
	for(int i = 0;i < k;i++){
		cin >> m;
		for(int j = 0;j < m;j++){
			cin >> b;
			bunny[b] = i;
		}
	}
	cin >> r;
	for(int i = 0;i < r;i++){
		cin >> p >> q;
		if(bunny[p] == bunny[q]){
			bad[p] = bad[q] = true;
		}
	}
	int res = 0;
	for(int i = 1;i <= n;i++){
		if(bad[i])res++;
	}
	cout << res << endl;
	
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n;
ll a[110];
ll ans[110];
int main(){
	scanf("%lld",&n);
	rep(i,1,n+1)scanf("%lld",a+i);
	rep(i,0,n){
		int flag=0;
		for(int j=n-i;j>0;j--)if(a[j]==j){
			flag=1;
			ans[n-1-i]=j;
			rep(k,j,n)a[k]=a[k+1];
			break;
		}
		if(!flag){
			puts("-1");
			return 0;
		}
	}
	rep(i,0,n)printf("%d\n",ans[i]);
}

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

using namespace std;

int main(){

    int n,maxV=0;
    cin>>n;
    
    string s1;

    map<string,int>m1;
    //vector<string>sv;

    for (int i = 0; i < n; i++)
    {
        cin>>s1;
        m1[s1]++;
        maxV = max(m1[s1],maxV);
    
    }

    for (auto i = m1.begin(); i != m1.end(); i++)
    {
        if ((*i).second == maxV)
        {
            cout<<(*i).first<<endl;
        }
        
    }
    


}

Measured memory_bytes: 17664
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define M (L+R)/2
#define N 500009
#define inf 99999999999
#define ll long long
#define mod 1000000007
using namespace std;
ll h,n,x,sum,ans;
int main(){

	ios::sync_with_stdio(0);
	
	cin>>h>>n;
	for(int i=1;i<=n;i++){
		cin>>x;
		sum+=x;
	}
	if(sum<h)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int prime[1000000];
bool Isprime(int n)
{
    if (n < 2)
        return false;
    if (n == 2)
        return true;
    if (n % 2 == 0)
        return false;
    for (int i = 3; i * i <= n; i += 2)
    {
        if (n % i == 0)
        {
            return false;
        }
    }
    return true;
}
int main()
{
    int n;
    while (cin >> n, n)
    {
        int cnt = 0;
        for (int i = n + 1; i <= 2 * n; i++)
        {
            if (Isprime(i))
                cnt++;
        }
        cout << cnt << endl;
    }
}



Measured memory_bytes: 3132
a,b,k = map(int,input().split())
forward = list()

for i in range(a,a+k):
    if i <=b:
        forward.append(i)
    else:
        continue


back = list()
for i in range(b,b-k,-1):
    if b-k >= a:
        back.append(i)
    else:
        continue
        
answer = forward + back

answer = sorted(list(set(answer)))

for num in answer:
    print(num)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

int main(void){
    int N;
    cin >> N;

    ll place[N + 1];
    for (int i = 1; i <= N; ++i) {
        ll a;
        cin >> a;
        place[a] = i;
    }

    ll ans = 0;
    set<ll> used = {0, N + 1};
    for (int i = 1; i <= N; ++i) {
        ll r, l;

        auto itr = used.lower_bound(place[i]);
        r = *itr;
        l = *(--itr);

        ans += i * (place[i] - l) * (r - place[i]);
        used.insert(place[i]);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S, T;
    cin >> S >> T;
    for (int i=0; i<S.size(); i++){
        if (S.at(i)  != T.at(i)){
            cout << "No" << '\n';
            break;
        }
        else if (i == S.size() - 1) cout << "Yes" << '\n';
    }
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
int main() {
cout << fixed << setprecision(30);
  ll n,c,k;
  cin3(n,c,k);
  vec t(n);
  loop(i,n)cin>>t[i];
  sort(all(t));
  ll bus=0;
  ll limit=t[0]+k;
  ll human=0;
  loop(i,n){
    if(t[i]<=limit){
      if(human==0)bus++;
      if(human==c){
        human=0;
        limit=t[i]+k;
        bus++;
      }
      human++;
    }
    else{
      human=1;
      bus++;
      limit=t[i]+k;
    }
  }
  putout(bus);
}

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

// A - Remaining Balls
int main() {
    string S, T, U;
    cin >> S >> T;
    int A, B;
    cin >> A >> B;
    cin >> U;

    if (S == U) {
        A--;
    }
    if (T == U) {
        B--;
    }
    cout << A << " " << B;
}


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

signed main() {
    int n, a, b;
    cin >> n >> a >> b;
    int mx = a + b * (n - 1);
    int mn = a * (n - 1) + b;
    int ans = mx - mn + 1;
    if (ans < 0) ans = 0;
    cout << ans << "\n";
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}


template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector< vector<Int> > G(n);
  for(Int i=0;i<m;i++){
    Int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  if(m&1) drop(-1);

  vector<Int> cnt(n,0),used(n,0);
  Int pos=1;
  MFP([&](auto dfs,Int v,Int p)->void{
        used[v]=pos++;

        vector<Int> bck;
        for(Int u:G[v]){
          if(u==p) continue;
          if(used[u]){
            if(used[u]<used[v]) bck.emplace_back(u);
          }else{
            dfs(u,v);
          }
        }

        if(cnt[v]&1){
          assert(~p);
          cout<<v+1<<" "<<p+1<<endl;
          cnt[v]++;
        }else if(~p){
          cout<<p+1<<" "<<v+1<<endl;
          cnt[p]++;
        }

        for(Int u:bck){
          cout<<u+1<<" "<<v+1<<endl;
          cnt[u]++;
        }
      })(0,-1);

  for(Int x:cnt) assert(x%2==0);
  return 0;
}


Measured memory_bytes: 24064
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	int N, D, i, ans = 0;
	scanf("%lld%lld", &N, &D);
	for(i = 0; i < N; i++){
		int X, Y;
		scanf("%lld%lld", &X, &Y);
		if(X * X + Y * Y <= D * D){
			ans++;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3796
#include<stdio.h>

int main(void){
  int n,w,h;
  unsigned long long in;
  int flg=0;
  scanf("%llu",&in);
  for(n=1;n<3500;n++){
    for(w=n;w<3500;w++){
      if(4*n*w-in*(n+w)==0) continue;
      if((in*n*w)%(4*n*w-in*(n+w))==0){
        h=(in*n*w)/(4*n*w-in*(n+w));
        printf("%d %d %d\n",h,n,w);
        flg=1;
        break;
      }
    }
    if(flg) break;
  }
  if(!flg) puts("no");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
const int MOD = 1e9 + 7;

ll N, M, K, Q;
string S;
// 1次元 vector
template <class T>
ostream &operator<<(ostream &s, vector<T> vec) {
    for (int i = 0; i < (int)vec.size(); ++i) {
        if (i > 0) {
            s << " ";
        }
        s << vec[i];
    }
    return s << endl;
}
int main() {
    cin >> K >> N;
    vector<ll> A(2 * N + 1);

    for (int i = 0; i < N; i++) {
        cin >> A.at(i + 1);
    }
    for (int i = 0; i < N; i++) {
        A[N + i + 1] = K + A[i + 1];
    }

    //cout << A;
    ll ans = INF;
    for (int i = 0; i < N; i++) {
        chmin(ans, A[N + i] - A[i + 1]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3456