akhauriyash/Code-Regression huggingface dataset:
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define LL long long
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;	
}
using namespace std;
bool contain[100001];
int ball[100001];
int n,m,ans;
int main()
{
	re(n),re(m);
	contain[1]=1;
	for(int i=1;i<=n;++i)ball[i]=1;
	while(m--)
	{
		int x,y;
		re(x),re(y);
		ball[x]--;ball[y]++;
		if(contain[x])
		{
			contain[y]=1;
			if(!ball[x])contain[x]=0;
		}
	}
	for(int i=1;i<=n;++i)
		ans+=contain[i];
	printf("%d\n",ans);
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#include<unordered_map>
#include<string>
#include<map>
#include<algorithm>
typedef long long int ll;
using namespace std;
#define MAXN   10001
#define MOD 1000000007
#define X first
#define Y second
ll t,n,i,j;
int main()
{
    cin>>n;
    ll c=n,cnt=0;
    while(n>0){
        n=n/10;
        cnt++;
    }
    if(cnt==1)
        cout<<c<<endl;
    else if(cnt==2)
        cout<<"9"<<endl;
    else if(cnt==3)
        cout<<(9+c-100+1)<<endl;
    else if(cnt==4)
        cout<<"909"<<endl;
    else if(cnt==5)
        cout<<(c-10000+910)<<endl;
    else
        cout<<"90909"<<endl;
}


Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var X = one[0];
  var A = one[1];
  if(X < A){
     myout(0);
  }else{
     myout(10);
  }
}

Measured memory_bytes: 9420
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define lli long long int
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define se second;
#define fi first;
#define endl '\n';
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define REP(i,n) for (int i = 1; i <= n; i++)
template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
typedef long long ll;
typedef vector<vector<ll> > matrix;
const ll MOD = 1000000007;
const int K = 9;
const lli mod = 1e9 + 7;
const lli INF = 1e9 + 7;
const lli N=2*1e5;
lli visit[400001];
map<lli,vector<lli> >g;
map<string,lli>pi,m1,m2;
lli var1,var2,var3,var4,var5,var6;
vector<lli>v1,v2,v3,v4;
vector<char>v;
lli X[10][10];
lli n,m,l,t,r,q,p,k,x,y,W;
lli ans=0,ans1=0,ans2=0,ans3=0;
lli L[3001][3001];
string s1,s2;
void print(){
  lli r1=n;
  lli r2=m;
  while(r1>0 and r2>0 ){
    if(s1[r1-1]==s2[r2-1]){
      v.pb(s1[r1-1]);
      r1--;
      r2--;
    }
    else if (L[r1-1][r2] > L[r1][r2-1]){
      r1--;
    }
    else{
        r2--;
      }
  }
  reverse(v.begin(),v.end());
  for(lli i=0;i<v.size();i++){
    cout<<v[i];
  }
}
int main(){
  _
  cin>>s1>>s2;
  n=s1.length();
  m=s2.length();
  for(lli i=1;i<=n;i++){
    for(lli j=1;j<=m;j++){
      if(s1[i-1]==s2[j-1]){
        L[i][j]=L[i-1][j-1]+1;
      }
      else{
        L[i][j]=max(L[i-1][j],L[i][j-1]);
      }
    }
  }
  print();
  // for(lli i=1;i<=n;i++){
  //   for(lli j=1;j<=m;j++){
  //     cout<<L[i][j]<<" ";
  //   }
  //   cout<<endl;
  // }
}


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

bool binarySearch(vector<int> s, int n, int key) {
	int left = 0, right = n, mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (s[mid] == key)return true;
		else if (key < s[mid])right = mid;
		else left = mid + 1;
	}
	return false;
}

