akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
using namespace std;

int main()
{
  int n;
  cin >> n;
  double nd, xd;
  int x;
  nd = static_cast<double>(n);
  x = n - (int)(nd*2.0/27.0);
  if((int)(x*1.08)!=n) x=0;
  if(x > 0){
    printf("%d\n", x);
  }else{
    printf(":(\n");
  }

}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	var (
		minL = 1
		maxR = n
		l, r int
	)
	for i := 0; i < m; i++ {
		fmt.Scan(&l, &r)
		if l > minL {
			minL = l
		}
		if r < maxR {
			maxR = r
		}
	}
	ans := maxR - minL + 1
	if ans < 0 {
		fmt.Println(0)
		return
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);
    
    char C[6];
    FOR(i,0,6)
        cin >> C[i];
    if (C[0] == C[5] && C[1] == C[4] && C[2] == C[3])
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

ll r,l;

int main(){
    cin >> l >> r;

    if(l <= 2019 && r >= 2019){
        cout << 0 << endl;
        return 0;
    }

    if(r-l >= 2019){
        cout << 0 << endl;
        return 0;
    }

    ll mo = 2019;

        ll tmp = 2019;
        for(ll i = l; i <= r; i++){
            for(ll j = i+1; j <= r; j++){
                ll mem = (i*j)%mo;
                //cout <<i << ' ' << j  << ' ' <<  mem << endl;
                tmp = min(tmp, mem);
            }
        }

        cout << tmp << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, from, to) for (int i = from; i < to; i++)
