akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int A, B;

  cin >> A >> B;
  cout << A * B << endl;

  return 0;
}

Measured memory_bytes: 3600
import java.io.*;

class Main
{
 public static void main(String[] args) throws IOException
 {
  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

  String[] str=br.readLine().split(" ");

  int a=Integer.parseInt(str[0]),b=Integer.parseInt(str[1]),c=Integer.parseInt(str[2]);

  if(a<b && b<c)
   System.out.println("Yes");
  else
   System.out.println("No");
 }
}

Measured memory_bytes: 24196
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container;

alias A = Tuple!(int, "a", long, "c");

void main()
{
    auto N = readln.chomp.to!int;
    int[int] aa, ii;
    foreach (i, a; readln.split.to!(int[])) {
        if (a !in ii) {
            ii[a] = i.to!int;
            aa[a] = 0;
        }
        ++aa[a];
    }
    A[] buf;
    foreach (a, c; aa) buf ~= A(a, c);
    auto Q = heapify!"a.a < b.a"(buf);

    auto res = new long[](N);
    for (;;) {
        auto a = Q.front.a;
        auto c = Q.front.c;
        Q.popFront();
        if (Q.empty) {
            res[ii[a]] += a * c;
            break;
        } else {
            auto n = Q.front;
            Q.popFront();
            auto d = a - n.a;
            res[ii[a]] += d * c;
            Q.insert(A(n.a, n.c + c));
            ii[n.a] = min(ii[a], ii[n.a]);
        }
    }
    foreach (r; res) writeln(r);
}

Measured memory_bytes: 16688
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
import random
J=int(1e9)+7

###############################################################################\n=17
n=int(input())
A=INPUT()
sum=0
for i in range(n):
    sum+=A[i]
sum=sum*sum

s=0
for i in range(n):
    s+=A[i]**2

ans=(sum-s)//2
ans%=J
print(ans)


Measured memory_bytes: 108440
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int AB,BC,CA;
    cin >> AB >> BC >> CA;

    cout << AB * BC / 2 << endl;
    
} 

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int main(){
    int a=0,n=0,c=1000000,b=-1000000;
    long long d=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a;
        if(a<c)
        {
            c=a;
        }
        if(b<a){
            b=a;
        }
        
        d=d+a;
        
    }
    cout<<c<<" "<<b<<" "<<d<<endl;
    return 0;
}



Measured memory_bytes: 3100
from collections import deque

N = int(input())
graph = {i:[] for i in range(N)}

for i in range(N):
    g = list(map(int, input().split()))
    for j in range(g[1]):
        graph[g[0]-1].append(g[j+2]-1)
        
que = deque()
dist = [-1 for _ in range(N)]
que.append(0)
dist[0] = 0

while que:
    top = que.popleft()
    
    for i in graph[top]:
        if(dist[i] != -1):
            continue
        dist[i] = dist[top]+1
        que.append(i)

for i in range(len(dist)):
    print(i+1, dist[i])    


Measured memory_bytes: 6044
// #define STOPIT
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

void debug_impl() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
    #define debug(...)\
    do {\
        cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        cerr << std::noboolalpha;\
    } while (false)
#else
    #define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr>
