akhauriyash/Code-Regression huggingface dataset:
/*
 *  Created on: 22 / 4 / 2020
 *  Author:     Eslam Waheed
 */
#include <bits/stdc++.h>
using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define __USE_MINGW_ANSI_STDIO
#define Eslam__Waheed ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

#define ll   long long
#define ull  unsigned ll
#define dd   double
#define ld   long dd
#define ss   string

#define pb      push_back
#define all(c)  c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define stp(n)  cout << fixed << setprecision(n)
#define iq(v)   v.resize(unique(v.begin(),v.end())-v.begin())
#define sz(s)   (ll)(s.size())
#define endl    '\n'

#define loop(i,m,n)  for(ll i=m;i<n;i++)

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

//const ll mod = 1e9 + 7;
//__int128
/*
 you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )
*/
int main()
{
    stp(20);
    Eslam__Waheed
        ll n; cin >> n;
    map<ll, ll>mp;
    loop(i, 0, n - 1)
    {
        ll a; cin >> a;
        mp[a]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (mp[i])
        {
            cout << mp[i] << endl;
        }
        else
        {
            cout << 0 << endl;
        }
    }
}

Measured memory_bytes: 16148
import sys
 
def main():
  input = sys.stdin.readline
  S = str(input().strip())
  T = str(input().strip())
  
  C1, C2 = [], []
  ans = 'Yes'
  S2T = dict()
  T2S = dict()
  for c1, c2 in zip(S, T):
    if (c1 in S2T) and (c2 in T2S):
      if not((S2T[c1] == c2) and (T2S[c2] == c1)):
        ans = 'No'
        break
    elif (c1 not in S2T) and (c2 not in T2S):
      S2T[c1] = c2
      T2S[c2] = c1
    else:
      ans = 'No'
      break
  print(ans)
 
 
if __name__ == '__main__':
  main()

Measured memory_bytes: 3632
a, b, c, x, y = list(map(int, input().split()))
ans = []
ans.append(a*x+b*y)
if(x>y):
    ans.append(c*2*x)
    ans.append(c*2*y+a*(x-y))
else:
    ans.append(c*2*y)
    ans.append(c*2*x+b*(y-x))
print(min(ans))

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    while (true) {
		    String line = br.readLine();
		    int x = Integer.parseInt(line.split(" ")[0]);
		    int y = Integer.parseInt(line.split(" ")[1]);

		    if (x == 0 && y == 0) break;

		    System.out.println(x < y ? x + " " + y : y + " " + x);
	    }
	}
}

Measured memory_bytes: 27856
pub struct Scanner {
    line: Vec<String>,
    idx: usize,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        return Scanner {
            line: vec![],
            idx: 0,
        };
    }
    fn next<T: std::str::FromStr>(&mut self) -> T {
        if self.idx == self.line.len() {
            let mut buffer = String::new();
            std::io::stdin().read_line(&mut buffer).ok();
            let a: Vec<&str> = buffer.trim().split(' ').collect();
            self.line = a.iter().map(|&s| String::from(s)).collect();
            self.idx = 0;
        }
        let ret: T = self.line[self.idx].parse::<T>().ok().expect("Parse error.");
        self.idx += 1;
        ret
    }
    fn next_string(&mut self) -> Vec<char> {
        let s: String = self.next();
        return s.chars().collect::<Vec<char>>();
    }
    fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        let mut v: Vec<T> = Vec::with_capacity(n);
        for _i in 0..n {
            v.push(self.next());
        }
        v
    }
}

fn main(){
    let mut scan = Scanner::new();
    let n: usize = scan.next();
    let a: Vec<usize> = scan.next_vec(n - 1);
    let mut c: Vec<i32> = vec![0; n];

    for x in a{
        c[x-1] += 1;
    }

    for x in c {
        println!("{}", x);
    }
}


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

