akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
const ll mod = 1e9+7;
const ll INF = 1e18;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using Graph = vector<vector<ll>>;
using V = vector<ll>;
using P = pair<ll,ll>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll n;
  cin >> n;
  ll cnt = 0;
  rep(i,n) {
    ll a, b;
    cin >> a >> b;
    if (a == b) ++cnt;
    else cnt = 0;
    if (cnt >= 3) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No" << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

Measured memory_bytes: 3656
//NEVER LOSE HOPE 
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#include <bits/stdc++.h>
#define int long long int
#define vi vector<int>
#define pi pair<int,int>
#define si set<int>
#define mi map<int,int>
#define ff first
#define ss second
#define pb push_back
#define all(v) v.begin(),v.end()
#define gi greater<int>()
#define mp make_pair
#define endl "\n"

//to count no of digits //floor(log10(n) + 1)

#define lb lower_bound //a,a+n,4 -a==index of 4  // returns pointer to the "first position of num" if number is present in the container. Returns pointer to the "position of next higher number greater than num" if num is not present.   
#define ub upper_bound // returns pointer to the "first position of the next higher number than last occurence of num" if num is present in the container. Returns pointer to the position of next higher number than num if container does not contain occurence of num.
#define REP(i,n) for(int i=0;i<n;i++)
#define REPE(i,n) for(int i=n-1;i>=0;i--)
#define REPA(i,a,n) for(int i=a;i<=n;i++)
 
//next_permutation(s.begin(),s.end())
//*max_element(a,a+n)
#define mod 1000000007
int N=INT_MAX;
using namespace std;

bool isPrime(int n)
{if(n==1)return false;
for(int i=2;i*i<=n;i++)
{if(n%i==0)return false;}
return true;
} 

int gcd(int a,int b)
{
    if(b==0)return a;
    return gcd(b,a%b);
    //cout<<__gcd(a,b)<<" "<<boost::math::lcm(a,b)<<endl;
}
int lcm(int a,int b)
{
    return a/gcd(a,b)*b;
 
}
//  vi v;
// void SE(int n) {
//    v.clear();
//     bool prime[n+1]; 
//     memset(prime, true, sizeof(prime)); 
  
//     for (int p=2; p*p<=n; p++) 
//     { 
//         if (prime[p] == true) 
//         { 
//             for (int i=p*p; i<=n; i += p) 
//                 prime[i] = false; 
//         } 
//     }

//     for (int p=2; p<=n; p++) 
//        if (prime[p]) 
//           v.pb(p);
  
//     }

  
 //JAI SHREE RAM  //JAI SHREE RAM //JAI SHREE RAM  //JAI SHREE RAM
///////////////// MAIN FUNCTION ////////////////////////

 void CSK()
 {
   int a,b,c;
   cin>>a>>b>>c;
   double r=a;
   double x=(r)/c;
   //cout<<x<<endl;
   if(b>=x){
    cout<<"Yes"<<endl;
   }
   else{
    cout<<"No"<<endl;
   }
  


  

   

    







    


    
 




   








   



    




  




    

















}
///////////////////////// END //////////////////////////////////////  
  
 

 
 
 
int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif 
    fastio;
    cout<<fixed;
    cout.precision(10);
    int __TESTCASES=1;
    //cin>>__TESTCASES;
    while(__TESTCASES--){
    CSK();  
}
 
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

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

	bool b = (s[2] == s[3] && s[4] == s[5]);
	cout << (b ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100
#define INF 2147483647
#define NIL -1

int n, d[N], color[N], pi[N], w[N][N];

void initializeSingleSource(int s){
  int v;
  for(v = 0; v < n; v++){
    d[v] = INF;
    color[v] = 0;
  }
  d[s] = 0;
  color[s] = 1;
}

void dijkstra(int s){
  int mincost, u, v, i;
  initializeSingleSource(s);
  while(1){
    mincost = INF;
    for(i = 0; i < n; i++){
      if(color[i] != 2 && d[i] < mincost){
	mincost = d[i];
	u = i;
      }
    }
    if(mincost == INF) break;
    color[u] = 2;
    for(v = 0; v < n; v++){
      if(color[v] != 2 && d[u] + w[u][v] < d[v] && w[u][v] != INF){
	color[v] = 1;
	d[v] = d[u] + w[u][v];
      }
    }
  }
}

int main(){
  int i, j, u, k, c, v;
  int s = 0;

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      w[i][j] = INF;
    }
  }

  for(i = 0; i < n; i++){
    scanf("%d%d", &u, &k);
    for(j = 0; j < k; j++){
      scanf("%d%d", &v, &c);
      w[u][v] = c;
    }
  }

  dijkstra(s);
  for(i = 0; i < n; i++){
    printf("%d ", i);
    if(d[i] == INF){
      printf("-1\n");
    }else{
      printf("%d\n", d[i]);
    }
  }

  return 0;
}



Measured memory_bytes: 2084
#include <bits/stdc++.h>
#define ll long long int
#define pb(x) push_back(x)
#define TEST(t) int inox,t;cin>>t; for(inox=1;inox<=t;inox++)
using namespace std;

