akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using ll =long long;
//nCm 
const int MAX = 510000;
const int MOD = 1000000007;

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

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

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

//nCmここまで

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
const ll INF = 1LL << 60;

//Write From this Line

const int mod = 1e9+7;
int main()
{
	int n ,m ;
	cin >> n >>m ;
	int a[n] ,b[n] ,c[m] ,d[m];
	rep(i,n) cin >> a[i] >> b[i] ;
	rep(i,m) cin >> c[i] >> d[i] ;

	//n人いて、m個のチェックポイントがある。
	rep(i,n){
		//i番目の人について、どこのチェックポイントが一番近いか
		ll dist = 1e9+7;
		ll dist_index = 0 ;
		rep(j,m){
			//iの座標とチェックポイントの距離 now　を撮る
			int now = 0 ;
			now += abs(a[i] - c[j]) + abs(b[i] - d[j]);
			if(dist > now){
				dist = now ;
				dist_index = j ;
			}
		}
		cout << dist_index + 1 << endl;
	}

}


Measured memory_bytes: 764
#include<stdio.h>
int main(void){
    int a[3],b[2],c,i;
    for(i=0;i<3;i++){
    scanf("%d",&a[i]);
    }
    for(i=0;i<2;i++){
    scanf("%d",&b[i]);
    }
    if(a[0]>=a[1]){
        c=a[0];
        a[0]=a[1];
        a[1]=c;
    }
    if(a[1]>=a[2]){
        c=a[1];
        a[1]=a[2];
        a[2]=c;
    }
    if(a[0]>=a[1]){
        c=a[0];
        a[0]=a[1];
        a[1]=c;
    }
    if(b[0]>=b[1]){
        c=b[0];
        b[0]=b[1];
        b[1]=c;
    }
    printf("%d\n",a[0]+b[0]-50);

    return 0;
}

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

int main()
{
    string S;
    cin >> S;
    if ((S[6] == '1' && S[5] == '0') || (S[6] == '2' && S[5] == '0') || S[6] == '3' || S[6] == '4')
    {
        cout << "Heisei" << endl;
    }
    else
    {
        cout << "TBD" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner


object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val s = sc.next().toCharArray
    
    val rs = new Array[Int](n)
    val gs = new Array[Int](n)
    val bs = new Array[Int](n)
    
    for (i <- s.indices) {
      if (i > 0) {
        s(i) match {
          case 'R' =>
            rs(i) = rs(i - 1) + 1
            gs(i) = gs(i - 1)
            bs(i) = bs(i - 1)
          case 'G' =>
            rs(i) = rs(i - 1)
            gs(i) = gs(i - 1) + 1
            bs(i) = bs(i - 1)
          case 'B' =>
            rs(i) = rs(i - 1)
            gs(i) = gs(i - 1)
            bs(i) = bs(i - 1) + 1
        }
      } else {
        s(i) match {
          case 'R' =>
            rs(i) = 1
            gs(i) = 0
            bs(i) = 0
          case 'G' =>
            rs(i) = 0
            gs(i) = 1
            bs(i) = 0
          case 'B' =>
            rs(i) = 0
            gs(i) = 0
            bs(i) = 1
        }
      }
    }
    
    var ans = 0L
    
    for (i <- n - 1 to 2 by -1) {
      for (j <- i - 1 to 1 by -1) {
        if ((s(i) == 'R' && s(j) == 'G') || (s(i) == 'G' && s(j) == 'R')) {
          ans += bs(j)
          val m = i - j
          val n = j - m
          if (0 <= n && s(n) == 'B') {
            ans -= 1
          }
        } else if ((s(i) == 'R' && s(j) == 'B') || (s(i) == 'B' && s(j) == 'R')) {
          ans += gs(j)
          val m = i - j
          val n = j - m
          if (0 <= n && s(n) == 'G') {
            ans -= 1
          }
        } else if ((s(i) == 'B' && s(j) == 'G') || (s(i) == 'G' && s(j) == 'B')) {
          ans += rs(j)
          val m = i - j
          val n = j - m
          if (0 <= n && s(n) == 'R') {
            ans -= 1
          }
        }
      }
      
    }
    println(ans)
  }
  
  def printArray[T](arr: Array[T]): Unit = {
    for (i <- arr.indices) {
      print(s"${arr(i)} ")
    }
    println()
  }
}

