akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

const double PI = acos(-1.0);

int main() {
    string s;
    cin >> s;
    char c = s[0];
    if ('a' <= c && c <= 'z') cout << "a" << endl;
    if ('A' <= c && c <= 'Z') cout << "A" << endl;
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll mod = 998244353;

int main() {
    
    int N, K;
    cin >> N >> K;
    int L[K], R[K];

    for (int i = 0; i < K; i++) {
        cin >> L[i] >> R[i];
    }
    


    ll d[N]{};
    ll c[N + 1]{};
    d[0] = 1;
    c[1] = 1;
    for (int i = 1; i < N; i++) {
        for (int j = 0; j < K; j++) {
            int l = max(0, i - R[j]);
            int r = max(0, i - L[j] + 1);
            d[i] += (c[r] - c[l] + mod) % mod;
            d[i] %= mod;
        }
        c[i + 1] = d[i] + c[i];
        c[i + 1] %= mod; 
    }
    cout << d[N - 1] % mod<< "\n";
    return 0;
}

Measured memory_bytes: 6760
#include<bits/stdc++.h>
#include<cstring>
//#define Mfc_Tanzim
typedef long long ll;
#define ull unsigned long long
#define pb push_back
#define ff first
#define ss second
#define all(v) (v.begin(), v.end())
#define pi acos(-1.0)
#define FastRead ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define bug(a) cerr << #a << " : " << a << endl
#define pq dp
using namespace std;
const ll mxx = 1e5+10;

ll posx[] = {1,-1, 0, 0};
ll posy[] = {0, 0, 1,-1};

int main()
{
    //FastRead

#ifdef Mfc_Tanzim
    freopen("input.txt","r", stdin);
    // freopen("output.txt","w", stdout);
#endif /// Mfc_Tanzim

    ll t=1, n, k, m, a, b, c, d, cs = 1;
    //cin >> t;
    set<ll>s;
    map<string, ll>mp;

    while(t--){
              cin >> a >> b;
              if(a==b){
                      cout << "Draw" << endl;
              }
              else if(a==1){
                      cout << "Alice" << endl;
              }
              else if(b==1){
                      cout << "Bob" << endl;
              }
              else if(a>b){
                      cout << "Alice" << endl;
              }
              else{
                      cout << "Bob" << endl;
              }

    }
    return 0;
}


Measured memory_bytes: 3640
H, W, A, B = map(int,input().split())
MOD = 10**9 + 7
def prepare(n, MOD):

    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv

    return factorials, invs

factorials, invs = prepare(H+W+1,MOD)
ans = 0
for b in range(B,W):
  ans += (factorials[H-A-1+b] * invs[H-A-1] % MOD * invs[b] % MOD) * (factorials[A-1+W-b-1] * invs[A-1] % MOD * invs[W-b-1] % MOD)
print(ans % MOD)

Measured memory_bytes: 18964
#include<stdio.h> 
#include<iostream> 
#include<string.h>
#include<cstring>
#include<string>
#include<math.h>
#include<algorithm>
#include<bits/stdc++.h>
#include<map>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
#define cuttime ios::sync_with_stdio(false)
#define swap(x, y) x ^= y, y ^= x, x^= y
#define INF 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define scan1(x) scanf("%d",&x)
#define scan2(x,y) scanf("%d%d",&x,&y)
#define scan3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define scanll1(x) scanf("%lld",&x)
#define scanll2(x,y) scanf("%lld%lld",&x,&y)
#define scanll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define lowbit(x) (x&(-x))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define debug(x) cout <<#x<<": "<<x<<endl
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=5e6+20;
const int mod=1e9+7;
inline ll read() {
    char c=getchar();ll x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0',c=getchar();}
    return x*f;
}
inline void out(ll x) {   
    if(x>9) out(x/10);   
    putchar(x%10+'0'); 
}

int main(){
    int n;
    ll d;
    int ans=0;
    n=read(),d=read();
    d=d*d;
    rep(i,1,n){
        ll x,y;
        cin>>x>>y;
        ll fd=x*x+y*y;
        if(fd<=d)ans++;
    }
    cout<<ans;
    return 0;
}
/*
 */

Measured memory_bytes: 3596
#include <stdio.h>
int main() {
	int i;

	int N;
	int A[20], B[20], C[20];
	int ans = 0;

	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}
	
	for (i = 0; i < N; i++) {
		scanf("%d", &B[i]);
	}

	for (i = 0; i < N - 1; i++) {
		scanf("%d", &C[i]);
	}

	for (i = 0; i < N; i++) {
		ans += B[A[i] - 1];
		if (i != 0 && A[i] - A[i - 1] == 1) {
			ans += C[A[i - 1] - 1];
		}
	}

	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
ans=1
b=[0,0,0]
for i in range(n):
  c=0
  for j in range(3):
    if a[i]==b[j]:
      c=c+1
  if a[i]==b[0]:
    b[0]=a[i]+1
  elif a[i]==b[1]:
    b[1]=a[i]+1
  elif a[i]==b[2]:
    b[2]=a[i]+1
  ans=ans*c%(10**9+7)
print(ans)
    

Measured memory_bytes: 14020
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
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; }

lli n, x, t;