int main(){
	ll t,n,s=0;
	cin>>n>>t;
	ll a[n],i;
	for(i=0;i<n;i++){cin>>a[i];}
		sort(a,a+n);
	for(i=0;i<=n-t-1;i++)s+=a[i];
		cout<<s;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
typedef map<int,int> mapi;

int main() {
	int n,m[100],a[100],b[100];
	while(cin >> n && n!=0){
		mapi z;
		vector<int> v;
		int longs[200]={};
		for(int i=0;i<n;i++){
			cin >> m[i] >> a[i] >> b[i];
			v.push_back(a[i]);
			v.push_back(b[i]);
		}
		sort(v.begin(),v.end());
		
		for(int i=0;i<v.size();i++)
			if(i==0 || v[i]!=v[i-1])
				z.insert(mapi::value_type(v[i],i));
		int add[200]={},sum=0;
		for(int i=0;i<n;i++){
			add[z[a[i]]]+=m[i];
			add[z[b[i]]]-=m[i];
		}
		bool ans=true;
		for(int i=0;i<200;i++){
			sum+=add[i];
			if(sum>150)
			ans=false;
		}
		if(ans)
		cout << "OK" << endl;
		else
		cout << "NG" << endl;
	}
	// your code goes here
	return 0;
}

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

using namespace std;

#define int long long
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;

typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

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

    int E, Y;
    cin >> E >> Y;
    if(E == 0) {
    	if(1868 <= Y && Y <= 1911) cout << "M" << Y - 1867;
    	if(1912 <= Y && Y <= 1925) cout << "T" << Y - 1911;
    	if(1926 <= Y && Y <= 1988) cout << "S" << Y - 1925;
    	if(1989 <= Y && Y <= 2016) cout << "H" << Y - 1988;
    }
    if(E == 1) cout << Y + 1867;
    if(E == 2) cout << Y + 1911;
    if(E == 3) cout << Y + 1925;
    if(E == 4) cout << Y + 1988;
    cout << "\n";
   	return 0;
}



Measured memory_bytes: 3208
void solve();

int main() {
	solve();
	return 0;
}

//////////////////////////////////////////////////
//////////////////////////////////////////////////
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <boost/multiprecision/cpp_int.hpp>
#include <limits.h>

using namespace std;
using namespace boost::multiprecision;

void solve() {
	int K, N;
	cin >> N >> K;
	cout << N - K + 1 << endl;
	return;
}

Measured memory_bytes: 256
import itertools

N,M,Q=map(int,input().split())
List = []

for i in range(Q):
  a = list(map(int,input().split()))
  List.append(a)
  
ans = 0

for team in itertools.combinations_with_replacement(range(1,M+1), N):
  cnt = 0
  for i in range(Q):
    a = List[i][0]
    b = List[i][1]
    c = List[i][2]
    d = List[i][3]
    
    if team[b-1] - team[a-1] == c:
      cnt += d
  ans = max(ans ,cnt)  
  
print(ans)

Measured memory_bytes: 9224
#include<bits/stdc++.h>
#define f first
#define s second
#define endl "\n"
#define M 1000000007
#define pb push_back
#define pf push_front
#define eb emplace_back
#define MM_PI 3.14159265358979323846
#define TEST_CASE int t;cin>>t;while(t--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
template<typename T> T pow(T a, T b, long long m) {T ans = 1; while (b > 0) { if (b % 2 == 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans % m; }
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
const int maxn = 1e5 + 10;

void solve() {
	ll n, k;
	cin >> n >> k;
	ll w[n + 10], val[n + 10];
	for (int i = 0; i < n; i++) {
		cin >> w[i] >> val[i];
	}
	ll dp[n + 1][k + 1];
	for (int i = 0; i <= n; i++) {
		dp[i][0] = 0;
	}
	for (int i = 0; i <= k; i++) {
		dp[0][i] = 0;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= k; j++) {
			if (w[i - 1] <= j) {
				dp[i][j] = max(val[i - 1] + dp[i - 1][j - w[i - 1]], dp[i - 1][j]);
			}
			else {
				dp[i][j] = dp[i - 1][j];
			}
		}
	}
	cout << dp[n][k] << endl;

}
int main() {


	//IOS
	//make();
	//TEST_CASE
	solve();
	return 0;
}



Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
int main() {
  int N;
  cin>>N;
  vector<int>T(N);
  int sum=0;
  for(int i=0;i<N;i++){
    cin>>T[i];
    sum+=T[i];
  }
  int M;
  cin>>M;
  vector<int>P(M),X(M);
  for(int i=0;i<M;i++){
    cin>>P[i]>>X[i];
  }
  for(int i=0;i<M;i++){
    int tot=sum;
    tot-=T[P[i]-1];
    tot+=X[i];
    cout<<tot<<endl;
  }
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include<stdio.h>
using namespace std;
int main(){
	int n,t,www;
	cin>>n;
	int ddd[n];
	www=n;
	while(1){
		cin>>t;
		ddd[n]=t;
			n--;
			if(n==0){
				break;
			}
	}
	while(1){
		n++;
		printf("%d", ddd[n]);
		if(n==www){
			break;
		}
		printf(" ");
	}
cout<<endl;

	return 0;
}



Measured memory_bytes: 3204
import bisect
import sys
input = sys.stdin.readline

A, B, Q = map(int, input().split())
Shrine = [int(input()) for _ in range(A)]
Temple = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]
Shrine = [-100000000000] + Shrine + [100000000000]
Temple = [-100000000000] + Temple + [100000000000]

for x in X:
    nums = bisect.bisect_left(Shrine, x)
    tems = bisect.bisect_left(Temple, x)
    ans1 = max(abs(Shrine[nums]-x), abs(Temple[tems]-x))
    ans2 = max(abs(x - Shrine[nums-1]), abs(x - Temple[tems-1]))
    ans3 = abs(Shrine[nums]-x) * 2 + abs(x - Temple[tems-1])
    ans4 = abs(Temple[tems]-x) * 2 + abs(x - Shrine[nums-1])
    ans5 = abs(x - Shrine[nums-1]) * 2 + abs(Temple[tems]-x)
    ans6 = abs(x - Temple[tems-1]) * 2 + abs(Shrine[nums]-x)

    print(min(ans1, ans2, ans3, ans4, ans5, ans6))

Measured memory_bytes: 122332
/*I wanna be the very best, like no one ever was...*/

#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define ll long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);
 

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



int main() {
    io;
    // freopen("in","r",stdin); 
    // freopen("out","w",stdout);
  

 
    ld a,b,c;
    cin>>a>>b>>c;
    ld lhs = a + b + (2*sqrt(a*b));
    if(lhs<c){
        cout<<"Yes";
        return 0;
    }
    cout<<"No";
    

 
    
 
    return 0;
}

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

const int mxn = 3e5+7;
ll n,k;
vector<ll> a(mxn);

ll check(ll mid){
	ll cuts=0;
	for(int i=0;i<n;i++){
		cuts += (mid+a[i]-1)/mid;
		cuts--;
	}
	return cuts;
}

int main(){
	cin>>n>>k;
	ll lo=1,hi=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		hi = max(hi,a[i]);
	}
	ll ans = -1;
	while(lo<=hi){
		ll mid = lo + (hi-lo)/2;
		if(check(mid)<=k){
			ans = mid;
			hi = mid-1;
		}
		else lo = mid+1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5476
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		String result = "No";
		for(int i = 0; i <= x; i++) {
			for(int j = 0; j <= x - i; j++) {
				if(i + j == x && i * 4 + j * 2 == y) result = "Yes";
			}
		}
		System.out.println(result);
	}

}


