akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vector<int> a(n);
  int sum=0;
  rep(i,n){
    cin>>a[i];
    sum^=a[i];
  }
  int ans=0;
  for(int i=40;i>=0;i--){
    bool flag=false;
    if(sum & (1ll<<(i))){
      rep(j,n){
        if(!flag && (a[j]^(a[j]-1))==((1ll<<(i+1))-1)){
          ans++;
          flag=true;
          sum^=(a[j]^(a[j]-1));
        }
      }
      if(!flag){
        cout<<-1<<endl;
        return 0;
      }
    }
    //cout<<i<<' '<<sum<<endl;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	string s,t,u ;
	cin >> s >> t >> u ;
	cout << (char)(s.at(0)-'a'+'A') << (char)(t.at(0)-'a'+'A') << (char)(u.at(0)-'a'+'A') << endl ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
using namespace std;
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/*************************************/

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int k, x; cin >> k >> x;
  kek(k * 500 >= x ? "Yes" : "No");
}


Measured memory_bytes: 256
// 20
/****************************************************
https://searleser97.gitlab.io/algorithms/template.cpp
****************************************************/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define forr(_, x, n) for (int _ = x; _ > n; _--)
#define fos(_, x, n, s) for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fos(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define cerr(s) cerr << "\033[48;5;196m\033[38;5;15m" << s << "\033[0m"
// typedef __int128_t lli;
typedef long long int li;
typedef long double ld;
// 12
void _main(int tc) {
  int a, b, c;
  cin >> a >> b >> c;
  set<int> s;
  s.insert(a), s.insert(b), s.insert(c);
  cout << s.size() << endl;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0); return 0;
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int f[N],deg[N],sz[N],fl[N];
int find(int x){
	return x==f[x]?x:f[x]=find(f[x]);
}
void merge(int x,int y){
	x=find(x);y=find(y);
	if(x==y) return;
	f[x]=y; sz[y]+=sz[x];
}
void add(int x,int y){
	merge(x,y);++deg[x];++deg[y];
}
int a[N],b[N],c[N];
vector<int> Y,Z;
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;++i)
		f[i]=i,sz[i]=1;
	for(int i=1;i<=m;++i){
		cin>>a[i]>>b[i]>>c[i];
		add(a[i],b[i]),--c[i];
	}
	for(int i=1;i<=n;++i)
		if(deg[i]>2) fl[find(i)]=1;
	int ned=0;
	for(int i=1;i<=n;++i)
		if(find(i)==i && !fl[i] && sz[find(i)]>=2) ++ned;
	int baigei=0,flag=0;
	for(int i=1;i<=m;++i)
		if(c[i]>0){
			if(fl[find(a[i])]){
				if(a[i]==b[i]) Z.push_back(c[i]);
				else flag=1,baigei+=c[i];
			}
			else{
				if(a[i]==b[i]) Y.push_back(c[i]-1);
				else baigei+=c[i];
			}
		}
	sort(Y.begin(),Y.end(),greater<int>());
	sort(Z.begin(),Z.end(),greater<int>());
	for(int i=0;i<Y.size();++i) baigei+=Y[i];
	int ans=1e9;if(ned==0) ans=0;
	for(int i=0,j=Y.size()-1;i<=Z.size();++i){
		while(j>=0 && baigei-Y[j]>=ned) baigei-=Y[j],--j;
		if((flag || i) && baigei>=ned) ans=min(ans,2*(j+1)+i);
		if(i<Z.size()) baigei+=Z[i];
	} 
	if(ans==1e9) puts("-1");
	else{
		for(int i=1;i<=m;++i)
			ans+=(a[i]!=b[i]);
		ans+=ned;
		cout<<ans;
	}
	return 0;
}

Measured memory_bytes: 6680
//I read the news today, oh boy
//About a lucky man who made the grade
 
#include <vector>
#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) int((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(int i = int(a); i < int(b); ++i)
#define roF(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int N=1e6;