int main(void){
	cin >> n >> x >> t;
	cout << t * ((n+x-1)/x) << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N, Q;
    cin >> N >> Q;
    VEC(int) D(Q);
    map<int, vector<int> > push, pop;
    FOR(i, 0, N) {
        int s, t, x;
        cin >> s >> t >> x;
        // takes atleast X[i] sec to reach here from 0.
        if (s < x) {
            s = x;
        }

        if (s >= t)
            continue;

        push[s - x].push_back(x);
        pop[t - x].push_back(x);
    }

    READVEC(D);

    multiset<int> xset;
    int i = 0;
    auto ptr1 = push.begin(), ptr2 = pop.begin();

    for (int d : D) {
        while (ptr1 != push.end() && (*ptr1).first <= d) {
            for (int x : (*ptr1).second)
                xset.insert(x);
            ptr1++;
        }

        while (ptr2 != pop.end() && (*ptr2).first <= d) {
            for (int x : (*ptr2).second)
                if (xset.count(x))
                    xset.erase(xset.find(x));
            ptr2++;
        } 
       
       if (xset.empty())
            cout << -1 << endl;
        else
            cout << *(xset.begin()) << endl;
    }

    return 0;
};


Measured memory_bytes: 55168
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readFloat64() float64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return float64(i)
}

func main() {
	sc.Split(bufio.ScanWords)
	s := readString()
	n := len(s)
	s1 := s[0 : (n-1)/2]
	s2 := s[((n+3)/2)-1 : n]

	if isPalindrome(s) && isPalindrome(s1) && isPalindrome(s2) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func isPalindrome(s string) bool {
	n := len(s)
	for i := 0; i < n; i++ {
		if i == n-i-1 {
			break
		}
		if s[i] != s[n-i-1] {
			return false
		}
	}
	return true
}


Measured memory_bytes: 640
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    V=list(map(int,input().split()))

    from itertools import product
    import heapq
    score=0
    # l,r : 左、右から取り出す個数
    for l,r in product(range(0,k+1),repeat=2):
        if(l+r>k or l+r>n): continue
        A=[]
        for i in range(l):
            heapq.heappush(A,V[i])
        for i in range(n-r,n):
            heapq.heappush(A,V[i])
        for _ in range(k-l-r):
            if(A):
                a=heapq.heappop(A)
                if(a>0):
                    heapq.heappush(A,a)
        score=max(score,sum(A))
    print(score)
resolve()

Measured memory_bytes: 59100
#include <bits/stdc++.h>
using namespace std;
using vec = vector<int>;
using intk = int64_t;

int main() {
	intk H;
  cin >>H;
  if(H ==1){
   cout << 1 <<endl; 
  return 0;
  }
	for(int i=1;i<=45;i++){
     if(H < pow(2,i+1) && H >= pow(2,i)){
       intk k = pow(2,i+1);
       printf("%ld\n",k-1);
       return 0;
     }
    }

}
  


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main() {
	long int N = 0;
	long int ans;
	cin >> N;
	long int A[N];
	for (long int i = 0; i < N; i++) {
		cin >> A[i];
	}
	long long int c = 0;
	for (long int i = N - 1; i > 0; i--) { //iは配列の番号
		c = (c + A[i]) % 1000000007;
		ans += (c * A[i - 1]) % 1000000007;
	}
	cout << (ans % 1000000007) << endl;
}


Measured memory_bytes: 5184
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <bits/stdc++.h>
#include <string>
using namespace std;
int keta(long long N);
int main(){
    int N,M;
    cin>>N>>M;
    int s[M];
    int c[M];
    for(int i=0;i<M;i++){
        cin>>s[i]>>c[i];
    }
    
    long long res = 0;
    for(int i=0;i<M;i++){
        for(int j=i+1;j<M;j++){
            if(s[i]==s[j]&&c[i]!=c[j]){
                cout<<"-1"<<endl;
                return 0;
            }else if(s[i]==s[j]){
                s[i]=-1;
            }
        }
    }
    for(int i=0;i<M;i++){
        if(s[i]!=-1){
            res += c[i]*pow(10,N-s[i]);
        }
    }
    bool flag=false;
    for(int i=0;i<M;i++){
        if(N!=1&&s[i]==1&&c[i]==0){
            cout<<"-1"<<endl;
            return 0;
        }
    }
    for(int i=0;i<M;i++){
        if(c[i]!=0)flag=true;
    }
    if(flag&&res==0&&N!=1){
        cout<<"-1"<<endl;
        return 0;
    }
    if(keta(res)!=N)res += pow(10,N-1);
    cout<<res<<endl;
}

int keta(long long N){
    int res=0;
    for(int i=0;;i++){
        N/=10;
        if(N==0)return i+1;
    }
}



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

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define FILENAME ""
#define __ fflush(stdout)

typedef long long ll;
typedef long double ld;    

using namespace std;

void FREOPEN() {
	#ifdef COMP
		freopen(".in", "r", stdin);
		freopen("1.out", "w", stdout);
	#else
		freopen(FILENAME".in", "r", stdin);
		freopen(FILENAME".out", "w", stdout);
	#endif
}

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

const int N = 500500, inf = 1e9 * 2, MOD = 1e9 + 7;

char CH[N];

const ll INF = 1e18;

const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};

int l1[N], r1[N], l2[N], r2[N];