Measured memory_bytes: 35748
#include<stdio.h>
int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if (a<b){
        if (c<a){
		printf("%d %d %d\n",c,a,b);
	} else if (b<c){
		printf("%d %d %d\n",a,b,c);
	} else {
		printf("%d %d %d\n",a,c,b);
	}
    } else {
        if (c<b){
		printf("%d %d %d\n",c,b,a);
	} else if (a<c){
		printf("%d %d %d\n",b,a,c);
	} else {
		printf("%d %d %d\n",b,c,a);
	}
    }
    return 0;
}


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

std::vector<int> *adjacent_vertexes;
char *s;
int n, *max_length, *cnt;
long long ans;

void pre_dfs(int u, int parent) {
	max_length[u] = 0;
	cnt[u] = (s[u] == '1');
	for (int v: adjacent_vertexes[u]) {
		if(v != parent) {
			pre_dfs(v, u);
			max_length[u] = std::max(max_length[v] + 1, max_length[u]);
			cnt[u] += cnt[v];
		}
	}
	return;
}

void dfs(int u, int parent, int max_length_from_parent) {
	int first_max = 0, second_max = 0, first_max_rem;
	if(~parent) {
		first_max = max_length_from_parent;
		first_max_rem = parent;
	}
	for (int v: adjacent_vertexes[u]) {
		if(v != parent) {
			int tmp = max_length[v] + 1;
			if(tmp > first_max) {
				second_max = first_max;
				first_max = tmp;
				first_max_rem = v;
			}
			else if(tmp > second_max) {
				second_max = tmp;
			}
		}
	}
	int low_bound = n + 1;
	if(cnt[u] != cnt[0]) {
		low_bound = max_length_from_parent;
	}
	for (int v: adjacent_vertexes[u]) {
		if(v != parent) {
			int max_length_from_u = v == first_max_rem ? second_max : first_max, ok = 0;
			if(max_length_from_u >= max_length[v]) {
				if(cnt[v]) {
					ok = 1;
				}
			}
			if(max_length_from_u <= max_length[v]) {
				if(cnt[v] != cnt[0]) {
					ok = 1;
				}
			}
			ans += ok;
			dfs(v, u, max_length_from_u + 1);
			if(cnt[v]) {
				low_bound = std::min(low_bound, max_length[v] + 1);
			}
		}
	}
	if(s[u] == '1') {
		ans += second_max + 1;
	}
	else {
		if(low_bound <= second_max) {
			ans += second_max - low_bound + 1;
		}
	}
	return;
}

int main() {
	scanf("%d", &n);
	adjacent_vertexes = new std::vector<int>[n];
	max_length = new int[n];
	s = new char[n];
	cnt = new int[n];
	for (int i = 1; i < n; ++i) {
		int u, v;
		scanf("%d%d", &u, &v);
		adjacent_vertexes[--u].push_back(--v);
		adjacent_vertexes[v].push_back(u);
	}
	scanf("%s", s);
	pre_dfs(0, -1);
	dfs(0, -1, 0);
	printf("%lld\n", ans);
	return 0;
}

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

