akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline

N,M,K=map(int,input().split())
F=[tuple(map(int,input().split())) for i in range(M)]
B=[tuple(map(int,input().split())) for i in range(K)]


# UnionFind

Group = [i for i in range(N+1)] # グループ分け
Nodes = [1]*(N+1) # 各グループのノードの数

def find(x):
    while Group[x] != x:
        x=Group[x]
    return x

def Union(x,y):
    if find(x) != find(y):
        if Nodes[find(x)] < Nodes[find(y)]:
            
            Nodes[find(y)] += Nodes[find(x)]
            Nodes[find(x)] = 0
            Group[find(x)] = find(y)
            
        else:
            Nodes[find(x)] += Nodes[find(y)]
            Nodes[find(y)] = 0
            Group[find(y)] = find(x)




EF=[[] for i in range(N+1)]
EB=[[] for i in range(N+1)]

for x,y in F:
    EF[x].append(y)
    EF[y].append(x)
    Union(x,y)

for x,y in B:
    EB[x].append(y)
    EB[y].append(x)

Group=[find(i) for i in range(N+1)]

GSET=[set() for i in range(N+1)]

for i in range(N+1):
    GSET[find(i)].add(i)

for i in range(1,N+1):
    gr=find(i)
    ANS=len(GSET[gr])-1

    for x in EF[i]:
        if x in GSET[gr]:
            ANS-=1

    for x in EB[i]:
        if x in GSET[gr]:
            ANS-=1

    print(ANS)


Measured memory_bytes: 88032
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.nextLine();
    for (int i = 0; i < str.length(); i++) {
      char ch = str.charAt(i);
      if (Character.isLowerCase(ch)) {
        ch = Character.toUpperCase(ch);
      }
      System.out.print(ch);
    }
    System.out.println();
  }
}

Measured memory_bytes: 12000
a=int(input())
d=0
for i in range(2,int(a**0.5)+1):
    c=0
    while a%i==0:
        c+=1
        a//=i
    for i in range(1,60):
        if c>=i:
            c-=i
            d+=1
        else:
            break
    if a==1:
        break
if a!=1:
    d+=1
print(d)

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

int main(){
    string s;
    cin >> s;

    int d = 1 << 30;
    for(int i = 0; i < s.size()-2; i++){
        string s1 = s.substr(i, 3);
        int n = stoi(s1);
        d = min(d, abs(n-753));
    }

    cout << d << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
const ll MAX = 1001001;
const ll MOD = 1000000007;
int main()
{
    ll x, k, d;
    cin >> x >> k >> d;
    if (abs(x) / d > k)
    {
        if (x < 0)
        {
            cout << abs(x + k * d);
        }
        else
        {
            cout << x - k * d;
        }
    }
    else
    {
        if ((k - abs(x) / d) % 2 == 0)
        {
            cout << abs(x) % d << endl;
        }
        else
        {
            cout << d - abs(x) % d << endl;
        }
    }
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
main(){
	int n;
	cin>>n;
	while(n--){
		string s;
		cin>>s;
		int f=0;
		r(i,s.size()-1)if(s[i]==s[i+1])f++;
		cout<<(f?"No":"Yes")<<endl;
	}
}

Measured memory_bytes: 3256
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,n,0)

#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)

#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
			<< " , " << #y << " = " << (y) << "\n";

const int INF = 1e9;
const double EPS = 1e-10;

int n,m;
ll k;
string s[50];

int main() {
	int h,w;
	cin>>h>>w;
	REP(i,h){
		cin>>s[i];
	}

	REP(i,h)REP(j,w)if(s[i][j]!='#'){
		int c=0;
		FOR(x, -1, 2)FOR(y, -1, 2)if(x*y!=x+y){
			int nx = i+x, ny = j+y;//ぎゃくだけどまあいいや
			if(0<=nx&&nx<h&&0<=ny&&ny<w && s[nx][ny]=='#')c++;
		}
		s[i][j]='0'+c;
	}
	REP(i,h){
		cout<<s[i]<<endl;
	}
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _083B
{
    class Program
    {

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

        static void Main(string[] args)
        {
            //int N, A, B;
            string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
            int N = int.Parse(str[0]);  //数値で受け取りたい場合は変換する
            int A = int.Parse(str[1]);
            int B = int.Parse(str[2]);

            int total = 0;
            for (int i = 1; i <= N; ++i)
            {
                int sum = findSumOfDigits(i); // i の各桁の和
                if (sum >= A && sum <= B)
                { //  i の各桁の和が A 以上 B 以下かどうか
                    total += i;

                }

            }
            Console.WriteLine(total);
            //Console.Read();

        }
    }
}

Measured memory_bytes: 11220
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
using namespace std; 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() << x; }
template<typename T> void db(T x , T y){ debug() << x <<" "<< y; }
template<typename T> void db(T x , T y , T z){ debug() << x <<" "<< y <<" "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() << x <<" " << y <<" "<< z <<" "<< a; }

const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;

int dis(char a , char b , char c){
  if(a != b && a != c && b != c) return 1;
  return 0;
}

signed main(){
  ios::sync_with_stdio(false);cin.tie(0);
  int N;
  cin >> N;
  string S;
  cin >> S;
  int tot = 0;
  int rc = 0 , gc = 0 , bc = 0;
  for(char i : S){
    rc += (i == 'R');
    gc += (i == 'G');
    bc += (i == 'B');
  }
  dg3(rc , gc , bc);
  tot = rc * gc * bc;
  int sub = 0;
  for(int i=1;i<N-1;i++){
     int l = i-1 , r = i+1;
     while(l>=0 && r < N){
       if(dis(S[l] , S[i], S[r])) sub++;
       l--;
       r++;
     }
  }
  int ans = tot - sub;
  cout << ans << '\n';

}

Measured memory_bytes: 3152
def solve():
    N, M, K = map(int, input().split())
    mod = 998244353
    dp = [1]*(K+1)
    for i in range(1,K+1):
        dp[i] = dp[i-1]*(N-i)*pow(i,mod-2,mod)%mod
    ans = 0
    for i in range(K+1):
        ans += dp[i]*M*pow(M-1,N-1-i,mod)
        ans %= mod
    return ans
print(solve())

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

int main(){
  int n,ans;double t,a,def=1e9;cin>>n>>t>>a;
  vector<double> h(n,0); REP(i,n) cin>>h.at(i);
  REP(i,n) if(def>abs(t-h.at(i)*0.006-a)){
    def=abs(t-h.at(i)*0.006-a);
    ans=i+1;
  }
  cout<<ans;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
	
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
	
		if (N==1){
			System.out.printf("Hello World");
			
		}
		else if(N==2){
			int A = scan.nextInt();
			int B = scan.nextInt();
			
			System.out.print(A+B);
			
		}
		
	}	
}

