akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

int main(){
    int K; cin>>K;
    QUE que;
    FOR(i,1,10) que.push(i);
    int count = 0; ll ans;
    while(count < K){
        ll p = que.front(); que.pop();
        count++;
        if(count == K) ans = p;
        ll r = p % 10;
        if(r != 0) que.push(10 * p + r - 1);
        que.push(10 *p + r);
        if(r != 9) que.push(10 * p + r + 1);
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 1792
#include <stdio.h>
#define MAX_S_LEN 100000
// 本当は10^5まで
int get_len(char *p) {
  int i;
  for (i = 0; *p != '\0'; i++) {
    p++;
  }
  return i;
}

int main()
{
  char input[MAX_S_LEN];

  scanf("%s", input);
  //    printf("LEN: %d\n", get_len(input));
  int i;
  int len = get_len(input);
  char back1;   char back2;
  char *p = input;

  
  for (i = 0; i < len; i++) {
    if (i == 0) {
      back1 = '\0';
      back2 = '\0';
    } else if (i == 1) {
      back2 = '\0';
    }
    
    if (back1 == *p) {
      //      printf("GET DOUBLED!\n");
      printf("%d %d\n", i, i+1);
      return 0;
    } else if (back2 == *p) {
      //      printf("GET HASSAMU!\n");
      printf("%d %d\n", i-1,i+1);
      return 0;
    }
    

    back2 = back1;
    back1 = *p;
    
    p++;


  }
  printf("%d %d\n",-1, -1);
    
  return 0;
}
  

  


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1e9;
const long long INFL = 1LL<<60;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) {
    cin >> a[i];
  }
  sort(ALL(a));
  cout << abs(a[0] - a[n-1]) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);
int dp[100005]; // dp[i]:= i円支払う時の最小のコインの数
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,m;
    cin >> n >> m;
    vector<int> coins(m);
    rep(i,m)cin >> coins[i];
    rep(i,1e5+5)dp[i] = 1e9+7;
    dp[0] = 0;
    for(int i=0;i<1e5+5;i++){
        rep(j,m){
            if(i>=coins[j]){
                dp[i] = min(dp[i-coins[j]]+1,dp[i]);
            }
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 3596
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  b += a * 3;
  cout << b / 2 << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

int a[3000], b[3000];
int dp1[3001][3001], dp2[3001][3001];

int main()
{
    int n, t, s;
    cin >> n >> t >> s;
    for( int i = 0; i < n; i++ ) cin >> a[i] >> b[i];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= s; j++)
        {
            if (b[i] > j)
                dp1[i + 1][j] = dp1[i][j];
            else
                dp1[i + 1][j] = max(dp1[i][j], dp1[i][j - b[i]] + a[i]);
        }
    }
    reverse(a, a + n);
    reverse(b, b + n);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= t - s; j++)
        {
            if (b[i] > j)
                dp2[i + 1][j] = dp2[i][j];
            else
                dp2[i + 1][j] = max(dp2[i][j], dp2[i][j - b[i]] + a[i]);
        }
    }
    int Max = 0;
    for (int i = 0; i < n; i++)
        Max = max(Max, dp1[i][s] + dp2[n - i - 1][t - s]);
    printf("%d\n", Max);
}



Measured memory_bytes: 62408
from itertools import groupby
S = input()
k = int(input())

seq = [(s, len(list(k))) for s, k in groupby(S)]

if len(seq) == 1:
    ans = (k * len(S)) // 2