int main(){
    string str, op, tmp;
    int q, a, b;
    
    cin >> str >> q;
    for(int i = 1; i <= q; i++){
        cin >> op;
        if(op == "replace") {
            cin >> a >> b >> tmp;
            str.replace(a, tmp.size(), tmp);
        }
        else if(op == "reverse") {
            cin >> a >> b;
            while(a < b){
                swap(str[a], str[b]);
                a++;
                b--;
            }
        }
        else if(op == "print") {
            cin >> a >> b;
            tmp = str.substr(a, b - a + 1);
            cout << tmp << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3208
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val n = in.readLine().toInt

    val as = Array.ofDim[Int](n)
    for((a, i) <- in.readLine().split("\\s+").map(_.toInt - 1).zipWithIndex) {
      as(i + 1) = a
    }

    val subs = Array.ofDim[Int](n)

    for(i <- 1 until n) {
      subs(as(i)) += 1
    }

    for(sub <- subs) {
      out.println(sub)
    }

    out.flush()
  }
}


Measured memory_bytes: 80176
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>

#include <random>
#define all(x) (x).begin(), (x).end()


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

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

void precalc() {}
template <typename T>
void do_uniq(vector<T> vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#define solvsh
//#define multi
#ifdef solvsh


const int MAXN = 1e5 + 29;

void solve() {
    ll a, b, c;
    cin >> a >> b >> c;
    if (c - a - b < 0){
        cout << "No";
        return;
    }

    if (4 * a * b < (c - a - b) * (c - a- b)){
        cout << "Yes";
    } else {
        cout << "No";
    }


}

#else
const int MAXN = 2 *  50005;

const int h = 7;

int dp[h][h][h][h];

void solve() {



}
#endif

void multisolve() {
    int t;
    cin >> t;

    while (t--)
        solve();
}

void gen(){
    cout << "100000 99999\n";

    for (int i = 0; i < 99999; ++i) {
        cout << 1 << " " << 2 + i << "\n";
    }
}

#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

#ifdef multi
    multisolve();
#else
    precalc();
    solve();
//    gen();
#endif

#ifdef LOCAL
    //cout << '\n' << (double)clock() / CLOCKS_PER_SEC << '\n';
#endif
}

Measured memory_bytes: 256
#include<stdio.h>
int cmp(const void *a,const void *b)
{
    return *(int*)a - *(int*)b;
}
int main(void)
{
    int a[3],i;
    for(i=0;i<3;i++){
        scanf("%d",&a[i]);
    }
    qsort(a,3,sizeof(int),cmp);
    printf("%d",a[2]*10+a[1]+a[0]);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int a[100000];
int main(void){
    int n,i,ans=0;
    int h[100000];
    cin >> n;
    for(i=0;i<n;i++) cin >> h[i];
    for(i=1;i<n;i++){
        if(h[i-1]>=h[i]) a[i] = a[i-1]+1;
        else{
            a[i]=0;
            ans = max(ans,a[i-1]);
        }
    }
    ans = max(ans,a[n-1]);
    cout << ans << endl;
}

Measured memory_bytes: 1024
import scala.io.StdIn._
object Main{
  def main(args:Array[String]){
    val N = readInt
    val a = readLine.split(' ').map(x=>x.toInt).sorted.reverse
    val sum = a.sum
    var x = 0;
    for(i <- 0 until N if i%2==0){
      x += a(i)
    }
    val y = sum - x
    println(x-y)
  }
}


Measured memory_bytes: 25664
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
 
long long int INF = 2e18;
const ll fact_table = 3200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define endl "\n"
#ifdef ENJAPMA
    #undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

const ll mod = 998244353ll;
// const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll mod){ll x=1;while(b){while(!(b&1)){(a*=a)%=mod;b>>=1;}(x*=a)%=mod;b--;}return x;}
void YES(bool cond){ if(cond){ p("YES");}else{ p("NO");} return;}
void Yes(bool cond){ if(cond){ p("Yes");}else{ p("No");} return;}

/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/

bool multicase = false;

ll n,m,num,a,b,c,d,e,h,q;
ll w, k, ans;

ll x[500005];
string s;

void solve(){
    ll h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    ll time1 = 60 * h1 + m1;
    ll time2 = 60 * h2 + m2;
    ll ans = time2 - time1 - k;
    if(ans < 0)ans = 0;
    p(ans);
    return;
}


int main(){
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if(multicase){
        cin >> q;
    }else{
        q = 1; 
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}
















Measured memory_bytes: 3612
N = int(input())
A = [int(i) for i in input().split()]
A.sort()

from itertools import accumulate

Acum = list(accumulate(A))

cnt = [1] * N
for i in range(N-1):
    if Acum[i] * 2 >= A[i+1]:
        cnt[i+1] += cnt[i]

print(cnt[-1])

Measured memory_bytes: 15788
#include <iostream>
using namespace std;
int main(){
    int N,x;
    cin >> N;
    x=0;
    if(N/10==0)
        x=N;
    if(N/10!=0&&N/100==0)
        x=9;
    if(N/100!=0&&N/1000==0)
        x=9+N-100+1;
    if(N/1000!=0&&N/10000==0)
        x=9+999-100+1;
    if(N/10000!=0&&N/100000==0)
        x=9+999-100+1+N-10000+1;
    if(N/100000!=0)
        x=9+999-100+1+99999-10000+1;

    cout << x;
    return 0;
}

Measured memory_bytes: 256
import java.util.*
import java.math.*

fun main(args: Array<String>) {

//    var N = readLine()!!.split(" ").map { it.toInt() }
    var N = readLine()!!.toInt()
//    val D = readLine()!!.split(" ").map { it.toLong() }
    val A = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    val mod = 1000000007L

    A.sort()
    var sum = 0
    var ans = mutableListOf<String>()

    if (N == 2) {
        var max = Math.max(A[0], A[1])
        var min = Math.min(A[0], A[1])
        println(max-min)
        println("${max} $min")
        return
    }


    if(A[0] > 0 && A[N-1] > 0) {

        var tmp = A[0] -A[1]

        ans.add("${A[0]} ${A[1]}")

        for (i in  2 until N-1){
            ans.add("${tmp} ${A[i]}")
            tmp -= A[i]
        }
        ans.add("${A[N-1]} ${tmp}")
        sum = A[N-1] - tmp

    }else if(A[0] < 0 && A[N-1] < 0) {
        var tmp = A[N-1] -A[N-2]
        ans.add("${A[N-1]} ${A[N-2]}")

        for (i in  2 until N){
            ans.add("${tmp} ${A[N-1-i]} ")
            tmp -= A[N-1-i]
        }
        sum = tmp

    }
    else{
        var f = A.first()
        var l = A.last()

        for (i in 1 until N - 1) {
            var a = A[i]
            if (a > 0) {
                ans.add("${f} ${a}")
                f -= a
            } else {
                ans.add("${l} ${a}")
                l -= a
            }
        }
        ans.add("${l} ${f}")
        sum = l - f
    }
    println(sum)
    println(ans.joinToString("\n"))

//    println("%.9f".format(ans))
}


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

#define NMAX 2e9

using namespace std;

int main()
{
    vector<int> v, dist;
    int n, k;
    cin>>n>>k;
    v.resize(n + 1);
    dist.resize(n + 1);

    for(int i = 1 ; i <= n ; i++){
        cin>>v[i];
    }

    dist[1] = 0;

    for(int i = 2 ; i <= n ; i++){
        dist[i] = NMAX;
        for(int j = 1 ; j <= k && i - j > 0 ; j++){
            dist[i] = min(dist[i], dist[i - j] + abs(v[i] - v[i - j]));
        }
    }
    cout<<dist[n];

    return 0;
}



Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;
const int mod= 1e+9+7;

int main() {
    int n;cin>>n;
    vector<string>s(n);
    vector<int>l(n);
    rep(i,n){
        cin>>s[i];
        l[i]=s[i].size();
    }
    int cnt;
    int mn;
    string ans;
    for(char c='a';c<='z';c++){
        mn=10100;
        rep(i,n){
            cnt=0;
            rep(j,l[i]){
                if(s[i][j]==c){
                    cnt++;
                }
            }
            mn =min(cnt,mn);
        }
            rep(i,mn){
            ans+=c;
        }
    }
    sort(ans.begin(),ans.end());
    cout<<ans<<endl;
}

Measured memory_bytes: 256
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){
  CIN(n);
  if(!n)EN(0);
  V v;
  while(n){
    v.pb((n%-2)!=0);
    if(n%2)
      --n;
    n/=-2;
  }
  REPR(i,v.size()-1)
    cout<<v[i];ENDL;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - ID
            var line = ReadLine();
            int n = line[0];
            int m = line[1];
            
            //市の情報(県の番号,誕生年)を取得
            var cities = GetCities(m).ToList();
            
            //結果の出力順を保持
            var dic = GetOutputOrder(cities);
            var result = new string[m];
            
            //市を誕生年でソート後、県の番号でグループ化
            var query = cities.OrderBy(x => x.Year).GroupBy(x => x.Pref);
            
            foreach(var group in query)
            {
                int i = 1;
                
                foreach(var city in group)
                {
                    string prefId = GetId(city.Pref);
                    string yearId = GetId(i);
                    string id= prefId + yearId;
                    
                    int index = dic[city.Year];
                    result[index] = id;
                    i++;
                }    
            }
            
            foreach(string s in result)
            {
                Console.WriteLine(s);    
            }
        }
        
        static Dictionary<int, int> GetOutputOrder(List<City> cities)
        {
            var dic = new Dictionary<int, int>();
            int i = 0;
            
            foreach(var city in cities)
            {
                dic.Add(city.Year, i);
                i++;
            } 
            
            return dic;
        }
        
        static string GetId(int num)
        {
            return num.ToString().PadLeft(6, '0');    
        }
        
        static IEnumerable<City> GetCities(int m)
        {
            for(int i = 0; i < m; i++)
            {
                var line = ReadLine();
                var city = new City(line[0], line[1]);
                yield return city;
            }
        }
        
        static List<int> ReadLine()
        {
            var line = Console.ReadLine().TrimEnd();
            var array = line.Split(' ');
            var numbers = new List<int>();
            
            foreach(var s in array)
            {
                int num = int.Parse(s);
                numbers.Add(num);
            }

            return numbers;
        }
    }
    
    class City
    {
        public int Pref { set; get; }
        public int Year { set; get; }
        public string Id { set; get; }
        
        public City(int pref, int year)
        {
            Pref = pref;
            Year = year;
        }
    }
}

