akhauriyash/Code-Regression huggingface dataset:
while True:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    a = [["#" for j in range(W)] for i in range(H)]
    b = ["".join(a[i]) for i in range(H)]
    for i in range(H):
        print(b[i])
    print()

Measured memory_bytes: 7980
def judgement(tmp,matrix):
    judge=[]
    x,y=0,0
    while True:
        if [x,y] in judge:
            print("LOOP")
            break
        judge.append([x,y])
        #print(judge)
        if tmp[x][y]=='>':
            y+=1
        elif tmp[x][y]=='<':
            y-=1
        elif tmp[x][y]=='^':
            x-=1
        elif tmp[x][y]=='v':
            x+=1
        else:
            print(y,x)
            break

while True:
    H,W=map(int, input().split())
    if H==W==0:
        break
    matrix=[[0 for i in range(W)] for i in range(H)]
    tmp=[]
    for i in range(H):
        hhh=list(map(str,input()))
        tmp.append(hhh)
    #print(tmp)
    judgement(tmp,matrix)



Measured memory_bytes: 5892
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
def factor(n, m=None):
    # mを与えると、高々その素因数まで見て、残りは分解せずにそのまま出力する
    arr = {}
    temp = n
    M = int(-(-n**0.5//1))+1
    if m is not None:
        M = min(m+1, M)
    for i in range(2, M):
        if i>temp:
            break
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr[i] = cnt

    if temp!=1:
        arr[temp] = 1

    if not arr:
        arr[n] = 1

    return arr
n *= 2
f = factor(n)
# print(f)
from itertools import product
ans = n-1
def gcd2(a, b):
    """a*x + b*y = gcd(a,b)なるx,yも求める
    """
    l = []
    while b:
        l.append(divmod(a,b))
        a, b = b, a%b
    x, y = 1, 0
    for aa,bb in l[::-1]:
        x, y = y, x - aa*y
    return a, x, y
def sub(x,y):
    g,k,l = gcd2(x, -y)
    if g!=1:
        return None
    return abs(k*x)
for ks in product(*[range(2) for _ in f.values()]):
    val = 1
    val2 = 1
    for k,v in zip(ks, f.keys()):
        if k:
            val *= pow(v,f[v])
        else:
            val2 *= pow(v,f[v])
#     print(val*val2)
    if val==1 or val2==1:
        continue
    res = gcd2(val, -val2)
    if res is not None and abs(res[0])==1:
#         print(val,val2,res)
        ans = min(ans, abs(val*res[1]))
print(ans)

Measured memory_bytes: 74644
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define FFOR(i, a, b) for(int (i)=a;(i)>(b);--(i))
#define rrep(i,n) FFOR(i,0,n)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define lb long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 123456789012345
#define int ll
typedef pair<int, int> P;
typedef pair<int, P> PP;

const int maxn =1e5 + 10;

//initialization here
//
int cx[105],cy[105],cr[105];
int vx[105],vy[105];
//
//initialization finish


// your function is here
//

//
// your function finished

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// your code is here
	//

	int n,x; cin >> n >> x;

	int minm = INF;
	int sum = 0;
	rep(i,n)
	{
		int m; cin >> m;
		sum += m;
		minm = min(minm,m);
	}

	x -= sum;

	int ans = n;
	ans += x/minm;

	Print(ans);

	//
	// your code finished


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n;
	scanf("%d",&n);
	n--;
	ll ans=n;
	for(int i=2;i<=n;i++)
	{
		ans+=(n/i);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3824
//yukicoder@cpp14
//author:luckYrat(twitter:@luckYrat_)
//競技プログラミングから逃げるな
//https://www.youtube.com/watch?v=z_B9iJ8r4ic

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  int n;cin>>n;
  int a;
  for(int i = 0; n > i; i++){
    cin>>a;
    if(a%2){
      cout << "first" << endl;
      return 0;
    }
  }
  cout << "second" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int H,W;
cin>>H>>W;
string x(W+2,'#');
char a[H][W];
for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
        cin>>a[i][j];
    }
}
for(int i=0;i<W+2;i++){
    cout<<x[i];
}
cout<<endl;
for(int i=0;i<H;i++){
        cout<<'#';
    for(int j=0;j<W;j++){
        cout<<a[i][j];
    }
cout<<'#'<<endl;
}
for(int i=0;i<W+2;i++){
    cout<<x[i];
}
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p = 0;
    cin >> n >> k;
    if(n == k){
        cout << "0";
    }
    else{
        x = n % k;
        if(abs(x-k) < x){
            cout << abs(x-k);
        }
        else{
            cout << x;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/perl
use strict;

my $N = <>;
my @arr;
my $sum = 0;
for (my $i = 1; $i <= $N; $i++) {
  if (($i % 3 == 0) && ($i % 5 == 0) ) {
  } elsif ($i % 3 == 0) {
  } elsif ($i % 5 == 0) {
  } else {
    push(@arr,$i);
  }
}
foreach my $item (@arr) {
  $sum += $item;
}
print $sum;

Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>num(100001);
  set<int>two;
  int i;
  for(i=0;i<n;i++){
    cin >> a[i];
    num[a[i]]++;
  }
  int cnt = n;
  for(i=1;i<=100000;i++){
    while(num[i]>=3){
      num[i]-=2;
      cnt -= 2;
    }
    if(num[i]==2)two.insert(i);
  }
  cnt -= two.size();
  if(two.size()%2==1)cnt--;
  cout << cnt << endl;


}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)();
typedef long long ll;

ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}