Measured memory_bytes: 55644
#include "bits/stdc++.h"
using namespace std;
int main()
{
    int n;
    scanf("%d", &n);
    vector<vector<int>> a(n, vector<int>(0, 0));
    vector<int> b(n,-1);
    b[0] = 0;
    for (int i = 0, u, k; i < n; i++)
    {
        scanf("%d %d", &u, &k);
        u--;
        for (int j = 0, v; j < k; j++)
        {
            scanf("%d", &v);
            a[u].push_back(--v);
        }
    }
    queue<int> c;
    c.push(0);
    for (int t; !c.empty(); )
    {
        t = c.front();
        c.pop();
        for (int i = 0; i < a[t].size(); i++)
        {
            if (b[a[t][i]] == -1)
            {
                c.push(a[t][i]);
                b[a[t][i]] = b[t] + 1;
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        printf("%d %d\n", i + 1, b[i]);
    }
}


Measured memory_bytes: 3268
import java.util.*;
public class Main {
	public static void main(String[] args)
	{
		//変数
		int count=0;
		boolean sw=false;
		int answer=0;
		//List<Integer> hb=new ArrayList<Integer>();
		//long a=0;
		int min=0;
		int midle=0;
		int max=0;
		//入力
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		int A=sc.nextInt();
		int B=sc.nextInt();
		//int [] P=new int[N];
		//int [][] cost =new int[N-1][2];
		//処理
		for(int i=0;i<N;i++)
		{
			int P=sc.nextInt();
			if(P<=A)
			{
				min++;
			}
			else if(P>=A+1 && P<=B)
			{
				midle++;
			}
			else if(P>=B+1)
			{
				max++;
			}
		}
		answer=Math.min(Math.min(min,max),midle);
		// 出力
		System.out.println(answer);
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  string s;
  cin >> n >> s;

  int ans = 0;
  rep(i, 1, n) {
    string l = s.substr(0, i);
    string r = s.substr(i, n - i);
    vector<bool> v(26, false);
    rep(j, 0, l.size()) { v[l[j] - 'a'] = true; }
    int c = 0;
    rep(j, 0, r.size()) {
      if (v[r[j] - 'a']) {
        c++;
        v[r[j] - 'a'] = false;
      }
    }
    chmax(ans, c);
  }

  cout << ans << endl;
}


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

int main()
{

	int n,k;
	cin >> n >> k;
	vector<int> oka(n+1);
	for (int i=0;i<k;++i)
	{
		int d;
		cin >> d;
		for (int j=0;j<d;++j)
		{
			int a;
			cin >> a;
			oka[a]=1;
		}
	}

	int trick=0;
	for (int i=1;i<=n;++i)
	{
		if (oka[i]==0)
		{
			++trick;
		}
	}
	cout << trick << endl;
}






Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
typedef pair<int, bool> sP;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

void solve() {
	int n; ll k; cin >> n >> k;
	ll le = -1, ri = 1e+12; ri += 3;
	vector<ll> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	vector<ll> f(n);
	rep(i, n) {
		cin >> f[i];
	}
	//sort(f.begin(), f.end());
	while (ri - le > 1) {
		ll mid = (le + ri) / 2;
		ll sum = 0;
		vector<ll> d;
		rep(i, n) {
			d.push_back(mid / f[i]);
		}
		sort(d.begin(), d.end());
		rep(i, n) {
			sum += max((ll)0, a[i] - d[i]);
		}
		if (sum > k) {
			le = mid;
		}
		else {
			ri = mid;
		}
	}
	cout << ri << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(7);
	//init();
	solve();
	//stop
	return 0;
}



Measured memory_bytes: 7060
import java.util.*;

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 d = sc.nextInt();

    int min_ab = a;
    int min_cd = c;

    min_ab = Math.min(a,b);
    min_cd = Math.min(c,d);

    System.out.println(min_ab+min_cd);
  }

}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int N,K,h,ans = 0;
    cin >> N >> K;

    for(int i=0;i<N;i++)
    {
        cin >> h;
        if(h >= K) ans++;
    }

    cout << ans << endl;
    

}

Measured memory_bytes: 256
/// b.cpp

# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < __typeof(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("Yes")
# define no puts("No")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < pll >
# define pb push_back
# define pdd pair < db , db >
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n;
    fi>>n;
    static int s[1 << 20];
    for (int i = 1;i <= n;++i)
        fi>>s[i];
    if (*max_element(s + 1,s + 1 + n) - *min_element(s + 1,s + 1 + n) > 1)
        return no * 0;
    int mn = *min_element(s + 1,s + 1 + n);
    int mx = *max_element(s + 1,s + 1 + n);
    if (mn == mx)
    {
        if (mx > n / 2 && mx != n - 1)
            return no * 0;
        else
            return yes * 0;
    }
    else
    {
        int a = 0,b = 0;
        for (int i = 1;i <= n;++i)
        {
            a += s[i] == mn;
            b += s[i] == mx;
        }
        if (a + 1 <= mx && mx <= a + (b / 2))
            return yes * 0;
        else
            return no * 0;
    }
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    map<char,int> mp;
    for(auto c:S) mp[c]++;

    int64_t ans=1;
    for(auto m:mp){
        ans*=m.second+1;
        ans%=MOD;
    }
    ans--;

    cout<<ans<<endl;
}