Measured memory_bytes: 22996
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int d;

int main(){
    INIT;
    cin >> d;
    if(d == 22){
        cout << "Christmas Eve Eve Eve" << endl;
    }else if(d == 23){
        cout << "Christmas Eve Eve" << endl;
    }else if(d == 24){
        cout << "Christmas Eve" << endl;
    }else{
        cout << "Christmas" << endl;
    }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
//import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		Node[] node = input();
		print(node);
	}
	
	public static Node[] input() throws NumberFormatException, IOException{
		//System.setIn(new FileInputStream("./ALDS1_7_B-in1.txt"));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Node[] node = new Node[n];
		
		for(int i = 0; i < n; ++i) {
			node[i] = new Node(i);
		}
		
		for(int i = 0; i < n; ++i) {
			String[] t = br.readLine().split(" ");
			int id = Integer.parseInt(t[0]);
			
			int c1 = Integer.parseInt(t[1]);
			int c2 = Integer.parseInt(t[2]);
			
			if(c1 != -1){
				node[id].child.add(node[c1]);
				node[c1].parent = node[id];
			}
			if(c2 != -1){
				node[id].child.add(node[c2]);
				node[c2].parent = node[id];
			}
			if(c1 != -1 && c2 != -1){
				node[c1].sibling = node[c2];
				node[c2].sibling = node[c1];
			}
		}
		return node;
	}

	public static void print(Node[] node){
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < node.length; ++i) {
			// example
			// node 0: parent = -1, sibling = -1, degree = 2, depth = 0, height = 3, root
			sb.append("node " + node[i].id);
			sb.append(": parent = " + node[i].parent.id);
			sb.append(", sibling = " + node[i].sibling.id);
			sb.append(", degree = " + node[i].getDegree());
			sb.append(", depth = " + node[i].getDepth());
			sb.append(", height = " + node[i].getHeight());
			sb.append(", " + node[i].getType());
			sb.append("\n");

		}
		System.out.print(sb);
	}
}

class Node {
	public int id;
	public Node parent;
	public ArrayList<Node> child = new ArrayList<Node>();
	public Node sibling;
	public Node(int id){
		this.id = id;
		if(id != -1){
			parent = sibling = new Node(-1);
		}
	}

	public int getDepth(){
		if(parent.id == -1){
			return 0;
		}else{
			return parent.getDepth() + 1;
		}
	}
	
	public int getHeight(){
		if(child.size() == 0){
			return 0;
		}else if(child.size() == 1){
			return child.get(0).getHeight() + 1;
		}else{
			return Math.max(child.get(0).getHeight(), child.get(1).getHeight()) + 1;
		}
	}
	
