akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        Map<Integer, List<Integer>> t = new HashMap<>();
        Map<Integer, List<Integer>> f = new HashMap<>();

        for (int i = 0; i < N; i++) {
            int a = Integer.parseInt(sc.next());
            List<Integer> tl = new ArrayList<>();
            List<Integer> fl = new ArrayList<>();
            for (int j = 0; j < a; j++) {
                int x = Integer.parseInt(sc.next());
                int y = Integer.parseInt(sc.next());
                if(y == 1) {
                    tl.add(x - 1);
                }else {
                    fl.add(x - 1);
                }
            }
            t.put(i, tl);
            f.put(i, fl);
        }

        int res = 0;
        for (int i = 0; i < (1 << N); i++) {
            boolean[] tp = new boolean[N];
            int tc = 0;
            for (int j = 0; j < N; j++) {
                if((1 & i >> j) == 1) {
                    tp[j] = true;
                    tc++;
                }else {
                    tp[j] = false;
                }
            }

            boolean b = true;
            for (int j = 0; j < N; j++) {
                if(!tp[j]) continue;
                for (int ii : t.get(j)) {
                    if(!tp[ii]) {
                        b = false;
                        break;
                    }
                }
                for (int ii : f.get(j)) {
                    if(tp[ii]) {
                        b = false;
                        break;
                    }
                }
            }

            if(b) {
                res = Math.max(res, tc);
            }
        }

        System.out.println(res);
    }
}


Measured memory_bytes: 40840
#include<bits/stdc++.h>
#define rep(i,a) for(int (i)=0; (i)<(a); (i)++)
#define rrep(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define rep2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;
using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n,k; cin >> n >> k;
  vector<ll> a(n), f(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> f[i];
  sort(all(a)); sort(all(f),greater<ll>());

  ll check=0;
  rep(i,n) check+=a[i];
  if(check <= k){ cout << "0"; return 0;}
  
  vector<pair<ll,ll>> p;
  rep(i,n) p.emplace_back(make_pair(a[i], f[i]));
  
  ll l = 0, r = 1000006000000;
  
  while(1){
    ll m = (l+r)/2;
    ll syugyo = 0;
    rep(i,n){
      if(m < p[i].first * p[i].second){
        syugyo += p[i].first - ll(m/p[i].second);
      }
    }
    if(syugyo > k) l = m + 1;
    else r = m;
    if(abs(r - l) <= 1) break;
  }

  ll c = 0;
  rep(i,n){
    if(l < p[i].first * p[i].second){
        c += p[i].first - ll(l/p[i].second);
    }
  }
  if(c <= k) cout << l << endl;
  else cout << r << endl;
  
  
  return 0;
}

Measured memory_bytes: 9712
N=int(input())
l=[]
for i in range(2,10**6+1):
    if not N%i:
        if i>N//i:
            break
        if i**2==N:
            l.append(i)
            break
        l+=[i,N//i]
l.append(N)
a=0
for i in l:
    t=N
    while t>=i:
        if t%i:
            t%=i
        else:
            t//=i
    if t==1:
        a+=1
N-=1
for i in range(1,10**6+1):
    if not N%i:
        if i>N//i:
            break
        if i**2==N:
            a+=1
            break
        else:
            a+=2
print(a-1)

Measured memory_bytes: 40668
#include<stdio.h>
 
int main(){
   
  int j,i,k,N,v,A[1000];
   
  scanf("%d",&N);
  for( i = 0; i < N; i++){
    scanf("%d",&A[i]);
  }
   
  for(k = 0; k < N-1; k++){
    printf("%d ",A[k]);
  }
  printf("%d",A[k]);
  printf("\n"); 
  for(i = 1; i < N; i++){
    v = A[i];
    j = i-1;
     
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
      A[j+1] = v;
       
    }
     
    for(k = 0; k < N-1; k++){
      printf("%d ",A[k]);
    }
    printf("%d\n",A[k]);
     
  }
   
  return 0;
}

Measured memory_bytes: 1856
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using Graph = vector<vector<int>>;

vector<int> color;
bool dfs(const Graph &G, int v, int cur = 0) {
    color[v] = cur;
    for (auto next_v : G[v]) {
        if (color[next_v] != -1) {
            if (color[next_v] == cur) return false; 
            continue;
        }
        if (!dfs(G, next_v , 1 - cur)) return false;
    }
    return true;
}

const int INF = 1e9;

int dist[205][205];