Measured memory_bytes: 512
#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++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
struct starryskytree{
	int N;
	using D = ll;
	D id_ = 1e17;		//initialize	!!このあとaddクエリがきてもidを超えないようにする!!
	D id  = 1e18;		//id
	vector<D> mn,ad;
	starryskytree(){}
	starryskytree(int n){
		N=1;
		while(N<n) N*=2;
		mn.assign(N*2,id_);
		ad.assign(N*2,0);
	}
	starryskytree(vector<D>& vc){
		int n = vc.size();
		N=1;
		while(N<n) N*=2;
		mn.assign(N*2,id_);
		ad.assign(N*2,0);
		rep(i,n) mn[i+N]=vc[i];
		for(int i=N-1;i>0;i--) mn[i]=min(mn[i*2],mn[i*2+1]);
	}
	void add(int a,int b,D v){
		add(a,b,0,N,1,v);
	}
	void add(int a,int b,int l,int r,int k,D v){
		if(b<=l||r<=a) return;
		if(a<=l&&r<=b){
			ad[k]+=v;
			return;
		}
		add(a,b,l,(l+r)/2,k*2,v);
		add(a,b,(l+r)/2,r,k*2+1,v);
		mn[k]=min(mn[k*2]+ad[k*2],mn[k*2+1]+ad[k*2+1]);
	}
	D getmin(int a,int b){
		return getmin(a,b,0,N,1);
	}
	D getmin(int a,int b,int l,int r,int k){
		if(b<=l||r<=a) return id;
		if(a<=l&&r<=b) return mn[k]+ad[k];
		return ad[k]+min(getmin(a,b,l,(l+r)/2,k*2),getmin(a,b,(l+r)/2,r,k*2+1));
	}
	void assign(int x,ll v){
		add(x,x+1,v-getmin(x,x+1));
	}
	void changemin(int x,ll v){
		D dif = v - getmin(x,x+1);
		if(dif<0) add(x,x+1,dif);
	}
};

using P = pair<int,int>;
int N,M;
V<P> r2lc[200010];
int main(){
	cin>>N>>M;
	ll csum = 0;
	rep(i,M){
		int l,r,c;
		cin>>l>>r>>c;
		l--;
		r2lc[r].pb(P(l,c));
		csum += c;
	}
	starryskytree seg(N+2);

	seg.assign(0,0);
	rep1(i,N){
		ll val = seg.getmin(0,i);
		seg.assign(i,val);
		for(P lc:r2lc[i]){
			int l = lc.fs;
			ll c = lc.sc;
			seg.add(0,l+1,c);
		}
	}
	ll tmp = seg.getmin(0,N+1);
	cout<<csum-tmp<<endl;
}

Measured memory_bytes: 19328
n=int(input())
l=[[0]*10 for i in range(10)]
for i in range(n):
    t=str(i+1)
    l[int(t[0])][int(t[-1])]+=1
a=0
for i in range(10):
    for j in range(10):
        a+=l[i][j]*l[j][i]
print(a)

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

int H, W, K;
int sx, sy, gx, gy;
vector<vector<int>> hasu;
vector<vector<int>> dist;
constexpr int dx[] = {0, 1, 0, -1};
constexpr int dy[] = {1, 0, -1, 0};

int main() {
  cin >> H >> W >> K;
  cin >> sx >> sy >> gx >> gy;
  sx--, sy--, gx--, gy--;
  hasu = vector<vector<int>>(H, vector<int>(W, 0));
  dist = vector<vector<int>>(H, vector<int>(W, 0xffffff));
  dist[sx][sy] = 0;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      char c;
      cin >> c;
      hasu[i][j] = c == '@';
    }
  }
  queue<pair<int, int>> que;
  que.push(make_pair(sx, sy));
  while (que.size()) {
    int x, y;
    tie(x, y) = que.front();
    que.pop();
    for (int d = 0; d < 4; ++d) {
      for (int i = 1; i <= K; ++i) {
        int nx = x + dx[d] * i;
        int ny = y + dy[d] * i;
        if (nx < 0 || H <= nx) break;
        if (ny < 0 || W <= ny) break;
        if (hasu[nx][ny]) break;
        if (dist[nx][ny] <= dist[x][y]) break;
        if (dist[nx][ny] <= dist[x][y] + 1) continue;
        dist[nx][ny] = dist[x][y] + 1;
        que.push(make_pair(nx, ny));
      }
    }
  }
  cout << (0xffffff == dist[gx][gy] ? -1 : dist[gx][gy]) << endl;
}

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