int main() {

	int n;
	cin >> n;
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	vector<pair<ll, ll> > range;
	range.pb({a * 1ll, a * 1ll});
	for (int j = 2; j <= n; j++) {
		vector<pair<ll, ll> > next;
		for (auto j : range) {
			next.pb({j.F - d, j.S - c});
			next.pb({j.F + c, j.S + d});	
		}
		range.clear(); 		
		sort(All(next));
		for (auto j : next) {
			if (range.empty() || j.F - range.back().S > 1) range.pb(j);
			else range.back().S = max(range.back().S, j.S);	
		}
		int pos = SZ(range);
		for (int i = 0; i < SZ(range); i++) {
			if (range[i].F > b) {
				pos = i;
				break;
			}	
			if (range[i].F <= b && range[i].S >= b) {
				pos = i;
				break;
			}
		}
		next.clear();
		for (int i = max(0, pos - 3); i <= min(SZ(range) - 1, pos); i++) next.pb(range[i]);
		for (int i = pos + 1; i <= min(SZ(range) - 1, pos + 3); i++) next.pb(range[i]);
		range = next;  
	}
	for (auto i : range) {
		if (i.F <= b && i.S >= b) {
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}


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

int main() {
	int N;
    int D;
	int F;
  cin >> N;
  cin >> D;
  F = N%(2*D+1);
  if(F == 0){
    cout << N/(2*D+1) << endl;
  }
  else{
    cout << N/(2*D+1)+1 << endl;
  }
}


Measured memory_bytes: 256
n,m=list(map(int,input().split(" ")))
if n>=m:
    print(0)
else:
    x=sorted(list(map(int,input().split())))
    d=[]
    for i in range(len(x)-1):
        d.append(x[i+1]-x[i])
    d.sort()
    print(sum(d[:len(d)-n+1]))

Measured memory_bytes: 57640
import sys
N, x = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
a.insert(0,0)
ans = 0
for i in range(1,len(a)):
    if x < a[i-1] + a[i]:
        ans += (a[i-1] + a[i] - x)
        a[i] -= (a[i-1] + a[i] - x)
print(ans)



Measured memory_bytes: 59632
#include<iostream>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int ans = 0;
  for(int i = 0; i < s1.length(); i++) {
    if (s1[i] == s2[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	long long n,m,res=0;
	scanf("%lld %lld",&n,&m);
	if(n>=1&&m>=2)
	{
		if(n*2>m)
		{
			res+=m/2;
			m=0;
		}
		else if(n*2<m)
		{
			res+=n;
			m=m-n*2;
			n=0;
		}
	}
	if(m>=4&&n==0)
	{
		res+=m/4;
	}
	printf("%lld",res);
	return 0;
}

Measured memory_bytes: 128
from fractions import gcd
from functools import reduce
inpl = lambda: list(map(int,input().split()))
def lcm(a,b):
    return a*b//gcd(a,b)
def lcm_list(numbers):
    return reduce(lcm, numbers)

N = int(input())
rate = []
rate.append(inpl())
rate.append(inpl())
AB = []
BA = []
for i in range(3):
    rA, rB = rate[0][i], rate[1][i]
    if rB > rA:
        AB.append((rA, rB))
    elif rA > rB:
        BA.append((rB, rA))
for l in [AB, BA]:
    l.sort(key=lambda x: -x[1]/x[0])

def buy_and_sell(N, cost_ret):
    if len(cost_ret) == 0:
        return N
    else:
        Nunit = lcm_list([ x[0] for x in cost_ret ])
        b0, s0 = cost_ret[0]
        q = N // b0
        n = max(0, q - 2*Nunit//b0 + 1)
        Ndp = N - n*b0
        dp = [0]*(Ndp+1)
        w = [0]*(len(cost_ret)+1)
        for i in range(1,Ndp+1):
            k = 1
            for cost, ret in cost_ret:
                if i >= cost:
                    w[k] = dp[i-cost] + ret
                    k += 1
            dp[i] = max(dp[i-1]+1, max(w))
        return s0*n + dp[-1]

M = buy_and_sell(N, AB)
L = buy_and_sell(M, BA)
print(L)

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

char s[201000];
int l,p1,p2,p3; long long ans;

struct Bit{
	int c[201000],tot;
	int add(int x,int v){
		for (tot+=v;x<=l;x+=x&-x) c[x]+=v;
	}
	int cal(int x){
		int res=0;
		for (;x;x-=x&-x) res+=c[x];
		return res;
	}
	int que(int y){
		int res=0;
		for (int i=18;~i;--i) if ((res|1<<i)<=l&&y>c[res|1<<i]){
			res|=1<<i, y-=c[res];
		}
		return res+1;
	}
}b[26],a;


int main(){
	cin>>s+1; l=strlen(s+1);
	for (int i=1;i<=l;++i) a.add(i,1), b[s[i]-'a'].add(i,1);
	for (int i=l;i>1;i-=2){
		p1=a.que(1), p2=a.que(a.tot);
		if (s[p1]-s[p2]){
			if (b[s[p1]-'a'].tot>1){
				p3=b[s[p1]-'a'].que(b[s[p1]-'a'].tot);
				ans+=i-a.cal(p2=p3);
			}else{
				p3=b[s[p2]-'a'].que(1);
				ans+=a.cal(p1=p3)-1;
			}
			if (p1==p2) return 0*printf("-1");
		}
		a.add(p1,-1), b[s[p1]-'a'].add(p1,-1);
		a.add(p2,-1), b[s[p2]-'a'].add(p2,-1);
	}
	cout<<ans;
}

Measured memory_bytes: 21632
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    private static int GOO = 0;
    private static int CHO = 1;
    private static int PAA = 2;

    /** N回*/
    private static int N;

    /** K回前*/
    private static int K;

    private static int R;
    private static int S;
    private static int P;

    private static char[] T;

    public static void main(String[] args) {
        initialize();

        // 手番をKの剰余類に分けてそれぞれの最大値を求め、最後に足してあげればよい。
        int allSum = 0;
        for (int i = 0; i < K; i++) {
            allSum += calculateKakuMax(i);
        }

        System.out.println(allSum);
    }

    private static void initialize() {
        Scanner sc = new Scanner(System.in);

        N = sc.nextInt();
        K = sc.nextInt();
        R = sc.nextInt();
        S = sc.nextInt();
        P = sc.nextInt();
        T = sc.next().toCharArray();

    }

    private static int calculateKakuMax(int amari) {
        List<Character> TK = new ArrayList<>();
        for (int i = 0; i * K + amari < T.length; i++) {
            TK.add(T[i * K + amari]);
        }
        int[][] dp = new int[3][TK.size()];

        dp[GOO][0] = TK.get(0) == 's' ? R : 0;
        dp[CHO][0] = TK.get(0) == 'p' ? S : 0;
        dp[PAA][0] = TK.get(0) == 'r' ? P : 0;

        for (int i = 1; i < TK.size(); i++) {

            dp[GOO][i] = (TK.get(i) == 's' ? R : 0) + Math.max(dp[CHO][i - 1], dp[PAA][i - 1]);
            dp[CHO][i] = (TK.get(i) == 'p' ? S : 0) + Math.max(dp[GOO][i - 1], dp[PAA][i - 1]);
            dp[PAA][i] = (TK.get(i) == 'r' ? P : 0) + Math.max(dp[CHO][i - 1], dp[GOO][i - 1]);
        }

        return Math.max(dp[GOO][TK.size() - 1], Math.max(dp[CHO][TK.size() - 1], dp[PAA][TK.size() - 1]));
    }

}


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

using namespace std;

typedef double ll;

struct Point
{
    ll x,y;
    Point(){ x = y = 0.0; }
    Point(ll _x, ll _y) : x(_x), y(_y){}

    Point operator+ (Point p)
    {
        return Point(p.x + x, p.y + y);
    }

    Point operator- (Point p)
    {
        return Point(x - p.x, y - p.y);
    }

    ll operator* (Point p)
    {
        return p.x * x + p.y * y;
    }

    Point operator* (ll t)
    {
        return Point(x*t, y*t);
    }

    ll operator~ ()
    {
        return x * x + y * y;
    }

    ll operator% (Point p)
    {
        return x * p.y - y * p.x;
    }

};

Point polygon[200];
int n;

double area()
{
    double acum = 0.0;
    for(int i = 1 ; i < n+1 ; i++)
        acum += polygon[i-1]%polygon[i];
    return acum / 2.0;
}

int main()
{
    cout << fixed;
    cout.precision(1);
    ios::sync_with_stdio(0); cin.tie(0);
    Point p;
    cin >> n;
    for(int i = 0 ; i < n ; i++)
        cin >> polygon[i].x >> polygon[i].y;
    polygon[n] = polygon[0];
    cout << area() << '\n';
    return 0;
}

Measured memory_bytes: 3268
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H, W;

		while(true) {

			H = sc.nextInt();
			W = sc.nextInt();

			if (H == 0 && W == 0) {
				sc.close();
				break;
			}

			for(int hight_count = 0; hight_count < H; hight_count++) {
				for(int width_count = 0; width_count < W; width_count++) {
					if(hight_count == 0 || hight_count == H-1) {
						System.out.printf("#");
					} else if(width_count == 0 || width_count == W -1) {
						System.out.printf("#");
					} else {
						System.out.printf(".");
					}
				}
				System.out.printf("\n");
			}
			System.out.printf("\n");
		}
	}
}



Measured memory_bytes: 56200
program main
implicit none
integer :: i, j, k, c(3), d(2)

do i = 1, 3
   read(*,*) c(1:3)
   if( i.ge.2 ) then
      do j = 1, 2
         if( d(j) /= c(j+1)-c(j) ) then
            write(*,*) 'No'
            stop
         end if
      end do
   end if
   do j = 1, 2
      d(j) = c(j+1)-c(j)
   end do
end do
write(*,*) 'Yes'

end program main


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
//typedef pair<int, int>P;
const int MOD = 1e9+7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 2e18;
long long fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}

ll cum[200020];
void test() {
	FOR(l, 1, 11) {
		pe(l);
		ll ans = 0;
		REP(k, l + 1) {
			ans += (k + 1)*COM(l, k);
		}
		print(ans);
	}
}
ll f(int n) {
	if (n == 0)return 1;
	return mult(n + 2, bin_pow(2, n - 1));
}
void solve() {
	int N; cin >> N;
	vector<int>C(N);
	REP(i, N) {
		cin >> C[i];
	}
	COMinit();
	//test();
	VSORT(C); 
	ll ans = 0;
	REP(k, N + 1) {
		cum[k + 1] += mult(k+1,COM(N, k));
		cum[k + 1] += cum[k];
		cum[k + 1] %= MOD;
	}
	REP(i, N) {
		ll l = N - i - 1;
		//print(f(l + 1));
		ans += mult(C[i],mult(bin_pow(2, 2 * i + l + 1), f(l)));
		ans %= MOD;
	}
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;cin>>q;
	//while(q--)
	solve();
}




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

int main() {
	int x[5]={1,2,3,4,5};
	for(int i=0;i<5;i++){
		cin>>x[i];
	}
	for(int i=0;i<5;i++){
		if(x[i]==0)cout<<i+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 3500
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <stack>
#include <iomanip>
#include <functional>
#include <array>
#include <memory>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#undef NDEBUG
#include <assert.h>

using namespace std;
typedef long long ll;

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

	int n;
	cin >> n;
	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		ans += x - 1;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int,int>
#define mk(x,y) make_pair(x,y)
#define fir first
#define sec second
#define Rep(x,y,z) for(int x=y;x<=z;x++)
#define Red(x,y,z) for(int x=y;x>=z;x--)
using namespace std;
const int MAXN=5e3+5;
char buf[1<<12],*pp1=buf,*pp2=buf,nc;int ny;
inline char gc() {return pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;for(ny=1;nc=gc(),(nc<48||nc>57)&&nc!=EOF;)if(nc==45)ny=-1;if(nc<0)return nc;
	for(x=nc-48;nc=gc(),47<nc&&nc<58&&nc!=EOF;x=(x<<3)+(x<<1)+(nc^48));return x*ny;
}
int n,mid,C[MAXN],F[MAXN],Mod;
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	n=read(),Mod=read(),mid=n>>1;
	Rep(i,2,mid+1)C[i]=i-1;
	Rep(i,mid+2,n)C[i]=n-i+2;
	F[0]=1;
	Rep(i,2,n)Rep(j,C[i],n)F[j]=(F[j]+F[j-C[i]])%Mod;
	ll ans=0;Rep(i,0,n)ans+=1ll*(n-i)*F[i];
	cout<<ans%Mod<<"\n";
	return 0;
}




Measured memory_bytes: 3668
#[test]
fn test_solve() {
    assert_eq!(solve("5 3\n-30 -10 10 20 50\n"), "40\n");
    assert_eq!(solve("3 2\n10 20 30\n"), "20\n");
    assert_eq!(solve("1 1\n0\n"), "0\n");
    assert_eq!(solve("8 5\n-9 -7 -4 -3 1 2 3 4\n"), "10\n");
}
fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);

    let n: usize = sc.read();
    let k: usize = sc.read();
    let x: Vec<isize> = (0..n).map(|_| sc.read()).collect();

    use std::cmp::min;
    format!(
        "{}\n",
        (0..n - k + 1)
            .map(|i| x[i + k - 1] - x[i] + min(x[i].abs(), x[i + k - 1].abs()))
            .min()
            .unwrap()
    )
}
fn main() {
    let mut buf = String::new();
    use std::io::{Read, Write};
    std::io::stdin().read_to_string(&mut buf).unwrap();
    std::io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}
