akhauriyash/Code-Regression huggingface dataset:
#include <cstdio> 
#include <cstdlib> 
#include <cmath> 
#include <cstring> 
#include <climits> 
#include <cfloat> 
#include <map> 
#include <utility> 
#include <set> 
#include <iostream> 
#include <memory> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <functional> 
#include <sstream> 
#include <complex> 
#include <stack> 
#include <queue> 
#include <numeric>
#include <cassert>

#define FOR(i, min, max) for (int i = (min); i < (max); ++i) 
#define FORE(i, min, max) for (int i = (min); i <= (max); ++i) 
#define REP(i, n) for (int i = 0; i < (n); ++i) 
#define REPV(vec, i) for (int i = 0; i < (int)(vec.size()); ++i) 
#define FOR_EACH(vec, it) for (typeof((vec).begin()) it = (vec).begin(); it != (vec).end(); ++it)

using namespace std; 
static const double EPS = 1e-12; 
typedef long long ll; 

ll LIMIT = 1000000000000000000LL;

int main(void)
{
    int N;
    cin >> N;
    vector<ll> A(N);
    bool haveZero = false;
    REP(i, N) {
        cin >> A[i];
        if (A[i] == 0)
            haveZero = true;
    }
    if (haveZero) {
        cout << 0 << endl;
    }
    else {
        ll ret = 1;
        REP(i, N) {
            if (A[i] > LIMIT/ret) {
                ret = -1;
                break;
            }
            ret *= A[i];
        }
        cout << ret << endl;
    }
    
    return 0;
}


Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
long X,d[]={100,101,102,103,104,105};
bool dp[1<<17];
int main(){
  cin>>X;
  for(int i=100;i<106;i++)dp[i]=true;
  for(int i=100;i<=1e5;i++)if(dp[i])for(int j=0;j<6;j++)dp[i+d[j]]=dp[i];
  cout<<dp[X]<<endl;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
  ll A, B, K;
  cin >> A >> B >> K;
  for (ll i = 0; i < K && A + i <= B; i++){
    printf("%lld\n", A + i);
  }
  for (ll i = K - 1; i >= 0; i--){
    if (B - i > A + K - 1) printf("%lld\n", B - i);
  }
}


Measured memory_bytes: 3736
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    N,=pin()
    temp=0
    ans=[]
    dame=0
    end=0
    for i in range(1,10**7):
        temp+=i
        if temp>=N:
            dame=temp-N
            end=i
            break
    for j in range(1,end+1):
        if j!=dame:print(j)
#%%submit!
resolve()

Measured memory_bytes: 42476
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	string s[3];
	rep (i, 3) cin >> s[i];

	bool ok = true;
	rep (i, 2) ok &= (s[i][s[i].length() - 1] == s[i+1][0]);

	cout << (ok ? "YES" : "NO") << endl;
 
	return 0;
}

Measured memory_bytes: 256
a, b, c, d = map(int, input().split())

if (a <= 0 and b >= 0) or (c <= 0 and d >= 0):
    print(max(a * c, a * d, b * c, b * d, 0))
else:
    print(max(a * c, a * d, b * c, b * d))

Measured memory_bytes: 9172
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

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

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

struct Hashing {
    ull seed, mod;
    vector <ull> hs, pw;

    Hashing(ull seed = 31, ull mod = 1000173169) :
        seed(seed),
        mod(mod) {}

    void build(int n, const string& s) {
        hs.assign(n + 1, 0);
        pw.assign(n + 1, 1);
        pw[0] = 1;

        for (int i = 1; i <= n; ++i)
            pw[i] = pw[i - 1] * seed % mod;
        for (int i = 1; i <= n; ++i)
            hs[i] = (hs[i - 1] * seed + s[i]) % mod;
    }

    ull hash(int l, int r) {
        return (hs[r] - hs[l - 1] * pw[r - l + 1] % mod + mod) % mod;
    }
};

int solve()
{
    int n;

    std::cin >>n;

    unordered_map<string, int> mp;

    string s;

    for (int i = 0; i < n; ++i) {
        cin >> s;
        mp[s]++;
    }

    map<int, vector<string>> mp2;

    for (auto it = mp.begin(); it != mp.end(); ++it) {
        mp2[it->second].push_back(it->first);
    }

    std::sort(mp2.rbegin()->second.begin(), mp2.rbegin()->second.end());
   
   for (auto &s2 : mp2.rbegin()->second)
        cout << s2 << endl;

    return 0;
}

int main()
{
    solve();

    return 0;
}

Measured memory_bytes: 26692
n = int(input())
d,x = map(int,input().split())
a = [int(input()) for _ in range(n)]
cnt=x
for i in range(n):
    cnt+=1
    k=1
    while 1:
        judge=k*a[i]+1
        if judge<=d:
            cnt+=1
            k+=1
        else:
            break
print(cnt)

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

int n,m,sum,cnt;
string s,t;
int a[100005];