int main(){
  int n,d[110],sum=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>d[i];
  }

  for(int i=0;i<n;i++){
    for(int k=i+1;k<n;k++){
      sum+=d[i]*d[k];
    }
  }
  cout<<sum;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  /**
   * Iterate through each line of input.
   */
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    
    if(Character.isUpperCase(str.charAt(0))) {
    	System.out.println("A");
    }else {
    	System.out.println("a");
    }
    
  }
}

Measured memory_bytes: 35732
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
using namespace std;

int main()
{
    std::cout<<std::fixed<<std::setprecision(10);

    int n;
    cin >> n;

    int t = ( n + 2 - 1 ) / 2;
    double a = (double)t / (double)n;
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i = a; i < (int) b; i++)
#define F0R(i, a) FOR (i, 0, a)
#define ROF(i, a, b) for(int i = a; i >= (int) b; i--)
#define R0F(i, a) ROF(i, a, 0)
#define GO(i, a) for (auto i : a)
 
#define rsz resize
#define eb emplace_back
#define pb push_back
#define sz(x) (int) x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define f first
#define s second
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vpii> vvpii;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef vector<pi64> vpi64;

const int N = 3e3 + 5;

int dp [N][N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string a, b;
  cin >> a >> b;
  int mx = 0;
  for (int i = 1; i <= sz(a); i++) {
    for (int j = 1; j <= sz(b); j++) {
      if (a[i - 1] == b[j - 1]) {
        dp[i][j] = 1 + dp[i - 1][j - 1];
      } else {
        dp[i][j] = max (dp[i - 1][j], dp[i][j - 1]);
      }
      mx = max (mx, dp[i][j]);
    }
  }
  int i = sz(a), j = sz(b);
  string ans;
  while (i > 0 && j > 0) {
    if (a[i - 1] == b[j - 1]) {
      ans += a[i - 1];
      i--; 
      j--;
    } else {
      if (dp[i - 1][j] > dp[i][j - 1]) {
        i--;
      } else {
        j--;
      }
    }
  }
  reverse (all(ans));
  cout << ans << '\n';
  return 0;
}


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

typedef long long ll;


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

	double t = 2*3.14159265358979*((60.0*H+M)/720.0 - M/60.0);
	cout << setprecision(10) << sqrt((double)A*A+B*B-2.0*A*B*cos(t)) << endl;

	return 0;
}

Measured memory_bytes: 4252
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N; cin>>N;
  N+=1;
  long long a=log10(N);
  long long b=pow(10,a);
  if(N/b==1)cout<<a*9<<endl;
  else cout<<a*9+N/b-1<<endl;
}

Measured memory_bytes: 3996
#include<stdio.h>


int n;
int score[110];
int _max,_min;
int i;
int sum;
int ans; 

int main()
{
	
	for(;;)
	{
		_max = 0;
		_min = 100000;
		sum = 0;
		
		scanf("%d",&n);
		if(n == 0)break;
		
		for(i = 0;i < n;i++)
		{
			scanf("%d",&score[i]);
			if(score[i] < _min)
			{
				_min = score[i];
			}
			if(score[i] > _max)
			{
				_max = score[i];
			}
			sum += score[i];
			
		}
		
		ans =( sum - _max - _min) /(n - 2);
		
		printf("%d\n",ans);
		
	}
	
	return 0;
	
}
		

Measured memory_bytes: 2584
#include<iostream>
#include<string>
using namespace std;
int main(){
  string ans,r,r2;
  int n,s,count=0;
  cin >> ans;
  cin >> s;
  for(int i=0;i<s;i++){
    cin >> r;
    r2 = r + r;
    n = r2.find(ans);
    if(n!=-1) count++;
  }
  cout << count << endl;
  return 0;
}
   

Measured memory_bytes: 1212
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>
#include <map>

