akhauriyash/Code-Regression huggingface dataset:
//#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#define MAX_INT 2100000000
using namespace std;
typedef long long int ll;
int main()
{
	int h, w, i, j, k, n = 0, dx[4] = { 0, -1, 0, 1 }, dy[4] = {1,0,-1,0},now=1,ans=0;
	static int a[1010][1010];
	char c;
	queue<pair<int,int> > q;
	cin >> h >> w;
	for (i = 1; i <= h; i++)
	{
		for (j = 1; j <= w; j++)
		{
			cin >> c;
			if (c == '#')
			{
				a[i][j] = 1;
				q.push(make_pair(i, j));
			}
			if (c == '.') a[i][j] = 0;
		}
	}
	while (q.size())
	{
		pair<int, int> p;
		p = q.front();
		q.pop();
		int kuro = 0;
		for (int i = 0; i < 4; i++)
		{
			if (1 <= p.first + dy[i] && p.first + dy[i] <= h && 1 <= p.second + dx[i] && p.second + dx[i] <= w)
			{
				if (a[p.first + dy[i]][p.second + dx[i]]==0)
				{
					kuro++;
					a[p.first + dy[i]][p.second + dx[i]] = a[p.first][p.second] + 1;
					q.push(make_pair(p.first + dy[i], p.second + dx[i]));
				}
			}
		}
	}
	for (i = 1; i <= h; i++)
	{
		for (j = 1; j <= w; j++)
		{
			ans=max(a[i][j],ans);
		}
	}
	cout << ans-1 << endl;
}

Measured memory_bytes: 12432
#include <stdio.h>

int main(void){
  int k, s, x, y, z;
  scanf("%d %d", &k, &s);
  int num = 0;
  for(x = 0; x <= k; x++){
    for(y = 0; y <= k; y++){
      z = s - x - y;
      if(z >= 0 && z <= k) num++;
    }
  }

  printf("%d\n", num);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
const int N=200;
struct dat{
    int x,y;
    dat(){}
    dat(int x,int y):
        x(x),y(y){}
    bool operator < (const dat &r) const
    {
        return y>r.y;
    }
};
int n;
int a[N];
char s[N],ch[N],ans[N][N],tem[N];
priority_queue<dat> q;
int main()
{
    setbuf(stdout,NULL);
    for(int k=1;k<=26;k++)
        ch[k]='a'+k-1;
    for(int k=1;k<=26;k++)
        ch[k+26]='A'+k-1;
    for(int k=0;k<=9;k++)
        ch[k+53]='0'+k;
    for(int k=1;k<=62;k++)
    {
        for(int i=1;i<=128;i++)
            s[i]=ch[k];
        s[129]='\0';
        printf("? %s\n",s+1);
        scanf("%d",&a[k]);
        a[k]=128-a[k];
        n+=a[k];
        if(a[k]) q.push(dat(k,a[k]));
    }
    for(int k=1;k<=62;k++)
        for(int i=1;i<=a[k];i++)
            ans[k][i]=ch[k];
    while(q.empty()==0)
    {
        int x=q.top().x;
        q.pop();
        if(q.empty())
        {
            ans[x][a[x]+1]='\0';
            printf("! %s\n",ans[x]+1);
            break;
        }
        int y=q.top().x;
        q.pop();
        int u=1,v=1,cnt=0;
        while(u<=a[x]&&v<=a[y])
        {
            int cntt=0;
            for(int k=1;k<=cnt;k++)
                s[++cntt]=tem[k];
            s[++cntt]=ans[y][v];
            for(int k=u;k<=a[x];k++)
                s[++cntt]=ans[x][k];
            s[cntt+1]='\0';
            printf("? %s\n",s+1);
            int w;
            scanf("%d",&w);
            if(w>n-cntt) tem[++cnt]=ans[x][u++];
            else tem[++cnt]=ans[y][v++];
        }
        while(u<=a[x]) tem[++cnt]=ans[x][u++];
        while(v<=a[y]) tem[++cnt]=ans[y][v++];
        for(int k=1;k<=cnt;k++)
            ans[x][k]=tem[k];
        a[x]=cnt;
        q.push(dat(x,a[x]));
    }
    return 0;
}


Measured memory_bytes: 3840
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;


public class Main {

	/**
	 * @param args
	 */
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(true){
			int n = Integer.parseInt(sc.nextLine());
			if(n==0)break;
			String[][] ss = new String[n][];
			TreeMap<String,Integer>[]map=new TreeMap[26];
			for (int i = 0; i < map.length; i++) {
				map[i]=new TreeMap<String,Integer>();
			}
			for(int i=0;i<n;i++){
				ss[i]=sc.nextLine().split(" ");
				for (int j = 0; j < ss[i].length; j++) {
					int num = ss[i][j].charAt(0)-'a';
					if(map[num].containsKey(ss[i][j])){
						map[num].put(ss[i][j], map[num].get(ss[i][j])+1);
					} else{
						map[num].put(ss[i][j], 1);
					}
				}
			}
			int num = sc.nextLine().charAt(0)-'a';
			if(map[num].entrySet().size()==0){
				System.out.println("NA");
			} else {
				int max=-1;
				SI[] si = new SI[map[num].entrySet().size()];
				int i=0;
				for(Entry<String,Integer> e:map[num].entrySet()){
					si[i]=new SI();
					si[i].n=e.getValue();
					si[i].s=e.getKey();
					i++;
				}
				Arrays.sort(si,new Comparator<SI>(){

					@Override
					public int compare(SI arg0, SI arg1) {
						if(arg0.n!=arg1.n){
							return arg1.n-arg0.n;
						}
						return arg0.s.compareTo(arg1.s);
					}
					
				});
				StringBuffer sb=new StringBuffer();
				for(i=0;i<si.length;i++){
					sb.append(" ");
					sb.append(si[i].s);
					if(i==4)break;
				}
				System.out.println(sb.toString().substring(1));
			}
		}
	}
	static class SI{
		String s;
		int n;
	}
}

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