istream& operator>> (istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr >
ostream& operator<< (ostream& os, Container const& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

int k;
int cnt = 0;

void partial_search(int digit, int prev, string& res)
{
    if (digit == 0)
    {
        ++cnt;
        return;
    }

    rep(n, prev-1, prev+2)
    {
        if (n<0 or n>9) continue;
        
        res += '0'+n;
        partial_search(digit-1, n, res);

        if (cnt == k) return;
        res.pop_back();
    }
}

string full_search(int digit)
{
    rep(n, 1, 10)
    {
        string res;
        res += '0'+n;
        partial_search(digit-1, n, res);

        if (k == cnt)
            return res;
    }
    return "";
}

int main()
{
    cin >> k;
    string ans;
    rep(i, 1, 100)
    {
        ans = full_search(i);
        if (cnt == k)
            break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 310, MOD = 1e9 + 7;
struct data {
  int l,x;
};
vector<data> req[N];
int dp[N][N][N],n,m,ans;
int main() {
  int x,y,z;
  scanf("%d%d",&n,&m);
  for (int i = 1 ; i <= m ; ++ i) {
    scanf("%d%d%d",&x,&y,&z);
    req[y].push_back((data){x,z});
  }
  dp[0][0][1] = 1;
  dp[0][1][0] = 1;
  dp[1][0][0] = 1;
  for (int k = 1 ; k <= n ; ++ k) {
    for (int i = 0 ; i < (int)req[k].size() ; ++ i)
      for (int a = 0 ; a < k ; ++ a)
        for (int b = 0 ; b < k ; ++ b) if (a != b || (!a)) {
          int cur = 1;
          cur += (a >= req[k][i].l);
          cur += (b >= req[k][i].l);
          if (cur != req[k][i].x) {
            dp[k][a][b] = dp[a][k][b] = dp[a][b][k] = 0;
          }
        }
    if (k == n) break;
    for (int i = 0 ; i < k ; ++ i)
      for (int j = 0 ; j < k ; ++ j)
        if (i != j || (!i)) {
          #define _(x) ((x) %= MOD)
          _(dp[k+1][i][j] += dp[k][i][j]);
          _(dp[k][k+1][j] += dp[k][i][j]);
          _(dp[k][i][k+1] += dp[k][i][j]);
          _(dp[k+1][k][j] += dp[i][k][j]);
          _(dp[i][k+1][j] += dp[i][k][j]);
          _(dp[i][k][k+1] += dp[i][k][j]);
          _(dp[k+1][j][k] += dp[i][j][k]);
          _(dp[i][k+1][k] += dp[i][j][k]);
          _(dp[i][j][k+1] += dp[i][j][k]);
        }
  }
  for (int i = 0 ; i < n ; ++ i)  
    for (int j = 0 ; j < n ; ++ j)
      if (i != j || (!i)) {
        _(ans += dp[n][i][j]);
        _(ans += dp[i][n][j]);
        _(ans += dp[i][j][n]);
      }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 114944
#include <iostream>

using namespace std;

int main() {
  for (;;) {
    int n;
    cin >> n;
    if (!n) return 0;
    int tmp[100], C[100][100];
    bool H[100][100];
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) {
        cin >> C[i][j];
        H[i][j] = false;
      }
    for (int i = 0; i < n; i++) {
      int c = 1, h = C[i][0];
      tmp[0] = 0;
      for (int j = 1; j < n; j++)
        if (C[i][j] < h) {
          h = C[i][j];
          c = 0;
          tmp[c++] = j;
        } else if (C[i][j] == h)
          tmp[c++] = j;
      for (int j = 0; j < c; j++)
        H[i][tmp[j]] = true;
    }
    for (int j = 0; j < n; j++) {
      int c = 1, h = C[0][j];
      tmp[0] = 0;
      for (int i = 1; i < n; i++)
        if (C[i][j] > h) {
          h = C[i][j];
          c = 0;
          tmp[c++] = i;
        } else if (C[i][j] == h)
          tmp[c++] = i;
      for (int i = 0; i < c; i++)
        if (H[tmp[i]][j]) {
          cout << C[tmp[i]][j] << endl;
          goto success;
        }
    }
    cout << 0 << endl;
success:;
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)

int main(){
    string S;
    cin>>S;
    if(S=="SUN"){
        cout<<7<<endl;
    }else if(S=="MON"){
        cout<<6<<endl;
    }else if(S=="TUE"){
        cout<<5<<endl;
    }else if(S=="WED"){
        cout<<4<<endl;
    }else if(S=="THU"){
        cout<<3<<endl;
    }else if(S=="FRI"){
        cout<<2<<endl;
    }else{
        cout<<1<<endl;        
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>

using namespace std;

int main() {
	int n, mac = 0, mic = 100000;
	vector<int> a;
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (mac < a[i]) {
			mac = a[i];
		}
		if (mic > a[i]) {
			mic = a[i];
		}
	}
	if (mac - mic != 1 && mac - mic != 0) {
		cout << "No" << endl;
		return 0;
	}
	int macc = 0, micc = 0;
	for (int i = 0; i < n; i++) {
		if (mac == a[i])
			macc++;
		else
			micc++;
	}
	if (micc == 0 && mac + 1 == n) {
		cout << "Yes" << endl;
		return 0;
	}
	int maxcolornum = macc / 2;
	if (maxcolornum + micc >= mac && 1 + micc <= mac) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	//cin >> n;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,Q;
  string S;
  cin >> N >> Q >> S;
  int s=S.size();
  vector<int> count(s);
  count[0]=0;
  for (int i=0;i<s;i++){
    count[i]=count[i-1];
    if (S[i]=='C'&&S[i-1]=='A'){
      count[i]++;
    }
  }
  for (int i=0;i<Q;i++){
    int l,r;
    cin >> l >> r;
    int ans=count[r-1]-count[l-1];
    cout << ans << endl;
  }
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

int dfs(int v, int p, const vector<vector<int>> &G, int &a) {
    int q;
    int m = 0;
    if (p >= 0 && G[v].size() == 1) {
        a = v;
        return 0;
    }
    for (int u : G[v]) {
        if (u == p) continue;
        int k = dfs(u, v, G, q) + 1;
        if (m < k) {
            m = k;
            a = q;
        }
    }
    return m;
}

int main() {
    int n; cin >> n;
    vector<vector<int>> G(n);
    REP(i, n - 1) {
        int a, b; cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int v,u;
    dfs(0, -1, G, v);
    if (dfs(v, -1, G, u) % 3 == 1) {
        puts("Second");
    }
    else {
        puts("First");
    }
    return 0;
}

Measured memory_bytes: 29952
while True:
  n = int(input())
  if n == 0:
    break
  pairs = []
  for _ in range(n):
    i, m1, s1, m2, s2, m3, s3, m4, s4 = map(int, input().split())
    score = (m1 + m2 + m3 + m4) * 60 + (s1 + s2 + s3 + s4)
    pairs.append((score, i))
  pairs.sort()
  print(pairs[0][1])
  print(pairs[1][1])
  print(pairs[-2][1])



Measured memory_bytes: 6172
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    ll x, y, group[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    cin >> x >> y;
    cout << ((group[x] == group[y]) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    ll h,w,n;cin>>h>>w>>n;
    out((n-1)/max(h,w)+1);
}

Measured memory_bytes: 256
n=int(input())
a=[0]+list(map(int,input().split()))+[0]
ans=0
for i in range(n+1):
    ans+=abs(a[i]-a[i+1])
for i in range(1,n+1):
    print(ans-abs(a[i]-a[i+1])-abs(a[i-1]-a[i])+abs(a[i-1]-a[i+1]))

Measured memory_bytes: 14048
#include<stdio.h>
#include<stdlib.h>

long cmp(const void *a,const void *b){
  return (char*)a - (char*)b;
}

int main(){
  long long n = 0;
  char name[100000][20] = {};
  long long XX[5] = {};
  long long m=0;
  long long a=0;
  long long r=0;
  long long c=0;
  long long h=0;
  long long i=0;
  long long j=0;
  long long k=0;
  long long cnt = 0;
  scanf("%lld",&n);
  for(i=0;i<n;i++){
    scanf(" %s",name[i]);
  }
  for(i=0;i<n;i++){
    switch(name[i][0]){
      case 'M':
        XX[0]++;
        break;
      case 'A':
        XX[1]++;
        break;
      case 'R':
        XX[2]++;
        break;
      case 'C':
        XX[3]++;
        break;
      case 'H':
        XX[4]++;
        break;
    }
  }
  for(i=0;i<5;i++){
    for(j=i+1;j<5;j++){
      for(k=j+1;k<5;k++){
        cnt += XX[i]*XX[j]*XX[k];
      }
    }
  }
  printf("%lld",cnt);
        
  return 0;
}

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

int main(void){
  int n; cin >> n;
  int G[8][8];
  for(int cnt = 1; cnt <= n; cnt++){
    int sx, sy;
    string inpt;
    for(int i=0; i < 8; i++){
      cin >> inpt;
      for(int j = 0; j < 8; j++){
        G[i][j] = inpt[j] - '0';
      }
    }
    cin >> sx >> sy;
    sy--; sx--;
    queue< pair<int, int> > q;
    q.push(make_pair(sx, sy));

    while(!q.empty()){
      int x = q.front().first;
      int y = q.front().second;
      q.pop();
      if(G[y][x] == true){
        for(int dy = -3; dy <= 3; dy++){
          int ny = y+dy; int nx = x;
          if(!(ny >= 0 && ny < 8 && nx >= 0 && nx < 8)) continue;
          if(G[ny][nx]){
            q.push(make_pair(nx, ny));
          }
        }
        for(int dx = -3; dx <= 3; dx++){
          int ny = y; int nx = x+dx;
          if(!(ny >= 0 && ny < 8 && nx >= 0 && nx < 8)) continue;
          if(G[ny][nx]){
            q.push(make_pair(nx, ny));
          }
        }
        G[y][x] = false;
      }
    }
    cout << "Data " << cnt << ":" << endl;
    for(int i=0; i < 8; i++){
      for(int j=0; j < 8; j++){
        cout << G[i][j];
      }
      cout << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1228
#include <stdio.h>
int main()
{
	int a[3][105];
	int i, j, n;
	scanf("%d", &n);
	for(i = 1 ; i <= 2 ; i++)
	{
		for(j = 1 ; j <= n ; j++)
		{
			scanf("%d", &a[i][j]);
		}
	}
	int max = 0;
	int all = 0;
	for(i = 1 ; i <= n ; i++)
	{
		all = 0;
		for(j = 1 ; j <= i ; j++)
		{
			all = all + a[1][j];
		}
		for(j = i ; j <= n ; j++)
		{
			all = all + a[2][j];
		}
		if(max < all)
		{
			max = all;
		}
	}
	printf("%d\n",max);
	return 0;
}


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

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
 
    ll left = 4 * a * b;
    ll sright = c - (a + b);
    if ((sright >= 0) && (left < sright * sright)) cout << "Yes" << endl;
    else cout << "No" << endl;
 
    return 0;
}

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

class UF{
  vi p,r;

public:
  UF(int n=1):p(n,-1),r(n,0){ }

  int find(int x){ return (p[x]<0)?x:(p[x] = find(p[x])); }

  void unite(int x,int y){
    x = find(x); y = find(y);
    if(x==y)return;

    if(r[x] < r[y])p[x] = y;
    else p[y] = x;
    if(r[x] == r[y])r[x]++;
  }

  bool same(int x,int y){return find(x)==find(y);}
};

struct edge{
  int a,b,c;
  edge(int x,int y,int z):a(x),b(y),c(z){}
  bool operator<(const edge e)const{ return c<e.c; };
};

vector<edge> ve;
vector<int> use;
UF uf;

int Kruskal(int del){
  int res = 0;
  for(int i=0;i<ve.size();i++){
    if(del == i)continue;
    if(uf.same(ve[i].a,ve[i].b))continue;
    uf.unite(ve[i].a,ve[i].b);
    res += ve[i].c;
    if(del<0)use[i] = 1;
  }
  return res;
}

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

  ve.clear();
  for(int i=0;i<m;i++){
    int s,d,c;
    cin >> s >> d >> c; s--; d--;
    ve.push_back(edge(s,d,c));
  }
  sort(ve.begin(),ve.end());

  use.resize(m,0); uf = UF(n);
  int minv = Kruskal(-1);

  int ans = 0, ansv = 0;
  for(int i=0;i<m;i++){
    if(use[i]==0)continue;
    uf = UF(n);
    if(Kruskal(i) != minv){
      ans++; ansv += ve[i].c;
    }
  }
  cout << ans << " " << ansv << endl;
}

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

int main() {
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b)
    {
        if(a==c)cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
    else
    {
        if(a==c)cout<<"Yes"<<endl;
        else if(b==c)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}


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

	int cnt = 0;
	int d = N%10;
	bool ok = false;
	while(N){
		if(d == N%10) cnt++;
		else cnt = 1;
		d = N%10;
		N /= 10;
		if(cnt > 2) ok = true;
	}

	Cout(Yes(ok));
}


Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef unsigned long long lli;
typedef unsigned long long ull;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

string t;
string p;

const ull b = 1000000007;
ull hsh = 0;
ull cmp = 0;
vll vb;

int main(){
    cin >> t >> p;
    if(t.size() < p.size()) return 0;
    vb = vll(p.size());
    vb[0] = 1;
    for(lli i = 1;i < p.size();i++){
        vb[i] = vb[i-1]*b;
    }
    for(lli i = 0;i < p.size();i++){
        hsh += ((lli)p[i])*vb[p.size()-i-1];
        cmp += ((lli)t[i])*vb[p.size()-i-1];
    }
    for(lli i = 0;i < t.size()-p.size();i++){
        if(hsh == cmp) cout << i << endl;
        cmp -= vb.back()*t[i];
        cmp *= b;
        cmp += t[i+p.size()];
    }
    if(cmp == hsh) cout << t.size()-p.size() << endl;
    return 0;


}

Measured memory_bytes: 3948
W,H,N=map(int,input().split())
x1=y1=0
x2,y2=W,H
for i in range(N):
  x,y,a=map(int,input().split())
  if a==1: x1=min(x2,max(x1,x))
  elif a==2: x2=max(x1,min(x2,x))
  elif a==3: y1=min(y2,max(y1,y))
  else: y2=max(y1,min(y2,y))
print((x2-x1)*(y2-y1))


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int shuffle(string &s, int h) {
	string t = s.substr(0, h),
		u = s.substr(h);
	s = u + t;
	return 0;
}

int main() {
	string a;
	int m, h;
	while (1) {
		cin >> a >> m;
		if (a == "-") break;
		for (int i = 0;i < m;++i) {
			cin >> h;
			shuffle(a, h);
		}
		cout << a << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3184
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

template<typename T>
class SegTree {
  int n;
  vector<T> seg;
  
  // irrelevant value for query
  const T NIL = make_pair(1<<30, 0);
  
  // binary operator for query
  T binop(T a, T b) {
    return min(a, b);
  }
  
  void update(int k, int l, int r, int p, T x) {
    if (p < l || r <= p)
      return;
    if (r - l == 1)
      seg[k] = x;
    else {
      update(2*k+1, l, (l+r)/2, p, x);
      update(2*k+2, (l+r)/2, r, p, x);
      seg[k] = binop(seg[2*k+1], seg[2*k+2]);
    }
  }
  T query(int k, int l, int r, int a, int b) {
    if (b <= l || r <= a)
      return NIL;
    if (a <= l && r <= b)
      return seg[k];
    else {
      T ret = NIL;
      ret = binop(ret, query(2*k+1, l, (l+r)/2, a, b));
      ret = binop(ret, query(2*k+2, (l+r)/2, r, a, b));
      return ret;
    }
  }
public:
  SegTree(int n): n(n), seg(4*n) {}
  void init() {
    for (int i = 0; i < 4*n; i++)
      seg[i] = NIL;
  }
  // update p-th value to x
  void update(int p, T x) {
    update(0, 0, n, p, x);
  }
  // query for range [l, r)
  T query(int l, int r) {
    return query(0, 0, n, l, r);
  }
};


int n, r, l;
int sum[100000];

int main() {
  ios::sync_with_stdio(false);
  cin >> n >> r >> l;

  SegTree<pair<int, int> > tree(100000);
  int pre = 0;
  REP (i, r) {
    int d, t, x;
    cin >> d >> t >> x;
    sum[tree.query(0, n).second] += t-pre;
    int pt = -tree.query(d-1, d).first;
    tree.update(d-1, make_pair(-(pt+x), d-1));
    pre = t;
  }
  sum[tree.query(0, n).second] += l-pre;

  int ans = 0;
  REP (i, n) if (sum[i] > sum[ans]) ans = i;
  cout << ans+1 << endl;

  return 0;
}

Measured memory_bytes: 6112
#include<bits/stdc++.h>
using namespace std;
int a[100005];
int main(){
	int n,ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;++i)a[i]=a[i/10]+1;
	for(int i=1;i<=n;++i)if(a[i]&1)ans++;
	printf("%d",ans);
}

Measured memory_bytes: 640
#include<iostream>
#include<utility>
#include<algorithm>
using namespace std;
int a[300][300],h,w,d,s[1<<17];
pair<int,int>p[1<<17];
main()
{
	cin>>h>>w>>d;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin>>a[i][j];
			p[a[i][j]]=make_pair(i,j);
		}
	}
	for(int i=1;i<=h*w;i++)
	{
		s[i+d]=s[i]+abs(p[i+d].first-p[i].first)+abs(p[i+d].second-p[i].second);
	}
	int q;cin>>q;
	for(int i=0;i<q;i++)
	{
		int l,r;cin>>l>>r;
		cout<<s[r]-s[l]<<endl;
	}
}

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

const int mod = 1e9+7;
int main(){
  int n,k;
  cin>>n>>k;
  
  ll res = 0;
  for(int i=k;i<=n+1;i++){
    res += (ll)(n-i+1)*i+1;
    res %= mod;
  }
  cout << res << endl;
}

Measured memory_bytes: 3624
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int main( ){
  double a,b,c,d,C,s,l,h;
  cin>>a>>b>>C;
  d=C*acos(-1)/180;
  s=a*b*sin(d)/2;
  c=sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(d));
  l=a+b+c;
  h=b*sin(d);
  printf("%f\n%f\n%f\n",s,l,h);
  return 0;
}

Measured memory_bytes: 3448
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void) {
  int n = 0;
  char S[5];
  scanf("%s", S);
  for (int i = 0; i < 4; i++) {
    if (S[i] == '+') n++;
    else n--;
  }
  printf("%d\n", n);

  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int main(void){
    int a,b;
    scanf("%d%d",&a,&b);
    if (a*b%2==0){
        printf("No\n");
    } else {
        printf("Yes\n");
    }
	return 0 ;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
#include<cmath>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)
#define show(x) cout<< #x << " = " << (x) << endl
#define show_array(arr) REP(i,int((arr).size()))cout<< #arr << "["<<i<<"]"<<"="<<arr[i]<<endl


int main(){
	
	ios::sync_with_stdio(false);
	ll N;
	cin>>N;
	vector<ll> arr(N);
	REP(i,N)cin>>arr[i];
	ll sell_count = 0;	
	sell_count = arr[0] - 1;
	ll P = 2;	
	for(ll i = 1; i < N; i++ ){
		
		if(arr[i] == P){
			P++;
			continue;
		}
	
		ll s_c;
		if(arr[i] % P == 0 ){
			s_c = arr[i] / P - 1;
		}else{
			s_c = arr[i] / P;
		}
		sell_count += s_c;
	}

	cout<<sell_count<<endl;
	
	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod2 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2e9

int ans[200011];

string dtob(int num,int rlen)
{
    string r="";
    while(num>0)
    {
        r=to_string(num%2)+r;
        num/=2;
    }
    int rem=rlen-r.length();
    string t(rem,'0');
    return t+r;
}

int func(string s)
{
    int ans=0;
    for(int i=0;i<s.length();i++)
        if(s[i]=='1')
            ans+=1;
    return ans;
}

int main()
{
    ans[0]=0;
    for(int i=1;i<=200010;i++)
    {
        int cnt=func(dtob(i,20));
        ans[i]=1+ans[i%cnt];
    }
    int n;
    string x;
    cin >> n >> x;
    int cnt=func(x);
    vector<int>v1(n),v2(n),v3(n,0),v4(n,0);
    int p=1;
    for(int i=n-1;i>-1;i--)
    {
        if(x[i]=='1')
        {
            v1[i]=p;
            v2[i]=0;
        }
        else
        {
            v1[i]=0;
            v2[i]=p;
        }
        p=(p*1LL*2)%(cnt+1);
    }
    p=1;
    if(cnt-1>0)
    {
        for(int i=n-1;i>-1;i--)
        {
            if(x[i]=='1')
            {
                v3[i]=p;
                v4[i]=0;
            }
            else
            {
                v3[i]=0;
                v4[i]=p;
            }
            p=(p*1LL*2)%(cnt-1);
        }
    }
    int sum1=0,sum2=0;
    for(int i=0;i<n;i++)
        sum1=(sum1*1LL+v1[i])%(cnt+1);
    if(cnt>1)
    {
        for(int i=0;i<n;i++)
            sum2=(sum2*1LL+v3[i])%(cnt-1);
    }
    //cout << sum1 << " " << sum2 << endl;
    for(int i=0;i<n;i++)
    {
        if(x[i]=='0')
        {
            int temp=(sum1*1LL-v1[i]+v2[i])%(cnt+1);
            temp=(temp+cnt+1)%(cnt+1);
            //cout << "temp=" << temp << endl;
            cout << 1+ans[temp] << endl;
        }
        else
        {
            if(cnt-1==0)
                cout << "0" << endl;
            else
            {
                int temp=(sum2*1LL-v3[i]+v4[i])%(cnt-1);
                temp=(temp+cnt-1)%(cnt-1);
                cout << 1+ans[temp] << endl;
            }
        }
    }
}

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



int main() {
    int N;
    cin>>N;
    vector<int> l(N);
    rep(i,N){cin>>l.at(i);}
    sort(l.begin(),l.end());
    int count=0;
    rep(i,N-2){
        for(int j=i+1;j<N-1;j++){
            int ne=l.at(i)+l.at(j);
            int k;
            k=lower_bound(l.begin(),l.end(),ne)-l.begin()-1;
            if(k>j){count+=k-j;}
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, x, sum, val, ans;
int main() {
	scanf("%d %d", &n, &x);
	ans = 1;
	for (int i = 0; i < n; i++) {
		scanf("%d", &val);
		sum += val;
		if (sum <= x) {
			ans++;
		}
	}
	printf("%d\n", ans);
}

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

int main(){
    int h,w,n;
    cin >> h >> w >> n;
    int m=max(h,w);
    if(n%m==0) cout << n/m << endl;
    else cout << n/m+1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
 string s;
 int c2=0,c=0,i;
   cin>>s;
   for(i=0;i<3;i++)
   {
   	if(s[i]=='A')
   	{
   		c++;
   	}else if(s[i]=='B')
   	{
   		c2++;

   	}
   }
   if(c!=0&&c2!=0)
   {
   	cout<<"Yes"<<endl;
   }else
   {
   	cout<<"No"<<endl;
   }
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

// i桁/和j/k以下確定
long long dp[10010][110][2];
int main(){
    string K; cin>>K;
    int digit=K.size();
    int n; cin>>n;
    dp[0][0][0]=1;
    for(int i=1;i<=digit;i++){
        int nn=K[i-1]-'0';
        for(int j=0;j<n;j++){
            for(int k=0;k<2;k++){
                // 確定してたら上限固定
                for(int d=0;d<=(k?9:nn);d++){
                    // 確定更新
                    dp[i][j][k||(d<nn)]+=dp[i-1][mod(j-d,n)][k];
                    dp[i][j][k]%=MOD;
                }
            }
        }
    }
    cout<<mod(dp[digit][0][0]+dp[digit][0][1]-1,MOD)<<endl;
    return 0;
}


Measured memory_bytes: 17408
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;

ll T[MAX_N];

int main() {
    ll N, C, K;
    cin >> N >> C >> K;
    rep(i, N){ cin >> T[i]; }

    ll t = -1;
    ll c = 0;
    ll ret = 0;

    sort(&T[0], &T[N]);

    rep(i, N){cerr << T[i] << " ";}
    cerr << endl;

    rep(i, N){
        if (t == -1){t = T[i];}

        if ( (T[i] > t + K) ){
            ret++;
            t = T[i];
            c = 0;
        }

        c++;

        if (c >= C){
            // cerr << T[i] << " " << c << endl;
            ret++;
            t = -1;
            c = 0;
        }
    }
    if (c > 0) ret++;

    cout << ret << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.141592653589793
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);


  double a,b,x;
  cin>>a>>b>>x;

  double s=a*a*b;
  if(s/2<x){
    double l=0,r=90;
    int t=1000;
    while(t--){
      double m=(l+r)/2;
      double p=M_PI;
      p*=m/180;
      double u=tan(p);
      
      u*=a*a*a;
      u/=2;
      if(u<s-x) l=m;
      else r=m;
    }
    cout<<l<<endl;
  }else{
    double l=0,r=90;
    int t=1000;
    while(t--){
      double m=(l+r)/2;
      double p=M_PI;
      p*=m/180;
      double u=tan(p);
      u*=b*b*a;
      u/=2;
      if(u>x) r=m;
      else l=m;
    }
    //cout<<l<<' '<<r<<endl;
    cout<<90-l<<endl;
  }
}
 


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

const int maxi=3002;
int N;
double dp[maxi][maxi];
double p[maxi];
int vis[maxi][maxi];

double solve(int h,int n)
{
    if(h<0)
    return 0;
    if(n==0)
    {
        if(h==0)
        return 1;
        else
        return 0;
    }
    if(vis[h][n]==1)
    return dp[h][n];
    vis[h][n]=1;
    dp[h][n]=(1.0-p[n])*solve(h,n-1)+(p[n])*solve(h-1,n-1);
    return dp[h][n];
}


int main()
{
  cin>>N;
  //cout<<N<<"\n";
  for(int i=1;i<=N;i++)
  cin>>p[i];
  int t=N/2+1;
  double total=0.0;
  //cout<<t<<"\n";
  for(int i=t;i<=N;i++)
  {total+=solve(i,N);}//cout<<total<<"\n";
  printf("%.10lf\n",total);
}

Measured memory_bytes: 105728
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif

// -------------------------------------Code starts here---------------------------------------------------------------------     

   int n,d,a;
   cin>>n>>d>>a;
   pair<int,int>p[n];
   int x,y;
   for(int i=0;i<n;i++)
   {
      cin>>x>>y;
      long double z=y,xx=a;
      y=ceil(z/xx);
      p[i].first=x;
      p[i].second=y;
   }
   sort(p,p+n);
   set<pair<int,int> >s;
   set<pair<int,int> >ind;
   int ans=0;
   int z=0;
   for(int i=0;i<n;i++)
   {
      while(ind.size()!=0)
      {
         if(ind.begin()->first+d<p[i].first)
            {
               z-=ind.begin()->second;
               // s.erase({ind.begin()->second,ind.begin()->first});
               ind.erase(ind.begin());
            }
            else
            {
               break;
            }            
      }
      if(p[i].second>z)
      {
         ind.insert({p[i].first+d,p[i].second-z});         
         // s.insert({p[i].second-z,p[i].first+d});
         ans+=p[i].second-z;
         z+=p[i].second-z;
      }
      // cout<<z<<'\n';
      // cout<<ind.begin()->first<<'\n';
   }
   cout<<ans;

// -------------------------------------Code ends here------------------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
    clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }

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

int main()
{
    int r, c;
    cin >> r >> c;
    int a[r][c], sum_r, sum_c[c], sum_total=0;
    
    for(int i=0;i<c;i++)
    {
        sum_c[i] = 0;
    }
    
    for(int i=0;i<r;i++)
    {
        sum_r = 0;
        for(int j=0;j<c;j++)
        {
            cin >> a[i][j];
            sum_r += a[i][j];
            sum_c[j] += a[i][j];
        }
        for(int j=0;j<c;j++)
        {
            cout << a[i][j] << " ";
        }
        cout << sum_r << endl;
    }
    for(int i=0;i<c;i++)
    {
        cout << sum_c[i] << " ";
        sum_total += sum_c[i];
    }
    cout << sum_total << endl;
    return 0;
}



Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int N, L, T;

int next(int a) {
    if (a == N-1) return 0;
    else return a+1;
}

int prev(int a) {
    if (a == 0) return N-1;
    else return a-1;
}

int dist(int a, int b) { //座標aから座標bへ時計回りにみた距離
    if (a <= b) return b-a;
    else return L-(a-b);
}

int meet_time(int dist) {
    if (T < dist/2.) return 0;
    else {
        int cnt=1;
        double first_meet = dist/2.;
        double remain = T - first_meet;
        cnt += floor(remain / (L/2.));
        return cnt;
    }
}

int X[100000 + 10];
int W[100000 + 10];

signed main() {
    vi last_pos;
    cin >> N >> L >> T;
    rep(i, N) {
        cin >> X[i] >> W[i];
        if (W[i] == 1) last_pos.pb((X[i] + T) % L);
        else last_pos.pb((X[i] + L * (int)1e10 - T) % L);
    }
    int last;
    if (W[0] == 1) { //時計回り
        int encount=0;
        Rep(i, 1, N) {
            if (W[i] == 2) {
                encount += meet_time(dist(X[0], X[i]));
                // cout << "encount:" << encount << endl;
            }
        }
        // cout << encount << endl;
        last = encount % N;
        // cout << last << endl;
    } else { //反時計回り
        int encount=0;
        Rep(i, 1, N) {
            if (W[i] == 1) {
                encount += meet_time(dist(X[i], X[0]));
                // cout << encount << endl;
            }
        }
        // cout << encount << endl;
        last = ((N * (int)1e10) - encount) % N;
        // cout << last << endl;
    }
    
    int final_idx = last;
    // cout << "final_idx:" << final_idx << endl;
    int final_pos = last_pos[0];
    // cout << "final_pos:" << final_pos << endl;
    sort(all(last_pos));
    int new_pos;
    if (W[0] == 1) { //時計回り
        rev(i, N) {
            if (last_pos[i] == final_pos) {
                new_pos = i;
                break;
            }
        }
    } else {
        rep(i, N) {
            if (last_pos[i] == final_pos) {
                new_pos = i;
                break;
            }
        }
    }
    // cout << "new_pos:" << new_pos << endl;
    int k = (new_pos + (N * (int)1e10) - final_idx) % N;
    rep(i, N) {
        cout << last_pos[k] << endl;
        k = next(k);
    }
    
    return 0;
}

Measured memory_bytes: 3700
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
vector<int> dx = {-1, -1, -1, 0, 0, 1, 1, 1};
vector<int> dy = {-1, 0, 1, -1, 1, -1, 0, 1};

int main () {
    string s, t; cin >> s >> t;
    int n = s.size();
    int ans = 0;
    rep(i, n) {
        if (s[i] != t[i]) ans++;
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 3856
N = int(input())
count = 0
T, X, Y = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    if abs(x-X)+abs(y-Y) <= t-T and t % 2 == (x+y) % 2:
        count += 1
    T, X, Y = t, x, y
print("Yes" if count == N else "No")

Measured memory_bytes: 3060
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void) {
	int n;cin >> n;
	vector<int> a(n+2);
	a[0]=0;a[n+1]=0;
	for(int i=1; i<=n; i++){
		cin >> a[i];
	}
	int ans=0;
	for(int i=1; i<=n+1; i++){
		ans+=abs(a[i]-a[i-1]);
	}
	for(int i=1; i<=n; i++){
		cout << ans+abs(a[i+1]-a[i-1])-abs(a[i]-a[i-1])-abs(a[i+1]-a[i]) << endl;
	}
	return 0;
}


Measured memory_bytes: 1664
from bisect import bisect_left
N = int(input())
L = [int(x) for x in input().split()]
L.sort()
ans = 0
for a in range(N-2):
    for b in range(a+1, N-1):
        ans += bisect_left(L[b+1:], L[a]+L[b])
print(ans)

Measured memory_bytes: 50780
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <cmath>
#include <sstream>
#include <queue>
#include <map>
#include <cstring>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
    int x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double a = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    double b = sqrt((x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2));
    double c = sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3));
    if (a > b) {
        swap(a, b);
    }
    if (b > c) {
        swap(b, c);
    }
    double A = acos((a * a + c * c - b * b) / 2 / a / c);
    double B = acos((b * b + c * c - a * a) / 2 / b / c);
    printf ("%.10lf\n", c / (1 / tan(A / 2) + 1 / tan(B / 2) + 2));
    return 0;
}


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

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

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

int main(){
    string S;
    int N;
    cin>>N>>S;
    if(N%2==0){
        N/=2;
        string a=S.substr(0,N);
        string b=S.substr(N,N);
        if(a==b)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

//a=97,z=122

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define PII pair<int,int>
#define ls x<<1
#define rs x<<1|1
#define fi first
#define se second
#define pb push_back
#define cwk freopen("D:\\c++\\in.txt","r",stdin),freopen("D:\\c++\\out.txt","w",stdout)
using namespace std;
const int N=1e6+10;
int n;
char s[N];
int arr[N];
vector<int>pos[3];
ll js(int a,int b,int c) {
	ll gs=0;
	int mx=pos[c].size();
	for(int u:pos[a]) {
		for(int v:pos[b]) {
			if(v<u) continue;
			int p=upper_bound(pos[c].begin(),pos[c].end(),v)-pos[c].begin();
			gs+=mx-p;
			if(2ll*v-u<=n&&arr[2ll*v-u]==c) gs--;
		}
	}
	return gs;
}
int main()
{
	//cwk;
	scanf("%d",&n);
	scanf("%s",s+1);
	for(int i=1;i<=n;i++) {
		if(s[i]=='R') arr[i]=0,pos[0].pb(i);
		if(s[i]=='G') arr[i]=1,pos[1].pb(i);
		if(s[i]=='B') arr[i]=2,pos[2].pb(i);
	}
	ll ans=0;
	ans+=js(0,1,2);
	ans+=js(0,2,1);
	ans+=js(1,0,2);
	ans+=js(1,2,0);
	ans+=js(2,0,1);
	ans+=js(2,1,0);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3812
import java.util.Arrays;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] items = new int[N];

        for (int i = 0; i < N; i ++) {
        	items[i] = sc.nextInt();
        }

        sc.close();

        Arrays.sort(items);

        double sum = items[0];
        int item;
        for (int i = 0 ; i < N-1 ; i++ ) {
        	item = items[i+1];
        	sum = (sum + item) / 2 ;
        }

        System.out.println(sum);



    }
}

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

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

  vector<int> C(26);
  for (int i = 0; i < 26; i++) cin >> C.at(i);

  vector<vector<int>> S(D, vector<int>(26));
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < 26; j++) cin >> S.at(i).at(j);
  }

  vector<int> T(D);
  for (int i = 0; i < D; i++) {
    cin >> T.at(i);
    T.at(i)--;
  }

  vector<int> L(26);

  for (int d = 0; d < D; d++) {
    int type = 0;
    long long score = 0;

    // d 日目に i を開くとしたとき
    for (int i = 0; i < 26; i++) {
      long long tmp = 0;
      tmp += S.at(d).at(i);
      for (int j = 0; j < 26; j++) {
        if (j == i) continue;
        tmp -= C.at(j) * (d+1 - L.at(i));
      }
      if (score > tmp) {
        score = tmp;
        type = i;
      }
    }

    for (int i = 0; i < 26; i++) {
      if (i == type) L.at(i) = 0;
      else L.at(i)++;
    }

    cout << type + 1 << endl;
  }
}


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

using namespace std;

int main(int argc, char *argv[]) {
    int k;
    cin >> k;
    string s;
    cin >> s;
    if (s.size() <= k) {
        cout << s << endl;
    } else {
        cout << s.substr(0, k) + "..." << endl;
    }
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    string s;
    cin >> s;
    int n = s.size();

    string res = "";
    char las = s[n-1];

    res += s[0];
    res += to_string(n-2);
    res += las;

    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.io.PrintStream;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
	static boolean debug = true;
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		String str=sc.nextLine();
		if(str.matches("A?KIHA?BA?RA?"))
			System.out.println("YES");
		else{
			System.out.println("NO");
		}
			
	}

}

Measured memory_bytes: 23636