	public int getDegree(){
		return child.size();
	}
	
	public String getType(){
		if(parent.id == -1){
			return "root";
		}else if(child.size() == 0){
			return "leaf";
		}else{
			return "internal node";
		}
		
	}
}

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

using namespace std;

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

#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()) //unsignedのサイズをint型に変換
#define pb push_back

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

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

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	

    map<int,int> M;
    int N; cin >> N;
    REP(i,N)
    {
        int a; cin >> a;
        M[a]++;
    }
    LL ans = 0;
    for(auto p : M)
    {
        int key = p.first;
        int cnt = p.second;
        dump(key)
        dump(cnt)
        if(cnt > key) 
        {
            ans += cnt - key;
        }
        else if(cnt == key)
        {

        }
        else
        {
            ans += cnt;
        }
        dump(ans)
    }
    cout << ans << endl;

}


Measured memory_bytes: 4736
N, M = map(int, input().split())

ans = [0]*(N+1)

for _ in range(M):
    L, R = map(int, input().split())
    ans[L-1] += 1
    ans[R] -= 1

for i in range(1, N):
    ans[i] += ans[i-1]

print(ans[:-1].count(M))


Measured memory_bytes: 7668
#include <map>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int Max_N(200050);
const double PI(acos(-1.0));
const double _0(100.0);
const double _180(10.0 * PI - 20.0);
const double _90(5.0 * PI - 20.0);

struct point
{
	int x, y;
	inline bool comp(const point &b) const
	{
		return x < b.x;
	}
};
int N, F[Max_N], LIS;
point S, T, V[Max_N];
map<int, int> P;
double Ans;

/*
通过一些翻转操作，使得起点在终点的左下角。特判掉一些特殊情况 
把一条路径写出来，答案 = 经过的边数 * 100 + 180度横向穿过的喷泉 * (10PI - 20) + 90度绕过去的喷泉 * (5PI - 20)
容易发现，min{经过的边数} = (TX - SX) + (TY - SY)。同时，为了避开180度横向穿过的喷泉而增加经过的边数显然是不优的
所以就是考虑最大化90度绕过去的喷泉个数和最小化180度横向穿过的喷泉个数
考虑求出点的LIS，显然最多90度绕过去LIS次喷泉，同时有LIS <= min(TX - SX, TY - SY) + 1。分情况讨论：
(1)LIS = min(TX - SX, TY - SY) + 1，可以走90度绕过去LIS - 1次喷泉，且180度横向穿过1个喷泉
   因为无论怎么走一定会180度横向穿过至少1个喷泉，所以这个方案达到了最优解
(2)LIS <= min(TX - SX, TY - SY)，那么可以90度绕过去LIS次喷泉同时不180度横向穿过任何1个喷泉，达到了最优解 
*/

int main()
{
	scanf("%d%d%d%d", &S.x, &S.y, &T.x, &T.y);
	scanf("%d", &N);
	for (int i = 1;i <= N;++i)
		scanf("%d%d", &V[i].x, &V[i].y);
	if (S.x > T.x)
		swap(S, T);
	if (S.y > T.y)
	{
		S.y = 100000000 - 1 - S.y, T.y = 100000000 - 1 - T.y;
		for (int i = 1;i <= N;++i)
			V[i].y = 100000000 - 1 - V[i].y;
	}
	for (int i = 1;i <= N;++i)
		if (S.x <= V[i].x && V[i].x <= T.x && S.y <= V[i].y && V[i].y <= T.y)
			P[V[i].x] = V[i].y;
	memset(F, 0X3F, sizeof(F)), F[0] = -0X3F3F3F3F;
	for (map<int, int>::iterator it = P.begin();it != P.end();++it)
	{
		int l = 0, r = N, mid;
		while (l < r)
		{
			mid = l + ((r - l) >> 1);
			if (F[mid] < it -> second)
				l = mid + 1;
			else
				r = mid;
		}
		F[l] = it -> second, LIS = max(LIS, l);
	}
	Ans = (T.x - S.x + T.y - S.y) * _0;
	if (LIS == min(T.x - S.x, T.y - S.y) + 1)
		--LIS, Ans += _180;
	Ans += LIS * _90;
	printf("%.12lf", Ans);
	return 0;
}

Measured memory_bytes: 11904
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let w = read::<f64>();
  let h = read::<f64>();
  let x = read::<f64>();
  let y = read::<f64>();

  print!("{} ", w * h / 2.0);

  match x * 2 as f64 == w && y * 2 as f64 == h {
    true => print!("1\n"),
    false => print!("0\n"),
  }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

