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

using namespace::std;

char gMap[22][22];
bool MapFlg[22][22];
int gRedCount;
void initMap(void)
{
  for(int i = 0; i < 22; i++)
    {
      for(int j = 0; j < 22; j++)
	{
	  gMap[i][j] = '#';
	  MapFlg[i][j] = false;
	}
    }
  gRedCount = 0;
}

void showMap(void)
{
  for(int i = 0; i < 22; i++)
    {
      for(int j = 0; j < 22; j++)
	{
	  cout << gMap[i][j];
	}
      cout << endl;
    } 
}

int countMap(int x , int y)
{
  int dx[] = { 0  , 1 , -1 , 0 };
  int dy[] = { -1 , 0 ,  0 , 1 };

  for(int i = 0; i < 4; i++)
    {
      int mx = x + dx[i];
      int my = y + dy[i];

      if( gMap[my][mx] != '@' && gMap[my][mx] != '#' && MapFlg[my][mx] == false)
	{
	  gRedCount++;
	  MapFlg[my][mx] = true;
	  countMap(mx , my);
	}
    }

  return gRedCount;

}

void calcAns(int sx, int sy)
{
  cout << countMap(sx,sy) + 1 << endl;
}

int main(void)
{

  int w,h;

  while( cin >> w >> h  && (w != 0 && h != 0))
    {
      int sx,sy;
      initMap();
      for(int i = 1; i <= h; i++)
	{
	  for(int j = 1; j <= w; j++)
	    {
	      cin >> gMap[i][j];
	      if( gMap[i][j] == '@')
		{
		  sy = i;
		  sx = j;
		}
	    }
	}
      calcAns(sx,sy);
    }

  return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
#define ll long long
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};