int main() {
	//配列の用意 + 入力を受け取る
	int s[10];
	for (int i = 0; i < 10; i++) {
		cin >> s[i];
	}
	int sum = 0;
	//合計点を算出
	for (int i = 0; i < 10; i++) {
		sum += s[i];
	}
	//出力
	cout << sum << endl;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

vector<int> G[2020];
vector<int> visited(2020);

void dfs(int now, int par, int dist, int D){
	if(dist <= D) visited[now] = 1;
	else visited[now] = 0;
	REP(i, G[now].size()){
		if(G[now][i] == par) continue;
		dfs(G[now][i], now, dist+1, D);
	}
	return;
}

void dfs2(int now, int par, int dist, int D){
	if(visited[now] == 1) visited[now] = 1;
	else if(dist <= D) visited[now] = 1;
	REP(i, G[now].size()){
		if(G[now][i] == par) continue;
		dfs2(G[now][i], now, dist+1, D);
	}
	return;
}

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

    ll N, K;
    cin >> N >> K;
    REP(i, N-1){
    	int a, b;
    	cin >> a >> b;
    	a--;b--;
    	G[a].push_back(b);
    	G[b].push_back(a);
    }

    ll res = -1;
    if(K%2 == 0){
    	REP(i, N){
    		dfs(i, -1, 0, K/2);
    		ll tmp = 0;
    		REP(j, N) tmp += visited[j];
    		res = max(tmp, res);
    	}
    }else{
    	REP(i, N){
    		REP(j, G[i].size()){
    			ll tmp = 0;
    			dfs(i, -1, 0, (K-1)/2);

    			dfs2(G[i][j], -1, 0, (K-1)/2);
    			REP(j, N) tmp += visited[j];
    			res = max(tmp, res);
    		}
    	}
    }
    cout << N - res << endl;
    return 0;
}

Measured memory_bytes: 512
a = 5.times.map { gets.strip.to_i }

s = []
a.each do |d|
  s << [d, d % 10]
end

zero = s.select { |d| d[1] == 0 }
num = s.select { |d| d[1] > 0 }.sort { |i, j| i[1] <=> j[1] }.reverse

sum = 0
zero.each do |d|
  sum += d[0]
end

num.each_with_index do |d, i|
  if (i + 1) < num.size
    sum += d[0] + (10 - d[1])
  else
    sum += d[0]
  end
end

puts sum


Measured memory_bytes: 1788
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramB a = new ProgramB();
            a.main();//実行する

        }

    }
    //ABC178
    class ProgramA
    {
        public void main()
        {
            //入力
            string s = Console.ReadLine();
            //30以上ならYes、それ以外はNoを出力
            if(s[s.Length  -1] == 's')
                Console.WriteLine(s + "es");
            else
                Console.WriteLine(s + "s");


        }
    }

    class ProgramB
    {
        public void main()
        {
            //入力
            int n = int.Parse(Console.ReadLine());
            int[] zorome = new int[n];
            for (int i = 0; i < n; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                if (int.Parse(s[0]) == int.Parse(s[1]))
                    zorome[i] = 1;
                else
                    zorome[i] = 0;
            }
            int count = 0;
            for(int i = 0;i < n;i++)
            {
                if (zorome[i] == 1)
                    count++;
                else
                    count = 0;

                if (count == 3)
                {
                    Console.WriteLine("Yes");
                    return;
                }

            }
            
            Console.WriteLine("No");

        }
    }

    class ProgramC
    {
        public void main()
        {

            //入力
            long n = long.Parse(Console.ReadLine());
            long MOD = 1000000000 + 7;

            long ans = (modpow(10, n, MOD) + modpow(8, n, MOD) - 2 * modpow(9, n, MOD) % MOD)% MOD;

            Console.WriteLine((ans + MOD) % MOD);


        }

        static long modpow(long a, long n, long MOD)
        {
            if (n == 0)
                return 1;
            if (n % 2 == 0)
            {
                long temp = modpow(a, n / 2, MOD);
                return temp * temp % MOD;
            }

            return a * modpow(a, n - 1, MOD) % MOD;
        }
    }

    class ProgramD
    {
        public void main()
        {

        }
            
    }

    class ProgramE
    {

        public void main()
        {

        }


    }

}






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


int main(){
  ll N,S;
  cin>>N>>S;
  vector<int>A(N);
  rep(i,N){cin>>A[i];}
  ll dp[3001][3001];
  rep(i,3001){
  	rep(j,3001){
    	dp[i][j]=0ll;
    }
  }
  dp[0][0]=1;
  for(int i=0;i<N;i++){
  	int a=A[i];
  	rep(j,S+1){
    	if(j>=a){dp[i+1][j]+=dp[i][j-a];}
      	dp[i+1][j]+=2*dp[i][j];
      	dp[i+1][j]%=MOD;
    }
    
  }
  cout<<dp[N][S];
}


Measured memory_bytes: 73996
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }
  const int N=100009;
  int n;