/*
. 1 2 3 4 5 6 7 8 9

1 0 1 1 1 1 1 1 1 1
2 0 0 2 2 2 2 2 2 2
3 0 1 0 3 3 3 3 3 3
4 0 0 1 0 4 4 4 4 4
5 0 1 2 1 0 5 5 5 5
6 0 0 0 2 1 0 6 6 6
7 0 1 1 3 2 1 0 7 7
8 0 0 2 0 3 2 1 0 8
9 0 1 0 1 4 3 2 1 0

k+1~nについて、すなわちi=1=n-kについて、
nを(k+i)で割った商をt、あまりをrとすれば、
t*i+(k以上r以下の数の個数)
*/

void solve(){
    int n,k;
    cin >> n >> k;
    ll ans=0;
    for(int i=1; i<=n-k; i++){
        int t;
        int r;
        t = n/(k+i);
        r = n%(k+i);
        if(k!=0) ans += t*i + max(0, r-k+1);
        else ans += t*i + max(0, r-k);
        //cout << "t:" << t << " r:" << r << " b:" << k+i << " " << t*i << " " <<  max(0, r-k) << endl;
    }
    cout << ans << endl;
}

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



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
char fa[200008];
int main(){
    scanf("%s",fa);
    int len=strlen(fa);
    for(int i=0;i<len;i++){
        if(fa[i]=='?')
            printf("D");
        else
            printf("%c",fa[i]);
    }
}

Measured memory_bytes: 1840
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    
    ll sum=0;
    int pre=0;
    rep(i,N){
        int a; cin>>a;
        int n=(a+pre);
        sum+=n/2;
        if(n%2&&a) pre=1;
        else pre=0;
    }
    cout1(sum);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 1005

int N;
int table[NUM];

int main(){

	scanf("%d",&N);

	for(int i = 0; i < N; i++){

		scanf("%d",&table[i]);
	}

	if(N == 1){

		printf("%d\n",table[0]);
		return 0;

	}
	sort(table,table+N);

	int ans = 0;

	while(true){

		if(N == 2){

			ans += table[1];
			break;

		}else if(N == 3){

			ans += table[0]+table[1]+table[2];
			break;

		}else{

			ans += min(2*table[0]+table[N-1]+table[N-2],table[0]+2*table[1]+table[N-1]);
			N -= 2;
		}
	}

	printf("%d\n",ans);

	return 0;
}



Measured memory_bytes: 3296
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

class Procon {

    static void Main (string[] agrs) {
        int N = Int ();

        for (int i = 1; i < 10; i++) {
            if (N % i == 0 && N / i < 10) {
                Console.WriteLine ("Yes");
                return;
            }
        }

        Console.WriteLine ("No");
    }

    static string String () => Scanner.nextString ();
    static int Int () => int.Parse (Scanner.nextString ());
    static long Long () => long.Parse (Scanner.nextString ());
    static double Double () => double.Parse (Scanner.nextString ());
    static char[] Chars () => String ().ToCharArray ();
    static string[] Strings () => Console.ReadLine ().Split (' ');
    static int[] Ints () => Strings ().Select (v => int.Parse (v)).ToArray ();
    static long[] Longs () => Strings ().Select (v => long.Parse (v)).ToArray ();
    static double[] Doubles () => Strings ().Select (v => double.Parse (v)).ToArray ();
    const int M = 1000000007;
}

class PriorityQueue<T> where T : IComparable<T> {
    public T[] heap;
    public int size;
    public int sign;
    public PriorityQueue (int N, bool descend = false) {
        heap = new T[N];
        sign = 1;
        if (descend) sign = -1;
    }
    public int Compare (T x, T y) {
        return x.CompareTo (y) * sign;
    }
    public void Push (T x) {
        int i = size++;
        while (i > 0) {
            int p = (i - 1) / 2;
            if (Compare (x, heap[p]) >= 0) {
                break;
            }
            heap[i] = heap[p];
            i = p;
        }
        heap[i] = x;
    }
    public T Pop () {
        T ret = heap[0];
        T x = heap[--size];
        int i = 0;
        while (i * 2 + 1 < size) {
            int a = i * 2 + 1;
            int b = i * 2 + 2;
            if (b < size && Compare (heap[a], heap[b]) > 0) {
                a = b;
            }
            if (Compare (heap[a], x) >= 0) {
                break;
            }
            heap[i] = heap[a];
            i = a;
        }
        heap[i] = x;
        return ret;
    }
    public int Count () {
        return size;
    }
}