void warchall_floyd(int N){
    rep(k,N)rep(i,N){
        if(dist[i][k] == INF) continue;
        rep(j,N){
            if(dist[k][j] == INF) continue;
	        chmin(dist[i][j], dist[i][k]+dist[k][j]);
        }
    }
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	Graph G(n);
	rep(i,n)rep(j,n){
		char c;
		cin >> c;
		if(c == '1'){
			G[i].push_back(j);
			dist[i][j] = 1;
		}
		else dist[i][j] = INF;
		dist[i][i] = 0;
	}
	color.assign(n, -1);
    bool is_bipartite = true;
    for (int v = 0; v < n; ++v) {
        if (color[v] != -1) continue;
        if (!dfs(G, v)) is_bipartite = false;
    }
	if(!is_bipartite){
		cout << -1 << endl;
		return 0;
	}
	warchall_floyd(n);
	int ans = 0;
	rep(i,n)rep(j,n){
		if(dist[i][j] != INF) chmax(ans, dist[i][j]);
	}
	cout << ans + 1 << endl;
	return 0;
}

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

int main()
{
	string a, b;
	cin >> a >> b;
	string ans;
	if(a.size() < b.size()) ans = "LESS";
	else if(a.size() > b.size()) ans = "GREATER";
	else if(a < b) ans = "LESS";
	else if(a > b) ans = "GREATER";
	else ans = "EQUAL";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define FOR(i,c) for(__typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define F first
#define S second
using namespace std;

const LL mod = 1e9 + 7;

template<typename T> T gcd(T a, T b) { return b == 0?a: gcd(b, a % b); }
template<typename T> T LCM(T a, T b) { return a*(b/gcd(a, b)); }
template<typename T> T expo(T base, T e, T mod) { T res = 1;
  while(e > 0) { if(e&1) res = res * base % mod; base = base * base % mod; e >>= 1; }
  return res;
}
template<typename T, typename S> T expo(T b, S e){if(e <= 1)return e == 0?1: b;\
	return (e&1) == 0?expo((b*b), e>>1): (b*expo((b*b), e>>1));}
template<typename T, typename S> T modinv(T a, S mod) { return expo(a, mod-2, mod); }
template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<class T> std::ostream& operator<<(std::ostream &os, const std::vector<T> &t) {
	os<<"["; FOR(it,t) { if(it != t.begin()) os<<", "; os<<*it; } os<<"]";
	return os;
}

const int MAXN = 103;

int h, w, n;
int grid[MAXN][MAXN];
int arr[MAXN*MAXN];
pair<int, int> get_next(int r, int c) {
  if(r % 2) {
    if(c == w) return {r + 1, c};
    return {r, c + 1};
  } else {
    if(c == 1) return {r + 1, c};
    return {r, c - 1};
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin >> h >> w;
  cin >> n;
  pair<int, int> st = {1, 1};
  for(int i = 0; i < n; i++) {
    cin >> arr[i];
    for(int j = 0; j < arr[i]; j++) {
      grid[st.F][st.S] = i + 1;
      st = get_next(st.F, st.S);
    }
  }
  for(int i = 1; i <= h; i++) {
    for(int j = 1; j <= w; j++) {
      cout << grid[i][j] << ' ';
    }
    cout << '\n';
  }
  return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main{
      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            String str = sc.next();
            String[] str2 = str.split("");
            if(str2[2].equals(str2[3]) && str2[4].equals(str2[5])){
              System.out.println("Yes");
            } else {
              System.out.println("No");
            }
      }
}

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

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

    cout << 10 - (x / 200) << endl;

    return 0;
}

Measured memory_bytes: 3592
import fractions
from functools import reduce


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)


def main():
    N,M=[int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    b = [x//2 for x in a]

    # l = np.lcm.reduce(b)
    l = lcm(b)
    for x in b:
        if l // x % 2 == 0:
            print(0)
            return

    ans = (M//l+1)//2
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 16308
n = int(input())

def divGame(N=n):
  if N == 1:
    return 0
  if N == 2:
    return 1
  
  factors = []

  for i in range(2, int(N**0.5 + 1)):
    count = 0
    while N % i == 0:
      N /= i
      count += 1
    if count != 0:
      factors.append(count)
  if N != 1:
    factors.append(1)

  factors.sort()

  answer = 0
  accum = 1
  count = 1
  for i in range(len(factors)):
    while factors[i] >= accum:
      count += 1
      accum += count
    answer += count - 1

  return answer

print(divGame())

Measured memory_bytes: 63772
/*
 * 2545.cc: Lion
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 10;
const int MAX_X = 10;
const int MAX_M = 10;

/* typedef */

struct Rng {
  int l, r, c;
  Rng() {}
  Rng(int _l, int _r, int _c): l(_l), r(_r), c(_c) {}
};

/* global variables */

Rng rngs[MAX_M];
int as[MAX_N], maxas[MAX_N], sums[MAX_N + 1];

/* subroutines */

/* main */

int main() {
  int n, x, m;
  cin >> n >> x >> m;

  for (int i = 0; i < m; i++) {
    cin >> rngs[i].l >> rngs[i].r >> rngs[i].c;
    rngs[i].l--;
  }

  bool cont = true;
  int maxsum = -1;
  
  while (cont) {
    sums[0] = 0;
    for (int i = 0; i < n; i++) sums[i + 1] = sums[i] + as[i];

    bool ok = true;
    for (int i = 0; i < m; i++)
      if (sums[rngs[i].l] + rngs[i].c != sums[rngs[i].r]) {
	ok = false;
	break;
      }

    if (ok && maxsum < sums[n]) {
      maxsum = sums[n];
      for (int i = 0; i < n; i++) maxas[i] = as[i];
    }

    int k = 0;
    while (k < n) {
      if (++as[k] <= x) break;
      as[k++] = 0;
    }
    if (k >= n) cont = false;
  }

  if (maxsum < 0) puts("-1");
  else {
    for (int i = 0; i < n; i++) {
      if (i) putchar(' ');
      printf("%d", maxas[i]);
    }
    putchar('\n');
  }
  return 0;
}

Measured memory_bytes: 1148
#!/usr/bin/env python3
import sys
from itertools import combinations

def solve(N: int, A: "List[int]", B: "List[int]"):
    answer = 10**18
 
    ## 奇数indexにくるものを決め打ち
    for c in combinations(range(N), N//2):
        even, odd= [], []
        
        for i in range(N):
            if i in c:
                odd.append((A[i] if i % 2 == 1 else B[i],i))
            else:
                even.append((A[i] if i % 2 == 0 else B[i],i))
    
        even.sort()
        odd.sort()
        t = []
        ind = []
        
        for i in range(N//2):
            t.append(even[i][0])
            t.append(odd[i][0])
            ind.append(even[i][1])
            ind.append(odd[i][1])

        if N%2 == 1:
            t.append(even[-1][0])
            ind.append(even[-1][1])
        
        if t != sorted(t):
            continue

        tentousuu = 0
        for i in range(N-1):
            for j in range(i+1,N):
                if ind[i] > ind[j]:
                    tentousuu += 1
        
        answer = min(answer,tentousuu)


    if answer == 10**18:
        print(-1)
    else:
        print(answer)
    return

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

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INF = 999999999;
const int MOD = (int)1e9 + 7;
const int EPS = 1e-9;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  string T;
  cin >> S >> T;
  SORT(S);
  SORT(T);
  REV(T);
  if (S < T)cout << "Yes" << endl;
  else cout << "No" << endl;

}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.PriorityQueue;
import java.math.BigInteger;
    
public class Main{

static final InputStream in=System.in;
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;

public static void main(String[] args) throws IOException{
InputReader ir=new InputReader(in);
HashMap<String,String> map=new HashMap<String,String>();
StringBuilder sb=new StringBuilder();
while(true){
int n=ir.nextInt();
if(n==0) break;
while(n-->0) map.put(ir.next(),ir.next());
int m=ir.nextInt();
while(m-->0){
String str=ir.next();
sb.append((map.containsKey(str))?map.get(str):str);
}
out.println(sb.toString());
map.clear();
sb.delete(0,sb.length());
}
out.flush();
}

static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;

public InputReader(InputStream in) {this.in=in;}
  
public int readByte() {
if(lenbuf==-1) throw new InputMismatchException();
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}
catch (IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0)
return -1;
}
return buffer[curbuf++];
}

public boolean isSpaceChar(int c){return !(c>=33&&c<=126);}

private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;}

public String next() {
int b=skip();
StringBuilder sb=new StringBuilder();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
 
public int nextInt() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}

public long nextLong() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}

public int[] toIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
}
}

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

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

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

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