int main() {
  cin >> n >> m;
  rep(i,n) cin >> a[i], sum+=a[i];
  rep(i,n)if(4*m*a[i]>=sum) cnt++;
  cout << (cnt>=m ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>

using namespace std;

void solve()
{
	int N;
	while(cin >> N, N)
	{
		map<int, int> Map;
		for(int i = 0; i < N; ++i)
		{
			int temp;
			cin >> temp;
			Map[temp]++;
		}
		int max = 0;
		int index = 0;
		for(map<int, int>::iterator Ite = Map.begin(); Ite != Map.end(); ++Ite)
		{
			if(max < Ite->second)
			{
				max = Ite->second;
				index = Ite->first;
			}
		}
		max > N / 2 ? cout << index << endl : cout << "NO COLOR" << endl;
	}
}

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

Measured memory_bytes: 0
#include<iostream>
using namespace std;
#define lli long long 
#include<bits/stdc++.h>
int main(){
  lli h;
  cin>>h;
  lli div=1;
  lli sum=0;
  while(div<=h){
    sum+=div;
    div=div*2;
  }
  cout<<sum;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

string s;
char ss[200002];
char sss[200002];

lin solve2()
{
    lin mxcur = (lin)s.length() - 3;
    lin cur = mxcur;
    lin res = 0;
 
    while(cur >= 0)
    {
        if(ss[cur] == 'A' &&
            ss[cur + 1] == 'B' &&
            ss[cur + 2] == 'C')
        {
            ss[cur] = 'B';
            ss[cur + 1] = 'C';
            ss[cur + 2] = 'A';
            res++;
            cur += 3;
        }
        cur--;
 
        cur = min(mxcur,cur); 
    }    

    return res;
}

lin solve1()
{
    lin cur = (lin)s.length() - 2;
    lin res = 0;
    lin bcc = 0;

    while(cur >= 0)
    {
        if(ss[cur] == 'B' && ss[cur+1] == 'C')
            bcc++;
        else if(ss[cur] == 'A' && ss[cur+1] != 'C')
            res += bcc;
        else if(ss[cur] == 'A')
            bcc = 0;
        else if(ss[cur] == 'B')
            bcc = 0;
        else if(ss[cur] == 'C' && ss[cur+1] == 'C')
            bcc = 0;

        cur--;
    }

    return res;
}

bool calc()
{
    rep(i, s.length())
    {
        //ss[i] = s[i];
        ss[i] = rand() % 3 + 'A';
        sss[i] = ss[i];
    }

    lin res1 = solve1();
    lin res2 = solve2();

    if(res1 != res2)
        cout << res1 << "," << res2 << endl;

    return res1 == res2;

}

int main(void)
{
    srand((unsigned int)time(NULL));

    cin >> s;

    rep(i, s.length())
    {
        ss[i] = s[i];
    }

    cout << solve1() << endl;

    // rep(x, 200000)
    // {
    //     if(!calc())
    //     {
    //         cout << x << endl;
    //         rep(i, s.length())
    //         {
    //             cout << sss[i];
    //         }
    //         cout << endl;
    //         return 0;
    //     }
    // }

    return 0;
}


Measured memory_bytes: 772
import java.util.*;

class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int a = Integer.parseInt(sc.next());
            if (isEven(a)) {
                System.out.println("Even");
                return;
            }

            int b = Integer.parseInt(sc.next());
            if (isEven(b)) {
                System.out.println("Even");
                return;
            }

            System.out.println("Odd");

        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    }

    public static boolean isEven(int num) {
        return num % 2 == 0;
    }
}

Measured memory_bytes: 22740
#include <iostream>
#include <vector>
#include <climits>
using namespace std;

string makeflame(int n){
    string s = "";
    for(int i = 0;i < n + 2;i++){
        s += "#";
    }
    return s;
}
int main(void){
   int h,w;
   cin >> h >> w;
   vector<string> s(h);
   for(int i = 0;i < h;i++){
       cin >> s[i];
   }
   vector<string> ans(h + 2);
   
   for(int i = 0;i < ans.size();i++){
       if(i == 0 || i == ans.size() - 1){
           ans[i] = makeflame(w);
       }else{
           ans[i] = "#" + s[i - 1] + "#";
       }
   }
   
  for(int i = 0;i < ans.size();i++){
        cout << ans[i] << endl;
  }
   
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()

int main() {
    ll r; cin >> r;
    cout << 3 * r * r << endl;
}

Measured memory_bytes: 256
#include <cstdio>

int main()
{
    int n, m, l;
    int i, j, k;
    int a[101][101], b[101][101];
    long c[101][101];
    scanf("%d %d %d", &n, &m, &l);
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < m; j++)
        {
            scanf("%d", &a[i][j]);
        }
    }
    for (i = 0; i < m; i++)
    {
        for (j = 0; j < l; j++)
        {
            scanf("%d", &b[i][j]);
        }
    }
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < l; j++) //cの配列
        {
            c[i][j] = 0;
            for (k = 0; k < m; k++)
            {
                c[i][j] += (a[i][k] * b[k][j]);
            }
            if (j == l - 1)
            {
                printf("%ld", c[i][j]);
            }
            else
            {
                printf("%ld ", c[i][j]);
            }
        }
        printf("\n");
    }
}


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

