akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	if (n == 1)cout << "Hello World" << endl;
	else {
		int a, b;
		cin >> a;
		cin >> b;
		cout << a+b << endl;
	}
}

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

#define LL long long
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1; char c=getchar();
	for (;!isdigit(c);c=getchar()) if (c=='-') f=-1;
	for (;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}

const int MAXN = 200010;

map<int,int> Mp;
int N,K,Sum[MAXN]; LL ans;
inline int Sub(int x,int y){return ((x-y)%K+K)%K;}
int main(){
	N=read(); K=read();
	Sum[0]=0; Mp[0]=1;
	for (int i=1;i<=N;++i){
		int x=read(); Sum[i]=(Sum[i-1]+x)%K;
		if (i>=K) --Mp[Sub(Sum[i-K],i-K)];
		//printf("%d %d\n",i,Sub(Sum[i],i));
		ans+=Mp[Sub(Sum[i],i)]; ++Mp[Sub(Sum[i],i)];
	} cout<<ans<<endl;
	return 0;
}


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

main() {
    int S; cin >> S; int pos;
    map<int,bool>m;
    for(int i=1;i<1000000;i++){
        if(i==1) pos=S;
        else if(pos%2==0){
            pos/=2;
        }
        else pos=pos*3+1;
        if(m[pos]) {cout << i << endl; break;} 
        m[pos]=true;

    }

    return 0;
}

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

using namespace std;

typedef long long ll;

#define mod 1000000007
#define siz 100001

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll a,b,c,k;
	cin >> a >> b >> c;
	cin >> k;
	// c > b > a
	
	ll cnt = 0;
	while(b <= a){
		b *= 2;
		cnt++;
	}
	while(c <= b){
		c *= 2;
		cnt++;
	}
	
	cnt > k ? cout << "No" << "\n" : cout << "Yes" << "\n";
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void) {
	double t,v,y;
	int result;
	int n;
	while(!feof(stdin)) {
		if(scanf("%lf",&v)==-1)break;
		t=v/9.8;
		y=4.9*t*t;
		result=ceil(y);
		if(result%5!=0)result=result+5-result%5;
		n=(result+5)/5;
		printf("%d\n",n);
	}
	return 0;
}

Measured memory_bytes: 0
(n,k),a = $<.map{|l|l.split.map(&:to_i)}

accum = [0]
modk = [0]
sum = 0
a.each.with_index(1){|ai,i|
  sum += ai
  accum << sum
  modk << (sum-i)%k
}

valmap = Hash.new{0}
l = 0
r = [k+l-1,n].min

(l+1..r).each{|i|
  valmap[modk[i]] += 1
}
cnt = 0
n.times{
  cnt += valmap[modk[l]]
  l += 1
  r += 1
  valmap[modk[l]] -= 1
  valmap[modk[r]] += 1
}
p cnt

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

typedef long long int ll;