int main(){
	fastio;
	int ans; cin>>ans;
	For(i,1,10) if(ans%i==0 && (ans/i)<10){
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
n,k=[int(j) for j in input().split()]
l=[[] for i in range(n)]

for i in range(n-1):
    a,b=[int(j)-1 for j in input().split()]
    l[a].append(b)
    l[b].append(a)

s=set([0])
ans=k
mod=10**9+7
from collections import deque
q=deque([(0,k-1)])
while q:
    x,y=q.popleft()
    j=0
    for i in l[x]:
        if i in s:
            continue
        s.add(i)
        if y-j<=0:
            print(0)
            exit()
        ans*=y-j
        ans=ans%mod
        q.append((i,k-2))
        j+=1
print(ans)



Measured memory_bytes: 73588
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <utility>

#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cmath>

using namespace std;

typedef long long ll;
typedef long double ld;

constexpr ld eps = 0.0000000001;

template<typename T>
constexpr T pi = asin(1)*2.0;

ld a,b,x;

inline bool ovf(ld d) {
	if(d < eps) return false;
	if(d > 90-eps) return true;
	ld c = d*pi<ld>/180.0;
	if(tan(c) < b/a) return (b+b-a*tan(c))*a*a/2.0<x;
	else return b*b/tan(c)*a/2.0<x;
}

int main() {
	cin >> a >> b >> x;
	ld r = 90,l=0;
	while(r-l > eps) {
		ld m = (r+l)/2.0;
		if(ovf(m)) r=m;else l=m;
	}
	cout << setprecision(12) << l << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
 
using namespace std;
 
const int MAX = 1e5;
 
int main(){
    int n,m,len;
    int dp[MAX] = {0};
 
    cin >> n >> m;
    for(int i = 1 ; i < n ; i++){
	cin >> len;
	dp[i] = dp[i-1] + len;
    }
 
    int a,ans = 0,pos = 0;
    for(int i = 0 ; i < m ; i++){
	cin >> a;
	ans += abs(dp[a+pos] - dp[pos]);
	ans %= 100000;
	pos += a;
    }
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 3496
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func rScan() []rune {
	return []rune(Scan())
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}
func bOutput(f bool, x string, y string) {
	if f {
		fmt.Println(x)
	} else {
		fmt.Println(y)
	}
}
func mod(x, d int) int {
	x %= d
	if x < 0 {
		x += d
	}
	return x
}
func iSSPrint(x []int) {
	fmt.Println(strings.Trim(fmt.Sprint(x), "[]"))
}

var lp int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, lp)
	sc.Split(bufio.ScanWords)
	n, q := iScan(), iScan()
	uf := newUF(n)
	for i := 0; i < q; i++ {
		t, u, v := iScan(), iScan(), iScan()
		if t == 0 {
			uf.unite(u, v)
		} else {
			bOutput(uf.same(u, v), "1", "0")
		}
	}
}

type UnionFind struct {
	par []int
}

func newUF(n int) *UnionFind {
	uf := new(UnionFind)
	uf.par = make([]int, n)
	for i, _ := range uf.par {
		uf.par[i] = -1
	}
	return uf
}
func (uf UnionFind) root(x int) int {
	if uf.par[x] < 0 {
		return x
	}
	uf.par[x] = uf.root(uf.par[x])
	return uf.par[x]
}
func (uf UnionFind) unite(x, y int) {
	rx, ry := uf.root(x), uf.root(y)
	if rx != ry {
		uf.par[ry] += uf.par[rx]
		uf.par[rx] = ry
	}
}
func (uf UnionFind) same(x, y int) bool {
	return uf.root(x) == uf.root(y)
}
func (uf UnionFind) size(x int) int {
	return -uf.par[uf.root(x)]
}


Measured memory_bytes: 5876
#include<cstdio>
#include<algorithm>
#include<functional>

using namespace std;

typedef	pair<int,int>	pii;

int main(){
	for(int n,m;scanf("%d%d",&n,&m),n;){
		int psum=0;
		static pii d_p[10000];
		for(int i=0;i<n;i++){
			scanf("%d%d",&d_p[i].second,&d_p[i].first);
			psum+=d_p[i].first*d_p[i].second;
		}
		sort(d_p,d_p+n,greater<pii>());
		for(int i=0;i<n;i++){
			if(m==0)	break;
			int deltam=min(d_p[i].second,m);
			psum-=d_p[i].first*deltam;
			m-=deltam;
		}
		printf("%d\n",psum);
	}
	return 0;
}

Measured memory_bytes: 848
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), G<type>())
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n, PER) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(roop, n) a[idx][roop] = v[roop]; idx++;} while(next_permutation(ALL(v))); PER = a;} while(0); // int fact(), VVI PERを宣言しておく、n=10が限界(500 ms)
#define ENDL cout << endl;