bool found=true;
  int arrival[N], departure[N], vis[N], parent[N];
  vector<pair<int, int> > g[N];

  void dra(int source, int destination)
  {
  	for(int i=1;i<=n;i++)
  	{
  		arrival[i]=1e9;
  		departure[i]=1e9;
  		vis[i]=0;
  	}
  	arrival[source]=0;
  	set<pair<int, int> > s;
  	s.insert({0, source});
  	while(!s.empty())
  	{
  		auto x = *(s.begin());
  		s.erase(x);
  		vis[x.second]=1;
  		departure[x.second]=arrival[x.second];
  		for(auto it:g[x.second])
  		{
  			if(arrival[it.first] > departure[x.second] + it.second)
  			{
  				s.erase({arrival[it.first], it.first});
  				arrival[it.first]=departure[x.second] + it.second;
  				s.insert({arrival[it.first], it.first});
  				parent[it.first]=x.second;
  			}
  		}
  	}
  	if(!vis[destination])
  	{
  found=false;
  return;
  	}
  	int v=destination;
  	vector<int> ans;
  	while(parent[v])
  	{
  		ans.push_back(v);
  		v=parent[v];
  	}
  	ans.push_back(source);
  	reverse(ans.begin(), ans.end());
  	// for(auto it:ans)
  	// 	cout<<it<<" ";
  }


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

    // ifstream fin(".in");
    // ofstream fout(".in");
    // for(int i=2;i<=100000;i++)dis[i]=1e8;
    // dis[1]=0;
    int m;
    cin>>n>>m;

    forn(i,m)
    {
      int x,y;
      cin>>x>>y;
      g[x].pb({y,1});
      g[y].pb({x,1});
    }
// vi ans(n+1,-1);
// vector<bool>vis(n+1,false);
dra(1,n);

if(found)
{
  cout<<"Yes\n";

fore(i,2,n)cout<<parent[i]<<"\n";
}
else
{
  cout<<"No\n";
}


    return 0;
  }


Measured memory_bytes: 17552
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

ll s[200001];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    s[0] = 0;
    int n = gi();
    int k = gi();
    for (int i = 0; i < n; i++)
        s[i+1] = s[i] + gi();

    ll ms = 0;
    for (int i = 0; i < n+1-k; i++) {
        ll alt = s[i+k] - s[i];
        ms = MAX(ms, alt);
    }

    ms += k;
    cout << ms/2 << (ms%2 ? ".5" : ".0") << endl;

    return 0;
}


Measured memory_bytes: 1792
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int N;
string S;
int Q;

signed main(){
    cin >> N >> S >> Q;
    rep(q, Q){
        ll K;
        cin >> K;
        ll ans = 0;
        ll m = 0;
        ll c = 0;
        ll _c = 0;
        deque<ll> que;
        ll sum = 0;
        for(int i=N-1; i>=0; i--){
            if(i+K < N){
                if(S[i+K] == 'M'){
                    sum -= que.back();
                    que.pop_back();
                    m--;
                }
                if(S[i+K] == 'C'){
                    _c++;
                    c--;
                }
            }
            if(S[i] == 'D'){
                ans += sum - m*_c;
            }
            if(S[i] == 'M'){
                que.push_front(c+_c);
                sum += c+_c;
                m++;
            }
            if(S[i] == 'C'){
                c++;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 7068
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<sstream>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; ++i)
#define per(i, a, n)  for(int i=n-1; i>=a; --i)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 1000000007
using namespace std;
typedef long long ll;

int main(){
  int X, Y, Z, K; cin >> X >> Y >> Z >> K;
  vector<ll> A(X), B(Y), C(Z);
  rep(i, 0, X)  cin >> A[i];
  rep(i, 0, Y)  cin >> B[i];
  rep(i, 0, Z)  cin >> C[i];
  sort(rall(A));
  sort(rall(B));
  sort(rall(C));
  vector<ll> sums;
  rep(i, 0, X) rep(j, 0, Y) rep(k, 0, Z){
    if((i+1)*(j+1)*(k+1)<=K)sums.push_back(A[i]+B[j]+C[k]);
    else  break;
  }
  sort(rall(sums));
  rep(i, 0, K)  cout << sums[i] << endl;
  return 0;
}

Measured memory_bytes: 1404
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var N int
	fmt.Scan(&N)
	sc.Split(bufio.ScanWords)
	f := make([][]int, N)
	p := make([][]int, N)
	for i := 0; i < N; i++ {
		f[i] = make([]int, 10)
		for j := 0; j < 10; j++ {
			sc.Scan()
			f[i][j], _ = strconv.Atoi(sc.Text())
		}
	}
	for i := 0; i < N; i++ {
		p[i] = make([]int, 11)
		for j := 0; j < 11; j++ {
			sc.Scan()
			p[i][j], _ = strconv.Atoi(sc.Text())
		}
	}

	r := -1000000000
	for m := 1; m < (1 << uint(10)); m++ {
		sum := 0
		for i := 0; i < N; i++ {
			c := 0
			for j := 0; j < 10; j++ {
				//if (m & (1 << uint(j))) > 0 {
				if (m >> uint(j) & 1) > 0 {
					if f[i][j] > 0 {
						c++
					}
				}
			}
			sum += p[i][c]
		}
		r = Max(r, sum)
	}
	fmt.Println(r)
}
func Max(a, b int) int {
	if b > a {
		return b
	}
	return a
}


Measured memory_bytes: 640
import math

def main():
    p_count = 0

    N, D = map(int, input().split())
    for _ in range(N):
        x, y = map(float, input().split())
        p = math.sqrt(x**2 + y**2)
        if p <= D:
            p_count += 1

    print(p_count)

main()


Measured memory_bytes: 9248
//28
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int h,l;cin>>h>>l;){
    if(h<l){
      swap(h,l);
    }
    while(h%l){
      h%=l;
      swap(h,l);
    }
    cout<<l<<endl;
  }
  return 0;
}

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