Measured memory_bytes: 43600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<"@"<<__LINE__<<": "<<x<<endl
using ll = long long;
using vi = vector<int>;
using pii = pair<int,int>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<ll> a(n);
    ll tot=0;
    rep(i,0,n) {
        cin >> a[i];
        tot+=a[i];
    }
    ll left=0;
    ll ans=LLONG_MAX;
    rep(i,0,n-1) {
        left+=a[i];
        ans=min(ans,abs(left-(tot-left)));
    }
    cout<<ans<<endl;
}


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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;

int n;
string s;

string bt[] = {".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
int ln[] = {5, 3, 3, 3, 3, 3, 4, 3, 4};

int main()
{
  cin >> n;

  while(n--){
    cin >> s;
    int ptr = 0;
    while(ptr < s.size()){
      int cnt = 0;
      while(ptr < s.size() && s[ptr] == '0') ptr += 1;
      if(ptr >= s.size()) break;
      while(ptr < s.size() - 1 && s[ptr] == s[ptr + 1]){
        cnt += 1;
        ptr += 1;
      }
      if(ptr >= s.size()) break;
      cout << bt[s[ptr]-'0'-1][cnt % (ln[s[ptr]-'0'-1])];
      if(ptr >= s.size()) break;
      ptr += 1;
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1212
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
#include<bitset>

using namespace std;



int main(){
  int n; cin>>n;

  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      if(n==i*j) {cout<<"Yes"<<endl; return 0;}
    }
  }
  cout<<"No"<<endl;
}


Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
    return divisors

def F(A, B):
    return max(len(list(map(int, str(A)))), len(list(map(int, str(B)))))

N = int(input())
divs = make_divisors(N)
ans = 10**10
for A in divs:
    B = N//A
    ans = min(ans, F(A, B))
print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define UNIQUE(Kanna) Kanna.erase(unique(Kanna.begin(),Kanna.end()),Kanna.end());
#define inf (1000000000)
#define linf (1000000000000000000ll)
#define mod (1000000007)

int n;
int a[111111];

int I_Love_Hashimoto_Kanna() {
	//完全想清楚了再开始写。
	//写不顺、不知道怎么写、很乱的时候，停下来好好想想。
	//做得慢总比做不出好。
	fastio;
	n=read();
	FOR(i,0,n){
		a[i]=read();
	}
	a[0]--;
	FOR(i,1,n){
		if(a[i]>a[i-1]){
			a[i]--;
		}
		else if(a[i]<a[i-1]){
			cout<<"No\n";
			return 0;
		}
	}
	cout<<"Yes\n";
	return 0;
}


Measured memory_bytes: 640
#include <cstdio>           // printf(), scanf()
#include <vector>
#include <queue>            // priority_queue
#include <algorithm>        // fill()
#include <utility>          // pair

using namespace std;

static const int MAX_V = 10000;
static const int INF = 100000000;

typedef pair<int, int> P;
struct edge
{
	int to;
	int cost;
};

vector<edge> G[MAX_V];
int V;

void
dijkstra()
{
	priority_queue<P, vector<P>, greater<P> > que;
	int d[MAX_V];
	int u;
	unsigned int v; 

	fill(d, d + V, INF);
	d[0] = 0;
	que.push(P(0, 0));

	while (!que.empty())
	{
		P p = que.top(); que.pop();
		int u = p.second;
		if (d[u] < p.first)
			continue;

		for (v = 0; v < G[u].size(); ++v)
		{
			edge e = G[u][v];
			if (d[u] + e.cost < d[e.to])
			{
				d[e.to] = d[u] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}

	for (u = 0; u < V; ++u)
		printf("%d %d\n", u, d[u]);
}

int
main(int argc, char** argv)
{
	edge e;
	int u, v;
	int c;
	int i, j, k;

	scanf("%d", &V);
	for (i = 0; i < V; ++i)
	{
		scanf("%d %d", &u, &k);
		for (j = 0; j < k; ++j)
		{
			scanf("%d %d", &v, &c);
			e.to = v;
			e.cost = c;
			G[u].push_back(e);
		}
	}

	dijkstra();
	return 0;
}

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

int main(){
	int n, m;
	double dp[101][101], hiryou[101][101];
	while(cin >>n >>m){
		if(n == 0 && m == 0) break;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				cin >>hiryou[i][j];
			}
		}
		for(int i = 0; i < n; i++){
			dp[0][i] = 1.0;
		}
		for(int i = 1; i < m; i++){
			for(int j = 0; j < n; j++){
				dp[i][j] = 0.0;
				for(int k = 0; k < n; k++){
					if(dp[i - 1][k] * hiryou[k][j] > dp[i][j]) dp[i][j] = dp[i - 1][k] * hiryou[k][j];
				}
			}
		}
		//for(int i = 0; i < n; i++){
		//	for(int j = 0; j < m; j++){
		//		printf("%5.5f ", dp[j][i]);
		//	}
		//	cout <<endl;
		//}
		double ans = 0.0;
		for(int i = 0; i < n; i++){
			if(dp[m - 1][i] > ans) ans = dp[m - 1][i];
		}
		printf("%.2f\n", ans);
	}
	return 0;
}

Measured memory_bytes: 0
//
// Created on 2020/03/01.
//

//#include <bits/stdc++.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;
using gragh = vector<vector<int>>;

int main() {
    bool ans = false;
    vector<vector <int> > bingo (3,vector<int>(3,0));
    for (int i = 0; i < 3; ++i) {
        cin>>bingo[i][0]>>bingo[i][1]>>bingo[i][2];
    }
    int n;
    cin>>n;
    for (int j = 0; j < n; ++j) {
        int temp;
        cin>>temp;
        for (int i = 0; i < 3; ++i) {
            for (int k = 0; k < 3; ++k) {
                if(temp==bingo[i][k]){
                    bingo[i][k]=0;
                }
            }
        }
    }

    for (int l = 0; l < 3; ++l) {
        if(bingo[l][0]==0 && bingo[l][1] == 0 &&  bingo[l][2] == 0) ans = true;
    }
    for (int l = 0; l < 3; ++l) {
        if (bingo[0][l] ==0 && bingo[1][l]==0 &&  bingo[2][l] == 0) ans = true;
    }
    if(bingo[0][0] == 0 && bingo[1][1] ==0 && bingo[2][2]==0) ans =true;
    if(bingo[0][2] == 0 && bingo[2][0] ==0&& bingo[1][1]==0) ans = true;

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


Measured memory_bytes: 256
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt(), w = sc.nextInt();
        int[][] a = new int[h][w];
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                a[i][j] = sc.nextInt() % 2;
            }
        }
        int[] b = new int[h*w];
        int[] c = new int[h*w];
        int[] d = new int[h*w];
        int[] e = new int[h*w];
        int[] y = new int[h*w];
        int[] x = new int[h*w];
        int cnt = -1;
        for(int i = 0; i < h; i++){
            if(i % 2 == 0){
                for(int j = 0; j < w; j++){
                    ++cnt;
                    y[cnt] = i;
                    x[cnt] = j;  
                }
            }else{
                for(int j = w - 1; j >= 0; j--){
                    ++cnt;
                    y[cnt] = i;
                    x[cnt] = j;
                } 
            }
        }
        int ans = -1;
        for(int i = 0; i < cnt; i++){
            if(a[y[i]][x[i]] % 2 == 1){
                ans++;
                b[ans] = y[i] + 1;
                c[ans] = x[i] + 1;
                d[ans] = y[i+1] + 1;
                e[ans] = x[i+1] + 1;
                a[y[i+1]][x[i+1]]++;
            }
        }
        System.out.println(++ans);
        for(int i = 0; i < ans; i++){
            System.out.println(b[i] + " " + c[i] + " " + d[i] + " "  + e[i]);
        }
    }
}




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

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