const int INF = 2e9;
const LL MOD = 1e9 + 7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
template<class T> inline bool chmin(T &a, T b){if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b) {a = b; return true;} return false;}
template<class T> inline void debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VLL A(n+1, 0);
  REP2(int, i, 1, n+1)
  {
    for (int j = 1; j*i <= n; j++) A[j*i]++;
  }
  LL ans = 0;
  REP2(int, i, 1, n+1) ans += i*A[i];
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main() {
    unsigned int n;
    string s, t;
    cin >> n >> s >> t;

    int dup = 0;
    for (unsigned int i = n; i >= 1; --i) {
        if (s.substr(n - i, i) == t.substr(0, i)) {
            dup = i;
            break;
        }
    }

    cout << 2 * n - dup << endl;
    return 0;
}


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

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int N,M;
vector<int> S,T;
const int max_n = 2010;

Int dp[max_n][max_n];

int main(void) {
    cin>>N>>M;
    for(int i = 0;i < N;i++) {
        int s;
        cin>>s;
        S.push_back(s);
    }
    for(int i = 0;i < M;i++) {
        int t;
        cin>>t;
        T.push_back(t);
    }
    
    for(int i = 0;i <= N;i++) {
        dp[i][0] = 1;
    }
    for(int i = 0;i <= M;i++) {
        dp[0][i] = 1;
    }

    for(int i = 0;i < N;i++) {
        for(int j = 0;j < M;j++) {
            if(S[i] == T[j]) {
                dp[i+1][j+1] = dp[i+1][j]+dp[i][j+1];
            } else {
                dp[i+1][j+1] = dp[i+1][j]+dp[i][j+1]-dp[i][j]+MOD;
            }
            dp[i+1][j+1] %= MOD;
        }
    }

    cout<<dp[N][M]<<endl;


    return 0;
}