const ll big=1000000007;
int exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (exp(x,y-1)*x)%big;
    ll t=exp(x,y/2);
    return (t*t)%big;
}

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


ll in(ll x){
    return exp(x,big-2);
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/
    
    int n;cin >> n;
    vector<int> a(n+1);
    int same=-1;
    set<int> al;
    rep(i,n+1){
        cin >> a[i];
        if(al.count(a[i]))same=a[i];
        else if(same==-1)al.insert(a[i]);
    }
    int x=-1;int y=1;
    rep(i,n+1)if(a[i]==same){
        if(x==-1)x=i;
        else y=i;
    }
    /*
    k=1:かぶりの一個を除いてn
    k=2:かぶった箇所で同じ方向にある要素を見て(n-2)~(n)
    k=3:かぶった箇所と同じ方向にある要素の数
    */
    
    //xより左：x個　yより右：n-y個
    //よって、C(n+1,k)-C(x+n-y,k-1)　(最後の-1は、そいつら自身を一つだけ含むものを引き算したいので)
    //n!までの値＆n!の逆元の前計算が必要
    
    vector<ll> fr(n+2);
    vector<ll> frin(n+2);
    fr[0]=1;
    frin[0]=1;
    rep(i,n+1){
        fr[i+1]=fr[i]*(i+1)%big;
        frin[i+1]=in(fr[i+1]);
    }
    ll ans=0;
    rep2(k,1,n+2){
        if(k-1<=x+n-y){
            ans=((fr[n+1]*frin[k]%big)*frin[n+1-k])%big-(fr[x+n-y]*frin[k-1]%big)*frin[x+n-y-k+1]%big;
        }else{
            ans=((fr[n+1]*frin[k]%big)*frin[n+1-k])%big;
        }
        if(ans<0)ans=(ans+big)%big;
        cout << ans << '\n';
    }
}

Measured memory_bytes: 7936
from collections import deque

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))


cnt_a = [0 for i in range(N+1)]
cnt_b = [0 for i in range(N+1)]

for a in A:
    cnt_a[a]+=1
for b in B:
    cnt_b[b]+=1

for i in range(N+1):
    if cnt_a[i]+cnt_b[i]>N:
        exit(print("No"))

print("Yes")

aidx = [i for i in range(N)]
bidx = [N-i-1 for i in range(N)]
bidx_left = deque([])

res = [-1 for i in range(N)]

while aidx and bidx:
    if A[aidx[-1]]!=B[bidx[-1]]:
        res[bidx[-1]] = aidx[-1]
        bidx.pop()
        aidx.pop()
    elif bidx_left and B[bidx_left[0]]!=A[aidx[-1]]:
        res[bidx_left[0]] = aidx[-1]
        bidx_left.popleft()
        aidx.pop()
    else:
        bidx_left.append(bidx[-1])
        bidx.pop()

while aidx:
    if A[aidx[-1]]!=B[bidx_left[-1]]:
        res[bidx_left[-1]] = aidx[-1]
        bidx_left.pop()
        aidx.pop()
    else:
        break

aidx = aidx[::-1]
while aidx:
    if A[aidx[-1]]!=B[bidx_left[-1]]:
        res[bidx_left[-1]] = aidx[-1]
        bidx_left.pop()
        aidx.pop()
    else:
        break

if aidx:
    c = len(aidx)
    num = A[aidx[-1]]
    change = []
    for i in range(N):
        if not aidx:
            break
        if res[i]!=-1 and B[i]!=num and A[res[i]]!=num:
            res[bidx_left[-1]] = res[i]
            res[i] = aidx.pop()
            bidx_left.pop()

ans = [0 for i in range(N)]
for i in range(N):
    ans[res[i]]=B[i]

print(*ans)

Measured memory_bytes: 164532
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n;
    cin >> n;
    auto cnt = make_vec<int>(10, 10);
    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        cnt[s[0] - '0'][s[sz(s) - 1] - '0']++;
    }

    ll ans = 0;
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            ans += (ll)cnt[j][i] * cnt[i][j];
        }
    }
    cout << ans << endl;
}


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