void trace(int A[],int N){
    REP(i,N){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}


int main(){
    int A,B,C;
    cin >> A >> B >> C;
    int five=0,seven=0;
    if(A == 5)five++;
    else if(A==7)seven++;
    if(B == 5)five++;
    else if(B==7)seven++;
    if(C == 5)five++;
    else if(C==7)seven++;
    if(five == 2 && seven == 1)puts("YES");
    else puts("NO");
}


Measured memory_bytes: 256
/***********************************************************
	When you are inspired by passion 
	and you want to live for the current moment

	When your every thought and action
	has the power to become the story of your future

	When difficulties stand to demolish your Glory
	Just remember that Life is a 'Golden adverse Story'

	Withstand it to acheive your passion and dreams
	more amazingly more easily.

	Why then? When writing the story of your Life
	You want to Let someone else hold your pen

					huzaifa242©

***********************************************************/
#include "bits/stdc++.h"
using namespace std;
#define int int32_t
#define MAX 100005
#define x first 
#define y second

int seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l = 0, int r = numeric_limits <int>::max())
{return uniform_int_distribution<int> (l, r)(rng);}

template <typename T, typename G>
ostream& operator << (ostream& out, const pair <T, G> &a) 
{return out << "( " << a.x << ", " << a.y << ")";}