else:
    if seq[0][0] != seq[-1][0]:
        ans = k*sum(a[1] // 2 for a in seq)
    else:
        left = seq[0][1]
        right = seq[-1][1]
        ans = k*sum(a[1] // 2 for a in seq[1:-1])
        ans += ((left + right) // 2) * (k - 1)
        ans += left // 2 + right // 2

print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
#define int long long int

int32_t main() {
  FASTIO;
  int n; cin >> n;
  vector<int> v(n+1, 0);
  int tmp;
  for(int i=1; i<n; i++) {
    cin >> tmp;
    v[tmp]++;
  }
  for(int i=1; i<=n; i++) {
    cout << v[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i,m,n) for(int i = m;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
#define mod 1000000007;
int main() {
  lli A,B,C=0,D=0,E=0,F=0,G=0,H=0,N,M;
  cin >> A;
  vector<int>P(A);
  rep(i,0,A){
    cin >> P[i];
    if(P[i]%4==0)C++;
    if(P[i]%2==0)D++;
  }
  D=D-C;
  D/=2;
  C+=D;
  if(A/2<=C)Out("Yes");
  else Out("No");
}

Measured memory_bytes: 640
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt(),m=sc.nextInt();
    int[][] a = new int[n][m];   //メモリの動的確保
    int[] b = new int[m];
    int[] r = new int[n];
    for(int i=0;i < n;i++){
      for(int j=0;j < m;j++){
        a[i][j] = sc.nextInt();
      }
    }
    for(int j = 0;j < m;j++){
      b[j] = sc.nextInt();
    }
    for(int i = 0;i < n;i++){
      r[i] = 0;
      for(int j = 0;j < m;j++){
        r[i] += a[i][j]*b[j];
      }
      System.out.println(r[i]);
    }
    sc.close();
  }
}


Measured memory_bytes: 40104
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n, k; cin >> n >> k;
  vector<int> v(n);
  for(int i = 0; i < n; i++){
      cin >> v[i];
  }
  sort(v.begin(), v.end());
  // we need the sum of smallest k elements.
  int ans = 0;
  for(int i = 0; i < k; i++){
      ans += v[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3616
#include<iostream>
using namespace std;
int main()
{
    int n,arr[105],sum=0;
    cin >> n ;
    for(int i=0;i<n-1;i++)
    {
        cin >> arr[i];
    }
    if(n==2){cout << arr[0]*2 << endl;return 0;}
    for(int i=1;i<n-1;i++)
    {
        sum+=min(arr[i],arr[i-1]);
    }
    sum+=(arr[0]+arr[n-2]);
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int R = Integer.parseInt(sc.next());//int型
		int G = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int N = Integer.parseInt(sc.next());
		sc.close();
		int b = 0;
		int resi = 0;
		int ans = 0;
		for(int r = 0; r <= 3000; r++) {
			for(int g = 0; g <= 3000; g++) {
				resi = N - r*R - g*G; 
				if (resi%B==0 && resi >= 0) {
					ans++;
					// System.out.println(r+" "+g+" "+resi/B+" ");
				}
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	ll W, H; cin >> W >> H;
	ll res;
	if (H == 1 && W == 1)
	{
		res = 1;
	}
	else if (H == 1 || W == 1)
	{
		res = max({0ll, H-2, W-2});
	}
	else
	{
		res = (W-2) * (H-2);
	}
	std::cout << res << std::endl;
}


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

const int N = 200005;

int n;
int a[N];
int bit[N];
long long res;
vector<int> go[26];
string s;

void upd(int x) {
	for (x; x <= n; x += x & -x) bit[x]++;
}

int get(int x) {
	int res = 0; for (x; x > 0; x -= x & -x) res += bit[x]; return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin >> s; n = s.size();
	for (int i = 0; i < n; ++i) go[s[i] - 'a'].push_back(i);
	int cnt = 0;
	for (int i = 0; i < 26; ++i) cnt += go[i].size() & 1;
	if (cnt > 1) { cout << -1; return 0; }
	for (int i = 0; i < 26; ++i) {
		int sz = go[i].size();
		for (int j = 0; j < sz; ++j) {
			a[go[i][j]] = go[i][sz - 1 - j];
		}
	}
	for (int i = 0; i < n; ++i) {
		a[i]++, res += get(a[i]), upd(a[i]);
	}
	cout << res / 2;
}

Measured memory_bytes: 3088
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#define __STDC_LIMIT_MACROS
#pragma comment(linker, "/STACK:1024000000")
#pragma warning( disable : 6031)
#pragma warning( disable : 4244)
#pragma warning( disable : 26451)
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdint>
#include <climits>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <chrono>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef vector<ll> vl;
typedef vector<vector<long long>> vvl;
typedef tuple<int, int, int> tiii;
const long long mod = int(1e9) + 7;
const int INF = 1e9;


int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int n;
	cin >> n;
	vi a(n);
	for (auto& i : a)
		cin >> i;
	int cmin = INT_MAX;
	int res = 0;
	for (int i = 0; i < n; i++)
	{
		if (a[i] <= cmin)
			res++;
		cmin = min(cmin, a[i]);
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
li = list(map(int, input().split()))

if n <= 2:
    print(0)
else:
    cnt = 0

    for i in range(n):
        for j in range(i+1, n):
            for k in range(j+1, n):
                if li[i] == li[j] or li[j] == li[k] or li[i] == li[k]:
                    continue

                l = sorted([li[i], li[j], li[k]])

                if l[0] + l[1] > l[2]:
                    cnt += 1

    print(cnt)

Measured memory_bytes: 9232
n=int(input())
dic={}
for i in range(n):
    s=input()
    if s in dic:
        dic[s]+=1
    else:
        dic[s]=1
m=int(input())
for i in range(m):
    s=input()
    if s in dic:
        dic[s]-=1
print(max(max(dic.values()),0))

Measured memory_bytes: 3060
from copy import deepcopy
H,W,K=list(map(int,input().split()))
c=[[c for c in input()] for _ in range(H)]

ans=0

for i in range(2**H):
    cc=deepcopy(c)
    for b in range(H):
        if (i>>b)&1==1:
            for k in range(W):
                cc[b][k]='r'

    for j in range(2**W):
        ccc=deepcopy(cc)
        for b in range(W):
            if (j>>b)&1==1:
                for k in range(H):
                    ccc[k][b]='r'
        cnt=0
        for i in range(H):
            for j in range(W):
                if ccc[i][j]=='#':
                    cnt+=1
        
        if cnt==K:
            ans+=1

print(ans)

Measured memory_bytes: 72096
#include<bits/stdc++.h>
#define ll long long
const int maxn=2e5+10;
const int N=10;
using namespace std;

int num[N][N];
int fir(int a)
{
	while(a)
	{
		if(a<10) return a;
		a/=10;
	}
}
int las(int a)
{
	return a%10;
}
int main()
{
	int n;
	ll ans=0;
	cin>>n;
	for(int i=1;i<=n;i++) num[fir(i)][las(i)]++;
	for(int i=1;i<=9;i++)
	{
		for(int j=1;j<=9;j++)
		{
			ans+=num[i][j]*num[j][i];
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  long N,M;
  cin>>N>>M;
  long ans=0;
  if(N*2<=M){
    ans =N;
    M -= N*2;
    N=0;
    ans += M/4;
  }

  else if(N*2>M){
    ans = M/2;
  }
  cout<<ans<<endl;
}


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

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

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

typedef long long ll;



int main() {
    int A,B;
    cin >> A >> B;

    int ans = (A > (B*2)) ? A-(B*2) : 0;


    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int[][] bingo = new int[3][3];
		for(int i = 0; i < 3; i++){
			for(int j = 0; j < 3; j++){
				bingo[i][j] = sc.nextInt();
			}
		}
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			int tmp = sc.nextInt();
			for(int j =0; j < 3; j++){
				for(int k = 0; k < 3; k ++){
					if(bingo[j][k] == tmp){
						bingo[j][k] = 0;
					}
				}
			}
		}
		for(int i = 0; i < 3; i++){
			if(bingo[i][0] == 0 && bingo[i][1] == 0 && bingo[i][2] == 0){
				System.out.println("Yes");
				break;
			}
			if(bingo[0][i] == 0 && bingo[1][i] == 0 && bingo[2][i] == 0){
				System.out.println("Yes");
				break;
			}
			if(bingo[0][0] == 0 && bingo[1][1] == 0 && bingo[2][2] == 0){
				System.out.println("Yes");
				break;
			}
			if(bingo[0][2] == 0 && bingo[1][1] == 0 && bingo[2][0] == 0){
				System.out.println("Yes");
				break;
			}
			if(i == 2){
				System.out.println("No");
			}
		}
 	}
}  

Measured memory_bytes: 35668
import math
X = int(input())

def isprime(n):
    if n < 2:
        return False
    elif n == 2:
        return True
    elif n % 2 == 0:
        return False
    for i in range(3, math.floor(math.sqrt(n))+1, 2):
        if n % i == 0:
            return False
    return True

while isprime(X) is not True:
    X += 1

print(X)



Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
#define ll long long
const int maxn=2e5+10;
ll a[maxn],len;
ll sum[maxn],tmp[maxn],num[maxn];
ll lowbit(ll x)
{
    return x&(-x);
}
void update(ll x)
{
    while(x<=len)
        tmp[x]+=1,x+=lowbit(x);
}
ll query(ll x)
{
    ll ans=0;
    while(x>=1)
        ans+=tmp[x],x-=lowbit(x);
    return ans;
}
ll solve(int n,int k)
{
    memset(tmp,0,sizeof(tmp));
    int i,j;
    ll ans=0;
    for(i=1; i<=n; i++)
        a[i]-=k;
    for(i=1; i<=n; i++)
        sum[i]=sum[i-1]+a[i],num[i]=sum[i];
    sort(sum+1,sum+n+1);
    len=unique(sum+1,sum+n+1)-sum-1;
    for(i=1; i<=n; i++)
        num[i]=lower_bound(sum+1,sum+len+1,num[i])-sum;
    update(num[1]);
    for(i=2; i<=n; i++)
        ans+=(query(num[i])),update(num[i]);
    return ans;
}
int main()
{
    int n,k;
    while(scanf("%d%d",&n,&k)!=EOF)
    {
        int i,j;
        a[1]=k,++n;
        for(i=2; i<=n; i++)
            scanf("%lld",&a[i]);
        printf("%lld\n",solve(n,k));
    }
    return 0;
}


Measured memory_bytes: 6528
#include<iostream>
#include<algorithm>
#include <cstring>
using namespace std;
int main ()
{
    string c;
    cin>>c;
    int n=c.size();
    int a,b;
    a=0x3fffffff;
    b=0;
    for (int i=1; i<n; i++)
        if (c[i]!=c[i-1])
        {
            b=max(n-i,i);
            a=min(a,b);
        }
        if (a==0x3fffffff)
            cout<<n<<endl;
        else
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 512
//Author - Rahil Malhotra
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int32_t main()
{
    IOS;
    string s,t;
    cin>>s>>t;
    int mini=1e18;
    for(int i=0;i<s.length();i++)
    {
        int ctr=0;
        for(int j=0;j<t.length();j++)
        {
            if(i+j>=s.length())
            {
                ctr=1e18;
                break;
            }
            if(t[j]!=s[i+j])
                ctr++;
        }
        mini=min(mini,ctr);
    }
    print(mini);
}


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

int main() {
  int m[10000], f[10000], r[10000];
  int n = 0;
  for (;;n++) {
    cin >> m[n] >> f[n] >> r[n];
    if (m[n] == -1 && f[n] == -1 && r[n] == -1) {
      break;
    }
  }

  for ( int i = 0; i < n; i++) {
    if (m[i] == -1 || f[i] == -1) {
      cout << "F" << endl;
    } else if(m[i] + f[i] >= 80) {
      cout << "A" << endl;
    } else if(m[i] + f[i] >= 65){
      cout << "B" << endl;
    } else if(m[i] + f[i] >= 50){
      cout << "C" << endl;
    } else if(m[i] + f[i] >= 30 && r[i] >= 50) {
      cout << "C" << endl;
    } else if(m[i] + f[i] >= 30) {
      cout << "D" << endl;
    } else {
      cout << "F" << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cstring>
#include <iomanip>
#include <utility>
using namespace std;

int main(){
    int n,c=0;
    cin>>n;
    vector<pair<int,int>>a(n);
    vector<pair<int,int>>b(n);
    int judge[n]={0};
    for(int i=0;i<n;i++){
        cin>>a[i].first>>a[i].second;
    }
    for(int i=0;i<n;i++){
        cin>>b[i].first>>b[i].second;
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    for(int i=0;i<n;i++){
        bool tyu=false;
        int tmp=-1,tmp2;
        for(int j=0;j<n;j++){
            if(b[i].first>a[j].first && b[i].second>a[j].second && judge[j]==0){
                if(a[j].second>tmp){
                    tmp=a[j].second;
                    tmp2=j;
                    tyu=true;
                }
            }else{
                continue;
            }
        }
        if(tyu){
            judge[tmp2]=1;
            c++;
        }
    }
    cout<<c;
}

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

ll A[100000];

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

	int N;
	cin >> N;
	for(int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A, A + N);

	int ans = N;
	ll sum = 0;
	for(int i = 0; i < N; i++) {
		if(sum * 2 < A[i]) ans = N - i;
		sum += A[i];
	}
	cout << ans << endl;
}

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

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using i32 = int_fast32_t;
using u32 = uint_fast32_t;
using i64 = int_fast64_t;
using u64 = uint_fast64_t;

namespace chrono = std::chrono;
using namespace std::string_literals;

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

__attribute__((constructor))
void fast_iostream() {
    std::ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);
}

int main() {
  std::string s;
  cin >> s;
  cout << s.substr(0, s.length() - "festival"s.length());
}


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

int main(){
  int X; cin >> X;
  if(X==0){
    cout << 0 << endl;
    return 0;
  }
  for(int i=1;;++i){
    if(i%2==0){
      if(X<=(i/2)*(i+1)){
	cout << i << endl;
	return 0;
      }
    }else{
      if(X<=i*((i+1)/2)){
	cout << i << endl;
	return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n,p;
    string s;
    cin >> n >> p >> s;
    if(p==2 || p==5){
        ll res=0;
        rep(i,n){
            if((s[i]-'0')%p==0) res += i+1;
        }
        cout << res << endl;
        return 0;
    }
    ll tmp = 1;
    int t=0;
    map<ll,ll> mp;
    rep(i,n){
        t = ((int)(s[n-1-i] - '0') * tmp + t) % p;
        //cout << t << endl;
        mp[t]++;
        tmp = tmp*10%p;
    }
    mp[0]++;
    ll ans = 0;
    for(auto ret : mp){
        ans += ret.second * (ret.second - 1) / 2;
        //cout << ret.first << " " << ret.second << " " << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1028
import java.util.*;
public class Main {
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();

    if(a == 0){
        System.out.println(1);
    }else if(a == 1){
        System.out.println(0);
    }
  }
}

Measured memory_bytes: 27084
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

vector<ll> divisor(ll n) {
    vector<ll> ret;
    for(ll i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
            }
    }
    sort(begin(ret), end(ret));
//  sort(ret.begin(), ret.end(), greater<ll>());
    return (ret);
}

int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> v = divisor(m);

    ll ans = 0;
    rep(i, v.size()){
        if (m / v[i] >= n) ans = max(ans, v[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <cctype>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

int main(){
    ll n,k;
    cin >> n >> k;
    ll h[n];
    vector<ll> v;
    rep(i,n){
        cin >> h[i];
        v.push_back(h[i]);
    }
    sort(v.begin(),v.end());
    vector<ll> w;
    rep(i,n-k+1) w.push_back(v[k-1+i]-v[i]);
    sort(w.begin(),w.end());
    cout << w.at(0) << endl;
}

Measured memory_bytes: 3316
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back

#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 2000
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};



//=============================================ASIFAZAD==============================================//

vi prime;
bitset<N> ck;
map<int, int> p_fact;

void seive()
{
    for(int i = 3; 1LL*i*i <= N; i+=2)
        if(ck[i] == 0)
            for(int j = i*i; j<= N; j+= 2*i)
                ck[j] = 1;
    prime.pb(2);
    for(int i = 3; i<= N; i+=2)
        if(!ck[i])
            prime.pb(i);
}

void prime_fact(int x)
{
    for(auto p: prime)
    {
        if(p*p>x)
            break;
        if(x%p == 0)
        {
            int pow = 0;
            while(x%p==0)
            {
                x/= p;
                pow++;
            }
            p_fact[p] = max(p_fact[p] , pow);
        }
    }
    if(x > 1)
        p_fact[x] = max(p_fact[x] , 1);
}

ll bigmod(ll x, ll p)
{
    ll res = 1;
    while(p)
    {
        if(p&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        p >>= 1;
    }
    return res;
}


int32_t main()
{
    io;
    int n;
    cin>>n;
    int ans = 0, lst;
    for(int i = 0; i< n; i++)
    {
        int x;
        cin>>x;
        if(!i)
        {
            lst = x;
            ans++;
        }
        else if(lst > x)
        {
            lst = x;
            ans++;
        }
    }
    cout<<ans;
    return 0;
}


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

using namespace std;

bool vis[8][8];
int mp[8][8];
int h, w, c, prv;
int dy[4] = {0, 1, 0, -1}, dx[4] = {1, 0, -1, 0};

int ch(int y, int x)
{
    vis[y][x] = true;
    int ret = 1;
    
    mp[y][x] = mp[0][0];
    
    for (int i = 0; i < 4; i++){
        int ny = y + dy[i], nx = x + dx[i];
        if (0 <= ny && ny < h && 0 <= nx && nx < w && !vis[ny][nx] && mp[ny][nx] == prv){
            ret += ch(ny, nx);
        }
    }
    
    return (ret);
}

int ct(int y, int x)
{
    if (mp[y][x] != prv) return (0);
    
    mp[y][x] = -1;
    
    int ret = 1;
    for (int i = 0; i < 4; i++){
        int ny = y + dy[i], nx = x + dx[i];
        if (0 <= ny && ny < h && 0 <= nx && nx < w){
            ret += ct(ny, nx);
        }
    }
    
    return (ret);
}

int main()
{
    while (scanf("%d %d %d", &h, &w, &c) && h){
        c--;
        int mp_[8][8];
        memset(mp_, -1, sizeof(mp_));
        for (int i = 0; i < h; i++){
            for (int j = 0; j < w; j++){
                scanf("%d", &mp_[i][j]);
                mp_[i][j]--;
            }
        }
        
        int ans = 0;
        for (int i = 0; i < 1296; i++){
            memcpy(mp, mp_, sizeof(mp_));
            int x = c * 1296 + i;
            for (int j = 0; j < 5; j++){
                prv = mp[0][0];
                mp[0][0] = x % 6;
                memset(vis, 0, sizeof(vis));
                ans = max(ans, ch(0, 0));
                x /= 6;
            }
            prv = mp[0][0];
            ans = max(ans, ct(0, 0));
        }
        
        printf("%d\n", ans);
    }
    
    return (0);
}

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

int main()
{
    int A, B;
    cin >> A >> B;

    if(A>=13){
        cout << B << endl;
    }
    else if(A<=12 && A>=6){
        cout << B / 2 << endl;
    }
    else if(A<=5){
        cout << 0 << endl;
    }

}

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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

int cal(int x, int s, int f){
    return ceil((x-s) / (double)f);
}

int main(int argc, char const* argv[])
{
    int n;
    cin >> n;

    vector<vector<int> > stations(n-1);
    for (int i = 0; i < n-1; i++) {
        stations[i].resize(3);
    }

    for (int i = 0; i < n-1; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> stations[i][j];
        }
    }


    for (int i = 0; i < n-1; i++) {
        int x;
        x = stations[i][0] + stations[i][1];
        for (int j = i+1; j < n-1; j++) {
            if (x > stations[j][1]) {
                x = stations[j][0] + stations[j][1] + cal(x, stations[j][1], stations[j][2]) * stations[j][2];
            }else{
                x = stations[j][0] + stations[j][1];
            }
        }
        cout << x << endl;
    }

    cout << 0 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <limits.h>
using namespace std;
typedef long long ll;
const int inf=1<<30;
const int INF=INT_MAX;

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m, c, b[21], a;
  int res = 0;
  cin >> n >> m >> c;
  for(int i = 0; i < m; ++i) {
    cin >> b[i];
  }
  for(int i = 0; i < n; ++i) {
    int sum = c;
    for(int j = 0; j < m; ++j) {
      cin >> a;
      sum += a * b[j];
    }
    if(sum > 0) {
      ++res;
    }
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
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; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	ll d = c-a-b;
	bool ans = d>0&&d*d>4*a*b;
	printf("%s\n", ans?"Yes":"No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  string S;
  cin>>S;
  vector<int> A(S.size(),0);
  int a=1,b=0,c=0;
  bool d=0;
  char C='R';
  for(int i=1;i<(int)S.size();i++){
    if(S[i]==C){
      if(C=='R'){
        if(d==1)
          a++;
        else
          b++;
      }else{
        if(d==0)
          A[c]++;
        else
          A[c-1]++;
      }
      d=1-d;
    }else{
      if(C=='R'){
        if(d==1){
          A[i]=a+1;
          A[i-1]=b;
        }else{
          A[i]=b+1;
          A[i-1]=a;
        }
        d=1;
        c=i;
      }else{
        a=1;
        b=0;
        d=0;
      }
    }
    C=S[i];
  }
  for(int i=0;i<S.size();i++){
    cout<<A[i];
    if(i==S.size()-1)
      cout<<endl;
    else
      cout<<' ';
  }
}

Measured memory_bytes: 4236
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a*b>c*d)  cout<<a*b<<endl;
	else cout<<c*d<<endl;
	//cout<<(a*b>c*d)?a*b:c*d<<endl;
	return 0;
 } 

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
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; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;




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

	REP(i, s.size()) {
		if (i % 2 == 0) {
			if (s[i] == 'L') {
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			if (s[i] == 'R') {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;

}

Measured memory_bytes: 384
#define _[2<<17]
n,i;A _,B _,T _,F _;long M,D _,P _,R _;s(u,i,p,I){R[i]=i?s(u,T[i],p),(I=B[i])-p?s(I,F[I],u),D[u]=D[u]*-~D[I]%M:D[u]:++D[u];}S(u,x,p,i,I){for(i=F[u];I=B[i];I-p?S(I,R[i]*x%M+1,u),x=x*-~D[I]%M:0)i=T[i];P[u]=x%M;}main(u,v){for(;~scanf("%d%d",&u,&v);)i++?A[i-1]=B[i]=u,B[i-1]=A[i++]=v:(n=u,M=v);for(;--i;F[A[i]]=i)T[i]=F[A[i]];s(1,F[1],0);for(S(1,1,0);i++<n;)printf("%d ",P[i]);}

Measured memory_bytes: 14592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n,m,x;
vector<int> lst(12);
vector<int> c(12);
vector<vector <int>> a(12);
ll ans=10000000000;

void dfs(int dep,ll money, vector<int> lst){
    if (dep==n){
        int count = 0;
        for (int i=0; i < m; i++) {
            if(lst[i]>=x) count++;
        }
        if (count == m) ans = min(ans,money);
    }else{
//        vector<int> nlst = lst;
//        vector<int> nlst2 = lst;
//        dfs(dep+1,money,nlst);
//        for (int i = 0; i < m; i++) {
//            nlst2[i]+=a[dep].at(i);
//        }
//        dfs(dep+1,money+c.at(dep),nlst2);
        dfs(dep+1,money,lst);
        for (int i = 0; i < m; i++) {
            lst[i]+=a[dep].at(i);
        }
        dfs(dep+1,money+c.at(dep),lst);
    }
}


int main() {
    cin >> n >> m >> x;
    for (int i = 0; i < n; i++) {
        cin >> c.at(i);
        for (int j = 0; j < m; j++) {
            int tmp;
            cin >> tmp;
            a[i].push_back(tmp);
        }
    }
    dfs(0,0,lst);
    if (ans == 10000000000) {
        cout << "-1" << endl;
    } else {
        cout<<ans<<endl;
    }

    return 0;
}



Measured memory_bytes: 3608
#include<iostream> 
#include<vector> 
#include<algorithm> 
#include<iomanip> 
#include<stack> 
#include<unordered_map>
#include<queue> 
#include<map> 
#include<climits>
#include<set> 
#include<string> 
//#include<time.h>
//#include<bits/stdc++.h> 
using namespace std; 
#define lld long long int 
#define eb emplace_back
//to insert pair use eb
#define mp make_pair
#define fi first
#define se second
#define pb push_back

#define X 1000000007
#define Y 998244353
#define E4 10000
#define E5 100000
#define E6 1000000
#define inf 1001001001
#define longinf 2001001001001001001
#define pi 3.1415926535

# define rec2(i,a,b) for(lld i=a;i<b;i++) 
#define rec(i,n) for(lld i=0;i<n;i++)
#define rev(i,a,b) for(lld i=b-1;i>=a;i--)
#define all(v) (v).begin(), (v).end()
#define large(v)  *max_element(all(v))
#define small(v)  *min_element(all(v)) 
#define v vector
const double EPS = 1e-6;

void google(int i)
{  cout<<"Case #"<<i<<":"; }

//prime sieve if needed 
//prime factors of number
lld prime[E6+1]; 
void sieve(lld n) 
{ rec(i,n+1) 
    prime[i]=1; 
   for(lld i=2;i*i<=n;i++) 
     { if(prime[i]!=1) 
          continue; 
         for(lld j=i*i;j<=n;j=j+i) 
          if(prime[i]==1)
           prime[j]=i; 
      }
}

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

//fermat a^(m-2)%mod
lld binarymul(lld a,lld n,lld m)
{  lld res=1; 
 while(n) 
  { if(n%2) 
      { res=(res*a)%m; 
         n--; 
      } 
     a=(a*a)%m; 
     n/=2; 
  }
  return res; 
}
/*
void complexity(time_t end,time_t start)
{ 
  double taken = double(end - start); 
    cout<<"Time : "; 
    cout<<fixed<<taken<<setprecision(8);         cout<<" sec "<<endl;
}
*/
void contest(); 
int main()
{   
    /*
    time_t start, end; 
    time(&start); 
    */
   ios_base::sync_with_stdio(false); 
   cin.tie(0);
     #ifdef PUNEET_GOEL
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif
   //sieve(E6); 
    lld t=1; 
    rec(i,t) 
    {
     //google(i+1); 
      contest(); 
      cout<<endl; 
    }
    /*
     time(&end); 
    complexity(end,start);
    */
	return 0;
}

void contest()
{ 
  string a; 
  cin>>a; 
  lld n=a.length(); 
  lld i=0; 
  lld ans=0; 
  while(i<n) 
  { if(a[i]=='S') 
    i++; 
   else 
    break; 
  } 
  while(i<n) 
  { if(a[i]=='R') 
     { i++; ans++; 
     }
    else 
    break; 
  } 
  cout<<ans<<endl; 
}

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

using namespace std;

int main() {
  int h, w, n;
  cin >> h >> w >> n;

  int y = 0;
  int x = 0;

  vector<vector<int>> ans(h, vector<int>(w));
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    while (a--) {
      ans[y][x] = i;
      if (y % 2 == 0) {
        if (x == w - 1) {
          y++;
        } else {
          x++;
        }
      } else {
        if (x == 0) {
          y++;
        } else {
          x--;
        }
      }
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cout << ans[i][j] + 1 << ' ';
    }
    cout << endl;
  }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  string a;
  cin>>a;
  if(a=="SUN")cout<<7;
  if(a=="MON")cout<<6;
  if(a=="TUE")cout<<5;
  if(a=="WED")cout<<4;
  if(a=="THU")cout<<3;
  if(a=="FRI")cout<<2;
  if(a=="SAT")cout<<1;
}


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

int main(){
	int n,m;
	cin >> n >> m;
	vector<int> a(n);
	for(int i=0;i<n;i++)	 cin >> a[i];
	int s=0;
	for(int i=0;i<n;i++)	 s+=a[i];
	int cnt=0;
	for(int i=0;i<n;i++){
		if(a[i]*4*m >= s ) cnt++;
	}
	if( cnt >= m ){
		cout << "Yes" <<endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#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[i] != T[i]) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <string.h>
int main(){
	int a,b,sum=0;
	char n[2];
	
	while(sum==0){
		scanf("%d %s %d",&a,n,&b);
		if(strcmp(n,"+")==0){
			printf("%d\n",a+b);
		}
		else if(strcmp(n,"-")==0){
			printf("%d\n",a-b);
		}
		else if(strcmp(n,"*")==0){
			printf("%d\n",a*b);
		}
		else if(strcmp(n,"/")==0){
			printf("%d\n",a/b);
		}
		else if(strcmp(n,"?")==0){
			sum=1;
		}
	}
	return 0;
}


Measured memory_bytes: 2112
a[100],v,j,k,n;main(i){scanf("%d",&n);for(;j<n;scanf("%d",&a[j++]));
	for(;k<n-1;){printf("%d ",a[k++]);}printf("%d\n",a[n-1]);
	for(;i<n;i++){
		v=a[i];j=i-1;
		for(;j+1&&a[j]>v;a[j+1]=a[j--]);
		a[j+1]=v;
		for(k=0;k<n-1;printf("%d ",a[k++]));
		printf("%d\n",a[n-1]);
	}
	exit(0);
}

Measured memory_bytes: 600
using System;

class StableSort {

    static void PrintArr(string[] C, int N) {
        for (int i = 0; i < N; i++) {
            Console.Write(C[i]);

            if (i != N-1)
                Console.Write(" ");
            else
                Console.Write("\n");
        }
    }

    static void BubbleSort(string[] C, int N) {

        for (int i = 0; i < N; i++) {
            for (int j = N-1; j > i; j--) {
                if (C[j][1] < C[j-1][1]) {
                    string tmp = C[j];
                    C[j] = C[j-1];
                    C[j-1] = tmp;
                }
            }
        }
        PrintArr(C, N);
        Console.WriteLine("Stable");
    }

    static void SelectionSort(string[] C, int N) {

        for (int i = 0; i < N; i++) {
            int minj = i;
            for (int j = i; j < N; j++){
                if (C[j][1] < C[minj][1])
                    minj = j;
            }
            string tmp = C[i];
            C[i] = C[minj];
            C[minj] = tmp;
        }
        PrintArr(C, N);
    }

    static void Main()
    {
        bool flag = true;
        string[] C1;
        string[] C2;

        int N = int.Parse(Console.ReadLine());

        C1 = Console.ReadLine().Split(' ');
        C2 = (string[])C1.Clone();

        BubbleSort(C1, N);
        SelectionSort(C2, N);

        for(int i = 0; i < N; i++) {
            if(C1[i][0] != C2[i][0]) {
                flag = false;
                break;
            }
        }

        Console.WriteLine(flag ? "Stable" : "Not stable");
    }
}

Measured memory_bytes: 9060
n  = int(input())
ls = list(map(int, input().split()))
ls_plus1  = list(map(lambda x: x + 1, ls))
ls_minus1 = list(map(lambda x: x - 1, ls))
dic = {}
for a, b, c in zip(ls_minus1, ls, ls_plus1):
    if a in dic: 
        dic[a] += 1
    else: 
        dic[a] = 1
    if b in dic:
        dic[b] += 1
    else:
        dic[b] = 1
    if c in dic:
        dic[c] += 1
    else:
        dic[c] = 1
print(sorted(dic.values())[-1])
    

Measured memory_bytes: 24820
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;

int n, m, a[305][305];

int trial(int x){
	int ban[305] = {};
	while(1){
		vector<int> v;
		for(int i=0; i<n; i++){
			for(int j=0; j<m; j++){
				if(!ban[a[i][j]]){
					v.push_back(a[i][j]);
					break;
				}
			}
		}
		if(v.size() != n) return false;
		sort(v.begin(), v.end());
		int reit = 0;
		for(int i=0; i<v.size(); ){
			int e = i;
			while(e < v.size() && v[e] == v[i]) e++;
			if(e - i > x) ban[v[i]] = 1, reit = 1;
			i = e;
		}
		if(!reit) return true;
	}
}

int main(){
	cin >> n >> m;
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++) cin >> a[i][j];
	}
	int s = 1, e = n;
	while(s != e){
		int m = (s+e)/2;
		if(trial(m)) e = m;
		else s = m+1;
	}
	cout << s;
}


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

using namespace std;

int n;
long long c, x[100005], v[100005], y[100005], z[100005], ans, la, lb;

int main() {
	scanf("%d%lld", &n, &c);
	for (int i = 1; i <= n; i++) {
		scanf("%lld%lld", x + i, v + i);
		// x[i] += x[i - 1];
		v[i] += v[i - 1];
	}
	for (int i = 1; i <= n; i++) {
		y[i] = max(y[i - 1], (v[n] - v[n - i]) - (c - x[n - i + 1]));
		z[i] = max(z[i - 1], (v[n] - v[n - i]) - (c - x[n - i + 1]) * 2);
	}
	for (int i = 0; i <= n; i++) {
		la = max(la, v[i] - x[i] * 2);
		lb = max(lb, v[i] - x[i]);
		ans = max(ans, la + y[n - i]);
		ans = max(ans, lb + z[n - i]);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
#include <stdlib.h>
int main(void){
    
    long long int a,b,v,w,t;
    scanf("%lld %lld", &a,&v);
    scanf("%lld %lld", &b,&w);
    scanf("%lld", &t);
    
    if(v-w<=0){
    printf("NO");
    }else if(llabs(a-b)>(v-w)*t){
    printf("NO");
    }else{
    printf("YES");
    }
    return 0;
}

Measured memory_bytes: 1736
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(ll n){
    ll res = 0;
    vector<ll> w(n); for(auto &in:w) cin >> in;
    vector<vector<ll>> dp(n+1,vector<ll>(n+1,0));
    for(int i = 2; i <= n;i++){
        for(int j = 0; j < n;j++){
            int k = j + i -1;
            if(k >= n) continue;
            
            if(dp[j+1][k-1] == i-2 && abs(w[j] - w[k]) <= 1) dp[j][k] = i;
            for(int l = j; l < k;l++){
                dp[j][k] = max(dp[j][k],dp[j][l] + dp[l+1][k]);
            }
        }
    }
    res = dp[0][n-1];
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll n;
    while(cin >> n,n){
        cout << solve(n) << endl;
    }
    return 0;
}



Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <set>
#include <vector>
using namespace std;

int main(){

    int alpha[30];
    string s;

    cin >> s;

    for(int i = 0 ; i < 30; ++i){
        alpha[i] = false;
    }

    for(int i = 0; s[i] != '\0'; ++i){
        alpha[ s[i]-'a' ] = true;
    }

    for(int i = 0; i < 26; ++i){
        if(alpha[i] == false){
            cout << (char) (i + 'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
#include<stdio.h>

int main(void){
    int a[5],b[5],tmp,ans,i;
    ans = 0;
    tmp = 10;
    for(i=0; i<5; i++){
        scanf("%d",&a[i]);
        ans += a[i];
        b[i] = a[i] % 10;
        if(b[i] != 0 ){
        ans += 10 - b[i];
        }
        if(b[i] > 0 && b[i] < tmp){
            tmp = b[i];
        }
    }
    printf("%d\n",ans - (10 - tmp) );

    return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 55001;

int N;
vector<int> primes;
set<int> is;
bitset<MX> valid;

void sieve() {
	valid.set();
	for (int i = 2; i < MX; i++) {
		if (valid[i]) {
			primes.push_back(i);
			is.insert(i);
			for (int j = i + i; j < MX; j += i) valid[j] = false;
		}
	}
	
}

void solve() {
    sieve();
    cin >> N;
    vector<int> ans;
    for (int i = 0; i < (int)primes.size(); i++) {
		if ((int)ans.size() == N) break;
		if ((int)ans.size() < 2) {
			ans.push_back(primes[i]);
		} else {
			if (primes[i] % 10 == 3) {
				ans.push_back(primes[i]);
			}
		}
	}
	
	for (auto& i : ans) cout << i << " ";
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 512