template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }

int main()
{
    ll h,w,n;
    cin>>h>>w>>n;
    set<pair<ll,ll>> black,seen;
    for(ll i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        black.insert(make_pair(x,y));
    }
    vector<pair<ll,ll>> start = { {-2,-2}, {-2,-1}, {-2,0},
                                    {-1,-2}, {-1,-1}, {-1,0},
                                    {0 ,-2}, {0,- 1}, {0,0}};
    vector<ll> cnt(10);
    cnt[0]=(h-2)*(w-2);
    for(auto b:black)
    {
        for (ll i = 0; i < 9; i++) {
            pair<ll,ll> pos = b + start[i];
            if (pos.first < 1 || pos.second < 1) {
                continue;
            }
            else if (pos.first + 2 > h || pos.second + 2 > w) {
                continue;
            }
            else if (seen.count(pos)) {
                continue;
            }
            seen.insert(pos);
            ll black_squares=0;
            for(ll j=0;j<3;j++)
                for(ll k=0;k<3;k++)
                    if(black.count({pos.first+j,pos.second+k}))
                        black_squares++;
            cnt[black_squares]++;
            cnt[0]--;
        }
    }
    for(ll i=0;i<10;i++)
        cout<<cnt[i]<<endl;
    return 0;
}


Measured memory_bytes: 66012
using System;
using System.Linq;

namespace UOA_PCKWU_1042
{
    class Program
    {
        static void Main(string[] args)
        {
            string input;
            while( (input = Console.ReadLine()) != "END OF INPUT")
            {
                Console.WriteLine(input.Split(' ').Select(s => s.Length.ToString()).Aggregate((all, next) => all += next));
            }
        }
    }
}



Measured memory_bytes: 14108
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


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

	VI v(n);
	REP(i, n) {
		cin >> v[i];
	}
	
	int m = v[0];
	int ans = 0;
	REP(i, n) {
		if (v[i] >= m) {
			ans++;
			m = v[i];
		}
	}

	ANS(ans);
	

	return 0;
}


Measured memory_bytes: 256
use std::io::stdin;
use std::cmp::{
    min,
    max,
};
use std::time::SystemTime;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::collections::HashSet;

