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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


int main() {
    int N; cin >> N;
    vector<int> A(N); cin >> A;
    vector<int> B = A;
    sort(all(B));
    rep(i, N) {
        cout << (A[i] == B.back() ? B[N - 2] : B[N - 1]) << endl;
    }
    return 0;
}


Measured memory_bytes: 3200
#include<iostream>
using namespace std;
int main(){
    int n, m, A[100][100], B[100], C[100];
    cin >> n >> m;
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            cin >> A[i][j];
        }
    }
    for(int j=0; j<m; j++){
        cin >> B[j];
    }
    
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            C[i] += A[i][j]*B[j];
        }
    }
    
    for(int i=0; i<n; i++){
        cout << C[i] <<endl;
    }
    
    return 0;
}


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

int main(){
    // あとで消す
    //std::ifstream in("ain3.txt");
    //std::cin.rdbuf(in.rdbuf());

    int H,A;
    cin >> H >> A;
    if(H%A){
        cout << H/A+1 << endl;
    }else{
        cout << H/A << endl;
    }
    

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,a,b,ans;
signed main(){
	scanf("%lld%lld%lld",&n,&a,&b);
	ans=n/(a+b)*a;
	ans+=min(a,n%(a+b));
	printf("%lld\n",ans);
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
   cin.tie(0);
   ios::sync_with_stdio(false);
   int h, w, n;
   cin >> h >> w >> n;
   int i = 0;
   while(1) {
       if(n<=max(h, w)*i) {
           cout << i << endl;
           return 0;
       }
       i++;
   }

}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

using Weight=long long;
static const Weight INF=1LL<<57;

template <class T>
using gp_queue=priority_queue<T, deque<T>, less<T>>;

struct Arc {
    // accessible to the reverse edge
    size_t src, dst;
    Weight capacity, cost, flow;
    size_t rev;
    Arc() {}
    Arc(size_t src, size_t dst, Weight capacity, Weight cost=0):
        src(src), dst(dst), capacity(capacity), cost(cost), flow(0), rev(-1)
    {}
    Weight residue() const {
        return capacity - flow;
    }
};

bool operator<(const Arc &e, const Arc &f) {
    if (e.cost != f.cost) {
        return e.cost > f.cost;
    } else if (e.capacity != f.capacity) {
        return e.capacity > f.capacity;
    } else {
        return e.src!=f.src? e.src<f.src : e.dst<f.dst;
    }
}

using Arcs=vector<Arc>;
using Node=vector<Arc>;
using FlowNetwork=vector<Node>;

void connect(FlowNetwork &g, size_t s, size_t d, Weight c=1, Weight k=0) {
    g[s].push_back(Arc(s, d, c, k));
    g[d].push_back(Arc(d, s, 0, -k));

    g[s].back().rev = g[d].size()-1;
    g[d].back().rev = g[s].size()-1;
}

void join(FlowNetwork &g, size_t s, size_t d, Weight c=1, Weight k=0) {
    g[s].push_back(Arc(s, d, c, k));
    g[d].push_back(Arc(d, s, c, k));

    g[s].back().rev = g[d].size()-1;
    g[d].back().rev = g[s].size()-1;
}

pair<Weight, Weight> mincost_flow(
    FlowNetwork &g, size_t s, size_t t, Weight F=INF
) {
    size_t V=g.size();
    vector<Arc *> prev(V, NULL);

    pair<Weight, Weight> total;  // <cost, flow>
    while (F > total.second) {
        vector<Weight> d(V, INF); d[s]=0;
        for (size_t i=0; i<V; ++i) {
            for (size_t v=0; v<V; ++v) {
                if (d[v] == INF) continue;
                for (Arc &e: g[v]) {
                    if (e.capacity <= 0) continue;

                    if (d[e.dst] > d[e.src] + e.cost) {
                        d[e.dst] = d[e.src] + e.cost;
                        prev[e.dst] = &e;
                    }
                }
            }
        }

        if (d[t] == INF) {
            total.first = -1;
            return total;
        }

        Weight f=F-total.second;
        for (Arc *e=prev[t]; e!=NULL; e=prev[e->src])
            f = min(f, e->capacity);

        total.second += f;
        total.first += f * d[t];
        for (Arc *e=prev[t]; e!=NULL; e=prev[e->src]) {
            e->capacity -= f;
            g[e->dst][e->rev].capacity += f;
        }
    }

    return total;
}

int main() {
    size_t V, E;
    Weight F;
    scanf("%zu %zu %lld", &V, &E, &F);

    FlowNetwork g(V);
    for (size_t i=0; i<E; ++i) {
        size_t u, v;
        Weight c, d;
        scanf("%zu %zu %lld %lld", &u, &v, &c, &d);

        connect(g, u, v, c, d);
    }

    printf("%lld\n", mincost_flow(g, 0, V-1, F).first);
    return 0;
}

Measured memory_bytes: 2836
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

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

const double INF = 1e16;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;

ll const MAX_N = 1e5 + 10;
bool done[MAX_N];

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;
}