const int INT_INF = 1000000000;                 // 10^9
const long long LONG_INF = 1000000000000000000; // 10^18

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }

    sort(h.begin(), h.end());
    reverse(h.begin(), h.end());

    long long count = 0;
    for (int i = k; i < n; i++)
    {
        count += h[i];
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007;




int main(){
	vi v(3);
	int n,r;
	while(cin>>v[0]>>v[1]>>v[2]){
		if(v[0]==0&&v[1]==0&&v[2]==0)break;
		sort(all(v));
		int d=(v[0]*v[0]+v[1]*v[1]);
		cin>>n;
		rep(i,n){
			cin>>r;
			r*=r;
			r*=4;
			if(r>d)cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
}

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

int main(){
     int N,W;
     long int w[110], v[110];
     long int dp[110][100010];
     cin >> N >> W;
     for (int i = 0; i < N; i++){
             cin >> w[i] >> v[i];
     }
     for (int j = 0; j < N; j++){
             dp[0][j] = 0;
     }
     for (int i = 0; i < N; i++){
             for (int j=0; j <= W; j++){
                    if (j >= w[i]) dp[i+1][j] = max(dp[i][j-w[i]] + v[i], dp[i][j]);
                    else dp[i+1][j] = dp[i][j];
             }
     }
     cout << dp[N][W] << endl;
     return 0;
}


Measured memory_bytes: 80384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n;
    cin>>n;
    string s;
    set<string>str;
    while(n--)
    {
        cin>>s;
     str.insert(s);
    }
    cout<<str.size()<<endl;

}


Measured memory_bytes: 19264
#include<bits/stdc++.h>
#define maxn 100005 
using namespace std;
int N;
vector<int> G[maxn];
int L;
void dfs(int u,int pa,int d)
{
	if(u==N)
		L = d-2;
	if(L!=0)    return; 
	for(int v:G[u])
	{
		if(v == pa)    continue;
		dfs(v,u,d+1); 
	} 
}
int state[maxn];
void dfs2(int u,int pa,int d,int sta)
{
	if(d>L+1)
	    return;
	state[u] = sta;
	for(int v:G[u])
	{
		if(v==pa)    continue;
		dfs2(v,u,d+1,sta); 
	} 
} 
int sz[maxn];
void dfs3(int u,int pa)
{
	sz[u] = 1;
	for(int v:G[u])
	{
		if(v==pa || state[v] == 0)
		    continue;
		dfs3(v,u);
		sz[u] += sz[v]; 
	} 
} 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> N;
	for(int i=1;i<N;i++)
	{
		int u,v;
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u); 
	} 
	dfs(1,1,1);
	memset(state,-1,sizeof state);
	bool flag = false; 
	if(L&1) 
	    flag = true;
	L >>= 1;
	if(flag)
	    L++; 
	dfs2(1,1,1,0);
	if(flag)
	    L--; 
	dfs2(N,N,1,1);
	dfs3(N,N);
	if(N&1)
	{
		if(sz[N] > N/2)
		    cout << "Snuke" << endl;
		else
		    cout << "Fennec" << endl; 
	}
	else
	{
		if(sz[N] >= N/2)
		    cout << "Snuke" << endl;
		else
		    cout << "Fennec" << endl; 
	} 
    return 0;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <unordered_map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, double> pid;
typedef pair<double, int> pdi;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;

const double EPS = 1e-9;

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

	vector<tuple<double, double, double>> P;

	double x, y, r;
	rep(i, 0, 2)
	{
		cin >> x >> y;
		P.push_back(make_tuple(x, y, 0.0));
	}

	int N;
	cin >> N;
	rep(i, 0, N)
	{
		cin >> x >> y >> r;
		P.push_back(make_tuple(x, y, r));
	}

	N = SZ(P);
	vector<vector<pair<int, double>>> G(N);
	rep(i, 0, N)rep(j, 0, N)
	{
		if (i == j)continue;
		double dx = get<0>(P[i]) - get<0>(P[j]), dy = get<1>(P[i]) - get<1>(P[j]);
		double c = sqrt(dx*dx + dy * dy) - (get<2>(P[i]) + get<2>(P[j]));
		chmax(c, 0.0);
		G[i].push_back(mp(j, c));
	}

	priority_queue<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>>> pq;
	pq.push(mp(0.0, 0));
	vector<double> D(N, 1e18);
	D[0] = 0.0;
	while (!pq.empty())
	{
		auto p = pq.top();
		pq.pop();
		if (D[p.second] < p.first - EPS)continue;
		for (const auto e : G[p.second])
		{
			if (chmin(D[e.first], p.first + e.second))
			{
				pq.push(mp(D[e.first], e.first));
			}
		}
	}

	cout << fixed << setprecision(12) << D[1] << endl;
	
	return 0;
}

Measured memory_bytes: 23612
#include <bits/stdc++.h>
using namespace std;;
 