struct Scanner<'a>(std::str::SplitWhitespace<'a>);
impl<'a> Scanner<'a> {
    fn from_str(src: &str) -> Scanner {
        Scanner(src.split_whitespace())
    }
    fn get(&mut self) -> &str {
        self.0.next().unwrap()
    }
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.get().parse().ok().unwrap()
    }
}


Measured memory_bytes: 6396
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int INF = 1e9 + 5;

void maxself(ll & a, ll b)
{
		a = max(a, b);
}

void solve()
{
		ll n, w;
		cin >> n >> w;
		vector <ll> dp(w+1);
		for(int i = 0; i<n; i++)
		{
			ll ww, val;
			cin >> ww >> val;
			
			for(ll j = w-ww; j>=0; j--)
			{
				maxself(dp[ww+j], dp[j]+val);
			}
			
		}
		ll ans = 0;
		for(ll i = 0; i<=w; i++)
			maxself(ans, dp[i]);
		
		cout << ans ;
}

int main()
{
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		ll t = 1;
	//	cin >> t
		while(t--)
		{
			solve();
		}
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
  int a, b;
  cin>>a>>b;
  int ans=a+b;
  if(ans>=24){
    ans-=24;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
//Sha3ban_El-Bay
#include<bits/stdc++.h>
using namespace std ;
//======================================================
#define El_Bay ios_base::sync_with_stdio(false);cin.tie(NULL);
#define forn(i,n)  for (int i = 0; i < (int)(n); ++i)
#define for1(i,n)  for (int i = 1; i <=(int)(n); ++i)
#define all(v)     (v).begin(),(v).end()
#define ull        unsigned long long
#define PI         3.14159265359
#define ll         long long
#define sz(v)	   v.size()
#define pb         push_back
#define pp         pop_back
#define S          second
#define bgn        begin
#define F          first
#define N          1000000+5
#define	MOD        1e9+7
#define inf        1e18
//======================================================
int dx[] = { 0,  0, 1, -1 ,  1,  -1,  1,  -1 };
int dy[] = { 1, -1, 0,  0 , -1,   1,  1,  -1 };
//======================================================
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ull a, ull b, ull ret = 1LL) {
	while (b--) ret = (ret * a);
	return ret;}
//======================================================
ll n,ans,w;
ll dp[110][N],a[110],b[110];
ll solve( ll i, ll r )
{
	if(r<0) return INT_MIN;
	if(i==n || r==0 ) return 0;
	if(dp[i][r]!=-1) return dp[i][r];

	dp[i][r] = max( solve(i+1,r) , solve(i+1,r-a[i])+b[i] );

	return dp[i][r];
}
int main()
{
	El_Bay
	cin >> n >> w ;
	for(int i=0 ; i<n ; i++)
		cin >> a[i] >> b[i];

	memset(dp,-1,sizeof(dp));

	cout << solve(0,w);
	return 0;
}




Measured memory_bytes: 862972
#include <bits/stdc++.h>
#define lli long long int
#define MAX(A,B) (A)>(B)?(A):(B)
#define MIN(A,B) (A)<(B)?(A):(B)
#define gcd(A,B) __gcd(A,B)
#define lcm(A,B) A/(__gcd(A,B))*B
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define ld long double
#define mod 1000000007LL
#define all(x) x.begin(), x.end()
#define usecppio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

typedef pair<int,int> pii;

int arr[100];
int sum = 0;
int total = 0;
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i<n; i++)
	{
		cin >> arr[i];
	}
	for (int i = 0; i<n; i++)
	{
		for (int j = i+1; j<n; j++)
		{
			total += arr[i]*arr[j];
		}
	}
	cout << total;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

