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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

ll memo[100001];
vector<vll> edge(100001);

ll dfs(ll x){
  if(memo[x]!=-1)
    return memo[x];

  if(edge[x].size()==0)
    return memo[x]=0;

  ll res = 0;
  for(auto e:edge[x])
    res = max(res,dfs(e)+1);

  return memo[x]=res;
}

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

  ll n,m;
  cin>>n>>m;

  vll x(m),y(m);
  REP(i,m){
    cin>>x[i]>>y[i];
    x[i]--;
    y[i]--;
  }

  REP(i,m)edge[x[i]].push_back(y[i]);
  REP(i,n)memo[i]=-1;


  ll ans=0;
  REP(i,n)ans=max(ans,dfs(i));
  cout << ans << endl;

}


Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed
#define endl '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

struct mint {
  ll x;
  mint() : x(0) {
  }
  mint(ll x) : x((x % MOD + MOD) % MOD) {
  }
  mint& operator+=(const mint& r) {
    if ((x += r.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint& r) {
    if ((x -= r.x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint& operator*=(const mint& r) {
    if ((x *= r.x) > MOD) {
      x %= MOD;
    }
    return *this;
  }
  mint& operator++() {
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint operator++(int) {
    mint ret = x;
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return ret;
  }
  mint& operator--() {
    if ((--x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint operator--(int) {
    mint ret = x;
    if ((--x) < 0) {
      x += MOD;
    }
    return ret;
  }
  mint operator+(const mint& r) {
    mint ret;
    return ret = x + r.x;
  }
  mint operator-(const mint& r) {
    mint ret;
    return ret = x - r.x;
  }
  mint operator*(const mint& r) {
    mint ret;
    return ret = x * r.x;
  }
  mint operator-() {
    return mint() - *this;
  }
  bool operator<(const mint& a) {
    return x < a.x;
  }
  bool operator>(const mint& a) {
    return x > a.x;
  }
  bool operator<=(const mint& a) {
    return x <= a.x;
  }
  bool operator>=(const mint& a) {
    return x >= a.x;
  }
  bool operator==(const mint& a) {
    return x == a.x;
  }
  bool operator!=(const mint& a) {
    return x != a.x;
  }
};
ostream& operator<<(ostream& os, const mint& r) {
  os << r.x;
  return os;
}
ostream& operator>>(ostream& os, const mint& r) {
  os >> r.x;
  return os;
}

ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while(b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

ll combination(ll n, ll r){
  ll num = 1;
  for(int i = 1; i <= r; i++){
      num = num * (n - i + 1) % MOD;
      num = num * modinv(r - i + 1, MOD) % MOD;
  }
  return num;
}

ll permutation(ll n){
  ll num = 1;
  for(int i = 1; i <= n; i++){
      num = num * (n - i + 1) % MOD;
  }
  return num;
}

void solve(istream& cin, ostream& cout) {
  ll n, m;
  cin >> n >> m;
  if (abs(n - m) >= 2) {
    cout << 0 << endl;
    return;
  }
  mint ans = 1;
  ans *= permutation(n);
  ans *= permutation(m);
  if (n == m) ans *= 2;
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


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

signed main() {
	int n;
	char c;
	cin >> c;

	if (c == 'A') cout << 'T' << endl;
	if (c == 'T') cout << 'A' << endl;
	if (c == 'C') cout << 'G' << endl;
	if (c == 'G') cout << 'C' << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

  int N = 3;
  REP(i, (1<<N)){
    int ret = s[0]-'0';
    REP(j, N){
      if((i >> j)&1) ret += s[j+1]-'0';
      else ret -= s[j+1]-'0';
    }

    if(ret == 7){
      cout << s[0];
      REP(j, N){
        if((i >> j)&1) cout << "+";
        else cout << "-";
        cout << s[j+1];
      }
      cout << "=" << 7 << "\n";
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {
	static class Range {
		int start, end;
		boolean type;

		Range(int start, int end, boolean type) {
			this.start = start;
			this.end = end;
			this.type = type;
		}
	}

	int H, W;
	boolean[][] cells;

	int[][] horizons, verticals;

	Main(int H, int W, boolean[][] cells) {
		this.H = H;
		this.W = W;
		this.cells = cells;
		this.horizons = new int[H][W];
		this.verticals = new int[H][W];

		this.setHorizons();
		this.setVerticals();
	}

	void setHorizons() {
		for (int h = 0; h < H; ++h) {
			Deque<Range> queue = new ArrayDeque<>();
			for (int w = 0; w < W; ++w) {
				if (queue.isEmpty()) {
					queue.addLast(new Range(w, w + 1, cells[h][w]));
				} else {
					Range r = queue.getLast();
					if (r.type == cells[h][w]) {
						queue.getLast().end = w + 1;
					} else {
						queue.addLast(new Range(w, w + 1, cells[h][w]));
					}
				}
			}
			Range range = queue.pollFirst();
			for (int w = 0; w < W; ++w) {
				if (range.end == w) {
					range = queue.pollFirst();
				}
				if (range.type) {
					horizons[h][w] = range.end - range.start;
				} else {
					horizons[h][w] = 0;
				}
			}
		}
	}

	void setVerticals() {
		for (int w = 0; w < W; ++w) {
			Deque<Range> queue = new ArrayDeque<>();
			for (int h = 0; h < H; ++h) {
				if (queue.isEmpty()) {
					queue.addLast(new Range(h, h + 1, cells[h][w]));
				} else {
					Range r = queue.getLast();
					if (r.type == cells[h][w]) {
						queue.getLast().end = h + 1;
					} else {
						queue.addLast(new Range(h, h + 1, cells[h][w]));
					}
				}
			}
			Range range = queue.pollFirst();
			for (int h = 0; h < H; ++h) {
				if (range.end == h) {
					range = queue.pollFirst();
				}
				if (range.type) {
					verticals[h][w] = range.end - range.start;
				} else {
					verticals[h][w] = 0;
				}
			}
		}
	}

	int calc() {
		int result = Integer.MIN_VALUE;
		for (int h = 0; h < H; ++h) {
			for (int w = 0; w < W; ++w) {
				result = Math.max(result, horizons[h][w] + verticals[h][w] - 1);
			}
		}
		return result;
	}

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);

		String[] tokens = in.readLine().split(" ");
		int H = Integer.parseInt(tokens[0]);
		int W = Integer.parseInt(tokens[1]);
		boolean[][] cells = new boolean[H][W];
		for (int h = 0; h < H; ++h) {
			String line = in.readLine();
			for (int w = 0; w < W; ++w) {
				if (line.charAt(w) == '.') {
					cells[h][w] = true;
				} else {
					cells[h][w] = false;
				}
			}
		}

		Main ins = new Main(H, W, cells);
		System.out.println(ins.calc());

	}
}

Measured memory_bytes: 127760
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cmath>
#define endl '\n'
using namespace std;
typedef long long ll;
int main()
{
    ll n,a,b;
    cin>>n>>a>>b;
    ll x = floor( (double)n/(a+b) );
    //cout<<x<<endl;
    ll ans = x*a;
    ll y = n%(a+b);
    ans+=min(y,a);
    cout<<ans<<endl;
    return 0;
}


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

int main()
{
	int a;
	int b[4800];
	int c[4800];
	int total1 = 1;
	int total2 = 0;
	int i;

	cin >> a;
	for (i = 0; i < a; i++)
	{
		cin >> b[i];

		if (b[i] >= 1 && b[i] <= 399)
		{
			c[i] = 1;
		}

		else if (b[i] >= 400 && b[i] <= 799)
		{
			c[i] = 2;
		}
		else if (b[i] >= 800 && b[i] <= 1199)
		{
			c[i] = 3;
		}
		else if (b[i] >= 1200 && b[i] <= 1599)
		{
			c[i] = 4;
		}
		else if (b[i] >= 1600 && b[i] <= 1999)
		{
			c[i] = 5;
		}
		else if (b[i] >= 2000 && b[i] <= 2399)
		{
			c[i] = 6;
		}
		else if (b[i] >= 2400 && b[i] <= 2799)
		{
			c[i] = 7;
		}
		else if (b[i] >= 2800 && b[i] <= 3199)
		{
			c[i] = 8;
		}	
		else
		{
			c[i] = 9;
		}
	}

	sort(c, c + a); 



	for (i = 0; i < a-1; i++)
	{
		if (c[i] != 9 && c[i + 1] != 9)
		{
			if (c[i + 1] - c[i] != 0)
			{
				total1++;
			}
		}
		else
		{
			continue;
		}
	}
	
	for (i = 0; i < a; i++)
	{
		if (c[i] == 9)
		{
			total2++;
		}
	}
	
	total2 = total1 + total2;
	
	if (total2 != 6)
	{
		cout << total1 << " " << total2;
	}
	else
	{
		cout << total1 << " " << total2 - 1;
	}
	return 0;

}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(){for(int n;scanf("%d",&n),n;){int m,a=0,l=0,f=0,b=0,c;scanf("%d ",&m);for(;m--;){c=getchar();if(b=='I'&&c=='I')l=f=0;if(b=='O'&&c=='O')l=f=0;if(b=='I'&&c=='O')f=1;if(b=='O'&&c=='I'&&f)if(n<=++l)a++;b=c;}printf("%d\n",a);}return 0;}

Measured memory_bytes: 0
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpll vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

// lld fac[500005]; 

// void getfac(lld p)
// {
//     fac[0] = 1; 
//     for (lld i=1 ; i<=500005; i++) 
//         fac[i] = fac[i-1]*i%p; 
// }    

// long long int nCrmodp(lld n, lld r,lld p) 
// { 
//    // Base case 
//    if (r==0) 
//       return 1; 
     
//     return (fac[n]* modInverse(fac[r], p) % p * 
//             modInverse(fac[n-r], p) % p) % p; 
// }



lld maxSubArraySum(vector<lld> &a, lld size) 
{ 
    lld max_so_far = INT_MIN, max_ending_here = 0; 
  
    for (lld i = 0; i < size; i++) 
    { 
        max_ending_here = max_ending_here + a[i]; 
        if (max_so_far < max_ending_here) 
            max_so_far = max_ending_here; 
  
        if (max_ending_here < 0) 
            max_ending_here = 0; 
    } 
    return max_so_far; 
} 


lld p1=1e9 + 7,p2=998244353;
lld l,r,mid,ans=0;
lld n,i,j,k,g,m;
lld x,y,n1,n2,h,z,c;
lld aa=1;
lld ss=1;

void solve()
{    
    string s;
    cin>>s;
    n=s.size();
    x=0;
    for(i=0;i<n;i++)
    {
        x+=(s[i]-'0');
        x%=9;
    }
    x%=9;
    if(x==0)
    {
        cout<<"Yes";

    }
    else cout<<"No";
}

void fun111(){
    #ifndef ONLINE_JUDGE
    // for getting input from input.
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    
}

int main()
{
    // fun111();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
    // cin>>t;
    // cout<<t;
    lld p1 = 1e9 + 7;
    // getfac(p1);
    //check the value by which modulo is to be taken
    // precompute();
    for(int i=0;i<t;i++)
    {
        // cout<<"Case #"<<i+1<<": ";
        solve();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3780
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String a = s.substring(0,5);
		String b = s.substring(6,13);
		String c = s.substring(14,19);
		System.out.println(a + " " + b + " " + c);
	}
} 

Measured memory_bytes: 23124
#include<stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  for(int i=1;i<=9;i++){
    for(int j=i;j<=9;j++){
      int mult=i*j;
      if(mult==n){
        printf("Yes\n");
        return 0;
      }
    }
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
  
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
  
using namespace std;
  
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
  
int main(){
	//freopen("test.txt", "r", stdin);
	int x, y, z;
	while(cin >> x >> y >> z, x|y|z){
		vector<int> dice(x);
		rep(i, x) cin >> dice[i];
		vector<P> ev(y+1, MP(0,0));
		rep(i, z){
			int n, e, a;
			cin >> n >> e >> a;
			ev[n] = MP(e, a);
		}

		vector<vector<double> > dp(y+1, vector<double>(z*100+1, 0.0));
		dp[0][0] = 1.0;

		for(int i = 0; i < y; i++){
			rep(j, x){
				int next = i+dice[j];
				int money = 0;
				if(next > y) next = y;
				switch(ev[next].first){
				case 1:
					next += ev[next].second;
					break;
				case 2:
					money += ev[next].second;
					break;
				case 3:
					money -= ev[next].second;
					break;
				default:
					break;
				}
				if(next > y) next = y;
				for(int k = 0; k <= min(z*100, z*100-money); k++){
					int m = k+money;
					if(m < 0) m = 0;
					dp[next][m] += dp[i][k]/x;
				}
			}
		}

		//cout << "***";
		double sum = 0;
		rep(i, z*100+1) sum += i*dp[y][i];
		cout << (int)sum << endl;
	}

 
    return 0;
}

Measured memory_bytes: 3180
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
typedef vector <int> VI;
typedef set <int> SI;

int get_digit( int n )
{
	int count = 0;
	while ( n >= 10 )
	{
		n /= 10;
		count++;
	}
	return count + 1;
}

int ten_pow( int n )
{
	int answer = 1;
	for ( int i = 0; i < n; i++ ) answer *= 10;
	return answer;
}

int main( void )
{
	int n, k;
	while ( cin >> n >> k && n && k )
	{
		VI cards(n);
		for ( int i = 0; i < n; i++ ) cin >> cards[i];
		sort( cards.begin(), cards.end() );

		SI h;
		for ( int i = 0; i < 1<<n; i++ )
		{
			int cnt = 0;
			for ( int j = 0; j < n; j++ )
			{
				if ( i & 1 << j ) cnt++;
			}
			if ( cnt != k ) continue;

			VI C;
			for ( int j = 0; j < n; j++ )
			{
				if ( i & 1 << j ) C.push_back( cards[j] );
			}

			do {
				int m = 0;
				for ( VI::iterator it = C.begin(); it != C.end(); it++ )
				{
					if ( m == 0 ) m += *it;
					else
					{
						m *= ten_pow( get_digit( *it ) );
						m += *it;
					}
				}
				h.insert( m );
			} while ( next_permutation( C.begin(), C.end() ) );
		}

		cout << h.size() << endl;

	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  vector<int>a(3);
  
  for(int i=0;i<3;i++){
    cin >> a.at(i);
  }
  
  sort(a.begin(),a.end());
  
  cout <<a.at(0)<<" "<<a.at(1)<<" "<<a.at(2)<<endl;
}


Measured memory_bytes: 3156
import math

n,f = map(int,input().split())
x = list(map(int,input().split()))
x.append(f)
k = min(x)
ans = max(x)-k
for i in range(n+1):
    if math.gcd(ans, x[i]-k) < ans:
        ans = math.gcd(ans, x[i]-k)
print(ans)


Measured memory_bytes: 20316
#include<iostream>
#include<string>
#include<vector>

using namespace std;
int main(){
    int N;
    cin >> N;

    vector<string> s(N);
    for(int i=0; i<N; i++) cin >> s.at(i);

    int count=0, acount=0, bcount=0, abcount=0;
    for(int i=0; i<s.size(); i++){
        if(s.at(i).at(s.at(i).size()-1)=='A'&&s.at(i).at(0)=='B'){
            abcount++;
        }else if(s.at(i).at(s.at(i).size()-1)=='A'){
            
            acount++;
        }else if(s.at(i).at(0)=='B'){
            
            bcount++;
        }

        for(int j=1; j<s.at(i).size(); j++){
            if(s.at(i).at(j)=='B'&&s.at(i).at(j-1)=='A'){
                count++;
            }
        }

    }
    if(abcount>0){
        count += abcount-1;
        count += (acount<bcount&&(acount>0||bcount>0)?acount+1:(acount>0||bcount>0)?bcount+1:0);
    }else{
        count += (acount<bcount?acount:bcount);
    }

    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 896
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main //implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        long mod=1000000007;
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        PriorityQueue<Integer> q=new PriorityQueue<>();
        
        int n=sc.nextInt();
        if(n<3)ret("0");
        n=(n-1)/2;

        out.println(n);
     	out.flush();
    }
    
    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}


class P {
	int x, y, d;
	P(int  x, int y, int d) {
	  this.x=x;
	  this.y=y;
	  this.d=d;
	}
}

//class P implements Comparable<P>{
//    int a,b;
//    P(int a, int b) {
//    	this.b=b;
//    	this.a=a;
//    }
//
//    public int compareTo(P p){
//        return p.a-a;//des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() throws IOException{
        return this.nextString().toCharArray();
    }    
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 23124
import java.io.*;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int X = fs.nextInt();
        int N = fs.nextInt();

        Set<Integer> s = new HashSet<>();

        for (int i = 0; i < N; ++i) {
            s.add(fs.nextInt());
        }


        int res = -1;
        int min = Integer.MAX_VALUE;
        for (int j = X - 102; j <= X + 102; ++j) {
            if (s.contains(j)) {
                continue;
            }
            else {
                if (Math.abs(X - j) < min) {
                    min = Math.min(min, Math.abs(X - j));
                    res = j;
                }
            }
        }

        System.out.println(res);
   }
}


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

int main() {
  int n;cin>>n;
  int ans=1e9;
  for(int i=1;i<n;i++){
    int a=i,b=n-i,cnt=0;
    while(a>0){
      cnt+=a%10;
      a/=10;
    }
    while(b>0){
      cnt+=b%10;
      b/=10;
    }
    ans=min(ans,cnt);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3644
S = input()

if S[0] == S[1] and S[2] == S[3] and S[0] != S[2] or S[0] == S[2] and S[1] == S[3] and S[0] != S[1] or S[0] == S[3] and S[1] == S[2] and S[0] != S[2]:
    result = "Yes"
else:
    result = "No"
print(result)


Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
using P = std::pair<ll, int>;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);

#define l_ength size

ll MOD;

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll memo[3030][3030],dp[3030][3030];
bool done[3030][3030];

ll rwpw(ll a, ll p, ll m = MOD){
	ll ret = 1ll;
	while(p){
		if(p%2){
			ret *= a; ret %= m;
		}
		a *= a; a %= m;
		p /= 2;
	}
	return ret;
}

ll ramen(int a){
	return rwpw(2ll,rwpw(2ll,a,MOD-1));
}

ll c(int n, int k){
	if(done[n][k]){
		return memo[n][k];
	}
	done[n][k] = true;
	if(k==n || k==0){
		return memo[n][k] = 1ll;
	}
	memo[n][k] = c(n-1,k-1);
	add_mod(memo[n][k],c(n-1,k));
	return memo[n][k];
}

int main(void){
	int n,i,j;
	ll tmp,ans=0ll;
	std::cin >> n >> MOD;
	dp[0][0] = 1ll;
	for(i=0; i<n; ++i){
		for(j=0; j<=n; ++j){
			add_mod(dp[i+1][j],dp[i][j]);
			add_mod(dp[i+1][j+1],dp[i][j]);
			add_mod(dp[i+1][j],dp[i][j]*j%MOD);
		}
	}
	for(i=0; i<=n; ++i){
		for(j=0; j<=n; ++j){
			mul_mod(dp[i][j],rwpw(rwpw(2ll,n-i),j));
		}
		for(j=0; j<n; ++j){
			add_mod(dp[i][j+1],dp[i][j]);
		}
	}
	for(i=0; i<=n; ++i){
		tmp = dp[i][n];
		mul_mod(tmp,ramen(n-i));
		mul_mod(tmp,c(n,i));
		// std::cout << tmp << std::endl;
		add_mod(ans,((i%2)?(MOD-tmp):tmp));
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 129820
#include<stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  float sum =0;
  for(int i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    sum += 1.0/a;
  }
  printf("%lf",1/sum);
  
  return 0;
}

Measured memory_bytes: 128
import sys

def tami(i,j,k):
  if (i == j == k == 0):
    return 0
  else:
    res = N
    if (i > 0):
      res += dp[i-1][j][k] * i
    if (j > 0):
      res += dp[i+1][j-1][k] * j
    if (k > 0):
      res += dp[i][j+1][k-1] * k
    res *= divTable[i + j + k]
    dp[i][j][k] = res
    return res
  
N = int(input())
a = list(map(float,input().split()))

one = a.count(1)
two = a.count(2)
three = a.count(3)

num = max(one,two,three)

dp = [[[-1]*(N+1) for i in range(N+1)] for i in range(N+1)]

divTable = [1]
for i in range(1, 10000):
  divTable.append(1.0 / i)

for k in range(0, N + 1):
  for j in range(0, N - k + 1):
    for i in range(0, N - k - j + 1):
      tami(i, j, k)

print(dp[one][two][three]+1)


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

int main()
{
ll n , k , c ;
cin >> n >> k >> c ;
string s ;
cin >> s ;
vector<ll> v(n,0);
vector<ll> vv(n,0);
ll l=-100000000;
ll cnt=1;
rep(i,n){
  if(i-l<=c)continue;
  if(s[i]=='o'){
    l=i;
    v[i]=cnt;
    cnt++;
  }
}
l=-100000000;
cnt=k;
rep(i,n){
  if(i-l<=c)continue;
  if(s[n-1-i]=='o'){
    l=i;
    vv[n-1-i]=cnt;
    cnt--;
  }
}
rep(i,n){
  if(v[i]!=0&&v[i]==vv[i])cout << i+1 << endl;
}
return 0;
}

Measured memory_bytes: 4996
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	ll x,k,d;cin>>x>>k>>d;
	ll p = abs(x)/d;
	ll q = p+1;
	ll ans=0;
	if(p>k){
		ans = abs(x) - k*d;
	}
	else{
		if((k-p)%2==0){
			ans = abs(x) - p*d;
		}
		else{
			ans = q*d - abs(x);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3620
#pragma warning(disable:4996)
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM T> inline istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { for (auto &_e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

int ans = 0;
int N;

bool check(const string& s) {
	int x = stoi(s);
	if (x > N)return false;
	int cnt[3] = { 0 };
	REP(i, s.size()) {
		if (s[i] == '7')++cnt[0];
		if (s[i] == '5')++cnt[1];
		if (s[i] == '3')++cnt[2];
	}
	return (cnt[0] > 0) && (cnt[1] > 0) && (cnt[2] > 0);
}

void rec(const string& s) {
	if (check(s))++ans;
	if (s.size() != 9) {
		rec(s + '7');
		rec(s + '5');
		rec(s + '3');
	}
}

int main(void) {
	cin >> N;
	rec("7");
	rec("5");
	rec("3");
	cout << ans << endl;
	return 0;
}

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

int main()
{
	int D,N;
	cin >> D >> N;
	int ans;
	if (N != 100)
	{
		ans = N;
		rep(i,D)
		{
			ans *= 100;
		}
		cout << ans << endl;
		return 0;
	}
	else
	{
		ans = 101;
		rep(i,D)
		{
			ans *= 100;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val n = sc.nextInt
  val p = Array.fill(n)(sc.nextInt).mkString
  val q = Array.fill(n)(sc.nextInt).mkString
  val listAndIndex = (1 to n).permutations.map(_.mkString).toList.sorted.zipWithIndex

  val a = listAndIndex.filter(l => l._1 == p).map(_._2).head
  val b = listAndIndex.filter(l => l._1 == q).map(_._2).head
  println(Math.abs(a - b))
}


Measured memory_bytes: 51472
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n; i>0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define FORR(i, m, n) for(int i=m; i>=n; i--)
#define INF 1999999999
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;
typedef long long ll;

#ifdef INPUT
stringstream input(R"(
BWBWBW
)");
#define cin input
#endif

int main()
{
    string s;
    cin >> s;
    ll sum=0;
    int w=0;
    
    for(int i=0; i<s.size(); i++)
    {
        if(s[i]=='W')
        {
            sum += i-w;
            w++;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<utility>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
int n;
struct UnionFind{
    vector<int> par;
    UnionFind(int n) : par(n){
      for(int i=0;i<n;i++) par[i]=i;
    }
    int root(int x){
      if(par[x]==x) return x;
      return par[x]=root(par[x]);
    }

    void unite(int x,int y){
      int rx=root(x);
      int ry=root(y);
      if(rx==ry) return;
      par[rx]=ry;
    }
    bool same(int x, int y){
      int rx=root(x);
      int ry=root(y);
      if(rx==ry) return 1;
      return 0;
    }
  };
bool compare_by_second(pair<int, int> a,pair<int, int> b){
  if(a.second != b.second){
   return a.second < b.second;
  }
  else{
    return a.first < b.first;
  }
}
int binary_search2(vector<int> &l,int key){
  int left=0;
  int right=l.size()-1;
  int mid;
  if(l[right]<key)return right;
  else{
  while(right-left>1){
    mid=(right+left)/2;
    if(l[mid]>=key)right=mid;
  else left=mid;
  }
  }
  if(key==l[left])right=left;
return right;
}
void swap(vector<int>& a,int i,int j){
  int tmp=a[i];
  a[i]=a[j];
  a[j]=tmp;
}
bool judge(vector<int> a,vector<pair<int,int>> array){
  bool k=false;
  bool tag=false;
  rep(i,n){
    int buf=binary_search2(a,array[i].first);
    swap(a,i,buf);
    if(a[i]<array[i].second&&a[buf]<array[buf].second){
      return true;
    }
    else swap(a,i,buf);
  }
  return k;
}
int main(){
  cin>>n;
  vector<pair<int,int>> array(n);
  vector<int> a(n);
  vector<int> memo(n,0);
  rep(i,n)cin>>array[i].first;
  rep(i,n)cin>>array[i].second;
  //  rep(i,n)cout<<array[i].first<<endl;
  sort(array.begin(),array.end(),compare_by_second);
  rep(i,n)a[i]=array[i].first;
  sort(a.begin(),a.end());
  /*  rep(i,n)cout<<array[i].first<<" ";
  cout<<endl;
  rep(i,n)cout<<array[i].second<<" ";
  cout<<endl;*/
  int flag=0;
  int ko=0;
  UnionFind tree(n);
  rep(i,n){
    if(array[i].first>array[i].second)ko++;
   }
  if(ko==0){
    cout<<"Yes"<<endl;
    return 0;
  }
  rep(i,n){
    if(a[i]>array[i].second)flag++;
    int buf=binary_search2(a,array[i].first);
    while(memo[buf]!=0){
      buf++;
    }
    tree.unite(i,buf);
    memo[buf]++;
  }
  if(flag==0){
    rep(i,n){
      //      cout<<tree.same(0,i)<<" "<<a[i]<<endl;
      if(tree.same(0,i)==1);
      else flag++;
    }
    if(flag!=0){
      cout<<"Yes"<<endl;
    }
    else if(judge(a,array))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+10;
int a[N],n;
inline int check(int x){
	int ret=0;
	for (int i=1;i<=n;++i)
		ret+=abs(a[i]-x);
	return ret;
}
signed main(){
	int x;
	cin>>n;
	for (int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		a[i]-=i;
	}
	int l=-2e9,r=2e9;
	for (;l+10<r;){
		int mid1=(l*2+r)/3,mid2=(l+r*2)/3;
		if (check(mid1)>check(mid2)) l=mid1;
		else r=mid2;
	}
	int ans=1e18;
	for (int i=l;i<=r;++i) ans=min(ans,check(i));
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

struct UnionFind{
    
    vector<int> par;
    
    UnionFind(int N) : par(N){
        for(int i = 0; i<N; i++) par.at(i) = i;
    }
    
    int root(int x){
        if(x == par.at(x)) return x;
        return par.at(x) = root(par.at(x)); //圧縮
    }
    
    void unite(int x, int y){
        int rx = root(x); //ここで圧縮をしている?
        int ry = root(y); //ここでも
        if(rx == ry) return;
        par.at(ry) = rx;
    }
    
    bool same(int x, int y){
        if(root(x) == root(y)) return true;
        return false;
    }
};

int main(){
    int N,M,K;
    cin >> N >> M >> K;
    
    UnionFind friends(N);
    
    vector<int> frn(N, 1);
    int tmpa,tmpb;
    for(int i = 0; i < M; i++){
        cin >> tmpa >> tmpb;
        frn.at(tmpa-1)++;
        frn.at(tmpb-1)++;
        friends.unite(tmpa-1 , tmpb-1);
    }
    
    vector<int> size(N,0);
    for(int i = 0; i < N; i++){
        size.at(friends.root(i))++;
    }
    
    vector<int> blocked(N,0);
    int tmpc,tmpd;
    for(int i = 0; i < K; i++){
        cin >> tmpc >> tmpd;
        if(friends.same(tmpc-1, tmpd-1)){
            blocked.at(tmpc-1)++;
            blocked.at(tmpd-1)++;
        }
    }
    
    int tmpans;
    for(int i = 0; i < N; i++){
        tmpans = size.at(friends.par.at(i)) - frn.at(i) - blocked.at(i);
        printf("%d ", tmpans);
    }
    
    
}

Measured memory_bytes: 2816
from math import sqrt
def isPrime(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    i, xx = 3, int(sqrt(x))
    while i <= xx:
        if x % i == 0:
            return False
        i = i + 2
    return True

N = int(input())
print(sum([1 for _ in range(N) if isPrime(int(input()))]))

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

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    if(a > b || (a < b && n == 1)){
        cout << 0 << endl;
    }else if(a == b || (a < b && n == 2)){
        cout << 1 << endl;
    }else if(a < b && n >= 2){
        //n = 1000000000,a=1,b=1000000000;
        cout << (n-1)*b+a-(n-1)*a-b+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/dp/tasks/dp_h
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
#define MOD 1000000007  //1e9 + 7
vector<vector<int>> mat, cache;

int dp (int x, int y) {
    if (!x or !y)
        return 0;
    if (!mat[x][y])
        return 0;
    int &ans = cache[x][y];
    if (ans != -1)
        return ans;
    ans = (dp(x-1, y) + dp(x, y-1)) % MOD;
    return ans;
}

int32_t main() {
    IOS;
    int i, h, w;
    cin >> h >> w;
    mat.resize(h+1, vector<int>(w+1));
    cache.resize(h+1, vector<int>(w+1, -1));
    cache[1][1] = 1;
    for(i = 1; i <= h; i++) {
        for(int j = 1; j <= w; j++) {
            char c;
            cin >> c;
            mat[i][j] = c == '.'? 1: 0;
        }
    }
    cout << dp(h, w);
    return 0;
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
using namespace std;
multiset<int> S;
int a[1<<18|3],t;
int main(){
//	freopen("1.in","r",stdin);
	int n,n1,s=1,x;scanf("%d",&n),n1=1<<n;
	for(int i=1;i<=n1;i++)scanf("%d",&x),S.insert(x);
	auto X=S.end();X--;
	a[t++]=(*X),S.erase(X);
	for(int i=0;i<n;i++){
		for(int i=t-1,j=a[i];~i;i--,j=a[i]){
			auto k=S.lower_bound(j);
			if (k==S.begin()){puts("No");return 0;}
			k--;a[t++]=*k,S.erase(k); 
		}
		s*=2;
	}
	puts("Yes");
	return 0;
} 


Measured memory_bytes: 13568
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define mp make_pair
#define st first
#define nd second

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr double f = 3.14159265358979323846;  /* pi */
constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

// End of template code!
int main() 
{
    double a, b, h, m;
    cin >> a >> b >> h >> m; 
    double ang_h = h * 30 + (m / 60.) * 30;
    double ang_m = m * 6;
    double ang_c = fabs(ang_h - ang_m);
    ang_c = min(ang_c, 360 - ang_c);
    ang_c *= f;
    ang_c /= 180.0;
    double c_sqr = (a*a + b*b - 2.*a*b*cos(ang_c));
    printf("%.20lf\n", sqrt(c_sqr)); 
    return 0;
}



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

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

    bool ans = false;
    if (s[2] == s[3] && s[4] == s[5]) ans = true;
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[N];
        int sum = 0;
        for(int i=0; i<N; i++) {
            A[i] = sc.nextInt();
            sum += A[i];
        }
        float check = (float)sum / (4 * M);
        int count = 0;

        for(int i=0; i < N; i++) {
            
            if(A[i] >= check) count++;
        }

        if(count >= M) System.out.println("Yes");
        else System.out.println("No");       
    }
}

Measured memory_bytes: 22740
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>
#include <cassert>
using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    ll n;
    cin >> n;
    cout << (n-1)*n/2 << endl;


    return 0;
}

Measured memory_bytes: 256
//あまりにできないのでwebで拾っただいたい同じプログラムが本当に間に合うのか調べる
#include <iostream>
#include <vector>
#include <set>


using namespace std;

typedef long long int ll;

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


int main()
{
	int n;
	cin>>n;
	vector<ll> p(n),pos(n+1,0);
	rep(i,n){
		cin>>p[i];
		pos[p[i]] = i+1;
	}
	ll ans = 0;

	multiset<ll> s;
	s.insert(0);
	s.insert(0);
	s.insert(n+1);
	s.insert(n+1);
	for (ll now = n; now >= 1; now--){
		auto it = s.lower_bound(pos[now]);
		ll pos_r = *it;

		it++;
		ll pos_rr = *it;

		it--;
		it--;
		ll pos_l = *it;

		it--;
		ll pos_ll = *it;

		ans += now*(pos_r-pos[now])*(pos_l-pos_ll);
		ans += now*(pos_rr-pos_r)*(pos[now]-pos_l);

		s.insert(pos[now]);
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define VPII vector<pair<int,int> >
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<58;
const double eps = 1e-13;

LL rs[100009];
LL a[100009];
LL l[100009],r[100009];//make it 1 indexed!

int main(){
	DRII(n,k);
	REP(i,n){
		scanf("%lld",&a[i]);
		rs[i+1]=rs[i]+a[i];
	}
	REPP(i,1,n+1){
		l[i]=l[i-1]+max(a[i-1],0LL);
	}
	for(int i=n;i>=1;i--){
		r[i]=r[i+1]+max(a[i-1],0LL);
	}
	LL ans=0;
	REPP(i,1,n+1){//left start
		if(i+k-1>n)break;
		ans=max(ans,l[i-1]+max(rs[i+k-1]-rs[i-1],0LL)+r[i+k]);
	}
	printf("%lld",ans);
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
 
// cout<<fixed<<setprecision(10);
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;}

const int INF = 1e9;
int NM = 100100;
int main() {
    int n; cin >> n;
    vector<int> paylist;
    for(int p6=1; p6<=n; p6 *= 6){
        paylist.push_back(p6);
    }
    for(int p9=9; p9<=n; p9 *= 9) {
        paylist.push_back(p9);
    }
    int dp[NM];
    rep(i, NM) dp[i] = INF;
    dp[0] = 0;
    for(int i=0; i<n; i++) {
        if(dp[i] == INF) {
            continue;
        }
        for(auto j : paylist) {
            if(i+j <= NM)
                chmin(dp[i+j], dp[i] + 1);
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

bool flag[100010];
int dp[100010];

struct edge{
    int to;
};

vector<edge>g[100010];

int rec(int x){
    if(flag[x])return dp[x];
    flag[x]=true;
    int fans=0;
    for(int i=0;i<(int)g[x].size();i++){
        int next=g[x][i].to;
        fans=max(fans,rec(next)+1);
    }
    return dp[x]=fans;
}

int main(void){
    int n,m,a,b;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        g[a].push_back({b});
    }
    int ans=0;
    for(int i=1;i<=n;i++)ans=max(ans,rec(i));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 8960
#include<iostream>
using namespace std;
int a[100];
int main(){
string s;
cin>>s;
for(int i=0;i<s.size();i++){
    int g=s[i]-'a';
   a[g]++;
}
for(long i=0;i<=25;i++){
    if(a[i]%2!=0){cout<<"No"<<endl;return 0;}
}
cout<<"Yes"<<endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} 


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,m;
    cin >> n >> m;

    // lpair pairs[n];
    vector<pair<ll, ll> > pairs(n);
    rep(i,n) {
        ll a,b;
        cin >> a >> b;
        pairs[i] = make_pair(a, b);
    }

    sort(pairs.begin(), pairs.end());
    ll cnt = m;
    ll money = 0;
    rep(i,n) {
        // cout << i << " " << pairs[i].first << " " << pairs[i].second << endl;
        if (cnt >= pairs[i].second) {
            cnt -= pairs[i].second;
            money += pairs[i].first * pairs[i].second;
        }
        else
        {
            money += pairs[i].first * cnt;
            cnt = 0;
            break;
        }
    }
    cout << money << endl;

}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (ll)1e9 //10^9:∞
#define LLINF (ll)1e12
#define MOD (ll)(1e9+7) //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)
#define endl "\n"

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	int N;
	cin >> N;
	vector<pair<int, int>> v(N);

	REP(i, N) {
		cin >> v[i].F >> v[i].S;
	}
	bool ok = false;

	FOR(i, 0,N-3) {
		if (v[i].F == v[i].S &&  v[i + 1].F == v[i + 1].S && v[i + 2].F == v[i + 2].S)ok = true;
	}

	YesNo(ok)









	return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
#include<algorithm>
using namespace std;
int b[1100000];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++)scanf("%d",b+i);
		std::sort(b,b+a);
		int len=0;
		bool yet=true;
		for(int i=0;i<a;i++){
			if(i==0||b[i]!=b[i-1])len=1;
			else len++;
			if(len*2>a){
				printf("%d\n",b[i]);
				yet=false;
				break;
			}
		}
		if(yet)printf("NO COLOR\n");
	}
}

Measured memory_bytes: 5144