akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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

//想定解答との絶対誤差または相対誤差が 10−6以下の場合+1以上だしておく。適当に15とかでもおｋ．
//cout << fixed << setprecision(15);

int main() {
    int N;
    cin >> N;
    int nx = 0;
    int ny = 0;
    int time = 0;
    int count = 0;
    rep(i, 0, N) {
        int t, x, y; 
        cin >> t >> x >> y;
        time = t-time;
        nx = x-nx;
        ny = y-ny;
        if (time >= nx+ny) {
            if ( (time % 2 == 0 && (nx+ny) % 2 == 0) || (time % 2 != 0 && (nx+ny) % 2 != 0)  )  {
                ++count;
            } else {
                cout << "No" << endl;
                return 0;
            }
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    
    if (count == N) {
        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 < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define readvec(vec) for(auto& e: vec){cin >> e;}
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long int ll;
typedef vector<int >    vecint;
typedef vector<ll >      vecll;
typedef vector<double >   vecd;
typedef vector<string > vecstr;
typedef vector<char >  vecchar;
typedef vector<bool >  vecbool;
typedef vector<vector<bool> >  vec2bool;
typedef vector<vector<int> >    vec2int;
typedef vector<vector<double> >   vec2d;
////////////////////////////////////////////////
void init(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
////////////////////////////////////////////////
int main()
{
  int n, p; cin >> n >> p;
  ll ne, no; ne = no = 0;
  REP(i,n){
    int tmp;
    cin >> tmp;
    if(tmp%2 ==0){
      ne ++;
    }else{
      no ++;
    }
  }
  if(p == 1 && no == 0){
    cout << 0 << endl;
  }else if(p == 0&& no == 0){
    cout << (ll)pow(2, n) << endl;
  }else{
    cout << (ll)pow(2, n - 1) << endl;
  }
}

Measured memory_bytes: 256
#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;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

signed main(){
  //入力の高速化用のコード
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int h1,h2,m1,m2;
  cin >> h1 >> m1 >> h2 >> m2;
  int time1,time2;
  time1 = h1 * 60 + m1;
  time2 = h2 * 60 + m2;
  int k;
  cin >> k;
  cout << (time2-time1) - k << endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll MOD = 1e9+7;

int main(){
  string s;
  int ans=0;
  cin>>s;
  for(int i=0;i<s.size();i++){
	if(s[i]=='1')ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int a;
  cin >> n;
  vector<int> A;
  REP(i,n){
    cin >> a;
    A.push_back(a);
  }
  vector<size_t> indices(A.size());
  iota(indices.begin(), indices.end(), 0);


  sort(indices.begin(), indices.end(), [&A](size_t i1, size_t i2) {
    return A[i1] < A[i2];
  });

  for (auto v : indices)
    cout << v+1 << " ";
  cout << endl;
}


Measured memory_bytes: 2168
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    # S = [x for x in sys.stdin.readline().split()][0]  # 文字列 一つ
    # N = [int(x) for x in sys.stdin.readline().split()][0]  # int 一つ
    H1, M1, H2, M2, K = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    # h_list = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    # grid = [list(sys.stdin.readline().split()[0]) for _ in range(N)]  # 文字列grid
    # v_list = [int(sys.stdin.readline().split()[0]) for _ in range(N)]
    # grid = [[int(x) for x in sys.stdin.readline().split()]
    #         for _ in range(N)]  # int grid

    logger.debug('{}'.format([]))

    print(H2 * 60 + M2 - K - H1 * 60 - M1)


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py で実行できる
# pypy3 -m unittest template/template.py で実行できる

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """10 0 15 0 30"""
        output = """270"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """10 0 12 0 120"""
        output = """0"""
        self.assertIO(input, output)


Measured memory_bytes: 16288
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String[] in = s.nextLine().split(" ");
        List<Integer> nums = new ArrayList<Integer>();
        for(int i=0;i<3;i++){
            nums.add(Integer.parseInt(in[i]));
        }
        int a1=Collections.min(nums);
        nums.remove(nums.indexOf(a1));
        int a2=Collections.min(nums);
        System.out.println(a1+a2);
    }
}

Measured memory_bytes: 23764
#include<iostream>
using namespace std;
int main(){
int e;
while(true){
cin >> e;
if(!e)
break;
int x,y,z;
int ans = e;
for(z=0;z*z*z<=e;z++){for(y=0;y*y+z*z*z<=e;y++){int b=e-(y*y+z*z*z);ans = min(ans,b+y+z);
}
}
cout << ans <<endl;
}
}

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

using namespace std;

int main() {
	int x, y;
	scanf("%d %d", &x, &y);
	if (x == y) {
		puts("Draw");
		return 0;
	}
	if (x == 1 || y == 1) {
		if (x == 1) puts("Alice");
		else if (y == 1) puts("Bob");
		return 0;
	}
	if (x > y) puts("Alice");
	else puts("Bob");
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {


    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);

        char[] ss  = sc.next().toCharArray();
        int n = ss.length;
        int[] s = new int[n];
        for(int i=0; i<n; i++) {
            s[i] = ss[i] - 'a';
        }
        char[] tt  = sc.next().toCharArray();
        int m = tt.length;
        int[] t = new int[m];
        for(int i=0; i<m; i++) {
            t[i] = tt[i] - 'a';
        }

        int[][] a = new int[26][n + 1];
        for(int i=0; i<26; i++) {
            a[i][n] = Integer.MAX_VALUE;
            for(int j=n-1; j>=0; j--) {
                if(s[j] == i) {
                    a[i][j] = j;
                } else {
                    a[i][j] = a[i][j+1];
                }
            }
        }


        int x = 0;
        int y = n;

        for(int q : t) {
            int p = a[q][y];
            if(p == Integer.MAX_VALUE) {
                x++;
                if(a[q][0] == Integer.MAX_VALUE) {
                    System.out.println(-1);
                    return;
                }
                y=a[q][0] + 1;
            } else {
                y= p + 1;
            }

        }
        System.out.println((long) (x-1) * n + y);
    }

}


Measured memory_bytes: 38540
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

struct edge { int to; long long yen, snuuk;};
vector<vector<edge>> g;

vector<long long> dijkstra(int s, bool is_yen) {
    vector<long long> dist(g.size(), numeric_limits<long long>::max());
    dist[s] = 0;
    using P = pair<long long, long long>;
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, s));
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (dist[v] < p.first) continue;
        for (edge e : g[v]) {
            long long weight;
            if (is_yen) weight = e.yen;
            else weight = e.snuuk;
            if (dist[e.to] > dist[v] + weight) {
                dist[e.to] = dist[v] + weight;
                que.push(P(dist[e.to], e.to));
            }
        }
    }
    return dist;
}

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

    int n, m, s, t;
    cin >> n >> m >> s >> t;
    s--; t--;
    g.resize(n);
    rep(i, m) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        g[u].push_back({v, a, b});
        g[v].push_back({u, a, b});
    }
    auto yen = dijkstra(s, true);
    auto snuuk = dijkstra(t, false);
    vector<ll> sum(n);
    rep(i, n) sum[i] = yen[i] + snuuk[i];
    vector<ll> ans(n);
    ans[n-1] = sum[n-1];
    rrep(i, n-1) {
        ans[i] = ans[i+1];
        chmin(ans[i], sum[i]);
    }
    rep(i, n) {
        ll x = 1e15;
        cout << x - ans[i] << endl;
    }
}


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

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


int N; 
void input()
{
    cin >> N;
}

void solve()
{
    int sum = 0;
    for (int i = 0; i < N; ++i){
        int a; cin >> a;
        sum += a;
    }
    cout << sum - N << endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 1e9  + 5;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	if(n < 30)
		cout << "No\n";
	else
		cout << "Yes\n";
} 


Measured memory_bytes: 3636
freq=Array.new(6, 0)

gets.to_i.times {
  h=gets.to_f
  case
    when h<165
      freq[0]+=1
    when h<170
      freq[1]+=1
    when h<175
      freq[2]+=1
    when h<180
      freq[3]+=1
    when h<185
      freq[4]+=1
    else
      freq[5]+=1
  end
}

freq.each_index { |i|
  puts "#{i+1}:" << '*' * freq[i]
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n;cin >> n;
    ll x = n/100;
    if(100*x <= n && n <= 105*x)out(1);
    else out(0);
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a1 = sc.nextInt();
        int a2 = sc.nextInt();
        int a3 = sc.nextInt();
        int m = Math.abs(Math.max(a1,Math.max(a2,a3)) - Math.min(Math.min(a1,a2),a3));
        System.out.println(m);
    }
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int main()
{	int a,b,c; cin>>a>>b>>c;
	if(a>=c) cout<<b+c;
	else
	{	if(b>=c-a) cout<<b+c;
		else cout<<(ll)b+b+a+1;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
VVI g;
VI visited;
VI ans;

void dfs(int v, int p){

    ans[v] = p;
    for(int u : g[v]){
        if(visited[u]) continue;
        visited[u] = 1;
        dfs(u,v);
    }
}

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int N,M; cin >> N >> M;
    g.resize(N);
    visited.resize(N,0);
    ans.resize(N);
    REP(i,M){
        int u,v; cin >> u >> v;
        u--; v--;
        g[u].eb(v);
        g[v].eb(u);
    }

    queue<PII> q;
    q.push(PII(0,-1));
    while(!q.empty()){
        auto p = q.front(); q.pop();
        int p1,p2;
        tie(p1,p2) = p;
        ans[p1] = p2;
        for(int v : g[p1]){
            if(visited[v]) continue;
            visited[v] = 1;
            q.push(PII(v,p1));
        }
    }

    cout << "Yes" << endl;
    FOR(i,1,N){
        cout << ans[i] + 1 << endl;
    }

    

}

Measured memory_bytes: 10960
using System;

namespace ABC170A
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine().Split(' ');
            for (var i = 0; i < str.Length; i++)
            {
                if (str[i] == "0")
                {
                    Console.WriteLine(i + 1);
                }
            }
        }
    }
}


Measured memory_bytes: 17780
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int32_t main(){
	int a,b;
	cin>>a>>b;
	for(int i=0;i<=1e6;i++){
		if(((i*8)/100 == a) && ((i/10)==b)){
			cout<<i;
			return 0;
		}
	}
	cout<<-1;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <climits>
#include <algorithm>
using namespace std;




int main() 
{
	int n;
	map<int,int> m;
	cin>>n;
	for(int i=1;i<n;++i){
		int k;
		cin>>k;
		m[k]++;
	}


	for(int i=1;i<=n;++i){
		if(m.find(i)!=m.end()){
			cout<<m[i]<<endl;
		}
		else{
			cout<<0<<endl;
		}
	}
	


}


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

int main() {
	char x,y;
	cin >> x >> y;
	char k = '=';
	if(x > y)
	{
		k = '>';
	}
	else if(x < y)
	 {
	 	k = '<';
	 }
    cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int s,x,t;
    cin>>s>>x>>t;
    long long ans=0;
    long long tans=0;
    while(ans<s) {
        ans+=x;
        tans+=t;
    }
    cout<<tans<<endl;
   
   return 0;
}

Measured memory_bytes: 3540
n,m=map(int,input().split())
a=list(map(int,input().split()))

import heapq
i=0
heap=[]
res=[]
for t in a:
	heapq.heappush(heap,-t)
for _ in range(m):
	t=heapq.heappop(heap)
	heapq.heappush(heap,-(-t//2))
print(-sum(heap))

Measured memory_bytes: 64792
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }


int solve(int X) {
    if (X == 1) {
        return 300000;
    }
    if (X == 2) {
        return 200000;
    }
    if (X == 3) {
        return 100000;
    }
    return 0;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int X, Y;
    cin >> X >> Y;
    int ans = 0;
    ans += solve(X);
    ans += solve(Y);
    if (X == 1 && Y == 1) {
        ans += 400000;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,a,b,c,d;
  cin >> n;
  
    a=n/1000;
    b=(n-a*1000)/100;
    c=(n-a*1000-b*100)/10;
    d=n-a*1000-b*100-c*10;

  if (a == b && a == c && b ==c) {
    cout << "Yes" << endl;
  }
  else if (b == c && c == d && d == b) {
    cout << "Yes" << endl;
  }
  else if (a == b && a == c && a == d && b == c && b == d && c == d) {
    cout << "Yes" << endl;
  }
    else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
n = int(input())
r = []
for i in range(0, n):
    r.append(int(input()))

minv = r[0]
maxv = r[1] - r[0]

for i in range(1, n):
    maxv = max(maxv, r[i] - minv)
    minv = min(minv, r[i])

print(maxv)


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

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

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

ull Euclid(ull A, ull B){
    if(A<B) swap(A, B);
    ull C = B;
    while(C != 0){
        C = A%B;
        A = B;
        B = C;
    }
    return A;
}

int main(){
	ll N, M;
	cin >> N >> M;
	string S, T;
	cin >> S >> T;
	ll G = Euclid(N, M);
	ll L = ((N*M)/G);
	bool flag = true;
	ll k = 0;
	while(k*(L/M)<L){
		if ((N*k)%M==0){
			ll l = (N*k)/M;
			if(S[l]!=T[k]){
				flag = false;
			}
		}
		k++;
	}
	cout << (flag ? L : -1) << endl;
    return 0;
}

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

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

int main() {
	int n;
	while (cin >> n) {
		string ans = "3C";
		int num = n % 39;
		if (num == 0) num = 39;
		ans.push_back(num / 10 + '0');
		ans.push_back(num % 10 + '0');
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.12f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int  N; cin >> N;
    ll x[105],y[105],h[105];
    rep(i,0,N) cin >> x[i] >> y[i] >> h[i];
    reps(X,0,100){
        reps(Y,0,100){
            ll H;
            rep(i,0,N){
                if(h[i] > 0){
                    H = h[i] + abs(x[i] - X) + abs(y[i] - Y);
                    break;
                }
            }
            bool flag = true;
            rep(i,0,N){
                if(h[i] != max(H-abs(x[i]-X)-abs(y[i]-Y), (ll)0)){
                    flag = false;
                    break;
                }
            }
            if(flag){
              cout << X << " " << Y << " " << H << endl;
              return 0;
            }
        }
    }
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
using P = pair<int, int>;

void solve(int n) {
  vector<P> ps;
  vector<P> rec;
  vector<int> largex, largey;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    ps.push_back(P(x, y));
    largex.push_back(x);
    largey.push_back(y);
  }
  for (int i = 0; i < 4; i++) {
    int x, y;
    cin >> x >> y;
    rec.push_back(P(x, y));
    largex.push_back(x);
    largey.push_back(y);
  }
  sort(largex.begin(), largex.end());
  sort(largey.begin(), largey.end());
  largex.erase(unique(largex.begin(), largex.end()), largex.end());
  largey.erase(unique(largey.begin(), largey.end()), largey.end());
  unordered_map<int, int> presX;
  unordered_map<int, int> expaX;
  unordered_map<int, int> presY;
  unordered_map<int, int> expaY;
  for (int i = 0; i < largex.size(); i++) {
    presX[largex[i]] = i;
    expaX[i] = largex[i];
  }
  for (int i = 0; i < largey.size(); i++) {
    presY[largey[i]] = i;
    expaY[i] = largey[i];
  }

  vector<P> presPs;
  vector<P> presRec;
  for (P p: ps) {
    presPs.push_back(P(presX[p.first], presY[p.second]));
  }
  for (P p: rec) {
    presRec.push_back(P(presX[p.first], presY[p.second]));
  }

  assert(largex.size() < 100 && largey.size() < 100);
  int bd[100][100] = {};
  int board[100][100] = {};
  P start = presPs.front();
  P prev = presPs.front();
  for (int i = 1; i < n; i++) {
    if (presPs[i].second != prev.second) {
      int x = prev.first;
      int ycrt = presPs[i].second;
      int yprv = prev.second;
      for (int y = min(ycrt, yprv); y < max(ycrt, yprv); y++) {
        bd[x][y] = 1;
      }
    }
    prev = presPs[i];
  }

  if (prev.second != start.second) {
    int x = prev.first;
    for (int y = min(prev.second, start.second); y < max(prev.second, start.second); y++) {
      bd[x][y] = 1;
    }
  }



  int ans = 0;
  for (int j = 0; j < 100; j++) {
    int prev = -1;
    for (int i = 0; i < 100; i++) {
      if (bd[i][j]) {
        if (prev != -1) {
          assert(j < 99);
          // long x = expaX[i] - expaX[prev];
          // long y = expaY[j + 1] - expaY[j];
          // assert(x > 0 && y > 0);
          // ans += x * y;
          for (int k = prev; k < i; k++) {
            board[k][j] = 1;
          }
          prev = -1;
        } else {
          prev = i;
        }
      }
    }
  }

  int minx = 100, maxx = 0, miny = 100, maxy = 0;
  for (P p: presRec) {
    minx = min(minx, p.first);
    maxx = max(maxx, p.first);
    miny = min(miny, p.second);
    maxy = max(maxy, p.second);
  }

  for (int i = minx; i < maxx; i++) {
    for (int j = miny; j < maxy; j++) {
      board[i][j] = 0;
    }
  }

  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      if (board[i][j]) {
        assert(i < 99 && j < 99);
        long x = expaX[i + 1] - expaX[i];
        long y = expaY[j + 1] - expaY[j];
        ans += x * y;
      }
    }
  }
  cout << ans << endl;
}

signed main() {
  int n;
  while (1) {
    cin >> n;
    if (n == 0) return 0;
    solve(n);
  }
}



Measured memory_bytes: 3280
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		boolean[] used=new boolean[11];
		for(; sc.hasNext();){
			Arrays.fill(used, false);
			int c1=sc.nextInt();
			int c2=sc.nextInt();
			int c3=sc.nextInt();
			used[c1]=used[c2]=used[c3]=true;
			int d=0, n=0;
			for(int j=1; j<=10; j++){
				if(!used[j]){
					used[j]=true;
					for(int i=1; i<=10; i++){
						if(!used[i]){
							d++;
							if(c1+c2+i<=20){
								n++;
							}
						}
					}
					used[j]=false;
				}
			}
			println(n*2>=d?"YES":"NO");
		}
	}

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

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

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

int main() {
  int H,W;
  cin >> H >> W;
  vector<string> a(H);
  for (int i=0; i<H; i++){
    cin >> a.at(i);
  }
  for(int i=0; i<W+2; i++)  cout << '#';
  cout << endl;
  for (int i=0; i<H; i++)  cout << '#' << a.at(i) << '#' << endl;
  for(int i=0; i<W+2; i++)  cout << '#';
  cout << endl;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool input(int* m, int* n){
	cin >> *m >> *n;
	return !(*m == 0 && *n == 0);
}

int main(void){
	int a, b;
	bool line = false;
	while(input(&a, &b)){
		if(line){
			cout << endl;
		}else{
			line = true;
		}
		bool na = true;
		for(int i = a; i <= b; i++){
			if(i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)){
				cout << i << endl;
				na = false;
			}
		}
		if(na){
			cout << "NA" << endl;
		}
	}

	return 0;
}

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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define whole(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

const int N = int(1e6) + 2;
const int LG = 20;
const ll mod = (int)1e9 + 7;
const int INF = (int)1e9 + 7;
const ll linf = 1e16;
const ld pi = acos(-1);
const int base = 10;
const ld EPS = 1e-9;

int n;
ld x[10], y[10];

ld dist (int i, int j)
{
    ld ans = 1.0 * sqrt(((x[i] - x[j]) * (x[i] - x[j])) + ((y[i] - y[j]) * (y[i] - y[j])));
    return ans;
}

int main ()
{
    cin >> n;
    vector < int > order;
    for (int i = 1; i <= n; ++i)
    {
        cin >> x[i] >> y[i];
        order.pb(i);
    }

    ld ans = 0;
    int kol = 0;
    do
    {
        ld sum = 0;
        for (int i = 1; i < sz(order); ++i) sum += (dist(order[i], order[i - 1]));
        ans += sum;
        ++kol;
    }while (next_permutation(whole(order)));

    ans = ans / kol;
    cout << fixed << setprecision(9) << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,r; cin>>n>>r;
	if (n<=10) cout<<100*(10-n)+r;
	else cout<<r<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long ;
int main(){
    ll h,n;
    cin >> h >>n;
    vector<ll> a(n);
    ll i,j;
    ll sum=0;
    ll han=0;
    for(i=0;i<n;i++){
        cin >> a.at(i);
        sum+=a.at(i);
        if(sum>=h)han++;
        }
    if(han!=0)cout << "Yes" <<endl;
    else cout << "No" << endl;

    return 0;
}

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

const int N = 2000054;

int A, B, D, n, top = 0, top2 = 0;
int stack[N], stack2[N];
char a[N], b[N];

inline void init(char *s) {char *p; for (p = s; *p; ++p) *p &= 1; std::reverse(s, p);}

inline void print(char *s) {
	char *p = s + N;
	for (; !*--p; ); for (; putchar(*p | 48), p-- != s; ); putchar(10);
}

void andition(int pos) {
	int remain = n, type = 3, nxt; bool alive = true;
	for (a[pos] = b[pos] = 0; alive && top; )
		switch (alive = false, nxt = stack[top - 1], type) {
			case 1:
				if (pos + 1 >= nxt) a[pos = nxt] || (type = 3), a[pos] = b[pos] = 0, --top, alive = true;
				break;
			case 2:
				if (pos + 1 >= nxt) b[pos = nxt] || (type = 3), a[pos] = b[pos] = 0, --top, alive = true;
				break;
			case 3:
				if (pos + remain >= nxt)
					remain -= nxt - pos, pos = nxt,
					type = a[pos] | b[pos] << 1, a[pos] ^= 1, b[pos] ^= 1;
					stack2[top2++] = pos, --top, alive = true;
				break;
		}
	switch (type) {
		case 1: stack2[top2++] = ++pos, a[pos] = 1, b[pos] = 0; break;
		case 2: stack2[top2++] = ++pos, a[pos] = 0, b[pos] = 1; break;
		case 3: pos += remain, a[pos] = b[pos] = 1; break;
	}
	for (; top2; stack[top++] = stack2[--top2]);
}

int main() {
	int i;
	scanf("%d%d%d%s%s", &A, &B, &n, a, b);
	init(a), init(b), D = std::max(A, B);
	for (i = D - 1; i >= 0; --i)
		if (a[i] && b[i]) andition(i);
		else if (a[i] || b[i]) stack[top++] = i;
	print(a), print(b);
	return 0;
}

Measured memory_bytes: 13440
def resolve():
    def counts(x):
        ans = 0
        if x < 0:
            x = -x
            r = 0
            for mi in minus[::-1]:
                while r < len(plus) and plus[r] * mi < x:
                    r += 1
                ans += len(plus) - r
            return ans

        r = 0
        for l in minus[::-1]:
            if l * l <= x: ans -= 1
            while r < len(minus) and minus[r] * l <= x:
                r += 1
            ans += r
        r = 0
        for l in plus[::-1]:
            if l * l <= x: ans -= 1
            while r < len(plus) and plus[r] * l <= x:
                r += 1
            ans += r

        ans //= 2
        ans += len(minus) * len(plus)
        return ans

    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    minus = [-x for x in A if x < 0]
    plus = [x for x in A if x >= 0]

    minus.sort()
    plus.sort()

    low = -10 ** 18 - 1
    high = 10 ** 18 + 1
    while high - low > 1:
        mid = (high + low) // 2
        if counts(mid) < K:
            low = mid
        else:
            high = mid

    print(high)


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 150828
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;
typedef pair<double, double> P;
const double eps = 1e-9;

double Length(P p1, P p2)
{
	return(sqrt((p1.first - p2.first) * (p1.first - p2.first) + (p1.second - p2.second) * (p1.second - p2.second)));
}

double Helon(P p1, P p2, P p3)
{
	double a = Length(p1, p2);
	double b = Length(p2, p3);
	double c = Length(p3, p1);
	double s = (a + b + c) / 2;
	return(sqrt(s * (s - a) * (s - b) * (s - c)));
}

void solve()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i)
	{
		vector<P> Point(3);
		P pk, ps;
		for(int j = 0; j < 3; ++j)
		{
			cin >> Point[j].first >> Point[j].second;
		}
		cin >> pk.first >> pk.second >> ps.first >> ps.second;
		double S = Helon(Point[0], Point[1], Point[2]);
		double S1 = Helon(Point[0], Point[1], pk);
		S1 += Helon(Point[1], Point[2], pk);
		S1 += Helon(Point[2], Point[0], pk);

		double S2 = Helon(Point[0], Point[1], ps);
		S2 += Helon(Point[1], Point[2], ps);
		S2 += Helon(Point[2], Point[0], ps);

		if(fabs(S - S1) < eps && fabs(S - S2) >= eps || fabs(S - S1) >= eps && fabs(S - S2) < eps)
		{
			cout << "OK" << endl;
		}
		else
		{
			cout << "NG" << endl;
		}
	}
}

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

Measured memory_bytes: 952
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[][] s = new int[M][];
        for (int i = 0; i < s.length; ++i) {
            int k = sc.nextInt();
            s[i] = new int[k];
            for (int j = 0; j < s[i].length; ++j) {
                s[i][j] = sc.nextInt() - 1;
            }
        }
        int[] p = new int[M];
        for (int i = 0; i < p.length; ++i) {
            p[i] = sc.nextInt();
        }

        System.out.println(solve(N, s, p));

        sc.close();
    }

    static int solve(int N, int[][] s, int[] p) {
        int result = 0;
        for (int code = 0; code < 1 << N; ++code) {
            int code_ = code;
            if (IntStream.range(0, s.length)
                    .allMatch(i -> Arrays.stream(s[i]).filter(j -> (code_ & (1 << j)) != 0).count() % 2 == p[i])) {
                ++result;
            }
        }

        return result;
    }
}

Measured memory_bytes: 39972
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#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 showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


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

    ll ans = 0;
    rep1(i, n){
        ll k = n/i;
        ans += (ll)i*k*(k+1)/2;
    }

    cout << ans << endl;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using P = pair<int,int>;
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;}




int main()
{
    double a,b,x,y,angle;
    cin >> a >> b >> x;

    bool ok = true;
    if(a*a*b/2.0 > x) ok = false;

    if(ok){
        y = (a*a*b - x)/(a*a)*2;
        angle = atan(a/y);
    }
    else{
        y = x/(a*b)*2;
        angle = atan(y/b);
    }
    const double pi = 3.1415926535897939;
    angle = 90 - angle / 2.0 / pi * 360;

    cout << fixed;
    cout << setprecision(9) << angle << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define pb push_back
#define f first
#define s second
#define pi 3.141592653589793238
using namespace std;

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*b)/gcd(a,b);
}

ll power(ll a, ll b)	//a is base, b is exponent
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	if(b%2 == 1)
		return (power(a,b-1)*a)%mod;
	ll q = power(a,b/2);
	return (q*q)%mod;
}
bool win[200000];
int main()
{
	std::ios::sync_with_stdio(false);
	ll n,k;
	cin >> n >> k;
	ll arr[n+2];
	for(int i =0;i<n;i++)
	{
		cin >> arr[i];
		win[arr[i]]=true;
	}	

	for(int i = 1;i<=k;i++)
	{
		for(int j =0;j<n;j++)
		{
			if(i-arr[j]>0&&win[i-arr[j]]==false) win[i] = true;
		}
	}

	if(win[k]) cout << "First\n";
	else cout << "Second\n";
	return 0;
}


//Hello, this is a snippet.


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) ((v).begin(),(v).end())
using namespace std;

int main(){
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    int k_h = k / 60;
    int k_m = k % 60;
    h2 -= k_h;
    m2 -= k_m;

    int ans_h = h1 - h2;
    int ans_m = m1 - m2;

    cout << abs(60*ans_h + ans_m) << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.io.*;
import java.text.*;
import java.util.*;

public class Main {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

    static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000");
        long maxi = Integer.MAX_VALUE;
        long mod = (long) (1e9 + 7);

        long pro(long a, long b) {
            return (a % mod * b % mod) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        void solve() {
            int n = sc.ni();
            int m = sc.ni();
            int n1 = (n * (n - 1)) / 2;
            int n2 = (m * (m - 1)) / 2;
            out.println(n1 + n2);
        }
    }
}


Measured memory_bytes: 21716
from collections import deque
N = int(input())
graph = [[] for _ in range(N)]
ditstant = [float('inf')]*N
visited = [False]*N
tmp = {}
for _ in range(N-1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
    tmp[a, b] = c
    tmp[b, a] = c
Q, K = map(int, input().split())
K -= 1
ditstant[K] = 0  # Kの地点は0にする
visited[K] = True
q = deque([K])
while len(q):
    v = q.popleft()
    for e in graph[v]:
        if visited[e]:
            continue
        visited[e] = True
        ditstant[e] = min(ditstant[e], ditstant[v]+tmp[v, e])
        q.append(e)
for _ in range(Q):
    x, y = map(lambda x: int(x)-1, input().split())
    print(ditstant[x] + ditstant[y])


Measured memory_bytes: 58272
#include <bits/stdc++.h>
#define lol long long
using namespace std;
 
//const lol mod=1e9+7;
 
/*  author: H3XoRuSH  */
 
int main() {
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lol a,b;
    cin >> a >> b;
    lol temp=b-a;
    temp=temp*(temp+1)/2;
    cout << temp-b;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  string s;
  cin >> s;
  if (s[0] == s[1] && s[1] == s[2] || s[1] == s[2] && s[2] == s[3]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<cstdint>
using namespace std;
int main() {
	int n, t, f, l;
	int64_t sum = 0;
	cin >> n >> t >> f;
	for (int i = 0;i < n - 1;i ++) {
		cin >> l;
		sum += min(l-f, t);
		f = l;
	}
	cout << sum+t;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll mod=1e9+7;
ll a[100009];
ll qpow(ll a,ll b)
{
    ll base=a,ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*base)%mod;
        }
        base=(base*base)%mod;
        b>>=1;
    }
    return ans%mod;
}
int main()
{
    memset(a,0,sizeof(a));
    int n;
    cin>>n;
    int x;
    for(int i=1; i<=n; i++)
    {
        cin>>x;
        a[x]++;
    }
    if(n%2==0)
    {
        for(int i=1; i<=n; i+=2)
        {
            if(a[i]!=2)
            {
                cout<<"0"<<endl;
                return 0;
            }
        }
        cout<<qpow(2,n/2)<<endl;
        return 0;
    }
else if(n%2==1)
    {
        if(a[0]!=1)
        {
            cout<<"0"<<endl;
            return 0;
        }
        else
        {
            for(int i=2; i<=n; i+=2)
            {
                if(a[i]!=2)
                {
                    cout<<"0"<<endl;
                    return 0;
                }
            }
            cout<<qpow(2,n/2)<<endl;
            return 0;
        }
    }
}


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

int main() {
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    int n; cin >> n;
    for (int i = n; i >= 1; i--) {
        if ((i & (-i)) == i) {
            cout << i << '\n';
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 999999999
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define MOD(x) (x%(mod))
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int main(){
  int n,m;
  ll ans=1;
  cin>>n>>m;
  if(abs(n-m)>1){
    cout<<0<<endl;
    return 0;
  }

  for(int i=n;i>=1;i--)ans=MOD(ans*i);
  for(int i=m;i>=1;i--)ans=MOD(ans*i);

  if(n==m)cout<<MOD(ans*2)<<endl;
  else cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
grid = [[i & 1 for i in map(int, input().split())] for _ in range(h)]

# 注目するマスが奇数の場合下に動かしていく
ans = []

for i in range(h-1):
    for j in range(w):
        if grid[i][j] % 2 == 0:
            continue
        grid[i + 1][j] += 1
        grid[i][j] -= 1
        ans.append((i+1, j+1, i + 2, j+1))

for i in range(w - 1):
    if grid[-1][i] % 2 == 0:
        continue
    grid[-1][i + 1] += 1
    grid[-1][i] -= 1
    ans.append((h, i+1, h, i+2))

print(len(ans))
for i in ans:
    print(*i, sep=" ")


Measured memory_bytes: 26636