using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; i++) cin >> l[i];
    sort(l.begin(), l.end());
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if (l[i] + l[j] > l[k] && l[i] != l[j] && l[j] != l[k]) cnt++;
            }
        }
    }
    cout << cnt << "\n";
}


Measured memory_bytes: 3628
use std::io::prelude::*;

fn input<T>() -> T
where T: std::str::FromStr {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n = input::<usize>().to_string();
    let rev = n.chars().rev();
    if n.chars().collect::<Vec<_>>() == rev.collect::<Vec<_>>() {
        println!("Yes");
    } else {
        println!("No");
    }
}

Measured memory_bytes: 4352
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

int main()
{
	long long int n, a[100000], d, sum=0;
  scanf("%lld", &n);
  for(int i=0; i<n; i++){
    scanf("%lld", &a[i]);
    sum=sum+a[i];
  }
  long long int m;
  if(sum%(n*(n+1)/2)!=0){
    printf("%s\n", "NO");
    return 0;
  }
  m=sum/(n*(n+1)/2);
  
  long long int maxnum[100000]={};
  for(int i=0; i<n; i++){
    if(i<n-1){
      d=a[i+1]-a[i];
      if(m-d<0 || (m-d)%n!=0){
        printf("%s\n", "NO");
        return 0;
      }
      maxnum[i]=(m-d)/n;
    }else{
      d=a[0]-a[n-1];
      if(m-d<0 || (m-d)%n!=0){
        printf("%s\n", "NO");
        return 0;
      }
      maxnum[i]=(m-d)/n;
    }
  }
  long long int a0=0;
  for(int i=0; i<n; i++){
    a0=a0+(n-i)*maxnum[i];
  }
  if(a0!=a[0]){
    printf("%s\n", "NO");
  }else{
    printf("%s\n", "YES");
  }
  
	return 0;
}


Measured memory_bytes: 1664
n, k = gets.split(" ").map(&:to_i)
p_arr = gets.split(" ").map(&:to_i)
c_arr = gets.split(" ").map(&:to_i)

# p_arrの中でループするものに分割
loop_arr = []
s = []
p_arr.each do |pi|
  ind = pi - 1
  next if s.include?(ind)
  parr = []
  carr = []
  n.times do
    break if s.include?(ind)
    s << ind
    parr << parr.length + 1
    carr << c_arr[ind]
    ind = p_arr[ind] - 1
  end
  parr[-1] = 0
  loop_arr << [parr, carr]
end

max_score = -1_000_000_000
# ループごとに最大値を求める
loop_arr.each do |parr, carr|
  m = parr.length
  k1 = k % m + m
  r = k / m - 1
  sum = carr.sum
  add = sum > 0 ? sum * r : 0

  max = -1_000_000_000
  m.times do |i|
    ind = i
    score = 0
    k1.times do
      ind = parr[ind]
      score += carr[ind]
      max = score if max < score
    end
  end
  max += add
  max_score = max if max_score < max
end
puts max_score


Measured memory_bytes: 15096
s = input()
count = 0
player = ['First', 'Second']

ans = 0
while ans == 0:
    if len(s) == 2:
        ans = player[(count+1)%2]
    else:
        for i in range(1, len(s)-1):
            if s[i-1]!=s[i+1]:
                s = s[:i]+s[i+1:]
                break
        else:
            ans = player[(count+1)%2]
    count += 1
print(ans)#winner

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

#define int long long
#define pb push_back
#define ld long double

using namespace std;

const int MAXN = 1048576 , MOD = 1e9 + 7 ;