class Scanner {
    static string[] s = new string[0];
    static int i = 0;
    static int max_i = 0;
    static public string nextString () {
        if (i >= s.Length) {
            s = Console.ReadLine ().Split (' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0) {
                return "";
            }
            return s[i++];
        }
        return s[i++];
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define sz(a) (int)((a).size())
#define fuck() cout<<"--------"<<endl
#define see(x) cout<<#x<<" = "<<x<<endl
#define see2(x,y) cout<<#x<<" = "<<x<<"::"<<#y<<" = "<<y<<endl 
const int mod=1000000007;
typedef pair<int,int> pii;
const int inf=1e17;
const int N=1e5+5;
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	vector<int>a(n+1);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int tmp=0;
	for(int i=1;i<=n;i++){
		if(i%2)tmp+=a[i];
		else tmp-=a[i];
	}
	vector<int>M(n+1);
	M[1]=tmp;
	for(int i=2;i<=n;i++){
		M[i]=2*a[i-1]-M[i-1];
	}
	for(int i=1;i<=n;i++){
		cout<<M[i]<<' ';
	}
}

Measured memory_bytes: 2944
/**
 * File              : C.cpp
 * Author            : JCHRYS <jchrys@me.com>
 * Date              : 16.02.2020
 * Last Modified Date: 16.02.2020
 * Last Modified By  : JCHRYS <jchrys@me.com>
 */

#include <bits/stdc++.h>
using namespace std;

int main() {
    map<string, int> mp;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        mp[s]++;
    }
    vector<pair<int, string>> v;
    for (auto x: mp) {
        v.push_back({x.second, x.first});
    }
    sort(v.rbegin(), v.rend());
    int const MAX = v.front().first;
    vector<string> ans;
    for (int i = 0; i < int(v.size()); i++) {
        if (v[i].first == MAX) {
            ans.push_back(v[i].second);
        }
    }
    sort(ans.begin(), ans.end());
    for (auto x: ans) {
        cout << x << '\n';
    }

    return 0;
}


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

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        int a;
        cin >> a;
        if (i%2 == 1 && a%2 == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    ll n,c,k;
    cin >> n >> c >> k;
    vector<ll> t(n);
    rep(i,n) cin >> t[i];
    sort(t.begin(),t.end());
    int ans=0,cnt=0,w=t[0];
    rep(i,n) {
        if (t[i]-w>k || cnt+1>c) {
            ++ans;
            w=t[i];
            cnt=1;
        } else {
            ++cnt;
        }
    }
    if (cnt>0) ++ans;
    cout << ans << endl;

    
    return 0;   
}

Measured memory_bytes: 3984
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
#define maxn 100005
typedef long long ll;
map<int,int> vis;
int main()
{
    int n,x,m;
    int flag=1;
    scanf("%d",&n);
    while(n--)
        scanf("%d",&x),vis[x]++;
    scanf("%d",&m);
    while(m--)
    {
        scanf("%d",&x);
        if(vis[x]==0)
            flag=0;
        else if(vis[x])
            vis[x]--;
    }
    if(flag)
    printf("YES\n");
    else
        printf("NO\n");
    return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;

#define lsc(x)      scanf("%lld",&x)
#define sc(x)       scanf("%d",&x)
#define lpr(x)      printf("%lld ",x)
#define pr(x)       printf("%d ",x)
#define n_l         printf("\n")
#define VI          vector<int>
#define VII         vector<long long int>
#define MI          map<int, int>
#define PI          pair<int, int>
#define m_p         make_pair
#define pb          push_back
#define fi           first
#define se           second
#define mset(x,y)   memset(x,y,sizeof(x))
#define sz(v)       (int)v.size()
#define all(v)      v.begin(), v.end()
#define fr(i, a, n) for(int i=a;i<=n;i++)
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
const int N=(int)1e3+5;
const int mod = 1000000007;
typedef long long ll;
// order_of_key (val): returns the no. of values strictly less than val
// find_by_order (k): returns the kth largest element iterator.(0-based)
// vector<int>::iterator itr=lower_bound(v.begin(),v.end(),x);
// s.substr(pos[0-indexed], len(default=till end))
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
ll dp[N][N];
string s[N];
int main(){
    int n, m;sc(n);sc(m);
    fr(i,1, n){
        cin >>s[i];
    }
    dp[1][1] = 1;
    fr(j,2, m) dp[1][j] = dp[1][j-1] & (s[1][j-1]=='.');
    fr(i,2, n) dp[i][1] = dp[i-1][1] & (s[i][0]=='.');
    fr(i, 2, n)
        fr(j, 2, m){
            dp[i][j] = ((dp[i-1][j] + dp[i][j-1]) %mod ) * (s[i][j-1]=='.');
        }
    lpr(dp[n][m]);n_l;
    return 0;
}



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

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

using namespace std;

int main(){
    int S, W;
    cin >> S >> W; 

    if (S <= W) {
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }

    return 0;
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1<<29;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

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

const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};

const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

vector< vector<int> > Graph;
vector< int > value;






int main(int argc, const char * argv[]) {
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,m; cin >> n >> m;
    vector<int> city(n);
    
    rep(i,m){
        int a,b; cin >> a >> b;
        a--;b--;
        city[a]++;
        city[b]++;
    }
    
    rep(i,n){
        cout << city[i] << endl;
    }
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
	

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

		Long X = sc.nextLong();
		Long base = (long) 100;
		int cnt = 0;

		while (true){
			base = (long) Math.floor(base*1.01);
			cnt++;
			if(base>=X){
				System.out.println(cnt);
				return;
			}
			continue;
		}
	}


}