int main()
{
    ll n, m;
    cin >> n >> m;
    vector<pair<ll,ll>> ab(n), cd(m);
    for(ll i = 0;i < n;i++){
        cin >> ab[i].first >> ab[i].second;
    }
    for(ll i = 0;i < m;i++){
        cin >> cd[i].first >> cd[i].second;
    }

    for(ll i = 0;i < n;i++){
        ll t = abs(ab[i].first - cd[0].first) + abs(ab[i].second - cd[0].second), ans = 0;
        for(ll j = 1;j < m;j++){
            if(t > abs(ab[i].first - cd[j].first) + abs(ab[i].second - cd[j].second)){
                t = abs(ab[i].first - cd[j].first) + abs(ab[i].second - cd[j].second);
                ans = j;
            }
        }
        cout << ans + 1 << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val k = readLine()!!.toLong()
 
    if (k % 2 == 0L) return println(-1)
 
    var rem = 0L
    var digit = 1L
    var answer = 0L
 
    repeat(k.toInt()) {
        rem += digit * 7
        rem %= k
        answer++
        if (rem == 0L) return println(answer)
        digit *= 10
        digit %= k
    }
 
    println(-1)
}

Measured memory_bytes: 34436
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fill(a)  memset(a, 0, sizeof (a))
#define ff first
#define ss second
#define pb push_back
typedef long double ld;
typedef vector<ll> vll;
const ll INF = 1e18;
const ld PI = 4*atan((ld)1);
const ll mod = 1e9+7;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll tt=1;
        // cin >> tt;
    while((tt)--){
        ll n;cin >> n;
        ll ans=0;
        repA(i,1,n){
            if(i%3!=0 and i%5!=0){
                ans +=i;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3616
#include<stdio.h>

int main()
{
	int i,j,cnt;
	char arr[10] = { 0 };

	while (scanf("%s", arr)!=EOF)
	{
		for (j = 0; j < 10; j++)
		{
			for (i = 0; i < 9-j; i++)
			{
				if (j == 0)
				{
					cnt = arr[i] - '0' + arr[i + 1] - '0';
				}
				else
				{
					cnt = arr[i]+ arr[i + 1];
				}
				if (cnt > 9)
				{
					cnt -= 10;
				}
				arr[i] = cnt;
			}
		}
		printf("%d\n",arr[0]);
	}


	return 0;
}


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

using LL = long long;

string solve() {
  LL N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  for(auto i = 0; i < N; ++i) {
    auto j = N-1 - i;
    if(C * j - D * i <= B-A && B-A <= D * j - C * i) return "YES";
  }
  return "NO";
}

int main() {
  cout << solve() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
        int n;
        bool ans=0;
        scanf("%d",&n);
        while(n>0){
            if(n%10==9) ans = true;
            n = n / 10;
        }
        if(ans) printf("Yes\n");
        else printf("No\n");
    }

Measured memory_bytes: 256
let N = Int(readLine()!)!
let S = readLine()!.characters
var e = 0
var w = S.reduce(0){$0+($1<"W" ?1:0)}
var ans = w
for c in S {
    c<"W" ?(w-=1):(e+=1)
    ans = min(e+w,ans)
}
print(ans)

Measured memory_bytes: 1280
# -*- coding: utf-8 -*-

import sys
import os
import math

N, K = map(int, input().split())

A = []
for i in range(N):
    a, b = map(int, input().split())
    A.append((a, b))

A.sort()

i = 0
cnt = 0
for a in A:
    v = a[0]
    num = a[1]
    cnt += num

    if cnt >= K:
        print(v)
        break

Measured memory_bytes: 16984
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n):
    for j in range(i,n):
        for k in range(j,n):
            if l[i]!=l[j] and l[j]!=l[k]:  
                if l[i]+l[j]>l[k]:
                    ans+=1
print(ans)

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


typedef long long ll;

using namespace std;


const ll mod=1000000000+7;


int num[1000001];


int main(){

    ll N;
    cin>>N;

    ll k=0;

    for(ll i=1;i<=N;i++){
        for(ll j=1;j*i<=N;j++){
            k=i*j;
            ++num[k];
        }
    }

    ll ans=0;

    for(ll i=0;i<N;i++){
        //cout<<num[i]<<endl;

        ans+=num[i];

    }

    cout<<ans<<endl;

}


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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> a(s.size());
  int ans = 0;
  for(int i = 0; i < n; i++){
    int count = 0;
    for(char c = 'a'; c <= 'z'; c++){
      bool left = false,right = false;
      for(int j = 0; j < i; j++){
        if(s[j] == c) left = true;
      }
      for(int j = i; j < n; j++){
        if(s[j] == c) right = true;
      }
      if(left && right) count++;
    }
    ans = max(ans,count);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,x=0;
    cin>>a>>b>>c;
 for(int i=a;i<b+1;i++)   {
     if(c%i==0){
         x+=1;
     }
 }
 cout<<x<<endl;
}


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

namespace AtTest.Exerwizerds2019
{
    class D
    {
        static long[] perms;

        static void Main(string[] args)
        {
            Method(args);
            ReadLine();
        }

        static void Method(string[] args)
        {
            int[] nx = ReadInts();
            long n = nx[0];
            long x = nx[1];
            long[] ss = ReadLongs();
            ss = ss.OrderBy(a => -a).ToArray();
            long mask = 1000000000 + 7;
            var dict = new Dictionary<long, long>();
            dict.Add(x, 1);
            for(int i = 0; i < n; i++)
            {
                var next = new Dictionary<long, long>();
                foreach (long key in dict.Keys)
                {
                    long nextKey = key % ss[i];
                    if (!next.ContainsKey(nextKey)) next.Add(nextKey, 0);
                    next[nextKey] += dict[key];
                    next[nextKey] %= mask;

                    if (!next.ContainsKey(key)) next.Add(key, 0);
                    next[key] += dict[key] * (n - 1 - i);
                    next[key] %= mask;
                }
                dict = next;
            }
            long res = 0;
            foreach(long key in dict.Keys)
            {
                if (key >= ss[n - 1]) continue;

                res += key * dict[key];
                res %= mask;
            }
            WriteLine(res);
        }

        static long Permutation(long n, long m, long mask)
        {
            long val = 1;
            for (long i = 0; i < m; i++)
            {
                val *= ((n - i) % mask);
                val %= mask;
            }
            return val;
        }

        private static string Read() { return ReadLine(); }
        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: 31160
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0 ; i < N ; i++) {
			A[i] = sc.nextInt();
		}
		Set<Integer> set = new HashSet<Integer>();
		for(int i = 0 ; i < N ; i++) {
			if(set.contains(A[i])) {
				set.remove(A[i]);
			} else {
				set.add(A[i]);
			}
		}
		System.out.println(set.size());
	}
}

Measured memory_bytes: 58088
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;



int main(void) {
  int n;
  cin >> n;
  string s ;
  cin >> s;
  string p = s;
  int paircnt = 0;
  vb paired(n,false);
  rep(i,n){
    rep2(j,i+1,n){
      if(s[i]=='(' && s[j]==')' && !paired[j]) {
        paircnt++;
        paired[j] = true;
        break;
        
        
        
      }
    }
  }
  int cnt = 0;
  rep(i,n){
    if(s[i]=='(')cnt++;
  }
  string a(n-cnt-paircnt,'(');
  string b(cnt-paircnt,')');
  cout << a+s+b << endl;
  
  
}




Measured memory_bytes: 256
#[allow(dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        mut h: u64,
    }
    // println!("dbg:: {:b}", h);
    let mut k: u64 = 0x0;
    while h > 0 {
        k <<= 1;
        k += 1;
        h >>= 1;
    // println!("    dbg:: h:{:b}, k:{:b}", h, k);
    }
    // println!("result dbg:: {:b}", k);
    println!("{}", k);
    // let mut vv = vec![0, 1];
    // for i in 2..(h +1) {
    //     let divided = i / 2;
    //     let k = 1 + 2 * vv[divided];
    //     vv.push(k);
    // }
    // println!("{}", vv[h]);
}


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