#define sortv(x) sort(x.begin(), x.end())
#define revv(x) sort(x.begin(), x.end(), greater<int>())
#define dump(x) cerr << #x << " = " << x << endl
typedef vector<int> vi;
typedef long long ll;
int main()
{
  double N;
  cin >> N;
  vector<double> a(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];
  double total = 0;
  for (int i = 0; i < N; i++)
    total += a[i];
  double ave = total / N;
  int ans = 0;
  double Min = 100000;
  for (int i = 0; i < N; i++)
  {
    double dist = abs(ave - a[i]);
    if (dist < Min)
    {
      Min = dist;
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    int a[2][n];
    for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
            cin >> a[i][j];
        }
    }
    int b[n];
    b[0]=a[0][0];
    for(int i=1;i<n;i++){
        b[i]=b[i-1]+a[0][i];
    }
    int c[n];
    int count=0;
    for(int i=0;i<n;i++){
        count+=a[1][i];
    }
    c[0]=count;
    for(int i=1;i<n;i++){
        c[i]=c[i-1]-a[1][i-1];
    }
    int ans=0;
    for(int i=0;i<n;i++){
        ans=max(ans,b[i]+c[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int sum=0;
    int r=n%10;
    int d=n;
    while(d>0){
        sum+=r;
        d/=10;
        r=d%10;
    }
    
    if(n%sum==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
  int num;
  cin >> num;
  string taro, hanako;
  int taro_count=0, hanako_count=0;

  for (int i = 0; i < num; i++) {
    cin >> taro >> hanako;
    if (taro == hanako) {
      taro_count++;
      hanako_count++;
    } else if (taro > hanako) {
      taro_count += 3;
    } else {
      hanako_count += 3;
    }
  }
  cout << taro_count <<	" " << hanako_count << endl;
  return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    while(A>=0 && C>=0)
    {
        C=C-B;
        if(C<=0)
        {
            break;
        }
        A=A-D;
    }
    if(A>0)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int n;
const int MAX = 32768;

int solve(int sum,int cnt,int num){
  if(sum == n) return 1;  
  if(sum+num*num > n|| cnt == 4) return 0;
  int res  = 0;
  res+=solve(sum+num*num,cnt+1,num);
  res+=solve(sum,cnt,num+1);
  return res;
}
int main(){
  
  while(cin >> n && n != 0){
	cout << solve(0,0,1) << endl;
  }
  
  return 0;
}

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

int main() {
  string Ans;
  int N; cin >>N;
  //int B; cin >>B;
  cout << "ABC" << N << '\n';
  return 0;
}


Measured memory_bytes: 3612
import java.lang.*;
import java.util.*;
//codechef mein public nahi aata hai class se pehle
//or agr public lagana h to Class name Main hoga
//par codeforces men public class xyz aata hi aata he mtlb public aata hi h
public class Main 
{
    public static void main( String args[]) 
    {
        final Scanner s = new Scanner(System.in);
        final int n = s.nextInt();
        double pi=3.1415926535;
        pi=pi*2;
        System.out.println(pi*n);
    }
}

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

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

using namespace std;
typedef long long ll;

int main(){
  int a,b,k; cin >> a >> b >> k;

  int max_num = 0;
  rep(i,k){
    if(a+i <= b){
      cout << a+i << endl;
      max_num = a+i;
    }
  }
  rep(i,k){
    if(b-k+i+1 > max_num) cout << b-k+i+1 << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <vector>

using namespace std;

int main() {
	vector<int> list;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int input;
		cin >> input;
		list.push_back(input);
	}
	int count = 0;
	while (true){
		label:
		for (int i = 0; i < n; i++) {
			if (list[i] % 2 == 0){
				list[i] /= 2;
				count++;
				goto label;
			}
		}
		break;
	}
	cout << count;
	//cin >> n;
	return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N,K;
	cin >> N>>K;
	string S;
	cin >> S;
	vector<int>A;
	int now = -1;
	if ('0' == S[0]) {
		A.push_back(0);
		now++;
	}
	for (int n = 0;n<N;++n) {
		if (0 == n) {
			A.push_back(1);
			now++;
		}
		else {
			if (S[n-1] != S[n]) {
				A.push_back(1);
				now++;
			}
			else {
				A[now]++;
			}
		}
	}
	if ('0' == S[N - 1]) {
		A.push_back(0);
		now++;
	}
	if (A.size()<=2 * K + 1) {
		cout << N<<endl;
		return 0;
	}
	int ans = 0;
	int sum = 0;
	for (int n = 0;n<2 * K + 1;++n) {
		ans += A[n];
	}	
	sum = ans;
	for (int n = 0; 2 * K + 2 + n <= A.size()-1; n += 2) {
		if (2*K+2+n >= A.size()) {
			cout << sum << endl;
			break;
		}
		sum -= A[n];
		sum -= A[n+1];
		sum += A[2*K+1+n];
		sum += A[2*K+2+n];
		ans = max(ans, sum); 
	}
	cout << ans<<endl;
	return 0;
}

Measured memory_bytes: 4052
#include <stdio.h>
#include <iostream>
using namespace std;

int main()
{
    int n, a, cnt,min=100000;
    bool flag = true;
    cin >> n;

    for(int i=0;i<n;i++){
        cin >> a;
        for(int j = 0; j < min; j++){
            if(a%2 == 1){
                if(j < min){
                    min = j;
                }
                break;
            }
            a /= 2;
        }
    }
    
    cout << min << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

const int MaxN = 2000;
int n, m;
int a[MaxN + 5][MaxN + 5];
int b[MaxN + 5][MaxN + 5];
int l[MaxN + 5], r[MaxN + 5], h[MaxN + 5];
char s[MaxN + 5];

bool Check(int x, int y)
{
	int cnt = 0;
	cnt += b[x][y];
	cnt += b[x + 1][y];
	cnt += b[x][y + 1];
	cnt += b[x + 1][y + 1];
	return (!(cnt & 1));
}

void Init()
{
	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));
	for (int i = 1; i <= n; i++) {
		scanf("%s", s);
		for (int j = 0; j < m; j++)
			b[i][j + 1] = (int)(s[j] == '#');
	}
	for (int i = 1; i <= n - 1; i++)
		for (int j = 1; j <= m - 1; j++)
			if (Check(i, j)) a[i][j] = 1;
				else a[i][j] = 0;
}

void Solve()
{
	int i = 0, j = 0, lmax = 0, rmax = 0, ans = max(n, m);
	n--; m--;
	memset(l, 0, sizeof(l));
	memset(r, 0, sizeof(r));
	memset(h, 0, sizeof(h));
	/*for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++)
			printf("%d ", a[i][j]);
		printf("\n");
	}*/
	for (i = 1; i <= m; i++) l[i] = 1, r[i] = m;
	for (i = 1; i <= n; i++) {
		for (lmax = j = 1; j <= m; j++) if (a[i][j]) {
			h[j]++;
			if (lmax > l[j]) l[j] = lmax;
		}else h[j] = 0, l[j] = 1, r[j] = m, lmax = j + 1;
		for (rmax = j = m; j; j--) if (a[i][j]) {
			if (rmax < r[j]) r[j] = rmax;
			if (r[j] - l[j] + 1 > 0 && h[j] > 0) {
				ans = max(ans, (r[j] - l[j] + 2) * (h[j] + 1));
			}
		}else rmax = j - 1;
	}
	printf("%d\n", ans);
}

int main()
{
	while (~scanf("%d%d", &n, &m)) {
		Init();
		Solve();
	}
	return 0;
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		String line;
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while ((line = br.readLine()) != null) {
			if (line.equals("-1 -1 -1")) {
				break;
			}

			String[] token = line.split(" ");
			int m, f, r, sum;
			m = Integer.parseInt(token[0]);
			f = Integer.parseInt(token[1]);
			r = Integer.parseInt(token[2]);
			sum = m + f;

			if (m == -1 || f == -1) {
				System.out.println("F");
			} else if (sum >= 80) {
				System.out.println("A");
			} else if (sum >= 65) {
				System.out.println("B");
			} else if (sum >= 50) {
				System.out.println("C");
			} else if (sum >= 30) {
				if (r >= 50) {
					System.out.println("C");
				} else {
					System.out.println("D");
				}
			} else {
				System.out.println("F");
			}
		}
	}
}

Measured memory_bytes: 24252
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
// import java.math.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            PrintWriter ot=new PrintWriter(System.out);
            int n=Integer.parseInt(br.readLine().trim());
            
            int total=0;
            int a[][]=new int[n][2];
            for(int i=0;i<n;i++)
            {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            }
            boolean bool=false;
            for(int i=0;i<n-2;i++)
            {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            }
            if(bool)
            ot.println("Yes");
            else
            ot.println("No");
            // while(t-->0)
            // {
                
            // }
            br.close();
            ot.close();
                        
        } catch(Exception e){
            System.err.println("ERROR");
            return;
        }
    }
}
    

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

#define int long long

#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

using namespace std;
using P = pair<int, int>;
using ll = long long;
using ld = double;

using bint = boost::multiprecision::cpp_int;

constexpr int MOD = 1e9 + 7;

template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}