Measured memory_bytes: 35808
from bisect import bisect_left
try:
    from math import inf
except:
    inf = float("inf")


def way(a, b, c):
    return abs(a - b) + abs(b - c)


A, B, Q = map(int, input().split())
s = []
t = []
x = []
for _ in range(A):
    s.append(int(input()))
for _ in range(B):
    t.append(int(input()))
for _ in range(Q):
    x.append(int(input()))

for xi in x:
    isr = bisect_left(s, xi)
    itr = bisect_left(t, xi)
    isl = isr - 1
    itl = itr - 1
    cand = []
    if 0 <= isl < A and 0 <= itl < B:
        cand.append((s[isl], t[itl]))
    if 0 <= isl < A and 0 <= itr < B:
        cand.append((s[isl], t[itr]))
    if 0 <= isr < A and 0 <= itl < B:
        cand.append((s[isr], t[itl]))
    if 0 <= isr < A and 0 <= itr < B:
        cand.append((s[isr], t[itr]))
    ans = inf
    for a, b in cand:
        ans = min(ans, way(xi, a, b), way(xi, b, a))
    print(ans)


Measured memory_bytes: 16156
n, a, b = (int(x) for x in input().split())

count = 0

for i in range(1, n + 1):
    count_rem = 0
    j = i
    while j > 0:
        rem = j % 10
        count_rem += rem
        j = j // 10
    if a <= count_rem <= b:
        count += i

print(count)


Measured memory_bytes: 2940
#include <iostream>

int main() {
	const int size = 5;
	int arr[size];
	std::cin
		>> arr[0]
		>> arr[1]
		>> arr[2]
		>> arr[3]
		>> arr[4];

	// sort
	for (int i = 0; i < size; i++)
		for (int j = i + 1; j < size; j++)
			if (arr[i] < arr[j]) {
				std::swap(arr[i], arr[j]);
			}
			

	// show
	for (int i = 0; i < size - 1; i++)
		std::cout << arr[i] << " ";
	
	std::cout << arr[4] << std::endl;
}

Measured memory_bytes: 1160
N = int(input())
H = list(map(int,input().split()))
INF = 10**10
dp = [INF]*N
dp[0] = 0
dp[1] = abs(H[1] - H[0])
for i in range(2,N):
  dp [i] = min(dp[i-1]+abs(H[i]-H[i-1]),dp[i-2]+abs(H[i]-H[i-2]))
print(dp[-1])

Measured memory_bytes: 13976
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int n;
int b;