int main(){
  int N;
  ll ans=1;
  cin>>N;
  map<ll,ll> m;
  for(int i=2;i<=N;i++){
    int num=i;
    for(int j=2;j<=N;j++){
      while(num%j==0){
        m[j]++;
        num/=j;
      }
    }
  }
  for(int i=2;i<=N;i++){
    ans*=m[i]+1;
    ans%=MOD;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include"stdio.h"
main()
{
	int a, b ,c, min;
	scanf("%d%d%d",&a,&b,&c);
	min = a + b;
	if(min > a + c)
		min = a + c;
	if(min > b + c)
		min = b + c;
	printf("%d",min);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pb(a) push_back(a)
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<typename T> void co(T e){std::cout << e << "\n";}
template<typename T> void co(const std::vector<T>& v){for(const auto& e : v)
{ std::cout << e << " "; } std::cout << std::endl;}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int main(){
    sonic();
    int a, b, k;
    cin >> a >> b >> k;
    set<ll> s;
    REP(i, a, a+k){
        if(i <= b)s.in(i);
    }
    REP(j, b-k+1, b+1){
        if(j >= a)s.in(j);
    }
    for(int n: s){
        co(n);
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX_N 100
#define MAX_T 200
#define MAX_V 100
double dp[MAX_T*MAX_N*2+2][MAX_V*2+2];
ll ttov[MAX_T*MAX_N*2+2];
ll nowt = 0, sumt;

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> v(N-1+1);
	vector<long long> t(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&t[i]);
	}
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&v[i]);
	}

	// tの累積値から対応するvを計算する
	sumt = t[0]*2;
	for(int i = 0 ; i < MAX_T*MAX_N*2+2 ; i++){
		if (i == sumt && nowt < N) {
			nowt++;
			if (nowt < N) {
				sumt += t[nowt]*2;
				ttov[i] = min(v[nowt-1]*2, v[nowt]*2);
			} else {
				ttov[i] = 0;
			}
			continue;
		}
		if (nowt < N) {
			ttov[i] = v[nowt]*2;
		} else {
			ttov[i] = 0;
		}
	}

	// for(int i = 0 ; i <= sumt ; i++){
	// 	cout << i << " " << ttov[i] << endl;
	// }
	// cout << endl;

	dp[0][0] = 0;
	for(int i = 1 ; i < MAX_V*2+2 ; i++){
		dp[0][i] = -1;
	}

	for(int i = 1 ; i < MAX_T*MAX_N*2+2 ; i++){
		for(int j = 0 ; j < MAX_V*2+2 ; j++){
			dp[i][j] = -1;
			if (j <= ttov[i]) {
				if (j-1 >= 0 && dp[i-1][j-1] >= 0) dp[i][j] = max(dp[i][j], dp[i-1][j-1]+(j-0.5));
				if (dp[i-1][j] >= 0) dp[i][j] = max(dp[i][j], dp[i-1][j]+j);
				if (j+1 < MAX_V*2+2 && dp[i-1][j+1] >= 0) dp[i][j] = max(dp[i][j], dp[i-1][j+1]+(j+0.5));
			}
		}
	}
	

	// for(int i = 0 ; i <= sumt ; i+=2){
	// 	cout << i << " " << dp[i][0] << endl;
	// }

	printf("%.16f\n", dp[sumt][0]*0.25);
	// cout << dp[sumt][0] << endl;

	return 0;
}



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

#define PI 3.14159265358979
#define RADIUS 6378.1 // 単位km

#define DEG_TO_RAD(theta) theta * PI / 180.0

struct position {
	double lat; // 緯度
	double lon; // 経度
	// 以下直交座標系
	double x;
	double y;
	double z;
};

void getCoordinates(position& loc)
{
	loc.x = RADIUS * cos(DEG_TO_RAD(loc.lat)) * cos(DEG_TO_RAD(loc.lon));
	loc.y = RADIUS * cos(DEG_TO_RAD(loc.lat)) * sin(DEG_TO_RAD(loc.lon));
	loc.z = RADIUS * sin(DEG_TO_RAD(loc.lat));
}

double getOneLineDistance(const position& loc1, const position& loc2)
{
	return sqrt(pow(loc1.x-loc2.x, 2) + pow(loc1.y - loc2.y, 2) + pow(loc1.z - loc2.z, 2));
}

double getInteriorAngle(double oneLineDistance)
{
	return 2 * asin(oneLineDistance/2/RADIUS);
}

double getSurfaceDistance(position& loc1, position& loc2)
{
	getCoordinates(loc1);
	getCoordinates(loc2);
	return RADIUS * getInteriorAngle(getOneLineDistance(loc1, loc2));
}

int main(void)
{
	position loc1, loc2;

	while(1) {
		std::cin >> loc1.lat >> loc1.lon >> loc2.lat >> loc2.lon;
		if(loc1.lat == -1 && loc1.lon == -1 && loc2.lat == -1 && loc2.lon == -1) {
			break;
		}
		std::cout << (int)(getSurfaceDistance(loc1, loc2) + 0.5) << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1272
s = input()
first = s[0]
count = 0
s_count = 0
num = 0
second = ""
for i in range(1,len(s)):
    if s[i] == first:
        count += 1
    else:
        second = s[i]  
        num = i
for i in range(1,len(s)):
    if num == i:
        m = 0
    elif second == s[i]:
        s_count += 1

if count == 1 and s_count == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
//============================================================================
// Name        : AOJCpp.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
//#include <queue>
using namespace std;
static const int MAX = 500000;

class process {
private:
	string name;
	int time;
public:
	void setName(string s);
	void setTime(int t);
	string getName();
	int getTime();
};
void process::setName(string s) {
	name = s;
}
void process::setTime(int i) {
	time = i;
}
string process::getName() {
	return name;
}
int process::getTime() {
	return time;
}
class queue {
private:
	int head;
	int tail;
	process q[MAX];
public:
	void initialize();
	process front();
	void pop();
	void push(process p);
	bool empty();

};
void queue::initialize() {
	head = 0;
	tail = 0;
}
process queue::front() {
	return q[head];
}
void queue::pop() {
	if(head >= MAX) {
		head = 0;
	} else {
		head++;
	}
}
void queue::push(process p) {
	q[tail] = p;
	if(tail >= MAX) {
		tail = 0;
	} else {
		tail++;
	}
}
bool queue::empty() {
	if (head == tail) {
		return true;
	}
	return false;
}


int main() {

	int n,q;
	cin >> n >> q;

	queue que;
	que.initialize();
	string name;
	int time;
	for(int i = 0; i < n; i++) {
		cin >> name;
		cin >> time;
		process p;
		p.setName(name);
		p.setTime(time);
		que.push(p);
	}
	int total = 0;
	while(!que.empty()) {
		process p = que.front();
		que.pop();
		time = p.getTime();
		if(time > q) {
			p.setTime(time - q);
			total += q;
			que.push(p);
		} else {
			total+=time;
//			p.setTime(total);
			cout << p.getName() << " " << total << endl;
		}
	}
	return 0;
}




Measured memory_bytes: 13156
N = int(input())
R = []
for i in range(N):
    x, l = map(int, input().split())
    R.append((x+l, x-l))
R.sort()
ans = 0
now = -(10 ** 9 + 1)
for (r, l) in R:
    if now <= l:
        ans += 1
        now = r
print(ans)


Measured memory_bytes: 22732
/*
我的心脏怦怦跳，监管者就在附近
name:
Algorithm:
writer:Lxs(cdx)
place:
nothing is impossible
*/
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#include<string>
#include<iostream>
#include<cmath>
#include<set>
#include<stack>
#include<queue>
#include<unistd.h>
#include<stdio.h>
#include<cstring>
#define random(a,b) (rand()%(b-a+1)+a)
using namespace std;
bool prime(int x){
	 int i;
	 if(x<2) return 0;
	 for(i=2;i*i<=x;i++){
		if(x%i==0){return 0;}
	 }
	 return 1;
}
int main()
{
	long long n,m;
	cin>>n>>m;
	if(n==1||m==1){
		cout<<1;
	}
	else if(n*m%2==0){
		cout<<n*m/2;
	}
	else cout<<n*m/2+1;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

#define MAX 100
#define NIL -1

struct node{
  int p;
  int l;
  int r;
  int s;
};

struct node Tree[MAX];
int D[MAX];

int SetH(int);
int SetD(int);

int main(){
  int i,l,n,r;
  int id;

  scanf("%d", &n);

  for(i = 0; i < n ; i++){
    Tree[i].p = Tree[i].l = Tree[i].r = Tree[i].s = NIL;
    D[i] = 0;
  }

  for(i = 0 ; i < n; i++){
    scanf("%d%d%d", &id, &l, &r);

    Tree[id].l = l;
    Tree[id].r = r;

    Tree[l].p = id;
    Tree[r].p = id;

    Tree[l].s = r;
    Tree[r].s = l;
    if(l != NIL){
      D[id]++;
    }

    if(r!=NIL){
      D[id]++;
    }
}



for(i = 0; i < n ; i++){
  printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, " , i, Tree[i].p, Tree[i].s, D[i], SetD(i), SetH(i));

  if(Tree[i].p == NIL){
    printf("root\n");
  }
  else if(D[i] > 0){
    printf("internal node\n");
  }
  else{
    printf("leaf\n");
  }
}

return 0;
}

int SetH(int u){
  int h1=0, h2=0;

  if(Tree[u].r != NIL)
  h1 = SetH(Tree[u].r) + 1;
  if(Tree[u].l != NIL)
    h2 = SetH(Tree[u].l) + 1;

  return (h1 > h2) ? h1 : h2;
}

int SetD(int u){
  int dpt=0;
  int par=Tree[u].p;

  while(par != NIL){
  dpt++;
  par = Tree[par].p;
  }

  return dpt;
}



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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, m;
  cin >> n >> m;

  cout << (n == m ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => long.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
      var n = F();
      var k=F();
      var x=G();
      WriteLine(2*x.Sum(i=>Min(i,k-i)));
	}
}


Measured memory_bytes: 13396
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<string>
#include<cstring>
#include<functional>
#include<cmath>

#define rep(i,a,b) for(int (i) = (a) ; (i) < (b) ; (i) ++)

using namespace std;

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

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

set<int> iset;

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int a;
    cin>>a;
    while (!iset.count(a)) {
        iset.insert(a);
        if((a&1)==0)a = a/2;
        else a = 3*a+1;
    }
    cout<<iset.size()+1<<endl;
    
}


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

using namespace std;

const int NUM_SCELTE = 3;

int main()
{
    vector<vector<int>> attivita;
    vector<vector<int>> dp;
    int numAttivita;

    cin >> numAttivita;

    attivita.resize(numAttivita);
    dp.resize(numAttivita + 1);

    dp[0].resize(NUM_SCELTE);
    for(int i = 0; i < numAttivita; i++)
    {
        attivita[i].resize(NUM_SCELTE);
        dp[i + 1].resize(NUM_SCELTE);
    }

    for(int i = 0; i < attivita.size(); i++)
    {
        cin >> attivita[i][0];
        cin >> attivita[i][1];
        cin >> attivita[i][2];
    }

    dp[0][0] = 0;
    dp[0][1] = 0;
    dp[0][2] = 0;
    for(int i = 1; i < dp.size(); i++)
    {
        for(int j = 0; j < NUM_SCELTE; j++)
        {
            dp[i][j] = -1;
            for(int k = 0; k < NUM_SCELTE; k++)
            {
                if(k != j)
                {
                    dp[i][j] = max(dp[i][j], dp[i - 1][k] + attivita[i - 1][j]);
                }
            }
        }
    }

    cout << max(dp[dp.size() - 1][0], max(dp[dp.size() - 1][1], dp[dp.size() - 1][2])) << endl;

    return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!
int sum(vi &W, int T){
  int s1 = 0; int s2=0;
  for(int j=0;j<=T;++j) s1 += W[j];
  for(int j=T+1;j<W.size();++j) s2 += W[j];
  return abs(s1-s2);
}
// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int N=in();
  vi W(N);
  rep(i,N) cin >> W[i];
  int m=100000000;
  rep(T,N){
    m = min(sum(W,T),m);
  }
  cout << m << endl;
  return 0;
}


Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

N, K = getNM()
intlist = [i for i in range(10)]
D = getList()
for i in D:
    if i in D:
        # 嫌いな数字を消す
        intlist.pop(intlist.index(i))

anslist = []
# intlist内の数字でできる５桁以内の数字を全列挙（５桁の数字も列挙するのは無駄な気もする）
# dfsで解いてる人はあんまりいない
# 基本的に全探索
def dfs(i, num):
    anslist.append(num)
    # num < Nの条件で計算量を制限
    if i < 5 and num < N:
        for j in intlist:
            newnum = int(str(num) + str(j))
            dfs(i + 1, newnum)

for i in intlist:
    if i != 0:
        dfs(1, i)

anslist.sort()

for i in anslist:
    if i >= N:
        ans = i
        break
print(ans)

Measured memory_bytes: 45164
#include "iostream"
using namespace std;

int main() {
  int n, fix, x[110], y[110], h[110];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> h[i];
    if (h[i] != 0) fix = i;
  }

  bool ans = true;

  for (int a = 0; a < 101; a++) {
    for (int b = 0; b < 101; b++) {
      for (int hi = max(h[fix] - 205, 0); hi < h[fix] + 205; hi++) {
        ans = true;
        for (int k = 0; k < n; k++) {
          if (h[k] != max(hi - abs(x[k] - a) - abs(y[k] - b), 0)) ans = false;
        }
        if (ans) cout << a << " " << b << " " << hi << endl;
      }
    }
  }
}

Measured memory_bytes: 256
import itertools
import math
def distance(v1,v2):
    if(len(v1)!=len(v2)):
        return False
    distance = 0
    for i in range(len(v1)):
        distance+=(v2[i]-v1[i])**2
    return math.sqrt(distance)


N,D = map(int,input().split(" "))
plots=[]
for i in range(N):
    plots.append(list(map(int,input().split(" "))))

comb_l = list(itertools.combinations([i for i in range(N)],2))
ans = 0
for comb in comb_l:
    if(distance(plots[comb[0]],plots[comb[1]]).is_integer()):
        ans+=1

print(ans)



Measured memory_bytes: 3064
n = int(input())
d = list(map(int, input().split()))

ma = max(d)
l = [0] * n
ans = 1

#  1番上の頂点が無ければ0
if d[0] != 0:
    print(0)
    exit()

#  0~maxがそれぞれ何個あるか
for e in d:
    l[e] += 1

#  1番上の頂点が複数個だと0
if l[0] != 1:
    print(0)
    exit()

for i in range(ma):
    #  l[i]は辺の数でl[i+1]はノードの数
    ans = ans * l[i] ** l[i+1]
    ans = ans % 998244353
print(ans)


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

int main() {
	int a=0;
	int b=0;
	int c=0;
	cin>>a;
	cin>>b;
	cin>>c;
		
	if (a<b&&b<c) {
		cout<<"Yes"<<endl;
	} else {
		cout<<"No"<<endl;
	}
	
	
}




Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
#define Vi vector<int>
#define Vl vector<long long>
#define pb(a) push_back(a)

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=10000000000000000001;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};