Measured memory_bytes: 31744
(let* ((n (read))
       (lst (loop :repeat n :collect(read)))
       (max (reduce #'max lst))
       (cnt (= (count max lst) 1))
       (max-2 (if cnt (reduce #'max (remove max lst)) max)))
  (mapcar (lambda (k) (format t "~A~%" (if (= max k) (if cnt max-2 max) max))) lst))

Measured memory_bytes: 63200
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
 
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include<chrono>
 
using namespace std;
//using namespace std::chrono;
 
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define vl int64_t

int main()
{
     ll n;
     cin>>n;
     string s,t;
     cin>>s>>t;
     for(ll i=0;i<n;i++)
     {
          cout<<s[i]<<t[i];
     }
}


Measured memory_bytes: 256
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7

n=I()
a=LI()

d={}
nd={}
for i,x in enumerate(a):
    if x in d:
        d[x]=min(i,d[x])
        nd[x]+=1
    else:
        d[x]=i
        nd[x]=1

A=[i for i in d.items()]
A=sorted(A,key=lambda x:x[0])
#[::-1]
ans=[0]*n
px,pm=A.pop()
nn=nd[px]
while A:
    x,m=A.pop()
    ans[pm]+=(px-x)*nn
    nn+=nd[x]
    px,pm=x,min(m,pm)
ans[0]+=sum(a)-sum(ans)
#print(n,sum(a),a)
#print(*ans)
for i in ans:print(i)
    

Measured memory_bytes: 88820
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Main {
	static boolean bElapsed = false;
	StringBuilder sb = new StringBuilder();
	List<String> list = new ArrayList<>();
	Set<String> set = new HashSet<>();
	Map<String,String> map = new HashMap<>();

	void solve(BufferedReader br) throws Exception {
		String line = br.readLine();
		String[] flds = line.split(" ");
		int n = Integer.parseInt(flds[0]);
		int l = Integer.parseInt(flds[1]);
		for (int i=0; i<n; i++) {
			line = br.readLine();
			list.add(line);
		}
		Collections.sort(list);
		for (String s : list) {
			p(s);
		}
		pln("");
	}

	void p(char c) {
		System.out.print(c);
	}
	void pln(char c) {
		System.out.println(c);
	}
	void p(long l) {
		System.out.print(l);
	}
	void pln(long l) {
		System.out.println(l);
	}
	void p(String s) {
		System.out.print(s);
	}
	void pln(String s) {
		System.out.println(s);
	}
	public static void main(String[] args) throws Exception {
		long start = System.currentTimeMillis();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		new Main().solve(br);
		long end = System.currentTimeMillis();
		if (bElapsed) {
			System.out.println((end-start) + "ms");
		}
	}
}


Measured memory_bytes: 8404
include Math

loop {
    n, hx, hy, dx, dy = gets.split.map &:to_i
    break if n == 0

    points = [[hx, hy]] + (1..n).map { gets.split.map &:to_i }

    dist = (0..n).map{|i|
        (0..n).map{|j|
            x1, y1 = points[i]
            x2, y2 = points[j]
            hypot(x1 - x2, y1 - y2)
        }
    }

    deadline = points.map{|x, y| hypot(x - dx, y - dy)}
    
    stack = [[0, 0] + (1..n).to_a]
    success = false 
    until stack.empty?
        t, i, *unreached = stack.pop
        if unreached == [] 
            success = true 
            break
        end 
        next if unreached.any?{|j| t + dist[i][j] >= deadline[j]}
        unreached.each{|j|
            stack << [t + dist[i][j], j, *(unreached - [j])]
        }   
    end
    puts success ? 'YES' : 'NO'
}

Measured memory_bytes: 6532
#include <bits/stdc++.h>
using namespace std;
#define all(arr) arr.begin(), arr.end() 
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
ll sums=0, n;

int main(){
	IOS
	cin >> n;
	int arr[n+5];
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			sums+=arr[i]*arr[j];
		}
	}
	cout << sums << '\n';
}


Measured memory_bytes: 3656
N,M,Q=map(int,input().split())
c=[[0 for i in range(N+1)] for j in range(N+1)]
for i in range(M):
  a,b=map(int,input().split())
  c[a][b]+=1
for i in range(1,N):
  for j in range(1,N+1-i):
    c[j][i+j]+=c[j+1][i+j]+c[j][i+j-1]-c[j+1][i+j-1]
for i in range(Q):
  a,b=map(int,input().split())
  print(c[a][b])

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

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}

int gyaku(int n){
    return modpow(n,MOD-2);
}

auto factor(int n){
  map<int,int>res;
  for(int i=2;i*i<=n;i++){
      for(; n%i==0;n/=i) res[i]++;
  }
  if(n>1)res[n]++;
  return res;
}
////////////////////////////////////////////////////////////
signed main() {
  string s;
  cin>>s;
  int ans=0;
  rep(i,s.size()-1){
    if(s[i]!=s[i+1])ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3656
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    ll x, y;
    cin >> x >> y;
    ll lx = 0, ly = 0, rx = 0, ry = 0;
    int t = 0;
    vector<ll> A(90);
    A[0] = 0, A[1] = 1;
    for(int i = 2; i < 90; i++) {
        A[i] = A[i - 1] + A[i - 2];
    }
    while(1) {
        if(lx <= x && ly <= y && x <= rx && y <= ry)
            break;
        if(t % 4 == 0) {
            lx += A[t + 1];
            rx += A[t + 2];
            ry += A[t];
        } else if(t % 4 == 1) {
            lx -= A[t];
            ly += A[t + 1];
            ry += A[t + 2];
        } else if(t % 4 == 2) {
            lx -= A[t + 2];
            ly -= A[t];
            rx -= A[t + 1];
        } else {
            ly -= A[t + 2];
            rx += A[t];
            ry -= A[t + 1];
        }
        t++;
    }
    cout << t % 3 + 1 << endl;
    return 0;
}


Measured memory_bytes: 3108
import java.io.*;
import java.util.*;

/**
5
((((((((((
)))))(
))))))(((
)))))))(((((
)
Yes
 */

public class Main {

    private void solve() {
        int n = sc.nextInt();
        String[] s = new String[n];

        List<int[]> up = new ArrayList<>();
        List<int[]> down = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            s[i] = sc.next();

            int cnt = 0, dep = 0;
            for (char c : s[i].toCharArray()) {
                cnt += c == '(' ? 1 : -1;
                dep = Math.min(dep, cnt);
            }

            // left unmatched
            int left = -dep;

            // right unmatched
            int right = cnt + left;

            int remain = right - left;
            if (remain >= 0) {
                up.add(new int[] { -left , remain });
            } else {
                down.add(new int[] { -left, remain  });
            }
        }

        up.sort((a, b) -> b[0] - a[0]);
        down.sort((a, b) -> - (a[1] - a[0]) + (b[1] - b[0]));

        int cur = 0;
        boolean ans = true;
        for (int[] x : up) {
            if (cur + x[0] < 0) {
                ans = false;
                break;
            }
            cur += x[1];
        }

        for (int[] x : down) {
            if (cur + x[0] < 0) {
                ans = false;
                break;
            }
            cur += x[1];
        }

        System.out.println(cur == 0 && ans ? "Yes" : "No");
    }

    private static PrintWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().solve();
        out.close();
    }
}


Measured memory_bytes: 138116
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ull  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 2005;
int dp[N][N], C[N][N], s[N][N];
const int mod = 1e9 + 7;
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt",  "r", stdin);
    //freopen("output.txt", "w", stdout);
    int a, b;
    int n = 2000;
    for (int i = 0; i <= n; i++) C[0][i] = 1;
    for (int i = 1; i <= n; i++){
        for (int j = i; j <= n; j++){
            C[i][j] = (C[i - 1][j - 1] + C[i][j - 1]) % mod;
        }
    }
    for (int i = 0; i <= n; i++){
        for (int j = 0; j <= i; j++){
            s[i][j] = (s[i][j - 1] + C[j][i]) % mod;
        }
    }
    cin >> a >> b;
    for (int i = 0; i <= b; i++) dp[0][i] = 1;
    for (int i = 1; i <= a; i++){
        for (int j = 0; j <= b; j++){
            int x = 0;
            if (j == 0) dp[i][j] = dp[i - 1][j]; else
            dp[i][j] = (dp[i - 1][j] + s[j - 1][min(j - 1, i)]) % mod;
        }
    }
    int ans = 0;
    for (int i = 0; i <= a; i++){
        for (int j = 0; j <= i; j++){
            int x = C[j][b - 1];
            ans = (ans + x * dp[i - j][j]) % mod;
        }
    }
    cout << ans;
}


Measured memory_bytes: 93056
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [s, w]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    return `${s <= w ? "unsafe" : "safe"}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


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

int main() {
    long long a, b, c;
    cin >> a >> b >> c;
    long long ans = 0;
    if (a+b >= c) ans = b + c;
    else if (a+b < c) ans = b + a + b + 1;
    cout << ans << endl;
}

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

class Dice{
    public:
    int face[6];
    string order;

    Dice(){
        for(int i=0; i<6; i++) face[i] = 0;
        order = "";
    }

    void roll(char ch){
        int tmp;

        if(ch == 'N'){
            tmp = face[0];
            face[0] = face[1];
            face[1] = face[5];
            face[5] = face[4];
            face[4] = tmp;
        }else if(ch == 'W'){
            tmp = face[0];
            face[0] = face[2];
            face[2] = face[5];
            face[5] = face[3];
            face[3] = tmp;
        }else if(ch == 'S'){
            tmp = face[0];
            face[0] = face[4];
            face[4] = face[5];
            face[5] = face[1];
            face[1] = tmp;
        }else if(ch == 'E'){
            tmp = face[0];
            face[0] = face[3];
            face[3] = face[5];
            face[5] = face[2];
            face[2] = tmp;
        }
    }
};

int main(){
    Dice dice;

    for(int i=0; i<6; i++) cin >> dice.face[i];
    cin >> dice.order;

    for(int i=0; i<dice.order.size(); i++){
        dice.roll(dice.order[i]);
    }

    cout << dice.face[0] << endl;

    return 0;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x, a, b;
	cin >> x >> a >> b;
	cout << (x - a) % b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	if(n>=400&&n<=599) cout << 8 << endl;
	else if(n>=600&&n<=799) cout << 7 << endl; 
	else if(n>=800&&n<=999) cout << 6 << endl;
	else if(n>=1000&&n<=1199) cout << 5 << endl;
	else if(n>=1200&&n<=1399) cout << 4 << endl;
	else if(n>=1400&&n<=1599) cout << 3 << endl;
	else if(n>=1600&&n<=1799) cout << 2 << endl;
	else if(n>=1800&&n<=1999) cout << 1 << endl;
	return 0;
}

Measured memory_bytes: 3616
def selection_sort(a, n)
    swap = 0
    for i in 0...(n - 1)
        minj = i
        for j in i...n
            if a[minj] > a[j]
                minj = j
            end
        end
        swap += 1 if i != minj
        a[i], a[minj] = a[minj], a[i]
        #puts a.join(" ")
    end
    puts a.join(" ")
    puts swap
end

n = gets.to_i
a = gets.split.map(&:to_i)
selection_sort(a, n)


Measured memory_bytes: 6864
#include<iostream>
using namespace std;
int main()
{
	int n, m;
	while (true){
		cin >> n >> m;
		if (n == 0 && m == 0){
			break;
		}
		int map[100][100] = { 0 };
		int dp[100][100] = { 0 };
		for (int i = 0; i < m; i++){
			for (int i2 = 0; i2 < n; i2++){
				cin >> map[i][i2];
			}
		}
		for (int i = 0; i < n; i++){
			if (map[0][i] == 0){
				dp[0][i] = 1;
			}
		}
		for (int i = 0; i < m; i++){
			for (int i2 = 0; i2 < n; i2++){
				if (map[i][i2] == 0){
					if ((map[i + 1][i2] == 0 || map[i + 1][i2] == 2)){
						dp[i + 1][i2] += dp[i][i2];
					}
					if (i2+1<n &&map[i + 1][i2 + 1] == 0&&i<m-1){
						dp[i + 1][i2 + 1] += dp[i][i2];
					}
					if (i2 - 1 >= 0 && map[i + 1][i2 - 1] == 0&&i<m - 1){
						dp[i + 1][i2 - 1] += dp[i][i2];
					}
				}
				if (map[i][i2] == 2){
					if (map[i + 2][i2] == 0 || map[i + 2][i2] == 2){
						dp[i + 2][i2] += dp[i][i2];
					}
				}
			}
		}
		int ans = 0;
		for (int i = 0; i < n; i++){
			ans += dp[m][i];
			ans += dp[m + 1][i];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,j,i,max;
	cin>>a>>b;
	j=a+b;
	i=a-b;
	c=a*b;
	max =j; 
	if(max<i)
		max=i;
	if(max<c)
		max=c;
	cout<<max;
	return 0;
}

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;

#define INF 1e9
#define MOD 1000000007
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (a); i > (b); i--)
#define each(x, v) for (auto& x: (v))
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl

void solve();
void in(){} template<class T, class... U> void in(T &t, U &...u){ cin >> t; in(u...); }
int main() { cin.tie(0); ios::sync_with_stdio(0); solve(); }

void solve() {
  int N;
  in(N);
  vi d(N);
  each(x, d) in(x);
  sort(all(d));
  int mid = N / 2;
  print(d[mid] - d[mid - 1]);
}


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

int main(void) {
    int N;
    int left,right;
    int water = 0;
    cin >> N;

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

    left= 0;
    while(1) {
        while(h[left] == 0) {
            left++;
            if(left == N)break;
        }
        if(left == N)break;
        right = left + 1;
        if(right != N) {
            while(h[right]) {
                right++;
                if(right == N)break;
            }
        }
        if(right > left) water++;
        for(int i=left;i<right;i++) {
            h[i]--;
        }
        if(left == N)break;
    }

    cout << water << endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  string s;
  cin >> n >> s;
  int x = 0, ret = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'I') {
      x++;
    } else {
      x--;
    }
    ret = max(ret, x);
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; cin >> N; 
	long long X[20], Y[20], P[20];
	for(int i = 0; i < N; i++){
		cin >> X[i] >> Y[i] >> P[i]; 
	}
	long long H[32770][16] = {}; // 水平な道を作る集落の集合
	long long V[32770][16] = {}; 
	for(int i = 0; i < (1 << N); i++){
		for(int j = 0; j < N; j++){
			if((i >> j) & 1) continue; 
			long long mn = abs(Y[j]); 
			for(int k = 0; k < N; k++){
				if(!((i >> k) & 1)) continue;
				mn = min(mn, abs(Y[j] - Y[k])); 
			}
			H[i][j] = mn * P[j]; 
		}
	}
	for(int i = 0; i < (1 << N); i++){
		for(int j = 0; j < N; j++){
			if((i >> j) & 1) continue; 
			long long mn = abs(X[j]); 
			for(int k = 0; k < N; k++){
				if(!((i >> k) & 1)) continue;
				mn = min(mn, abs(X[j] - X[k])); 
			}
			V[i][j] = mn * P[j]; 
		}
	}
	long long ans[16] = {}; 
	fill(ans, ans+16, 1145141919810364364); 
	for(int bit = 0; bit < (1 << N); bit++){ // 道を作る集落の集合
		int hor = bit; // 横の道を作る集落の集合
		while(1){
			int ver = bit - hor;
			long long tmp = 0; 
			for(int i = 0; i < N; i++){
				if((bit >> i) & 1) continue; 
				tmp += min(H[hor][i], V[ver][i]); 
			}
			int p = __builtin_popcount(bit); 
			ans[p] = min(ans[p], tmp); 
			hor = (hor - 1) & bit; 
			if(hor == bit) break; 
		}
	}
	for(int i = 0; i <= N; i++){
		cout << ans[i] << "\n"; 
	}
}

Measured memory_bytes: 11784
#include <iostream>
using namespace std;
inline int GCD(int x,int y){
  return (y==0? x:GCD(y,x%y));
}
int main(){
  int K,gcd[200+1][200+1],sum=0;
  cin >> K;
  for(int a=1;a<=K;a++){
    for(int b=1;b<=K;b++){
      gcd[a][b]=GCD(a,b);
    }
  }
  for(int a=1;a<=K;a++){
    for(int b=1;b<=K;b++){
      for(int c=1;c<=K;c++){
        sum+=gcd[gcd[a][b]][c];
      }
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3760
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{x:i64, t:i64};
    println!("{}", max(x-t,0));
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
int main(void){
    int n,m,count=0,max=0;
    scanf("%d",&n);
    char s[n][10+1];
    for(int i=0; i<n; i++)
        scanf("%s",s[i]);
    scanf("%d",&m);
    char t[m][10+1];
    for(int i=0; i<m; i++)
        scanf("%s",t[i]);
    for(int i=0; i<n; i++){
        count=0;
        for(int j=0; j<n; j++){
            if(strcmp(s[i],s[j])==0)
                count++;
        }
        for(int j=0; j<m; j++){
            if(strcmp(s[i],t[j])==0)
                count--;
        }
        if(count>max)
            max=count;
    }
    printf("%d",max);
}

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

int main(void){
    string S;
    cin >> S;

    int count = 0, count_max = 0;

    for(char ch : S){
        if(ch == 'R'){
            count++;
            if(count_max < count) count_max = count;
        }
        else count=0;
    }

    cout << count_max;

    return 0;
}

Measured memory_bytes: 3620
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n;cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  vl b=a;
  sort(b.begin(),b.end());
  map<ll,ll>M;
  rep(i,n)M[b[i]]=i;
  ll ans=0;
  rep(i,n){
    ll d=abs(i-M[a[i]]);
    //cout<<d<<endl;
    if(d%2!=0)ans++;
  }
  cout<<ans/2<<endl;
}
  

Measured memory_bytes: 8064
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
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; }
typedef pair <ll,ll> P;

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) { 
        os << v[i]; 
        if (i != (int)v.size() - 1) 
            os << " "; 
    } 
    return os; 
} 

int main()
{
    ll N, M;
    cin >> N >> M;
    multiset<ll> A;
    rep(i, N) { 
        ll tmp;
        cin >> tmp;
        A.insert(tmp);
    }
    while(M > 0) {
        ll tmp = *(--A.end());
        A.erase(--A.end());
        M--;
        tmp /= 2;
        A.insert(tmp);
    }
    ll sum = 0;
    for(auto itr = A.begin(); itr != A.end(); ++itr) {
        sum += *itr;      // イテレータの指す先のデータを表示
    }
    print(sum);
    return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <string.h>

char str[50];
char word[1000][50];
int count[1000];

int main(void)
{
	int i, j, ind, ind2;
	int c, len = 0;
	i = 0;
	
	while (scanf("%s", str) != EOF){
		
		c = 1;
		for (j = 0; j < i; j++){
			
			if (strcmp(str, word[j]) == 0){
				count[j]++;
				c = 0;
			}
		}
		
		if (c == 1){
			strcpy(word[i], str);
			
			if (strlen(word[i]) > len){
				len = strlen(word[i]);
				ind = i;
			}
			i++;
		}
	}
	ind2 = 0;
	
	for (j = 0; j < i; j++){
		
		if (count[ind2] < count[j]){
			ind2 = j;
		}
	}
	
	printf("%s %s\n", word[ind2], word[ind]);
	
	return (0);
}

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

int main() {
	long long N;
	cin >> N;
	long long ans = 0;
	for (long long i = 1; i <= (long long)sqrt(N) + 1; i++) if (N % i == 0 && (N - i) / i > i) ans += (N - i) / i;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(30);
#define ll long long
#define pi 3.14159265359
using namespace std;

int main()
{
    IOS;
    int k;
    cin>>k;
    string s;
    cin>>s;
    if(s.size()<=k) cout<<s;
    else cout<<s.substr(0,k)<<"...";
    return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  string ans = "No";
  if (a + b == c)
    ans = "Yes";
  if (a + c == b)
    ans = "Yes";
  if (b + c == a)
    ans = "Yes";

  cout << ans << endl;
}

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

int main()
{
	int n, ans = 0;
	cin >> n;
	for (int i = 1; i <= n; i += 2)
	{
		int way = 0;
		for (int j = 1; j <= n; ++j)
		{
			way += (i % j == 0);
		}
		ans += (way == 8);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;

int main() {
    string str;
    cin >> str;
    char a = str[0];
    if (a == str[1]) {
        if (str[2] == str[3] and str[2] != a) {
            cout << "Yes" << endl;
            return 0;
        }
    } else if (a == str[2]) {
        if (str[1] == str[3] and str[1] != a) {
            cout << "Yes" << endl;
            return 0;
        }
    } else if (a == str[3]) {
        if (str[1] == str[2] and str[1] != a) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 888
def solve():
    rec = [1000000] * 1000000
    rec[0] = 0
    odd_rec = rec.copy()
    
    for i in range(1, 181):
        t = i * (i + 1) * (i + 2) // 6
        for i, tpl in enumerate(zip(rec[t:t*4], rec), start=t):
            a, b = tpl
            b += 1
            if b < a:
                rec[i] = b
        if t % 2:
            for i, tpl in enumerate(zip(odd_rec[t:t*35], odd_rec), start=t):
                a, b = tpl
                b += 1
                if b < a:
                    odd_rec[i] = b
    
    import sys
    file_input = sys.stdin
    n = int(file_input.readline())
    while n:
        print(rec[n], odd_rec[n])
        n = int(file_input.readline())

solve()


Measured memory_bytes: 29200
#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define stdi(in) freopen(in, "r", stdin)
#define stdo(out) freopen(out, "w", stdout)
#define stdio(in, out) stdi(in); stdo(out)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define MAX 100007
#define MOD 1000000007
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define ordered_set tree<int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

ll arr[102],n,k;
ll dp[102][MAX];
ll presum[102][MAX];

int main(){
    /*#ifndef ONLINE_JUDGE
        stdio("in", "out");
    #endif*/
    fast;
    cin>>n>>k;

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

    if(k==0){
    	cout<<1<<'\n';
    	return 0;
    }

    /*for(int i=0;i<=n;i++){
    	dp[i][0] = 1;
    }*/

    for(int i=1;i<=k;i++){
    	if(arr[1]>=i){
	    	dp[1][i] = 1;
	    }
    	presum[1][i] = presum[1][i-1]+dp[1][i];
    }


    for(int i=2;i<=n;i++){
    	for(int j=1;j<=k;j++){
    		dp[i][j] = presum[i-1][j]-presum[i-1][max(j-arr[i]-1, 0LL)];
    		if(arr[i]>=j) dp[i][j]++;
    		if(dp[i][j]<0) dp[i][j]+=MOD;
    		presum[i][j] = (presum[i][j-1]+dp[i][j])%MOD;;
    	}
    }

    cout<<dp[n][k]<<'\n';


    return 0;   
}

Measured memory_bytes: 158080
N = int(input())
A = list(map(int, input().split()))
d = {}
for a in A:
    if a in d.keys():
        d[a] += 1
    else:
        d[a] = 1

d = sorted(d.items(), reverse=True)
ans = []
for dd in d:
    if dd[1] > 1:
        if len(ans) == 0 and dd[1] > 3:
            print(dd[0] ** 2)
            exit()
        ans.append(dd[0])
    if len(ans) >= 2:
        break

if len(ans) < 2:
    print(0)
else:
    print(ans[1] * ans[0])


Measured memory_bytes: 21128