int main() {
    while (cin >> n) {
        if (n == 0) break;
        
        vint seg[2]; 
        int pre = -1;
        for (int i = 0; i < 2; ++i) {seg[i].clear(); seg[i].PB(-1);}
        for (int i = 0; i < n; ++i) {
            cin >> b;
            if (i & 1) {
                if (pre == b) seg[b].back()++;
                else {
                    if (!seg[0].empty()) seg[0].pop_back(); 
                    if (!seg[1].empty()) seg[1].pop_back();
                    seg[b].PB(i);
                }
            }
            else {
                if (pre == b) seg[b].back()++;
                else seg[b].PB(i);
            }
            pre = b;
            
            //COUT(i); COUT(seg[0]); COUT(seg[1]); cout << endl;
        }
        int res = 0;
        bool zs = true;
        if (seg[0][0] == -1) seg[0].erase(seg[0].begin());
        if (seg[1][0] == -1) seg[1].erase(seg[1].begin());
        
        if (seg[0].size() == 0) zs = false;
        else if (seg[1].size() > 0) if (seg[0][0] > seg[1][0]) zs = false;
        
        vint vec;
        if (zs) vec.PB(-1);
        for (int i = 0; i < seg[0].size(); ++i) vec.PB(seg[0][i]);
        for (int i = 0; i < seg[1].size(); ++i) vec.PB(seg[1][i]);
        sort(ALL(vec));
        
        //COUT(vec);
        
        for (int i = 0; i+1 < vec.size(); i += 2) res += vec[i+1] - vec[i];
        
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 1220
#include <iostream>
#include <vector>
#include <string>

int main() {
    auto H = 0;
    auto W = 0;
    std::cin >> H >> W;

    auto grid = std::vector<std::string>(H);

    for (auto& y : grid) {
        std::cin >> y;
    }

    for (auto i = 0; i < H; ++i) {
        for (auto j = 0; j < W; ++j) {
            if (grid[i].substr(j, 1) == std::string(".")) {
                auto      count = 0;
                for (auto i_x   = -1; i_x < 2; ++i_x) {
                    const auto x = j + i_x;
                    if (x < 0 || x > W - 1) continue;
                    for (auto i_y = -1; i_y < 2; ++i_y) {
                        const auto y = i + i_y;
                        if (y < 0 || y > H - 1) continue;
                        if (grid[y].substr(x, 1) == std::string("#")) ++count;
                    }
                }
                grid[i].replace(j, 1, std::to_string(count));
            }
        }
    }

    for (const auto& y : grid) {
        std::cout << y << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>
#include <unordered_map>

#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define all(s) s.begin(), s.end()
#define fo(i, start, finish) for(int i = start; i <= finish; i ++)
#define y1 kdfjsalsdkf

const long long MXN = 1e5 + 10;
const long long MNN = 5e3 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long OO = 1e9 + 500;

typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

llong n, b[MXN], a[MXN], cnt;
map<int, int> mp;

int main(){
    ios;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> b[i];
        mp[b[i]] = i;
        a[i] = b[i];
    }
    sort(a + 1, a + n + 1);
    for(int i = 1; i <= n; i++){
        if(mp[a[i]] % 2 != i % 2){
            cnt++;
        }
    }
    cout << cnt / 2;
    return 0;
}



Measured memory_bytes: 6528
#include <iostream>
#include <cmath>

using namespace std;


int main(){
  long long a, b;
  cin >> a >> b;
  
  for(long long i=max(a,b); i<=a*b; i+=max(a,b)){
  	if(i%a == 0 && i%b == 0){
    	cout << i << endl;
      	return 0;
    }
  }
}

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

int main(){
	string str,ans="";
	cin >> str;

	for(auto i: str){
		if(i=='0')	ans+='0';
		else if(i=='1')	ans+='1';
		else if(i=='B'){
			if(ans.length()>0)
				ans.pop_back();
			else	continue;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int m,f,r;
    while(true){
        cin>>m>>f>>r;
        if(m==-1&&f==-1&&r==-1){
            break;
        }
        else if(m==-1||f==-1){
            cout<<"F"<<endl;
        }
        else if(m+f>=80){
            cout<<"A"<<endl;
        }
        else if(65<=m+f&&m+f<80){
            cout<<"B"<<endl;
        }
        else if((50<=m+f&&m+f<65)||(30<=m+f&&m+f<50&&r>=50)){
            cout<<"C"<<endl;
        }
        else if(30<=m+f&&m+f<50&&r<50){
            cout<<"D"<<endl;
        }
        else if(m+f<30){
            cout<<"F"<<endl;
        }
    }
    return 0;
    
}


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

maximizer = A[0]
flag = 1
for i in range(N):
  if A[i] >= maximizer - 1:
    maximizer = max(maximizer, A[i])
  else:
    flag = 0
if flag:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x, y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb3(x, y, z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

template <typename T>void print(T v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<v.size(); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto i= v.begin(); i!=v.end(); i++)cout<<setw(w)<<*i<<" ";cout<<endl;}
template <typename T>void print_vv(T v){if(v.size()==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<v[0].size(); j++)cout<<setw(w)<<j<<" ";cout<<endl;for(auto i= 0; i<v.size(); i++){cout<<i<<" {";for(auto j = 0; j!=v[i].size(); j++){cout<<setw(w)<<v[i][j]<<",";}cout<<"},"<<endl;}cout<<endl;}
template <class T, class U> void print_m(map<T,U> m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}

int main(){
    double r; 
    while(cin>>r){
        double ans = 2*M_PI*r;
        printf("%lf\n",ans);
    }
    return 0;
}

Measured memory_bytes: 3788
# 2019-11-16 10:55:08(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n = int(sys.stdin.readline().rstrip())

    if  math.floor(math.log10(n)) % 2 == 0:
        ans = n
    else:
        ans = 10 ** (math.floor(math.log10(n))+1) - 1
    for i in range(1, math.floor(math.log10(n)+1), 2):
        ans -= 10 ** (i+1) - 1 - 10 ** i + 1
    
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main()
{
    int A,B,C;
    cin>>A>>B>>C;
    if((A==5&&B==5&&C==7)||(A==7&&B==5&&C==5)||(A==5&&B==7&&C==5)){
    cout<<"YES";}
    else{
    cout<<"NO";}
}

Measured memory_bytes: 3472
N,K=map(int,input().split(' '))
if K%2==0:
    cnt_0=0
    cnt_k2=0
    for i in range(1,N+1):
        if i%K==0:
            cnt_0+=1
        if i%K==K//2:
            cnt_k2+=1
    print(cnt_0**3+cnt_k2**3)

else:
    print((N//K)**3)

Measured memory_bytes: 3060
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
typedef unsigned long long ULL;
using namespace std;

const int maxN = 100000 + 24;
int N, ans = 1;
LL a[maxN], b[maxN];

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) scanf("%lld", &a[i]);
    sort(a+1, a+N+1);
    b[1] = a[1];
    for (int i = 2; i <= N; i++) b[i] = b[i-1] + a[i];
    // for (int i = 1; i <= N; i++) cout << b[i] << " ";cout << endl;
    int i = 1, j = 0;
    while (i != N) {
        if (b[i] * 2 < a[i+1]) j = i;
        i++;
    }
    ans = i - j;
    printf("%d\n", ans);

    return 0;
}
/*
    input:
    output:
    modeling:
    methods:
    complexity:
    summary:
*/

Measured memory_bytes: 1792
n,k = [int(i) for i in input().split()]
count = 0
for K in range(k,n):
    waru = K+1
    if n % waru >= k:
        count += n // waru * (waru - k) + n%waru-k+1
    else:
        count += n//waru *(waru - k)
if k == 0:
    count = n**2
print(count)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

int main() {
  char s[101], p[101], t[201];

  scanf("%s", s);
  scanf("%s", p);

  strcpy(t, s);
  strcat(t, s);

  if (strstr(t, p) != NULL)
    printf("Yes\n");
  else
    printf("No\n");
  
  return 0;
}


Measured memory_bytes: 2144
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
d = {"r": P, "s": R, "p": S}
D = {"r": "p", "s": "r", "p": "s"}
janken = []

score = 0
for i in range(N):
  if len(janken) < K:
    score += d[T[i]]
    janken.append(D[T[i]])

  elif D[T[i]] != janken[-K]:
    score += d[T[i]]
    janken.append(D[T[i]])
  
  else:
    janken.append("")

print(score)

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
int main(){
    int s;
    cin >> s;
    int i=1;
    if(s==1 || s==2){
        cout << 4 << endl;
    }else{
        while(1){
            if(s==4){
                break;
            }
            if(s%2==0){
                s/=2;
            }else{
                s=3*s+1;
            }
            i++;
        }
        cout << i+3 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
word = list(str(input()) for _ in range(N))
res = 'Yes'
if len(word) != len(set(word)):
    print('No')
    exit()
last = (word[0])[0]
for i, x in enumerate(word):
    if last != x[0]:
        print('No')
        exit()
    last = x[-1]
print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define sz(a) (int)a.size()
#define B_E(a) a.begin(),a.end()
#define pb push_back
#define pob pop_back
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);

const ll MaxN=1e5+5;
const ll MOD=1000000007;
const ll INF=ll(1e15);

bool graph[2000][2000];
bool visited[2000];
ll n,m;
ll a[2000],b[2000];

void dfs(ll e){
	visited[e]=true;
	for(int r=0;r<n;r++){
		if(graph[e][r]==false) continue;
		if(visited[r]==true) continue;
		dfs(r);
	}
}

int main(){
	ll ans=0;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i];
		a[i]--;
		b[i]--;
		graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;
	}
	
	for(int i=0;i<m;i++){
		graph[a[i]][b[i]]=graph[b[i]][a[i]]=false;
		for(int j=0;j<n;j++) visited[j]=false;
		dfs(0);
		bool bridge=false;
		for(int j=0;j<n;j++) if(visited[j]==false) bridge=true;
		if(bridge) ans++;
		graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;
	}
	cout<<ans<<endl;
}

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

int main()
{
    int N;
    int cnt = 0;

    cin >> N;

    // 複数要素を取得
    vector<int> vec(N);
    for (int i = 0; i < N; i++)
    {
        cin >> vec.at(i);
    }
    int flag = 0;

    while (1)
    {
        // 複数要素が偶数かを判定
        for (int i = 0; i < vec.size(); i++)
        {
            // 奇数の場合
            if (vec.at(i) % 2 != 0)
            {
                flag = 1;
                break;
            }
            // 最後のループの場合
            else if (i + 1 == vec.size())
            {

                cnt++;
            }
            else
            {
                vec.at(i) /= 2;
            }
        }
        if (flag)
        {
            break;
        }
    }
    cout << cnt;
}


Measured memory_bytes: 3624