int main()
{
    string s;
    cin >> s;
    int i;
    int firstA = -1;
    int lastZ = -1;
    for(i = 0; i < s.length(); i ++)
    {
    	if(firstA == -1 && s[i] == 'A')
    		firstA = i;
    	if(s[i] == 'Z')
    		lastZ = i;
    }

    cout << lastZ - firstA + 1 <<  endl;
}

Measured memory_bytes: 640
import math
data = input()
num = int(data)
o = input().rstrip().split(" ")
list =[]
for i in o:
    list.append(int(i))
p = input()
times = int(p)
ans = sum(list)
num_count=[0 for i in range(100001)]
for i in list:
    num_count[i] += 1
for i in range(times):
    B, C = map(int, input().split(" "))
    a = num_count[B]
    num_count[B] = 0
    num_count[C] += a
    ans += a*(C-B)
    print(ans)


Measured memory_bytes: 21944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+100;
int main()
{
	ll n,s[maxn];
	scanf("%lld",&n);
	for(int i=0;i<n;i++)
		scanf("%lld",&s[i]);
//	sort(s,s+n);
	ll ans=s[0];
	for(int i=1;i<n;i++)
		ans=__gcd(ans,s[i]);
	cout<<ans;
}

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

char str[MAX];
int table[10] = {0, 1, 2, 3, 4, 5, 4, 3, 2, 1};