template <typename T>
ostream& operator << (ostream& out, const vector <T> &a) 
{out << "[ "; for(const auto &i: a) out << i << ", "; return out << "]" << endl;}

template <typename T>
ostream& operator << (ostream& out, const set <T> &a) 
{out << "{ "; for(const auto &i: a) out << i << ", "; return out << "}" << endl;}

template <typename T, typename G>
ostream& operator << (ostream& out, const map <T, G> &a) 
{out << "< "; for(const auto &i: a) out << i << ", "; return out << ">" << endl;}

template <typename T, size_t N>
typename enable_if<!is_same <typename remove_cv <T>::type, char>::value,
ostream&>::type operator << (ostream& out, T (&a)[N])
{out << "[ "; for(const auto &i: a) out << i << ", "; return out << "]" << endl;}

void debug_out(){cerr << endl;} 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{cerr << (H) << ' '; debug_out(T...);}
 
#ifdef LOCAL
#define debug(...) cerr << '#' << #__VA_ARGS__ << ":\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 24
#endif

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n, ans = 0;
	cin >> n;
	vector <int> a(n);
	for (int i = 0; i < n; ++i) 
		cin >> a[i];
	sort(a.begin(), a.end());
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			for (int k = j + 1; k < n; ++k) {
				if (a[i] + a[j] > a[k] && a[i] != a[j] && a[j] != a[k]) {
					ans++; 
				}
			}
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3664
#include <stdio.h>
int main(void){
	int a,b,c,d,e,k;
	scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&k);
	if(	e-d>k || e-c>k || e-b>k || e-a>k||
		d-c>k || d-b>k || d-a>k ||
		c-b>k || c-a>k || b-a>k){
		printf(":(");
	}else{
		printf("Yay!");
	}
	return 0;
}