// https://twitter.com/vane11ope ←フォローしましょう
// (ノ)>◡<(ヾ)ﾓﾁﾓﾁ
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    cin>>n;
    vector<int> l(n);
    rep(i,n)cin>>l[i];
    sort(l.begin(),l.end());
    int ans=0;
    rep(i,n){
        rep(j,i){
            rep(k,j){
                if(l[i]==l[j]||l[j]==l[k])continue;
              if(l[k]+l[j]>l[i])ans++;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3668
//コンパイラ最適化用
#pragma GCC optimize("Ofast")

//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//INT_MAXなど
#include<chrono>//実行時間計測
#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,accumulate
#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;

// clang++ main.cc -std=c++11 -stdlib=libc++

/*
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];
*/

signed main(){
  int N, M, X;
  cin >> N >> M >> X;

  vector<int> A(N);
  for (int i = 0; i < M; i++)
    cin >> A[i];

  int sum_l = 0, sum_r = 0;
  for (int i = 0; i < M; i++) {
    if (A[i] > X) sum_l++;
    else sum_r++;
  }
  cout << min(sum_l, sum_r) << endl;

  return 0;
}

Measured memory_bytes: 3612
# abc121_b.py
# https://atcoder.jp/contests/abc121/tasks/abc121_b

# B - Can you solve this? /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# N個のソースコードがあり、i 個目のソースコードの特徴は Ai1,Ai2,...,AiM の M個の整数で表されます。
# また、整数 B1,B2,...,BMと 整数 Cが与えられます。
# Ai1B1+Ai2B2+...+AiMBM+C>0のときに限り、i個目のソースコードはこの問題に正答するソースコードです。
# N個のソースコードのうち、この問題に正答するソースコードの個数を求めてください。

# 制約

#     入力は全て整数である。
#     1≤N,M≤20
#     −100≤Aij≤100
#     −100≤Bi≤100
#     −100≤C≤100

# 入力

# 入力は以下の形式で標準入力から与えられる。
# N M C
# B1 B2 ... BM
# A11 A12 ... A1M
# A21 A22 ... A2M
# ⋮
# AN1 AN2 ... ANM

# 出力
# N個のソースコードのうち、この問題に正答するソースコードの個数を出力せよ。

# 入力例 1
# 2 3 -10
# 1 2 3
# 3 2 1
# 1 2 2

# 出力例 1
# 1

# 以下のように 2個目のソースコードのみがこの問題に正答します。

#     3×1+2×2+1×3+(−10)=0≤0なので 1個目のソースコードはこの問題に正答しません。
#     1×1+2×2+2×3+(−10)=1>0なので 2個目のソースコードはこの問題に正答します。

# 入力例 2
# 5 2 -4
# -2 5
# 100 41
# 100 40
# -3 0
# -6 -2
# 18 -13

# 出力例 2
# 2

# 入力例 3
# 3 3 0
# 100 -100 0
# 0 100 100
# 100 100 100
# -100 100 100

# 出力例 3
# 0

# 全て Wrong Answer です。あなたのソースコードは含めません。


def calculation(lines):
    # line = lines[0]
    # N = int(lines[0])
    N, M, C = list(map(int, lines[0].split()))
    values_b = list(map(int, lines[1].split()))
    # values = list(map(int, lines[1].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i+1]))
    valueses = list()
    for i in range(N):
        valueses.append(list(map(int, lines[i+2].split())))

    cnt = 0

    for values in valueses:
        sm = C
        for i in range(M):
            sm += values_b[i] * values[i]
        if sm > 0:
            cnt += 1

    return [cnt]


# 引数を取得
def get_input_lines():
    line = input()
    N, M, C = list(map(int, line.split()))
    lines = list()
    lines.append(line)
    for _ in range(N+1):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['2 3 -10', '1 2 3', '3 2 1', '1 2 2']
        lines_export = [1]
    if pattern == 2:
        lines_input = ['5 2 -4', '-2 5', '100 41', '100 40', '-3 0', '-6 -2', '18 -13']
        lines_export = [2]
    if pattern == 3:
        lines_input = ['3 3 0', '100 -100 0', '0 100 100', '100 100 100', '-100 100 100']
        lines_export = [0]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines()
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


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

int main(){
  int N;
  cin>>N;
  vector<int> t(N+1);
  vector<vector<int>> p(N+1,vector<int>(2));
  for(int i=1;i<N+1;++i){
    cin>>t.at(i)>>p.at(i).at(0)>>p.at(i).at(1);
  }
  t.at(0)=0;
  p.at(0)={0,0};
  bool ans;
  ans=true;
  for(int i=0;i<N;++i){
    int M=abs(p.at(i+1).at(0)-p.at(i).at(0))+abs(p.at(i+1).at(1)-p.at(i).at(1));
    if(t.at(i+1)-t.at(i)-M<0 || (t.at(i+1)-t.at(i)-M)%2 !=0){
    ans=false;
    cout<<"No"<<endl;
    break;
    }
    }

  if(ans){
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 6144
#!/usr/bin/env python3

import math, itertools, operator
from math import *
from math import factorial as fact
from itertools import permutations, combinations
from functools import reduce
from statistics import mean, median, median_low, median_high, mode
# Before Python 3.5
from fractions import gcd

#import numpy
#import scipy, scipy.special
#from sympy import isprime, nextprime
#from sympy.ntheory import factorint
#from sympy import divisors

inf = float('inf')

def lcm(a, b):
    return a * b // gcd(a,b)

def perm(a, b):
    import scipy.special
    return scipy.special.perm(a, b, exact = True)

def comb(a, b):
    import scipy.special
    return scipy.special.comb(a, b, exact = True)

def dfact(n):
    import scipy.special
    return scipy.special.factorial2(n, exact = True)

def prod(l):
    return reduce(operator.mul, l)

def input_ints(inp = input, sep = ' ', conv = int):
    return map(conv, inp().split(sep = sep))

################################################################################


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


def prime_factors(n):
    prime_factor_list = []
    while not n % 2:
        prime_factor_list.append(2)
        n //= 2
    while not n % 3:
        prime_factor_list.append(3)
        n //= 3
    i = 5
    while n != 1:
        if is_prime(i):
            while not n % i:
                prime_factor_list.append(i)
                n //= i
        i += 2

    return prime_factor_list

def divisors2(factors) :
    """
    Generates all divisors, unordered, from the prime factorization.
    """
    ps = sorted(set(factors))
    omega = len(ps)

    def rec_gen(n = 0) :
        if n == omega :
            yield 1
        else :
            pows = [1]
        for j in range(factors.count(ps[n])) :
            pows += [pows[-1] * ps[n]]
        for q in rec_gen(n + 1) :
            for p in pows :
                yield p * q

    for p in rec_gen() :
        yield p

def divisors(N):
    l = []
    for i in range(1,int(sqrt(N))+1):
        if N % i == 0:
            l.append(i)
    return l

N = int(input())

cnt = 0
#for p in divisors(prime_factors(N)):
for p in divisors(N):
    m = N // p
    if not p < m-1:
        break
    #print(m-1)
    cnt += m-1

print(cnt)


Measured memory_bytes: 5632
N = int(input())
A = list(map(int, input().split()))

d = {}

for i in range(N - 1):
    if A[i] in d:
        d[A[i]].append(i + 2)
    else:
        d[A[i]] = [i + 2]

for i in range(1, N + 1):
    if i in d:
        print(len(d[i]))
    else:
        print(0)


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

#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;

ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}

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

ll powerm(ll base,ll exp,ll mod) 
{ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}

using namespace std;

int main() 
{	
	fast;
	ll n; cin>>n; ll arr[n]; for(ll i = 0; i < n; i++) cin>>arr[i];
	ll dp[n];
	dp[0] = 0;
	dp[1] = abs(arr[1] - arr[0]);
	for(ll i = 2; i < n; i++)
	{
		dp[i] = min(  abs(arr[i] - arr[i-1]) + dp[i-1]  ,  abs(arr[i] - arr[i-2])  + dp[i-2] );
	}
	cout << dp[n-1] << endl;
 	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    double b = 0.0;
    cin >> N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
    cin >> A[i];
    b += (double)1/A[i];
        }
        cout << 1/b << endl;
}


Measured memory_bytes: 256
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('d1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def solve(t, R, S, P):
    n = len(t)
    m = [[0] * 3 for i in range(n)]
    m[0][0] = R if t[0] == 's' else 0
    m[0][1] = S if t[0] == 'p' else 0
    m[0][2] = P if t[0] == 'r' else 0

    for i in range(1, n):
      m[i][0] = max(m[i-1][1], m[i-1][2])
      m[i][0] += R if t[i] == 's' else 0
      m[i][1] = max(m[i-1][0], m[i-1][2])
      m[i][1] += S if t[i] == 'p' else 0
      m[i][2] = max(m[i-1][0], m[i-1][1])
      m[i][2] += P if t[i] == 'r' else 0

    return max([m[n-1][0], m[n-1][1], m[n-1][2]])


def bigger(l):
  if l == 'r':
    return 'p'
  if l == 'p':
    return 's'
  if l == 's':
    return 'r'


def solve_greedy(t, R, S, P):
    n = len(t)
    res = 0
    l = ''
    score = {'r': R, 's': S, 'p': P}
    for i in range(n):
      for k in 'rps':
        if t[i] == k:
          if l != bigger(k):
            l = bigger(k)
            res += score[bigger(k)]
          else:
            for q in 'rps':
              if q != bigger(k):
                if i+1 < n and bigger(t[i+1]) != q:
                  l = q
    return res


def main():
    N, K = read_int_list()
    R, S, P = read_int_list()
    T = read_str()

    res = 0
    for i in range(K):
      # res += solve(T[i::K], R, S, P)
      res += solve_greedy(T[i::K], R, S, P)
    
    print(res)


main()


Measured memory_bytes: 3828
n = int(input())
a = sorted(list(map(int,input().split())))
m = max(a)+1
c = [0]*m
for x in a:
    for i in range(x,m,x):
        if c[i]<2:c[i]+=1
ans = 0
for i in a:
    if c[i]==1:
        ans += 1
print(ans)

Measured memory_bytes: 32332
#include <stdio.h>
 
int check(int age){
    if(age<10) return 0;
    else if(age<20) return 1;
    else if(age<30) return 2;
    else if(age<40) return 3;
    else if(age<50) return 4;
    else if(age<60) return 5;
    else return 6;  
}
 
int main(void){
    int n , i , buf , cnt[7];
    while(1){
        for(i=0;i<7;i++) cnt[i] = 0;
        scanf("%d" , &n);
        if(n==0) break;
        for(i=0;i<n;i++){
            scanf("%d" , &buf);
            cnt[check(buf)]++;
        }
        for(i=0;i<7;i++) printf("%d\n" , cnt[i]);
    }
     
    return 0;
}

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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1L<<29)

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

typedef int Cost;
struct Edge {
  int src, dst; Cost cost;
  Edge(int s, int d, Cost c) : src(s), dst(d), cost(c) {}
};
typedef vector<Edge>  Edges;
typedef vector<Edges> Graph;
typedef vector<Cost>  Array;
typedef vector<Array> Matrix;

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

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  string str; cin >> str;
  string ans = "CODEFESTIVAL2016";
  int cnt = 0;
  for (int i = 0; i < ans.size(); i++) {
    cnt += (ans[i] != str[i]);
  }
  cout << cnt << endl;
  return 0; 
}


Measured memory_bytes: 256
import string
import collections
n = int(input())
res = ''
dic_lst = []
for i in range(n):
  w = collections.Counter(input())
  dic_lst.append(w)
for ch in string.ascii_lowercase:
  cc = 100
  for w in dic_lst:
    cc = min(cc, w[ch])
  res += ch * cc
print(res)
  

Measured memory_bytes: 3772
N = int(input())
L = [[] for i in range(N+1)]
d = [-1] * (N+1)
f = [0] * (N+1)
nkey = []
ntime = []


def bfs():
    while len(nkey):
        key = nkey.pop(0)
        time = ntime.pop(0)
        if d[key] == -1:
            d[key] = time
        for i in range(len(L[key])):
            if d[L[key][i]] == -1:
                nkey.append(L[key][i])
                ntime.append(time+1)
        

for i in range(N):
    Q = list(map(int, input().split()))
    L[Q[0]].extend(Q[2:])

nkey.append(1)
ntime.append(0)
bfs()


for i in range(1,N+1):
    print(i, d[i])



Measured memory_bytes: 6352
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let N = Int(readLine()!)!
    var (t, x, y) = (0, 0, 0)
    for _ in 1...N {
        let line = readInts()
        let t_ = line[0]
        let x_ = line[1]
        let y_ = line[2]
        let dt = t_ - t
        let dx = abs(x_ - x)
        let dy = abs(y_ - y)
        if dt < dx + dy {
            print("No")
            return
        }
        if t_ % 2 != (x_ + y_) % 2 {
            print("No")
            return
        }
        (t, x, y) = (t_, x_, y_)
    }
    print("Yes")
}

main()


Measured memory_bytes: 8228
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True


def main():
    N = I()
    a = ['AC', 'WA', 'TLE', 'RE']
    cnt = defaultdict(int)

    for i in range(N):
        s = S()
        cnt[s] += 1

    for s in a:
        print("{} x {}".format(s, cnt[s]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 69632
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, A, B = MAP()

a = B - A + 1
c = B * (N-1) - A * (N-1) + 1
mi = A + B + A * (N - 2)
ma = A + B + B * (N - 2)
print(max(0, ma-mi+1))

Measured memory_bytes: 3896
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <stack>
#include <vector>
#include <stack>
using namespace std;

//常に心してかかれ
//簡単なことを簡単にできるように練習する

	int n;
	int A[20+1];
	int q;
	int m[200+1];
//模範解答
bool solve(int i,int m){//solve(i,m):A[i]?A[n-1]でmが作れるかどうか
	bool res;
	if(m == 0)
		return true;
	if(i >= n)
		return false;
	res = solve(i+1,m) || solve(i+1,m-A[i]);
	return res;
}

int main(){
	scanf("%d",&n);
	//printf("%d\n",n);//確認用
	for(int i=0;i<n;i++){
		scanf("%d",&A[i]);
		//printf("%d ",A[i]);//確認用
	}
	//printf("\n");//確認用
	scanf("%d",&q);
	//printf("%d\n",q);//確認用
	for(int i=0;i<q;i++){
		scanf("%d",&m[i]);
		//printf("%d ",m[i]);//確認用
	}

	for(int i=0;i<q;i++){
		if(solve(0,m[i]))
			cout <<"yes" <<endl;
		else 
			cout <<"no" <<endl;
	}

	return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <cstring>

#define LL long long
#define INF 2147483647

using namespace std;

int main(){
	string s;
	cin>>s;
	if (s.length()<4) cout<<"No"<<endl;
	else {
		if (s[0]=='Y' && s[1]=='A' && s[2]=='K' && s[3]=='I') cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}



Measured memory_bytes: 256
n = int(input())
heights = list(map(int,input().split()))

ans = 0

for i in range(1,101):
    c = 0
    for j in range(1,n):
        if heights[j-1] >= i and heights[j] < i:
            c += 1
        
        else:
            continue
    
    if heights[-1] >= i:
        c += 1
    
    ans += c
    

print(ans)

Measured memory_bytes: 3060
tmp = [2020]*101
n = int(input())
X = list(map(int, input().split()))
m = int(input())
A = list(map(int, input().split()))
for i in range(n):
    tmp[i] = X[i]

for i in range(m):
    if (tmp[A[i]-1]+1) < tmp[A[i]]:
        tmp[A[i]-1] += 1

for i in range(n):
    print(tmp[i])


Measured memory_bytes: 5608
import java.util.Scanner

import scala.collection.Searching._
import scala.annotation.tailrec
import scala.collection.immutable.Queue
import scala.collection.mutable
import scala.io.StdIn.readLine

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  @tailrec
  private def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {
  def solve(sc: => Scanner): Unit = {
    val A = Array.fill(3)(Array.fill(3)(sc.nextInt))
    var ans = false
    for (i <- Range(0, 3)) {
      for (j <- Range(1, 3)) {
        ans = ans || A(i)(j) - A(i)(j - 1) != A(0)(j) - A(0)(j - 1)
        ans = ans || A(j)(i) - A(j - 1)(i) != A(j)(0) - A(j - 1)(0)
      }
    }
    println(if (!ans) ("Yes") else ("No"))
  }

  def gcd(i: Int, j: Int): Int = {
    if (i < j) (gcd(j, i)) else (if (j == 0) (i) else (gcd(j, i % j)))
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

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

#define ll long long

ll fact[1000001];
ll mod = 1000000007;
ll pow2(ll val, ll exp);

int main()
{
    fact[0] = 1;
    fact[1] = 1;
    for(long i=2; i<=1000000; i++)
        fact[i] = (fact[i-1] * i)%mod;
        
    long x,y;
    cin>>x>>y;
    
    ll ans = 0;
    for(long i=0; i<=x; i++)
    {
        long x1 = i;
        long x2 = (x - i)/2;
        
        if( ((x1 + (2*x2)) == x) && ( ((2*x1) + x2) == y) )
            ans  = ( ans + ((fact[x1+x2] * pow2((fact[x1]*fact[x2])%mod, mod-2))%mod))%mod;
    }
    cout<<ans;
    return 0;
}

ll pow2(ll val, ll exp)
{
    if(!exp)
        return 1;
    if(exp == 1)
        return val;
    ll ans = pow2(val, exp/2);
    
    ans = (ans*ans)%mod;
    if(exp%2)
        ans=(ans*val)%mod;
    return ans;
}


Measured memory_bytes: 8064
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
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(a > b){a = b; return 1;} return 0;}

ll dp[41][1<<18];

template <typename T>
T power(T a, T n, T mod) {
  T res = 1;
  T tmp = n;
  T curr = a;
  while(tmp){
    if(tmp % 2 == 1){
      res = (T)((ll)res * curr % mod);
    }
    curr = (T)((ll)curr * curr % mod);
    tmp >>= 1;
  }
  return res;
}

int main(int argc, char const* argv[])
{
  int n, x, y, z;
  cin >> n >> x >> y >> z;
  int ng = 1 << (z-1);
  ng |= 1 << (y + z - 1);
  ng |= 1 << (x + y + z - 1);
  //int mask = (1 << (x + y + z)) - 1;
  int mask = (1 << 17) - 1;
  dp[0][0] = 1;
  rep(i, n){
    rep(j, mask + 1){
      //cout << i << " " << bitset<17>(j) << " " << dp[i][j] << endl;
      FOR(k, 1, 11){
        int st = (((ll)j << k) & mask) + (1 << (k-1));
        if((st & ng) != ng){
          dp[i+1][st] = (dp[i+1][st] + dp[i][j]) % mod;
        }
      }
    }
  }
  ll res = power<ll>((ll)10, (ll)n, mod);
  rep(j, mask+1){
    //cout << n << " " << bitset<17>(j) << " " << dp[n][j] << endl;
    res = (res - dp[n][j] + mod) % mod;
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 82176
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


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

	cin >> N;
	vector<pair<int,int>>r(N);
	vector<pair<int,int>>b(N);
	for (int i = 0; i < N; i++) {
		cin >> r[i].first >> r[i].second;
	}
	for (int i = 0; i < N; i++) {
		cin >> b[i].first >> b[i].second;
	}
	sort(r.begin(), r.end());
	sort(b.begin(), b.end());
	int index = N - 1;
	set<int>s;
	for (int i = N - 1; i >= 0; i--) {
		while (index >= 0 && b[index].first > r[i].first) {
			s.insert(b[index].second);
			index--;
		}
		if (s.upper_bound(r[i].second) != s.end()) {
			K++;
			s.erase(s.upper_bound(r[i].second));
		}
	}
	cout << K << endl;
	return 0;
}

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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n, a[101][101] = {0}, u, k, v;
  cin >> n;
  rep(i, n) {
    cin >> u >> k;
    u--;
    rep(j, k) {
      cin >> v;
      v--;
      a[u][v] = 1;
    }
  }

  rep(i, n) {
    rep(j, n) {
      if (j) cout << " ";
      cout << a[i][j];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3216
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
using namespace std;

const long long MOD = 1000000007;

int main(){
    long long int w, h, x, y;
    cin >> w >> h >> x >> y;

    std::cout<<std::fixed<<std::setprecision(10);
    cout << w*h/2.0 << " ";
    if(2*x == w && 2*y == h){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	int sum = 0;
	REP(i,n){
		cin >> a[i];
	}
	int ans = 1e9;
	for(int i = -100;i<=100;i++){
		sum = 0;
		REP(ai,n){
			sum += (a[ai]-i)*(a[ai]-i);
		}
		ans = min(sum,ans);
	}
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int sum_sec = 0;
	int i, sec;
	
	for (i = 0; i < 4; i++){
		scanf("%d", &sec);
		sum_sec += sec;
	}
	
	printf("%d\n", sum_sec / 60);
	sum_sec %= 60;
	printf("%d\n", sum_sec);
	
	return (0);
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
  	cin >> n >> m;
  	int in[n];
  	for (int i = 0; i < n; i++) in[i] = 0;
  	int num = n;
  	for (int i = 0; i < m; i++){
    	int a,b;
      	cin >> a >> b;
      	a--;
    	b--;
      	in[a]++;
     	in[b]++;
      	if (in[a]%2) num--;
      	else num++;
      	if (in[b]%2) num--;
      	else num++;
      	//cout << num << "\n";
    }
    //for(int i = 0; i < n; i++) cout << in[i] << "\n";
  	if (num == n) cout << "YES";
  	else cout << "NO";
}


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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define int long long
typedef pair<int, int> ii;

int n, k, q, a[2005], used[2005], ans = LLONG_MAX;

priority_queue<int, vector<int>, greater<int>> pq, pq1;

int lmao(int p) {
    used[n + 1] = 1;
    int cnt = 0, ret = 0;
    while(!pq.empty()) pq.pop();
    while(!pq1.empty()) pq1.pop();
    for(int i = p - 1; i >= 1; i--) {
        if(used[i]) break;
        cnt++;
    }
    for(int i = p; i <= n; i++) {
        if(used[i]) break;
        cnt++;
    }
    if(cnt < k) return LLONG_MAX;
    for(int i = 1; i <= n + 1; i++) {
        if(used[i]) {
            while(pq.size() >= k) {
                pq1.push(pq.top());
                pq.pop();
            }
            while(!pq.empty()) pq.pop();
        }
        else
            pq.push(a[i]);
    }
    cnt = pq1.size();
    if(cnt < q) return LLONG_MAX;
    cnt = q;
    while(cnt--) {
        ret = max(pq1.top(), ret);
        pq1.pop();
    }
    return ret;
}

signed main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n >> k >> q;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 1; i <= n; i++) {
        memset(used, 0, sizeof(used));
        for(int j = 1; j <= n; j++) {
            if(a[j] < a[i])
                used[j] = 1;
        }
        int ret = lmao(i) - a[i];
        //cout << ret << "\n";
        ans = min(ans, ret);
    }
    cout << ans;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()
#define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0)
char _;
#define pi 3.14159265358979323846

ll n, lo, hi, a[100005];
int main(){
    cin >> n;
    fox(l, n) cin >> a[l];
    lo=hi=2;
    foxr(l, n){
        if (hi<a[l]){
            cout << -1;
            return 0;
        }
        lo=(lo+a[l]-1)/a[l]*a[l];
        hi=(hi)/a[l]*a[l]+a[l]-1;
        if (lo>hi){
            cout << -1;
            return 0;
        }
        //cout<< lo << ' ' << hi << endl;
    }
    cout << lo << ' ' << hi;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void solve(){
    string s;
    cin>>s;
    int mx = 0;
    for(int i =0;i<s.length();i++){
        int cnt = 0;
        if(s[i]=='R'){
            while(s[i]=='R' && i<s.length()){
                i++;
                cnt++;
            }
            i--;
            mx = max(mx,cnt);
        }
    }
    cout<<mx<<'\n';
}
int main(){
    int tt;
    tt = 1;
    //cin>>tt;
    while(tt--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3620
package main

import (
	"fmt"
)

func main() {
	var n string
	fmt.Scan(&n)
	flug := false
	for _, str := range n {
		if string(str) == "7" {
			flug = true
		}
	}
	if flug {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 1752
#ABC113_C

N,M=map(int,input().split())
PYi=[]
for i in range(M):
    p,y=map(int,input().split())
    PYi.append([p,y,i])

PYi.sort()

prep=PYi[0][0]
cc=1#city code
PYi[0][1]=cc
for j in range(1,M):
    p=PYi[j][0]
    if prep==p:
        cc+=1
    else:
        cc=1
    PYi[j][1]=cc
    prep=p
        
PYi.sort(key=lambda x:x[2])

def padding(A):
    A=str(A)
    while len(A)<6:
        A=str(0)+A
    return A

for i in range(M):
    ansi=padding(PYi[i][0])+padding(PYi[i][1])
    print(ansi)

Measured memory_bytes: 24732
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;

int main(){
   ll n,a,b;cin>>n>>a>>b;
   ll ans =0;
   ll now;
   cin>>now;
   rep(i,n-1){
       ll x;cin>>x;
       ans+=min(b,(x-now)*a);
       now =x;
   }
   cout<<ans<<endl;
}


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

int MOD = 2019;

int main() {
    int l, r;
    cin >> l >> r;

    if(r - l + 1 >= MOD) {
        cout << 0 << endl;
        return 0;
    }

    int n = r - l + 1;
    int a[n];
    for(int i = 0; i < n; i++) {
        a[i] = (l + i) % MOD;
        // cout << a[i] % MOD << ' ';
    }
    // cout << endl;

    // sort(a, a + n);

    int min = 1e9;
    for(int i = 0; i < n - 1; i++) {
        for(int j = i + 1; j < n; j++) {
            int temp = a[i] * a[j] % MOD;
            if(min > temp) min = temp;
        }
    }
    cout << min << endl;

    /* TLE code
    int ans = INF;
    for(int i = l; i < r; i++) {
        for(int j = i + 1; j <= r; j++) {
            int tmp = i % MOD * j % MOD;
            if(ans > tmp) ans = tmp;
        }
    }
    cout << ans << endl;
    */

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<lint, lint> pi;
const int MAXN = 200005;

vector<int> gph[MAXN];
int n, a[MAXN], deg[MAXN];
int g1[MAXN], g2[MAXN];
int ans[MAXN];

int dfs(int x){
	set<int> s;
	for(auto &i : gph[x]){
		s.insert(dfs(i));
	}
	for(int i=0; ; i++){
		if(s.find(i) == s.end()) return i;
	}
}

bool solve(int x){
	int prv = x;
	for(int j=a[x]; ; j=a[j]){
		int tmp = (ans[prv] == g1[j] ? g2[j] : g1[j]);
		if(j == x){
			return tmp == ans[j];
		}
		ans[j] = tmp;
		prv = j;
	}
}

int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; i++){
		scanf("%d",&a[i]);
		gph[a[i]].push_back(i);
		deg[a[i]]++;
	}
	queue<int> que;
	for(int i=1; i<=n; i++) if(!deg[i]) que.push(i);
	while(!que.empty()){
		int x = que.front();
		que.pop();
		deg[a[x]]--;
		if(!deg[a[x]]) que.push(a[x]);
	}
	int piv = 0;
	for(int i=1; i<=n; i++){
		if(!deg[i]) continue;
		piv = i;
		set<int> s;
		for(auto &j : gph[i]){
			if(!deg[j]) s.insert(dfs(j));
		}
		int cnt = 0;
		for(int j=0; ; j++){
			if(s.find(j) == s.end()){
				if(cnt == 0) g1[i] = j;
				if(cnt == 1) g2[i] = j;
				cnt++;
			}
			if(cnt == 2) break;
		}
	}
	ans[piv] = g1[piv];
	if(solve(piv)){
		puts("POSSIBLE");
		return 0;
	}
	ans[piv] = g2[piv];
	if(solve(piv)){
		puts("POSSIBLE");
		return 0;
	}
	puts("IMPOSSIBLE");
}


Measured memory_bytes: 14208