int main(void)
{
	cin >> str;
	int N = strlen(str);
	int carry = 0;
	int ans = 0;
	for (int i = N - 1; i >= 0; i--)
	{
		str[i] += carry;
		carry = 0;
		if (str[i] > '9')
		{
			str[i] = '0';
			carry = 1;
		}
		ans += table[str[i] - '0'];
		if (str[i] > '5')
		{
			if (i) str[i - 1]++;
			else carry++;
		}
		else if (str[i] == '5' && i && str[i - 1] >= '5') str[i - 1]++;
	}
	cout << ans + carry << endl;
	return 0;
}


Measured memory_bytes: 1280
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer[] l = new Integer[n];
        for (int i=0; i<n; i++) {
            int lx = sc.nextInt();
            l[i] = lx;
        }
        Arrays.sort(l,Collections.reverseOrder());
        int ans =0;
        for (int i=0; i<k; i++) {
            ans += l[i];
        }
        
        System.out.println(ans);
        sc.close();
    }
}

Measured memory_bytes: 35780
#include<iostream>
using namespace std;
int main()
{
  int A, B;
  cin >> A >> B;
  int d, e, f;
  d = A + B;
  e = A - B;
  f = A * B;
  if(d >= e && d >= f)
    cout << d;
  else if(e >= d && e >= f)
    cout << e;
  else if(f >= d && f >= e)
    cout << f;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int p=1e9+7;
ll qmi(ll a,ll k)//用到快速幂/逆元/组合公式
{
    ll res=1;
    while(k)
    {
        if(k&1)
            res=res*a%p;
        a=a*a%p;
        k>>=1;
    }
    return res;
}
ll C(int a,int b)
{
    ll res=1;
    for(ll i=1,j=a;i<=b;i++,j--)
    {
        res=res*j%p;
        res=res*qmi(i,p-2)%p;
    }
    return res;
}
ll lucas(ll a,ll b)
{
    if(a<p&&b<p)
        return C(a,b);
    return
    C(a%p,b%p)*lucas(a/p,b/p)%p;
}
int main()
{
    ios::sync_with_stdio(false);
	ll n,a,b;
	cin>>n>>a>>b;
	cout<<(qmi(2,n)-(lucas(n,a)%p+lucas(n,b)%p)%p-1+p)%p<<endl;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll w,h,n;
  cin >> w >> h >> n;
  vll x(n), y(n), a(n);
  REP(i, n)
    cin >> x[i] >> y[i] >> a[i];

  ll lx,ly,rx,ry;
  lx = ly = 0;
  rx = w;
  ry = h;
  REP(i, n){
    if(a[i] == 1)
      lx = max(lx, x[i]);
    else if(a[i] == 2)
      rx = min(rx, x[i]);
    else if(a[i] == 3)
      ly = max(ly, y[i]);
    else
      ry = min(ry, y[i]);

    if(lx > rx)
      lx = rx;
    if(ly > ry)
      ly = ry;
  }

  cout << (rx-lx)*(ry-ly) << endl;

}


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

using ll    = long long;
using ull   = unsigned long long;
using veci  = vector<int>;
using vecll = vector<ll>;
#define EPS (1e-7)
#define INF (1e9)
#define PI  (acos(-1))
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define REP(i,n) for(int i= 0;i<(int)(n);++i)
#define pb push_back

veci enum_div(int n){
	veci ret;
	ret.pb(1);
	for(int i=1;i*i<n;i++){
		if(n%i==0){
			ret.pb(i);
			if(i != n/i){ret.pb(n/i);}
		}
	}
	ret.pb(n);
	return ret;
}
int gcb(int a,int b){return ((b == 0)? a : gcb(b,a%b));}
int gcd(int a,int b){return (a*b) / gcb(a,b);}

int main(){
	string s,t;
	string ans = "Yes";
	map<char,char> sw1,sw2;
	cin >> s >> t;
	string stmp(s),ttmp(t);
	REP(i,(ll)s.size()){
		auto iter1 = sw1.find(s[i]);
		auto iter2 = sw2.find(t[i]);
		if(iter1 != sw1.end()){
			s[i] = sw1[s[i]];
		}else{
			sw1[s[i]] = ttmp[i];
			s[i] = ttmp[i];
		}
		if(iter2 != sw2.end()){
			t[i] = sw2[s[i]];
		}else{
			sw2[s[i]] = stmp[i];
			t[i] = stmp[i];
		}
	}
	if(s != ttmp || t != stmp){
		ans = "No";
	}

	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1160
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	value, _ := strconv.Atoi(sc.Text())
	return value
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	K := scanInt()
	sc.Scan()
	S := sc.Text()
	sliced := strings.Split(S, "")
	sliced[K-1] = strings.ToLower(sliced[K-1])
	fmt.Printf("%s\n", strings.Join(sliced, ""))
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++)cin >> a[i];
  sort(a.rbegin(),a.rend());
  int sum=0;
  for(int i=0;i<N;i++){
    if(i%2==0){
      sum+=a[i];
    }
    else sum-=a[i];
  }
  cout << sum;
}



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