int gcd(int a,int b,int &x,int &y){
    if (b==0){
        x=1,y=0;
        return a;
    }
    int q=gcd(b,a%b,y,x);
    y-=a/b*x;
    return q;
}
int main()
{
    int m,n,x,y;
    cin >> m >> n;
    gcd(m,n,x,y);
    cout << x<< " " << y<< endl;
    return 0;
}

Measured memory_bytes: 3116
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std ;
const int maxn=1000010;
int n , m , a[maxn] ,b[maxn];
int x ,y ;

int main() {
	int  mx = 0 ;
	cin>>n>>m>>x>>y;
	for( int i = 1 ; i <= n ; i ++ ) {
		cin>>a[i];
	}
	for( int i = 1 ; i <= m ; i ++ ) {
		cin>>b[i];
	}
	a[ 0 ] = x ;
	b [ 0 ]  = y ;
	sort( a , a+ n + 1);
	sort( b , b + m + 1 ) ;
	if( a[ n ] < b[ 0 ] )puts("No War");
	else puts("War");
	return 0 ;
}

Measured memory_bytes: 2304
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [n]: string[] = tmp.shift().split(" ");
    return `${n.charAt(0) == "7" || n.charAt(1) == "7" || n.charAt(2) == "7" ? "Yes" : "No"}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 29624
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n;
  cin >> n;
  vi a(n + 1);
  int g = 0;
  for (int i = n; i >= 0; --i) {
    cin >> a[i];
    g = __gcd(g, abs(a[i]));
  }
  vi erat(10003, 1);
  erat[0] = erat[1] = 0;
  for (int i = 2; i * i < erat.size(); ++i) if (erat[i])
    for (int j = i * i; j < erat.size(); j += i) erat[j] = 0;
  vi d;
  for (int i = 0; i < erat.size(); ++i) if (erat[i]) {
    d.push_back(i);
  }
  for (int p : d) {
    vi b = a;
    for (int i = n; i >= 0; --i) {
      b[i] %= p;
      if (i >= p) {
        b[i - p + 1] += b[i];
      }
    }
    bool ok = 1;
    for (int i = 0; i < min(p, n + 1); ++i) if (b[i] % p) {
      ok = 0; break;
    }
    if (ok) cout << p << endl;
  }
  vi pr;
  for (int i = 2; i * i <= g; ++i) if (g % i == 0) {
    pr.push_back(i);
    while (g % i == 0) g /= i;
  }
  if (g > 1) pr.push_back(g);
  for (int p : pr) if (p > d.back()) cout << g << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define veci(x,n) vector<int> x((int) (n))
#define vecs(x,n) vector<string> x((int) (n))
#define vecbf(x,n) vector<bool> x((int) (n), false)

int main(){
  string s;
  cin >> s;
  if(s.at(0) == s.at(1) && s.at(1) == s.at(2)){
    cout << "Yes" << endl;
    return 0;
  }
  if(s.at(1) == s.at(2) && s.at(2) == s.at(3)){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if(a%3==0||b%3==0||(a+b)%3==0) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
}


Measured memory_bytes: 256
import scala.io.StdIn.{readLine,readInt}

object Main extends App {
  val seq1 = for(i<-1 to 9) yield List(i,i,i)
  val seq2 = for(i<-1 to 7) yield List(i,i+1,i+2)

  def check(m:List[Int], count:Int,u:Int,v:Int):Boolean =
    if(m.length != count) false
    else if(count==2) {
      val List(x,y) = m
      if(x==y) true else false
    } else
      (u to 8).exists( i=> check(m diff seq1(i),count-3,i+1,v)) || (v to 6).exists(i=> check(m diff seq2(i),count-3,u,i))

  Iterator.continually(readLine).takeWhile ( _!=null ).foreach { line =>
    val l = line.map(_.asDigit).toList
    val m = (1 to 9).filter { i=> if(l.count( _==i ) >= 4) false else check(i::l,14,0,0) }
    if(m.length>0) println(m.mkString(" ")) else println(0)
  }
}

Measured memory_bytes: 70212
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int a[][] = new int[2][n];
            for (int j = 0; j < n; j++) {
                a[0][j] = in.nextInt();
            }
            long sum = a[0][0];
            for (int j = 0; j < n; j++) {
                a[1][j] = in.nextInt();
                sum += a[1][j];
            }
            long max = sum;
            for (int i = 1; i < n; i++) {
                sum += a[0][i] - a[1][i - 1];
                if (sum > max) {
                    max = sum;
                }
            }
            out.println(max);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 22740
def main():
  N = int(input())
  flag = 0
  for l in range(N):
    l = list(map(int, input().split()))
    if l[0] == l[1]:
      flag += 1
      if flag == 3:
        flag = 80000
        break
    else:
      flag = 0    
  return flag

Ans = main()
if Ans == 80000:
  print('Yes')
else :
  print('No')

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

int main() {
    int N;
    cin >> N;
    vector<int> cnt_list(N+1);
    for(int X = 1; X <= 100; X++) {
        for(int Y = 1; Y <= 100; Y++){
            for(int Z = 1; Z <= 100; Z++){
                int s = X*X + Y*Y + Z*Z + X*Y + Y*Z + Z*X;
                if(s <= N) cnt_list[s]++; 
            }
        }
    }
    for (int i = 1; i <= N; i++){
        cout << cnt_list[i] << endl;
    }
}

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

int main(){
  int H,W;
  bool nul;
  cin >> H >> W;
  char a[H][W];
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++) cin >> a[i][j];
  }
  for(int i=0; i<H; i++){
    nul = true;
    for(int j=0; j<W; j++){
      if(a[i][j]=='#') nul = false;
    }
    if(nul) for(int j=0; j<W; j++) a[i][j] = '0';
  }
  for(int i=0; i<W; i++){
    nul = true;
    for(int j=0; j<H; j++){
      if(a[j][i]=='#') nul = false;
    }
    if(nul) for(int j=0; j<H; j++) a[j][i] = '0';
  }
  for(int i=0; i<H; i++){
    nul = true;
    for(int j=0; j<W; j++) if(a[i][j]!='0'){
      cout << a[i][j];
      nul = false;
    }
    if(!nul) cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys
while True:
    a,b = map(int, raw_input().split())
    if a ==0 and b == 0:
        break
    for i in range(a):
        for j in range(b):
            if i == 0 or i == a-1 or j == 0 or j == b-1:
                sys.stdout.write("#")
            else:
                sys.stdout.write(".")
        print 
    print

Measured memory_bytes: 6380
import numpy as np
n, m = map(int, input().split())
ans = [0]*n

for _ in range(m):
    l, r = map(int, input().split())
    ans[l-1] += 1
    if r < n:
        ans[r] -= 1

c = list(np.cumsum(ans))
print(c.count(m))

Measured memory_bytes: 32144
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_152
{
    class A
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] nm = ReadInts();
            WriteLine(nm[0] == nm[1] ? "Yes" : "No");
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<cctype>
using namespace std;
int main(){
  string a,b,c;
  cin >> a >> b >> c;
  cout << (static_cast<char>(toupper(a[0]))) << (static_cast<char>(toupper(b[0]))) << (static_cast<char>(toupper(c[0]))) << endl;
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define init(n) int n;cin>>n;int a[n];rep(i,n)cin>>a[i];
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
const int inf=1e9;
int main() {
  
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
    	int l;double ans;
    	cin>>l;
    	ans=l*l*l;
    	ans=ans/27;
    	cout<<fixed<<setprecision(6);
    	cout<<ans;
    }   
    return 0;   
}   	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
const char* LF = "\n";
namespace{struct _{_(){
    cin.tie(0);
    ios::sync_with_stdio(false);
}}a;}

signed main() {
    int A, B, C;
    cin >> A >> B >> C;

    vector<int> v = { A, B, C };
    sort(ALL(v));

    int ans = v[2] - v[1];
    v[0] += v[2] - v[1];
    ans += (v[2] - v[0]) / 2 + ((v[2] - v[0]) % 2) * 2;
    cout << ans << LF;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n, k; scanf("%d%d", &n, &k); std::vector<int> a(n);
	for(auto& v: a) scanf("%d", &v);
	

	for(int i = k; i < n; i++) printf("%s\n", (a[i - k] < a[i] ? "Yes" : "No"));
	return 0;
}


Measured memory_bytes: 4064
a,b,c = list(map(int,input().split()))
k = int(input())
ans = 'No'

def iter_p_adic(p, n):
    from itertools import product
    tmp = [range(p)] * n
    return product(*tmp)

iterator = iter_p_adic(3, k)
for idxs in iterator:
    a_tmp = a
    b_tmp = b
    c_tmp = c
    for i in idxs:
      if i == 0:
        a_tmp = a_tmp*2
      elif i == 1:
        b_tmp = b_tmp*2
      elif i == 2:
        c_tmp = c_tmp*2
    if a_tmp<b_tmp<c_tmp:
      ans = 'Yes'

print(ans)


Measured memory_bytes: 9192
import itertools

a,b,c,d = map(int, input().split())
ab = [a,b]
cd = [c,d]

if a<=0 and 0<=b:ab.append(0)
if c<=0 and 0<=d:cd.append(0)

ans = - float('inf')
for x, y in itertools.product(ab,cd):
  ans = max(ans, x*y)
  
print(ans)   
  

Measured memory_bytes: 9124
from heapq import heappush, heappop

Q = int(input())

update_count = 0
al = []
sl = 0
ar = []
sr = 0
b = 0
for _ in range(Q):
    # print(f'al:{al}, sl:{sl}')
    # print(f'ar:{ar},sr:{sr}')
    # print(f'b:{b}')
    # print()
    s = tuple(map(int, input().split()))
    if s[0] == 1:
        # 更新クエリ
        b += s[2]
        if update_count % 2 == 0:
            # 左に追加
            heappush(ar, s[1])  # 右に追加
            sr += s[1]
            x = heappop(ar)  # 右の最小値
            sr -= x
            heappush(al, -x)  # 左に追加
            sl += x
        else:
            # 右に追加
            heappush(al, -s[1])  # 左に追加
            sl += s[1]
            x = heappop(al)  # 左の最小値
            sl -= (-x)
            heappush(ar, -x)  # 右に追加
            sr += (-x)
        update_count += 1
        # 左キューalの最大値が中央値になっている
        # 左キューにheappushする際,負値に変換したので,heappopで最大値*(-1)が求まる
    else:
        # 求値クエリ
        x = heappop(al)  # 中央値
        heappush(al, x)
        x *= (-1)
        cnt_l = (update_count + 1) // 2
        cnt_r = update_count - cnt_l
        print(x, (cnt_l * x - sl) + (sr - cnt_r * x) + b)


Measured memory_bytes: 11184
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int lli;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef pair <lli,lli> pii;
#define ff first
#define ss second
#define MOD 1000000007
#define pb push_back
#define EPS 1e-6


 
int main(){
	fast;
	map<string,int> mp;
	int n;
	cin>>n;
	int cnt=0;
	for(int i=0; i<n; i++){
	    string s;
	    cin>>s; 
	    mp[s]++;
	    cnt=max(cnt, mp[s]);
	}
	vector<string> v;
	for(auto i: mp){
	    if(i.ss==cnt) cout<<i.ff<<"\n";
	}
	return 0;
}

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

int main()
{
    int a,b,k;
    cin>>k;
	cin>>a>>b;
    int i=a;
    while(i<=b)
    {
        if(i%k==0)
        {

            cout<<"OK"<<endl;
            break;
        }
        i++;
    }
    if(i==b+1)
        cout<<"NG"<<endl;

}

Measured memory_bytes: 3612
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int L = Integer.parseInt(sc.next());
        String[] S = new String[N];
        String s = "";

        for (int i = 0; i < N; i++) {
            S[i] = sc.next();
        }

        Arrays.sort(S);

        for (int i = 0; i < N; i++) {
            s += S[i];
        }

        PrintWriter out = new PrintWriter(System.out);
        out.println(s);

        sc.close();
        out.flush();
    }
}

Measured memory_bytes: 40364
s = input()
sl = [0 for _ in range(26)]
for i in range(len(s)):
    sl[ord(s[i])-97] += 1
ans = 0
for j in sl:
    if j%2 == 0:
        pass
    elif j%2 != 0:
        ans = 1
        break
if ans == 0:
    print("Yes")
else:
    print("No")


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

int main(){
  int N,X,sumg=0,sumk=0;
  cin >> N >> X;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>> A.at(i);
    sumg+=A.at(i);
    sumk++;
  }
  sort(A.begin(),A.end());
  while(true){
    if(sumg+A.at(0)<=X){
      sumg+=A.at(0);
      sumk++;
    }
    else{
      break;
    }
  }
  cout << sumk << endl;
}

Measured memory_bytes: 256
import java.util.Scanner

import scala.collection.mutable.ArrayBuffer

object Main {
  def read() = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val s = sc.next()
    //val h = for (_ <- 0 until n) yield sc.nextInt()
    (n, s)
  }


  def solve(n: Int, s: String): Int = {
    val cumSumB = s.map(c => if (c == '#') 1 else 0).scanLeft(0)(_ + _)
    val cumSumW = s.map(c => if (c == '.') 1 else 0).scanLeft(0)(_ + _)
    case class Range(begin: Int, end: Int)
    def countB(range: Range) = cumSumB(range.end) - cumSumB(range.begin)

    def countW(range: Range) = cumSumW(range.end) - cumSumW(range.begin)

    // 白にする区間: [0, i) (i=0,...,n)
    (0 to n).map { i =>
      val whiteRange = Range(0, i)
      val blackRange = Range(i, n)
      countB(whiteRange) + countW(blackRange)// 異なる数
    }.min
  }


  def main(args: Array[String]): Unit = {
    val (n, s) = read()
    println(solve(n, s))
  }

}

Measured memory_bytes: 53884
#include<bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define VAL 100000
#define ll long long
const int MAX=1e5+8;
using namespace std;
vector<int>adj[MAX];
int vis[MAX];
int cnt[MAX];
int main() 
{ 
	//ios_base::sync_with_stdio(false);
  //  cin.tie(NULL);
//	#ifndef ONLINE_JUDGE
//	freopen("inp.txt" ,"r", stdin );
//	freopen("out.txt", "w", stdout);
//	#endif
	int k , n;
	cin>>k>>n;
	int arr[n+1];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	int mn=k-(k-arr[n-1]+arr[0]);
	for(int i=1;i<n;i++){
		mn=min(mn , k-(arr[i]-arr[i-1]));
	}
	cout<<mn;
}

Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int M = in.nextInt();
		int[] b = new int[M + 1];
		for (int i = 1; i <= M; i++) {
			b[i] = Integer.parseInt(in.next());
		}
		for (int i = M / 2; i > 0; i--) {
			int sum = 0;
			for (int j = 2; j * i <= M; j++) {
				if (b[j * i] == 1) {
					sum++;
				}
			}
			if (sum % 2 != 0) {
				if (b[i] == 1) {
					b[i] = 0;
				} else {
					b[i] = 1;
				}
			}
		}
		int count = 0;
		StringBuilder sb = new StringBuilder();
		for (int i = 1; i <= M; i++) {
			if (b[i] == 1) {
				count++;
				sb.append(i + " ");
			}
		}
		if (sb.length() != 0 && sb.charAt(sb.length() - 1) == ' ') {
			sb.deleteCharAt(sb.length() - 1);
		}
		System.out.println(count);
		if (count != 0) {
			System.out.println(sb.toString());
		}
		in.close();
	}
}

Measured memory_bytes: 51708
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
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;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	ll a, b;

	cin >> a >> b;

	if (a <= b) {
		cout << a << endl;
	}
	else {
		cout << a - 1 << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

int to_sec(int h, int m, int s){
	return h*60*60 + m*60 + s;
}

int main(){
	int n;
	while( scanf("%d", &n ), n ){
		int H[60*60*24+1] = {0};
		
		for(int i=0 ; i < n ; i++ ){
			int h1, m1, s1, h2, m2, s2;
			scanf("%d:%d:%d %d:%d:%d", &h1, &m1, &s1, &h2, &m2, &s2 );
			int t1 = to_sec( h1 , m1 , s1 );
			int t2 = to_sec( h2 , m2 , s2 );
			for(int t = t1 ; t < t2 ; t++ ){
				H[t]++;
			}
		}
		int ans = 0;
		for(int t=0 ; t < 60*60*24+1 ; t++ ){
			ans = max( ans , H[t] );
		}
		cout <<  ans << endl;
	}
}

Measured memory_bytes: 1228
#include<stdio.h>
int main (){
    int array_1[40] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K,Re;
    scanf("%d",&K);
    Re = array_1[K-1];
    printf("%d\n",Re);
    return(0);
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys
INF = float("inf")

MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    RGB = [-1, -1, -1]
    ans = 1
    for a in A:
        count = 0
        for i in range(3):
            if RGB[i] == a-1:
                if count == 0:
                    RGB[i] = a
                count += 1
        if count > 1:
            ans *= count
            ans %= MOD
        elif count == 0:
            ans = 0
            print(ans)
            return
    print(ans)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14324
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

function main()
	d = Dict{String,Int}()
	d["SSS"] = 0
	d["SSR"] = 1
	d["SRS"] = 1
	d["RSS"] = 1
	d["SRR"] = 2
	d["RSR"] = 1
	d["RRS"] = 2
	d["RRR"] = 3
	s = readline() |> chomp
	println(d[s])
end

main()

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

int main()
{
  long n; cin>>n;
  
  long long ans = 0;
  
  for(long i=1; i<n; i++)
  {
    long x = n/i;
    if(n%i == 0)
      x--;
    ans += x;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3576
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define maxn 2005
#define _x1 x1
#define _x2 x2
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
int n, m;
ll v;
int fa[maxn], id[maxn], x[maxn], y[maxn];
ll w[maxn];
int getfa(int now) {
	return fa[now] == now ? now : fa[now] = getfa(fa[now]);
}
int cmp(int i, int j) {
	return w[i] < w[j];
}
ll kruskal(int now) {
	for (int i = 1; i <= n; i++)
		fa[i] = i;
	ll ans = 0;
	if (now)
		fa[x[now]] = y[now], ans += w[now];
	for (int i = 1; i <= m; i++) {
		int pos = id[i];
		int x1 = getfa(x[pos]), y1 = getfa(y[pos]);
		if (x1 != y1) {
			ans += w[pos];
			fa[x1] = y1;
		}
	}
	return ans;
}
ll quickpow(ll p, ll k) {
	ll ans = 1;
	while (k) {
		if (k & 1)
			ans = (ans * p) % mod;
		p = (p * p) % mod;
		k >>= 1;
	}
	return ans;
}
int main() {
	scanf("%d%d%lld", &n, &m, &v);
	for (int i = 1; i <= m; i++)
		scanf("%d%d%lld", &x[i], &y[i], &w[i]), id[i] = i;
	sort(id + 1, id + 1 + m, cmp);

	ll temp = kruskal(0);

	if (temp > v)
		return printf("0\n"), 0;

//	printf("%lld %lld\n", temp, v);
	if (temp == v) {
		int cnt1 = 0, cnt2 = 0;
		for (int i = 1; i <= m; i++) {
			if (kruskal(i) == temp)
				cnt1++;
			else
				cnt2++;
		}
		ll res1 = (quickpow(2, cnt1) - 2 + mod) % mod;
		ll res2 = quickpow(2, cnt2) % mod;
//		printf("%lld %lld %d %d\n", cnt1, cnt2, res1, res2);
		return printf("%lld\n", res1 * res2 % mod), 0;
	} else {
		int cnt1 = 0, cnt2 = 0;
		for (int i = 1; i <= m; i++) {
			ll res1 = kruskal(i);
			if (res1 == v)
				cnt1++;
			else if (res1 > v)
				cnt2++;
		}
		ll res1 = 2ll * ((quickpow(2, cnt1) - 1 + mod) % mod) % mod;
		ll res2 = quickpow(2, cnt2);
		printf("%lld\n", res1 * res2 % mod);
	}
}


Measured memory_bytes: 3840
#define MYDEBUG
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <algorithm>
#include <queue>
#include <set>
#include <cstdio>
#include <unordered_map>

#ifdef MYDEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
using namespace std;

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
	out << "[";
	size_t last = v.size() - 1;
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i];
		if (i != last)
			out << ",";
	}
	out << "]";
	return out;
}

void solve() {
	ll a, b, x;
	cin >> a >> b >> x;
	int off = 0;
	if (a == 0)
		off += 1;
	cout << b / x - max((a - 1), 0ll) / x + off << endl;
}
int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  string s;
  cin >> s;

  int ans = 0;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] != s[i - 1]) {
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define print(a) cout << (a) << endl; 
typedef long long ll;
const int MOD = 1000000007; 

int main() {
    int n, p;
    string s;
    cin >> n >> p >> s;
    ll ans = 0;
    if (p == 2 || p == 5) {
        rep(i, n) {
            if ((s[i]-'0')%p==0) ans += i+1;
        }
        cout << ans << endl;
        return 0;
    } 
    vector<int> smod(n);
    smod[0] = (s[n-1]-'0') % p;
    int tenmod = 1;
    rep1(i, n) {
        tenmod = tenmod * 10 % p;
        smod[i] = (tenmod * (s[n-i-1]-'0') + smod[i-1]) % p;
    } 
    vector<ll> counts(p, 0);
    rep(i, n) counts[smod[i]]++;
    ans += counts[0];
    rep(i, p) {
        if (counts[i]) {
            ans += counts[i] * (counts[i]-1) / 2;
        }
    }
    cout << ans << endl; 
    return 0;
}

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

int main() {
    char s[5];
    cin >> s;
    if (s[0]==s[1] && s[1]==s[2]) puts("Yes");
    else if (s[1]==s[2] && s[2]==s[3]) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 3576
import sys

def input_num():
    num = input().split()
    return num

def num_serch(num):
    penki_num = len(num)
    if num[0] == num[1]:
        penki_num = penki_num - 1
    if num[0] == num[2]:
        penki_num = penki_num - 1
    if num[1] == num[2]:
        penki_num = penki_num - 1

    if penki_num == 0:
        penki_num = penki_num + 1

    print(penki_num)

if __name__ == '__main__':
    num = input_num()
    num_serch(num)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>

using namespace std;

int main(){
    int N,b=0,count=1;
    cin>>N;
    int a[N];
    for(int i=0;i<N;i++) cin>>a[i];
    b=a[0];
    for(int i=0;i<N;i++){
        if(b==2){
            cout<<count<<endl;
            return 0;
        }else{
            b=a[b-1];
            count++;
        }
    }
    count=-1;
    cout<<count<<endl;
    return 0;
}

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

int main(){
    int N,K;
    std::cin>>N>>K;
    std::vector<long long> a(N);
    for(int i=0;i<N;++i) std::cin>>a[i];
    long long ans=1e18;
    for(int bit=0;bit<(1<<N);++bit){
        if(__builtin_popcount(bit)<K) continue;
        long long tmp=0,height=0;
        for(int i=0;i<N;++i){
            if(bit>>i&1){
                if(a[i]<=height){
                    height++;
                    tmp+=height-a[i];
                }
                else height=a[i];
            }
            else height=std::max(height,a[i]);
        }
        ans=std::min(ans,tmp);
    }
    std::cout<<ans<<std::endl;
}

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

int main()
{	
	double a, b, c, d, p, q;
	char s;

	while (cin >> a >> s >> b >> s >> c >> s >> d >> s >> p >> s >> q) {

		double x = (p * ((c - a) * (c - a) - (d - b) * (d - b))
			+ 2 * (d - b) * (a * d - b * c - a * q + c * q)) / ((d - b) * (d - b) + (c - a) * (c - a)),
			y = (q * ((d - b) * (d - b) - (c - a) * (c - a))
				+ 2 * (c - a) * (- a * d + b * c + d * p - b * p)) / ((d - b) * (d - b) + (c - a) * (c - a));

		cout << fixed << setprecision(6) << x << " " << y << endl;
	}

	return 0;
}



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

int main() {
    int n, numofpush, light;
    bool tf;
    cin >> n;
    vector<int> a(n + 1);
    vector<bool> lighted(n + 1, false);
    for (int i = 1; i <= n; i++) cin >> a.at(i);
    light = 1;
    lighted.at(1) = true;
    numofpush = 1;
    while(true) {
        light = a.at(light);
        if (light == 2) {
            tf = true;
            break;
        }
        if (lighted.at(light) == true) {
            tf = false;
            break;
        }
        lighted.at(light) = true;
        numofpush++;
    }
    if(tf) cout << numofpush << endl;
    else cout << -1 << endl;
}

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

int main(){
    int N;
    cin>>N;
    vector<int> vec(N);
    for(auto &x:vec){
        cin>>x;
    }
    cout<<*max_element(vec.begin(),vec.end())-*min_element(vec.begin(),vec.end())<<endl;
}

Measured memory_bytes: 256
var
	s:String;
	x,y,f,cnt,i,j,off:Longint;
	d:array[1..2,1..8000]of Longint;
	c:array[1..2]of Longint;
	dp:array[1..2,1..2,1..20000]of Boolean;
	ans:Boolean;
begin
	readln(s);
	f:=1;
	for i:=1 to length(s) do begin
		if s[i]='T'then begin
			inc(c[f]);
			d[f,c[f]]:=cnt;
			cnt:=0;
			f:=3-f;
		end else inc(cnt);
	end;
	inc(c[f]);
	d[f,c[f]]:=cnt;
	read(x,y);
	off:=10000;
	dp[1,1,off+d[1,1]]:=True;
	dp[2,1,off-d[2,1]]:=True;
	dp[2,1,off+d[2,1]]:=True;
	f:=1;
	for i:=2 to c[1]do begin
		for j:=1 to 20000-d[1,i]do begin
			if dp[1,f,j]then dp[1,3-f,j+d[1,i]]:=True;
		end;
		for j:=d[1,i]+1 to 20000 do begin
			if dp[1,f,j]then dp[1,3-f,j-d[1,i]]:=True;
		end;
		for j:=1 to 20000 do dp[1,f,j]:=False;
		f:=3-f;
	end;
	ans:=dp[1,f,off+x];
	f:=1;
	for i:=2 to c[2]do begin
		for j:=1 to 20000-d[2,i]do begin
			if dp[2,f,j]then dp[2,3-f,j+d[2,i]]:=True;
		end;
		for j:=d[2,i]+1 to 20000 do begin
			if dp[2,f,j]then dp[2,3-f,j-d[2,i]]:=True;
		end;
		for j:=1 to 20000 do dp[2,f,j]:=False;
		f:=3-f;
	end;
	if ans and dp[2,f,off+y]then writeln('Yes')else writeln('No');
end.


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

int main() {

    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;

    bool vertical = true, horizontal = true;

    if (((y - r) < 0) || ((y + r) > H)) {
        vertical = false;
    }

    if (((x - r) < 0) || ((x + r) > W)) {
        horizontal = false;
    }

    if (vertical && horizontal) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }

    return 0;
}



Measured memory_bytes: 3104
#include <iostream>
using namespace std;
int main()
{
    int x,ans=0;
    cin>>x;
    int a,b,c;
    a=x/100;
    b=x/10%10;
    c=x%10;
    if (a==1) ans++;
    if (b==1) ans++;
    if (c==1) ans++;
    cout<<ans<<endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 504
object Main extends App {
  import scala.io.StdIn._

  val Array(n, k, l) = readLine.trim.split(' ').map(_.toLong)
  val series = readLine.trim.split(' ').map(_.toInt)
  println(
    Range(1, n.toInt).upperBound(i ⇒ numOfUnderXSeries(series, i, k.toInt) >= l).get
  )
  def numOfUnderXSeries(num: Array[Int], x: Int, k: Int): Long = {
    val series = num.zipWithIndex.withFilter(_._1 <= x).map(_._2.toLong)
    if (series.length < k) {
      0L
    }else {
      (1 to (series.length - k)).map{left ⇒
        (series(left) - series(left - 1)) * (num.length - series(left + k - 1))
      }.sum + (series(0) + 1) * (num.length - series(k - 1))
    }
  }
  case class Range(from: Int, to: Int){
    def upperBound(predicate: Int ⇒ Boolean): Option[Int] = {
      var left = from
      var right = to
      while (left < right){
        val mid = left + (right - left) / 2
        if (predicate(mid)){
          right = mid
        }else {
          left = mid + 1
        }
      }
      if (left == to && !predicate(left)) None
      else Some(left)
    }
  }
  implicit class ScopeFunc[T](value: T){
    def let[A](func: T ⇒ A): A = func(value)
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
  }
}


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

int main() {
    long long n,a,b,ans=0;
    cin>>n;
    cin>>a;
    cin>>b;
    if(a==0){
        cout<<a;
    }
    else if(b==0){
        cout<<n;
    }
    else{
        ans=a+b;
        if(n%ans==0){
            ans=a*(n/ans);
            cout<<ans;
        }
        else{
            if((n%ans)>a){
                cout<<(a+(a*(n/ans)));
            }
            else{
                cout<<((n%ans)+(a*(n/ans)));
            }
        }
    }
    return 0;
       
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <cstdlib>

using namespace std;

int n;

int main()
{
	scanf("%d",&n);
	if(n/100==n%10)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 256
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
//get_be biger & equal
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
//ll a[Max];
ll n;
void solve(){
	string s;
	cin>>s;
	n = sz(s);
	if(n&1){
		cout<<"No";return ;
	}else{
		for(int i=0;i<n;i+=2){
			if(s[i]=='h'&&s[i+1]=='i'){
				;
			}else{
				cout<<"No";return ;
			}
		}
		cout<<"Yes";
	}
	
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





Measured memory_bytes: 256