akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef pair<double,ll> pdl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<pdd> vdd;
typedef vector<pdi> vdi;
typedef vector<pdl> vdl;
typedef vector<string> vs;
#define fi first
#define se second
const ll INFLL=LLONG_MAX;
const int INF=INT_MAX;
const ll MAXLL=0x3f3f3f3f3f3f3f3f;
const int MAX=0x3f3f3f3f;
const ll MOD=1000000007;
const ll mod=998244353;
#define eb emplace_back
#define emp emplace
#define mp(a,b) make_pair(a,b)
template<class T> using min_heap=priority_queue<T,vector<T>,greater<T> >;
template<class T>
void sort(vector<T>& v){
	sort(v.begin(),v.end());
}
template <class T, class U>
void sort(vector<T>& v,U func){
	sort(v.begin(),v.end(),func);
}
template<class T>
void rsort(vector<T>& v){
	sort(v.rbegin(),v.rend());
}
template <class T>
int lb_index(vector<T>& v,T k){
	return lower_bound(v.begin(),v.end(),k)-v.begin();
}
template <class T>
int ub_index(vector<T>& v,T k){
	return upper_bound(v.begin(),v.end(),k)-v.begin();
}
template<class T>
bool is_sorted(vector<T>& v){
	return is_sorted(v.begin(),v.end());
}
template<class T>
bool sorted(vector<T>& v){
	return is_sorted(v);
}
void precompute(){

	return;
}
void solve(){
	vvi a(3,vi(3));
	vvb b(3,vb(3));
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++)cin>>a[i][j];
	}
	int q;
	cin>>q;
	while(q--){
		int n;
		cin>>n;
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(n==a[i][j])b[i][j]=1;
			}
		}
	}
	for(int i=0;i<3;i++){
		if(b[i][0]&&b[i][1]&&b[i][2]){
			cout<<"Yes";
			return;
		}
		if(b[0][i]&&b[1][i]&&b[2][i]){
			cout<<"Yes";
			return;
		}
	}
	if(b[2][0]&&b[1][1]&&b[0][2]){
		cout<<"Yes";
		return;
	}
	if(b[0][0]&&b[1][1]&&b[2][2]){
		cout<<"Yes";
		return;
	}
	cout<<"No";
	return;
}

int main(){
	ios::sync_with_stdio(0);
	int numberofsubtestcases=1;
//	cin>>numberofsubtestcases;
	precompute();
	for(int looping=1;looping<=numberofsubtestcases;looping++){
//		cout<<"Case #"<<looping<<": ";
		solve();
	}
	return 0;
}




Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;

bool BinarySearch(int key, vector<int> v)
{
    int l = 0;
    int r = v.size();
    int m = (l+r)/2;
    while(l < r){
        if (v[m] == key) return true;
        else if (v[m] < key) l = m + 1;
        else r = m;
        m = (l+r) / 2;
    }
    return false;
}
int main()
{
    int n, q;
    cin >> n;
    vector<int> s(n);
    rep(i,n) cin >> s[i];
    cin >> q;
    vector<int> t(q);
    rep(i,q) cin >> t[i];

    int ans = 0;
    rep(i,q){
        if (BinarySearch(t[i], s) == true) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3864
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		int k = scanner.nextInt();
		Set<String> set = new TreeSet<>();

		for (int i = 0; i < s.length(); i++) {
			for (int j = i + 1; j < i + 1 + k; j++) {
				if (j <= s.length()) {
					String str = s.substring(i, j);
					set.add(str);
				}
			}
		}

		int cnt = 1;
		for (String tmp : set) {
			if (cnt == k) {
				System.out.println(tmp);
			}
			cnt++;
		}

	}
}


Measured memory_bytes: 26452
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pf(n) printf("%lld\n",n)
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1001001001;
const double PI = acos(-1);

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];

	int cnt = 0;
	rep(i, n) {
		if ((i + 1) % 2 != 0 && a[i] % 2 != 0) {
			//printf("%d %d\n",i+1,a[i]);
			cnt++;
		}
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<=(int)(n); i++)
#define rep2(i, n, m) for(int i=n; i<=m; i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;
typedef vector<ll> vl;
const ll inf=1LL << 60;
const ll MOD=1e9+7;

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

  int x, y, z;
  cin >> x >> y >> z;

  cout << (x-z)/(y+z) << endl;

  return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;class Main{public static void main(String[] args){Scanner scan = new Scanner(System.in);int b = scan.nextInt()%10;switch(b){case 2:case 4:case 5:case 7:case 9:System.out.println("hon");break;case 0:case 1:case 6:case 8:System.out.println("pon");break;case 3:System.out.println("bon");break;}}}

Measured memory_bytes: 35636
$_=<>;
($_,$_,$X,$Y) =split;
$_=<>;
@x=sort {$a <=> $b} split;
$_=<>;
@y=sort {$a <=> $b} split;

print (($x[-1] < $y[0] && $X < $Y && $X < $y[0] && $x[-1] < $Y) ? "No War" : "War");