int main() {
	ll i, j;
	ll N;
	cin >> N;
	vll A(N);
	for (auto& e : A)cin >> e;
	vll B(N, 0);
	for (i = N; i > 0; i--) {
		if (N / i == 1) {
			B[i - 1] = A[i - 1];
		}
		else {
			ll sum = 0;
			for (j = 2; i * j <= N; j++) {
				sum += B[i * j - 1];
			}
			if (sum % 2 == 0) {
				B[i - 1] = A[i - 1];
			}
			else {
				B[i - 1] = 1 - A[i - 1];
			}
		}
	}
	cout << accumulate(B.begin(), B.end(), 0LL) << endl;
	for (i = 1; i <= N; i++) {
		if (B[i - 1] == 1) {
			cout << i << " ";
		}
	}

	return 0;
}


Measured memory_bytes: 3968
/*
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,fma")
*/
#include <bits/stdc++.h>
#define LL              long long
#define ll              long long
#define SL(n)           scanf("%lld",&n)
#define LF              double
#define SF(n)           scanf("%lf",&n)
 
#define pb              push_back
#define mp              make_pair
 
#define ON(n,i)         (n|(1LL<<i))
#define OFF(n,i)        (n&(~(1LL<<i)))
#define CHK(n,i)        (n&(1LL<<i))
 
#define ff              first
#define ss              second
 
#define SET(arr)        memset( arr , -1 , sizeof arr)
#define RESET(arr)      memset( arr,0,sizeof arr)
 
#define srt(v)          sort(v.begin(),v.end())
#define uniq(v)			v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define found( s,d )    (s.find(d) != s.end())
 
#define FOR(i,s,e)      for( LL i = s ; i<=e ; i++ )
#define RFOR(i,e,s)     for( LL i = e ; i>=s ; i-- )
         
 
#define FILEIN          freopen("in.txt","r",stdin)
#define FILEOUT         freopen("WA.txt","w",stdout)
 
#define DEBUG(x)        cerr<<#x<<" = "<<x<<endl
#define PRINTALL(v)     {cerr<<endl<<"Printing: "<<#v<<endl;for(LL i = 0 ; i<v.size(); i++) DEBUG(v[i]); cerr<<endl;}
 
using namespace std;


int main(){
   
   char c;
   cin>>c;
   if( c>='A' && c<='Z' ) cout<<'A'<<endl;
   else cout<<'a'<<endl;
    
return 0;}

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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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;
}

struct Edge {
    ll to, rev;
    long double cap;
    Edge(ll _to, long double _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph &G, ll from, ll to, long double cap, bool revFlag,
              long double revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n;
    cin >> n;
    ll a[5];
    REP(i, 5) { cin >> a[i]; }
    ll ma = 0;
    REP(i, 5) { chmax(ma, (n + a[i] - 1) / a[i]); }

    cout << ma + 4 << en;
}

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

    solve();
    /*
    ll t;
    cin >> t;
    REP(i, t) { solve(); }*/

    return 0;
}


Measured memory_bytes: 3608
#include "stdio.h"
#include "string.h"
 