#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read<T>() -> T
where T: std::str::FromStr
{
    read_line().parse::<T>().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T>() -> Vec<T>
where T: std::str::FromStr
{
    read_line().split(" ").map(|n| n.parse::<T>().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn read_chars() -> Vec<char>
{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn print_time() -> () {
    println!("{:?}", SystemTime::now());
}

trait BinarySearchLeft<T> {
    fn binary_search_left(&self, x: &T) -> Result<usize, usize>;
}

impl<T> BinarySearchLeft<T> for Vec<T>
where T: std::cmp::Ord + std::fmt::Debug
{
    fn binary_search_left(&self, x: &T) -> Result<usize, usize> {
        let index = self.binary_search(x);
        match index {
            Ok(index) => {
                for i in (1..index+1).rev() {
                    if self[i] != self[i - 1] {
                        return Ok(i - 1)
                    }
                }
                
                Ok(index)
            },
            _ => index,
        }
    }
}

#[allow(unused_variables)]
fn main() {
    let nm: Vec<usize> = read_vec();
    let mut v = vec![];
    for _ in 0..nm[0] {
        v.push(read_chars());
    }

    let mut ans = 0;
    for _i in 0..nm[0] {
        for _j in 0..nm[1] {
            if v[_i][_j] == '#' {
                continue;
            }

            let mut m = vec![vec![1000000; nm[1]]; nm[0]];
            let mut s = S {
                map: v.clone(),
                nm: nm.clone(),
                m: m,
            };
            s.f(_i, _j, 0);

            for l in s.m {
                for v in l {
                    if v != 1000000 {
                        ans = max(ans, v);
                    }
                }
            }
        }
    }
    println!("{}", ans);
}

struct S {
    map: Vec<Vec<char>>,
    nm: Vec<usize>,
    m: Vec<Vec<usize>>,
}

impl S {
    fn f(&mut self, i: usize, j: usize, c: usize) {
        if self.m[i][j] <= c {
            return;
        }
        if self.map[i][j] == 'G' {
            self.m[i][j] = c;
            return;
        }
        if self.map[i][j] == '#' {
            return;
        }
        self.m[i][j] = c;

        if i + 1 < self.nm[0] {
            self.f(i + 1, j, c + 1);
        }
        if i >= 1 {
            self.f(i - 1, j, c + 1);
        }
        if j + 1 < self.nm[1] {
            self.f(i, j + 1, c + 1);
        }
        if j >= 1 {
            self.f(i, j - 1, c + 1);
        }
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char a[100];
	int n,ans=10000;
	int i,j,k;
	scanf("%s",a+1);
	n=strlen(a+1);
	for(i=1;i<=n;i++)
	{
		j=i+1,k=j+1;
		if(k<=n)
			{
				ans=min(ans,abs((a[i]-'0')*100+(a[j]-'0')*10+(a[k]-'0')-753));
			}
	}
	printf("%d\n",ans);
	return 0;
}

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

int main(){
    int N; cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    list<int> L;
    for(int i = 0; i < N; i++){
        if(N % 2 == 0){
            if(i % 2 == 0) L.push_back(A[i]);
            else L.push_front(A[i]);
        }else{
            if(i % 2 == 0) L.push_front(A[i]);
            else L.push_back(A[i]);
        }
    }
    for(auto itr = L.begin(); itr != L.end(); itr++){
        if(itr != L.begin()) cout << " ";
        cout << *itr;
    }
    cout <<endl;
}

Measured memory_bytes: 9216
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int i, j, n;
	string name[101];
	int point[101];
	int number[101];

	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> name[i] >> point[i];
		number[i] = i + 1;
	}

	string nametmp;
	int pointtmp;
	int numbertmp;
	for (i = 0; i < n; i++) {
		for (j = i+1; j < n; j++) {
			if (name[i] > name[j]) {
				nametmp = name[i];
				name[i] = name[j];
				name[j] = nametmp;
				pointtmp = point[i];
				point[i] = point[j];
				point[j] = pointtmp;
				numbertmp = number[i];
				number[i] = number[j];
				number[j] = numbertmp;
			}
			else if (name[i] == name[j] && point[i]<point[j]) {
				nametmp = name[i];
				name[i] = name[j];
				name[j] = nametmp;
				pointtmp = point[i];
				point[i] = point[j];
				point[j] = pointtmp;
				numbertmp = number[i];
				number[i] = number[j];
				number[j] = numbertmp;
			}
		}
	}

	for (i = 0; i < n; i++) {
		cout << number[i] << endl;
	}
	return 0;

}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long a, b, x;
    cin >> a >> b >> x;
    a += x;
    b += x;
    long long res = b / x - (a - 1) / x;
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <math.h>
#include <algorithm>
//#include <vector> 

int main(int argc, char* argv[])
{
    char str0[200001]={0};
    char str1[200001]={0};
    scanf("%s", str0);
    scanf("%s", str1);

    long len = strlen(str0);
    if(len != strlen(str1) ) {
        printf("No\n");
        return 0;
    }

    long a[26]={0};
    long i;
    for(i=0; i<26; i++) {
        a[i] = -1;
    }
    for(i=0; i<len; i++) {
        char curr = str0[i] - 'a';
        if(a[curr] < 0) {
            a[curr] = str1[i] - 'a';
        }
        else if (a[curr] != str1[i] - 'a') {
            printf("No\n");
            return 0;
        }
    }

    long count[26]={0};
    for(i=0; i<26; i++) {
        if(a[i] >= 0) {
            if(count[a[i]]>0) {
                printf("No\n");
                return 0;
            }
            count[a[i]] ++;
        }
    }

    printf("Yes\n");

    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

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

int main(){
    double r;
    cin >> r;
    const double PI=3.14159;
    cout << 2 * r * PI << endl;
}


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

int main() {
    ios_base::sync_with_stdio(false);	
    cin.tie(0);
	int n;
	cin >> n;
	bool ok = false;
	for (int i = 1; i <= 9; i++) {
		if (n % i == 0 && n / i <= 9) {
			ok = true;
			break;
		}
	}	
	if (ok) cout << "Yes" << "\n";
	else cout << "No" << "\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
     int k;
     cin >> k;
     map<string, int> mp;
     for(int i=0; i<k; ++i)
     {
     	string s;
     	cin >> s;
     	++mp[s]; 
	 }
	 cout << "AC x " << mp["AC"] << endl;
	 cout << "WA x " << mp["WA"] << endl;
	 cout << "TLE x " << mp["TLE"] << endl;
	 cout << "RE x " << mp["RE"] << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n, C, a[100005]{};
    vector<P> ls[30];
    cin >> n >> C;
    for (int i = 0; i < C; i++) ls[i].push_back({0, 0});
    for (int i = 0; i < n; i++) {
        int s, t, c;
        cin >> s >> t >> c;
        c--;
        ls[c].push_back({s, t});
    }
    for (int i = 0; i < C; i++) {
        sort(ls[i].begin(),ls[i].end());
        for (int j = 1; j < ls[i].size(); j++) {
            if (ls[i][j].first - ls[i][j - 1].second == 0)
                a[ls[i][j].first]++;
            else
                a[ls[i][j].first - 1]++;
            a[ls[i][j].second]--;
        }
    }
    int amax = 0;
    for(int i=1;i<100003;i++){
        a[i] += a[i-1];
        amax = max(amax,a[i]);
    }
    cout << amax << endl;
    return 0;
}

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

#define int long long
int N, M;
int P[100100];
int A[100100];
int B[100100];
int C[100100];

int visit[100100];

signed main() {
  cin >> N >> M;
  for (int i=0; i<M;   i++) cin >> P[i];
  for (int i=0; i<N-1; i++) cin >> A[i] >> B[i] >> C[i];

  for (int i=1; i<M; i++) {
    int from = P[i-1]-1;
    int to   = P[i]-1;
    for (int j=min(from, to); j<max(from, to); j++) visit[j]++;
  }

  int ans = 0;
  for (int i=0; i<N-1; i++) {
    int v = visit[i];
    if (v != 0) ans += min(v*A[i], C[i] + v*B[i]);
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 6996
Q = int(input())
query = [list(map(int, input().split())) for _ in range(Q)]

def is_prime(n):
  if n <= 1:
    return False
  if n == 2:
    return True
  i = 2
  while i * i <= n:
    if n % i == 0:
      return False
    i += 1
  return True

sum_a = [0]*100001
for n in range(1, 100000+1):
  if is_prime(n) and is_prime((n+1)//2):
    prime = 1
  else:
    prime = 0
  sum_a[n] = sum_a[n-1] + prime

for l, r in query:
  print(sum_a[r] - sum_a[l-1])

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

using namespace std;

using ll = long long;

constexpr ll mod = 1e9 + 7;

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

  double n;
  cin >> n;

  array<int, 4> counts = {};
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    ++counts[a];
  }

  // num of 1, num of 2, num of 3
  vector<vector<vector<double>>> dp(n + 2, vector<vector<double>>(n + 2, vector<double>(n + 2)));
  for (int threes = 0; threes <= counts[3]; ++threes) {
    for (int twos = 0; twos <= counts[2] + counts[3]; ++twos) {
      for (int ones = 0; ones <= counts[1] + counts[2] + counts[3]; ++ones) {
        double cur = 0;
        if (ones | twos | threes) {
          cur = 1.;
        }
        if (ones) {
          cur += ones / n * dp[ones - 1][twos][threes];
        }
        if (twos) {
          cur += twos / n * dp[ones + 1][twos - 1][threes];
        }
        if (threes) {
          cur += threes / n * dp[ones][twos + 1][threes - 1];
        }
        int zeros = n - ones - twos - threes;
        if (zeros > 0 && zeros != n) {
          cur *= n / (n - zeros);
        }
        dp[ones][twos][threes] = cur;
      }
    }
  }

  cout << setprecision(16) << fixed << dp[counts[1]][counts[2]][counts[3]] << '\n';

  return 0;
}


Measured memory_bytes: 221824
#include <iostream>
using namespace std;
int main(void){
    int r, c, HYOU[101][101]={}, i, j;
    
    cin >> r >> c;
    for(i=0; i<r; i++){
        for(j=0; j<c; j++){
            cin >> HYOU[i][j];
            HYOU[i][c] += HYOU[i][j];
            HYOU[r][j] += HYOU[i][j];
            HYOU[r][c] += HYOU[i][j];
        }
    }
    
    for(i=0; i<r+1; i++){
        for(j=0; j<c+1; j++){
            cout << HYOU[i][j];
            if(j != c)   cout << " ";
            else cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3128
condition = input().split(' ')
num_of_values = int(condition[0])
quontum = int(condition[1])
input_lines = []
time_passed = 0

for n in range(num_of_values):
    input_lines.append(input())
    
while len(input_lines) > 0:
# for i in range(8):
    # 配列の1つ目を取り出す
    value = input_lines[0]
    # print(value)
    splitted_value = value.split(' ')
    # 値を記録する
    elem_name = splitted_value[0]
    elem_value = int(splitted_value[1])
    # print(elem_name)
    # print(elem_value)
    # 値を変更する
    calc_value = elem_value - quontum
    # print(calc_value)
    if calc_value > 0:
        time_passed += quontum
        input_lines.remove(value) # 値を削除する
        join_value = [elem_name, str(calc_value)]
        new_value = ' '.join(join_value)
        input_lines.append(new_value) # 値を追加する
    else :
        time_passed += elem_value
        input_lines.remove(value) # 値を削除する
        print(elem_name, time_passed)


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

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

	vector<int> xv(n + 1);
	vector<int> yv(m + 1);
	cin >> xv[0];
	cin >> yv[0];

	int mx = xv[0];
	for (int i = 1; i <= n; ++i) {
		cin >> xv[i];
		mx = max(xv[i], mx);
	}

	int my = yv[0];
	for (int i = 1; i <= m; ++i) {
		cin >> yv[i];
		my = min(yv[i], my);
	}

	if (mx < my) {
		cout << "No War" << endl;
	}
	else {
		cout << "War" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    ll a,b,c;
    cin>>a>>b>>c;
    if(a+b+2>=c) cout<<"No";
    else if((4*a*b)<((c-a-b)*(c-a-b))) cout<<"Yes";
    else cout<<"No";
    return 0;
}


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

#define int long long
signed main(){
    int n;
    cin >> n;
    int a[n];
    int  k=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
    k+= a[i];
    }
    int t = k;
    int l = 0;
    for(int i =0;i<n;i++){
        if(abs( n*a[i]-k)<t){
             t = abs( n*a[i]-k);
            l =i;
        }
    }
    cout << l;
    
    return 0;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int n;
	cin >> n; 
	vector<int> a(n);
	int x=0;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		x^=a[i];
	}

	for(int i=0;i<n;i++)
		cout << (x^a[i]) << endl;




}

Measured memory_bytes: 3548
import math

n, m = map(int, input().split())
mod = 10 ** 9 + 7

if abs(n-m) > 1:
    print(0)
    exit()

if abs(n-m) == 0:
    ans = math.factorial(n) * math.factorial(m) * 2 % mod
    print(ans)
else:
    ans = math.factorial(n) % mod * math.factorial(m) % mod
    print(ans)

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

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

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    cin >> s;
    int n = s.size();
    cout << string(n, 'x') << '\n';
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
typedef long long ll;
int main(){
    int A,B,C,X;
    cin >> A >> B >> C >> X;
    int ans = 0;
    REP(i,A+1){
        REP(j,B+1){
            REP(k,C+1){
                if(500*i+100*j+50*k == X) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256