Measured memory_bytes: 512
#include<bits/stdc++.h>
int n,k,a,b,c,ds,fa[200010],L[200010],R[200010],d;
int ask(int x){return x==fa[x]?x:fa[x]=ask(fa[x]);}
long long m;
int main(){
	scanf("%d%lld%d",&n,&m,&k);ds=n;
	for(int i=0;i<n;i++)fa[i]=i;
	while(k--){
		scanf("%d%d%d",&a,&b,&c);
		int p=ask(a),q=ask(b);
		if(c==0&&p!=q)ds--,fa[q]=p;
		if(c==1)L[++d]=a,R[d]=b;
	}
	for(int i=1;i<=d;i++)if(ask(L[i])==ask(R[i]))return puts("No"),0;
	puts((m+ds-n>1ll*ds*(ds-1)/2)||(d&&(ds==2||m<n))?"No":"Yes");
	return 0;
}

Measured memory_bytes: 1408
l = [int(input()) for _ in range(5)]
ans = 0
m = []
for i in range(5):
    if l[i] % 10 != 0:
        m.append(l[i] % 10)
m.sort()
for i in l:
    if i % 10 != 0:
        ans += ((i // 10) + 1) * 10
    else:
        ans += i
if m != []:
    print(ans - 10 + m[0])
else:
    print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(obj) (obj).begin(),(obj).end()

using namespace std;


int main() {
	speed;
	int n;
	int a, b;
	cin >> n;
	if (n == 2) {
		cin >> a >> b;
		cout << a + b;
	}
	else {
		cout << "Hello World";
	}
	ed;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
c = 0
for i in range(0, n):
    c += min(A[i], B[i])
    if B[i] > A[i]:
        c += min(A[i+1], (B[i] - A[i]))
        A[i+1] -= min(A[i+1], (B[i] - A[i]))
print(c)

Measured memory_bytes: 18476
#include <bits/stdc++.h>
#define Open(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
#define rg  register
#define LL long long
using namespace std;
const int MAXN=666;
const int INF=0x3f3f3f3f;
int A,B;
int d[MAXN][MAXN],f[MAXN][MAXN];

template <typename T> inline void in(T &a) {
	T ch = getchar(), f = 1;
	for(a = 0; !isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
	for( ; isdigit(ch); ch = getchar()) a = (a << 3) + (a << 1) + ch - '0';
	a *= f;
}

template <typename T> inline void print(T x) {
	if(x < 0) putchar('-'), x = -x;
	if(x > 9) print(x / 10);
	putchar(x % 10 + '0');
}
//f[i][j]=max{d[x][y]-i*x-j*y}
//表示从S到T的路径上有i个x和j个y时其余边的最小可能长度
//d[x][y]=min{f[i][j]+i*x+j*y}

signed main(){
	in(A),in(B);
	
	for(rg int i=1;i<=A;i++){
		for(rg int j=1;j<=B;j++)
			scanf("%d",&d[i][j]);
	} 
    
    for(rg int i=0;i<=100;i++){
    	for(rg int j=0;j<=100;j++){
    		for(rg int x=1;x<=A;x++){
				for(rg int y=1;y<=B;y++)
					f[i][j]=max(f[i][j],d[x][y]-i*x-j*y);
			}
		}
	}
	
	int now=INF;
	for(rg int x=1;x<=A;x++){
		for(rg int y=1;y<=B;y++){
			now=INF;
			for(rg int i=0;i<=100;i++){
				for(rg int j=0;j<=100;j++)
					now=min(now,f[i][j]+i*x+j*y);
			}
			if(now!=d[x][y]){
				puts("Impossible");
				return 0;
			}
		}
	}
    puts("Possible");
    puts("202 10401");
    for(rg int i=1;i<=100;i++)
    	printf("%d %d X\n",i,i+1);
    for(rg int i=102;i<=201;i++)
    	printf("%d %d Y\n",i,i+1);
    for(rg int i=0;i<=100;i++){
    	for(rg int j=0;j<=100;j++)
    		printf("%d %d %d\n",i+1,202-j,f[i][j]);
	}
	puts("1 202");
	return 0;
}
/*


*/


Measured memory_bytes: 640
#include<iostream>

using namespace std;

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

  int score[n];
  for(int i = 0; i < n; i++) score[i] = 0;

  for(int i = 0; i < (n * (n-1)/2); i++){
    int t1, t2, s1, s2;
    cin >> t1 >> t2 >> s1 >> s2;
    if(s1 > s2) score[t1 - 1] += 3;
    else if(s1 < s2) score[t2 - 1] += 3;
    else if(s1 == s2){score[t1 - 1]++; score[t2 - 1]++;}
  }

  int rank[n];
  for(int i = 0; i < n; i++) rank[i] = 1;

  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      if(score[i] < score[j]) rank[i]++;
    }
  }


  for(int i = 0; i < n; i++) cout << rank[i] << endl;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

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

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

int main()
{
    int n,ans = 0;
    cin >> n;
    int p[n];
    rep(i, n)cin >> p[i];
    rep(i, n - 2){
        if (p[i] < p[i + 1] && p[i + 1] <= p[i + 2]) {
            ++ans;
        }else if (p[i] >= p[i + 1] && p[i + 1] > p[i + 2]){
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(t) for(ll i=0;i<t;i++)
#define ll long long int
#define ld long double
#define umpl unordered_map<ll,ll> 
#define vl vector<ll>
#define vld vector<ld>
#define vvl vector<vl>
#define pb push_back
#define mod 998244353
#define inf 1e18
#define pcout(x,p) cout<<fixed<<setprecision(p)<<x
#define all(a) a.begin(),a.end()
#define endl "\n"

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c >= mod) c -= mod; return c; }
inline ll max(ll a, ll b){return a>b?a:b;}
inline ll min(ll a, ll b){return a<b?a:b;}

struct comp { 
    template<class T1,class T2,class T3,class T4>
    bool operator()(const pair<T1,T2> &p1,const pair<T3,T4> &p2){
        return p1.first<p2.first;
    }
}; 


int main(){
	ll n,k;cin>>n>>k;
	vl a(n);
	f(n)cin>>a[i];
	double sum=0;
	for(ll i=0;i<k;i++){
		sum+=log(a[i]);
	}
	double temp=sum;
	for(ll i=k;i<n;i++){
		sum=sum-log(a[i-k]);
		sum+=log(a[i]);
		if(sum>temp){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
		temp=sum;
	}
}

Measured memory_bytes: 4904
#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <climits>
#include <numeric>
#include <queue>
#include <cmath>
#include <iomanip>
#include <array>
#include <string>
#include <stack>
#include <cassert>
#include <memory>
#include <random>
#include <fstream>
#include <cfloat>
#include <complex>
using namespace std;
int main() {
	int x; cin >> x;
	cout << (2199 - x) / 200 << endl;
}

Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	numSeq := GetArgs()
	SelectionSort(numSeq)
}

// GetArgs 数列の長さを表す整数 Nと数列を取得する
func GetArgs() []int {
	sc.Split(bufio.ScanWords)
	elmCnt := NextInt()

	var numSeq []int
	for i := 0; i < elmCnt; i++ {
		numSeq = append(numSeq, NextInt())
	}
	return numSeq
}

// NextInt 個々の数値を取得する
func NextInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

// SelectionSort 選択ソートを実行する
func SelectionSort(numSeq []int) {
	exchangeCnt := 0
	for i := 0; i < len(numSeq); i++ {
		minj := i
		for j := i; j < len(numSeq); j++ {
			if numSeq[j] < numSeq[minj] {
				minj = j
			}
		}
		if i != minj {
			tmp := numSeq[i]
			numSeq[i] = numSeq[minj]
			numSeq[minj] = tmp
			exchangeCnt++
		}
	}
	OutputResult(numSeq, exchangeCnt)
}

// OutputResult ソート結果を出力する
func OutputResult(numSeq []int, exchangeCnt int) {
	for i, v := range numSeq {
		if i == len(numSeq)-1 {
			fmt.Printf("%d\n", v)
		} else {
			fmt.Printf("%d ", v)
		}
	}
	fmt.Println(exchangeCnt)
}



Measured memory_bytes: 1104
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
int main(){
  int N,K;
  int W[100000];
  cin>>N>>K;
  int ma=0;
  FOR(i,0,N){
    cin>>W[i];
    ma=max(ma,W[i]);
  }
  int L=ma,R=INF;
  while(R>L){
    int M=(L+R)/2;
    int now=0;
    int cnt=1;
    FOR(i,0,N){
      if(now+W[i]<=M){
        now+=W[i];
      }else{
        cnt++;
        now=W[i];
      }
    }
    if(cnt<=K){
      R=M;
    }else{
      L=M+1;
    }
  }
  cout<<R<<endl;
  return 0;
}


Measured memory_bytes: 3472
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    string s,a,c;
    cin >>a>>s>>c;
    
    cout << a[0]<<s[0]<<c[0] << endl;


    return 0;
    

}

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

int main(){
  int n,count=0;
  cin>>n;
  vector<int> num(n);
  for(int i=0;i<n;i++){
    cin>>num[i];
    int c=0;
    while(num[i]>=num[c]){
      c++;
      if(c>i) break;
    }if(c==i+1){
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

int MOD_BIG = 1000000007;
int MOD_BIG2 = 998244353;
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////

//////////////////////////////////////

int main() {
    
    string S, T;
    cin >> S >> T;
    int max = 0;
    REP(i, S.length()-T.length()+1) {
        int now = 0;
        REP(j, T.length()) {
            if (S[i+j] != T[j]) {
            } else {
                now++;
            }
        }
        max = std::max(max, now);
    }
    cout << T.length() - max << endl;
    
    return 0;
}


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

int main() {
    int K,S;
    cin>>K>>S;
    int ans=0;
    int k;
    for(int i=0;i<=K;i++){
        for(int j=0;j<=K;j++){
           k= S-i-j;
           if(K>=k&&k>=0)ans++;
        }
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 256
#include<cstdio>
int main()
{
    int n,deal;
    scanf("%d",&n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d",&deal);
        if (deal%2==0)
        {
            if(deal%3&&deal%5)
            {
                printf("DENIED");
                return 0;
            }
        }
    }
    printf("APPROVED");
    return 0;
}

Measured memory_bytes: 128
N = int(input())
D = []
for i in range(N):
    d1, d2 = map(int, input().split())
    D.append([d1, d2])

for i in range(N - 2):
    if D[i][0] == D[i][1] and D[i + 1][0] == D[i + 1][1] and D[i + 2][0] == D[i + 2][1]:
        print("Yes")
        exit()
print("No")


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

using namespace std ;

int Max(int a , int b )
{
    return(a>b) ? a :b ;
}

int up[102];
int down[102] ;

int main()
{
    int n  , res ;
    cin>>n ;

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

    // cumulative sum

    for(int i=1 ; i<n ; i++)
    {
        up[i] += up[i-1] ;
    }

    for(int i = n-2 ; i>=0 ; i--)
    {
        down[i] += down[i+1] ;
    }

    res = up[0] + down[0] ;

    for(int i=1 ; i<n ; i++)
    {
        int sum = up[i] + down[i] ;

        res = Max(res,sum) ;
    }

    cout<<res <<endl ;

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type point struct{ x, y int }
type sortByX []point

func (s sortByX) Len() int           { return len(s) }
func (s sortByX) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortByX) Less(i, j int) bool { return s[i].x < s[j].x }

type sortByY []point

func (s sortByY) Len() int           { return len(s) }
func (s sortByY) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortByY) Less(i, j int) bool { return s[i].y > s[j].y }

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	rs := make(map[point]bool, n)
	for i := 0; i < n; i++ {
		p := point{}
		sc.Scan()
		p.x, _ = strconv.Atoi(sc.Text())
		sc.Scan()
		p.y, _ = strconv.Atoi(sc.Text())
		rs[p] = true
	}
	bs := sortByX(make([]point, n))
	for i := range bs {
		sc.Scan()
		bs[i].x, _ = strconv.Atoi(sc.Text())
		sc.Scan()
		bs[i].y, _ = strconv.Atoi(sc.Text())
	}

	sort.Sort(bs)
	ans := 0
	for _, b := range bs {
		ps := sortByY(make([]point, 0, n))
		for r := range rs {
			if r.x < b.x && r.y < b.y {
				ps = append(ps, r)
			}
		}

		if len(ps) > 0 {
			sort.Sort(ps)
			delete(rs, ps[0])
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define LL long long
int N, wei[111];
int main(){
	cin>>N;
	for(int i = 1;i <= N; i++)cin>>wei[i];
	int ans = 1e9;
	for(int T = 1;T < N; T++){
		int s1 = 0, s2 = 0;
		for(int i = 1;i <= N; i++){
			if(i <= T)s1 += wei[i];
			else s2 += wei[i];
		}
		ans = min(ans, abs(s1 - s2));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
*H, = map(int, input().split())


count_max = 0
count_temp = 0
flg = 0
#全探索
for i in range(0, len(H)-1, 1):

    if H[i] < H[i+1]:
        if count_max < count_temp:
            count_max = count_temp
        count_temp = 0
        flg = 1
        continue

    count_temp = count_temp + 1

    if H[i+1]==H[len(H)-1]:
        if count_max < count_temp:
            count_max = count_temp
        flg = 1

if flg == 1:
    print(count_max)
else:
    print(0)

Measured memory_bytes: 14228
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  map<string, bool> kind;
  string tmp;
  for(int i = 0; i < N; i++){
    cin >> tmp;
    kind[tmp] = true;
  }
  
  cout << kind.size() << endl;
  

}
      



Measured memory_bytes: 19220
//Vol0 0018
#include<stdio.h>
int main()
{
	int x[5],b=0;
	for(int i=0;i<5;i++){
		scanf("%d",&x[i]);
	}
	for(int i=5;i!=0;i--){
		for(int j=1;j<i;j++){
			if(x[j-1]<x[j]){
				b=x[j];
				x[j]=x[j-1];
				x[j-1]=b;
			}
		}
	}
	for(int i=0;i<5;i++){
		printf("%d",x[i]);
		if(i==4){
			printf("\n");
		}else{
			printf(" ");
		}
	}
	return 0;
}

Measured memory_bytes: 2624
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int n, now = inf;
long long ans;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        int x, y; scanf("%d%d", &x, &y);
        ans += x; if (x > y) now = min(now, y);
    }
    printf("%lld", now == inf ? 0 : ans - now);
}


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

typedef long long ll;

ll pwr(ll a, ll e, ll m) {
    if (e == 0) return 1;
    if (e%2 == 1) return a*pwr(a, e-1, m) % m;
    ll h = pwr(a, e/2, m);
    return h*h%m;
}

const int MOD = 2019;
const int PHI_MOD = 1344;

ll inv(ll a) {
    return pwr(a, PHI_MOD-1, MOD);
}

ll pwrs10[200000+1];
ll pwrs10Inv[200000+1];

void precalc() {
    pwrs10[0] = 1;
    for(int i = 1; i <= 200000; i++) {
        pwrs10[i] = (pwrs10[i-1]*10) % MOD;
    }
    for(int i = 0; i <= 200000; i++) {
        pwrs10Inv[i] = inv(pwrs10[i]);
    }
}

int main() {
    precalc();
    string s;
    cin >> s;
    int n = s.length();
    vector<ll> S(n+1);
    vector<ll> Sd(n+1);
    for(int i = 1; i <= n; i++) {
        S[i] = (S[i-1]*10 + s[i-1] - '0') % MOD;
    }
    for(int i = 0; i <= n; i++) {
        Sd[i] = (S[i] * pwrs10Inv[i])%MOD;
    }
    map<ll, int> cnts;
    ll ans = 0;
    for(int i = 0; i <= n; i++) {
        ll need = (S[i]-2019)%MOD;
        if (need < 0) need += MOD;
        need = (need * pwrs10Inv[i])%MOD;

        ans += cnts[need];
        cnts[S[i]*pwrs10Inv[i]%MOD]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 9948
#include <iostream>

using namespace std;
int d[100010];
long long cnt[100010] = {},mod = 998244353;
long long pw(long long a,long long x){
	long long ret = 1;
	while(x){
		while(!(x&1)){
			(a *= a) %= mod;
			x /= 2;
		}
		(ret *= a) %= mod;
		x--;
	}
	return ret;
}
int main(){
	int i,n;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> d[i];
		cnt[d[i]]++;
	}
	if(d[0]!=0){
		cout << 0 << endl;
		return 0;
	}
	if(cnt[0]!=1){
		cout << 0 << endl;
		return 0;
	}
	long long ans = 1;
	for(i=1;i<n;i++){
		if(cnt[i]!=0 && cnt[i - 1]==0){
			cout << 0 << endl;
			return 0;
		}
	}
	for(i=1;i<=n - 1;i++){
		if(cnt[i]==0) break;
		(ans *= pw(cnt[i - 1],cnt[i])) %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1408
a,b=input().split()
c,d=int(a),int(b)
p=a*d
q=b*c
k=0
e=max(c,d)
if p==q:
    print(p)
elif p[0]>q[0]:
    print(q)
elif p[0]<q[0]:
    print(p)


Measured memory_bytes: 3060
//#include<bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
typedef long long unsigned int ll;

int main() {

    int dp[10003][1<<5] = {{}};
    int block[10003] = {};

    int H,N;
    int x,y;
    scanf("%d %d", &H,&N );
    for (int i = 0; i < N; i++){
        scanf("%d %d", &x,&y );
        block[y] |= 1<<x;
    }

    int set[5] = {0xf,0x3,0x6,0xc,0x0};
    int vul[5] = {2, 1, 1, 1, 0};
    for (int ai = 0; ai < H-1; ai++){
        for (int bi = 0; bi < 1<<5; bi++){
            for (int si = 0; si < 5; si++){
                if( set[si] & (block[ai] | block[ai+1] | bi ) ){
                    continue;
                }
                dp[ai+1][set[si]] = max(dp[ai+1][set[si]] , dp[ai][bi] + vul[si] );
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < 1<<5; i++){
        ans = max(ans , dp[H-1][i] );
    }

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


    return 0;
}




Measured memory_bytes: 4052
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int result = 0;

		for(int i = 0; i <= a; i++) {
			for (int j = 0; j <= b; j++) {
				for(int k = 0; k <= c; k++) {
					if (i * 500 + j * 100 + k * 50 == x) {
						result++;
					}
				}
			}
		}
		System.out.println(result);
	}

}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
  
  int N, M;
  cin >> N >> M;
  
  int ans=0;
  
  if(N>0) ans+=N*(N-1)/2;
  if(M>0) ans+=M*(M-1)/2;
  
  cout << ans;
  
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    ll n, a,ans=0;
    cin >> n;
    vector<ll>arr(n);
    rep(i, n) {
        cin >> arr[i];
    }
    sort(all(arr));
    ans = arr[n - 1];
    a = (n-2LL) / 2LL;
    for (int i = n - a; i < n; i++) {
        ans += arr[i - 1];
        ans += arr[i - 1];
    }
    if ((n - 2) % 2 == 1) {
        ans += arr[n - a - 2];
    }
    cout << ans << endl;
}


Measured memory_bytes: 4840
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////

void Warshall_Floyd(ll N, vector<vector<ll>> &g) {
	repn(k, N) {
		repn(i, N) {
			repn(j, N) {
				g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
			}
		}
	}
}



int main() {

	ll N, M;
	cin >> N >> M;

	vector<vector<ll>> g(N + 1, vector<ll>(N + 1, INF));

	vector<ll> s(M + 1), t(M + 1), d(M + 1);

	
	repn(i, M) {
		ll a, b, c;
		cin >> a >> b >> c;
		g[a][b] = c;
		g[b][a] = c;

		s[i] = a; t[i] = b; d[i] = c;
	}

	Warshall_Floyd(N, g);

	ll ans = 0;
	repn(i, M) { if (g[s[i]][t[i]] < d[i]) { ans++; } }

	cout << ans;
	

	system("PAUSE");
}


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

int main()
{
  string s;
  cin >> s;
  int ans = 0;
  for(int i = 0; i < s.size(); i++){
    int k = i, cnt = 0;
    while(s[k] == 'A'||s[k] == 'C'||s[k] == 'G'||s[k] == 'T'){
      cnt++;
      k++;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  system("pause");
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int ans = 0;
    vector<int> vec(N);
    for (int i = 0; i < N; i++) {
        cin >> vec.at(i);
    }
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0){

            if (vec.at(i) % 2 == 1) {
                ans += 1;
            }
            else {
                ans += 0;
            }
        }
        else {
            ans += 0;
        }
    }
cout << ans << endl; 
}


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

int main() {

	ll d, g; cin >> d >> g;
	
	vector<ll> p(d), c(d);
	for (ll i = 0; i < d; i++) {
		cin >> p[i] >> c[i];
	}

	ll ans = 9223372036854775807LL;;
	for (ll bit = 0; bit < (1 << d); ++bit) {

		ll tmpScore = 0;
		ll tmpProblemNum = 0;
		for (ll i = 0; i < d; ++i) {
			if (bit & (1 << i)) {
				tmpScore += 100 * (i + 1) * p[i] + c[i];
				tmpProblemNum += p[i];
			}
		}

		if (g <= tmpScore) {
			ans = min(ans, tmpProblemNum);
		}
		else {
			for (ll i = d - 1; i >= 0; i--) {
				if (bit & (1 << i)) continue;
				for (int j = 0; j < p[i]; j++) {
					if (g <= tmpScore) break;
					tmpScore += 100 * (i + 1);
					tmpProblemNum++;
				}
			}
			ans = min(ans, tmpProblemNum);
		}
	}

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

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

int main(){
  string S;
  cin >> S;
  ll A = S.size(),ans = 0;
  rep(i,A/2){
    if(S[i] != S[A-i-1]){
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 3596
#include<iostream>
using namespace std;
int main()
{
  int H,W,N;
  cin >> H;
  cin >> W;
  cin >> N;
  
  int ans=0;
  int cnt=0;
  int max_n = max(H,W);
  
  while(N>cnt){
    cnt += max_n;
    ans++;
  }
  cout << ans << endl; 

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin >> N >> M;
    int cnt[112345] = {};
    REP(i,M){
        int a,b; cin >> a >> b;
        cnt[a]++;
        cnt[b]++;
    }
    bool ok = 1;
    FOR(i,1,N+1){
        if(cnt[i]%2 == 1) ok = 0;
    }
    if(ok) cout << "YES" << endl;
    else cout << "NO" << endl;


}


Measured memory_bytes: 768
#bit & 演算子は同じ位置のbitが１の時１を返す
def main():
    n, m = map(int, input().split())
    # ｋは何個のスイッチにつながっているか、ｓはスイッチの番号
    s = []; k = [] # s : どのスイッチとつながってるか、インデックスは電球を指す、　k: 電球が何個のスイッチとつながっているか
    for _ in range(m):
        tmp = list(map(int, input().split()))
        s.append(tmp[1:]); k.append(tmp[0])
    p = list(map(int, input().split()))

    res = 0
    # スイッチの状態は２進数表記で表す。スイッチはｎ個あるので
    for bit in range(2**n):
        ok = True
        for i in range(m): # 各電球に対して見ていく
            cnt = 0
            for v in s[i]: # 各電球につながっているスイッチを見てる
                if ( bit & 1 << (v - 1) ): # bitの状態がスイッチvがついてる状態なのかどうか
                    cnt += 1
            if cnt % 2 != p[i]:
                ok = False
        if ok: # okなら全ての電球が付いているということ
            res += 1

    print(res)

if __name__ == "__main__":
    main()

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


int main(){
  int n;
  cin >> n;
  vector<ll> a(n),b(n);
  for(int i=0;i<n;++i){
    cin >> a[i] >> b[i];
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  if(n%2==0){
    ll mi=a[n/2-1]+a[n/2];
    ll ma=b[n/2-1]+b[n/2];
    cout << ma-mi+1 << endl;
  }else{
    ll mi=a[n/2];
    ll ma=b[n/2];
    cout << ma-mi+1 << endl;
  }
  return 0;
}


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

class ArgSort{
public:
  //complex<T>(x, y)またはpair<T, T>(x, y)の入力に対して偏角ソートする。
  template<typename T>
  static vector<pair<T, T> > Sort(vector<pair<T, T> > A){
    sort(A.begin(), A.end(), [&](const auto &p1,const auto &p2){
        return atan2(p1.second, p1.first) < atan2(p2.second, p2.first);
      });
    return A;
  }

  template<typename T>
  static vector<complex<T> > Sort(vector<complex<T> > A){
    sort(A.begin(), A.end(), [&](const auto &p1,const auto &p2){
        return atan2(p1.imag(), p1.real()) < atan2(p2.imag(), p2.real());
      });
    return A;
  }
};

void ABC139_F_pair(){
  using Int = long long;
  using Double = long double;
  using P = pair<Int, Int>;

  Int N;
  cin>>N;
  vector<P> A(N);
  for(int i=0;i<N;i++){
    int x, y;
    cin>>x>>y;
    A[i] = P(x, y);
  }

  A = ArgSort::Sort(A);

  Int ans = 0;
  for(Int i=0;i<N;i++)
    for(Int j=0;j<N;j++){
      Int idx = i;
      Int x = 0, y = 0;
      while(1){
        x += A[idx].first;
        y += A[idx].second;
        ans = max(ans, x * x + y * y);
        if(idx == j) break;
        idx = (idx + 1)%N;
      }
    }
  cout << fixed << setprecision(12);
  cout<<sqrt((Double)ans)<<endl;


}
void ABC139_F_complex(){
  using Int = long long;
  using Double = long double;
  using P = complex<Int>;

  Int N;
  cin>>N;
  vector<P> A(N);
  for(int i=0;i<N;i++){
    int x, y;
    cin>>x>>y;
    A[i] = P(x, y);
  }

  A = ArgSort::Sort(A);

  Int ans = 0;
  for(Int i=0;i<N;i++)
    for(Int j=0;j<N;j++){
      Int idx = i;
      Int x = 0, y = 0;
      while(1){
        x += A[idx].real();
        y += A[idx].imag();
        ans = max(ans, x * x + y * y);
        if(idx == j) break;
        idx = (idx + 1)%N;
      }
    }
  cout << fixed << setprecision(12);
  cout<<sqrt((Double)ans)<<endl;
}

signed main(){

  //ABC139_F_complex();
  ABC139_F_pair();

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define HITO 39
using namespace std;

int main(void){
	int n;
	
	while(cin>>n){
		while(true){
			
			if(1<=n && n<=HITO){
				int i;
				for(i=0;n>0;i++){
					n--;
				}
				printf("3C%02d\n",i);
				break;
			}			
			else if(n>HITO){
				
				n=n%HITO;
			
				if(n!=0){
					printf("3C%02d\n",n);
					break;
				}
				else if(n==0){
					cout<<"3C39"<<endl;
					break;
				}
			}
		}
	}
	return 0;
}

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

int  main()
{
	string s; cin >> s;
	string t; cin >> t;
	int cnt = 0;
	rep(i, 3)
	{
		if (s[i] == t[i])
			cnt++;
	}
	cout << cnt << endl;
	return (0);
}


Measured memory_bytes: 256
#include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	((v).begin(), (v).end())
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl


int main(){
	repp(i,1,10){
		repp(j,1,10){
			printf("%dx%d=%d\n",i,j,i*j);
		}
	}
	
	return 0;
}

Measured memory_bytes: 1096
# coding: utf-8
import sys
import numpy as np
from math import factorial

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, A, B = lr()
V = np.array(lr())
V.sort()
ave = V[-A:].sum() / A
print(ave)
border = V[-A]
left_i = np.searchsorted(V, border, side='left')
right_i = np.searchsorted(V, border, side='right')
seg = right_i - left_i  # 使える数字たち
done = N - right_i
use = A - done  # 使う幅

def combinations_count(n, r):  # 組み合わせ
    return factorial(n) // factorial(n - r) // factorial(r)

answer = combinations_count(seg, use)
if border == ave:
    for x in range(use+1, min(B-done, seg)+1):
        answer += combinations_count(seg, x)

print(answer)
# 05

Measured memory_bytes: 14432
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    string s,t; cin >> s >> t;
    if (s.length() == t.length())
    {
        for (int i = 0; i < s.length(); i++)
        {
            cout << s[i] << t[i];
        }
    } else {
        for (int i = 0; i < s.length()-1; i++)
        {
            cout << s[i] << t[i];
        }
        cout << s.back();
    }
    cout << endl;
    return 0;
}

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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	int N;
	cin >> N;
	int p[N];
	map<int, int> m;
	rep(i, 0, N) {
		cin >> p[i];
		m[p[i]] = i;
	}
	vector<int> a, b;
	rep(i, 1, N + 1) a.push_back(30000 * i);
	rep(i, 0, N) b.push_back(30000 * (N - i) + m[i + 1]);
	rep(i, 0, N - 1) cout << a[i] << " ";
	cout << a[N - 1] << endl;
	rep(i, 0, N - 1) cout << b[i] << " ";
	cout << b[N - 1] << endl;

}


Measured memory_bytes: 1920
#include <stdio.h>

int main(void){
	int a,b,c,d,e,f;
	int g;
	
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	g=a*1+b*5+c*10+d*50+e*100+f*500;
	if(g>=1000){
		printf("%d\n",1);
	}else{
		printf("%d\n",0);
	}
	
	return 0;
}

Measured memory_bytes: 1028
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Map<String,Integer> map = new HashMap<String,Integer>();
		String tmp = sc.nextLine();
		for(int i = 0;i < n; ++i){
			String s = sc.nextLine();
			map.putIfAbsent(s,0);
			map.put(s,map.get(s) + 1);
		}
		SortedSet<String> st = new TreeSet<>();
		int maxi = 0;
		for(Map.Entry<String,Integer> entry : map.entrySet()){
			maxi = Math.max(maxi,entry.getValue());
			// System.out.printf(" %s %d \n",entry.getKey(),entry.getValue());
		}
		// System.out.println(maxi);	
		for(Map.Entry<String,Integer> entry : map.entrySet()){
			if(entry.getValue() == maxi){
				st.add(entry.getKey());
			}
		}

		for(String ele : st){
			System.out.println(ele);
		}
	}
}

Measured memory_bytes: 177664
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        final int MOD = 998_244_353;
        
        final int N = sc.nextInt();
        final int K = sc.nextInt();
        
        final int[] L = new int[K];
        final int[] R = new int[K];
        
        for (int j = 0; j < K; j++) {
            L[j] = sc.nextInt();
            R[j] = sc.nextInt();
        }
        
        // マスidxに到達する方法の数を保持する。
        // 但しidxは0開始。
        final long[] dp = new long[N];
        dp[0] = 1;
        
        // dpの累積和を保持する。
        // つまり、sdp[n] = dp[0] + dp[1] + .. + dp[n]
        final long[] sdp = new long[N];
        sdp[0] = 1;
        
        // dp[1] .. dp[N - 1] を順に求める。
        for (int i = 1; i < N; i++) {
            
            for (int j = 0; j < K; j++) {
                if (R[j] < i) {
                    // dp[i] = dp[i - R] + dp[i - R + 1] + .. + dp[i - L - 1] + dp[i - L]
                    // である。
                    // ここで右辺について、
                    // dp[i - R] + dp[i - R + 1] + .. + dp[i - L - 1] + dp[i - L]
                    //   = dp[0] + dp[1] + .. + dp[i - R - 1] + dp[i - R] + dp[i - R + 1] + .. + dp[i - L - 1] + dp[i - L]
                    //   - dp[0] + dp[1] + .. + dp[i - R - 1]
                    //   = sdp[i - L] - sdp[i - R - 1]
                    // となる。
                    // まとめると、
                    //   dp[i] = sdp[i - L] - sdp[i - R - 1]
                    // これは区間jについてのみだから、実際にはそれぞれの区間jについて合計する。
                    dp[i] += sdp[i - L[j]] - sdp[i - R[j] - 1];
                    
                } else if (L[j] <= i) {
                    // dp[i] = dp[0] + dp[1] + .. dp[i - L - 1] + dp[i - L]
                    //       = sdp[i - L]
                    dp[i] += sdp[i - L[j]];
                    
                } else {
                    continue;
                }
                if (dp[i] < 0) {
                    dp[i] += MOD;
                } else {
                    dp[i] %= MOD;
                }
            }
            sdp[i] = sdp[i - 1] + dp[i];
            sdp[i] %= MOD;
        }
        
        System.out.println(dp[N - 1]);
    }
}


Measured memory_bytes: 40136
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;

#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()

#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;
#define nl endl

#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)

#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)

#define MAXN        100000007
#define INF 0x3f3f3f3f
bool mark[100005];vi prime;
void seive(ll N){for(int i=2;i<=N;i++){if(mark[i]==false){prime.pb(i);for(int j=i+i;j<N;j+=i)mark[j]=true;}}}
//freopen("input.txt", "r", stdin);

int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n,d;
    cin>>n>>d;
    vector<int>v[n+1];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++)
        {
            int c;
            cin>>c;
            v[i].push_back(c);
        }
    }
    int res=0;
    for(int i=0;i<n;i++){

        for(int j=i+1;j<n;j++){
                long long temp=0;
                for(int k=0;k<d;k++){
                    temp+=((v[i][k]-v[j][k])*(v[i][k]-v[j][k]));
                }
               long long t=sqrt(temp);
               if(t*t==temp)
                    res++;
    }
}
cout<<res<<endl;
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    S = input().strip()
    s = S[0]
    ans = 0
    for i in range(1, len(S)):
        if s != S[i]:
            ans += 1
            s = S[i]

    print(ans)




if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
 
//思路：并?集 + ? + ?列 （??取出方式） 

int parent[100016];
int height[100016];

//并?集 
void init(int n)
{
	for(int i = 1; i <= n; i++){
		parent[i] = i;
		height[i] = 0;
	}
}
 
int find(int x)
{
	if(parent[x] == x)  return x;
	else  return parent[x] = find(parent[x]);
}
 
//用来描述原始? 
vector<int> children[100016];
int parent_tree[100016];
bool marked[100016];
int ancestor[100016];
// ?条指令被拆分? 操作 + 目?
stack<char> operation;
stack<int>  target;
 
void bfs(int index, int the_ancestor)
{
	queue<int> q_index;
	queue<int> q_ancestor;
	q_index.push(index);
	q_ancestor.push(the_ancestor);
	while (!q_index.empty())
	{
		the_ancestor = q_ancestor.front(); 
		q_ancestor.pop();
		index = q_index.front(); 
		q_index.pop();
		if(marked[index] == true)  the_ancestor = index;  //如果?点自身被??，?它的染色祖先是自己，它的自己不??的儿子的最近染色祖先是它
		ancestor[index] = the_ancestor;  //??index的最近染色祖先 
		for(vector<int>::iterator it = children[index].begin(); it != children[index].end(); it++){  //将index的儿子加入?列 
			q_index.push(*it);
			q_ancestor.push(the_ancestor);
		}
	}
}
 
int main()
{
 
	int N, Q;
	while(scanf("%d %d", &N, &Q) && (N || Q)){
		for(int i = 1; i <= N; i++){
			children[i].clear();
			marked[i] = false;
		}
		marked[1] = true;
		parent_tree[1] = 1;
		int p;
		for(int i = 2; i <= N; i++){
			scanf("%d", &p);
			parent_tree[i] = p;
			children[p].push_back(i);
		}
		getchar(); 
		for(int i = 0; i < Q; i++){
			char ch;
			int t;
			scanf("%c %d", &ch, &t);
			getchar();
			if(ch == 'M'){
				if(marked[t])  continue;  //不?存重?的 "M v"，防止之后重?反染色 
				else  marked[t] = true;
			}
			operation.push(ch);
			target.push(t);
		}
		bfs(1, 1);
		init(N);
		for(int i = 1; i <= N; i++){
			parent[i] = ancestor[i];
		}
		unsigned long long result = 0;
		while(!operation.empty()){  //从后往前取出操作
			char ch = operation.top(); 
			operation.pop();
			int t = target.top(); 
			target.pop();
			if(ch == 'Q')  result += find(t);  //?目index从1?始
			else{  //??点t反染色（取消染色），t的祖先??其父?点的祖先
				parent[t] = find(parent_tree[t]);
			}
		}
		printf("%lld\n", result);
	}
	return 0;
}

Measured memory_bytes: 11564
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }

// #define int long long

using namespace std;

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

  int num = 0;

  int n; // cin >> n;
  string s; cin >> s;
  n = s.length();

  int m = 0;
  for (auto it = s.begin(); it < s.end(); ++it) if (*it == '0') ++m;

  num = 2 * min(m, n - m);
  
  cout << num << endl;

  return 0;
}


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

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    lli N, P;
    cin >> N >> P;
    vector<lli> A(N);
    lli sum = 0;
    REP (i, 0, N) {
        cin >> A[i];
        sum += A[i];
    }
    vector<vector<lli>> table(N + 1, vector<lli>(sum + 1, 0));
    table[0][0] = 1;
    REP (i, 1, N + 1) {
        REP (j, 0, sum + 1) {
            if (j >= A[i - 1]) {
                table[i][j] += table[i - 1][j - A[i - 1]];
            }
            table[i][j] += table[i - 1][j];
        }
    }
    lli ans = 0;
    REP (i, 0, sum + 1) {
        if (i % 2 == P) ans += table[N][i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408