int main()
{
    int i, j;
    char a, s[3];
    scanf("%s", s);
    for (i = 0; s[i] != 0; i++) {
         for (j = i + 1; s[j] != 0; j++) {
              if (s[i] > s[j]) {
                                    a = s[i];
                                    s[i] = s[j];
                                    s[j] = a;
              }
         }
    }
 
    if (strcmp(s, "abc") == 0)
        printf("Yes\n");
    else
        printf("No\n");
 
    return 0;
 
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int32_t main(){
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
        // for debug in error.txt
        freopen("error.txt", "w", stderr);
    #endif
    int t = 1;
    while(t--) {
        ll a, b, c;
        cin >> a >> b >> c;
        double _t = (double)a/c;
        double _tt = (double)b;
        // cout << _t << ' ' << _tt << '\n';
        if( _t <= _tt) {
            cout << "Yes";
        }else{
            cout << "No";
        }
    }
}

Measured memory_bytes: 3616
/* https://atcoder.jp/contests/abc124/tasks/abc124_a */

#include <iostream>
#include <vector>
#include <algorithm>

/* {{{ Variables */
int A, B;
/* }}} */

int main(int argc, char *argv[])
{
  /* {{{ Input */
  std::cin >> A >> B;
  /* }}} */

  /* {{{ Output */
  int max_num = std::max({A+B, A+A-1, B+B-1});

  std::cout << max_num << std::endl;
  /* }}} */

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using static System.Math;

class P
{
    static void Main()
    {
        int[] hw = Console.ReadLine().Split().Select(int.Parse).ToArray();
        char[][] map = Enumerable.Repeat(0, hw[0]).Select(_ => Console.ReadLine().ToArray()).ToArray();
        for (int i = 0; i < hw[0]; i++)
        {
            for (int j = 0; j < hw[1]; j++)
            {
                if (map[i][j] == '#')
                {
                    if (!((i != 0 && map[i - 1][j] == '#') || (j != 0 && map[i][j - 1] == '#') || (i != hw[0] - 1 && map[i + 1][j] == '#') || (j != hw[1] - 1 && map[i][j + 1] == '#')))
                    {
                        Console.WriteLine("No");
                        return;
                    }
                }
            }
        }
        Console.WriteLine("Yes");
    }
}

Measured memory_bytes: 13396
//There was and will always be only one Chester. RIP legend
//--------------------Life is beautiful--------------------
#include<bits/stdc++.h>
using namespace std;
#define Nilesh ios_base::sync_with_stdio(false);

int main()
{
	Nilesh
	int a,b,c,x;
	cin>>a>>b>>c>>x;
	int cnt=0;
	for(int i=0;i<=a;i++)
    {
        for(int j=0;j<=b;j++)
        {
            for(int k=0;k<=c;k++)
            {
                if((500*i+100*j+50*k)==x)
                    cnt++;
            }
        }
    }
    cout<<cnt;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
    int n;
    cin >> n;
    int as[n];
    for(int i = 0; i < n; i++){
        cin >> as[i];
    }
    int minus = 0;
    int m = abs(as[0]);
    long long s = 0;
    for(int i = 0; i < n; i++){
        s += abs(as[i]);
        m = min(m, abs(as[i]));
        if(as[i] <= 0){
            minus++;
        }
    }
    if(minus%2 == 0){
        cout << s << endl;
    }else{
        cout << s-m*2 << endl;
    }
    return 0;
}


Measured memory_bytes: 640
/*
	*	Created By: 'Present_Sir'
	*	Created On: Monday 03 August 2020 08:11:06 PM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define int long long
using namespace std;

const int N = 2e5+10;
int n,k;
vector<int> v(N);

bool valid(int mid){
    int kc = k;
    if(mid == 0){
        return false;
    }
    for(int i=0; i<n; i++){
        if(v[i]<=mid ){
            continue;
        }
        int t = v[i]/mid;
        kc -= (t);
    }
    return kc>=0;
}

void solve(){
    cin>>n>>k;
    
    for(int i=0; i<n; i++){
        cin>>v[i];
    }
    int i=0, j=LLONG_MAX;
    int ans=0;
    while(i<=j){
        int mid = (i+j)/2;
        if(valid(mid)){
            j = mid-1;
            ans = mid;
        }else{
            i = mid+1;
        }
    }
    cout<<ans<<endl;
}

int32_t main(){
    IOS;
    //int t; cin>>t; while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 4728
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <sstream>
using namespace std;

#define SIZE 10

int n;
vector<int> d(SIZE + 1);
set<string> nums;

void run(int k, string num) {
    if (k == 0) {
        nums.insert(num);
        return;
    }
    for (vector<int>::iterator it = d.begin(); it != d.end(); it++) {
        int temp = *it;
        d.erase(it);
        stringstream ss;
        ss << temp;
        run(k - 1, num + ss.str());
        d.insert(it, temp);
    }
}

int main() {
    while (true) {
        int k;
        cin >> n >> k;
        if ((n | k) == 0) {
            break;
        }
        d.resize(n);
        for (int i = 0; i < n; i++) {
            cin >> d[i];
        }
        nums.clear();
        string num;
        run(k, num);
        cout << nums.size() << endl;
    }
}

Measured memory_bytes: 1056
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  double fa=a,fb=b;
//   cout << (a/b) <<" "<<(a%b)<<" "<<(fa/fb)<<endl;
  printf("%d %d %.5f\n",(a/b),(a%b),(fa/fb));
  return 0;
}


Measured memory_bytes: 3212
n, k, c = map(int, input().split())
s = list(input())

count = 0

l, r = [], []

for i in range(n):
    m = i + c * count
    if m >= n:
        break
    if s[m] == 'o':
        count += 1
        if count > k:
            break
        l.append(m)

count = 0

for i in range(n - 1, -1, -1):
    m = i - c * count
    if m < 0:
        break
    if s[m] == 'o':
        count += 1
        if count > k:
            break
        r.append(m)

l.sort()
r.sort()

for i in range(k):
    if l[i] == r[i]:
        print(l[i] + 1)

Measured memory_bytes: 22092
N = int(input())
txy = [tuple(map(int, input().split())) for _ in range(N)]

tp = xp = yp = 0
for t, x, y in txy:
  ti = t - tp
  d = abs(x - xp) + abs(y - yp)
  tp = t
  xp = x
  yp = y
  if ti < d:
    print('No')
    exit()
  else:
    if ti % 2 != d % 2:
      print('No')
      exit()
    else:
      continue
    
print('Yes')

Measured memory_bytes: 17312
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
int x[MAXN], st[MAXN][18];
int main()
{
    int n; scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
    int L, Q; scanf("%d%d", &L, &Q);
    // memset(st, 0x3f3f3f3f, sizeof(st));
    for (int i = 1; i <= n; i++)
        st[i][0] = min(n, (int)(upper_bound(x + 1, x + 1 + n, x[i] + L) - x - 1));

    
    for (int j = 1; j < 18; j++)
        for (int i = 1; i <= n; i++)
            st[i][j] = st[st[i][j - 1]][j - 1];
    while (Q--)
    {
        int l, r; scanf("%d%d", &l, &r);
        if (l > r) swap(l, r);
        int res = 0;
        for (int j = 17; j >= 0; j--)
            if (st[l][j] < r) res += (1 << j), l = st[l][j];
        printf("%d\n", res + 1);
    }
    return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &&x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

int dp[101][100005];
signed main() {
    int N, W;
    cin >> N >> W;
    vector<int> w(N), v(N);
    REP(i, N) {
        cin >> w[i] >> v[i];
    }

    dp[0][0] = 0;
    REP(i, N) {
        REP(j, W + 1) {
            chmax(dp[i + 1][j], dp[i][j]);
            if (j + w[i] <= W) {
                chmax(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
            }
        }
    }
    int ans = 0;
    REP(i, W + 1) {
        chmax(ans, dp[N][i]);
    }
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 78336
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
#define INF __INT32_MAX__
#define LINF __LONG_LONG_MAX__

int main() {
    int N, D;
    cin >> N >> D;
    vl X(N), Y(N);
    rep(i, N) {
        cin >> X[i] >> Y[i];
    }

    int cnt = 0;
    rep(i, N) {
        if (sqrt(X[i] * X[i] + Y[i] * Y[i]) <= D) {
            cnt++;
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 6416
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <climits>
#include <math.h>
#include <memory.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N, M;
int cnt = 0;
int count = 0;
ll ans = 0LL;
int i_index;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};
string board[64];

int main(){
    int N, maxt = 0;
    cin >> N;
    int L[N];
    rep(i, N) cin >> L[i];
    sort(L, L + N);
    maxt = L[N - 1];
    for(int i = 0; i < N - 1; i++){
        ans += L[i];
    }
    if(maxt < ans)
        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 REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	int lim = (n%2==1 ? n-1 : n);
	vector<pair<int, int>> v;

	FOR(i,1,n+1){
		FOR(j,1,n+1){
			if(i>=j || j==lim) continue;
			v.push_back(pair<int, int>(i,j));
		}
		lim--;
	}
	cout << v.size() << '\n';
	for(auto vs: v){
		cout << vs.first << " " << vs.second << '\n';
	}
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt", "r", stdin)
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long LL;
void read(int& val) { int x = 0; int bz = 1; char c; for (c = getchar(); (c<'0' || c>'9') && c != '-'; c = getchar()); if (c == '-') { bz = -1; c = getchar(); }for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48; val = x * bz; }
const int maxn = 1e6+10;
LL n,t,a,b,c,d;
unordered_map<LL,LL>mp;
LL dfs(LL x){
    if(x==0) return 0;
    if(x==1) return d;
    if(mp.count(x)) return mp[x];

    LL l2 = (x/2)*2;
    LL r2 = ((x+1)/2)*2;
    LL l3 = (x/3)*3;
    LL r3 = ((x+2)/3)*3;
    LL l5 = (x/5)*5;
    LL r5 = ((x+4)/5)*5;

    LL res=1e18;
    if(res/d>x)res=x*d;

    res=min(res,dfs(l2/2)+(x-l2)*d+a);
    res=min(res,dfs(r2/2)+(r2-x)*d+a);

    res=min(res,dfs(l3/3)+(x-l3)*d+b);
    res=min(res,dfs(r3/3)+(r3-x)*d+b);

    res=min(res,dfs(l5/5)+(x-l5)*d+c);
    res=min(res,dfs(r5/5)+(r5-x)*d+c);

    mp[x]=res;
    return res;
}

int main(){
//    op;
    scanf("%lld",&t);
    while(t--) {
        mp.clear();
        scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
        printf("%lld\n",dfs(n));
    }
    return 0;
}

Measured memory_bytes: 4184
import scipy.sparse.csgraph as c,numpy
s=numpy.int8([list(t[:-1])for t in open(0)][1:])
m=c.floyd_warshall(s)
i=m[0]%2<1
j=i^True
print((s[i][:,i].any()|s[j][:,j].any()or~int(m.max()))*-1)

Measured memory_bytes: 18536
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
using namespace std;

#define ll long long int

const int MOD = 1000000007;

int max(int a, int b) {

	if (a > b)return a;
	else return b;

}
int main() {

	string S;

	cin >> S;
	S[5] = ' ';
	S[13] = ' ';
	cout << S << endl;

	return 0;
}

Measured memory_bytes: 256
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const n = Number(stdin.split('\n')[0])
const a = stdin
  .split('\n')[1]
  .split(' ')
  .map(Number)
const b = stdin
  .split('\n')[2]
  .split(' ')
  .map(Number)

const ans = () => {
  const aRev = [...a].reverse()
  const bRev = [...b].reverse()

  let count = 0

  for (let i = 0; i < n; i++) {
    if (bRev[i] >= aRev[i]) {
      bRev[i] -= aRev[i]
      count += aRev[i]

      aRev[i] = 0
    } else {
      aRev[i] -= bRev[i]
      count += bRev[i]

      bRev[i] = 0
    }

    if (bRev[i] >= aRev[i + 1]) {
      bRev[i] -= aRev[i + 1]
      count += aRev[i + 1]

      aRev[i + 1] = 0
    } else {
      aRev[i + 1] -= bRev[i]
      count += bRev[i]

      bRev[i] = 0
    }
  }

  console.log(count)
}

ans()


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

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

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

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


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

  ll n;
  cin >> n;
  vll a(n);
  REP(i, n)
    cin >> a[i];

  string ans = "second";
  REP(i, n){
    if(a[i]%2 == 1)
      ans = "first";
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main(void){
    int i,j,cnt;
    char str1[101];
    char str2[101];
    int p[2] = {};
    scanf( "%d" , &cnt );
    
    for( i = 0 ; i < cnt ; i ++ ){
        scanf( "%s %s" , str1 , str2 );
        //printf("%s %s\n" , str1 , str2 );
        for( j = 0 ; ; j++ ){
            if( str1[j] == '\0' && str2[j] == '\0' ){
                p[0]++;
                p[1]++;
                //printf(" 1 1:%s - %s\n" , str1,str2);
                break;
            }else if( str1[j] > str2[j] || str2[j] == '\0' ){
                p[0] += 3;
                //printf(" 3 0:%s - %s\n" , str1,str2);
                break;
            }else if( str1[j] < str2[j] || str1[j] == '\0' ){
                p[1] += 3;
                //printf(" 0 3:%s - %s\n" , str1,str2);
                break;
            }
        }
    }
    
    printf( "%d %d\n" , p[0] , p[1] );
}



Measured memory_bytes: 2088
# https://atcoder.jp/contests/abc060/tasks/arc073_a
# C - Sentou

N, T = list(map(int, input().split()))
t_list = list(map(int, input().split()))
total = 0

for i in range(1, N):
    diff = t_list[i] - t_list[i-1]
    if diff < T:
        total += diff
    else:
        total += T
total += T

print(total)


Measured memory_bytes: 25196
N, K, S = map(int, input().split())

ans = [S]*K
if S == 10**9:
    #最大値の時に制限の値を超えないように
    ans += [1]*(N - K)   
else:
    ans += [S+1]*(N - K)
ans = list(map(str, ans))

print(" ".join(ans))

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> v(n);
    ll ans = 0;
    for (int i = 0; i < n; i++) cin >> v[i];
    for (int l = 0; l <= min(n, k); l++) {
        for (int r = 0; r <= min(n - l, k - l); r++) {
            ll tmp = 0;
            vector<ll> sub;
            for (int i = 0; i < l; i++) {
                tmp += v[i];
                if (v[i] < 0) sub.push_back(v[i]);
            }
            for (int i = 0; i < r; i++) {
                tmp += v[n - i - 1];
                if (v[n - i - 1] < 0) sub.push_back(v[n - i - 1]);
            }
            sort(sub.begin(), sub.end());
            int m = max(0, min((int)sub.size(), k - l - r));
            for (int i = 0; i < m; i++) tmp -= sub[i];
            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    if(N % 2 == 0) cout << N / 2 << endl;
    else cout << N / 2 + 1 << endl;
}

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

typedef long long ll;
typedef long double ld;

#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}

int main(){

    string S;
    ll m;
    
    cin >> S;

    m = (S[5] - '0') * 10 + S[6] - '0';

    cout << (m <= 4 ? "Heisei" : "TBD") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <utility>
#include <vector>

using namespace std;
using P = pair<double, double>;

inline double dist(P s, P t) {
  return sqrt(pow((s.first - t.first), 2) + pow((s.second - t.second), 2));
}

inline double S(double a, double b, double c) {
  double z = (a + b + c) / 2;
  return sqrt(z * (z - a) * (z - b) * (z - c));
}

int main() {
  char line[128];
  double x, y;
  vector<P> ps;
  while (scanf("%lf,%lf", &x, &y) != EOF) {
    ps.push_back({x, y});
  }
  size_t sz = ps.size();
  P c;
  for (int i = 0; i < 3; ++i) {
    c.first += ps[i].first;
    c.second += ps[i].second;
  }
  c.first /= 3;
  c.second /= 3;
  double ans = 0;
  for (int p1 = 0, p2 = 1; p1 < sz; ++p1, p2 = (p2 + 1) % sz) {
    ans += S(dist(ps[p1], ps[p2]), dist(ps[p1], c), dist(ps[p2], c));
  }
  printf("%.7lf\n", ans);
}

Measured memory_bytes: 2716
#include <bits/stdc++.h>
#define RI register int
int main() {
	int n; scanf("%d", &n);
	int fi = n / 100, se = n % 100;
	int o1 = 0, o2 = 0;
	if (1 <= fi && fi <= 12) o1 = 1;
	if (1 <= se && se <= 12) o2 = 1;
	if (o1 && o2) puts("AMBIGUOUS");
	else if (o1) puts("MMYY");
	else if (o2) puts("YYMM");
	else puts("NA");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <unordered_map>
// #include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x)  if(DEBUG_Switch) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
void pvarr_int(int *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%d%c", arr[i], i == n ? '\n' : ' ');}}
void pvarr_LL(ll *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%lld%c", arr[i], i == n ? '\n' : ' ');}}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","r",stdin);
    ll a, b, c;
    scanf("%lld %lld.%lld", &a, &b, &c);
    b *= 100ll;
    b += c;
    a *= b;
    a /= 100;
    printf("%lld\n", a );
    return 0;
}




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

int main()
{

	string s;
	cin >> s;

	int count=0;
	int maxcount=0;
	for (int i=0;i<3;++i)
	{
		//cout << s[i] << endl;
		if (s[i]=='R')
		{
		//	fprintf(stderr,"R detected\n");
			++count;
		}
		else
		{
			maxcount=max(maxcount,count);
			count=0;
		}
	}
	maxcount=max(maxcount,count);
	cout << maxcount << endl;
}






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

using namespace std;

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

  vector<vector<int>> G(n, vector<int>());

  for (int i = 0; i < n; i++) {
    int u, k; cin >> u >> k; u--;
    for (int j = 0; j < k; j++) {
      int v; cin >> v; v--;
      G[u].push_back(v);
    }
  }

  vector<int> dist(n, 1000);
  dist[0] = 0;

  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < n; j++) {
      for (auto k: G[j]) {
        dist[k] = min(dist[k], dist[j] + 1);
      }
    }
  }

  for (int i = 0; i < n; i++) {
    cout << i + 1 << ' ';
    if (dist[i] == 1000) {
      cout << -1 << endl;
    } else {
      cout << dist[i] << endl;
    }
  }
}



Measured memory_bytes: 3140
import math
a,b,h,m = map(int, input().split())

r_m = 6*m
r_h = 30*h + 0.5*m
r = math.radians(abs(r_h - r_m))
x2 = a*a + b*b - 2*a*b*math.cos(r)
print(math.sqrt(x2))

Measured memory_bytes: 9508
'use strict'

const Main = (input) => {
  const nr = input.split('\n')
  const N = parseInt(nr[0])
  let counts = {}
  let max = {name: [], value: 0}
  for (let i = 1; i < N + 1; i++) {
    const key = nr[i]
    counts[key] = (counts[key]) ? counts[key] + 1 : 1
    if (counts[key] > max.value) {
      max.name = [key]
      max.value = counts[key]
    } else if (counts[key] === max.value) {
      max.name.push(key)
    }
  }
  max.name = max.name.sort()
  for (let j = 0; j < max.name.length; j++) {
    console.log(max.name[j])
  }
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 85000
#include <stdio.h>

int SIMPLE_INTEREST = 0; /* 単利 */
int COMPOUND_INTEREST = 1; /* 複利 */
int RATE_DIVISION = 8192; /* 年利率の単位の逆数 (1/x) */

/* 最終資金をシミュレートする */
long simulate(long f, int y, int interestType, double interestRate, int annualFee) {
	double interest = 0;
	int r, i;
	long long lf = f;
	r = (int)(interestRate * RATE_DIVISION + 0.5); /* 整数での計算用に変換した年利率 */
	/* 年毎のシミュレーション */
	for (i = 0; i < y; i++) {
		interest += lf * r / RATE_DIVISION; /* 利子をつける */
		if (interestType == COMPOUND_INTEREST) {
			lf += interest;
			interest = 0;
		}
		lf -= annualFee; /* 年間手数料をとる */
	}
	lf += interest;
	return (long)lf;
}

int main(void) {
	int m; /* データセット数 */
	int i, j;

	if (scanf("%d", &m) != 1) return 0;

	/* データセット毎の処理 */
	for (i = 0; i < m; i++) {
		long f; /* 初期資金 */
		int y; /* 運用年数 */
		int n; /* 運用方法の種類数 */
		long max; /* 最大の最終資金 */

		if (scanf("%ld%d%d", &f, &y, &n) != 3) return 0;
		if (f <= 0 || f > 100000000 || y <= 0 || y > 10 || n <= 0 || n > 100) return 0;
		max = f;

		/* データセット毎の処理 */
		for (j = 0; j < n; j++) {
			int it; double ir; int af; /* 入力 */
			long r;
			if (scanf("%d%lf%d", &it, &ir, &af) != 3) return 0;
			/* シミュレーション */
			r = simulate(f, y, it, ir, af);
			if (r > max) max = r; /* 最大値を記録する */
		}

		printf("%ld\n", max); /* 出力 */
	}

    return 0;
}

Measured memory_bytes: 632
#include<iostream>
#include<cstdio>
#include<random>
using namespace std;

struct Dice
{
	int Top, Front, Right, Left, Back, Bottom;
};


void roll (Dice &d1, int r);

int main()
{
	Dice d1;	
	cin >> d1.Top >> d1.Front >> d1.Right >> d1.Left >> d1.Back >> d1.Bottom;
	int q;
	cin >> q;
	for (int a, b; q > 0; q--)
	{
		cin >> a >> b;
		while (d1.Top != a || d1.Front != b)
			roll(d1, rand()%4);
		cout << d1.Right << endl;
	}
	return 0;
}


void roll (Dice &d1, int r)
{
	switch (r)
		{
			case 0:	  swap(d1.Top, d1.Back); 
					  swap(d1.Back, d1.Bottom);
					  swap(d1.Bottom, d1.Front);
					  break;
			case 1:	  swap(d1.Top, d1.Front);
					  swap(d1.Front, d1.Bottom);
					  swap(d1.Bottom, d1.Back);
					  break;
			case 2:   swap(d1.Top, d1.Left);
					  swap(d1.Left, d1.Bottom);
					  swap(d1.Bottom, d1.Right);
					  break;
			case 3:   swap(d1.Top, d1.Right);
					  swap(d1.Right, d1.Bottom);
					  swap(d1.Bottom, d1.Left);
					  break;
		}
}



Measured memory_bytes: 3076
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn printa(a: &Vec<u32>) {
    let p = a
        .clone()
        .into_iter()
        .map(|x| x.to_string())
        .collect::<Vec<String>>()
        .join(" ");
    println!("{}", p);
}

fn main() {
    let n = read::<usize>();
    let mut a = read_vec::<u32>();

    printa(&a);
    for i in 1..n {
        let v = a[i];
        let mut j = i - 1;
        while a[j] > v {
            a[j + 1] = a[j];
            a[j] = v;
            if j == 0 {
                break;
            } else {
                j -= 1;
            }
        }
        printa(&a);
    }
}



Measured memory_bytes: 5044
#include <iostream>

int main(int argc, char const* argv[])
{
	int r, c;
	int mat[101][101] = {};

	std::cin >> r >> c;
	for (size_t i = 0; i < r; i++)
		for (size_t j = 0; j < c; j++)
		{
			std::cin >> mat[i][j];
			mat[i][c] += mat[i][j];
			mat[r][c] += mat[i][j];
			mat[r][j] += mat[i][j];
		}

	for (size_t i = 0; i < r + 1; i++)
		for (size_t j = 0; j < c + 1; j++)
		{
			if(j != c)
				std::cout << mat[i][j] << " ";
			else
				std::cout << mat[i][j] << std::endl;
		}

	return 0;
}

Measured memory_bytes: 1208
#include<stdio.h>
char s[200];
int main()
{
	scanf("%s",s);
	bool C=0;
	for(int i=0;i<=199;i++)
	{
		if(s[i]==10) break;
		if(s[i]=='C')
		{
			C=1;
		}
		if(s[i]=='F')
		{
			if(C==1)
			{
				printf("Yes");
				return 0;
			}
		}
	}
	printf("No");
	return 0;
}

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

#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define FOR(i, x, n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define trav(a, x) for(auto& a: x)
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define MOD 1000000007

typedef vector<int> vec;
typedef long long ll;

int main() {
    fast_cin();
    int n, r;cin>>n>>r;
    int ans = 0;
    while (n>0){
        n/=r;
        ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main(){
int N,T;
double A;
cin>>N>>T>>A;
vector<double> H(N);
for(int i=0;i<N;i++){
    cin>>H.at(i);
    H.at(i)=abs(T-H.at(i)*0.006-A);
}
int ans=0;
double judge=100000.0;  
for(int i=0;i<N;i++){
    if(judge>H.at(i)){
      judge=H.at(i);    
      ans=i+1;
    }
}
cout<<ans<<endl;
}


Measured memory_bytes: 256
import heapq
from sys import stdin
input = stdin.readline

#入力
# s = input()[0:-1]
# n = int(input())
# a = list(map(int,input().split()))
# a = [int(input()) for i in range()]


# ab=[]
# for i in range():
#     a,b = map(int, input().split())
#     ab.append([a,b])


     
def main():
    count =[0]*4
    for i in range(3):
       a,b = map(int, input().split())
       count[a-1]+=1
       count[b-1]+=1
    flag = True
    for i in count:
        if i ==3:
            flag=False
    if flag:
        print("YES")
    else:
        print("NO")

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <stack>
#include <vector>

using namespace std;

struct TopologicalSort {
private:
    int V;
    int E;
    vector<vector<int>> table;
public:
    TopologicalSort(int v, int e) {
        V = v;
        E = e;
        table.resize(v);
    }

    void add_edge(int from, int to) {
        table[from].push_back(to);
    }

    vector<int> sort() {
        vector<int> sorted_nodes;
        stack<int> st;

        vector<int> indegree(V, 0);
        for (int i = 0; i < V; i++) {
            for (int to : table[i]) {
                indegree[to]++;
            }
        }

        for (int i = 0; i < V; i++) {
            if (indegree[i] == 0) st.push(i);
        }

        while (st.size() > 0) {
            int popped = st.top();
            st.pop();

            sorted_nodes.push_back(popped);

            for (int to : table[popped]) {
                indegree[to]--;
                if (indegree[to] == 0) st.push(to);
            }
        }

        return move(sorted_nodes);
    }
};

signed main() {
    int V, E;
    cin >> V >> E;

    TopologicalSort ts(V, E);

    for (int i = 0; i < E; i++) {
        int s, t;
        cin >> s >> t;
        ts.add_edge(s, t);
    }

    vector<int> sorted_nodes = ts.sort();
    for (int node: sorted_nodes) cout << node << endl;
}




Measured memory_bytes: 3768
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> N>>M;
  ll a[N];
  unordered_map<ll,ll> b;
  ll count = 0;
  b[0]++;
  //cout << M << endl;
  rep(i, N){
    cin >> a[i];
    count +=a[i]%M;
    //cout <<"count: " << count << endl;
    b[count%M]++;
  }
  ll m;
  ans = 0;
  for(auto itr = b.begin(); itr != b.end(); ++itr) {
        m = itr->second;
        //cout << "key:" << itr->first << ", value:" << m << endl;
    	ans += m*(m-1)/2;
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4108
#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
#define MOD 10007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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


int main(){
    string S;
    cin >> S;
    llong ans;
    llong count = 0;
    int N = S.size();
    REP(i,N){
        if(S[i]=='0') count++;
    }
    ans = min(count,N-count)*2;
    cout << ans << endl;

    
    return 0;

}

Measured memory_bytes: 512
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())

sys.setrecursionlimit(10 ** 9)


def main():
    A, B = MAP()

    if not 0 < A < 10 or not 0 < B < 10:
        print(-1)
    else:
        print(A*B)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
// finish date: 2018/01/20
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define bigmod 1000000007
#define INF 500000000


int main() {
    int a, b;
    cin >> a >> b;
    cout << (a + b + 1) / 2 << endl;


    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{
	public static void main(String[] args)throws Exception{
		long add=0;
	
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String[] line2 = br.readLine().split(" ");
		StringBuilder sb = new StringBuilder();
		
		int n = Integer.parseInt(line1);
		int[] a = new int[n];
		int min = Integer.MAX_VALUE;
		int max = Integer.MIN_VALUE;
		
		for(int i=0; i<n; i++){
			a[i] = Integer.parseInt(line2[i]);
			if(a[i] < min){
				min = a[i];
			}	if(a[i] > max){
				max = a[i];
			}
			add += a[i];
		}
		System.out.println(min+" "+ max+" "+ add);		
	}
}

Measured memory_bytes: 28588
import scala.io.Source.stdin

object Main extends App {
  def gcd(m:Long,n:Long):Long = if(n==0) m else gcd(n, m % n)

  val l =
    for(s <- stdin.getLines.map(_.split(" ").map(_.toLong))) yield {
        val g = gcd(s(0),s(1))
        g + " " + (s(0)/g)*s(1)
    }
  println(l.toSeq.mkString("\n"))
}

Measured memory_bytes: 43864