Measured memory_bytes: 128
N = int(input())
A = map(int, input().split())
minus_count = 0
total = 0
minimum = 999999999999999999

for a in A:
	total += abs(a)
	if abs(a) < minimum:
		minimum = abs(a)
	if a < 0:
		minus_count += 1
			
if minus_count % 2 == 0:
	print(total)
else:
	print(total - 2 * minimum)

Measured memory_bytes: 11196
#include <iostream>
using namespace std;
struct Card{
  char suit, value;
};

void bubble(struct Card A[], int N){
  for (int i = 0; i < N; i++){
    for (int j = N - 1; j >= i + 1; j--){
      if (A[j].value < A[j - 1].value){
        Card t = A[j];
        A[j] = A[j - 1];
        A[j - 1] = t;
      }
    }
  }
}

void selection(struct Card A[], int N){
  for (int i = 0; i < N; i++){
    int minj = i;
    for (int j = i; j < N; j++){
      if (A[j].value < A[minj].value)
      minj = j;
    }
    Card t = A[i];
    A[i] = A[minj];
    A[minj] = t;
  }
}

void print(struct Card A[], int N){
  for (int i = 0; i < N; i++){
    if (i > 0) cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N){
  for (int i = 0; i < N; i++){
    if (C1[i].suit != C2[i].suit) return false;
  }
  return true;
}

int main(){
  Card C1[1000], C2[100];
  int N;
  char ch;

  cin >> N;
  for (int i = 0; i < N; i++){
    cin >> C1[i].suit >> C1[i].value;
  }
  for (int i = 0; i < N; i++) C2[i] = C1[i];

  bubble(C1, N);
  selection(C2, N);

  print(C1, N);
  cout << "Stable" << endl;
  print(C2, N);
  if (isStable(C1, C2, N)){
    cout << "Stable" << endl;
  }else{
    cout << "Not stable" << endl;
  }
  
  return 0;
}



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

int main(){
    int m, f, r;
    while(cin >> m >> f >> r){
        if(m == -1 && f == -1 && r == -1) break;
        if(m == -1 || f == -1){
            cout << "F" << endl;
        }else if(m + f >= 80){
            cout << "A" << endl;
        }else if(m + f < 80 && m + f >= 65){
            cout << "B" << endl;
        }else if(m + f < 65 && m + f >= 50){
            cout << "C" << endl;
        }else if(m + f < 50 && m + f >= 30){
            if(r >= 50){
                cout << "C" << endl;
            }else{
                cout << "D" << endl;
            }
        }else if(m + f < 30){
            cout << "F" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3096
<?php
$f = fopen( 'php://stdin', 'r' );
$line1 = fgets($f);
$line2 = fgets($f);
$num_array = explode(' ', $line2);
$min_count = 1000000;
foreach ($num_array as $num){
    $tmp = (int)$num;
    $count = 0;
    while($tmp%2 === 0){
        $count = $count + 1;
        $tmp = $tmp / 2;
    }
    if ($count === 0) {
        echo(0);
        exit();
    }
    if ($count < $min_count){
        $min_count = $count;
    }
}
echo($min_count);

Measured memory_bytes: 4604
#include <iostream>
#include <string>
#include <vector>
using namespace std;

void print_chessboard(int H, int W);
string build_row(int W, string bw);

int main() {
	int H, W;
	while(cin >> H >> W){
		if (H == 0 && W == 0) break;
		print_chessboard(H, W);
	}
}

void print_chessboard(int H, int W){
	vector<string> rows {build_row(W, "#."), build_row(W, ".#")};
	for (int h=0; h != H; ++h){
		cout << rows[h % 2] << endl;
	}
	cout << endl;
}

string build_row(int W, string bw){
	string row;
	for (int w=1; w < W; w += 2){
		row += bw;
	}
	if (W % 2){
		row += bw[0];
	}
	return row;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, m;
    cin >> n >> m;
    long long int dp[n + 5][m + 5];
    long long int mod = 1e9 + 7;
    char s[n + 5][m + 5];
    for(int i = 1; i <=n; i++){
        for(int j = 1; j <=m; j++){
            cin >> s[i][j];
        }
    }
  dp[1][1]=1;
  for(int i=0;i<=n+1;i++)
  {
    dp[i][0]=0;
  }
  
 for(int i=0;i<=m+1;i++)
  {
    dp[0][i]=0;
  }
  
    for(int i = 1; i <= n; i++){
        for(int j =1; j <= m; j++){
          if(i==1&&j==1)dp[i][j]=1;  //starting position mai 1 way hai
          else if(s[i][j]=='#')
            dp[i][j]=0;            //we cant reach this cell with wall in any way
          else 
          {dp[i][j]=dp[i-1][j]+dp[i][j-1]; //   bcoz we can move either right or down ..so to reach a cell with i,j...it will be the sum of reaching cell (i-1,j) and cell(i,j-1).....dp[i][j] represents the no of ways we can arrive at this cell
           //cout<<i<<" "<<j<<endl;
          dp[i][j]=dp[i][j]%mod;
          }
        }
    }
 /* for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++)
    {cout<<dp[i][j]<<" ";
    }
  cout<<endl;
}*/
    cout << dp[n][m];
    return 0;
}

Measured memory_bytes: 9088
#include <stdio.h>
#include <math.h>
int main(){
  double n;
  double s[1001];
  int i;
  double m=0;
  double sigma=0;
  while(1){
	m=0;
	sigma=0;
	scanf("%lf", &n);
	if(n==0)
	  break;
	for(i=0; i<n; ++i){
	  scanf("%lf", &s[i]);
	  m+=s[i];
	}
	m=m/n;
	for(i=0; i<n; ++i){
	  sigma+=(s[i]-m)*(s[i]-m)/n ;
		}
	printf("%lf\n", sqrt(sigma));
  }
  return 0;
}



Measured memory_bytes: 2044
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int c = sc.nextInt();
      
      if(a+b==c || b+c==a || c+a==b){
      	System.out.println("Yes");
      }else{
      	System.out.println("No");
      }

    }
}

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

using namespace std;

int n;

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

    cin >> n;
    
    n %= 10;

    if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
        cout << "hon" << endl;
    }
    else if(n == 0 || n == 1 || n == 6 || n == 8) {
        cout << "pon" << endl;
    }
    else {
        cout << "bon" << endl;
    }
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
using namespace std;

int main() {
	long long int H, W;
	long long int Y = 1000000000;
	cin >> H >> W;
	
	for (int k = 0; k < 2; k++) {
		for (int i = 1; i < H - 1; i++) {
			if ((H - i) % 2 == 0) {
				if (Y > abs(W*i - W * (H - i) / 2))Y = abs(W*i - W * (H - i)/2);
			}
			else {
				
				long long int Q;
				long long int R;
				Q= max(W*i, W*(H - i + 1) / 2);
				Q = max(Q, W*(H - i - 1) / 2);
				R = min(W*i, W*(H - i + 1) / 2);
				R = min(R, W*(H - i - 1) / 2);
				if ((Q-R) < Y)Y = (Q-R);
			}
			

			
		}
		for (int i = 1; i < H; i++) {
			if (W % 2 == 0) {
				if (Y > abs(i*W - W / 2 * (H - i)))Y = abs(i*W - W / 2 * (H - i));
			}
			else {
				long long int Q;
				long long int R;
				Q = max(i*W, (H - i)*(W + 1) / 2);
				Q = max(Q, (H - i)*(W - 1) / 2);
				R = min(i*W, (H - i)*(W + 1) / 2);
				R = min(R, (H - i)*(W - 1) / 2);
				if ((Q - R) < Y)Y = (Q - R);

			}
			
			
		}

		swap(H, W);
	}
	cout << Y << endl;


	return 0;
}


Measured memory_bytes: 256
h,w=map(int, input().split())
a=[]
w=[False for _ in range(w)]
for _ in range(h):
    line=input()
    for i, ai in enumerate(line):
        if ai=='#':
            w[i]=True
    if '#' in line:
        a.append(line)

for ai in a:
    line=''
    for i, wi in enumerate(w):
        if wi:
            line+=ai[i]
    print(line)



Measured memory_bytes: 3060
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect
mod = 10**9+7

n,k = map(int,input().split())
a = list(map(int,input().split()))
d = 1
mina = min(a)+1
for i in range(n-k):
    if a[i] < a[i+k]:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 94808
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;cin>>n;
  vector<int> p(n);
  for(int i=0;i<n;i++)
    cin>>p[i];
  int count=1;
  int min=p[0];
  for(int i=1;i<n;i++)
    if(p[i]<=min)
    {count++;
  		min=p[i];}
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 1024
def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

S = set(T)
res = 1
for j in S:
    res = res * j // gcd(res, j)
    
print(int(res))


Measured memory_bytes: 2940
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <bitset>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#define MAXN 1010100
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ll __int64
#define INF 0x7fffffff
#define cs(s) freopen(s,"r",stdin)
#define mem(x) memset(x,0,sizeof(x))
#define PI acos(-1)
#define eps 1e-10
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
//head
int main(){
	// freopen("in.txt","r",stdin);
	// freopen("out.txt","w",stdout);
	ios::sync_with_stdio(false);
	LL a,b;
	cin>>a>>b;
	if(b%a==0)cout<<a+b;
	else cout<<b-a;	
	return 0;
}

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

def solve():
    N = int(input())

    if N == 1:
        print(1)
        return

    L0 = 2
    L1 = 1
    i = 2
    while True:
        ans = L0 + L1

        if i == N:
            break
        
        L0 = L1
        L1 = ans
        i += 1

    print(ans)

if __name__ == "__main__":
    solve()


Measured memory_bytes: 3060
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int A = sc.nextInt();
      int A_2 = sc.nextInt();
      int A_3 = sc.nextInt();
      if(A+A_2+A_3>=22){
        System.out.println("bust");
      }else{
        System.out.println("win");
      }
    }
}