int main(void) {
	int n, q, T, ans = 0;
	cin >> n;
	vector<int> S(n);
	for (int i = 0;i < n;i++)cin >> S[i];
	cin >> q;
	for (int i = 0;i < q;i++) {
		cin >> T;
		//if (binarySearch(S, n, T)) ans++;
		if (binary_search(S.begin(), S.end(), T))ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3112
#include<stdio.h>
#include<string.h>
int main()
{
char a[4],b[4],c;
gets(a);
gets(b);
c=b[0];
b[0]=b[2];
b[2]=c;
if(strcmp(a,b)==0)
printf("YES");
else
printf("NO");
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i < (int)(n);i++)
using namespace std;
int main(){
  int n,ch=0;
  cin >> n;
  for(int i=1;i<=n;i++){
    int in;
    cin >> in;
    if(in != i) ch++;
  }
  if(ch <= 2) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
using namespace std;

char ss[110000];
int id;
void dfs(int now,int k,int p)
{
	for(int i=1;i<=p-1-k;i++)
		printf("%d %d\n",now,++id);
	printf("%d %d\n",now,++id);
	now=id;
	for(int i=k-1;i>=1;i--)
		if(ss[i]=='1')
		{
			dfs(now,i,k);
			break;
		}
}
int main()
{
	scanf("%s",ss+1);int n=strlen(ss+1);
	if(ss[n]=='1'||ss[1]=='0'){printf("-1\n");return 0;}
	n--;
	for(int i=1;i<=n;i++)
		if(ss[i]!=ss[n-i+1]){printf("-1\n");return 0;}
		
	id=1;
	for(int i=(n+1)/2;i>=1;i--)
		if(ss[i]=='1')
		{
			dfs(1,i,n+1);
			break;
		}
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll max(ll a, ll b){ 
	if(a >= b) return a;
	else if(a < b) return b;
}
int main(){
	int n; cin >> n;
	vector<int>a(n);
	int ans = 0;
	for(int i = 0; i < n; i++){
		int temp; cin >> temp;
		ans += temp;
		--ans;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x; }
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  Sieve sieve(n+10);
  unordered_map<int,int> mp;
  for (int i = 1; i <= n; ++i) {
    auto fact = sieve.factor(i);
    for (auto p:fact) {
      mp[p.first] += p.second;
    }
  }
  int ans = 0;
  vector<int> cnt(5,0); //2,4,14,24,74以上の個数
  for (auto p:mp) {
    debug(p.first,p.second);
    if (p.second >= 74) cnt[4]++;
    if (p.second >= 24) cnt[3]++;
    if (p.second >= 14) cnt[2]++;
    if (p.second >= 4) cnt[1]++;
    if (p.second >= 2) cnt[0]++;
  } 
  ans += cnt[1]*(cnt[1]-1)*(cnt[0]-2)/2; //4で2個使ってる
  ans += cnt[3]*(cnt[0]-1);
  ans += cnt[2]*(cnt[1]-1);
  ans += cnt[4];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        for (long i = 1; i < 3501; i++)
            for (long j = i; j < 3501; j++)
            {
                var w1 = n * i * j;
                var w2 = 4 * i * j - n * (i + j);
                if (w2 > 0 && w1 % w2 == 0) { Console.WriteLine("{0} {1} {2}", i, j, w1 / w2); goto end; }
            }
        end:;
    }
}

Measured memory_bytes: 13140
from bisect import (
    bisect_left,
    bisect_right
)

def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    a.sort()
    c.sort()

    ans = 0
    for target in b:
        ans += bisect_left(a, target) * (len(c) - bisect_right(c, target))
    print(ans)

main()


Measured memory_bytes: 105444
#include<iostream>
using namespace std;
int main(void)
{
	int a,b,c,i,x;
	cin>>a>>b>>c;
	for(i=1;i<=100;i++) if(c==a*i%b) x++;
	if(x!=0) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    ll n;
    cin >> n;
    ll ans = n*(n-1)/2;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define pb           push_back
#define pf           push_front
#define in           insert
#define ff           first
#define ss           second
#define int          long long
#define rep(i,x,m)   for(int i=x;i<m;i++)
#define repr(i,x,m)  for(int i=x;i>=m;i--)
#define MOD          1000000007
#define endl         "\n"
#define all(v)       v.begin(),v.end()
#define rall(v)      v.rbegin(),v.rend()
#define vi           vector<int>
#define pi           pair<int,int>
#define sz(x)       (int)x.size()
#define pq           priority_queue<int>
#define pqs          priority_queue<int,vi,greater<int> >
#define fix(y)       fixed<<setprecision(y)
#define print(v)     for(int i=0;i<v.size();i++) cout<<v[i]<<" ";cout<<endl
#define FIO         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

int fac[2000005]={0};
void factorial(){ fac[0]=1; fac[1]=1; for(int i=2;i<200005;i++) fac[i]=((i%MOD)*(fac[i-1]%MOD))%MOD;}
int power(int n,int m)
{int p=1;if(m==0)return 1;p=(power(n,m/2)%MOD);p=(p%MOD*p%MOD)%MOD;
return(m&1?((p%MOD*n%MOD)%MOD):(p%MOD));}
int ncr(int n,int r){return ((fac[n]*power(fac[r],MOD-2))%MOD*power(fac[n-r],MOD-2))%MOD;}

void ram5564()
{
     int n;
     cin>>n;
     string s;
     cin>>s;
     int mx=1e9;
     int cnt=0;
     rep(i,0,n)
     {
        if(s[i]=='R')++cnt;
     }
     mx=min(mx,cnt);
     mx=min(mx,n-cnt);
     int cnt1=0;
     rep(i,0,cnt)
     {
        if(s[i]=='R')
            cnt1+=1;
     }
     mx=min(mx,cnt-cnt1);
     cout<<mx;

}

signed main()
{
        FIO
        // #ifndef ONLINE_JUDGE
        //   freopen("input.txt","r",stdin);
        //   freopen("output.txt","w",stdout);
        // #endif   
        
        int t=1;
        //cin>>t;
        while(t--)
        ram5564();
        cerr<<"\n"<<(float)clock()/CLOCKS_PER_SEC*1000<<" ms"<<endl;

        return 0;
}

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

int main() {
    LL n;
    scanf("%lld", &n);
    LL sum = 0;
    for(LL i = 1; i <= n; ++i)
        sum += i * (n-i+1);
    for(LL i = 1, u, v; i < n; ++i) {
        scanf("%lld %lld", &u, &v);
        if(u > v) swap(u, v);
        sum -= u * (n-v+1);
    }
    printf("%lld\n", sum);
    return 0;
}

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

int main() {
	int n,i,c;
	string s;
	cin >> n >> s;
	for(i=0; i<s.size(); i++){
		c=s[i]-'A';
		c=(c+n)%26;
		s[i]='A'+c;
	}
	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
import sys, os, math, bisect, itertools, collections, heapq, queue

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def partition(A, P, R):
    x = A[R]
    i = P - 1
    for j in range(P, R):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[R] = '[' + str(A[R]) + ']'  # 基準となる要素
    A[i + 1], A[R] = A[R], A[i + 1]
    return i + 1


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

    N = ii()
    A = il()
    partition(A, 0, N - 1)
    print(*A)


if __name__ == '__main__':
    main()



Measured memory_bytes: 16024
package main

import (
	"fmt"
	"sort"
)

func main() {
	// Code for C - Poll
	var N int
	fmt.Scanf("%d", &N)

	var temp string
	S := make(map[string]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%s", &temp)
		S[temp]++
	}

	var max int
	key := make([]string, N)
	var count int
	for i, v := range S {
		if max < v {
			max = v
		}
		key[count] = i
		count++
	}

	sort.Sort(sort.StringSlice(key))

	for i := 0; i < len(key); i++ {
		if max == S[key[i]] {
			fmt.Println(key[i])
		}
	}
}


Measured memory_bytes: 21024
import sys
import heapq
def input(): return sys.stdin.readline().rstrip()
 
def main():
    n,m=map(int, input().split())
    li=[]
    for _ in range(n):
        b,a=map(int, input().split())
        if m-b >= 0:
            li.append([a,m-b])
    li.sort(key=lambda x: x[1])
    h=[]
    for i in li:
        if len(h) >= i[1]+1:
            heapq.heappushpop(h, i[0])
        else:
            heapq.heappush(h, i[0])
    print(sum(h))
    

if __name__=='__main__':
    main()

Measured memory_bytes: 25348
n , l = map(int, input().split())
l_list = [l + i for i in range(n)]
min_l = min(l_list)
max_l = max(l_list)
if max_l <= 0:
    ans = sum(l_list) - max_l
elif min_l >= 0:
    ans = sum(l_list) - min_l
elif (max_l > 0) & (min_l < 0):
    ans = sum(l_list)
print(ans)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <string>
#include <utility>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstring>
#include <complex>
#include <queue>
#include <stack>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}


void run(){
  int n,m;
  cin>>n>>m;
  vector<pi> a(n);
  rep(i,n){
    cin>>a[i].fi>>a[i].se;
  }
  sort(all(a));

  int ans=0;
  int c=0;
  rep(i,n){
    if(c>m)break;
    if(c+a[i].se<=m){
      ans+=a[i].fi*a[i].se;
      c+=a[i].se;
    }
    else{
      ans+=a[i].fi*(m-c);
      c+=m-c;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const ll INF = numeric_limits<ll>::max();
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
  if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
  if (!t) return 1;
  mint a = pow(t>>1);
  a *= a;
  if (t&1) a *= *this;
  return a;
}
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
int main()
{
    ll n; cin >> n;
    mint a = 10;
    a = a.pow(n);
    mint b = 9;
    b = b.pow(n);
    mint c = 8;
    c = c.pow(n);
    mint ans = a + c - b*2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
using ll=long long;using ull=unsigned long long;
#include<limits>
namespace pcl{template<typename T>constexpr T TNF=std::numeric_limits<T>::max()/2;constexpr int INF=TNF<int>;constexpr ll LNF=TNF<ll>;constexpr double DNF=TNF<double>;constexpr double EPS=1e-8;constexpr int P7=1'000'000'007;constexpr int DX[]={1,0,-1,0,1,1,-1,-1};constexpr int DY[]={0,1,0,-1,-1,1,1,-1};}
#include<algorithm>
#include<cmath>
#include<iostream>
namespace pcl{template<typename T>void updmax(T&a,T const&b){a=std::max(a,b);}template<typename T>void updmin(T&a,T const&b){a=std::min(a,b);}template<typename T,typename U,typename V>bool in_range(T const&begin,U const&mid,V const&end){return begin<=mid&&mid<end;}template<typename T,typename U,typename V>bool in_range(T const&begin,std::initializer_list<U>list,V const&end){auto p=std::minmax_element(list.begin(),list.end());return begin<=*p.first&&*p.second<end;}template<typename T,typename U,typename V>bool in_range_strict(T const&begin,std::initializer_list<U>list,V const&end){if(!std::is_sorted(list.begin(),list.end()))return false;return in_range(begin,list,end);}template<typename T>inline T cget(){T x;std::cin>>x;return x;}}
#include<iostream>
#include<vector>
namespace pcl{template<typename T>std::ostream&operator<<(std::ostream&os,std::vector<T>const&v){os<<'[';for(size_t i=0;i<v.size();i++){if(i!=0)os<<",";os<<v[i];}os<<']';return os;}template<typename T>std::istream&operator>>(std::istream&is,std::vector<T>&v){for(size_t i=0;i<v.size();i++)is>>v[i];return is;}}
#include<bits/stdc++.h>
using namespace std;using namespace pcl;int main(){int N;cin>>N;vector<pair<ll,ll>>lr;ll lmax=0;ll rmin=LNF;ll max_range=0;lr.reserve(N);for(int i=0;i<N;i++){ll L,R;cin>>L>>R;R++;updmax(lmax,L);updmin(rmin,R);updmax(max_range,R-L);lr.push_back(make_pair(L,R));}ll ans1=max(0ll,rmin-lmax)+max_range;vector<pair<ll,ll>>ab(N);for(int i=0;i<N;i++){ab[i].first=max(0ll,lr[i].second-lmax);ab[i].second=max(0ll,rmin-lr[i].first);ab[i].second*=-1;}sort(ab.begin(),ab.end());int lmax_idx=-1;for(int i=0;i<N;i++){if(rmin-(-ab[i].second)==lmax)lmax_idx=i;}ll ans2=0;ll bmin=LNF;for(int i=1;i<=N-1;i++){updmin(bmin,-ab[i-1].second);updmax(ans2,ab[i].first+bmin);}cout<<max(ans1,ans2)<<endl;}


Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

const int N = 1e9;

int n, k, s;

int main() {
	scanf("%d%d%d", &n, &k, &s);
	while (n--) {
		if (k) {
			printf("%d ", s);
			--k;
		}
		else {
			if (s == N) printf("%d ", N - 1);
			else printf("%d ", N);
		}
	}
	return 0;
}

Measured memory_bytes: 1280
// Ai を A-1 に置き換えると、部分和%K = 0 を数える問題になる。
// 部分和を求めるために累積和を作る。
// (R[j] - R[i])%K = 0 な数を数えるので、R[j]%K == R[i]%K を数えればOK。

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPI(i,f,n) for(int i=(f);i<(n);++i)
using namespace std;
typedef long long ll;

ll R[200005];
ll A[200005];

int main() {
  ll N, K;
  cin >> N >> K;
  R[0] = 0;
  for(int i=1; i<=N; i++) {
    cin >> A[i];
    R[i] = R[i-1] + A[i] - 1;
  }
//  REP(i,N+1) cout << R[i] << " ";
//  cout << endl;
  ll ans = 0;
  map<ll,ll> M;
  M[0] = 1;
  for(int i=1; i<=N; i++) {
    if ( i-K >= 0 ) M[ R[i-K]%K ]--;
    ans += M[ R[i]%K ];
    M[ R[i]%K ]++;
  }
//  for ( auto x: M ) cout << x.first << " " << x.second << endl;
  cout << ans << endl;
}


Measured memory_bytes: 15872
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main argv =
    let [a;b;k] = reads int
    seq {
        for i in 100 .. -1 .. 1 do
            if a % i = 0 && b % i = 0 then yield i
    }
    |> Seq.item (k - 1)
    |> printfn "%i"
    0

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

long s, x, y;
const long a = 1e9;

int main(){
	cin >> s;
	x = s % a;
	y = s / a + (x != 0);
	x = (x == 0) ? x : a - x;
	printf("%d %d %ld %d %ld %ld", 0, 0, a, 1, x, y);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int D; cin >> D; 
	int C[30] = {}; 
	for(int i = 1; i <= 26; i++) cin >> C[i]; 
	int S[370][30] = {}; 
	for(int i = 1; i <= D; i++){
		for(int j = 1; j <= 26; j++){
			cin >> S[i][j]; 
		}
	}
	int T[370] = {}; 
	for(int i = 1; i <= D; i++) cin >> T[i]; 
	for(int i = 1; i <= D; i++){
		int a = 0; int mx = 0; 
		for(int j = 1; j <= 26; j++){
			if(S[i][j] > mx){
				a = j; mx = S[i][j]; 
			}
		}
		cout << a << endl; 
	}
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int M, N, ans = 0;
    cin >> M >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    if (M == 2) {
        int count = 0;
        for (int i = 0; i < N; i++) {
            if (A.at(i) == 1 && i % 2 == 0) {
                count++;
            }
            else if (A.at(i) == 2 && i % 2 == 1){
                count++;
            }
        }
        cout << min(N - count, count) << endl;
        return 0;
    }
    else {
        for (int i = 0; i < N - 1; i++) {
            if (A.at(i) == A.at(i + 1)) {
                ans++;
                i++;
            }
        }
    }
    cout << ans << endl;

}



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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

struct pos{
  ll x, y;
  ll dis(pos p){
    return abs(p.x - x) + abs(p.y - y);
  }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;
  cin >> n >> m;
  ll x,y;
  vector<pos> p(n),q(m);
  rep(i,n){
    cin >> x >> y;
    p[i] = {x,y};
  }
  rep(i,m){
    cin >> x >> y;
    q[i] = {x,y};
  }
  rep(i,n){
    ll cp = inf,dis = inf;
    rep(j,m){
      if(dis > p[i].dis(q[j])){
        cp = j;
        dis = p[i].dis(q[j]);
      }
    }
    std::cout << cp+1 << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ )
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair  
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is #" << (x) <<"#" <<endl
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9+7;
const ll MAX = 1e5+5;
const ll inf = 1e18+7;

ll dp[MAX];
int main() {
  fastio;
  ll n,capac;
  cin>>n>>capac;
  f(i,0,MAX+1) dp[i]=inf;
  dp[0]=0;
  f(i,0,n){
    ll w,v;
    cin>>w>>v;
    af(j,MAX,v){
      if(dp[j-v]!=inf) dp[j]=min(dp[j],dp[j-v]+w);
    }
  }
  af(j,MAX,0){
  if(dp[j]<=capac){cout<<j<<"\n";break;}
  }
  return 0; 
}

Measured memory_bytes: 4424
def main():
    n = int(input())
    s = list(map(int,input().strip().split()))

    if s[0] % n == 0 or s[1] % n == 0:
        print("OK")
        return 

    for nn in range(s[0], s[1]):
        if nn % n == 0:
            print("OK")
            return 
    print("NG")
    return

main()


Measured memory_bytes: 9128
use proconio::input;
use proconio::marker::Usize1;
use std::collections::HashSet;
fn main() {
    input! {
        h: usize, w: usize, m: usize,
    };
    let mut row: Vec<usize> = vec![0; h];
    let mut col: Vec<usize> = vec![0; w];
    let mut tgt: HashSet<(usize, usize)> = HashSet::new();
    for _ in 0..m {
        input! {
            i:Usize1 , j:Usize1
        };
        row[i] += 1;
        col[j] += 1;
        tgt.insert((i,j));
    }
    let a: usize = *row.iter().max().unwrap();
    let b: usize = *col.iter().max().unwrap();
    let aind: Vec<usize> = row.iter().enumerate()
        .filter(|(_, &x)| x==a)
        .map(|(i, _)| i).collect();
    let bind: Vec<usize> = col.iter().enumerate()
        .filter(|(_, &x)| x==b)
        .map(|(i, _)| i).collect();
    let mut cnt = 0;
    for i in aind {
        for &j in &bind {
            cnt += 1;
            if cnt > m {
                println!("{}", a+b);
                return;
            } else if tgt.contains(&(i,j)) {
                continue;
            } else {
                println!("{}", a+b);
                return;
            }
        }
    }
    println!("{}", a+b-1);
}

Measured memory_bytes: 23984
//
//  main.cpp
//
 
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
 
template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

int main() {
	ll N;
	cin >> N;
	vector<ll> pis;
	vector<ll> qis(N);
	for (ll i = 0; i < N; i++) {
		ll pi;
		cin >> pi;
		pi--;
		pis.push_back(pi);
		qis[pi] = i;
	}
	vector<ll> ais(N);
	vector<ll> bis(N);
	vector<ll> cis(N);
	for (ll i = 0; i < N; i++) {
		cis[i] = i;
	}
	for (ll i = 1; i < N; i++) {
		ais[i] = max(ais[i-1], ais[i-1] - cis[qis[i-1]] + cis[qis[i]]) + 1;
	}
	for (ll i = 0; i < N; i++) {
		bis[i] = cis[qis[i]] - ais[i];
	}
	for (vector<ll>* xs_p : {&ais, &bis}) {
		vector<ll>& xs = *xs_p;
		ll mn = *min_element(xs.begin(), xs.end());
		if (mn <= 0) {
			for (ll i = 0; i < xs.size(); i++) {
				xs[i] += -mn + 1;
			}
		}
		for (ll i = 0; i < xs.size(); i++) {
			cout << xs[i];
			if (i < xs.size() - 1) {
				cout << " ";
			}
		}
		cout << endl;
	}
}


Measured memory_bytes: 1532
use std::cmp::min;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let a: usize = read(&mut stdin_lock, &mut buf, b' ');
    let b: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let s: String = read(&mut stdin_lock, &mut buf, b'\n');
    let cv: Vec<char> = s.chars().collect();
    let n = cv.len();
    let ans = n == a + b + 1
        && cv[a] == '-'
        && cv[0..a].iter().all(|&c| c.is_digit(10))
        && cv[min(a + 1, n - 1)..n].iter().all(|&c| c.is_digit(10));
    println!("{}", if ans { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void){
  int d,n,data=1;
  if(scanf("%d%d",&d,&n)==1);
    for(int i=0;i < d;i++){
      data *= 100;
    }
    if(n<=99){
      data *= n;
    }else{
      data *= 101;
    }

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

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll a, b, n;std::cin >> n;
  vvl d = vv(n, 2, 0, ll);
  re(i, n) {
    std::cin >> a >> b;
    d[i][0] = a-b, d[i][1] = a+b;
  }
  sort(all(d));
  ll ans = 0;
  ll right = -100000000000000000, mode = 1;
  for(int i=0;i<n;i++){
    if(mode==1){
      if(d[i][0]>=right) ans++, mode = 0, right = d[i][1];
    }else{
      if(d[i][0]>=right) ans++, right = d[i][1];
      right = min(right, d[i][1]);
    }
    //std::cout << ans << " " << right << '\n';
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 6392
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
B=[0]*(N+1)
for i in range(1,N+1):
    B[i]=B[i-1]+A[i-1]
D=[0]*(2*10**5+1)
for i in range(N):
    D[A[i]]+=1
for i in range(len(D)-1,0,-1):
    D[i-1]+=D[i]
#print(D)
#print(A)
#print(D)
l=-1
r=2*10**5+1
while r-l>1:
    m=(l+r)//2
    s=0
    for i in range(N):
        s+=D[max(1,m-A[i])]
    if s>=M:
        l=m
    else:
        r=m
ans=0
s=0
for i in range(N):
    v=max(0,r-A[i])
    t=max(0,min(D[v],M-s))
    ans+=B[t]+t*A[i]
    s+=t
ans+=l*(M-s)
print(ans)


Measured memory_bytes: 54660
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
char a[15];
int main(void)
{
	int i,n,sum=0;
	scanf("%s",a+1);n=strlen(a+1);
	if(a[1]!='A'){printf("WA\n");return 0;}
	for(i=1;i<=n;++i)
	{
		if(a[i]=='A'||a[i]=='C')continue;
		if(a[i]>='A'&&a[i]<='Z'){printf("WA\n");return 0;}
	}
	for(i=3;i<n;++i)sum+=a[i]=='C';
	if(sum==1)printf("AC\n");
	else printf("WA\n");
	return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    cin >> n;
    vi xy(n), xy2(n);
    rep(i, n) {
        int a;
        cin >> a;
        rep(j, a) {
            int x, y;
            cin >> x >> y;
            --x;
            xy[i] |= y<<(x);
            xy2[i] |= 1<<(x);
        }
    }
    int ans = 0;
    rep(i, 1<<n) {
        bool ok = true;
        rep (j, n) {
            if (!(i>>j&1)) continue;
            if ((i ^ xy[j]) & xy2[j] & ((1<<n)-1)) ok = false;
        }
        if (ok) {
            int bits = 0, t = i;
            rep(j, n) {
                if (t%2) ++bits;
                t >>= 1;
            }
            if (bits > ans) ans = bits;
        }
    }
    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);

        String T = sc.next();
        sc.close();
      
      	String result = T;
        result = result.replaceAll("P\\?", "PD");
        result = result.replaceAll("\\?D", "PD");
        result = result.replaceAll("\\?\\?", "PD");
        result = result.replaceAll("\\?", "D");
        System.out.println(result);
    }
}

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

ll mod = 1000000007;


int main() {
	long long x; cin >> x;
	int cnt = 0;
	long long money = 100;
	while(money < x){
		long long tmp = money /100;
		money += tmp;
		cnt++;
	}
	cout << cnt << endl;
}


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

using ll = long long;

#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

void solve(long long A, long long B, long long K) {
  ll div = gcd(A, B);  // 順番考慮したほうがいいかも
  ll counter = 1;

  while (K != counter) {
    div -= 1;
    if (A % div == 0 && B % div == 0) counter++;
  }

  cout << div << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  long long K;
  scanf("%lld", &K);
  solve(A, B, K);
  return 0;
}


Measured memory_bytes: 256
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.ST                 as ST
import qualified Data.Array.Unboxed            as AU
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                   as IM
import           Data.List
import qualified Data.Map                      as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                      as S
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

main = do
  [n] <- readInt
  s   <- replicateM n getLine
  print $ length $ group $ sort s


Measured memory_bytes: 165376
#include <iostream>
#include <cstring>

#define MOD 1'000'000'007

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;

    int dp[H + 1][W + 1];
    memset(dp, 0, sizeof(dp));
    dp[1][1] = 1;

    char a;
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            cin >> a;
            if (a == '.') {
                dp[i][j] += dp[i - 1][j] + dp[i][j - 1];
                dp[i][j] %= MOD;
            }
        }
    }

    cout << dp[H][W] << endl;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(long long i=0;i<(n);i++)
#define rep2(i,m,n) for(long long i=(m);i<(n);i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back







int main(){

    int n;
    cin>>n;

    cout<<(2199-n)/200<<endl;






}








            






Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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; }

#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
//#define vvector(name,typ,m,n)vector<vector<typ> > name(m,vector<typ> (n))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
ll ceil(ll a,ll b){
    return ((a+b-1)/b);
}
const int INF = 2000000000;
const ll INF64 = 9223372036854775807ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
//mapは、if関数などで覗いただけで構成されるので注意しよう！
//std::vector<vector<int>> g;


//std::vector<std::set<int>> g;
int main(){
    int n,m;
    std::cin >> n>>m;
    vvector(a,char,n,n,0);
    vvector(b,char,m,m,0);
    reprep(i,j,n,n)std::cin >> a[i][j];
    reprep(i,j,m,m)std::cin >> b[i][j];
    bool ans=0;
    reprep(ii,jj,n-m+1,n-m+1){
        bool bo=1;
        reprep(i,j,m,m){
            if(a[i+ii][j+jj]!=b[i][j])bo=0;
        }
        if(bo)ans=1;
    }    
    if(ans)std::cout << Yes << std::endl;
    else std::cout << No << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target ("avx2,avx,fma")
#define ll long long int
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define make_pair
#define rep(i,l,r) for(i=l;i<r;i++)
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
int main()
{
    io;
    string s;
    cin>>s;
    int i;
    ll ans=0,r=0;
    rep(i,0,s.length())
    {
        if(s[i]=='A')
            r++;
        else if(s[i]=='C')
        {
            if(i>=1&&s[i-1]=='B')
            r=r;
            else
                r=0;
        }
        else
        {
            if(i+1<s.length()&&s[i+1]=='C')
                ans+=r;
            else
                r=0;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 720
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner	sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];
		int[] d = new int[n];
		for(int i = 0 ; i < n ; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		for(int i = 0 ; i < n ; i++) {
			c[i] = sc.nextInt();
			d[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0 ; i < n ; i++) {
			int minBlueIndex = 300;
			int minBlueValue = 300;
			for(int j = 0 ; j < n ; j++) {
				if(minBlueValue > c[j] && c[j] != -1 && d[j] != -1) {
					minBlueIndex = j;
					minBlueValue = c[j];
				}
			}
			int maxRedIndex = -1;
			int maxRedValue = -1;
			for(int j = 0 ; j < n ; j++) {
				if(a[j] < c[minBlueIndex] && b[j] < d[minBlueIndex]) {
					if(maxRedValue < b[j]) {
						maxRedIndex = j;
						maxRedValue = b[j];
					}
				}
			}
			if(maxRedIndex != -1) {
				a[maxRedIndex] = -1;
				b[maxRedIndex] = -1;
				c[minBlueIndex] = -1;
				d[minBlueIndex] = -1;
				ans++;
			} else {
				c[minBlueIndex] = -1;
				d[minBlueIndex] = -1;
			}
		}
		System.out.println(ans);
	}
}


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

int partition(int A[], int p, int r){
	int x=A[r];
	int i=p-1;
	for(int j=p;j<r;j++){
		if(A[j]<=x){
			i++;
			swap(A[i],A[j]);
		}
	}
	swap(A[i+1],A[r]);
	return i+1;
}

int main(){
	int n, A[500000];
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> A[i];
	}
	int p=partition(A,0,n-1);
	for(int i=0;i<n;i++){
		if(i==p) cout << "[";
		cout << A[i];
		if(i==p) cout << "]";
		if(i!=n-1) cout << " ";
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 3528
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int k = sc.nextInt();
    
    int[] a = new int[n];
    
    for(int i = 0; i < n; i++)
      a[i] = sc.nextInt();
    
    for(int i = k; i < n; i++){

      if(a[i-k] < a[i])
        System.out.println("Yes");
      else
        System.out.println("No");
      
    }
  }
}


Measured memory_bytes: 71652
#include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;

void call(int n) {
	int i = 1;
	do {
		int x = i;
		if(x % 3 == 0){
			cout << " " << i;
			continue;
		}
		do {
			if(x % 10 == 3) {
				cout << " " << i;
				break;
			}
			x /= 10;
		} while(x);
	} while(++i <= n);
	cout << endl;
}

int main() {
	int n;
	cin >> n;
	call(n);
	return 0;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if ((c-1)/b <= (a-1)/d) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3624
#include<iostream>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
typedef unsigned long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
pair<int, bool> pair[102];
int main() {
    ll x, n;
    cin >> x >> n;
    bool p[102];
    rep(i, 102) p[i] = true;
    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        p[k] = false;
    }
    int ans;
    for (int i = 0; i < 102; i++) {
        if (p[x - i]) {
            ans = x - i;
            break;
        } else if (p[x + i]) {
            ans = x + i;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632