int main() {
	int h, w;
	while (true) {
		cin >> h >> w;
		if (h == 0 && w == 0) {
			return 0;
		}
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
}

Measured memory_bytes: 3052
from collections import deque


def bfs(maze, visited, sy, sx, gy, gx):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    while True:
        if len(queue) > 0:
            y, x = queue.popleft()
            if [y, x] == [gy, gx]:
                return visited[y][x]
            for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
                new_y, new_x = y+j, x+k
                if maze[new_y][new_x] == "." and visited[new_y][new_x] == -1:
                    visited[new_y][new_x] = visited[y][x] + 1
                    queue.append([new_y, new_x])
        else:
            return -1


H, W = map(int, input().split())
white = 0
s = ['#' * (W + 2)]
for i in range(H):
    s_i = '#' + input() + '#'
    white += s_i.count('.')
    s.append(s_i)
s.append('#' * (W + 2))

visited = [[-1] * (W+2) for i in range(H+2)]
shortest = bfs(s, visited, 1, 1, H, W)
if shortest > 0:
    print(white - shortest - 1)
else:
    print(-1)


Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

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

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

#define REP(i, n) for(int (i) = 0; (i) < (int)(n); (i)++)
#define REPR(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 1e9

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

typedef long long ll;

using namespace std;

int main(int argc, char const *argv[])
{
    ll ans = 0;

    int N, M;
    cin >> N >> M;
    vector<int> A(100001);
    vector<int> B(100001);
    fill(ALL(A), INF);
    fill(ALL(B), INF);
    REP(i, N) cin >> A[i] >> B[i];

    vector< pair<int, int> > p;

    REP(i, N) p.push_back(make_pair(A[i], B[i]));

    sort(ALL(p));
    
    int drinkcount = 0;
    REP(i, N)
    {
        REP(j, p[i].second)
        {
            ans += p[i].first;
            drinkcount++;
            if (drinkcount == M) break;
        }
        if (drinkcount == M) break;
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 2168
//****** @author mdazmat9 **********
#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define MP make_pair
#define EB emplace_back
#define endl "\n"
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll fast_pow(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

void solve() {
    string s,t;
    cin>>s>>t;
    cout<<t<<s;


}
int main()
{
    IOS;
    ll test=1;
   // cin>>test;
    while(test--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int N;
int memo[100010][3];
vector<int> v[3];
int sol(int pos,int prec){
  if(pos>=N)return 0;
  if(memo[pos][prec])return memo[pos][prec];
  int ma=0;
  for(int i=0;i<3;i++){
    if(i!=prec)ma=max(ma,sol(pos+1,i)+v[i][pos]);
  }
  return memo[pos][prec]=ma;
}
int main(){
		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
		//freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
    cin>>N;
    for(int i=0;i<N;i++){
      int a,b,c;
      cin>>a>>b>>c;
      v[0].push_back(a);
      v[1].push_back(b);
      v[2].push_back(c);
    }
    cout<<max({v[1][0]+sol(1,1),v[0][0]+sol(1,0),v[2][0]+sol(1,2)});
    return 0;
}

Measured memory_bytes: 7916
#include <bits/stdc++.h>
#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 all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef double D;
typedef complex<D> P;
D inf=1e50;
D dot(P x,P y){return real(x*conj(y));}
int N,T,R,n[100];
string st[100];
D t[100][1001];
P v[100][1001],p[100][1001];
D fi(D x){
	if(abs(x)<1e-9) return 0;
	return x;
}
typedef pair<D,D> Pdd;
vector<Pdd> segs[100][100];
void fix(vector<Pdd> vc){
	if(vc.empty()) return;
	sort(all(vc));
	vector<Pdd> ret;
	D l=vc[0].fs,r=vc[0].sc;
	for(Pdd p:vc){
		if(r<p.fs){
			ret.pb(Pdd(l,r));
			l=p.fs,r=p.sc;
		}else{
			chmax(r,p.sc);
		}
	}
	ret.pb(Pdd(l,r));
	vc=ret;
}
D fst(vector<Pdd> vc,D t){
	int N=vc.size();
	int id=lower_bound(all(vc),Pdd(t,0))-vc.begin()-1;
	if(id>=0&&vc[id].fs<t&&t<vc[id].sc) return t;
	id++;
	if(id==N) return inf;
	return vc[id].fs;
}
int main(){
	while(true){
		cin>>N>>T>>R;
		if(N==0) break;
		rep(i,N) rep(j,N) segs[i][j].clear();
		rep(i,N){
			cin>>st[i];
			int j=0;
			while(true){
				int vx,vy;
				cin>>t[i][j]>>vx>>vy;
				if(j==0) p[i][0]=P(vx,vy);
				else{
					v[i][j-1]=P(vx,vy);
					p[i][j]=p[i][j-1]+v[i][j-1]*(t[i][j]-t[i][j-1]);
				}
				if(t[i][j]==T) break;
				j++;
			}
			n[i]=j;
		}
		rep(a,N) rep(b,a){
			rep(i,n[a]) rep(j,n[b]){
				D tl=max(t[a][i],t[b][j]);
				D tr=min(t[a][i+1],t[b][j+1]);
				if(tl>tr) continue;
				P s=(p[a][i]-t[a][i]*v[a][i])-(p[b][j]-t[b][j]*v[b][j]),dv=v[a][i]-v[b][j];
				D A=fi(norm(dv));
				D B=2.0*dot(s,dv);
				D C=fi(norm(s)-R*R);
				if(A==0){
					// if(a==1&&b==0){
					// 	show(i);
					// 	show(j);
					// 	show(C);
					// 	show(p[a][i]);
					// 	show(p[b][j]);
					// 	show(v[a][i]);
					// 	show(v[b][j]);
					// }
					if(C<=0) segs[a][b].pb(Pdd(tl,tr));
					continue;
				}
				D det=B*B-4*A*C;
				if(det<0) continue;
				D x=(-B-sqrt(det))/2.0/A,y=(-B+sqrt(det))/2.0/A;
				chmax(tl,x);chmin(tr,y);
				if(tl<tr) segs[a][b].pb(Pdd(tl,tr));
			}
			fix(segs[a][b]);
			// if(a==1&&b==0){
			// 	for(Pdd p:segs[a][b]) printf("(%.1f,%.1f) ",p.fs,p.sc);
			// 	puts("");
			// }
			segs[b][a]=segs[a][b];
//			cout<<a<<","<<b<<"  ";
//			show(d[a][b]);
		}
		bool done[100]={};
		D d[100];
		rep(i,N) d[i]=inf;
		d[0]=0;
		rep(i,N){
			int mn=-1;
			rep(j,N) if(!done[j]&&(mn<0||d[j]<d[mn])) mn=j;
			if(mn<0||d[mn]==inf) break;
			done[mn]=1;
//			show(mn);
			rep(j,N) if(!done[j]){
				D x=fst(segs[mn][j],d[mn]);
				chmin(d[j],x);
			}
//			if(i==0) rep(j,N) show(d[j]);
		}
		vector<string> ans;
		rep(i,N) if(d[i]<T) ans.pb(st[i]);
		sort(all(ans));
		for(string s:ans) cout<<s<<endl;
	}
}

Measured memory_bytes: 4812
#include<bits/stdc++.h>
using namespace std;
int main()
{
      int a,b,x;
      scanf("%d %d %d",&a,&b,&x);
      if(a+b>=x&&a<=x)
      {
             printf("YES");
      }
      else
      {
             printf("NO");
      }
      return 0;
}

Measured memory_bytes: 256
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   

int main(){
    std::ios::sync_with_stdio(false);
    int n;
    //cin>>>n;
    //int n;
    cin>>n;
    int j,sumi=0,val,i,haha;
    if(n==3){
    	cout<<2<<" "<<5<<" "<<63<<endl;
    	return 0;
    }
    else if(n==4){
    	cout<<"2 5 20 63"<<endl;
    	return 0;
    }
    j=2;
    rep(i,n-2){
    	while(j%2!=0 && j%3!=0 && j%5!=0){
    		j++;
    	}
    	cout<<j<<" ";

    	sumi+=j;
    	j++;
    	sumi%=30;
    }

    haha=n-2;
    if((30-sumi)%3!=0){
    	val=(30-sumi)%3;
    	while(!(j%3==val && j%2==0)){
    		j++;
    	}
    	cout<<j<<" ";
    	
    	sumi+=j;
    	j++;
    	sumi%=30;
    	sumi=30-sumi;
    	sumi%=30;
    	while(j%30!=sumi){
    		j++;
    	}
    	cout<<j<<endl;
    }
    else{
    	sumi=30-sumi;
    	sumi%=30;
    	while(j%30!=sumi){
    		j++;
    	}
    	cout<<j<<" ";
    	j++;
    	while(j%30!=0){
    		j++;
    	}
    	cout<<j<<endl;

    }


    return 0;  
    
}



Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<cmath>

using namespace std;
using ll  = long long;
template <typename T> T In() {
    T t;
    cin >> t;
    return t;
}
template <typename T> vector<vector<T>> Vec2(int i, int j, T ini = 0) {
    vector<vector<T>> vec(i, vector<T>(i, ini));
    return move(vec);
}
template <typename T> vector<vector<vector<T>>> Vec3(int i, int j, int k, T ini = 0) {
    vector<vector<vector<T>>> vec(i, vector<vector<T>>(j, vector<T>(k, ini)));
    return move(vec);
}

int getKeta(int n){
    int ans = 1;
    while(n >= 10) {
        n /= 10;
        ans++;
    }
    return ans;
}
int main() { 
    int N = In<int>();
    int ans = 0;
    for(int n = 1; n <= N; n++){
        if(getKeta(n)%2==1)
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC142A
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            Console.WriteLine(Enumerable.Range(1, N).Count(x => x % 2 != 0) / (double)N);
        }
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2500;
ll dp[55][5005];
int n,m,x,y;
int main()
{
	cin>>n>>m;
	dp[0][2500]=1;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		y=x-m;
		for(int j=0;j<=5000;j++)
		{
			dp[i][j]+=dp[i-1][j];
			if(j+y<0||j+y>5000)continue;
			dp[i][j+y]+=dp[i-1][j];
		}
	}
	cout<<dp[n][2500]-1<<endl;
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
	int H, W; cin >> H >> W;
	vector<string> S(H);
	for(int i = 0; i < H; i++) cin >> S[i];
	vector<vector<int>> mapping(H, vector<int>(W));
	for(int i = 0; i < H; i++) {
		int start = 0, goal = 0;
		for(int j = 0; j < W; j++) {
			if(S[i][j] == '#') {
				for(int k = start; k < goal; k++) mapping[i][k] += goal - start;
				start = j + 1; goal = j + 1;
				continue;
			}
			goal++;
			if(j == W - 1) {
				for(int k = start; k < goal; k++) mapping[i][k] += goal - start;
			}
		}
	}
	for(int j = 0; j < W; j++) {
		int start = 0, goal = 0;
		for(int i = 0; i < H; i++) {
			if(S[i][j] == '#') {
				for(int k = start; k < goal; k++) mapping[k][j] += goal - start;
				start = i + 1; goal = i + 1;
				continue;
			}
			goal++;
			if(i == H - 1) {
				for(int k = start; k < goal; k++) mapping[k][j] += goal - start;
			}
		}
	}
	int ans = 0;
	for(int i = 0; i < H; i++) for(int j = 0; j < W; j++) ans = max(ans, mapping[i][j]);
	/*for(int i = 0; i < H; i++) {
		for(int j = 0; j < W; j++) {
			cout << mapping[i][j] << " ";
		}
		cout << endl;
	}*/
	ans--;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 26496
MOD = 998244353
MOD_t_MAX = 2 * (10**5) + 100
fac  = [None] * MOD_t_MAX
finv = [None] * MOD_t_MAX
inv  = [None] * MOD_t_MAX
def MOD_COM_init():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MOD_t_MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
def MOD_COM(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
def main():
    n, m, k = map(int, input().split())
    MOD_COM_init()
    lim = n-1-k
#    print(lim)
    ans = 0
    for i in range(lim, n):
        x = m * pow(m-1, i, MOD)
        y = MOD_COM(n-1, i)
        z = x*y % MOD
        ans += z
        ans %= MOD
#        print(i, ans)
    print(ans % MOD)

if __name__ == "__main__":
    main()

Measured memory_bytes: 32632
import java.io.*;
import java.util.*;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        char[] S = new char[500000];
        int n = in.read(S);

        long ans = 0;
        char c = S[0];
        long up = 0;
        long down = 0;
        for (int i = 0; i < n; i++) {
            if (S[i] == '<') {
                if (S[i] == c) {
                    up++;
                } else {
                    ans += Math.max(up, down) + up * (up - 1) / 2 + down * (down - 1) / 2;
                    up = 1;
                    down = 0;
                }
            } else {
                down++;
            }
            c = S[i];
        }

        ans += Math.max(up, down) + up * (up - 1) / 2 + down * (down - 1) / 2;

        System.out.println(ans);
    }
}


class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
}


Measured memory_bytes: 36264
#include<bits/stdc++.h>
using namespace std;
const int N = 500005;
int seg[4 * N];
int query(int idx, int start, int end, int l, int r)
{
	if (start > end || start > r || end < l)
		return 0;
	if (start >= l && end <= r)
		return seg[idx];
	else
	{
		int mid = (start + end) / 2;
		int x = query(2 * idx + 1, start, mid, l, r);
		int y = query(2 * idx + 2, mid + 1, end, l, r);
		return (x | y);
	}
}
void upd(int idx, int start, int end, int id, int v)
{
	if (start > end || start > id || end < id)
		return;
	else if (start == end)
		seg[idx] = (1 << v);
	else
	{
		int mid = (start + end) / 2;
		upd(2 * idx + 1, start, mid, id, v);
		upd(2 * idx + 2, mid + 1, end, id, v);
		seg[idx] = (seg[2 * idx + 1] | seg[2 * idx + 2]);
	}
}
int main(int argc, char const *argv[])
{
	int n, q;
	string s;
	cin >> n;
	cin >> s;
	for (int i = 0; i < n; ++i)
	{
		upd(0, 0, n - 1, i, s[i] - 'a');
	}
	cin >> q;
	while (q --)
	{
		int t;
		cin >> t;
		if (t == 1)
		{
			int id;
			char v;
			cin >> id >> v;
			id --;
			upd(0, 0, n - 1, id, v - 'a');
		}
		else
		{
			int l, r, ans = 0;
			cin >> l >> r;
			l --;
			r --;
			int val = query(0, 0, n - 1, l, r);
			while (val)
			{
				ans += (val & 1);
				val >>= 1;
			}
			cout << ans << '\n';

		}
	}
	return 0;
}

Measured memory_bytes: 7980
#include <iostream>
#define NIL -1

using namespace std;

struct tree{
  int l;
  int r;
  int p;
};

  tree t[10000];

void preorder(int now){
  if(now == NIL) return;
  cout << " " << now;
   preorder(t[now].l);
   preorder(t[now].r);
}

void inorder(int now){
  if(now == NIL) return;
  inorder(t[now].l);
  cout << " " << now;
  inorder(t[now].r);
}

void postorder(int now){
  if(now == NIL) return;
  postorder(t[now].l);
  postorder(t[now].r);
  cout << " " << now;
}
int main(){

  int n,e,l,r,root;
  cin >> n;
  for(int i = 0;i < n;i++)t[i].p = NIL;
  for(int i = 0;i < n;i++){
    cin >> e;
    cin >> t[e].l >> t[e].r;
    l = t[e].l;
    r = t[e].r;
    t[l].p = e;
    t[r].p = e;
  }

for(int i = 0;i < n;i++) if(t[i].p == NIL) root = i;

cout << "Preorder" << endl;
preorder(root);
cout << endl;

cout << "Inorder" << endl;
inorder(root);
cout << endl;

cout << "Postorder" << endl;
postorder(root);
cout << endl;



}

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

char s[205];
int n,k,ans,ans1[105],a[105],loop;

int main()
{
	scanf("%s%d",&s,&k);
	n=strlen(s);
	int cur=0;
	for(int i=1;i<n;++i) if(s[i]==s[i-1]&&a[i-1]==0) a[i]=-1,cur++;else a[i]=0;
	ans+=cur;++loop;ans1[loop]=ans1[loop-1]+cur;
//	printf("%d %d %d\n",ans,ans1[loop],loop);
	bool flag=0;
	while(!(a[n-1]==-1||s[0]!=s[n-1])&&loop<k)
	{
		flag=1;
		if(!a[0]) flag=0;
		a[0]=-1;
		cur=1;
		for(int i=1;i<n;++i)
		{
			if(s[i]==s[i-1]&&a[i-1]==0)
			{
				if(!a[i]) flag=0;
				a[i]=-1,cur++;
			}
			else
			{
				if(a[i]==-1) flag=0;
				a[i]=0;
			}
		}
		if(flag)
			break;
		++loop;ans1[loop]=ans1[loop-1]+cur;
		ans+=cur; 
	}
	if(!flag) printf("%lld",(long long)ans*(k/loop)+(long long)ans1[k%loop]);
	else printf("%lld",(long long)(ans1[loop]-ans1[loop-1])*(k-loop)+ans);
}


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

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

using namespace std;

typedef long long ll;

bool is_prime(long long int x) {
  for (long long int i = 2; i*i <= x; i++) {
    if (x % i == 0) { return false; }
  }
  return x != 1;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;

  int x; cin >> x;
  for (int i = x; i < x*10; i++) {
    if (is_prime(i)) {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int X;
    cin >> X;
    int tens;
    int ones;
    int count;
    tens = X % 100;
    ones = X % 10;
    count = (tens - ones) / 5;
    if (ones == 0) {
        count = count + 0;
    } else if (ones <= 5 && ones != 0) {
        count =  count + 1;
    } else if (ones <= 9) {
        count =  count + 2;
    } else {
    }
    if (count * 100 + tens <= X || X >= 2000) {
        cout << "1 \n";
    } else {
        cout << "0 \n";
    }
}

Measured memory_bytes: 888
#include <iostream>
#include <bits/stdc++.h>
#define PB push_back
#define INF 1e9+5;
#define F(i,a,b)  for(i=a;i<b;i++)
#define FE(i,a,b)  for(i=a;i<=b;i++)
#define FR(i,a,b) for(i=a;i>b;i--)
#define LL long long
#define MAX(a,b) (a<b?b:a)
#define ABS(x) (x<0?(-x):x)
#define ALL(c) (c).begin(),(c).end()
#define WATCH(x) cout << (#x) << " is " << (x) << endl
#define vi vector<int>
#define vs vector<string>
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
using namespace std;
string ConvertToBin(LL s)
{
    string res = "";
    while(s != 0) {
        res += (char)('0' + s % 2);
        s /= 2;
    }
    reverse(res.begin() , res.end());
    return res;
}

void PrintVec(vector<int> &v)
{
    for(vector<int>::iterator it = v.begin() ; it != v.end(); ++it)
    cout<<*it<<" ";
}

vector<int> Populate(vector<int> &v,int n)
{
    int num;
    for(int i=0;i<n;i++)
    {
        cin>>num;
        v.push_back(num);
    }
    return(v);
}

int sumofdigits(int n)
{
    int sm=0;
    while(n)
    {
        sm=sm+(n-(n/10)*10);
         n=n/10;
    }
    return(sm);
}

bool isprime(int n)
{
    int i=0;
    FE(i,2,sqrt(n))
    {
        if(n%i==0)
        return(false);
    }
    return(true);
}

int fun(string s1,string s2,int l1,int l2)
{
    if(l1<0 || l2<0)
    return(0);
    if(s1[l1]==s2[l2])
    {
    return(1+fun(s1,s2,l1-1,l2-1));
    cout<<s1[l1];
    }
    else
    return(max(fun(s1,s2,l1,l2-1),fun(s1,s2,l1-1,l2)));
}




/*--------------------------time to code-------------------------------*/



int main()
{
    string s1,s2;
    cin>>s1>>s2;
    int l1=s1.size();
    int l2=s2.size();
    int dp[l1+1][l2+1];
    for(int i=0;i<=l1;i++)
    {
        for(int j=0;j<=l2;j++)
        {
            if(i==0 || j==0)
            dp[i][j]=0;
            else if(s1[i-1]==s2[j-1])
            dp[i][j]=1+dp[i-1][j-1];
            else
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    vector<char> vc;
    while(l1>0 && l2>0)
    {
        if(s1[l1-1]==s2[l2-1])
        {
            vc.push_back(s1[l1-1]);
            l1--;
            l2--;
        }
        else
        {
            if(dp[l1-1][l2]>dp[l1][l2-1])
            l1--;
            else
            l2--;
        }
    }
    reverse(vc.begin(),vc.end());
    for(char c : vc)
    cout<<c;
    cout<<endl;
    //cout<<fun(s1,s2,l1-1,l2-1)<<endl;
    return(0);
}









Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,i,ans=0;
  cin>>n;
  vector<int> p(n);
  for(i=0;i<n;i++) cin>>p.at(i);
  for(i=1;i<n-1;i++) if((p.at(i+1)-p.at(i))*(p.at(i-1)-p.at(i))<0) ans++;
  cout<<ans<<endl;
}

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

int gcd(int a, int b, int step);

int main()
{
	int a, b;

	while (cin >> a >> b, a){
		int step = 0;
		gcd(a, b, step);
	}

	return (0);
}

int gcd(int a, int b, int step)
{
	if (b == 0){
		cout << a << " " << step << endl;
	}
	else if (a < b){
		return (gcd(a, b % a, step + 1));
	}
	else {
		return (gcd(b, a % b, step + 1));
	}
}

Measured memory_bytes: 1160
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
def ddprint(x):
  if DBG:
    print(x)

n = inn()
a = inl()
b = [0]*n
m = n//2
sum = 0
for i in range(m):
    sum += a[2*i]-a[2*i+1]
b[0] = sum + a[2*m]
for i in range(1,n):
    b[i] = 2*a[i-1]-b[i-1]
for i in range(n):
    printn("{} ".format(b[i]))
print('')


Measured memory_bytes: 63984
# AOJ 0594: Super Metropolis
# Python3 2018.6.30 bal4u

def shortpath(xs, ys, xe, ye):
	if (xe >= xs and ye <= ys) or (xe <= xs and ye >= ys):
		return abs(xe-xs)+abs(ye-ys)
	return max(abs(xe-xs), abs(ye-ys)) 

w, h, n = map(int, input().split())
x1, y1 = map(int, input().split())
ans = 0
for i in range(1, n):
	x2, y2 = map(int, input().split())
	ans += shortpath(x1, y1, x2, y2)
	x1, y1 = x2, y2
print(ans)


Measured memory_bytes: 5608
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (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; }


int main() {
    int H, W; cin >> H >> W;
    vector<vector<char>> grid(H, vector<char>(W));
    rep(i, H){
        string s; cin >> s;
        rep(j, W){
            grid[i][j] = s[j];
        }
    }

    rep(i, H){
        bool fg = true;
        rep(j, W){
            if(grid[i][j] == '#') fg = false;
        }
        if(fg){
            rep(j, W) grid[i][j] = 'x';
        }
    }

    rep(j, W){
        bool fg = true;
        rep(i, H){
            if(grid[i][j] == '#') fg = false;
        }
        if(fg){
            rep(i, H) grid[i][j] = 'x';
        }
    }
    rep(i, H){
        bool fg = false;
        rep(j, W){
            char c = grid[i][j];
            if(c != 'x') fg = true, cout << c;
        }
        if(fg)cout << ln;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int m,d;
int main()
{
    cin >> m >> d;
    int answ = 0,pd;
    for(int i = 1;i<=m;i++)
    {
        for(int j = 1;j<=d;j++)
        {
            if(j%10 >=2 and (j/10)>=2)
            {
                if((j%10)*(j/10) == i) answ ++;
            }
        }
    }
    cout << answ ;
    return 0;
}


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

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<double> a(n), pre;
    pre.PB(0);
    for(auto &x : a){
        cin >> x;
        x = (x + 1.0) / 2.0;
        pre.PB(pre.back() + x);
    }
    debug(pre);
    double ans = 0.0;
    for(int i = k; i <= n; i++){
        ans = max(ans, pre[i] - pre[i - k]);
    }
    cout << fixed << setprecision(10) << ans;
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 5104
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
ans=1
for i in range(n):
    t=int(input())
    ans=(ans*t)//fractions.gcd(ans,t)
print(ans)

Measured memory_bytes: 5460
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; cin >> N; 
	int A[100010] = {}; 
	int ans = 0; int pos = 0; int neg = 0; int zero = 0; 
	vector<int> P; vector<int> M; 
	for(int i = 0; i < N; i++){
		cin >> A[i]; 
		ans += abs(A[i]); 
		if(A[i] > 0) {pos ++; P.push_back(A[i]);}
		if(A[i] < 0) {neg ++; M.push_back(A[i]);}
		if(A[i] == 0) {zero ++; P.push_back(A[i]);}
	}
	sort(A, A+N); 
	if(zero == 0 && pos == 0) ans += 2 * A[N-1]; 
	if(zero == 0 && neg == 0) ans -= 2 * A[0]; 
	cout << ans << endl; 
	if(zero == 0 && pos == 0){
	    int tmp = A[N-1]; 
	    for(int i = N-2; i >= 0; i--){
	        cout << tmp << " " << A[i] << endl; 
	        tmp = tmp - A[i]; 
	    }
	}
	else if(zero == 0 && neg == 0){
	    int tmp = A[0]; 
	    for(int i = 1; i < N-1; i++){
	        cout << tmp << " " << A[i] << endl; 
	        tmp = tmp - A[i]; 
	    }
	    cout << A[N-1] << " " << tmp << endl;
	}
	else if(pos+zero > neg && neg > 0){
	    cout << M[0] << " " << P[0] << endl; 
	    for(int i = 1; i < neg; i++){
	        cout << P[i] << " " << M[i] << endl; 
	    }
	    int tmp = M[0] - P[0]; 
	    for(int i = 1; i < neg; i++){
	        cout << tmp << " " << P[i] - M[i] << endl;
	        tmp = tmp - P[i] + M[i]; 
	    }
	    for(int i = neg; i < pos+zero-1; i++){
	        cout << tmp << " " << P[i] << endl; 
	        tmp = tmp - P[i]; 
	    }
	    cout << P[pos+zero-1] << " " << tmp << endl;
	}
	else if(pos+zero < neg){
	    cout << P[0] << " " << M[0] << endl; 
	    for(int i = 1; i < pos+zero; i++){
	        cout << M[i] << " " << P[i] << endl; 
	    }
	    int tmp = P[0] - M[0]; 
	    for(int i = 1; i < pos+zero; i++){
	        cout << tmp << " " << M[i] - P[i] << endl;
	        tmp = tmp - M[i] + P[i]; 
	    }
	    for(int i = pos+zero; i < neg; i++){
	        cout << tmp << " " << M[i] << endl; 
	        tmp = tmp - M[i]; 
	    }
	}
	else if(pos+zero == neg){
	    cout << M[0] << " " << P[0] << endl; 
	    for(int i = 1; i < neg; i++){
	        cout << P[i] << " " << M[i] << endl; 
	    }
	    int tmp = M[0] - P[0]; 
	    for(int i = 1; i < neg-1; i++){
	        cout << tmp << " " << P[i] - M[i] << endl;
	        tmp = tmp - P[i] + M[i];
	    }
	    cout << P[pos+zero-1] - M[pos+zero-1] << " " << tmp << endl;
	}
	else if(neg == 0){
	    int tmp = A[0]; 
	    for(int i = 1; i < N-1; i++){
	        cout << tmp << " " << A[i] << endl; 
	        tmp = tmp - A[i]; 
	    }
	    cout << A[N-1] << " " << tmp << endl;
	}
}

Measured memory_bytes: 2808
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

#define REP(i,n)    for(int i = 0; i < (int)(n); i++)
typedef long long ll;
ll ans = 0;
string s;

ll kurisage(ll x, ll i) {
    return x - (s[i] - '0') * pow(10, s.length() - i - 1);
}

ll kuriage(ll x, ll i) {
    return x * 10 + (s[i] - '0');
}

void dfs(ll i, ll l, ll r, ll sum) {
    if(i > s.length() - 2)   return;
    r = kurisage(r, i);
    l = kuriage(l, i);
    dfs(i + 1, l, r, sum);
    ans += sum + l + r;
    dfs(i + 1, 0, r, sum + l);
}

int main() {
    cin >> s;
    ans += stol(s);
    if(s.length() == 1){
        cout << ans << endl;
        return 0;
    }
    dfs(0, 0, stol(s), 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384