int main(){
	
    string s, t;
    int sSize, tSize, ans, count;
    
    cin >> s >> t;
    
    sSize = s.size();
    tSize = t.size();
    
    ans = tSize;
    
    for (int i = 0; i <= sSize-tSize; i++){
        count = 0;
        for (int j = 0; j < tSize; j++){
            if (s[i + j] != t[j]){
                count++;
            }
        }
        ans = min(ans, count);
    }
    cout << ans << endl;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  while(true){
    int W,H;
    cin>>W>>H;
    if(H==0&&W==0)break;
    vector<vector<int>>c(H,vector<int>(W));
    for(int i=0;i<H;i++)for(int j=0;j<W;j++)cin>>c[i][j];
    queue<pii>q;
    int dx[8]={0,0,1,-1,1,-1,-1,1};
    int dy[8]={1,-1,0,0,1,-1,1,-1};
    int ans=0;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        if(c[i][j]==0)continue;
        c[i][j]=0;
        q.push({i,j});
        while(q.size()){
          int y=q.front().first;
          int x=q.front().second;
          q.pop();
          for(int k=0;k<8;k++){
            int X=x+dx[k];
            int Y=y+dy[k];
            if(0<=X&&X<W&&0<=Y&&Y<H&&c[Y][X]==1){
              c[Y][X]=0;
              q.push({Y,X});
            }
          }
        }
        ans++;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3128
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  int n,x;
  cin >> n >> x;
  int a;
  int cnt = 1;
  int now = 0;
  rep(i,n){
    cin >> a;
    if(now+a <= x){
      now += a;
      cnt++;
    }else{
      break;
    }
  }
  printf("%d\n", cnt);

  return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn gcd(a: usize, b: usize) -> usize {
    if a == usize::default() {
        b
    } else {
        gcd(b % a, a)
    }
}
fn lcm(a: usize, b: usize) -> usize {
    a * b / gcd(a, b)
}

fn count(a: usize) -> usize {
    let mut count = 0;
    let mut a = a;
    while a%2 == 0 {
        a /= 2;
        count += 1;
    }
    count
}

fn solve() {
    let (n,m) = get!(usize, usize);
    let a = get!([usize]);

    let base = count(a[0]);
    if a.iter().any(|&e| base != count(e)) {
        println!("0");
        return;
    }

    let l = a.iter().fold(1, |l, &e| lcm(l,e/2));
    if m < l {
        println!("0");
        return;
    }
    println!("{}", (m-l)/(2*l)+1);
}


Measured memory_bytes: 12540
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final String s = fs.next();
        if (s.charAt(s.length() - 1) == 's') {
            System.out.println(s + "es");
        } else {
            System.out.println(s + 's');
        }
    }

    static final class Utils {
        public static void shuffleSort(int[] arr) {
            shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffleSort(long[] arr) {
            shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffle(int[] arr) {
            final Random r = new Random();

            for (int i = 0; i <= arr.length - 2; i++) {
                final int j = i + r.nextInt(arr.length - i);
                swap(arr, i, j);
            }
        }

        public static void shuffle(long[] arr) {
            final Random r = new Random();

            for (int i = 0; i <= arr.length - 2; i++) {
                final int j = i + r.nextInt(arr.length - i);
                swap(arr, i, j);
            }
        }

        public static void swap(int[] arr, int i, int j) {
            final int t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
        }

        public static void swap(long[] arr, int i, int j) {
            final long t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
        }

        private Utils() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        private String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        int[] nextIntArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long[] nextLongArray(int n) {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++) { a[i] = nextLong(); }
            return a;
        }
    }
}


Measured memory_bytes: 36580
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define rep2(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define rrep(i,n) ll i=(n);ll now=-1;while(i--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)
#define vll vector<ll>
#define pb push_back
using namespace std;
using ll = long long;

static inline void ignore_ret(int x) {x++;}
template<class T> inline bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> inline T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> inline T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm(r,v.at(i));return r;}
template<class T> inline T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> inline T nCr(T n,T k){if(n<k||n<0||k<0)return 0;T r=1;k=min(k,n-k);for(T i=n-k+1;i<=n;i++)r*=i;return r/factorial(k);}
template<class T> inline T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> inline T sum(vector<T>v){return reduce(all(v),0LL);}

// Template ends here

void solve(ll N, ll M, vector<ll> A){
    if (sum(A) > N) cout << "-1\n";
    else cout << N - sum(A) << "\n";
}

int main() {
    ll N;
    ignore_ret(scanf("%lld",&N));
    ll M;
    ignore_ret(scanf("%lld",&M));
    vector<ll> A(M);
    for(int i = 0 ; i < M ; i++){
        ignore_ret(scanf("%lld",&A[i]));
    }
    solve(N, M, move(A));
    return 0;
}


Measured memory_bytes: 3848
import java.math.*;
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n= sc.nextInt();
        int list[]=new int[n];
        for (int i = 0; i < n; i++)
            list[i] = sc.nextInt();
        Arrays.sort(list);
        String ans="YES";
        for (int i = 0; i < n - 1; i++) {
            if (list[i] == list[i + 1]) {
                ans = "NO";
                break;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 64996
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#define rep(i, n) for(int i=0; i<n; i++)

using namespace std;

int main(){
  long long K, A, B;
  cin >> K >> A >> B;
  //入力終了

  //操作回数の上限より，円経由交換による操作の方が多い
  if(K < A+1){
    cout << K+1 << endl;
    return 0;
  }
  //円を経由するよりも直接ビスにした方が効率が良い
  if(A+2 >= B){
    cout << K+1 << endl;
    return 0;
  }

  long long ans = 0;
  
  //1回目の操作
  K = K-(A-1);   //初めに1個持っている
  K--;           //Aビスを1円に
  ans += B; K--; //1円をBビスに

  //AビスがBビスに変わるが，A<BよりBビスの一部を使って操作を繰り返せる．
  //よって，操作を繰り返せる回数は，Aビス->1円，1円->Bビスの2回の操作を
  //何回繰り返せるかによる
  long long change_count = K/2;
  
  //AビスをBビスにchange_count回変換できる
  ans = ans+( (B-A)*change_count);    
  
  //残った操作回数はビスを増やす
  ans += K%2;
  
  //解答
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
int main()
{
	int n,m,a,b;
	cin>>n>>m>>a>>b;
	if(n!=a) cout<<1<<endl;
	else cout<<0<<endl;
	return 0;
 } 
 /*

*/

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

using namespace std;

typedef long long int ll;

const ll mod = 1e9 + 7;
const ll MAXN = 2e5 + 5;

vector < ll > fact(MAXN);

ll pwr(ll a, ll b){
  ll res = 1;
  while(b > 0){
    if(b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}

ll inv(ll a){
  return pwr(a, mod - 2);
}

ll comb(ll n, ll r){
  return ((fact[n] * (inv(fact[r]) * inv(fact[n - r])) % mod) % mod);
}

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

  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  for(ll i = k; i <= n + 1; i++){
    ll a = ((i - 1) * i) / 2;
    ll b = ((2 * n - i + 1) * i) / 2;
    ans = (ans + b - a + 1) % mod;
  }
  cout << ans << endl;
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N, K; cin >> N >> K;
    vi l(N); REP(i, N) cin >> l[i];
    sort(ALL(l), greater<>());
    int ans = 0;
    REP(i, K) ans += l[i];
    cout << ans << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    string s;
    cin>>s;
    ll n = sz(s);
    ll x, y;
    cin>>x>>y;

    ll m = 0;
    rep(i, n) {
        if (s[i] == 'T') break;
        x--;
        m++;
    }

    vvl xy(2);
    ll dir = 1;
    ll cur = 0;
    for (int i = m + 1; i < n; ++i) {
        if (s[i] == 'F') {
            cur++;
            continue;
        }
        xy[dir].push_back(cur);
        dir = (dir + 1) % 2;
        cur = 0;
    }
    xy[dir].push_back(cur);

    bitset<40000> dpx, dpy;
    dpx.set(20000);
    rep(i, sz(xy[0])) dpx = (dpx<<xy[0][i]) | (dpx>>xy[0][i]);
    dpy.set(20000);
    rep(i, sz(xy[1])) dpy = (dpy<<xy[1][i]) | (dpy>>xy[1][i]);

    if (dpx[20000 + x] & dpy[20000 + y]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int n,ax=0;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;++i){
    cin>>a[i];
    ax ^= a[i];
  }
  for(int i=0;i<n;++i)cout<<(ax^a[i])<<" ";
  cout<<endl;
}


Measured memory_bytes: 4052
#include<iostream>
#include<string>
#include<map>

using namespace std;

int main(){
  string s, t;
  cin >> s >> t;
  map<char, char> m1, m2;
  bool ans=true;
  for(int i=0;i<s.length();i++){
    if(m1[s[i]]==t[i] || m1[s[i]]=='\0'){
      m1[s[i]] = t[i];
    }
    else{
      ans=false;
      break;
    }
    if(m2[t[i]]==s[i] || m2[t[i]]=='\0'){
      m2[t[i]] = s[i];
    }
    else{
      ans=false;
      break;
    }
  }
  cout << (ans?"Yes":"No") << endl;
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 10000005
#define pb push_back
#define mp make_pair
#define vit vector<int>::iterator
typedef pair<lint,lint> pii;

bool prime[MAX];
int lowFactor[MAX];
void SIEVE(void){  /// 10^6 lowest factors stored ; O(Nlog(log(N)))
    for(int i=1;i<MAX;i++){
        prime[i]=true;
        lowFactor[i]=i;
    }
    prime[1]=false;
    for(int i=2;i*i<MAX;i++){
        if(!prime[i]) continue;
        for(int j=i*i;j<MAX;j+=i){
            prime[j]=false;
            if(lowFactor[j]==j) lowFactor[j]=i;
        }
    }
}

lint getFactorization(int a){ /// O(log(n)); n<10^6/10^7
    lint ans=1;
    while(a>1){
        int pre=lowFactor[a];
        int cong=0;
        while(lowFactor[a]==pre){
            pre=lowFactor[a];
            a/=pre;
            cong++;
        }
        if(cong) ans*=(cong+1);
    }
    return ans;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    SIEVE();
    int n;
    cin>>n;
    lint sm=0;
    for(int i=1;i<=n;i++){
        sm+=i*getFactorization(i);
    }
    cout<<sm;
    return 0;
}



Measured memory_bytes: 52388
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)
#define FORR(i,n,m) for(ll i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K



int main(){
    string s;
    cin >> s;
    ll ans = 700;
    REP(i,3){
        if(s[i]=='o'){
            ans+=100;
        }
    }
    cout << ans << endl;
    }

Measured memory_bytes: 764
#include <bits/stdc++.h>  // ver1.9.4
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a[a.size()-1]<<endl;
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

signed main() {
  cout << fixed << setprecision(8);
  int n;
  cin >> n;
  Vi a(n),b(n);
  rep(i,0,n){
    cin >> a[i] >> b[i];
  }
  int ans = 0;
  reverse(ALL(a));
  reverse(ALL(b));
  int memo;
  
  rep(i,0,n){
    memo = (b[i]-(a[i]+ans)%b[i])%b[i];
    ans += memo;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
program main
Implicit None
integer :: n,x

	read *, n
	
	if (n > 200)then
		x = 100
		n = n-900
		else
		x = 900
		n = n-100
	endif
	
	if(n > 20)then
		x= x + 10
		n = n-90
		else
		x = x + 90
		n = n-10
	endif
	
	if(n > 2)then
		x = x + 1
		else
		x = x + 9
	endif
	
	print 101,x
	
101 format (i0)

end program main

Measured memory_bytes: 768
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
    ll a,b,k;
    cin >>a>>b>>k;
    if(a >=k){
        a-=k;
        k=0LL;
    }else{
        k-=a;
        a=0LL;
    }
    if (b>= k)
    {
        b -= k;
        k = 0LL;
    }
    else
    {
     
        b = 0LL;
    }
    cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
import java.util.*;

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

      if(X.charAt(0) > Y.charAt(0)){
         System.out.println(">");
         }
      else if(X.charAt(0) == Y.charAt(0)){
              System.out.println("=");
              }
      else{
          System.out.println("<");
          }
   }
}


Measured memory_bytes: 23252
N, M = map(int, input().split())
can = [[] for i in range(N + 1)]
for i in range(M):
  a, b = map(int, input().split())
  x = [a, b]
  if (1 in x) or (N in x):
    can[a].append(b)
    can[b].append(a)


for j in range(len(can[1])):
  k = can[1][j]
  if N in can[k]:
    print("POSSIBLE")
    quit()
    
print("IMPOSSIBLE")

Measured memory_bytes: 37688
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
using namespace std;
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
// cout << fixed << setprecision(10);
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
int main(){
    int N; cin >> N;
    double v[55];
    for (int i = 0; i < N; i++){
        cin >> v[i];
    }
    sort(v,v+N);
    for (int i = 1; i < N; i++){
        v[i] = (v[i]+v[i-1])/2.0;
    }
    cout << v[N-1] << endl;
} 

Measured memory_bytes: 256
s=input()
temp_new=""
temp_old=""
cnt=0
for i in range(len(s)):
    if temp_new=="":
        temp_new=s[i]
    elif temp_new==temp_old:
        temp_new+=s[i]
    else:
        temp_old=temp_new
        temp_new=s[i]
        cnt+=1
if temp_new!=temp_old and temp_new!="":
    cnt+=1
print(cnt)

Measured memory_bytes: 3500