int n;

vint op(vint vec) {
    map<int,int> ma;
    for (int i = 0; i < vec.size(); ++i) ma[vec[i]]++;
    vint res(vec.size());
    for (int i = 0; i < vec.size(); ++i) res[i] = ma[vec[i]];
    return res;
}

int main() {
    while (cin >> n) {
        if (n == 0) break;
        vint vec(n);
        for (int i = 0; i < n; ++i) cin >> vec[i];
        int res;
        for (res = 0; res < 1000000; ++res) {
            vint nvec = op(vec);
            if (nvec == vec) break;
            vec = nvec;
        }
        cout << res << endl;
        for (int i = 0; i < n; ++i) {
            cout << vec[i];
            if (i != n-1) cout << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1220
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

namespace math { namespace integer {

template<class value_type> value_type mod_mul(value_type x, value_type k, ll m) { if(k == 0) { return 0; } if(k % 2 == 0) { return mod_mul((x+x) % m, k/2, m); } else { return (x + mod_mul(x, k-1, m)) % m; } }
template<class value_type> value_type mod_pow(value_type x, value_type n, ll mod) { if(n == 0) { return 1; } if(n % 2 == 0) { return mod_pow(mod_mul(x, x, mod) % mod, n / 2, mod); } else { return mod_mul(x, mod_pow(x, n - 1, mod), mod); } }
template<class value_type> value_type extgcd(value_type a, value_type b, value_type& x, value_type& y) { value_type d = a; if(b != 0) { d = extgcd(b, a%b, y, x); y -= (a / b) * x;} else { x = 1, y = 0; } return d; }
template<class value_type> value_type mod_inverse(value_type x, ll mod) { return mod_pow(x, value_type(mod-2), mod); /* use fermat */ }
template<class value_type> value_type mod_inverse_composite_num_mod(value_type a, ll mod) { value_type x, y; extgcd(a, mod, x, y); return (mod + x % mod) % mod; }

}}
using namespace math::integer;
template<class T>
T lcm(T x, T y) {
  return x / __gcd(x, y) * y;
}

int main() {

  for(int A, B, d; cin >> A >> B >> d && (A|B|d);) {
    int G = __gcd(__gcd(A, B), d);
    A /= G, B /= G, d /= G;
    ll ans = 1e18, axby = 1e18; int tx = -1, ty = -1;
    for(int sgn=-1; sgn<2; sgn+=2) {
      int a = sgn * A, b = -sgn * B;
      int x, y; int g = extgcd(a, b, x, y);
      x *= d / g, y *= d / g;
      ll L = lcm(a, b);
      rep(_, d+1) {
        if(x >= 0 || y >= 0) {
          if(minimize(ans, abs(x) + abs(y))) {
            axby = a * x + b * y;
            tx = x, ty = y;
          }
          else if(ans == abs(x) + abs(y)) {
            if(minimize(axby, (ll)a * x + b * y)) {
              tx = x, ty = y;
            }
          }
        }
        x += L / abs(a);
        y += L / abs(b);
      }
    }
    cout << abs(tx) << " " << abs(ty) << endl;

  }
  
  return 0;
}

Measured memory_bytes: 3096
from itertools import product
n = int(input())
d = [int(i) for i in input().split()]
if 0 in d or 23<n: ans = 0
elif n<12:
    ans = 0
    for i in product((0,1),repeat=n):
        x = [0,24]
        for j in range(n):
            if i[j]: x.append(d[j])
            else: x.append(24-d[j])
        x,num = sorted(x),24
        for j in range(n+1): num = min(num,x[j+1]-x[j])
        ans = max(ans,num)
else:
    d+=[0]
    f = 1
    for i in range(1,13):
        if d.count(i)>2: f = 0
    if f: ans = 1
    else: ans = 0
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int main(){
    int input;
    int h, m, s;
    int tmp;
    scanf("%d", &input);
    h = input / 3600;
    tmp = input % 3600;
    m = tmp / 60;
    s = tmp % 60;
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}


Measured memory_bytes: 2120
#include <iostream>

using namespace std;

int a, b, c, d;

int main(int argc, char const *argv[]) {
    cin >> a >> b >> c >> d;
    int takahashiAttack = (c + (b - 1)) / b;
    int aokiAttack = (a + (d - 1)) / d;
    if (takahashiAttack <= aokiAttack) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        s: String,
        t: String
    }
    println!("{}{}", t, s);
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 4352
-- 2 variables
main = do
  (x:y:k:xs) <- map read . words <$> getLine
  putStrLn . show $ solve x y k (min x y)

solve :: Int -> Int -> Int -> Int -> Int
solve x y k p
  | x `mod` p == 0 && y `mod` p == 0 =
      if k == 1 then
        p
      else
        solve x y (k-1) (p-1)
  | otherwise = solve x y k (p-1)


Measured memory_bytes: 508
#include <stdio.h>

int main()
{
	int a[2];
	scanf("%d %d", &a[0],&a[1]);
	while(!(a[0] == 0 && a[1] == 0))
	{
		if (a[0] > a[1])
		{
			int i = a[0];
			a[0] = a[1];
			a[1] = i;
		}
		printf("%d %d\n",a[0],a[1]);
		scanf("%d %d", &a[0], &a[1]);
	} 
	return 0;
}


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

using namespace std;

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

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

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

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;


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

    int n; cin >> n;
    vector<int> l(n);
    REP(i, n) cin >> l[i];
    int ans = 0;
    REP(i, n) {
        FOR(j, i+1, n) {
            FOR(k, j+1, n) {
                set<int> st{l[i], l[j], l[k]};
                if (st.size() < 3) continue;
                int s = l[i] + l[j] + l[k];
                int ma = max({l[i], l[j], l[k]});
                if (s - ma > ma) {
                    ++ans;
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3620
from itertools import combinations_with_replacement
n,m,q = map(int, input().split())
abcd = []
for _ in range(q):
  a,b,c,d = map(int, input().split())
  abcd.append([a,b,c,d])

nums = list(range(1,m+1))
l = list(combinations_with_replacement(nums, n))

ans = 0
for i in l:
  p = 0
  for j in abcd:
    if i[j[1]-1] - i[j[0]-1] == j[2]:
      p += j[3]
  ans = max(ans, p)
  
print(ans)

Measured memory_bytes: 21604
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	as := make([]int, n)
	for i := range as {
		sc.Scan()
		as[i], _ = strconv.Atoi(sc.Text())
		as[i]--
	}
	bs := make([]int, n)
	for i := range bs {
		sc.Scan()
		bs[i], _ = strconv.Atoi(sc.Text())
	}
	cs := make([]int, n-1)
	for i := range cs {
		sc.Scan()
		cs[i], _ = strconv.Atoi(sc.Text())
	}
	var ans int
	for i := range as {
		a := as[i]
		ans += bs[a]
		if i > 0 && as[i-1]+1 == a {
			ans += cs[a-1]
		}
	}
	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1840
import sys
from collections import Counter
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
A = MAP()

C = Counter(A).most_common()
#print(C)

ans = 0
for k, v in C:
	if v > k:
		ans += v - k
	elif v < k:
		ans += v

print(ans)


Measured memory_bytes: 67496
#include<stdio.h>

#define MAX 10000
#define NIL -1

typedef struct{
	int p;
	int l;
	int r;
}Node;

Node T[MAX];
int n , D[MAX] , H[MAX];

void setDepth( int u , int d ){
	
	if( u == NIL ){
		return;
	}
	D[u] = d;
	setDepth( T[u].l , d+1 );
	setDepth( T[u].r , d+1 );
}

int setHeight( int u ){
	
	int h1 = 0 , h2 = 0;
	
	if( T[u].l != NIL ){
		h1 = setHeight( T[u].l ) +1;
	}
	if( T[u].r != NIL ){
		h2 = setHeight( T[u].r ) + 1;
	}
	return H[u] = ( h1 > h2 ? h1 : h2 );
}

int getSibling( int u ){
	
	if( T[u].p == NIL ){
		return NIL; 
	}
	if( T[T[u].p].l != u && T[T[u].p].l != NIL ){
		return T[T[u].p].l;
	}
	if( T[T[u].p].r != u && T[T[u].p].r != NIL ){
		return T[T[u].p].r;
	}
	return NIL;
	
}

void print( int u ){
	
	printf( "node %d: " , u );
	printf( "parent = %d, " , T[u].p );
	printf( "sibling = %d, " , getSibling(u) );
	
	int deg = 0;
	
	if( T[u].l != NIL ){
		deg++;
	}
	if( T[u].r != NIL ){
		deg++;
	}
	printf( "degree = %d, " , deg );
	printf( "depth = %d, " , D[u] );
	printf( "height = %d, " , H[u] );
	
	
	if( T[u].p == NIL ){
		printf( "root\n" );
	}else if( T[u].l == NIL && T[u].r == NIL ){
		printf( "leaf\n" );
	}else{
		printf( "internal node\n" );
	}
}

int main( void ){
	
	int v , l , r , root = 0;
	
	scanf( "%d" , &n );
	
	for( int i = 0; i < n; i++ ){
		T[i].p = NIL;
	}
	
	for( int i = 0; i < n; i++ ){
		scanf( "%d" , &v );
		scanf( "%d" , &l );
		scanf( "%d" , &r );
		T[v].l = l;
		T[v].r = r;
		if( l != NIL ){
			T[l].p = v;
		}
		if( r != NIL ){
			T[r].p = v;
		}
	}
	
	for( int i = 0; i < n; i++ ){
		if( T[i].p == NIL ){
			root = i;
		}
	}
	
	setDepth( root , 0 );
	setHeight( root );
	
	for( int i = 0; i < n; i++ ){
		print( i );
	}
	
	return 0;
}


Measured memory_bytes: 2048
import random
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
ans = 0
last = [0]*26
for i in range(1,d+1):
    res = -float("inf")
    index = 0
    for k in range(26):
        x = k
        tnplast = last
        tnplast[x] = i
        tnp = 0
        tnp += s[i-1][x]
        for j in range(26):
            tnp -= c[j]*(i-last[j])
        if (tnp > res):
            res = tnp
            index = k+1
    ans += res
    print(index)
    

Measured memory_bytes: 9868
#include <cstdio>
#include <iostream>
#include <list>
#include <string>
using namespace std;
 
int main() {
    int n,key;
    char buf[20];
    string command;
    list<int> lst;
    scanf("%d",&n);
    for(int i=0; i<n; ++i) {
        scanf("%s",buf);
        command = buf;
        if(command=="insert") {
            scanf("%d",&key);
            lst.push_front(key);
        } else if(command=="delete") {
            scanf("%d",&key);
            for(auto itr=lst.begin(); itr!=lst.end(); ++itr) {
                if((*itr)==key) {
                    lst.erase(itr);
                    break;
                }
            }
        } else if(command=="deleteFirst") {
            lst.pop_front();
        } else if(command=="deleteLast") {
            lst.pop_back();
        }
    }
 
    for(auto itr=lst.begin(); itr!=--(lst.end()); ++itr) {
        printf("%d ",*itr);
    }
    printf("%d\n",lst.back());
    return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n-1);
	rep(i,n){ cin >> a[i]; a[i]--; }
	rep(i,n) cin >> b[i];
	rep(i,n-1) cin >> c[i];
	int ans = 0;
	rep(i,n){
		ans += b[a[i]];
		if(a[i]+1 == a[i+1]) ans += c[a[i]];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a[100] = { 0,1,3,1,2,1,2,1,1,2,1,2,1 };
    int x, y;
    cin >> x >> y;
    
    cout << (a[x]==a[y]?"Yes":"No")<< endl;
}

Measured memory_bytes: 256
#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 <list>
#include <cmath>
using namespace std;
#define rep(i,m,n) for (int i = (int) (m); i < (int) (n); i++)
#define rep1(i,m,n) for (int i = (int) (m); i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
int main(void){
    int N,i;
    cin>>N;
    vector<int> data(N-1);
    vector<int> out(N);
    rep(i,0,N-1)cin>>data.at(i);
    rep(i,0,N-1)out.at(data.at(i)-1)++;
    rep(i,0,N)cout<<out.at(i)<<endl;
}

Measured memory_bytes: 4844
import sys
input = sys.stdin.readline

N, M = map(int, input().split(' '))
k = [list(map(int, input().split(' ')))[1:] for _ in range(M)]
p = list(map(int, input().split(' ')))

ans = 0
for bit in range(2**N):
    counts = [0] * M
    for i in range(N):
        if bit & 1<<i:
            for m in range(M):
                for s in k[m]:
                    if s-1 == i:
                        counts[m] += 1
    all = True
    for m in range(M):
        if counts[m] % 2 != p[m]:
            all = False
    if all:
        ans += 1
print(ans)

Measured memory_bytes: 3188
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 998244353;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

ll dp[3010][3010];
ll sum[3010][3010];

int main(void) {

  ll n, s, a[4000];
  cin >> n >> s;
  rep(i, n) cin >> a[i];

  dp[0][0] = 1;
  for (int x = 1; x <= n; x++) {
    for (int y = 1; y <= s; y++) {
      if (y-a[x-1] == 0) {
	dp[x][y] = (ll)x;
      }
      if (y - a[x - 1] > 0) {
	dp[x][y] += sum[x-1][y-a[x-1]];
	dp[x][y] %= MOD;
	
      }
      sum[x][y] = (sum[x-1][y]+dp[x][y])%MOD;
    }
    
  }

  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += (dp[i][s] * (ll)(n - i + 1)) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
    
			       


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

int main(void){
	int k;
	string s;
	string ans;
	cin>>k;
	cin>>s;
	int sl=s.length();
	if(k<sl){
		ans = s.substr(0, k)+"...";
	}
	else{
		ans = s;
	}

	cout<<ans<<endl;

	return 0;
}	

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
 
int main() {

int n,k;
cin >> n >> k;
int x,sum=0;

for(int i=0;i<n;i++){
  cin >> x;
  if(k<x) sum += x-k;
  else if(x<k-x) sum += x;
  else sum += k-x;
}

cout << sum * 2;

}

Measured memory_bytes: 384
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif




#define int long long
#define rng(i,l,r) for(size_t i=(l);i<(r);++i)
#define rep(i,n) rng(i,0,n)
#define gnr(i,l,r) for(size_t i=(r)-1;i>=(l);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

using namespace std;
//using ll = long long;


const int MOD = 1000000007;
const int INF = 1e18;

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

const double pi = acos(-1);



template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


using Graph = vector<vector<int>>;



void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    map<int,int> store;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        store[a]++;
        store[a-1]++;
        store[a+1]++;
    }
    
    int ans = -1;
    for (auto itr = store.begin(); itr != store.end(); itr++) {
        ans = max(ans, itr->second);
    }
    
    
    
    cout << ans << endl;
    
}



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



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

using namespace std;

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

  vector<int> number;

  int temp;
  for(int i=0; i<num; ++i){
    cin >> temp;
    number.push_back(temp);
  }

  int sum = 0;
  for(auto v:number){
    sum += v;
  }

  if(sum % 2 == 0){ cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


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

int N, K;

int main()
{
	std::cin >> N >> K;
	for( int i = 0; i != K; ++i )
	{
		int a, b;
		std::cin >> a >> b;
		--a; --b;

		std::cout << std::min( std::min( a, N - 1 - a ), std::min( b, N - 1 - b ) ) % 3 + 1 << std::endl;
	}

	return 0;
}

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

int main() {
	int n,k;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++)
	cin>>arr[i];
	sort(arr,arr+n);
	int sum=0;
	for(int i=0;i<k;i++)
	sum+=arr[i];
	cout<<sum<<"\n";
	return 0;
}


Measured memory_bytes: 3624
s = input()

len_s = len(s)
for i in range(len_s):
    if s[i] == 'A':
        start = i
        break
for i in range(len_s - 1, -1, -1):
    if s[i] == 'Z':
        end = i
        break
print(end - start + 1)


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

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

#define fori(a, n) for(ll (a) = 0; a < (n); ++a)
#define forI(a, n) for(ll (a) = 1; a <= (n); ++a)
#define pll pair<ll, ll>
#define pt pair<ll, ll>
#define x first
#define ff first
#define y second
#define ss second

const ll MAXN = 1e5 + 1;
const ll INF = 9e18;
const ll mod = 1e9 + 7;

ll n, m;

struct SegTree{
    vector<ll> p, s;
    ll pr = 1;

    void build(vector<ll> &o){
        p[0] = s[s.size() - 1] = 1;
        for(ll i = 1; i < o.size(); ++i) p[i] = p[i - 1] * o[i - 1] % m;
        for(ll i = ll(o.size()) - 2; i >= 0; --i) s[i] = s[i + 1] * o[i + 1] % m;
    }

    SegTree(){}

    SegTree(vector<ll> &o){
        if(o.empty()) o.push_back(1);
        for(ll e: o) pr = pr * e % m;
        p.resize(o.size());
        s.resize(o.size());
        build(o);
    }

    ll q(ll i){
        return p[i] * s[i] % m;
    }
};

ll dp[MAXN];
ll num[MAXN];
ll ans[MAXN];
vector<ll> g[MAXN];
SegTree *children[MAXN];
ll p[MAXN];

void dfs(ll v, ll pr = -1){
    p[v] = pr;
    ll c = 1;
    vector<ll> ch;
    for(ll to: g[v]){
        if(to == pr) continue;
        dfs(to, v);
        c = c * dp[to] % m;
        num[to] = ch.size();
        ch.push_back(dp[to]);
    }
    children[v] = new SegTree(ch);
    dp[v] = c + 1;
}

void dfs2(ll v, ll fp, bool root = false){
    ll p_pr = fp;
    if(root){
        ans[v] = (dp[v] - 1 + m) % m;
    }else {
        ll ch_pr = children[v]->pr;
        //p_pr = children[p[v]]->q(1, 0, pall, 0, num[v]) % m;
        //p_pr = (p_pr * children[p[v]]->q(1, 0, pall, num[v] + 1, pall) % m * fp % m) % m;
        p_pr = fp;
        ans[v] = ch_pr * p_pr % m;
    }
    for(ll to: g[v]){
        if(to == p[v]) continue;

        dfs2(to, (p_pr * children[v]->q(num[to]) % m + 1) % m);
    }
}

void solve(){
    cin >> n >> m;
    fori(i, n - 1){
        ll a, b;
        cin >> a >> b;
        --a, --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    ll r00t = rand() % n;
    dfs(r00t);
    /*
    fori(i, n){
        if(i == r00t)
            cout << children[i]->q(1, 0, children[i]->t.size()/2, 0, children[i]->t.size()/2) << "\n";
        else {
            ll all = children[i]->t.size() / 2;
            ll ans = children[i]->q(1, 0, all, 0, all);
            ll pr = children[p[i]]->q(1, 0, all, 0, num[i]) % m;
            pr = (pr * children[p[i]]->q(1, 0, all, num[i] + 1, all) + 1) % m;
            cout << ans * pr % m << "\n";
        }
    }*/
    dfs2(r00t, 1, true);
    fori(i, n) cout << ans[i] << "\n";
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    solve();
}


Measured memory_bytes: 31744
h, w = map(int, input().split())
a = [''] * h
for i in range(h):
	a[i] = input()
 
row = [False] * h
col = [False] * w
for i in range(h):
	for j in range(w):
		if a[i][j] == '#':
			row[i] = True
			col[j] = True
 
for i in range(h):
	if row[i]:
		for j in range(w):
			if col[j]:
				print(a[i][j], end = '')
		print()

Measured memory_bytes: 9112
import java.util.Arrays;

public class Main {
  private static void solve() {
    int[] a = na(3);
    Arrays.sort(a);

    if (a[0] == a[1] && a[1] == a[2]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


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

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

//////////////////////////////////////////////////
//
// 要素個数カウント付き Union Find
//   -テンプレートで要素の型を指定。int か long あたりを想定
//   -コンストラクタで要素数 n を指定。0 ～ n - 1 までの要素が利用可能

#include <vector>
template<typename T_uf_data>

class UnionFind
{
private:

    std::vector<T_uf_data> par; // 親 (parent) 親がいない場合は -要素の個数
    std::vector<T_uf_data> rnk; // 要素を偏らせないためのもの

    // その値を持つグループのルートノードを返す
    T_uf_data find_root(int x)
    {
        if(par[x] < 0) {
            return x;
        } else {
            // 検索時に一番上の要素を指すように付け替える
            return par[x] = find_root(par[x]);
        }
    }

public:

    // コンストラクタの引数で要素数を指定
    UnionFind(int n) : par(n), rnk(n)
    {
        for(int i = 0; i < n; i++) {
            par[i] = -1; // 始めは -要素の個数 = -1 となる
            rnk[i] = 0;
        }
    }

    // 二つの要素をグループ化
    void Unite(int x, int y)
    {
        x = find_root(x);
        y = find_root(y);
        if(x == y) return;

        if(rnk[x] < rnk[y]) {
            // y が親になる
            par[y] += par[x]; // 要素の個数を足し合わせる
            par[x] = y;
        } else {
            // x が親になる
            par[x] += par[y]; // 要素の個数を足し合わせる
            par[y] = x;
            // 深さに差が無かった場合だけ長さが１増える
            if(rnk[x] == rnk[y]) rnk[x]++;
        }
    }

    // x と y が同じグループかを返す
    bool isSameGroup(int x, int y)
    {
        return find_root(x) == find_root(y);
    }

    // x を含むグループの要素数を返す
    int Size(int x)
    {
        return -par[find_root(x)];
    }
};
//////////////////////////////////////////////////



int main()
{
    int N, M, A[100001], B[100001];
    long long ans[100001];

    cin >> N >> M;
    UnionFind<int> uf(100001);

    for(int i = 1; i <= M; i++) {
        cin >> A[i] >> B[i];
    }
    ans[M] = (long long)N * (N - 1) / 2;

    for(int i = M - 1; i >= 1; i--) {
        ans[i] = ans[i + 1];
        if(!uf.isSameGroup(A[i + 1], B[i + 1])) {
            ans[i] -= (long long)uf.Size(A[i + 1]) * uf.Size(B[i + 1]);
            uf.Unite(A[i + 1], B[i + 1]);
        }
    }

    for(int i = 1; i <= M; i++) {
        cout << ans[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main() {
    string s, t;
    cin >> s >> t;
    vector<string> ans;
    rep (i, s.size() - t.size() + 1) {
        rep (j, t.size()) {
            if (t[j] != s[i+j] && s[i+j] != '?') {
                break;
            }
            if (j == t.size() - 1) {
                string u = s;
                rep (k, u.size()) {
                    if (i <= k && k < i + t.size()) {
                        u[k] = t[k-i];
                    }
                    else if (u[k] == '?') {
                        u[k] = 'a';
                    }
                }
                ans.push_back(u);
            }
        }
    }
    sort(all(ans));
    if (ans.size() == 0) {
        cout << "UNRESTORABLE" << endl;
    }
    else {
        cout << ans[0] << endl;
    }
}


Measured memory_bytes: 256