Measured memory_bytes: 35668
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

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

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }


main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector <pii> a(n);
    for (auto &i : a) cin >> i.x >> i.y;
    int ans = 0;
    sort(all(a));
    stack <pii> q, q1;
    for (int i = 0; i < n; i++) {
        int x = -a[i].x - a[i].y, X = -LINF;
        while (!q.empty() && q.top().x >= a[i].y) {
            umax(X, q.top().y);
            q.pop();
        }
        if (!q.empty()) {
            umax(x, q.top().y);
        }
        umax(ans, a[i].x + a[i].y + x);
        q.push({a[i].y, max(x, X)});

        x = -a[i].x + a[i].y, X = -LINF;
        while (!q1.empty() && q1.top().x <= a[i].y) {
            umax(X, q1.top().y);
            q1.pop();
        }
        if (!q1.empty()) {
            umax(x, q1.top().y);
        }
        umax(ans, a[i].x - a[i].y + x);
        q1.push({a[i].y, max(x, X)});
    }
    cout << ans << '\n';
}


Measured memory_bytes: 9472
#include <cctype>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <list>
#include <map>
#include <ostream>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#define ll long long
#define PI 3.1415926
using namespace std;
int cnt[200005];
int main() {
	int n,num;
	cin>>n;
	for (int i=2; i<=n; i++) {
		cin>>num;
		cnt[num]++;
	}
	for (int i=1; i<=n; i++) cout<<cnt[i]<<endl;
	return 0;
}

Measured memory_bytes: 4348
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int flg = 0;
		if(A == 1) flg = 1;
		for(int i = B;i <= B * 2 ;i ++) {
			if(C == A * i % B) flg = 1;
		}
		if(flg == 1) System.out.println("YES");
		else System.out.println("NO");
	}
}

Measured memory_bytes: 22228