int32_t main() 
{
    ios::sync_with_stdio(0); 
    int n , k ; 
    int a[2] = {} , x ; 
    cin >> n >> k ; 
    for(int i = 0 ; i < n ; i ++ )
        cin >> x , a[x%2] ++ ; 
    if(k==1&&a[1]==0) return cout << 0 << endl , 0 ; 
    int ans = 1 ; 
    if(a[1]==0) n ++ ; 
    for(int i = 0 ; i < n - 1 ; i ++ ) ans *= 2 ;
    cout << ans << endl ; 
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;  // or pb_ds;

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#ifndef DEBUG
#define endl "\n"
#endif
#define fff ff
#define sss ss.ff
#define ttt ss.ss
#define INF (1 << 30)
#define LLF (1ll << 60)
#define PRIME (1000000007)
#define FASTIO std::ios::sync_with_stdio(false)
#ifdef DEBUG
#define debug(x) cerr << #x << " = " << x << endl
#else
#define debug(x)
#endif
#define rep(i, begin, end)                            \
  for (__typeof(end) i = (begin) - ((begin) > (end)); \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define FILE_INPUT                  \
  freopen("input.txt", "r", stdin); \
  freopen("output.txt", "w", stdout)

#define all(x) x.begin(), x.end()

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<string> vs;

template <typename T, typename B = null_type>
using oset =
    tree<T, B, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order / order_of_key

const ld eps = 1e-12;

/*-----------------END TEMPLATE-----------------*/

vi vals;
vi valsR;

int(((((((((((((((main)))))))))))))))() {
  FASTIO;
  ll a, b;
  cin >> a >> b;
  cout << max({a + b, a - b, a * b});
}

/*

0 1 2 3 4
      x

*/

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

int main(){
    int x, y;
    scanf("%d %d", &x, &y);
    if((x==1 || x== 3 || x==5 || x==7 || x==8 || x==10 || x==12)&&(y==1 || y== 3 || y==5 || y==7 || y==8 || y==10 || y==12))
        printf("Yes\n");
    else if((x==4|| x==6 || x==9|| x==11)&&(y==4|| y==6 || y==9|| y==11))
        printf("Yes\n");
    else
        printf("No\n");
    
    return 0;
	
}


Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

ll n;
vl a;

int main(){
  cin >> n;
  a.resize(n);
  rep(i, n) cin >> a[i];
  sort(all(a));
  ll ans = 1;

  bool flag = false;

  if(n % 2 == 1){
    if(a[0] != 0) flag = true;
    for(int i = 1; 2*i < n; i++){
      if(!(a[2*i] == 2*i && a[2*i-1] == 2*i)) flag = true;
    }
    if(flag){
      cout << 0 << endl;
      return 0;
    }
    for(int i = 1; 2*i < n; i++){
      ans *= 2;
      ans = ans % DIV;
    }
  }

  else{
    for(int i = 0; 2*i < n; i++){
      if(!(a[2*i] == 2*i+1 && a[2*i+1] == 2*i+1)) flag = true;
    }
    if(flag){
      cout << 0 << endl;
      return 0;
    }
    for(int i = 1; 2*i <= n; i++){
      ans *= 2;
      ans = ans % DIV;
    }
  }

  cout << ans << endl;

}


Measured memory_bytes: 1024
// import std = require('tstl')

{
  type Print = void | string | number | string[] | number[]
  let outs: Print[] = []

  const main = (): Print => {
    const r = _io()
    const [s] = r.ss()
    const lib = {
      RRR: 3,
      SRR: 2,
      RRS: 2,
      RSS: 1,
      SRS: 1,
      SSR: 1,
      RSR: 1,
      SSS: 0,
    }

    return lib[s]
  }

  const _io = (i = 0) => {
    const str: string = require('fs').readFileSync('/dev/stdin', 'utf8')
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')

    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map((v) => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  outs.push(main())

  console.log(
    outs
      .map((line) => (typeof line === 'object' ? line.join(' ') : String(line)))
      .join('\n')
  )
}


Measured memory_bytes: 29680
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define repe1(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

int main() {
  int n,h,w;
  cin >> n >> h >> w;
  cout << (n-h+1)*(n-w+1) << "\n";
}


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


def main():
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
    g = [set() for _ in [0]*n]
    [g[a-1].add(b-1) for a, b in ab]
    [g[b-1].add(a-1) for a, b in ab]
    only = []
    sign = [False]*n
    for i in range(n):
        if len(g[i]) == 1:
            only.append(i)
    while only:
        i = only.pop()
        if not g[i]:
            print("Second")
            return
        j = g[i].pop()
        g[j].remove(i)
        if sign[i] and not g[j]:
            print("First")
            return
        if not sign[i] and sign[j]:
            print("First")
            return
        if not sign[j] and not sign[i]:
            sign[j] = True
        if len(g[j]) == 1:
            only.append(j)


main()


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

int main() {
	
	string s;
	cin >> s;
	
	for(int i=1; i<4; i++){
		if(s[i] == s[i-1]){
			puts("Bad");
			return 0;
		}
	}
	puts("Good");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long 
#define N 1000005
using namespace std;
LL int n,ar[N],sum;
char c[N];
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&ar[i]);
	for(int i=1;i<=n;i++)
	{
		sum+=ar[i]/2;
		if(ar[i]%2 && ar[i+1])
			sum++,ar[i+1]--;
	}
	printf("%lld",sum);
}


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

int main(){
  int N, t, x, y, tb = 0, lb = 0, l, f = 0;
  cin >> N;
  
  for (int i = 0; i < N; i++){
    cin >> t >> x >> y;
    l = x + y;
    if (l % 2 != t % 2){
      f = 1;
      break;
    }
    else if (abs(l - lb) > t - tb){
      f = 1;
      break;
    }
    tb = t;
    lb = l;
  }
  
  if (f == 1){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<ll, ll> pii;
typedef vector<vector<ll>> mat;
const ll mod = 1e9+7;
const int MAXN = 1*1e5+5;

double ev[305][305][305], pb[305][305][305];

int32_t main() {
	
	int n;
	cin >> n;
	vector<int> cont(4, 0);
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		cont[x]++;
	}
	
	pb[cont[1]][cont[2]][cont[3]] = 1;
	
	for(int c = n; c >= 0; c--) 
		for(int b = n; b >= 0; b--)
			for(int a = n; a >= 0; a--) {
				if(!a && !b && !c) continue;
				if(a + b + c > n) continue;
				
				double pw = (double) (n - (a+b+c)) / n;
				double expw = pw / (1.0 - pw) + 1.0;
				
				ev[a][b][c] += expw * pb[a][b][c]; 
				
				if(a != 0) {
					double p_to = (double) a / (a+b+c);
					ev[a-1][b][c] += ev[a][b][c] * p_to;
					pb[a-1][b][c] += pb[a][b][c] * p_to;
				}
				if(b != 0) {
					double p_to = (double) b / (a+b+c);
					ev[a+1][b-1][c] += ev[a][b][c] * p_to;
					pb[a+1][b-1][c] += pb[a][b][c] * p_to;
				}
				if(c != 0) {
					double p_to = (double) c / (a + b + c);
					ev[a][b+1][c-1] += ev[a][b][c] * p_to;
					pb[a][b+1][c-1] += pb[a][b][c] * p_to;
				}
				
			}
	cout << fixed << setprecision(10) << ev[0][0][0] << endl;
	
}


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

int card[13];

void c_card(){
  for(int i=0; i<13; i++){
    card[i]=0;
  }
}

void judge(){
  int count2=0, count3=0;
  bool flag = false;
  for(int i=0; i<13; i++){
    if(card[i] == 2){ count2++; flag = true; }
    if(card[i] == 3){ count3++; flag = true; }
    if(card[i] == 4){ cout << "four card" << endl; flag = true;}

    if(card[i%13]== 1 && card[(i+1)%13]==1 && card[(i+2)%13]==1 && card[(i+3)%13]==1 && card[(i+4)%13]==1){
      if(card[10]==1 && card[11]==1 && card[12]==1 && card[0]==1 && card[1]==1){
	continue;
      }
      else{
	cout << "straight" << endl;
	flag = true;
      }
    }

  }
  
  if(count2==1 && count3==0) cout << "one pair" << endl;
  if(count2==2) cout << "two pair" << endl;
  if(count2==0 && count3==1) cout << "three card" << endl;
  if(count2==1 && count3==1) cout << "full house" << endl;

  if(!flag) cout << "null" << endl;
}


int main(){
  int c[5];
  while(scanf("%d,%d,%d,%d,%d",&c[0],&c[1],&c[2],&c[3],&c[4])!=EOF){
    c_card();
    for(int i=0; i<5; i++)
      card[c[i]-1]++;

    judge();

  }
}

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

using namespace std;

int main()
{
  string s;
  cin >> s;
  for(int i = 0; i < s.length(); i++)
  {
    if(i % 2) if(s[i] == 'R') {
	cout << "No" << endl;
	return 0;
      }
    if(i % 2 == 0) if(s[i] == 'L') {
	cout << "No" << endl;
	return 0;
      }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<map>
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)

using namespace std;
#define fin(ans) cout << (ans) << '\n'
int main()
{
    int A,B,T;
    int ans;
    cin >> A >> B >> T;
    ans = T/A*B;
    fin(ans);

    return 0;
}

Measured memory_bytes: 3164
S = list(map(int, list(input())))

last = S[0]
n_change = 0
for idx, current in enumerate(S):
    if idx == 0:
        continue
    if current == last:
        current = 0 if current == 1 else 1
        S[idx] = current
        n_change += 1
    last = current

print(n_change)

Measured memory_bytes: 4652
program main
    implicit none
    integer:: N
    integer, allocatable:: H(:)
    integer:: c_move, max_move, i

    read*, N
    allocate(H(N))
    read*, H(1:N)
    ! print*, H(1:N)
    c_move = 0
    max_move = 0


    do i = 1, N-1
        ! print*, '--- ---', c_move, max_move
        ! print*, H(i),H(i+1)
        if( H(i) >= H(i+1) ) then
            ! print*, 'down'
            c_move = c_move + 1
        else
            ! print*, 'no_down'
            if (c_move > max_move) then
                ! print*, 'renew'
                max_move = c_move
            endif
            c_move = 0
        endif
    enddo

    if (c_move > max_move) then
        max_move = c_move
    endif

    print'(i0)', max_move
end program

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    int a,b,k;
    cin>>k>>a>>b;
    for (int i = a; i <= b; ++i)
    {
    	if(i%k==0){
    		cout<<"OK\n";
    		return 0;
    	}
    }
    cout<<"NG\n";
 	return 0;
}

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

typedef long long ll;

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

const ll MAX = 10000000;
long long fac[MAX], finv[MAX], inv[MAX];

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long f_pattern(ll r, ll c){
    return COM(r+c,r) % MOD;
}

int main()
{
    ll r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;

    Fill(fac, 0);
    Fill(finv, 0);
    Fill(inv, 0);
    // // 前処理
    COMinit();

    ll r2c2 = 0;
    ll r1c2 = 0;
    ll r2c1 = 0;
    ll r1c1 = 0;

    // for(ll i=1; i<=c2+1; i++){
    //     r2c2 = (r2c2 +f_pattern(r2,i)) % MOD;
    // }
    // for(ll i=1; i<=c2+1; i++){
    //     r1c2 = (r1c2 +f_pattern(r1-1,i)) % MOD;
    // }
    // for(ll i=1; i<=c1; i++){
    //     r2c1 = (r2c1 +f_pattern(r2,i)) % MOD;
    // }
    // for(ll i=1; i<=c1; i++){
    //     r1c1 = (r1c1 + f_pattern(r1-1,i)) % MOD;
    // }

    r2c2 = f_pattern(r2+1,c2+1) % MOD;
    r1c2 = f_pattern(r1,c2+1) % MOD;
    r2c1 = f_pattern(r2+1,c1) % MOD;
    r1c1 = f_pattern(r1,c1) % MOD;

    cout << (((r2c2 + r1c1) % MOD) + MOD - ((r1c2 + r2c1) % MOD)) % MOD << endl;
    return 0;
}

Measured memory_bytes: 234752
#include <stdio.h>
 
int main(void){
    int hotel[4][3][10],i,j,k,test,b,f,r,v;
    for(i=0;i<4;i++){
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                hotel[i][j][k]=0;
            }
        }
    }
    scanf("%d",&test);
    for(i=0;i<test;i++){
        scanf("%d %d %d %d",&b,&f,&r,&v);
        hotel[b-1][f-1][r-1]+=v;
    }
    for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                printf(" %d",hotel[0][j][k]);
            }
            printf("\n");
        }
    for(i=1;i<4;i++){
        printf("####################\n");
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                printf(" %d",hotel[i][j][k]);
            }
            printf("\n");
        }
    }
    return 0;
}