int main(void){

    int a,b,c;
    cin >> a >> b >> c;
    if (a<b)
    {
        if (b < c)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1156
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = list(str(input()))

# R,G,B ひとつずつ
# 距離が等間隔でない

R_pos = []
G_pos = []
B_pos = []
for i in range(N):
    if S[i] == "R":
        R_pos.append(i)
    elif S[i] == "G":
        G_pos.append(i)
    elif S[i] == "B":
        B_pos.append(i)

answer = len(R_pos) * len(G_pos) * len(B_pos)
for i in range(N):
    for j in range(i+1, N):
        k = j + j - i
        if k >= N:
            break
        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            answer -= 1

print(answer)

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

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

  int p[n];
  int i, ii, j, k;

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

  int ans=101, def = 100;

  for (i=101;i>=0;i--) {
    k = 0;
    ii = i;
    // cout << ii << endl;
    for (j=0;j<n;j++) {
      if (ii == p[j]) k = 1;
    }
    // cout << k << endl;
    if (k == 0) {
      // cout << ii << endl;
      if (abs(ii-x) <= def) {
        def = abs(ii-x);
        ans = ii;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

int main() {
	int A, B, K;

	cin >> A >> B >> K;

	for (int i = A; i <= B; i++) {
		if (i >= A + K && i <= B - K)continue;
		cout << i << endl;
	}

	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int test[51];
signed main() {
    double n, m; int a = 0, b = 0, c = 0;
    int d = 0, e = 0, f = 0, g = 0, h = 0;
    while (cin >> n >> m) {
        if (n >= 1.1) { a++; }
        else if (n >= 0.6) { b++; }
        else if (n >= 0.2) { c++; }
        else { d++; }
        if (m >= 1.1) { e++; }
        else if (m >= 0.6) { f++; }
        else if (m >= 0.2) { g++; }
        else { h++; }
    }
    cout << a << ' ' << e << endl;
    cout << b << ' ' << f << endl;
    cout << c << ' ' << g << endl;
    cout << d << ' ' << h << endl;
}


Measured memory_bytes: 3076
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        String s = a + b ;
        int n = Integer.valueOf(a + b);
        if (n == Math.floor(Math.sqrt(n)) * Math.floor(Math.sqrt(n))) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

}

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

int main() {
	string S, T; cin >> S >> T;
	long long ans = 0;
	for (long long i = 0; i < S.size(); i++) {
		if (S.at(i) != T.at(i)) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3912
#include <iostream>

using namespace std;

int K, S;

int main(void)
{
	cin >> K >> S;
	
	int ans = 0;
	for(int x = 0; x <= K; x++){
		for(int y = 0; y <= K; y++){
			if(S - x - y >= 0 && S - x - y <= K) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int N;
    cin >> N;
    map<string, int> mp;
    int mx = 0;
    rep(i, N) {
        string s;
        cin >> s;
        mp[s]++;
        mx = max(mx, mp[s]);
    }

    V(string) res;
    for(auto &p: mp) {
        if(p.se == mx) res.pb(p.fi);
    }
    sort(ALL(res));

    rep(i, res.size()) cout << res[i] << endl;
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 26868
def main():
    N = int(input())

    if N % 11 == 0:
        ans = (N // 11) * 2
    elif N % 11 <= 6:
        ans = (N // 11) * 2 + 1
    else:
        ans = (N // 11) * 2 + 2

    print(ans)




if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <string>

int main()
{
	std::string s;
	std::cin >> s;

	int sum = 0;
	for( int i = 0; i < s.size(); i++ ) {
		sum += s[ i ] - '0';
	}
	
	int n = std::stoi( s );
	std::cout << ( n % sum == 0 ? "Yes" : "No" ) << std::endl;
	return 0;
}


Measured memory_bytes: 760
import java.util.*;

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

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

int main() {
  int N ;
  string S ; 
  
  cin >> N ;
  cin >> S ; 

  if(S.size() % 2 == 1 ){

    cout << "No" << endl ; 
    return 0 ; 
  }
   else if (S.size() % 2 == 0 ){ 
    for(int i = 0 ; i < N/2 ; i++){

      if( S.at(i) != S.at(N/2 + i  )){
        cout << "No" << endl ; 
        return 0 ; 
      }
    }
  }
 
  cout << "Yes" << endl ; 
  
  
}

Measured memory_bytes: 3648
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
    if cur == N:
        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define scan(n)     scanf("%lld", &n);
#define print(n)    printf("%lld\n", n);
#define fd(n)       fixed<<setprecision(n)
#define MAX         1000000000000000000
#define MAXN        100005
#define LOG         19
#define mod         1000000007
using namespace std;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,i,x,y,mx=0;
    cin>>n>>m;
    vector<ll> vi[n+1];
    ll deg[n+1];
    queue<ll> qe;
    vector<ll> vi1;
    memset(deg,0,sizeof(deg));
    for(i=1;i<=m;i++){
        cin>>x>>y;
        vi[x].pb(y);
        deg[y]++;
    }
    for(i=1;i<=n;i++){
        if(deg[i]==0){
            qe.push(i);
            vi1.pb(i);
        }
    }
    while(!qe.empty()){
        ll node=qe.front();
        qe.pop();
        for(auto x:vi[node]){
            deg[x]--;
            if(deg[x]==0){
                vi1.pb(x);
                qe.push(x);
            }
        }
    }
    ll dp[n+1];
    memset(dp,0,sizeof(dp));
    for(auto node:vi1){
        for(auto x:vi[node]){
            dp[x]=max(dp[x],dp[node]+1);
        }
    }
    for(i=1;i<=n;i++){
        mx=max(mx,dp[i]);
    }
    cout<<mx;
}

Measured memory_bytes: 10892
#include<iostream>
#include<cmath>

using namespace std;

int main(){
  unsigned long long N, ans = 0;

  cin >> N;

  if (N%2==0){
    unsigned long long b = 10;
    while(N >= b){
      ans += N / b;
      b *= 5;
    }
    printf("%llu\n",ans);
  }else{
    printf("0\n");
  }
  
}



Measured memory_bytes: 3672
#include<iostream>
#include<string>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int n,i;
	int maxnum=-1,minnum=2100000000;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		int a;
		scanf("%d",&a);
		maxnum=max(maxnum,a);
		minnum=min(minnum,a);
	}
	printf("%d",maxnum-minnum);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>

using namespace std;
using ll = long long int;

int main() {
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	cout << (s == "abc" ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main(void)
{
	int a[4],b[4],hit = 0,blow = 0;
	while(1)
	{
		for(int i = 0;i<4;i++)
		{
			if(scanf("%d",&a[i]) == EOF) goto kitune;
		}
		for(int i = 0;i < 4;i++)
		{
			scanf("%d",&b[i]);
		}

		for(int i = 0;i<4;i++)
		{
			if(a[i] == b[i]) hit += 1;
		}
		for(int i = 0;i<4;i++)
		{
			for(int j = 0;j < 4;j++)
			{
				if(i!= j && a[i] == b[j]) blow += 1;
			}
		}
		printf("%d %d\n",hit,blow);
		hit = 0;
		blow = 0;
	}
	kitune:;
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
int a[100005];
int main()
{
 int n,k,q;
 scanf("%d%d%d",&n,&k,&q);
 for(int i=1;i<=q;i++)
 {
  int x;
  scanf("%d",&x);
  a[x]++;
 }
 for(int i=1;i<=n;i++)
  puts(k-q+a[i]>0?"Yes":"No");
 return 0;
}

Measured memory_bytes: 896
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		Arrays.sort(a);
		
		for (int i = 0; i < n / 2; i++) {
			int tmp = a[i];
			a[i] = a[n - i - 1];
			a[n - i - 1] = tmp;
		}
		
		int alice = 0;
		int bob = 0;
		for (int i = 0; i < n; i++) {
			if (i % 2 == 0) {
				alice += a[i];
			} else {
				bob += a[i];
			}
		}
		
		System.out.println(alice - bob);
	}
}

Measured memory_bytes: 23636
x=$<.read.split.map &:to_i
(w,h,n=x.shift 3
m=[[0]*-~w,[1]]
a=2.upto(h){m<<[0]}
n.times{|i|c,r=x.shift 2;m[r][c]=0}
1.upto(h){|i|1.upto(w){|j|a=m[i][j]||=m[i-1][j]+m[i][j-1]}}
p a)while x.size>2

Measured memory_bytes: 8648
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define MAX 100005
#define MOD 1000000007
vector <int> v[MAX];
int dp[MAX][2];
void dfsdp(int x,int y)
{
	dp[x][0]=1;
	dp[x][1]=1;
	for(auto i:v[x])
	{
		if(i!=y)
		{
			dfsdp(i,x);
			dp[x][0]=(dp[x][0]*((dp[i][1]+dp[i][0])%MOD))%MOD;
			dp[x][1]=(dp[x][1]*dp[i][0])%MOD;
		}
	}
}
signed main()
{
	int n,i;
	cin>>n;
	for(i=1;i<n;i++)
	{
		int k1,k2;
		cin>>k1>>k2;
		v[k1].push_back(k2);
		v[k2].push_back(k1);
	}
	dfsdp(1,1);
	cout<<(dp[1][0]+dp[1][1])%MOD<<"\n";
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
const int inf=1000000000;

void bfs(int s,vector<int> &d,vector<vector<int> > &Adj){
	d[s]=0;
	queue<int> q;
	q.push(s);
	while(q.empty()==false){
		int u=q.front();
		q.pop();
		for(int i=0;i<Adj[u].size();i++){
			int v=Adj[u][i];
			if(d[v]==inf){
				d[v]=d[u]+1;
				q.push(v);
			}
		}
	}
	return;
}

int main(){
	int n,x,y,black=0,white=0;
	cin>>n;
	vector<vector<int> > Adj(n+1);
	for(int i=1;i<n;i++){
		cin>>x>>y;
		Adj[x].push_back(y);
		Adj[y].push_back(x);
	}
	vector<int> d1(n+1,inf),d2(n+1,inf);
	bfs(1,d1,Adj);
	bfs(n,d2,Adj);
	for(int i=2;i<n;i++)
	  if(d1[i]<=d2[i])
	    black++;
	white=n-2-black;
	if(black>white)
	  cout<<"Fennec";
	else
	  cout<<"Snuke";
	return 0;
}

Measured memory_bytes: 6528