akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] In = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int n = In[0];
            int t = In[1];
            int INF = 1001001001;
            int min = INF;
            for(int i=0; i < n; i++)
            {
                int[] In2 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                if (In2[1] <= t) min = (int)Math.Min(min, In2[0]);
            }
            if (min == INF) Console.WriteLine("TLE");
            else Console.WriteLine(min);
        }
    }
}


Measured memory_bytes: 28048
m1097 = 1000000007

main = do
  [n, m] <- map read . words <$> getLine
  putStrLn . show $ solve n m

solve:: Int -> Int -> Int
solve n m
  | n == m = mu poN $ mu poN 2
  | abs (n - m) /= 1 = 0
  | otherwise = mu poN $ po m
  where
    poN = po n

po 0 = 1
po a = mu a $ po (a - 1)

mu a b = mod ((mod a m1097) * (mod b m1097)) m1097


Measured memory_bytes: 3068
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;i++)

int main()
{
	ull x;
	cin >> x;
	ull ans = 0;
	ull n = 100;
	while (n<x)
	{
		ans++;
		n +=n/100;
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pll;
const int N = 1e5 + 5;
int n, m, h[N];
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for(int i = 1;i <= n;++i)
        cin >> h[i];
    set<int>st;
    while(m--)
    {
        int u, v;
        cin >> u >> v;
        if(h[u] >= h[v])    st.insert(v);
        if(h[u] <= h[v])    st.insert(u);
    }
    cout << n - st.size();
    return 0;
}


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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/f.in", "r", stdin);
//  freopen("../IO/f.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}

const int MAX = 500000 + 25;

struct Query
{
  int l, r, idx;
};

bool cmp(Query x, Query y)
{
  return x.r < y.r;
}

void update(int idx, int val, int bit[], int n)
{
  for (; idx <= n; idx += idx&-idx)
    bit[idx] += val;
}

int query(int idx, int bit[], int n)
{
  int sum = 0;
  for (; idx>0; idx-=idx&-idx)
    sum += bit[idx];
  return sum;
}

void answeringQueries(int arr[], int n, Query queries[], int q) {
  // initialising bit array
  int bit[n + 1];
  memset(bit, 0, sizeof(bit));

  // holds the rightmost index of any number
  // as numbers of a[i] are less than or equal to 10^6
  int last_visit[MAX];
  memset(last_visit, -1, sizeof(last_visit));

  // answer for each query
  int ans[q];
  int query_counter = 0;
  for (int i = 0; i < n; i++) {
    // If last visit is not -1 update -1 at the
    // idx equal to last_visit[arr[i]]
    if (last_visit[arr[i]] != -1)
      update(last_visit[arr[i]] + 1, -1, bit, n);

    // Setting last_visit[arr[i]] as i and updating
    // the bit array accordingly
    last_visit[arr[i]] = i;
    update(i + 1, 1, bit, n);

    // If i is equal to r of any query  store answer
    // for that query in ans[]
    while (query_counter < q && queries[query_counter].r == i) {
      ans[queries[query_counter].idx] =
        query(queries[query_counter].r + 1, bit, n) -
        query(queries[query_counter].l, bit, n);
      query_counter++;
    }
  }

  // print answer for each query
  for (int i = 0; i < q; i++)
    cout << ans[i] << endl;
}

int a[MAX];
Query queries[MAX];
void solve(std::istream &in, std::ostream &out) {
  int n, m;
  in >> n >> m;
  for (int i = 0; i < n; ++i) {
    in >> a[i];
  }
  for (int i = 0; i < m; ++i) {
    in >> queries[i].l >> queries[i].r;
    --queries[i].l;
    --queries[i].r;
    queries[i].idx = i;
  }
  sort(queries, queries+m, cmp);
  answeringQueries(a, n, queries, m);
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

using namespace std;

#define MAX_N 100005

int N;
LL K;
LL List[MAX_N];

int main()
{
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    LL a, b;
    cin >> a >> b;
    List[a] += b;
  }

  for (int i = 0; i < MAX_N; i++) {
    if(List[i] == 0){
      continue;
    }

    K -= List[i];
    if(K <= 0){
      cout << i << endl;
      return 0;
    }

  }


  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
vll adj[MAX];
bool vis[MAX];
void dfs(ll cur)
{
    if(!vis[cur])
    {
        vis[cur] = 1;
        for(auto x : adj[cur])
            dfs(x);
    }
}
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll n, m, i;
    cin >> n >> m;
    ll u, v;
    ll x;
    for(i = 0; i < m; i++)
    {
        cin >> u >> v >> x;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    ll ans = 0;
    for(i = 1; i <= n; i++)
    {
        if(!vis[i])
            dfs(i), ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 30080
#include<stdio.h>
int main(void)
{
	int num;
  int i = 0 ;

  while(1)
    {
      ++i;

      scanf("%d", &num);
      if( num == 0)
    break;

      printf("Case %d: %d\n", i, num);

    }

	return 0;
}

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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

constexpr int INF = 1e9;
//constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;


vector<int> memo(2*1e5+5, -1);

int solve(int n){
  if(memo[n] != -1){
    return memo[n];
  }
  int pcnt = 0;
  REP(i, 30){
    if(n >> i & 1){
      pcnt++;
    }
  }
  return memo[n] = (solve(n%pcnt) + 1);
}

int main(){
  memo[0] = 0;
  int N;
  cin >> N;
  string S;
  cin >> S;

  int pcnt = 0;
  int X = 0;
  int beki = 1;
  REP(i, min(N, 17)){
    if(S[N-1- i] == '1'){
      X += beki;
    }
    beki *= 2;
  }
  REP(i, N){
    if(S[i]=='1'){
      pcnt++;
    }
  }

  int modm = pcnt-1, modp = pcnt+1;
  vector<int> bekim(N+1, 0), bekip(N+1, 0);
  int summ = 0, sump = 0;
  if(modm != 0){
    beki = 1;
    REPR(i, N-1){
      bekim[i] = beki;
      if(S[i] == '1'){
        summ += beki;
        summ %= modm;
      }
      beki *= 2;
      beki %= modm;
    }
  }

  beki = 1;
  REPR(i, N-1){
    bekip[i] = beki;
    if(S[i] == '1'){
      sump += beki;
      sump %= modp;
    }
    beki *= 2;
    beki %= modp;
  }

  // cout << "modm:" << modm << " modp:" << modp << endl;
  // cout << "summ:" << summ << " sump:" << sump << endl;
  REP(i, N){
    int ans = 1;
    int Y;
    if(S[i] == '1' && modm != 0){
      pcnt--;
      S[i] = '0';
      Y = summ - bekim[i];
      if(Y < 0){
        Y += modm;
      }
      Y %= modm;
    }
    else if(S[i] == '1' && modm == 0){
      cout << 0 << endl;
      continue;
    }
    else{
      pcnt++;
      S[i] = '1';
      Y = sump + bekip[i];
      Y %= modp;
    }
    if(Y == 1 && pcnt == 1 && S[N-1] == '1'){
      ans = 0;
    }

    // cout << "Y:" << Y << " ";
    if(Y == 0 && pcnt == 0){
      ans = 0;
    }
    else if(S[i] == '0'){
      ans = solve(Y % modm) + 1;
    }
    else{
      ans = solve(Y % modp) + 1;
    }
    cout << ans << endl;
    if(S[i] == '0'){
      S[i] = '1';
      pcnt++;
    }
    else{
      S[i] = '0';
      pcnt--;
    }
  }
  return 0;
}


Measured memory_bytes: 5936
#ABC129B - Balance
N = int(input())
W = list(map(int,input().split()))
#W.sort()
half = sum(W)/2
S = 0
ans = []
for i in range(N):
    S += W[i]
    if S > half:
        x = i
        break
ans.append(sum(W[0:x+1])-(sum(W)-sum(W[0:x+1])))
ans.append((sum(W)-sum(W[0:x]))-sum(W[0:x]))
print(min(ans))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  int n;
  cin >> n;

  string s;
  cin >> s;

  int r = count(s.begin(), s.end(), 'R');
  int b = count(s.begin(), s.end(), 'B');

  cout << (r > b ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 256
def main():
    str = input()
    str_list = [int(num) for num in list(str)]
    one_counter = 0

    for number in str_list:
        if number == 1:
            one_counter += 1

    zero_counter = len(str_list) - one_counter
    more = zero_counter if zero_counter < one_counter else one_counter
    print(2 * more)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4724
#include<bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define READ freopen("in.txt","r",stdin)
#define WRITE freopen("out.txt","w",stdout);
#define pb push_back
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define sf(x) scanf("%d",&x)
#define sf2(x,y) scanf("%d %d",&x,&y)
#define sf3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sl2(x,y) scanf("%lld %lld",&x,&y)
#define sl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define sd(x) scanf("%lf",&x);
#define pii pair<int,int>
#define pLL pair<long long,long long>
#define ff first
#define sn second
#define PRINT_CASE  printf("Case %d: ",tc++)
#define PRINT_CASENL  printf("Case %d:\n",tc++)
#define mx 100005
#define lnd tree[ind<<1]
#define rnd tree[(ind<<1)+1]
#define cnd tree[ind]
#define lndp b,(b+e)>>1,(ind<<1)
#define rndp ((b+e)>>1)+1,e,(ind<<1)+1
#define IN(a,x,y) (a>=x && a<=y)
typedef long long ll;
typedef long long int lln;
ll INF=1<<28;
//typedef long long lld;
const double pi=acos(-1.0);
int fx[]={1,-1,0,0}; //direction array
int fy[]={0,0,1,-1};
int dir[4][2]={1,0,-1,0,0,-1,0,1};
const long double EPS=1e-7;
//#define INF 10000
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}

bool cmp(int a, int b)
{
    return a<b;
}

struct compare
{
  bool operator()(const int& l, const int& r)
  {
      return l>r;
  }
};
ll inf=1e18;
vector<int>G[200000];
int vis[200000];
int tim=0;
int color;
int dp[200000];
int dfs(int node)
{
    if(dp[node]!=-1)
        return dp[node];
    int countt=1;
    for(int i=0;i<G[node].size();i++)
    {
        countt=max(countt,1+dfs(G[node][i]));
    }
    return dp[node]=countt;

}
int main()
{
//    READ;
    mem(dp,-1);
    int n,m,x,y;
    sf2(n,m);
    for(int i=0;i<m;i++)
    {
        sf2(x,y);
        G[x].pb(y);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        ans=max(ans,dfs(i));
    }
    cout<<ans-1<<endl;
    return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
    long long k; cin >> k;
    if (k % 2 == 0 || k % 5 == 0){
        cout << -1 << '\n';
        return 0;
    }
    if (k % 7 == 0){
        k /= 7;
    }
    k *= 9;
    if (k == 9){
        cout << 1 << '\n';
        return 0;
    }
    long long cnt = 1;
    long long hehe = 10;
    while (hehe != 1){
        hehe *= 10;
        hehe %= k;
        cnt++;
    }
    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 3644
n = int(input())

s = n*(n+1)/2
s3 = (3/2)*(n//3)*(1+(n//3))
s5 = (5/2)*(n//5)*(1+(n//5))
s15 = (15/2)*(n//15)*(1+(n//15))

ans = int(s-s3-s5+s15)

print(ans)

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

using namespace std;

struct Edge
{
	int u, v, c;	

	Edge() {}
	Edge(int x, int y, int z) : u(x), v(y), c(z) {}
};

vector<Edge> res;

int L, N, M;

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> L;
	for (int i = 1; i < 19; i++)
	{
		res.emplace_back(Edge(i, i + 1, 1 << (i - 1)));	
		res.emplace_back(Edge(i, i + 1, 0));
	}
	int cur = L;
	for (int i = 19; i > 0; i--)
	{
		while (L >= (1 << i - 1))
		{
			res.emplace_back(Edge(i, 20, cur - L));
			L -= (1 << i - 1);
		}
	}
	N = 20, M = res.size();
	cout << N << " " << M << endl;
	for (int i = 0; i < M; i++)
		cout << res[i].u << " " << res[i].v << " " << res[i].c << endl;	
	return 0;	
}


Measured memory_bytes: 256
// trace works only with c++ 14

#include<bits/stdc++.h>

using namespace std;

//#pragma comment (linker, "/STACK:256000000")

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}

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

#define all(a) a.begin(), a.end()
#define endl '\n'
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define boost  ios_base::sync_with_stdio(false);
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

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

const int mod = 1e9 + 7 ;
ll powmod(ll a,ll b) {ll res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
ll gcd(ll a , ll b){return a==0?b:gcd(b%a,a);}
/*---------------------------------------------------------------------------------------------------------------------*/
const int maxn = 100010;
const int inf = 2000000020;

int solve(int x, int y) {
	if (y < x) {
		return inf;
	}
	int ans = y - x;
	return ans;
}

int main() {
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int x, y;
	// while (1) {
	scanf("%d %d", &x, &y);
	int ans = min(solve(x, y), min(1 + solve(-x, y), min(2 + solve(-x, -y), 1 + solve(x, -y))));
	printf("%d\n", ans);
	// }
	cin.get();
	cin.get();
	cin.get();

    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = []
t = []
for _ in range(n):
	ts,tt=map(str,input().split())
	s.append(ts)
	t.append(int(tt))
x = input()
cond = 0
ans = 0
for i in range(n):
	if s[i] == x:
		cond = 1
		continue
	if cond == 0:
		continue
	ans += t[i]

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll,pair<ll, ll>> lpll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;

#define deg_to_rad(deg) (((deg)/360)*2*PI)

const ll LINF = LLONG_MAX;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;

const ld PI = (acos(-1));
const ld EPS = 0.0000000001;
// cout << fixed << setprecision(10) << middle << endl;

int main() {
    // input, ready
    int A,B;
    cin >> A >> B;

    if (A<B) swap(A,B);
    int ans =A;
    A--;
    if (A<B) swap(A,B);
    ans +=A;

    // output
    cout << ans << endl;

    return 0;
}


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

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int h, w;
    cin >> h >> w;
    map<int, int> row, col;
    char grid[h + 1][w + 1];
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            cin >> grid[i][j];
            if(grid[i][j] == '.'){
                row[i]++;
                col[j]++;
            }
        }
    }
    for(int i = 1; i <= h; i++){
        if(row[i] != w){
            for(int j = 1; j <= w; j++){
                if(col[j] != h){
                    cout << grid[i][j];
                }
            }
            cout << nl;
        }
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
     long long int n;
     cin>>n;
    long long  int a[n+5];
     long long int arr[1000000]={0};
     for(long long int i=0;i<n-1;i++){
     	cin>>a[i];
     	arr[a[i]]++;
     }
     for(long long int i=1;i<=n;i++){
        cout<<arr[i]<<endl;
     }
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<N;i++)
using namespace std;
long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;

int main(){
 int N;
 cin>>N;
 long long x[N];
 long long y[N];
 rep(i,N){
     cin>>x[i]>>y[i];
 }
map<pair<long long,long long> ,int>mp;
 for(int i=0;i<N;i++){
     for(int k=0;k<N;k++){
         if(i==k)continue;
        long long dx=x[i]-x[k];
        long long dy=y[i]-y[k];
        mp[make_pair(dx,dy)]++;
     }
 }
auto iter=mp.begin();
long long ans=0;
while(iter!=mp.end()){
    long long p=iter->second;
    ans=max(ans,p);
    iter++;
}
cout<<N-ans<<endl;
 return 0;
}
/*

by myself

first 33m17s
second 6m39s

2
1 1
2 2

1

3
1 4
4 6
7 8

1


4
1 1
1 2
2 1
2 2

2
*/

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define NMAX 110000
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
typedef long long ll;


int main()
{
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	string S;
	cin >> S;

	bool success = true;
	for(int i=a; i<c; i++){
		if(S[i]=='#' && S[i+1]=='#'){
			success = false;
		}
	}

	for(int i=b; i<d; i++){
		if(S[i]=='#' && S[i+1]=='#'){
			success = false;
		}
	}

	if(c>d){
		if(S[d-2]=='#'){
			success = false;
			for(int i=b-2;i<=d-4;i++){
				if((S[i]=='.'&&S[i+1]=='.'&&S[i+2]=='.')) success = true;
			}
		}
	}

	if(success) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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

ll a[400000];
int main() {
	ll n; cin >> n;
	rep(i, 3 * n) {
		scanf("%lld", &a[i]);
	}
	sort(a, a + 3 * n);
	ll sum = 0;
	for (int i = n; i < 3 * n; i += 2)sum += a[i];
	printf("%lld\n", sum);
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int a,b;
    int n;
    while (cin>>a>>b>>n) {
        int sum=0;
        if (a<b) {
            for (int i=0;i<n;i++) {
                if (a/b==0) {
                    a*=10;
                    int c=a/b;
                    sum+=c;
                    a=a-b*c;
                } else {
                    int d=a/b;
                    sum+=d;
                    a=a-b*d;
                }
            }
            cout<<sum<<endl;
        } else {
            for (int j=0;j<n+1;j++) {
                if (a/b==0) {
                    a*=10;
                    int c=a/b;
                    if (j!=0) {
                        sum+=c;
                    }
                    a=a-b*c;
                } else {
                    int d=a/b;
                    if (j!=0) {
                        sum+=d;
                    }
                    a=a-b*d;
                }
            }
            cout<<sum<<endl;
        }
    }
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

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

int main()
{
    int n;cin >> n;
    ll a[n];
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a,a+n);
    ll x = 0;
    ll y = 0;
    for(int i = n-1; i >= 1; i--){
        if(a[i] == a[i-1]){
            if(x == 0){
                x = a[i];
                i--;
            }else{
                y = a[i];
                break;
            }
        }
    }
    ll ans = x * y;
    cout << ans << endl;
    
}

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

int main(){
  int d, g; cin >> d >> g;
  vector<int> p(d), c(d);
  for(int i = 0; i < d; i++){
    cin >> p[i] >> c[i];
  }
  int ans = 1001001001;
  for(int i = 0; i < (1<<d); i++){
    int sum = 0, ins = 0, num = 0;
    for(int j = 0; j < d; j++){
      if(!(i & (1<<j))) ins = j;
      else{
        sum += (j+1)*100*p[j] + c[j];
        num += p[j];
      }
    }
    if(sum < g){
      if(sum + (ins+1)*100*(p[ins]-1) < g) continue;
      else num += ((g-sum)+((ins+1)*100-1))/((ins+1)*100);
    }
    ans = min(ans, num);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#define INF 10000000000000000
#define MOD 1000000007
using namespace std;


int main(){
    string s;
    cin >> s;
    int cost=700;
    for(int i=0; i<3; i++){
        if(s[i]=='o'){
            cost+=100;
        }
    }
    cout<<cost<<endl;
    return 0;
}


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

int main (){
    string A,op,B;
    cin >> A >> op >> B;
    std::istringstream ss1,ss2;
    ss1 =std::istringstream(A);
    ss2 =std::istringstream(B);
    int a,b;
    ss1 >> a;
    ss2 >> b;
    if (op == "+"){
        cout << a + b << endl;
    }else{
        cout << a - b << endl;
    }
}

Measured memory_bytes: 3600
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[][] a = new int[3][3];
        for(int i = 0; i<3; i++) {
            for(int j = 0; j<3; j++) {
                a[i][j] = sc.nextInt();
            }
        }

        for(int i = 0; i<=100; i++) {
            for(int j = 0; j<=100; j++) {
                for(int k = 0; k<=100; k++) {
                    if(a[0][0]-i ==  a[1][0] - j && a[1][0]-j ==  a[2][0] - k && a[2][0]-k ==  a[0][0] - i) {
                        if(a[0][1]-i ==  a[1][1] - j && a[1][1]-j ==  a[2][1] - k && a[2][1]-k ==  a[0][1] - i) {
                            if(a[0][2]-i ==  a[1][2] - j && a[1][2]-j ==  a[2][2] - k && a[2][2]-k ==  a[0][2] - i) {
                                System.out.println("Yes");
                                return;
                            }
                        }
                    }
                }
            }
        }
        System.out.println("No");

    }
}

Measured memory_bytes: 22356
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
#endif

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

ll mod = 1e9 + 7;

namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}
	ll poww(ll a, ll b) {
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}
	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

ll const maxn = 3e5 + 5;


signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	ll a, b; cin >> a >> b;
	ll c, d; cin >> c >> d;

	ll kek1 = (c + b - 1) / b;
	ll kek2 = (a + d - 1) / d;
	if (kek1 <= kek2) {
		cout << "Yes";
	} else {
		cout << "No";
	}


	return 0;
}

/*

*/

Measured memory_bytes: 3640
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

//エラトステネスの篩
const int N = 11000;
vector<bool> p(N, true);
void Eratosthenes() {
	p[0] = false;
	p[1] = false;
	rep(i, N)if (p[i])for (int j = i * 2; j < N; j += i)p[j] = false;
}

int main() {
	Eratosthenes();
	int n;
	while (cin >> n) {
		if (n == 0)break;

		int ans1, ans2;
		for (int i = n; i >= 1; i--) {
			if (p[i] && p[i - 2]) {
				ans1 = i - 2; ans2 = i;
				break;
			}
		}
		Cout2(ans1, ans2);
	}
}


Measured memory_bytes: 3016
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> V;

#define _ cin.tie(0);ios::sync_with_stdio(false);
string o,e;

int main(){ _;
  cin>>o>>e;
  REP(i,e.length())
    cout<<o[i]<<e[i];
  if(o.length()==e.length()+1)
    cout<<o[o.length()-1]<<endl;
  else
    cout<<"\n";

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long double n,m,d;scanf("%Lf%Lf%Lf",&n,&m,&d);
  long double ans = (n-d)*(1+(d!=0))*(m-1)/n/n;
  printf("%.8Lf\n",ans);
}

Measured memory_bytes: 256
import Control.Monad
import Data.List

check :: [[Int]] -> [Int] -> Bool
check a b = any f a
  where
    f = all (`elem` b)

check2 :: [[Int]] -> [Int] -> Bool
check2 a b = any f a'
  where
    a' = let p = concat a
          in [[p!!0, p!!4, p!!8], [p!!2, p!!4, p!!6]]
    f xs = all (\x -> x `elem` b) xs

main :: IO ()
main = do
    a <- replicateM 3 $ map read . words <$> getLine :: IO [[Int]]
    n <- readLn :: IO Int
    b <- map read . lines <$> getContents :: IO [Int]
    putStrLn $
        if check a b || check (transpose a) b || check2 a b
           then "Yes" else "No"

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

int n, a[100010];
long long s;

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]), s += a[i];
    }
    printf("%s\n", s & 1 ? "NO" : "YES");
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    set<string> S;
    string tmp;
    for(int i=0;i<N;i++){
        cin >> tmp;
        S.insert(tmp);
    }

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


    return 0;
}


Measured memory_bytes: 19180
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvld;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

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

    int N, W;
    cin >> N >> W;

    vi w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];

    const int MAX_V_SUM = 200000;

    vvll dp(N + 1, vll(MAX_V_SUM + 1, INF));
    dp[0][0] = 0;

    rep(i, N)
    {
        reple(j, 0, MAX_V_SUM)
        {
            chmin(dp[i + 1][j], dp[i][j]);
            if(j - v[i] >= 0) chmin(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
        }
    }

    for (int i = MAX_V_SUM; i >= 0; i--)
    {
        if (dp[N][i] <= W)
        {
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}

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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<float> v;
    float sum=0;
    for(int i=0;i<n;i++){
        int in;
        cin>>in;
        
        sum +=1.0/in;
    }
     cout<<1.0/sum<<endl;   
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

long long int kaijo(long long int);

int main()
{
	long long int n;

	scanf("%lld", &n);
	printf("%lld\n", kaijo(n));

	return 0;
}

long long int kaijo(long long int n)
{
	if(n==0 || n==1)
		return 1;
	else
		return n * kaijo(n-1);
}

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

int main(){
    ll k, d=2, u=2; cin >> k;
    ll a[k]; for(ll i =0 ; i < k; i++) cin >> a[i];
    for(ll i = k-1; i >= 0; i--){
        d = (d+a[i]-1)/a[i]; u = u/a[i];
        if(d > u){ cout << -1 << endl; return 0; }
        d *= a[i]; u *= a[i]; u += a[i]-1;
    }
    cout << d << " " << u << endl;
}

Measured memory_bytes: 4412
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (x).begin(),(x).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);

int n, p[101], q[101], r[101], b[101];

long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

long long lcm(long long a, long long b) {
	long long g = gcd(a, b);
	return a / g * b;
}

int check[200];

int calc(int i) {
	int rc = r[i] ? calc(r[i]) : 1;
	int bc = b[i] ? calc(b[i]) : 1;
	int num = lcm(p[i] * rc, q[i] * bc);
	return num / p[i] + num / q[i];
}

int main() {
	while (cin >> n&&n) {
		for (int i = 0; i < 200; i++)check[i] = 0;
		for (int i = 0; i < 101; i++)p[i] = q[i] = r[i] = b[i] = 0;
		for (int i = 1; i <= n; i++) {
			cin >> p[i] >> q[i] >> r[i] >> b[i];
			check[r[i]] = check[b[i]] = true;
		}
		for (int i = 1; i <= n; i++) {
			if (!check[i]) {
				cout << calc(i) << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main()
{
   // freopen("i.txt","r",stdin);
    string s1;
    int n,l;
    cin>>n>>l;
    vector <string> v;
    vector <string>:: iterator it;
    while(n--){
        cin>>s1;
        v.push_back(s1);
    }
    sort(v.begin(),v.end());
    string s2="";
    for(it=v.begin();it!=v.end();it++){
        s2+=*it;
    }
    cout<<s2<<endl;
    return 0;
}


Measured memory_bytes: 3636
import * as fs from 'fs';
// main
function main(input: string[]) {
    // param
    let n: bigint = 0n;
    let a: bigint = 0n;
    let b: bigint = 0n;
    let ans: string = "";
    // init
    [n, a, b] = input.shift().split(" ").map(x => BigInt(x));
    // solve
    let s = n % (a + b);
    let t = (n - s) / (a + b);
    let u = (a < s) ? a : s;
    ans = String(a * t + u).replace("n", "");
    // answer
    console.log(ans);
}
// entrypoint
function entrypoint() {
    try {
        // linux
        let input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            let input = lines;
            main(input);
        });
    }
}
entrypoint();


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

int main(){
    string s;
    cin >> s;
    vector<li> v;
    li white=0;
    for(li i=0;i<s.length();i++){
        if(s[i]=='W'){
            ++white;
            v.push_back(i);
        }
    }
    li k=0,total=0;
    while(white--){
        total+=(v[k]-k);
        ++k;
    }
    cout << total << endl;

}


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

using namespace std;
const int N = 300010;
const int INF = 0x3f3f3f3f;
int _w;

int n, pfe[N], pfw[N], sfe[N], sfw[N];
char s[N];

int main() {
	_w = scanf( "%d%s", &n, s+1 );
	for( int i = 1; i <= n; ++i ) {
		pfe[i] = pfe[i-1] + (s[i] == 'E');
		pfw[i] = pfw[i-1] + (s[i] == 'W');
	}
	for( int i = n; i >= 1; --i ) {
		sfe[i] = sfe[i+1] + (s[i] == 'E');
		sfw[i] = sfw[i+1] + (s[i] == 'W');
	}
	int ans = INF;
	for( int i = 1; i <= n; ++i )
		ans = min( ans, pfw[i-1] + sfe[i+1] );
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5248
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define st first
#define nd second

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>;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
#define shandom_ruffle random_shuffle
 
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(11);
	cerr << fixed << setprecision(6);

	int x;
	cin >> x;

	int ang = 0;
	for (int i = 1;; ++i) {
		ang += x;
		if (ang % 360 == 0) {
			cout << i << "\n";
			return 0;
		}
	}
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <sstream>
#include <vector>
#include <string>
#include <iomanip>
#include <bitset>
using namespace std;
#define INF	100000000
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define SS stringstream
#define rep(i,n) for(int i = 0; i < n; i++)
#define sz(x) ((int)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).begin(), (x).end(), greater<int>() )
#define clr(a,b) memset((a),(b),sizeof(a))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<P> Vp;
typedef priority_queue<P, vector<P>, greater<P> > PQ;

int h,m,s;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	while(cin >> h >> m >> s){
		int t;
		int a[3];
		if(h == -1 && m == -1 && s == -1) break;
		t = 120*60-h*3600-m*60-s;
		rep(i,2){
			a[0] = t/3600; a[1] = (t%3600)/60; a[2] = t%60;
			rep(j,3){
				if(j == 0){
					if(a[j] <= 9) cout << "0";
					cout << a[j];
				} else{
					cout << ":";
					if(a[j] <= 9) cout << "0";
					cout << a[j];
				}
			}
			cout << endl;
			t *= 3;
		}
	}
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
#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 pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
ll k;
const int maxx=1e8+10;
int vis[maxx];
int main() {
	memset(vis,0,sizeof(vis) );
	scanf("%lld",&k);
	int now=7,i;
	for(i=1,now=7%k;;i++){
		if(vis[now]==1){
			printf("-1");
			return 0;
		}
		if(now%k==0) {
			printf("%d",i);
			return 0;
		}
		vis[now]=1;		
		ll a=now%k;
		now=(a*10)%k+7;
	}
} 

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

using namespace std;

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

int main(){
  int k, a, b;
  cin >> k >> a >> b;
  cout << (a % k == 0 || a / k < b / k ? "OK" : "NG") << endl;
  return 0;
}

Measured memory_bytes: 3636
while True:
    num_length = int(input())
    if num_length==0:break
    eachwait = []
    wait = []
    for i in range(0, num_length):
        eachwait.append(int(input()))
    eachwait.sort()
    for i, num in enumerate(eachwait):
        wait.append(sum(eachwait[:i]))
    print(sum(wait))


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

int N;

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

const int LEAF = 0;
vector<P>pv;

class T{
public:
  int p,q,r,b;
  int par;
  T(){par = -1;}
};

vector<T>vec;

void init(){
  vec.clear();
  pv.clear();
}

void input(){

  for(int i = 0 ; i <= N ; i++){
    T t;
    vec.push_back(t);
  }

  for(int i = 1 ; i <= N ; i++){
    cin >> vec[i].p >> vec[i].q >> vec[i].r >> vec[i].b;
    ll gcd = __gcd(vec[i].p,vec[i].q);
    vec[i].p /= gcd;
    vec[i].q /= gcd;

    vec[vec[i].r].par = i;
    vec[vec[i].b].par = i;
  }
}

void dfs(int now,P p){

  if(now == LEAF){
    pv.push_back(p);
    return;
  }


  P np = P(p.first * vec[now].p,p.second * (vec[now].p + vec[now].q));
  ll gcd = __gcd(np.first,np.second);
  np.first /= gcd;
  np.second /= gcd;
  dfs(vec[now].b,np);

  np = P(p.first * vec[now].q,p.second * (vec[now].p + vec[now].q));
  gcd = __gcd(np.first,np.second);
  np.first /= gcd;
  np.second /= gcd;
  dfs(vec[now].r,np);
}

ll LCM(ll a,ll b){
  return a/__gcd(a,b)*b;
}

void solve(){
  init();
  input();
  int root;
  for(int i = 1 ; i <= N ; i++){
    if(vec[i].par == -1)root = i;
  }

  dfs(root,P(1,1));

  vector<ll>av;

  for(int i = 0 ; i < pv.size() ; i++){
    av.push_back(LCM(pv[i].first,pv[i].second)/pv[i].first);
  }

  ll res = 1;
  sort(av.begin(),av.end());
  for(int i = 0 ; i < av.size(); i++){
    res = LCM(res,av[i]);
  }
  cout << res << endl;
}

int main(){
  while(cin >> N,N)solve();
  return 0;
}

Measured memory_bytes: 1220
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
typedef long long          ll;
typedef unsigned long long ull;
using namespace std;

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
};

int main() {
    Setup();
    int a, b, c;
    cin >> a >> b >> c;
    int d = b / a;
    cout << min(d, c) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include "bits/stdc++.h"
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,Q;
	ll S[200001],T[200001],X[200001],D[200001];
	vpll sd;
	map<ll,ll> ban;
	ll ans[200001];
	scan(N>>Q);
	rep(i,N){
		scan(S[i]>>T[i]>>X[i]);
		S[i]-=X[i],T[i]-=X[i];
		sd.push_back(mp(S[i],i));
	}
	rep(i,Q){
		scan(D[i]);
		ban[D[i]]=i;
		sd.push_back(mp(D[i],INF));
	}
	sort(sd.begin(),sd.end());
	multiset<int> kojiX;
	priority_queue<pll, vector<pll>, greater<pll> > QTX;
	rep(i,sd.size()){
		ll jikan=sd[i].first;
		ll kind=sd[i].second;
		while(QTX.size()&&QTX.top().first<=jikan){
			ll x=QTX.top().second;
			QTX.pop();
			auto itr = kojiX.find(x);
			kojiX.erase(itr);
		}
		if(kind==INF){
			ll id=ban[jikan];
			if(kojiX.empty()){
				ans[id]=-1;
			}
			else{
				auto itr = kojiX.begin();
				ans[id]=*itr;
			}
		}
		else{
			ll x=X[kind];
			kojiX.insert(x);
			QTX.push(mp(T[kind],x));
		}
	}
	rep(i,Q){
		prin(ans[i]);
	}
	return 0;
}


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

int main() {
    int N; cin >> N;
    vector<int> a(N);
    int big = 0;
    int bignum = -1;
    rep(i, N){
        cin >> a[i];
        if(abs(a[i]) > abs(big)){
            big = a[i];
            bignum = i;
        }
    }

    if(bignum == -1){
        cout << 0 << endl;
        return 0;
    }

    cout << 2 * N - 1 << endl;
    for (int i = 1; i <= N; i++){
        cout << bignum+1 << " " << i << endl;
    }

    if(big > 0){
        for (int i = 1; i < N; i++){
            cout << i << " " << i+1 << endl;
        }
    } else {
        for (int i = N; i > 1; i--){
            cout << i << " " << i-1 << endl;
        }
    }

    return 0;
}

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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin>>s;

    int ans = 0;

    int t = s.size();
    t--;

    int i = 0;

    while(i < t) {
        if(s[i] != s[t]) ans++;
        i++;
        t--;
    }

    cout<<ans<<endl;


}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{
    public static void Main()
    {
        String input = Console.ReadLine();
        int A = int.Parse(input);
        A %= 10;
        if (A==2||A==4||A==5||A==7||A==9) { Console.WriteLine("hon"); }
        else if(A==3) { Console.WriteLine("bon"); }
        else { Console.WriteLine("pon"); }
    }
}

Measured memory_bytes: 27536