int main() {

	ll n,m;
	cin>>n>>m;

	if(n==1&&m==1)cout<<"1"<<endl;
	else if(n==1||m==1)cout<<n*m-2<<endl;
	else{
		ll ans=n*m-4;
		ans-=(n-2)*2;
		cout<<ans-(m-2)*2<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
using It = vector<int>::iterator;
using ll = long long;

int const M = 1e9 + 7;

int merge(It b, It e, It w) {
  It mid = next(b, distance(b, e) / 2);
  It in1 = b;
  It in2 = mid;
  It out = w;
  int r = 0;
  while(in1 != mid && in2 != e) {
	  if (*in1 <= *in2) {
		  *out++ = *in1++;
	  }
	  else {
		  r += distance(in1, mid);
		  *out++ = *in2++;
	  }
  }
  copy(in1, mid, prev(e, distance(in1, mid)));
  copy(w, out, b);
  return r;
}
         
int mergesort(It b, It e, It w) {
	auto d = distance(b, e);
	if (d < 2)
		return 0;
    It mid = next(b, d / 2);
    return mergesort(b, mid, w) + mergesort(mid, e, w) + merge(b, e, w);
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	int k;
	cin >> n >> k;
	vector<int> a(n), temp(n);
	for (int& x : a) {
		cin >> x;
	}
    int r = mergesort(begin(a), end(a), begin(temp));
	int p = 0, c = n * (n - 1) / 2 , l = 1;
	for (int x : a) {
		if (x == p) {
			l++;
		}
		else {
			c -= l * (l - 1) / 2;
			p = x;
			l = 1;
		}
	}
    c -= l * (l - 1) / 2;
	cout << ((ll)r * k + (ll)k * (k - 1) / 2 % M * c) % M << '\n';
    return 0;
}

Measured memory_bytes: 256
x=str(input())
s1=x.count("K")
s2=x.count("U")
s3=x.count("P")
s4=x.count("C")
b=min(s1,s2,s3,s4)
if s1==0 or s2==0 or s3==0 or s4==0:
    b==0
print(b)


Measured memory_bytes: 5556
#include <bits/stdc++.h> 
using namespace std;
 
int main(){
    int N,M;
    cin >> N >> M;
    int L[M],R[M]={};
    int maxR = 100000;
  	int maxL = 0;
    for (int i = 0; i<M;i++){
        cin >> L[i] >> R[i];
        maxL = max(maxL,L[i]);
        maxR = min(maxR,R[i]);
    }
    if(maxL<=maxR){
    	cout << abs(maxR - maxL) + 1<<endl;
    }else {
        cout << 0 <<endl;
    }

    
    
 
}

Measured memory_bytes: 1024
#include <stdio.h>
 
int main(void){
  int i,j,n,m,cn;
  char c,s[5]={'S','H','C','D','\0'};
  static int card[4][13];
  scanf("%d\n",&n);
 
  for(i=0;i<n;i++){
    scanf("%c %d\n",&c,&m);
    for(j=0;j<4;j++)
      if(s[j]==c)
        card[j][m-1]=1;
  }
   
  for(i=0;i<4;i++)
    for(j=0;j<13;j++)
      if(card[i][j]==0)
        printf("%c %d\n",s[i],j+1);
 
  return 0;
}


Measured memory_bytes: 2124
#include <stdio.h>

int main()
{
    int n, x, t;

    scanf("%d %d %d", &n, &x, &t);

    if (n % x == 0)
    {
        printf("%d\n", n/x * t);
    }
    else
    {
        printf("%d\n", (n/x + 1) * t);
    }
    
}

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

using namespace std;

bool simenzu(int h[])
{
    int hist[10];
    for(int i=0; i<9; ++i){
        hist[i] = h[i];
    }

    for(int i=0; i<9; ++i){
        if(hist[i] >= 3){
            hist[i] -= 3;
        }
        while(i < 7 && hist[i] > 0){
            hist[i]--;
            hist[i+1]--;
            hist[i+2]--;
            if(hist[i+1] < 0 || hist[i+2] < 0){
                return false;
            }
        }
    }

    for(int i=0; i<9; ++i){
        if(hist[i] > 0){
            return false;
        }
    }

    return true;
}


bool ok(int hist[])
{
    for(int i=0; i<9; ++i){
        if(hist[i] >= 2){
            hist[i] -= 2;
            if(simenzu(hist)){
                hist[i] += 2;
                return true;
            }
            hist[i] += 2;
        }
    }

    return false;
}


vector<int> calc(char str[])
{
    vector<int> result;

    int hist[10] = {};
    for(int i=0; i<13; ++i){
        hist[str[i] - '1']++;
    }

    for(int i=0; i<9; ++i){
        if(hist[i] >= 4){
            continue;
        }

        hist[i]++;
        if(ok(hist)){
            result.push_back(i+1);
        }
        hist[i]--;
    }

    return result;
}


int main()
{
    char str[15];

    while(cin >> str){
        vector<int> result = calc(str);
        if(result.empty()){
            cout << 0;
        }
        else{
            for(int i=0; i<result.size(); ++i){
                cout << (i==0 ? "" : " ") << result[i];
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
#define maxn 110
#define all 100
#define p 1000000007
#define mk make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
template<typename T> inline void read(T &x)
{
    x=0;char c=getchar();bool flag=false;
    while(!isdigit(c)){if(c=='-')flag=true;c=getchar();}
    while(isdigit(c)){x=(x<<1)+(x<<3)+(c^48);c=getchar();}
    if(flag)x=-x;
}
int q;
ll f[maxn];
vector<pair<ll,ll> > ve[maxn];
int main()
{
    f[0]=f[1]=1;
    for(int i=2;i<=all;++i) f[i]=f[i-1]+f[i-2];
    ve[1].push_back(mk(1,2)),ve[1].push_back(mk(1,3)),ve[1].push_back(mk(1,4));
    for(int i=2;i<=all;++i)
    {
        for(int j=0;j<ve[i-1].size();++j)
        {
            ll x=ve[i-1][j].se,y=ve[i-1][j].fi+x;
            while(y<=f[i+2]+f[i-1]) ve[i].push_back(mk(x,y)),y+=x;
        }
    }
    read(q);
    for(int i=1;i<=q;++i)
    {
        ll n,m,mx=1,v=0;
        read(n),read(m);
        if(n>m) swap(n,m);
        while(f[mx+1]<=n&&f[mx+2]<=m) mx++;
        printf("%lld ",mx);
        if(mx==1)
        {
            printf("%lld\n",n%p*m%p);
            continue;
        }
        for(int j=0;j<ve[mx-1].size();++j)
        {
            ll x=ve[mx-1][j].fi,y=ve[mx-1][j].se;
            if(y<=n) v=(v+(m-x)/y)%p;
            if(y<=m) v=(v+(n-x)/y)%p;
        }
        printf("%lld\n",v);
    }
    return 0;
}

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

const ll mod = 1e9 + 7;
ll dp[2020];

int main() {
	ll s;
    cin >> s;
    dp[0] = 1;
    for (int i = 0; i < 2020; ++i) {
        for (int k = 3; k < 2020; ++k) {
            if(i + k < 2020) {
                dp[i + k] += dp[i];
                dp[i + k] %= mod;
            }
        }
    }
    cout << dp[s] << endl;
}


Measured memory_bytes: 3632
N = int(input())
S = [input() for _ in range(N)]

dic = {"AC":0, "WA":0, "TLE":0, "RE":0}
for i in range(N):
    dic[S[i]] += 1

print("AC x {}".format(dic["AC"]))
print("WA x {}".format(dic["WA"]))
print("TLE x {}".format(dic["TLE"]))
print("RE x {}".format(dic["RE"]))


Measured memory_bytes: 16128
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    int64_t Q, H, S, D, N;
    std::cin >> Q >> H >> S >> D >> N;

    if (Q * 2 < H) {
        H = Q*2;
    }
    if (H * 2 < S) {
        S = H * 2;
    }
    if (S * 2 < D) {
        D = S * 2;
    }

    int64_t ans = 0;

    ans += (N / 2) * D;
    N = N % 2;
    ans += S * N;

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a,b,c,d int
	fmt.Scan(&a,&b,&c,&d)

	if a + b > c + d {
		fmt.Println("Left")
	} else if a + b < c + d {
		fmt.Println("Right")
	} else {
		fmt.Println("Balanced")
	}
}

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

int main() {
	int a, b, c, x;
	cin >> a >> b >> c >> x;

	int cnt = 0;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				if (((500 * i) + (100 * j) + (50 * k) == x)) {
					cnt++;
				}
			}
		}
	}
	cout << cnt << endl;
	return 0;
}

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

int minn(int a,int b,int c){
  int minn;
  minn=a;
  if(minn>b)
    minn=b;
  if(minn>c)
    minn=c;
  return minn;
}
int main(void)
{
  int a,b,c;
  cin>>a>>b>>c;
  int d1,d2,d3;
  d1=a+b;
  d2=a+c;
  d3=b+c;
  int mi=minn(d1,d2,d3);
  cout<<mi<<endl;
  
}

Measured memory_bytes: 256
/**
*	created: 20.09.2020 02:28:09
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rrep(i,n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
using ll = long long;
using P = pair<int,int>;
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
// const int MOD = 1000000007;
const int MOD = 998244353;
template<typename T> inline bool chmax(T &a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> inline bool chmin(T &a, T b) {if (b < a) {a = b; return 1;} return 0;}
inline void print(P a) {cout << a.first << " " << a.second << endl;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

// ModInt
template<int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {if ((x = x_ % mod + mod) >= mod) x -= mod;}
    ModInt inv() const {return pow(*this, mod - 2);}
    ModInt& operator+=(ModInt rhs) {if ((x += rhs.x) >= mod) x -= mod; return *this;}
    ModInt& operator-=(ModInt rhs) {if ((x -= rhs.x) < 0) x += mod; return *this;}
    ModInt& operator*=(ModInt rhs) {x = (unsigned long long)x * rhs.x % mod; return *this;}
    ModInt& operator/=(ModInt rhs) {x = (unsigned long long)x * rhs.inv().x % mod; return *this;}
    ModInt operator-() const {return -x < 0 ? mod - x : -x;}
    ModInt operator+(ModInt rhs) const {return ModInt(*this) += rhs;}
    ModInt operator-(ModInt rhs) const {return ModInt(*this) -= rhs;}
    ModInt operator*(ModInt rhs) const {return ModInt(*this) *= rhs;}
    ModInt operator/(ModInt rhs) const {return ModInt(*this) /= rhs;}
    bool operator==(ModInt rhs) const {return x == rhs.x;}
    bool operator!=(ModInt rhs) const {return x != rhs.x;}
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {s << a.x; return s;}
    friend istream& operator>>(istream& s, ModInt<mod>& a) {s >> a.x; return s;}
};

using mint = ModInt<MOD>;

mint dp[MAX], dpsum[MAX];

signed main() {
    int n, k; cin >> n >> k;
    vector<P> v;
    rep(i,k) {
        int l, r; cin >> l >> r;
        v.push_back(P(l,r));
    } 

    dp[1] = 1;
    dpsum[1] = 1;

    rep2(i,2,n+2) {
        rep(j,k) {
            int l = v[j].first, r = v[j].second;
            int li = i - r, ri = i - l;
            if (ri < 0) continue;
            chmax(li,1ll);
            dp[i] += dpsum[ri] - dpsum[li-1];
        }
        dpsum[i] = dpsum[i-1] + dp[i];
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 19192
#include "iostream"
#include "string"
using namespace std;
int d[6]={1,2,3,4,5,6},tmp;
int north()
{
	tmp=d[0];
	d[0]=d[1];
	d[1]=d[5];
	d[5]=d[4];
	d[4]=tmp;
	return d[0];

}
int east()
{
	tmp=d[0];
	d[0]=d[3];
	d[3]=d[5];
	d[5]=d[2];
	d[2]=tmp;
	return d[0];

}
int south()
{
	tmp=d[0];
	d[0]=d[4];
	d[4]=d[5];
	d[5]=d[1];
	d[1]=tmp;
	return d[0];

}
int west()
{
	tmp=d[0];
	d[0]=d[2];
	d[2]=d[5];
	d[5]=d[3];
	d[3]=tmp;
	return d[0];

}
int left()
{
	tmp=d[1];
	d[1]=d[3];
	d[3]=d[4];
	d[4]=d[2];
	d[2]=tmp;
	return d[0];

}
int right()
{
	tmp=d[1];
	d[1]=d[2];
	d[2]=d[4];
	d[4]=d[3];
	d[3]=tmp;
	return d[0];

}
int main(void)
{
	int n;
	while (cin>>n,n) {
		for (int i = 0; i < 6; i++) {
			d[i]=i+1;
		}
		string in;
		int ans=1;
		while (n--) {
			cin>>in;
			switch (in[0]) {
				case 'N':
					ans+=north();
					break;
				case 'E':
					ans+=east();
					break;
				case 'S':
					ans+=south();
					break;
				case 'W':
					ans+=west();
					break;
				case 'L':
					ans+=left();
					break;
				case 'R':
					ans+=right();
					break;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1208
fn main() {
    let (mut a, mut b) = {
        let vec: Vec<i32> = read_vec();
        (vec[0], vec[1])
    };

    if a <= b {
        std::mem::swap(&mut a, &mut b);
    }

    if a - b == 0 {
        println!("{}", 2 * a);
    }
    else {
        println!("{}", 2 * a - 1);
    }
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    vs s(h);
    rep(i, h) cin >> s[i];
    vector<vi> a(h, vi(w));
    int num = 1;
    rep(i, h) {
        int cnt = count(all(s[i]), '#'), p = 0;
        if (cnt > 0) {
            rep(j, cnt) {
                while (s[i][p]!='#') {
                    a[i][p] = num;
                    ++p;
                }
                a[i][p] = num;
                ++p;
                ++num;
            }
            while (p<w) {
                a[i][p] = num - 1;
                ++p;
            }
        }
    }
    rep1(i, h-1) {
        if (a[i][0] == 0) a[i] = a[i-1];
    }
    repr(i, h-1) if (a[i][0] == 0) a[i] = a[i+1];
    rep(i, h) rep(j, w) printf("%d%c", a[i][j], (j<w-1?' ':'\n'));
    return 0;
}


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

#define pb push_back
#define ll long long
#define mp make_pair
#define F first
#define S second
using namespace std;
void data() {
	#ifdef NURS
		freopen("main.in", "r", stdin);
		freopen("main.out", "w", stdout);
	#endif
}
const int N = 1e5 + 100;
const int mod = 1e9 + 7;
int dp[N][5];
int main()
{
	data();
	int n;
	cin >> n;
	int a[n + 1], b[n + 1], c[n + 1];
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i] >> b[i] >> c[i];
	}
	for (int i = 1; i <= n; i++)
	{
		dp[i][0] = max(dp[i][0], max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]));
		dp[i][1] = max(dp[i][1], max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]));
		dp[i][2] = max(dp[i][2], max(dp[i - 1][1] + c[i], dp[i - 1][0] + c[i]));
	}
	cout << max(dp[n][0], max(dp[n][1], dp[n][2]));
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111
	


	void solve(){

		ini(n);
		ini(k);
		ini(n1);
		vi morty(n);
		int rick = inf;
		FOR(i,0,n)in(morty[i]);
		FOR(i,0,n){
			vi big;
			vi fujiwara;
			FOR(j,0,n){
				if(morty[j]<morty[i]){
					if(big.size()>=k){
						sort(all(big));
						FOR(x,0,big.size()-k+1){fujiwara.push_back(big[x]);}
					}
					big.clear();
				}
				else{
					big.push_back(morty[j]);
				}
			}
			if(big.size()>=k){
						sort(all(big));
						FOR(x,0,big.size()-k+1){fujiwara.push_back(big[x]);}
			}
			if(fujiwara.size()<n1)continue;
			sort(all(fujiwara));
			rick  = min(rick,fujiwara[n1-1]-fujiwara[0]);
		}
		out(rick);


	}























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<cstring>
#include<climits>
using namespace std;
#define add(x) accumulate(x)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for (int i=a; i<(b); i++)
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
void solve() {
	int k;
	cin >> k;
	for (int i = 0; i < k; i++) {
		cout << "ACL";
	}
	return;
}
int main(int argc, char const *argv[])
{
	ll t = 1;
	while (t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3584
#include <cassert>
#include <array>
#include <algorithm>
#include <iostream>
#include <complex>
#include <vector>
#include <set>
using namespace std;

const double EPS = 1e-10;
template<class T>
bool eq(const T& a, const T& b) {return abs(a - b) < EPS;}

typedef complex<double> point;

namespace std {
	bool operator==(const point &a, const point &b){
		return abs(a - b) < EPS;
	}
	bool operator<(const point& a, const point& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}

double cross(const point& a, const point& b) {
	return imag(conj(a)*b);
}
double dot(const point& a, const point& b) {
	return real(conj(a)*b);
}

typedef array<point, 2> line;

bool intersectLL(const line& l, const line& m) {
	return !eq(cross(l[1]-l[0], m[1]-m[0]), 0.) || // non-parallel
			eq(cross(l[1]-l[0], m[0]-l[0]), 0.);   // same line
}

point crosspoint(const line& l, const line& m) {
	double A = cross(l[1] - l[0], m[1] - m[0]);
	double B = cross(l[1] - l[0], l[1] - m[0]);
	if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
	if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
	return m[0] + B / A * (m[1] - m[0]);
}

vector<line> lines;

int hitCount(const line& s) {
	vector<point> hits;
	for (const auto& t : lines) {
		if (intersectLL(s, t)) {
			point p = crosspoint(s, t);
			if (-100 < p.real() && p.real() < 100 && -100 < p.imag() && p.imag() < 100) {
				hits.push_back(p);
			}
		}
	}
	sort(hits.begin(), hits.end());
	auto it = unique(hits.begin(), hits.end());
	return it - hits.begin();
}

int main() {
	int n;
	while (cin >> n, n) {
		int cnt = 1;
		lines.clear();
		for (int i = 0; i < n; i++) {
			line l;
			for (auto& p : l) {
				int x, y;
				cin >> x >> y;
				p = point(x, y);
			}
			cnt += hitCount(l) + 1;
			lines.push_back(l);
		}
		cout << cnt << endl;
	}
	return 0;
}

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

using namespace std;

int main(void){
    int N, H;
    cin >> N >> H;
    vector<pair<int, int>> v(2*N);
    int ab=0;
    for(auto& it:v){
        cin >> it.first;
        it.second = ab;
        ab = !ab;
    }
    sort(v.rbegin(), v.rend());
    int ans = 0;
    for(auto x:v){
        if(x.second == 1){
            ans++;
            H -= x.first;
            if(H <= 0) break;
        } else {
            ans += (int)ceil((double)H / x.first);
            break;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import random
import math
LI = lambda: list(map(int,input().split()))
MI = lambda: map(int,input().split())
yes = lambda: print("Yes")
no = lambda: print("No")
I = lambda: list(input())
J = lambda x: "".join(x)
II = lambda: int(input())
SI = lambda: input()
#---khan17---template
n,m = MI()
d = {}
for i in range(m):
	a,b = MI()
	if a not in d:
		d[a] = [b]
	else:
		d[a].append(b)
	if b not in d:
		d[b] = [a]
	else:
		d[b].append(a)
q = [1]
mark = [0]*(n+1)
di = [0]*(n+1)
di[1] = 0
mark[1] = 1
way = [0]*(n+1)
while len(q)>0:
	v = q.pop(0)
	for i in range(len(d[v])):
		if mark[d[v][i]] == 0:
			di[d[v][i]] = di[v] + 1
			mark[d[v][i]] = 1
			q.append(d[v][i])
			way[d[v][i]] = v
if 0 in di[2:]:
	print("No")
else:
	print("Yes")
	for i in range(2,n+1):
		print(way[i])



Measured memory_bytes: 42648
from itertools import product

MAX_ITEM = 4
NUM = 7
OPS = ("+", "-")

ABCD = input()


def main():
    for p in product(OPS, repeat=3):
        eq = ABCD[0]

        for o, abcd in zip(p, ABCD[1:]):
            eq += o
            eq += abcd

        if eval(eq) == NUM:
            print(eq + "=" + str(NUM))
            break

    return


main()


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

long long gcd(long long x,long long y)
{
    return y?gcd(y,x%y):x;
}

int main()
{
    long long a,b;
    scanf("%lld%lld",&a,&b);
    long long c=gcd(a,b);
    long long d=a*b/c;
    printf("%lld",d);
}


Measured memory_bytes: 128
import java.io.*;
public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder out = new StringBuilder();
		while(true){
			String str = in.readLine();
      String[] words = str.split("\\s");
			int[] data = new int[words.length];
      for(int i=0; i < words.length; i++){
        data[i] = Integer.parseInt(words[i]);
      }
			int x = data[0];
			int y = data[1];
			if( x == 0 && y == 0){
				break;
			}else if( x < y ){
				out.append(x).append(" ").append(y).append("\n");
			}else {
				out.append(y).append(" ").append(x).append("\n");
			}
		}
		System.out.print(out);
	}
}

Measured memory_bytes: 29396
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;
const ll INF = 1LL<<50;

int main(){

int N;
cin>>N;
ll abc[N+1][3];
rep3(i,N){
    cin>>abc[i][0]>>abc[i][1]>>abc[i][2];
}
ll dp[N+1][3]; 
rep(i,3){
    dp[1][i]=abc[1][i];
}
rep4(i,2,N){
    rep(j,3){
    dp[i][j]=0;
    rep(k,3){
        if(j==k)continue;
        dp[i][j]=max(dp[i-1][k]+abc[i][j],dp[i][j]);

    }
    }
}
ll ans=0;
rep(i,3){
    ans=max(ans,dp[N][i]);
}
cout<<ans<<endl;


return 0;
}

Measured memory_bytes: 8220
#include <cstdio>
#include <string>
typedef long long LL;
int main() {
	LL a, b, c;
	scanf("%lld%lld%lld",&a,&b,&c);
	if (a%2==0||b%2==0||c%2==0) 
	{
		printf("0");
		return 0;
	}
	LL AB=a*b;
	LL BC=b*c;
	LL AC=a*c;
	LL m=std::min(AB,BC);
	m=std::min(m,AC);
	printf("%lld",m);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=1;i<=n;i++)
#define m(a,b) memset(a,b,sizeof(a))
typedef long long ll;
const int MAXN=2e5+10;
ll a[MAXN],ans=0;
map<ll,ll> mp;
map<ll,ll>::iterator iter;
 
int main(){
	int n;
	cin>>n;
	m(a,0);
	rep(i,n){
		cin>>a[i];
		a[i]+=a[i-1];
		if (a[i]==0) ans++;
		mp[a[i]]++;
	}
	for(iter=mp.begin();iter!=mp.end();iter++){
		ans+=(iter->second)*(iter->second-1)/2;
	}
	cout<<ans<<endl;
	return 0;
}

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

int n, q;
vector<vector<int>> g; // 隣接リスト
map<int, int> mp;
vector<int> ans;

void dfs(int from, int to, int val)
{
    ans[to] = val;
    for (auto& e: g[to]) {
        if (e == from) continue;
        dfs(to, e, val + mp[e]);
    }
}

int main()
{
    cin >> n >> q;
    g.resize(n);
    for (int i = 0; i < n-1; i++) {
        int a, b; cin >> a >> b; a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int i = 0; i < q; i++) {
        int p, x; cin >> p >> x; p--;
        mp[p] += x;
    }
    ans.resize(n, 0);
    dfs(0, 0, mp[0]);
    for (int i = 0; i < n; i++) {
        cout << ans[i] << " \n"[i==n-1];
    }
    return 0;
}

Measured memory_bytes: 39168
S=int(input())
T=S
i=0
x=0

while S>10**(i+1):
  i+=1

for a in range(i+1)[::-1]:
  x+=S//(10**a)
  S-=(S//(10**a))*(10**a)

if T%x==0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
a,b=map(int,input().split())
mod=(10**9)+7
if b>=a-1:
  print(cmb((2*a)-1, a,mod))
else:
  ans=0
  for i in range(1,b+1):
    ans+=cmb(a, i,mod)*cmb(a-1, a-i-1,mod)
  if b!=1:
    ans+=1
  print(ans%mod)

Measured memory_bytes: 127492
# 第2回全国統一プログラミング王決定戦予選-A
if False:
    N=int(input())
    if N%2==0: print(N//2-1)
    else: print(N//2)

# 第1回同じ-A
if False:
    M,D=map(int,input().split())
    ans=0
    for m in range(1,M+1):
        for d in range(1,D+1):
            if len(str(d))==2:
                x,y=int(str(d)[0]),int(str(d)[1])
                if x>=2 and y>=2 and x*y==m:
                    ans+=1
    print(ans)

#d2019PC2 - A
if False:
    N,K=map(int,input().split())
    MAX=N-K+1
    print(MAX-1 if K!=1 else 0)

#https://atcoder.jp/contests/nikkei2019-qual/tasks/nikkei2019_qual_a
if True:
    N,A,B=map(int,input().split())
    MAX=min(A,B)
    MIN=A+B-N if A+B>=N else 0
    print(MAX,MIN)


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

using namespace std;
#define int long long
using ld = long double;
ld dp[301][301][301];
ld solve(int a, int b, int c, int n)
{
    if(a < 0 || b < 0 || c < 0 || a > n || b > n || c > n)
        return 0;
    if(dp[a][b][c] != -1)
        return dp[a][b][c];
    ld x = solve(a-1, b, c, n);
    ld y = solve(a+1, b-1, c, n);
    ld z = solve(a, b+1, c-1, n);
    ld ans = (x*a + y*b + z*c + n);
    ans = ans/(a+b+c);
    return (dp[a][b][c] = ans);
}
signed main() {
    int cnt[4] = {0};
    int n;
    cin >> n;
    int i, j, k;
    for(i=1;i<=n;i++)
    {
        int x;
        cin >> x;
        cnt[x]++;
    }
    for(i=0;i<=300;i++)
        for(j=0;j<=300;j++)
            for(k=0;k<=300;k++)
                dp[i][j][k] = -1;
    dp[0][0][0] = 0;
    cout << fixed << setprecision(10) << solve(cnt[1], cnt[2], cnt[3], n);
    // dp[n][0][0]
}

Measured memory_bytes: 429932
#include <iostream>
#include <algorithm>

using namespace std;

int main(void) {
    int a, b, c;
    cin >> a >> b >> c;
    if(max({a, b, c}) == a+b+c - max({a, b, c})) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256