int main()
{
  int N, X;
  int fx = 0;
  cin >> N;
  X = N;
  while(X != 0)
  {
    fx += X % 10;
    X /= 10;
  }
  if(N % fx == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

using namespace std;

int main(){
    char s[1000],t[1000];
    int a,b;
    char u[1000];

    cin>>s>>t;
    cin>>a>>b;
    cin>>u;

    if(strcmp(s,u)==0){
        a=a-1;
    }else if(strcmp(t,u)==0){
        b=b-1;
    }
    cout<<a<<" "<<b<<endl;
    
}

Measured memory_bytes: 888
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

int S, K;
int main(int argc, const char * argv[]) {
  cin >> K >> S;

  int cnt = 0;
  for (int i = 0; i <= K; i++) {
    for (int j = 0; j <= K; j++) {
      int z = S - i - j;
      if (0 <= z && z <= K) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


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

using namespace std;

int main(){
    int n,k;
    cin >> n >> k ;
    vector<int> v;
    int a;
    for(int i=0;i<n;i++){
        cin >> a ;
        v.push_back(a);
	}
    sort(v.begin(), v.end());
    long ans;
    ans=0;
    for (int j = 0; j<k;j++) {
        ans= ans +v[j];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define repi(i,a,n) for(int i = (int)a; i < (int)(n); i++)
#define ll long long

int main(void){
    ll int a,b,k;
    
    std::cin >> a >>b >>k;
    
    if(k>=a){
        k-=a;
        a=0;
    }else{
        a-=k;
        k=0;
    }

    if(k>=b){
        b=0;
    }else{
        b-=k;
    }
    
    std::cout << a <<" "<<b << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#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 Rep(i,a) for(int i = 0; i < a; i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ab(x) ((x) < 0 ? -(x) : (x))
using namespace std;
typedef long long LL;
typedef map<int, int>::iterator mit;
typedef set<int>::iterator sit;
const int N = 1e5 + 10, mod = 1e9 + 7;
int a[N];
int main() {
	int n; scanf("%d",&n);	
	rep(i,1,n) scanf("%d",a + i);
	int ans = 1, cur = 1;
	rep(i,1,n) {
		while (cur < n && (cur - i + 1) * 2 - 1 <= a[cur]) cur++;
		ans = 1LL * ans * (cur - i + 1) % mod;
	}
	cout <<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>

int main(){
  int N;
  int A[100];
  int i,j;
  int count = 0;
  int temp;
  
  scanf("%d",&N);
  
  for(i = 0 ;i < N ;i++){
    scanf("%d",&A[i]);
  }

  for(i = 0; i < N-1 ;i++){
    for(j = N-1; j > i; j--){
      if(A[j] < A[j-1]){
	temp = A[j];
	A[j] = A[j-1];
	A[j-1] = temp;
	count++;
      }
    }
  }

  for(i = 0; i < N; i++){
    printf("%d",A[i]);
    if(i == N-1){
      printf("\n");
      break;
    }
    else printf(" ");
  }
  
  printf("%d\n",count);
  
  return 0;
}



Measured memory_bytes: 2104
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int X=stdIn.nextInt();
		int L=0;
		int z=1,sum=0;
		while(z<=N){
			L=stdIn.nextInt();
			sum+=L;
			if(sum>X)
				break;
			z++;
		}
		System.out.println(z);
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

class Combination {
   public:
    Combination(int n) {
        fac = new ll[n];
        inv = new ll[n];
        finv = new ll[n];
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        REP(i, 2, n) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    ll cnr(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;
    }

   private:
    ll *fac, *inv, *finv;
};

int main() {
    int N, K; cin >> N >> K;
    Combination comb(N);

    for (int i = 1; i <= K; i++) {
        cout << (comb.cnr(N - K + 1, i) * comb.cnr(K - 1, i - 1)) % MOD << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
	char houses[4][3][10] = {{{0}}};
    int n, b, f, r, v;

	scanf("%d", &n);
	while (n--) {
		scanf("%d %d %d %d", &b, &f, &r, &v);
		houses[b-1][f-1][r-1] += v;
	}
	for (b = 0; b < 4; b++) {
		for (f = 0; f < 3; f++) {
			for (r = 0; r < 10; r++) {
				printf(" %d", houses[b][f][r]);
			}
			putchar('\n');
		}
		if (b < 3) {
			puts("#####" "#####" "#####" "#####");
		}
	}
	return 0;
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

int mod(int a, int b){return (a%b+b)%b;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}



template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef map<int, int> mint;
typedef vector<int> vint;
typedef vector<char> vch;
typedef vector<long long> vll;
typedef vector<string> vstr;

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;

    vstr a(n), b(m);

    rep(i, n)
        cin >> a[i];
    rep(i, m)
        cin >> b[i];

    bool ok = false;

    rep(i, n){
        rep(j, n){
            if(i+m-1 >= n or j+m-1 >= n) continue;
            bool exist = true;
            rep(y, m){
                rep(x, m){
                    if(a[i+y][j+x] != b[y][x]) exist = false;
                }
            }
            if(exist)
                ok=true;
        }
    }

    Judge(ok);



    return 0;
}


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

class Restaurant:
    def __init__(self, id=None, name=None, score=None):
        self.id = id
        self.name = name
        self.score = score

r = [None for _ in range(n)]

for i in range(n):
    s, p = input().split()
    r[i] = Restaurant(i + 1, s, int(p))

r.sort(key=lambda x:(x.name, -x.score))

for i in range(n):
    print(r[i].id)


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

const int N=2e5+10,Mod=1e9+7,Inf=1e9+10;

struct Node{
	int k,x,l,r;
	bool operator < ( const Node &A ) const { return (r<A.r) || ( r==A.r && l<A.l); }
}p[N];

bool cmpk( const Node &A , const Node &B ) { return A.k<B.k; }
bool cmpx( const Node &A , const Node &B ) { return A.x<B.x; }

int n,f[N],sum[N];

void Init() {
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%d%d",&p[i].x,&p[i].k);
}

void Solve() {
	std::sort(p+1,p+n+1,cmpk); for (int i=1;i<=n;++i) p[i].k=i;
	std::sort(p+1,p+n+1,cmpx); for (int i=1;i<=n;++i) p[i].x=i;
	int mx=-Inf;
	for (int i=1;i<=n;++i) {
		mx=std::max(mx,p[i].k);
		p[i].r=mx;
	}
	int mn=Inf;
	for (int i=n;i>=1;--i) {
		mn=std::min(mn,p[i].k);
		p[i].l=mn;
	}
	std::sort(p+1,p+n+1);
	f[0]=1; sum[0]=1; int t=1; 
	for (int i=1;i<=n;++i) {
		while (p[t].r==i && t<=n) {
			f[i]=(1ll*f[i]+f[i]+sum[i-1]-sum[p[t].l-1]+f[p[t].l-1])%Mod;
			++t;
		}
		sum[i]=(sum[i-1]+f[i])%Mod;
	}
	printf("%d\n",(f[n]+Mod)%Mod);
}

int main() {
	Init();
	Solve();
	return 0;
}

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

//関数宣言
//int func(int x, int y);

int main(void){

  //スカラー入力
  int K,N;

  scanf("%d %d", &N, &K);

  /* //配列入力 */
  /* int A[M][N]; */

  /* for(int i=0; i<M; i++){ */
  /*   for(int j=0; j<N; j++){ */
  /*     scanf("%d", &A[i][j]); */
  /*   } */
  /* } */

  /* //文字列入力 */
  /* char str[10]; */
  /* scanf("%s", str); */

  int min=K, max=N, i=0;
  double p = 1.0, ans, dblN;
  dblN = (double) N;
  if(K>N){
    ans = 0.0;
  }else{
    ans = (N-K+1) / dblN;
  }
  /* printf("%f\n", ans); */

  do{
    i++;
    if(min>N){
      max = N;
    }else{
      max = min-1;
    }
    min = ceil(K/pow(2,i));
    p = p * 0.5;
    if(max >= min){
      ans += (max - min + 1) / dblN * p;
    }
    /* printf("%f: %d %d %f\n", ans, max, min, p); */

  }while(min!=1);
  printf("%.12f\n", ans);

  return 0;
}


Measured memory_bytes: 384
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<algorithm>

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define For(i,x,y) for(int i=((int)x);i<=((int)y);i++)
#define Dep(i,y,x) for(int i=((int)y);i>=((int)x);i--)
#define Rep(i,x) for (int y,i=head[x];i;i=E[i].nxt)
using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;

int rd() {
	char c=getchar(); int t=0,f=1;
	while (!isdigit(c)) f=(c=='-')?-1:1,c=getchar();
	while (isdigit(c)) t=t*10+c-48,c=getchar(); return t*f;
}
void wt(int x) {
	if (x<0) putchar('-'),wt(-x);
	else { if (x>9) wt(x/10); putchar(x%10+48); }
}

const int N=305;
const int mod=1000000007;

int n,m;
vector<pii>VI[N];
int f[2][N][N],ans;

inline void inc(int &x,int y) { x+=y; if (x>=mod) x-=mod; }

int main() {
	
	n=rd(),m=rd();
	For (i,1,m) {
		int l=rd(),r=rd(),x=rd();
		VI[r].push_back(mp(l,x));
	}
	
	f[1][0][0]=1;
	For (i,1,n) {
		memset(f[i&1^1],0,sizeof f[i&1^1]);
		For (q,0,VI[i].size()-1) {
			int l=VI[i][q].fi,x=VI[i][q].se;
			For (j,0,i-1) For (k,0,max(j-1,0)) {
				int t=1;
				if (j>=l) t++;
				if (k>=l) t++;
				if (t!=x) f[i&1][j][k]=0;
			}
		}
		For (j,0,i-1)
		For (k,0,max(j-1,0)) {
			inc(f[i&1^1][j][k],f[i&1][j][k]);
			inc(f[i&1^1][i][k],f[i&1][j][k]);
			if (j!=k) inc(f[i&1^1][i][j],f[i&1][j][k]);
		}
	}
	
	inc(ans,3ll*f[n&1][0][0]%mod);
	For (j,1,n-1) For (k,1,j-1)
		inc(ans,6ll*f[n&1][j][k]%mod);
	For (j,1,n-1) inc(ans,6ll*f[n&1][j][0]%mod);
	printf("%d\n",ans);
	
	return 0;
}
/*
8 10
2 6 2
5 5 1
3 5 2
4 7 3
4 4 1
2 3 1
7 7 1
1 5 2
1 7 3
3 4 2

*/





Measured memory_bytes: 1152
def main():
    n = int(input())
    x_lst = list(map(int, input().split()))
    x_sorted_lst = sorted(x_lst)

    median1 = x_sorted_lst[n // 2 - 1]
    median2 = x_sorted_lst[n // 2]

    if median1 == median2:
        lst = [median1] * n

    else:
        lst = []
        for i in range(n):
            x = x_lst[i]

            if x <= median1:
                lst.append(median2)
            elif median2 <= x:
                lst.append(median1)

    for i in range(n):
        print(lst[i])


if __name__ == '__main__':
    main()

Measured memory_bytes: 30576
#include <stdio.h>
#include <stdint.h>
#include <memory.h>

#define NUM_ALPHABETS (26)
int main(void)
{
    uint8_t flag[NUM_ALPHABETS];
    char c;
    uint8_t i;
    memset(flag, 0, sizeof(flag));
    while ((c = getchar()) != '\n') {
        int idx = (int)c - 'a';
        flag[idx]++;
    }

    for (i = 0; i < NUM_ALPHABETS; i++) {
        if (flag[i] & 1) {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}



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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    vi sn(1100);
    REP(i,1,1100) sn[i] = i*(i+1)*(i+2) / 6;
    vi dp1(1000010, INF);
    vi dp2(1000010, INF);
    dp1[0] = 0;
    rep(i,1000010){
        rep(j,1100){
            if(i - sn[j] >= 0)
                dp1[i] = min(dp1[i], dp1[i-sn[j]] + 1);
        }
    }
    dp2[0] = 0;
    rep(i,1000010){
        rep(j,1100){
            if(i - sn[j] >= 0 && sn[j] & 1)
                dp2[i] = min(dp2[i], dp2[i-sn[j]] + 1);
        }
    }
    int x;
    while(cin >> x){
        if(x == 0) break;
        cout << dp1[x] << " " << dp2[x] << endl;
    }
    return 0;
}


Measured memory_bytes: 10572
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	ll ans = 0;
	for(int i = 0; i < n; ++i) {
		for(int j = i + 1; j < n; ++j) {
			ans += a[i] * a[j];
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

        int n = in.nextInt();
        int s = 0;
        while(n-- > 0) {
            s += in.nextInt() - 1;
        }
        out.println(s);


        out.close();
        //INT OVERFLOW -> USE LONG
        //ARR OUT OF BOUNDS
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

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

        public double[] nextDoubleArray(int n) {
            double[] arr = new double[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextDouble();
            }
            return arr;
        }

        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        public char[] nextCharArray(int n) {
            char[] arr = nextLine().trim().replaceAll("\\s", "").toCharArray();
            return arr;
        }

        public String[] nextStringArray(int n) {
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = next();
            }
            return arr;
        }
    }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>                          
using namespace std;
int n,m,ans;
int main(){
    cin>>n>>m;
    for(int i=m-1;i>=1;i--) ans+=i;
    for(int i=n-1;i>=1;i--) ans+=i;
    cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int y,m,d;
  long long int t;
  for(;cin>>y>>m>>d;)
    {
      string n="meiji";
      t=y*365+m*12+d;
      y-=1867;
      if(t>1912*365+7*12+29)
        n="taisho",y-=44;
      if(t>1926*365+12*12+24)
        n="showa",y-=14;
      if(t>1989*365+1*12+7)
        n="heisei",y-=63; 
      if(t<1868*365+9*12+8)
        cout<<"pre-meiji"<<endl;
      else
        cout<<n<<" "<<y<<" "<<m<<" "<<d<<endl;
    }
}

Measured memory_bytes: 1208
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
typedef long long ll;
const int MAXM = 4e2 + 5;
const int MAXN = 26 + 5;
const int inf = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3f;

int n=26, m;
int c[MAXN];
int a[MAXM][MAXN];

int p[MAXM];
set<int> idx[MAXN];
int ans;

void init(void)
{
	for(int i=1; i<=n; ++i)
	{
		idx[i].clear();
		idx[i].insert(0);
		idx[i].insert(m+1);
	}
	
	for(int k=1; k<=m; ++k)
		idx[ p[k] ].insert(k);
}

int recalc(register int pos, register int x)
{
	register int old = p[pos];
	if(old == x) return ans;
	
	register int res = ans;
	
	idx[old].erase(pos);
	
	set<int>::iterator it = idx[old].upper_bound(pos);
	register int nxt = *it;
	register int lst = *(--it);
	
	res -= (pos - lst) * c[old] * (nxt - pos) + a[pos][old];
	
	it = idx[x].upper_bound(pos);
	nxt = *it;
	lst = *(--it);
	
	res += (pos - lst) * c[x] * (nxt - pos) + a[pos][x];
	
	idx[x].insert(pos);
	
	p[pos] = x;
	return res;
}

int main(void)
{
	srand(time(0));
	
	scanf("%d",&m);
	for(int i=1; i<=n; ++i) scanf("%d",&c[i]);
	for(int i=1; i<=m; ++i)
		for(int j=1; j<=n; ++j)
			scanf("%d",&a[i][j]);
	
	static int lst[MAXN];
	
	ans = 0;
	for(int k=1; k<=m; ++k)
	{
		int mx = -inf;
		int mxi = -1;
		for(int i=1; i<=n; ++i)
		{
			int res = a[k][i];
			for(int j=1; j<=n; ++j) if(j!=i)
				res -= c[j] * (k-lst[j]);
			
			if(mxi==-1 || mx < res)
				mxi = i, mx = res;
		}
		lst[mxi] = k;
		
		ans += mx;
		p[k] = mxi;
	}
	
	init();
	
	register int T = 6e6;
	while(T--)
	{
		int pos = rand()%m + 1;
		int x = rand()%n + 1;
		
		int old = p[pos];
		int res = recalc(pos, x);
		if(res < ans) recalc(pos, old);
		else ans = res;
	}
	
	for(int i=1; i<=m; ++i) printf("%d\n",p[i]);
	return 0;
}

Measured memory_bytes: 3380
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define Cout(s) cout << s << endl;
#define CoutV(vec)        \
    for (auto v : vec)    \
    {                     \
        cout << v << " "; \
    }                     \
    cout << endl;
#define CoutVV(vecvec)      \
    for (auto vec : vecvec) \
        CoutV(vec);

using ll = long long;
using P = pair<int, int>;
#define INF 10000000;

ll MOD = 1e9 + 7;

ll gcd(ll x, ll y) { return (y != 0) ? gcd(y, x % y) : x; }

int main()
{


    ll n, x;
    cin >> n;
    vector<ll> X(n + 1);
    vector<ll> d(n);
    cin >> X[0];
    for (int i = 1; i <= n; i++)
    {
        cin >> X[i];
    }

    REP(i, n)
    d[i] = abs(X[i] - X[i + 1]);

    ll ans = d[0];

    REP(i, n)
    {
        ans = gcd(ans, d[i]);
    }

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


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

int main() {
    string s,t;
    cin >> s;
    cin >> t;

    int ans = 1e9;
    rep(i,s.size()) {
        if (i+t.size() > s.size()) break;
        int count = 0;
        rep(j,t.size()) {
            if (s[i+j] != t[j]) {
                count++;
            }
        }
        ans = min(ans, count);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	lld n;
	cin >> n;
	vector<pair<lld,bool> > a(2*n);
	for(int i = 0; i < 2*n; i++)
	{
		cin >> a[i].first;
		if (i < n)
		{
			a[i].second = true;
		}else
		{
			a[i].second = false;
		}
	}
	
	sort(a.begin(),a.end());

	lld ans = 1;
	lld A=0,B=0;
	for(int i = 0; i < 2*n; i++)
	{
		if (a[i].second)
		{
			if (B==0)
			{
				A++;
			}else
			{
				ans *= B%mod;
				ans %= mod;
				B--;
			}
		}else
		{
			if (A==0)
			{
				B++;
			}else
			{
				ans *= A%mod;
				ans %= mod;
				A--;
			}
		}
	}

	cout << ans%mod << endl;

	return 0;
}

Measured memory_bytes: 3328
fun main(args: Array<String>) {
    val (N, M) = readInputLine().split(" ").map { it.toInt() }
    val S = readInputLine().toCharArray().reversed()
    
    var now = 0
    val step = mutableListOf<Int>()
    
    while (now != N) {
        var ok = false
        for (i in M downTo 1) {
            if (now + i > N || S[now + i] == '1') {
                continue
            }
            ok = true
            now = now + i
            step.add(i)
            break
        }
        if (!ok) {
            println(-1)
            return
        }
    }

    println(step.reversed().joinToString(" "))
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 41408
#!/usr/bin/env python3
from itertools import product, permutations, combinations
from bisect import bisect_right,bisect_left
INF = float('inf')

N=int(input())
h=list(map(int, input().split()))
dp = [10**4] * (N+2)
dp[0] = 0
dp[1] = dp[0] + abs(h[0]-h[1])
for i in range(2, N):
    dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2]-h[i]))
print(dp[N-1])

Measured memory_bytes: 14480
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f3f;
const int maxn = 1e5+500;
ll T,n,m;
vector<ll> num(maxn);
vector<double> t(maxn);
int main() {
    cin>>n;
    for(int i=0;i<n;i++)
    	cin>>num[i],t[i]=1.0/num[i];
    double sum= 0;
	for(int i=0;i<n;i++){
		sum+=t[i];
	}
	printf("%.6f\n",1.0/sum);
//	cout<<1.0/sum<<endl;
}



Measured memory_bytes: 1792
import sys

input()
input_line = [int(i) for i in input().split(" ") if int(i) % 2 == 0]

if input_line == []:
  print("APPROVED")
  sys.exit()

for i in input_line:
  if i % 3 == 0:
    continue
  if i % 5 == 0:
    continue
  print("DENIED")
  sys.exit()
print("APPROVED")    

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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll N, M;
    cin >> N >> M;
    ll ai, bi;
    vector<set<ll>> g(N, set<ll>());
    for(int i=0;i<M;i++){
        cin >> ai >> bi;
        g[ai-1].insert(bi-1);
        g[bi-1].insert(ai-1);
    }
    vector<ll> pattern(N-1, 0);
    iota(pattern.begin(), pattern.end(), 1);
    ll res=0;
    do{
        if(g[0].count(pattern[0])==0) continue;
        bool isGood = true;
        for(int i=0; i<N-2; i++){
            isGood = (g[pattern[i]].count(pattern[i+1])>0);
            if(!isGood) break;
        }
        if(isGood) res++;
    }while(next_permutation(pattern.begin(), pattern.end()));

    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 256
/******************************************************************************

            EYENINE,THE ELDER_WAND!!!
            THE ROOT OVER MINUS EIGHTY ONE!!

*******************************************************************************/

#include<bits/stdc++.h>
#define ALL_UP_WITH return 0
using namespace std;
int n,a[100],s,ans=INT_MAX;
int main()
{

    ios::sync_with_stdio(false);
    cin.tie(0);
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
    }
    for(int  t=-100; t<=100; t++)
    {
        s=0;
        for(int i=0; i<n; i++)
        {
            s+=(t-a[i])*(t-a[i]);
        }
        ans=min(ans,s);
    }
    printf("%d\n",ans);

    ALL_UP_WITH;
}


Measured memory_bytes: 256
// Ala be zekrellah tatmaenolgholoob ...
// :)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define F first
#define S second
#define MP make_pair
using namespace std;
using namespace __gnu_pbds;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef pair<int,int> pii;
typedef pair<int64,int64> pii64;
const int maxn = 1e5+9;
const int64 M = 1e9+7;
const int64 I = 1e9;

int a, b, c;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> a >> b >> c;
	int64 ans = min(c, a + b + 1);
	ans += b;
	cout << ans << "\n";
}



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

int main(void) {
    int h, w;
    string s;
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> s;
            if (s == "snuke") {
                cout << (char)(j + 'A') << i + 1 << endl;
            }
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    int a[2][n];
    for(int i = 0; i <2; i++){
        for(int j = 0; j < n; j++) cin >> a[i][j];
    }
    int ma = INT_MIN;

    for(int i = 0; i < n; i++){
        // i番目で下に行く
        int c = a[0][0];
        int nowi = 0, nowj = 0;

        for(int j = 0; j < i; j++){
            nowj++;
            c += a[nowi][nowj];
        }

        nowi++;

        for(int j = nowj; j < n; j++){
            c += a[nowi][nowj];
            nowj++;
        }
        ma = max(ma, c);
    }
    cout << ma << endl;
}

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

using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#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 all(c) c.begin(),c.end()
const int inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
//const ll mod = 1000000009;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p;//<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };



int main() {
	vi a(3);
	rep(i, 3) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int cnt = 0;
	while (a[0] + 2 <= a[2]) {
		a[0] += 2;
		cnt++;
	}
	sort(a.begin(), a.end());
	while (a[0] + 2 <= a[2]) {
		a[0] += 2;
		cnt++;
	}
	sort(a.begin(), a.end());
	if (a[0] == a[2]) {
		cout << cnt << endl;
	}
	else {
		if (a[0] == a[1]) {
			cout << cnt + 1 << endl;
		}
		else {
			cout << cnt + 2 << endl;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define allR(x) (x).rbegin(), (x).rend()
using ll = long long;
using P = pair<int, int>;
const int INF = 2'000'000'000;

int main() {
  string S, T;
  cin >> S >> T;

  bool isOk = true;

  if (S.length()+1 == T.length()) {
    rep(i, S.length()) {
      if (S[i] != T[i]) {
        isOk = false;
        break;
      }
    }
  }
  else {
    isOk = false;
  }


  if (isOk) cout << "Yes" << endl;
  else cout << "No" << endl;



  return 0;
}


Measured memory_bytes: 3624
main()
{
	long long n,l,r,k,res=0;
	scanf("%lld",&n);
	for(l=1;l<=n;l=r+1)
		k=n/l,r=n/k,res+=(l<=r-1&&r*k==n)?(r-1):0;
	printf("%lld\n",res);
}

Measured memory_bytes: 1724
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    int n, x, t;
    cin >> n >> x >> t;
    cout << (int) ceil( (double) n/x) * t << '\n';
}

int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    //int t; cin >> t; while (t--)
        solve();
}

Measured memory_bytes: 3660
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int a, b;
bool c[4];

int solve() {
    c[a] = true;
    c[b] = true;
    int res = 0;
    for (int i = 1; i <= 3; i++) {
        if (!c[i]) {
            res = i;
            break;
        }
    }
    return res;
}

void input() {
    cin >> a >> b;
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc133/tasks/abc133_c
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int L, R;
    cin >> L >> R;
    int ans = 1e9;
    FOR(i, L, min(R + 1, L + 2020 * 2)) {
        FOR(j, i + 1, min(R + 1, L + 2020 * 2)) {
            ans = min(ans, (i * j) % 2019);
        }
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define INTMAX 2147483647LL
#define PII pair<int,int>
#define MP make_pair
#define fir first
#define sec second
#define pb push_back
#define re register
#define lc c[x][0]
#define rc c[x][1]
using namespace std;
typedef long long ll;
const double Pi=acos(-1.0);
const int Inf=0x3f3f3f3f;
const int MAXN=1e5+10;
const int Mod=1e9+7;
inline int read(){
	re int x=0,f=1,ch=getchar();
	while(!isdigit(ch))f=ch=='-'?-1:1,ch=getchar();
	while(isdigit(ch))x=x*10+ch-48,ch=getchar();
	return x*f;
}
inline ll readll(){
	re ll x=0,f=1,ch=getchar();
	while(!isdigit(ch))f=ch=='-'?-1:1,ch=getchar();
	while(isdigit(ch))x=x*10+ch-48,ch=getchar();
	return x*f;
}

struct Node{int L,R;}p[MAXN];
inline bool cmp(Node x,Node y){return x.L==y.L?x.R<y.R:x.L<y.L;}

int n,m,cnt;
int a[MAXN],b[MAXN];
int R_pos[MAXN];
int BIT[MAXN];
vector<int> v;

inline int lowbit(int x){return x&(-x);}
inline void Update(int x,int v){for(int i=x;i<=n;i+=lowbit(i)) BIT[i]=(BIT[i]+v)%Mod;}
inline int Query(int x){int res=1;for(int i=x;i;i-=lowbit(i)) res=(res+BIT[i])%Mod;return res;}

int main(){
	n=read();m=read();
	for(int i=1;i<=n;++i) a[i]=read();
	for(int i=1;i<=m;++i) b[i]=read();
	
	for(int i=1,pos;i<=n;++i){
		if(a[i]<=b[1]||a[i]>=b[m]) continue;
		pos=lower_bound(b+1,b+m+1,a[i])-b;
		p[++cnt]=(Node){a[i]-b[pos-1],b[pos]-a[i]};
		v.pb(p[cnt].R);
	}
	sort(v.begin(),v.end());
	v.erase(unique(v.begin(),v.end()),v.end());
	n=cnt;sort(p,p+cnt+1,cmp);
	for(int i=1,j=1,curL,curR;i<=n;i=j){
		//cout<<i<<endl;
		curL=p[i].L;
		while(j<=n&&p[j].L==curL) ++j;
		//cout<<i<<endl;
		for(int k=j-1;k>=i;--k){
			curR=lower_bound(v.begin(),v.end(),p[k].R)-v.begin()+1;
			if(k!=j-1&&p[k].R==p[k+1].R) continue;
			Update(curR,Query(curR-1));
		} 
		//cout<<i<<endl;
	}
	printf("%d\n",Query(v.size()));
	return 0;
}

Measured memory_bytes: 2424
#include <stdio.h>

int main() {
	int money, coinh, coinf, h;
	scanf("%d", &money);
	coinh = money / 500;
	money = money - (500 * coinh);
	coinf = money / 5;
	h = (1000 * coinh) + (5 * coinf);
	printf("%d", h);
}

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

long long f(long long y, long long x){//0からyまで
    if(y==-1) return 0;
    return y/x + 1;
}

int main(){
    long long a, b, x; cin >> a >> b >> x;
    cout << f(b, x) - f(a-1, x) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 2000000;

int main() {
	int R[MAX], n;

	cin >> n;

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

	int maxValue = -2000000000; // ???????°??????????????????????????¨????
	int minValue = R[0];

	for ( int i = 1; i < n; i++ ) {
		maxValue = max(maxValue, R[i] - minValue);
		minValue = min(minValue, R[i]);
	}

	cout << maxValue << endl;

	return 0;
}

Measured memory_bytes: 3864