Measured memory_bytes: 2052
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  string s;
  cin >> s;
  vector<string> t;
  t={"KIHBR","KIHBRA","KIHBAR","KIHBARA","KIHABR","KIHABRA","KIHABAR","KIHABARA","AKIHBR","AKIHBRA","AKIHBAR","AKIHBARA","AKIHABR","AKIHABRA","AKIHABAR","AKIHABARA"};
  bool ans = false;
  for(int i=0;i<16;i++){
    if(s==t[i]){
      ans = true;
      break;
    }
  }
  puts(ans?"YES":"NO");
}

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

#define LL long long



int main(){
	int box[3];
	scanf("%d %d %d", &box[0], &box[1], &box[2]);

	swap(box[0], box[1]);
	swap(box[0], box[2]);

	printf("%d %d %d", box[0], box[1], box[2]);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(int i = (k); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pdd;
 

int main(){
    ll n,mod=1000000007;
    cin>>n;
    vector<ll> dist(n-1);
    ll a,b;cin>>a;
    rep(i,n-1){
        cin>>b;
        dist[i]=b-a;
        a=b;
    }
    ll ans=dist[0];
    ll ex=1,ls=1;
    rept(i,2,n){
        ex=ex*(i-1)%mod;
        ls =(ls*i+ex)%mod;
        ans = (ans*i+dist[i-1]*ls)%mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
a,b=map(int,input().split())
lst=[0 for _ in range(10**4,10**5)]

for i,_ in enumerate(lst):
  w=str(10**4+i)
  if w[0]==w[-1] and w[1]==w[-2]:
    lst[i]=1

print(sum(lst[a-10**4:b+1-10**4]))

Measured memory_bytes: 10384
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

int n;
vector<int> vp;

void input() {
	cin >> n;
	for(int i = 0; i < n; i++){
	    int p;
	    cin >> p;
	    vp.push_back(p);
	}
}

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	input();
 
	sort(vp.begin(), vp.end());
	
	int sum = 0;
	for(int i = 0; i < n - 1; i++){
	    sum += vp.at(i);
	}
	sum += vp.at(n - 1) / 2;
	
	cout << sum << "\n";
 
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
const int INF = 1e9+7;

int main() {
  int n; cin >> n;
  int c = 0;
  rep(i,n) {
    int a; cin >> a;
    if (i%2==0 && a%2==1) c++;
  }

  cout << c << endl;
}


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

const int lim = 1e5, M = 1 << 9;

#define LL long long

int n, q;
int dep[1 << 18 | 5];
int v[1 << 18 | 5], w[1 << 18 | 5];
LL f[M + 1][lim + 5];

inline int read()
{
	int num = 0, f = 1;
	char ch = getchar();
	while( !isdigit( ch ) ) { if(ch == '-') f = -1; ch = getchar(); }
	while( isdigit( ch ) ) num = (num << 3) + (num << 1) + (ch ^ 48), ch = getchar();
	return num * f;
}

inline LL dfs(int x, int L)
{
	if(x <= M) return f[x][L];
	LL ans = dfs(x >> 1, L);
	if(L >= w[x]) ans = max(ans, dfs(x >> 1, L - w[x]) + v[x]);
	return ans;
}

int main()
{
	n = read();
	for(int i = 1; i <= n; i++) v[i] = read(), w[i] = read();
	
	for(int i = 1; i <= n; i++) dep[i] = dep[i >> 1] + 1;

	for(int i = 1; i <= min(n, M); i++)
		for(int j = 0; j <= lim; j++)
			if(j < w[i]) f[i][j] = f[i >> 1][j];
			else f[i][j] = max(f[i >> 1][j], f[i >> 1][ j - w[i] ] + v[i]);

	q = read();
	while(q --)
	{
		int x = read(), L = read();
		printf("%lld\n", dfs(x, L));
	}
	return 0;
}


Measured memory_bytes: 406696
H, W, K = [int(_) for _ in input().split()]
C = []
for i in range(H):
  c = input()
  C.append(c)

ans = 0
for i in range(2**H):
  for j in range(2**W):
    count = 0
    for row in range(H):
      for col in range(W):
        if i >> row & 1 and j >> col & 1:
          if C[row][col] == "#":
            count += 1
    if count == K:
      ans += 1
print(ans)


Measured memory_bytes: 68416
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll mod = 1000000007;
ll INF = 1000000009;

void solve(){
    string s;
    ll k;
    cin >> s >> k;
    int t = s.size();
    int tmp =min((ll)t, k);
    bool b=true;
    char c;
    rep(i,tmp){
        if(s[i]!='1') {
            b = false;
            c = s[i];
            break;
        }
    }
    if(b) cout << "1" << endl;
    else cout << c << endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(void) {
	string s;
	cin >> s;
	if (s[0]==s[1] && s[1]==s[2]) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<size_t I,class H,class...T>struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template<class H,class...T>struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template<class...T>istream&operator>>(istream&i,tuple<T...>&t){t=TupleReaderWriter<sizeof...(T),T...>::r(i);return i;}
template<class...T>ostream&operator<<(ostream&o,tuple<T...>&t){string delim=" ";TupleReaderWriter<sizeof...(T)-1,T...>::w(o,t,delim);return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int x;fixprec(int d):x(d){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.x);}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
/*!* [union_find] *!*/
/*+* UnionFind 木 *+*/
// T (typename) : グラフの頂点を表す型, (int)parent を持つ必要あり
template <typename T>
struct UnionFind {
    vector<T> &u;
    UnionFind(vector<T> &u) : u(u) {
        for (int i = 0; i < u.size(); i++) {
            u[i].parent = i;
        }
    }
    int root(int x) {
        if (x < 0 || u.size() <= x) return -1;
        else if (x == u[x].parent) return x;
        else return u[x].parent = root(u[x].parent);
    }
    bool connect(int a, int b) {
        a = root(a), b = root(b);
        if(a == b) {
            if(u[b].e + 1 > u[b].v) {
                return false;
            }
            u[b].e++;
        } else {
            if(u[a].e + u[b].e + 1 > u[a].v + u[b].v) {
                return false;
            }
            u[b].parent = a;
            u[a].e += u[b].e + 1;
            u[a].v += u[b].v;
        }
        return true;
    }
};
using Data = tuple<i64, i64, i64>;
struct Node {
    int parent;
    int e;
    int v;
};
int main() {
    int N, H, W;
    cin >> N >> H >> W;
    vector<Node> node(H + W, {0, 0, 1});
    vector<Data> A(N);
    UnionFind<Node> uf(node);
    for(auto &x : A) {
        i64 r, c, a;
        cin >> r >> c >> a;
        r--, c--;
        x = make_tuple(a, r, H + c);
    }
    i64 ans = 0;
    sort(REV_WHOLE(A));
    for(auto x : A) {
        i64 a, r, c;
        tie(a, r, c) = x;
        ans += uf.connect(r, c) ? a : 0;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 5248
#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, n;
  cin >> x >> n;
  vector<int> d(101, 0);
  rep(i,n) {
    int p;
    cin >> p;
    d[p] = 1;
  }
  P ans(99999, -1);
  for (int i = 0; i <= 101; ++i) {
    if (d[i] == 1) continue;
    int dif = abs(x-i);
    ans = min(ans, P(dif,i));
  }
  cout << ans.second << endl;
  return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<string> vs;
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  string s, t;
  cin >> s >> t;
  t.erase(s.size());
  if(s == t) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3628
N=int(input())
M=int(pow(N, 1/2))
ans=[0]*(N+1)
for x in range(1, M+1):
  for y in range(1, M+1):
    for z in range(1, M+1):
      tmp=x**2+y**2+z**2+x*y+y*z+z*x
      if tmp<=N:
        ans[tmp]+=1
print(*ans[1:], sep='\n')

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

using Weight=long long;
struct Edge{
    int from,to;
    Weight c;
};
bool operator<(const Edge &lhs,const Edge &rhs){
    return lhs.c<rhs.c;
}
bool operator>(const Edge &lhs,const Edge &rhs){
    return lhs.c>rhs.c;
}

using Edges=vector<Edge>;
using Graph=vector<Edges>;

Graph MST(int n,Graph& g){
    vector<int> used(n,false);
    priority_queue<Edge,vector<Edge>,greater<>> que;
    que.push({-1,0,0});
    Graph res(n);
    while(!que.empty()){
        Edge ret=que.top();
        que.pop();
        int f=ret.from;
        int v=ret.to;
        Weight c=ret.c;
        if(used[v]) continue;
        used[v]=true;
        if(f!=-1){
            res[f].push_back(Edge{f,v,c});
            res[v].push_back(Edge{v,f,c});
        }
        for(int i=0;i<g[v].size();i++){
            que.push(g[v][i]);
        }
    }
    return res;
}
int main(){
    int n,m;;
    cin>>n>>m;
    Graph g(n);
    for(int i=0;i<m;i++){
        int a,b;
        Weight c;
        cin>>a>>b>>c;
        a--,b--;
        g[a].push_back(Edge{a,b,c});      
        g[b].push_back(Edge{b,a,c});
    }
    
    Graph mst=MST(n,g);
    Edges edges;
    for(int i=0;i<mst.size();i++){
        for(int j=0;j<mst[i].size();j++) edges.push_back(mst[i][j]);
    }
    sort(edges.begin(),edges.end(),greater<>());
    
    auto adder=[](Weight lhs,Edge& e){
        return lhs+e.c;
    };
    Weight sum=accumulate(edges.begin(),edges.end(),0LL,adder)/2;
    
    vector<vector<Weight>> sc(n,vector<Weight>(n,0));
    vector<vector<int>> slash(n,vector<int>(n,false));

    function<void(int,int,vector<int>&)> dfs=[&](int v,int pre,vector<int>& vs){
        vs.push_back(v);
        for(int i=0;i<mst[v].size();i++){
            if(mst[v][i].to!=pre && !slash[v][mst[v][i].to]){
                dfs(mst[v][i].to,v,vs);
            }
        }
        return;
    };

    for(int i=0;i<edges.size();i++){
        int v0=edges[i].from;
        int v1=edges[i].to;
        Weight c=edges[i].c;
        slash[v0][v1]=true;
        slash[v1][v0]=true;
        vector<int> v0s;
        vector<int> v1s;
        dfs(v0,-1,v0s);
        dfs(v1,-1,v1s);
        for(int j=0;j<v0s.size();j++){
            for(int k=0;k<v1s.size();k++){
                sc[v0s[j]][v1s[k]]=c;
                sc[v1s[k]][v0s[j]]=c;
            }
        }
    }

    int q;
    cin>>q;
    for(int i=0;i<q;i++){
        int s,t;
        cin>>s>>t;
        s--,t--;
        cout<<sum-sc[s][t]<<endl;
    }
    return 0;
}

Measured memory_bytes: 207140
while True:
    a, op, b = input().split()
    
    a = int(a)
    b = int(b)
    
    if op == "?":
        break
    elif op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    elif op == "*":
        print(a*b)
    elif op == "/":
        print(int(a/b))


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

#define vi vector<int>
#define vl vector<long long>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define MOD 1e9+7

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 (a>b) {
        a = b;
        return true;
    }
    return false;
}

const int MAX_N = 50010;
const int MAX_M = 25;
int dp[MAX_M][MAX_N];
vector<int> value;
int n, m;

//dp[i+1][v]:i番目までのコインを使ってv円を作れる最小の枚数
void coin() {
    dp[0][0] = 0;
    REP(v, n+1) dp[1][v] = v;
    FOR(i, 1, m) {
        REP(v, n+1) {
            if (v >= value[i]) dp[i+1][v] = min(dp[i+1][v-value[i]]+1, dp[i][v]);
            else dp[i+1][v] = dp[i][v];
        }
    }
}

int main() {
    cin >> n >> m;
    int v;
    value.push_back(1);
    REP(i, m) {
        cin >> v;
        if (v == 1) continue;
        value.push_back(v);
    }

    coin();
    cout << dp[m][n] << endl;

    return 0;
}


Measured memory_bytes: 7060
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

int main(){
  long long a, b, k;
  cin >> a >> b >> k;
  if(a <= k){
    if(a+b <= k) b = 0;
    else b -= (k-a);
    a = 0;
  }
  else{
    a -= k;
  }
  cout << a << ' ' << b << endl;
}


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

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

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        string str; cin >> str;
        int sum = 0;
        for (int i = 0; i < sz(str); i++) (sum += str[i] - '0') %= 9;
        if (sum) cout << "No";
        else cout << "Yes";
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


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

int a[55],b[55],c[55],d[55],n,m,q,x[15],sol=0;
void bkt(int poz,int val)
{
    x[poz]=val;
    if(poz==n)
    {
        int nr=0;
        for(int i=1;i<=q;i++)
        {
            if(x[b[i]]-x[a[i]]==c[i])
            {
                nr=nr+d[i];

            }
        }
        sol=max(sol,nr);
        return;
    }
    for(int i=val;i<=m;i++)
    {
        bkt(poz+1,i);
    }
}
int main()
{

   cin>>n>>m>>q;
   for(int i=1;i<=q;i++)
   {
       cin>>a[i]>>b[i]>>c[i]>>d[i];

   }
   bkt(0,1);
   cout<<sol;







}


Measured memory_bytes: 3632
// package app;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        // long N = sc.nextLong();
        // long K = sc.nextLong();
        int N = sc.nextInt();

        double[] A = new double[N];

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

        double result = 0;

        for (int i = 0; i < N; i++) {
            result += 1.0 / A[i];
        }

        result = 1.0 / result;

        System.out.println(result);

    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
    string ans = "APPROVED";

    int N; cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; ++i){
        cin >> A[i];
    }

    for(int i=0; i < N; ++i){
        if( A[i]%2 == 0){
            if( A[i] % 3 != 0 && A[i] % 5 !=0 ){
                ans = "DENIED";
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define lli long long int
#define f first 
#define s second
#define fw(i,start,end) for(lli i=start;i<end;++i)
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
 
 lli a,b,c;
 cin>>a>>b>>c;
 cout<<c<<" "<<a<<" "<<b<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public static class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Program
{
    static int[] NumberOfNeededMatches = new int[]
    {
            6, 2, 5, 5, 4, 5, 6, 3, 7, 6,
    };

    static int N, M;
    static int[] A;

    public static void Main(string[] args)
    {
        N = Input.NextInt();
        M = Input.NextInt();
        A = Input.LineInt();
        Array.Sort(A);
        Array.Reverse(A);

        int[] dp = new int[N + 1];
        int[][] dp_answers = new int[N + 1][];
        dp[0] = 0;
        for (int numberOfMatches = 1; numberOfMatches <= N; numberOfMatches++)
        {
            int max = int.MinValue;
            int prev_answer_dp_index = int.MinValue;
            int this_answer = int.MinValue;
            for (int j = 0; j < A.Length; j++)
            {
                var res = numberOfMatches - NumberOfNeededMatches[A[j]];
                if (res < 0)
                    continue;
                var dp_n = dp[res] + 1;
                if (dp_n > max)
                {
                    max = dp_n;
                    prev_answer_dp_index = res;
                    this_answer = A[j];
                }
            }
            dp[numberOfMatches] = max;
            if (max >= 0)
            {
                var ans = new List<int>();
                ans.Add(this_answer);

                var n = numberOfMatches - NumberOfNeededMatches[this_answer];
                while (n > 0)
                {
                    ans.Add(dp_answers[n][0]);
                    n = n - NumberOfNeededMatches[dp_answers[n][0]];
                }
                dp_answers[numberOfMatches] = ans.ToArray();
            }
        }

        foreach (var c in dp_answers[N])
            Console.Write(c);
        Console.WriteLine();
    }
}


Measured memory_bytes: 163128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int main() {
	string s;
	cin >> s;
	string zen = "";
	string t = "";
	int ans = 0;
	rep(i, s.size()) {
		t += s[i];
		if (zen != t) {
			ans++;
			zen = t;
			t = "";
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>

#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using lint = long long;

int main(void)
{
	int N;
	cin >> N;
	vector<int> H(N);
	rep(i, N) cin >> H[i];

	int cnt = 0;
	int now = H[0];
	bool isContinue = true;
	int ans = 0;
	for(int i = 1; i < N; i++){
		if (now >= H[i]){
			if (isContinue){
				cnt++;
			}
			else{
				cnt = 1;
				isContinue = true;
			}
		}
		else{
			isContinue = false;
		}
		ans = max(ans, cnt);
		now = H[i];
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<cstring> 
#include<algorithm>
using namespace std;
const int N=1e5+5;
char str[N];
int main()
{
	int k;
	scanf("%s",str);
	int s=strlen(str);
	k=s;
	for(int i=1;i<s;i++){
		if(str[i]!=str[i-1]){
		    int mine=max(i,s-i);
			if(k>mine)  k=mine;	
		}
	}
	printf("%d",k);
	return 0;
 } 

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

int main(){
  ll l,r;
  cin >> l >> r;
  // mod 2019の場合 1 == 2020となる
  // iとjの値がi<jとなり同じにはならないため
  // 2019*2とすることでiとjが違う値が求められる
  r = min(r,l+4038);
  // mod 2019なため答えは2019より小さくなる
  int ans = 2018;
  for (ll i = l; i <= r; i++) {
    for (ll j = i+1; j <= r; j++) {
      int x = i*j%2019;
      ans = min(ans, x);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3612