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

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Q = sc.nextInt();
        String S = sc.next();
        ArrayList<Integer> List = new ArrayList<Integer>();
        int num=0;
        for(int i=0;i<N-1;i++) {
            char s = S.charAt(i);
            char s2 = S.charAt(i+1);
            if(s=='A'&&s2=='C'){
                List.add(num);
                num+=1;
            }
            else List.add(num);
        }
        List.add(num);
        for(int i=0;i<Q;i++){
            int l = sc.nextInt();
            int r = sc.nextInt();
            int opt =List.get(r-1)-List.get(l-1);
            System.out.println(opt);
        }
	}
}


Measured memory_bytes: 94188
(let* ((n (read))
       (d (read))
       (lst (loop :repeat n :collect(loop :repeat d :collect (read))))
       (ans '()))
  (mapcar (lambda (pos1)
            (mapcar (lambda (pos2)
                      (push (reduce #'+ (mapcar (lambda (p q) (expt (- p q) 2)) pos1 pos2)) ans)) lst)) lst)
  (princ (floor (length (remove 0 (remove-if-not (lambda (x) (= (expt (isqrt x) 2) x)) ans))) 2)))

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

using namespace std;

int main(int argc, char * argv[]) {
    int k;
    cin >> k;

    vector<long long> nbs;

    queue<long long> vals;

    for(int i = 1; i<=9; ++i) {
        vals.push(i);
    }

    while(nbs.size() < k) {
        long long val = vals.front();

        nbs.push_back(val);
        vals.pop();

        int res = val%10;
        if(res != 0 && res != 9) {
            val *=10;
            vals.push(val + res - 1);
            vals.push(val + res);
            vals.push(val + res + 1);
        }
        else if(res == 9) {
            val *=10;
            vals.push(val + res - 1);
            vals.push(val + res);
        }
        else {
            val *=10;
            vals.push(val);
            vals.push(val + 1);
        }

    }

    cout << *(nbs.end() - 1) << endl;
}

Measured memory_bytes: 2548
#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.at(i);
  }
  int i=0;
  sort(A.begin(),A.end());
  while(i!=N-1){
    while(A.at(i)==0){
      i++;
    }
    for(int j=i+1;j<N;j++){
      A.at(j)%=A.at(i);
    }
    sort(A.begin(),A.end());
  }
  cout<<A.at(N-1)<<endl;
}


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

int main() {
	int a = 0;
	int A[4] = {};
	

	std::cin >> a;

	A[0] = a % 10;
	a /= 10;
	A[1] = a % 10;
	a /= 10;
	A[2] = a % 10;
	a /= 10;
	A[3] = a % 10;
	for (int i = 0; i < 4; i++) {
		if (i + 1 < 4) {
			if (A[i] == A[i + 1]) {
				a = 0;
				break;
			}
			else {
				a = 1;
			}
		}

	}

	if (a == 0) {
		std::cout << "Bad" << std::endl;
	}
	else {
		std::cout << "Good" << std::endl;
	}

}

Measured memory_bytes: 256
/*
  B - Increment Decrement
  Contest 052
  Rakesh Kumar --> 04/08/2020
 */

#include <bits/stdc++.h>

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

    int n = 0;
    std::cin >> n;
    std::cin.ignore();
    std::string s;
    std::getline(std::cin, s);

    int x = 0;
    int m = 0;
    for (char c : s) {
        if (c == 'I') ++x;
        else --x;
        m = std::max(x, m);
    }
    std::cout << m << std::endl;

    return 0;
}


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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    char s[312];
    Scs(s);
    int N = strlen(s);
    Rep(i,N){
        printf ("%c", 'x');
    }
    printf ("\n");

    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	static int ans = 0;
	static long N;
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		dfs(0,0,0,0);
		System.out.println(ans);
	}

	private static void dfs(long n, int x3, int x5, int x7) {
		if(x3>0&&x5>0&&x7>0&&n<=N) ans++;
		if(n*10<N) {
			dfs(n*10+3,x3+1,x5,x7);
			dfs(n*10+5,x3,x5+1,x7);
			dfs(n*10+7,x3,x5,x7+1);
		}
	}
}

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

int vis[105];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,k;
	cin >> n >> k;
	for (int i = 1; i <= k; i++)
	{
		int x;
		cin >> x;
		for (int j = 1; j <= x; j++)
		{
			int t;
			cin >> t;
			vis[t] = 1;
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if( vis[i] == 0 ) ans ++;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3196
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys, math, bisect, random, itertools
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = II()
    print(n*n*3)
    return

#B
def B():
    n, d = LI()
    print((n-1)//(2*d+1)+1)
    return

#C
def C():
    n = II()
    a = IR(n)
    b = a[::1]
    b.sort()
    for i in range(n):
        if a[i] == b[-1]:
            print(b[-2])
        else:
            print(b[-1])
    return

#D
def D():
    n = II()
    a = [0] + LI()
    for i in range(n // 2, 0, -1):
        x = sum(a[i::i])
        if x % 2 != a[i]:
            a[i] ^= 1
    ans = []
    x = 0
    for i in range(1, n + 1):
        if a[i]:
            ans.append(str(i))
            x += 1
    print(x)
    if x == 0:
        return
    print(" ".join(ans))
    return

#E
def E():
    return

#F
def F():
    return

#Solve
if __name__ == '__main__':
    D()


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

#define ff first
#define ss second
#define endl '\n'

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

	int n;
	cin >> n;

	string s, t;
	cin >> s >> t;

	for (int i = 0; i < s.size(); ++i) {
		cout << s[i] << t[i];
	}

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int T = s.nextInt();
        int A = s.nextInt();
        int ans = 0;
        double nearlest = 10000;
        for(int i = 0; i < N; i++){
            double n = Math.abs(A - (T - s.nextInt() * 0.006)); //TT忘れちまったぜ☆
            if(n < nearlest){
                ans = i + 1;
                nearlest = n;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 24276
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N,M; cin>>N>>M;
    vector<vector<char>> img(N,vector<char>(N)), tmpl(M,vector<char>(M));
    rep(i,0,N)rep(j,0,N) cin>>img.at(i).at(j);
    rep(i,0,M)rep(j,0,M) cin>>tmpl.at(i).at(j);
    
    bool mismatch=false;
    rep(ni,0,N-M){
        rep(nj,0,N-M){
            mismatch=false;
            rep(mi,0,M){
                rep(mj,0,M){
                    char c_img=img.at(ni+mi).at(nj+mj),
                        c_tmpl=tmpl.at(mi).at(mj);
                    
                    if(c_img!=c_tmpl){
                        mismatch=true;
                        break;
                    }
                }
                if(mismatch) break;
            }
            if(!mismatch) break;
        }
        if(!mismatch) break;
    }

    string ans="Yes";
    if(mismatch) ans="No";
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String msg = "No";

		for (int i = 0; i <= 25; i++) {
			for (int j = 0; j <= 14; j++) {
				if (i * 4 + j * 7 > n) {
					break;
				}
				if (i * 4 + j * 7 == n) {
					msg = "Yes";
				}
			}
		}

		System.out.println(msg);

	}
}

Measured memory_bytes: 23124
#include <stdio.h>
int main()
{
	int n,m,k,flag=0,i,j;
	scanf("%d %d %d",&n,&m,&k);
	for(i=0;i<=n;i++)
	for(j=0;j<m+1;j++)
	{
		if(i*(m-j)+j*(n-i)==k)
		{
			flag=1;break;
		}
	}
	if(flag)printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
fun c79(args: Array<String>) {
    val numList = args[0].toCharArray().map { it.toString().toInt() }
    fun dfs(current: List<Int>, remaining: List<Int>): List<String> {
        if (remaining.isEmpty()) {
            if (current.sum() == 7) {
                val begin = current[0].toString()
                val center = current.drop(1)
                        .map {
                            val sign = if (it < 0) '-' else '+'
                            val value = Math.abs(it)
                            "$sign$value"
                        }
                        .joinToString("")
                return listOf(begin.plus(center).plus("=7"))
            } else {
                emptyList<String>()
            }
        }
        return remaining.flatMap {
            val plus = dfs(current.plus(it), remaining.minus(it))
            val minus = dfs(current.plus(-it), remaining.minus(it))
            return plus.plus(minus)
        }
    }

    print(dfs(numList.take(1), numList.drop(1)).first())
}

fun main(args: Array<String>) {
    c79(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

Measured memory_bytes: 33816
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
using namespace std;

int main(){
  int k;
  cin>>k;
  int a,b;
  cin>>a>>b;
  int f=0;
  for(int i=a;i<=b;i++){
    if(i%k==0){
      f=1;
    }
  }
  if(f==1){
    cout<<"OK";
  }else{
    cout<<"NG";
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
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++)

int main() {
  long n, k, x, y;
  cin >> n >> k;
  long a[n];

  rep (i, n) {
    cin >> a[i];
  }
  x = 0;
  y = pow(10, 9);
  // cout << x << " " << y << endl;
  while (x + 1 < y) {
    long z;
    long sum;
    z = (x + y) / 2;
    sum = 0;
    rep (i, n) {
      sum += (a[i] / z) + !!(a[i] % z);
    }
    if (sum <= n + k) {
      y = z;
    }
    else {
      x = z;
    }
    // cout << x << " " << y << endl;
  }
  cout << y << endl;
}


Measured memory_bytes: 5128
n, q = map(int, input().split())
s = input()
keep = [0]*(n)

for i in range(1, n):
    keep[i] = keep[i-1]
    l, r = i-1, i+1
    if s[l:r] == "AC":
        keep[i] += 1

for j in range(q):
    l, r = map(int, input().split())
    print(keep[r-1]-keep[l-1])


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

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

    sort(vec.begin(), vec.end()); 
    reverse(vec.begin(), vec.end());

    int suma = 0;
    int sumb = 0;

    for(int i = 0; i < N; i++){
        if(i%2 == 0){
            suma += vec[i];
        }
        else{
            sumb += vec[i];
        }

    }

    cout << suma-sumb << endl;
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define IOS cin.tie(0); ios::sync_with_stdio(false)
using namespace std;

main() {
    string S,T; cin >> S >> T;
    map<char,int> m,m2;
    rep(i,S.size()){
        m[S[i]]++;
        m2[T[i]]++;
    }
    if(m.size()!=m2.size()) cout << "No" << endl;
   
    else {
        vector<int> v,v2;
        for(auto p:m){
            v.push_back(p.second);
        }
        for(auto p:m2){
            v2.push_back(p.second);
        }

        sort(v.begin(),v.end());
        sort(v2.begin(),v2.end());
        if(v==v2) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 776
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

int main() {
  int n, l;
  while (cin >> n >> l) {
    int best = 0;
    REP(i,n) best += l + i;
    vint results(n);
    REP(i,n) {
      int r = best - (l + i);
      results[i] = abs(best - r);
    }
    int pos = min_element(ALL(results)) - results.begin();
    cout << best - (l + pos) << endl;
  }
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
map<string,int> m;
int main(){
    string S,T,U;
    int A,B;
    cin>>S>>T>>A>>B>>U;
    m[S]=A;
    m[T]=B;
    if(U==S)m[S]--;
    else m[T]--;
    cout<<m[S]<<" "<<m[T]<<endl;
}


Measured memory_bytes: 256
import math
import itertools
 
def prime_boolean_table(n):
    primes=[True]*(n+1)
    primes[0]=False
    primes[1]=False
    limit=math.floor(math.sqrt(n)+1)
    for i in range(2,limit+1):
        if primes[i]:
            for j in range(i*2,n+1,i):
                primes[j]=False
    return primes

n=10**5
q=int(input())
a=[list(map(int,input().split())) for _ in range(q)]
primes=prime_boolean_table(10**5)
c=[0]*(n+1)
for i in range(n):
    if primes[i+1] and primes[(i+2)//2]:
        c[i+1]=c[i]+1
    else:
        c[i+1]=c[i]
for i in range(q):
    ans=c[a[i][1]]-c[a[i][0]-1]
    print(ans)

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

#define ll long long
#define forr(i,n) for(ll i=0;i<n;i++)
#define f(i,a,b) for(ll i=a;i<b;i++)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)
#define sor(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())

ll power(ll a,ll b){ll r=1;while(b--)r*=a;return r;}
const ll INF=1e17L+5;

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

    int n,W;cin>>n>>W;
    vector<int> wt(n),val(n);
    f(i,0,n)cin>>wt[i]>>val[i];
    int max_sum=0;
    f(i,0,n)max_sum+=val[i];
    vector<ll> dp(max_sum+1,INF);dp[0]=0;

    f(i,0,n){
        for(int j=max_sum-val[i];j>=0;j--){
            dp[j+val[i]]=min(dp[j+val[i]],dp[j]+wt[i]);
        }

    }
    ll ans=0;
    for(ll i=0;i<=max_sum;i++)
    if(dp[i]<=W)ans=max(ans,i);
    cs(ans);


  }


Measured memory_bytes: 3968
N,M=map(int,input().split())
H=list(map(int,input().split()))
L=[0]*N
for i in range(M):
    A,B=map(int,input().split())
    L[A-1]=max(L[A-1],H[B-1])
    L[B-1]=max(L[B-1],H[A-1])
ans=0
for j in range(N):
    if H[j]>L[j]:
        ans+=1
print(ans)

        



    









        

    









    

        




    















    



    





    






        






    
















        


























            
    


    


    
    














    


    














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

#define pb push_back
#define mp make_pair

typedef long long ll;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

ll dp[101][100001];

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

  for(int i = 0; i <= n; i++){
    for(int j = 0; j < 100001; j++){
      dp[i][j] = linf;
    }
  }
  dp[0][0] = 0;

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

  for(int i = 1; i <= n; i++){
    for(int j = 0; j < 100001; j++){
      dp[i][j] = dp[i-1][j];
      if(j-v[i] >= 0){
        dp[i][j] = min(dp[i][j], dp[i-1][j-v[i]] + w[i]);
      }
    }
  }
  
  ll ans = 0;
  for(ll i = 0; i < 100001; i++){
    if(dp[n][i] <= maxw) ans = max(ans, i);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 79104
#include <stdio.h>

int main()
{
  int box[4], keep, keep_2;

  for(int i = 0; i < 3; i++){
    scanf("%d", &box[i]);
  }
  keep = box[0];
  keep_2 = box[1];
  box[0] = box[2];
  box[1] = keep;
  box[2] = keep_2;

  for(int i = 0; i < 3; i++){
    printf("%d ", box[i]);
  }


  return 0;
}

Measured memory_bytes: 1728
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    if (a * b) % 2:
        print("Yes")
    else:
        print("No")
    return

#B
def B():
    n = II()
    w = SR(n)
    d = []
    for i in w:
        d.append("".join(i))
    if len(set(d)) != n:
        print("No")
        return
    for i in range(n - 1):
        if w[i][-1] != w[i + 1][0]:
            print("No")
            return
    print("Yes")
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 38512
fun main(args: Array<String>) {
    abc110c()
}

fun abc110c() {
    val s = readLine()!!
    val t = readLine()!!

    val sMap = mutableMapOf<Char, Char>()
    val tMap = mutableMapOf<Char, Char>()
    for (i in s.indices) {
        val sc = s[i]
        val tc = t[i]
        sMap[sc]?.let { if (it != tc) return println("No") }
        tMap[tc]?.let { if (it != sc) return println("No") }
        sMap[sc] = tc
        tMap[tc] = sc
    }

    return println("Yes")
}


Measured memory_bytes: 36136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    double x, t;
    cin >> x >> t;
    cout << x / t << endl;
    return 0;
}


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

using namespace std;

int main()
{
	int n, t = 1<<30;
	scanf("%d", &n);
	while(t > n) t >>= 1;
	if(n == t) puts("No");
	else
	{
		puts("Yes");
		for(int i=2; i<n; i+=2)
		{
			printf("%d %d\n", 1, i);
			printf("%d %d\n", i, i+1);
			printf("%d %d\n", 1, n+i+1);
			printf("%d %d\n", n+i+1, n+i);
		}
		printf("%d %d\n", n+1, 3);
		if(!(n&1))
		{
			printf("%d %d\n", n, n^t);
			printf("%d %d\n", n*2, n+(t^1));
		}
	}
	return 0;
}

Measured memory_bytes: 2304
parseInt(x) = parse(Int, x)
parseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
  n, k = readline() |> split |> parseArray
  a = readline() |> split |> parseArray
  f = readline() |> split |> parseArray

  sort!(a)
  sort!(f, rev=true)

  prev = maximum(a.*f)
  curr = div(prev, 2)
  ans = 10^18 + 1
  while true
    k′ = 0
    for i in 1:n
      if curr >= a[i] * f[i]
        continue
      end
      k′ += a[i] - floor(Int, curr / f[i])
    end
    # println("$(curr) $(prev) $(k′)")
    m = max(div(abs(prev - curr), 2), 1)
    prev = curr
    if k′ <= k
      ans = curr
      curr -= m
      curr = max(curr, 0)
    else
      curr += m
    end
    if curr == prev || curr == ans
      break
    end
  end

  println(ans)
end

main()


Measured memory_bytes: 174576
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++) 

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<ll> Vl;

const int MOD = 1000000007;

void init();

int k, n_keys;
ll n;
Vl keys, mul;

int main()
{
	init();

	Vl dp(n_keys, 0);
	dp[0] = 1;

	REP(_i, k)
	{
		Vl newdp(n_keys, 0);

		REP(i, n_keys)
			newdp[n_keys - 1 - i] = dp[i];

		for (int i = n_keys - 2; i >= 0; --i)
			newdp[i] = (newdp[i] + newdp[i + 1]) % MOD;

		REP(i, n_keys)
			newdp[i] = newdp[i] * mul[i] % MOD;

		swap(dp, newdp);
	}

	ll ans = accumulate(ALL(dp), 0LL) % MOD;
	cout << ans << endl;
}

void init()
{
	cin >> n >> k;

	int i = 1;
	while (i <= n / i)
	{
		keys.PB(i);
		keys.PB(n / i);
		++i;
	}
	sort(ALL(keys));
	n_keys = SZ(keys);

	mul.resize(n_keys);
	mul[0] = 1;
	REP1O(i, n_keys)
		mul[i] = keys[i] - keys[i - 1];
}

Measured memory_bytes: 2296
/// Zhupengfei 2018
/// Hereby declare: this program is in public domain.

/// Solution for problem: arc070d Sol2

#include <bits/stdc++.h>

#ifdef LOCAL
#pragma GCC poison printf // To avoid fastio problems
#pragma GCC poison scanf
#endif

using namespace std;

int n, K;
int a[5001]={};
bool dp[5001]={};

bool check(int x) {
	if(x>=K) return true;
	memset(dp, 0, sizeof(dp));
	dp[0]=true;
	int skip=-1;
	for(int i=0;i<n;i++) {
		if(a[i]==x) {
			skip=i;
			break;
		}
	}
	for(int i=0;i<n;i++){
		if(i==skip) continue;
		for(int j=K-1;j>=0;j--) {
			if(dp[j]&&j+a[i]<K) {
				dp[j+a[i]]=true;
			}
		}
	}
	for(int i=0;i<K;i++){
		if(dp[i] && i+x>=K) return true;
	}
	return false;
} 

void solve() {
	int l=-1, r=n;
	while(r-l>1) {
		int m=l+(r-l)/2;
		if(check(a[m])){
			r=m;
		} else{
			l=m;
		}
	}
	cout<<r<<endl;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n>>K;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a, a+n);
	solve();
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll unsigned long long
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int>arr(n);
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	vector<int>sorted=arr;
	sort(sorted.begin(),sorted.end(),greater<int>());
	for(int i=0;i<n;i++){
		if(arr[i]==sorted[0]){
			cout<<sorted[1]<<"\n";
		}else{
			cout<<sorted[0]<<"\n";
		}
	}
	return 0;
}

Measured memory_bytes: 3200
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();

		System.out.println((H - h) * (W - w));
		}
}

Measured memory_bytes: 21972
import math
import sys
N = int(input())

X_floor = math.floor(N / 1.08)
X_ceil = math.ceil(N / 1.08)

if int(X_floor * 1.08) == N:
    print(X_floor)
    sys.exit()
if int(X_ceil * 1.08) == N:
    print(X_ceil)
    sys.exit()

print(":(")

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll n,a,b;
    cin>>n>>a>>b;
    cout << min(n*a,b);
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//modをとった余りは循環する
//鳩の巣原理


int main(){
  ll n,x,m;
  cin >> n >> x >> m;
  vector<int> id(m, -1);
  vector<int> a;    //配列

  int len = 0;   //配列の長さ
  ll tot = 0;   //ループの値の合計
  //ループの検出
  while(id[x] == -1){
    a.push_back(x);
    id[x] = len;
    len++;
    tot += x;
    x = (x*x)%m;
  }
  
  int c = len - id[x]; // サイクルの長さ
  ll sum = 0;   //サイクルの合計
  for(int i = id[x]; i < len; ++i) sum += a[i];

  ll ans = 0;
  if(n <= len){ //サイクルに入る前に打ち切り
      REP(i,n) ans += a[i]; 
  }
  else{
    ans += tot;
    n -= len;
    ans += sum*(n/c);
    n %= c;
    REP(i,n) ans += a[id[x]+i];
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4048
class Combination:
    """
    SIZEが10^6程度以下の二項係数を何回も呼び出したいときに使う
    使い方:
    comb = Combination(SIZE, MOD)
    comb(10, 3) => 120
    """

    def __init__(self, N, MOD=10 ** 9 + 7):
        self.MOD = MOD
        self.fact, self.inv = self._make_factorial_list(N)

    def __call__(self, n, k):
        if k < 0 or k > n:
            return 0
        res = self.fact[n] * self.inv[k] % self.MOD
        res = res * self.inv[n - k] % self.MOD
        return res

    def _make_factorial_list(self, N):
        fact = [1] * (N + 1)
        inv = [1] * (N + 1)
        MOD = self.MOD
        for i in range(1, N + 1):
            fact[i] = (fact[i - 1] * i) % MOD
        inv[N] = pow(fact[N], MOD - 2, MOD)
        for i in range(N, 0, -1):
            inv[i - 1] = (inv[i] * i) % MOD
        return fact, inv


if __name__ == "__main__":
    N, K = map(int, input().split())
    mod = 10 ** 9 + 7
    U = 1000
    comb = Combination(U + 5, mod)

    total = pow(K, N, mod)
    ng = 0
    for i in range(1, K):
        pair = comb(K, i)
        cnt = pow(K - i, N, mod)
        if i % 2 == 0:
            ng -= pair * cnt
            ng += mod
            ng %= mod
        else:
            ng += pair * cnt
            ng %= mod

    ans = (total - ng + mod) % mod
    print(ans)


Measured memory_bytes: 5636
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Read();
        }

        public void Solve(ConsoleInput cin)
        {
            //var D = cin.ReadInt;
            var N = cin.ReadInt;

            int[] a = cin.ReadIntArray(N);
            int count =0;

            for (int i=0;i<N;i++)
            {
                while (a[i] % 2 == 0) { a[i] /= 2;count++; }


            }

            //var 
            //            string[] N;

            //          N = Console.ReadLine().Split;

            //            int A, B;
            //          A = int.Parse(N[0]);
            ///        B = int.Parse(N[1]);

            double result  ;
            //if (N == 100)
            //{
            //    result = Math.Pow(100, D) * 101;
            //}
            //else
            //{
            //    result = Math.Pow(100, D) * N;
            //}

            //if (A <= 8 && B <= 8) { result = "Yay!"; }
            //else { result = ":("; }

            Console.WriteLine(count);
            Console.Read();

        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        ///
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

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

int main(void){
    int N,M; cin >> N >> M;

    int T=100*(N-M)+1900*M;
    double b=pow(0.5, M);
    double a=1-b;

    cout << (double)b*T/((1-a)*(1-a)) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 * AOJ id=0021
 * Parallelism
 * @author scache
 *
 */
public class Main {
	public static void main(String[] args) {
		Main p = new Main();
	}

	public Main() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int a=0;a<n;a++){
			long[] x =new long[2];
			long[] y =new long[2];
			for(int i=0;i<4;i++){
				int sign = i%2==0 ? 1:-1;
				x[i/2] += sc.nextDouble() *sign * 1e7;
				y[i/2] += sc.nextDouble() *sign * 1e7;
			}
			solve(x, y);
		}
	}

	public void solve(long[] x, long[] y) {
		System.out.println(x[0]*y[1]==y[0]*x[1] ? "YES" : "NO");
	}

}

Measured memory_bytes: 23272
#include <stdio.h>
    #include <memory.h>
    long paint(char* field, int x, int y)
    {
      int stack[160000];
      long odd = 0;
      long even = 0;
      int p = y * 402 + x;
      if((x + y) % 2)
      {
        odd = 1;
      }
      else
      {
        even = 1;
      }
      int color = field[p];
      int stn = 1;
      stack[0] = p;
      field[p] = 0;
      while(stn)
      {
        stn--;
        int pos = stack[stn];
        int way[4] = {-402, -1, 1, 402};
        int w;
        for(w = 0 ; w < 4 ; w++)
        {
        	int newpos = pos + way[w];
    	    if(field[newpos] == color)
    	    {
    	      field[newpos] = 0;
    	      if((newpos / 402 + newpos % 402) % 2)
    	      {
    	        odd++;
    	      }
    	      else
    	      {
    	        even++;
    	      }
    	      stack[stn] = newpos;
    	      stn++;
    	    }
        }
      }
      return odd * even;
    }
     
    int main()
    {
      char field[402][402];
      int h, w;
      int x, y;
      scanf("%d%d", &h, &w);
      memset(field, 0, 402*402);
      for(y = 1 ; y <= h ; y++)
      {
        scanf("%s", field[y]+1);
        for(x = 1 ; x <= w ; x++)
        {
          if((x + y) % 2 == 0)
          {
            field[y][x] = field[y][x] ^ ('#' ^ '.');
          }
        }
      }
      long sum = 0;
      for(y = 1 ; y <= h ; y++)
      {
        for(x = 1 ; x <= w ; x++)
        {
        	if(field[y][x])
        	{
        		sum += paint((char*)field, x, y);
        	}
        }
      }
      printf("%ld\n", sum);
      return 0;
    }

Measured memory_bytes: 640
n, m, k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a, b = [0],[0]

for i in range(n):
    a.append(a[i] + A[i])
for i in range(m):
    b.append(b[i] + B[i])


ans, j = 0, m

for i in range(n + 1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)

Measured memory_bytes: 47368
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

const int S = 2020;
int comb[S+10][S+10];
signed main() {
    int N, K; cin >> N >> K;
    for(int i=0; i<S; i++) {
        comb[i][0] = 1;
        for(int j=1; j<=i; j++) {
            (comb[i][j] += comb[i-1][j-1] + comb[i-1][j]) %= MOD;
        }
    }

    N -= K;
    if(N < 0) cout << 0 << endl;
    else {
        int n = N+K-1;
        int r = N;
        cout << comb[n][r] << endl;
    }
    return 0;
}



Measured memory_bytes: 26088
#include <iostream>

using namespace std;
using LL = long long;

int J[3001][3001]{};
int O[3001][3001]{};
int I[3001][3001]{};

int main() {
    int H, W;
    cin >> H >> W;

    string s;
    for (int i = 1; i <= H; i++) {
        cin >> s;
        for (int j = 1; j <= W; j++) {
            switch (s[j - 1]) {
                case 'J':
                    J[i][j] = 1;
                    break;
                case 'O':
                    O[i][j] = 1;
                    break;
                case 'I':
                    I[i][j] = 1;
                    break;
            }
        }
    }

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            O[i][j] += O[i][j - 1];
            I[i][j] += I[i - 1][j];
        }
    }

    LL ans = 0;

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (J[i][j]) {
                ans += (O[i][W] - O[i][j]) * (I[H][j] - I[i][j]);
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 108608
#include <iostream>
#include <cstdio>
#define p 998244353
using namespace std;
int n,m;
char c[300010];
struct node{
	int v,num;
}a[300010];
int f[3];
int F(char gg){
	if(gg=='R')return 0;if(gg=='G')return 1;if(gg=='B')return 2;
}
int d(int x,int y){
	return 3-x-y;
}
int jc[300010],njc[300010],inv[300010];
int A(int x,int y){
	int ans=1;
	return 1ll*jc[x]*njc[x-y]%p;
}
int main(){
    scanf("%d",&m);scanf("%s",c+1);
    int tot=1;
    for(int i=0;i<=1;i++)jc[i]=njc[i]=inv[i]=1;
    for(int i=2;i<=m*3;i++){
    	inv[i]=1ll*inv[p%i]*(p-p/i)%p;
    	jc[i]=1ll*jc[i-1]*i%p;
    	njc[i]=1ll*njc[i-1]*inv[i]%p;
	}
    for(int i=1;i<=m*3;i++){
    	if(c[i]!=c[i+1]||i==m*3)a[++n]={F(c[i]),tot},tot=1;
    	else tot++;
	}
	long long ans=1,now=-1,sum=0;
	for(int i=1;i<=n;i++){
		int n1=0,n2=0,n3=0;
		if(now!=-1){
			if(now==a[i].v){
				n1=f[a[i].v];
				if(n1>=a[i].num){
					ans=1ll*ans*A(f[a[i].v],a[i].num)%p;
					f[a[i].v]-=a[i].num;
				}
				else if(n1<a[i].num){
					ans=1ll*ans*A(n1,n1)%p;
					f[a[i].v]=0;sum+=a[i].num-n1;now=a[i].v;
				}
			}
			else{
				n1=f[a[i].v];
				n2=sum;
				if(n1>=a[i].num){
					ans=1ll*ans*A(f[a[i].v],a[i].num)%p;
					f[a[i].v]-=a[i].num;
				}
				else if(n1+n2>=a[i].num){
					ans=1ll*ans*A(n1,n1)%p*A(n2,a[i].num-n1)%p;
					f[d(a[i].v,now)]+=a[i].num-n1;f[a[i].v]=0;sum-=(a[i].num-n1);
					if(!sum)now=-1;
				}
				else if(n1+n2<a[i].num){
					ans=1ll*ans*A(n1,n1)%p*A(n2,n2)%p;
					f[d(a[i].v,now)]+=sum;f[a[i].v]=0;sum=a[i].num-n1-n2;now=a[i].v;
				}			}

		}
		else {
			n1=f[a[i].v];
			if(n1>=a[i].num){
				ans=1ll*ans*A(f[a[i].v],a[i].num)%p;
				f[a[i].v]-=a[i].num;
			}
			else if(n1<a[i].num){
				ans=1ll*ans*A(n1,n1)%p;
				f[a[i].v]=0;sum=a[i].num-n1;now=a[i].v;
			}
		}
	}
	cout<<1ll*ans*jc[m]%p;
    return 0;
}


Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N, K;
  cin >> N >> K;
  int64_t ans = 0;
  if(K == 0){
    ans = N*N;
  }
  else{
   for(int64_t i=K+1; i<=N; i++){
    ans += N/i *(i-K);
    if(N %i >= K){
    ans += N%i -(K-1);
    }
   }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <climits>

using namespace std;

int dp[2][1 << 22];

int main(void){
	while(1){
		int n, m; cin >> n >> m;
		if(!n && !m) break;

		int b[505][505]={0};
		for(int i=0; i<n; i++){
			for(int j=0; j<m; j++){
				char c; cin >> c;
				b[i][j] = c - '0';
			}
		}

		int ans = 0;
		if(n <= 22){
			int S = 1 << n;
			for(int i=0; i<S; i++){
				int cnt = 0;
				int ingredient[501]={0};//材料
				for(int j=0; j<n; j++){
					if((i & (1<<(j))) == 0) continue;
					cnt++;
					for(int k=0; k<m; k++) ingredient[k] ^= b[j][k];
				}
				bool flag = true;
				for(int j=0; j<m; j++){
					if(ingredient[j] == 1){
						flag = false;
						break;
					}
				}
				if(flag) ans = max(ans, cnt);
			}
		}else{
			int B[501]={0};
			for(int i=0; i<n; i++){
				for(int j=0; j<m; j++){
					B[i] |= (b[i][j] << j);
				}
			}

			int S = 1 << m;
			fill(dp[0], dp[2], INT_MIN);
			dp[1][0] = 0;
			for(int i=0; i<n; i++){
				for(int j=0; j<S; j++){
					dp[(i)%2][j^B[i]] = max(dp[(i)%2][j^B[i]], dp[(i+1)%2][j] + 1);
					dp[(i)%2][j] = max(dp[(i)%2][j], dp[(i+1)%2][j]);
				}
			}
			ans = dp[(n+1)%2][0];
		}
		cout << ans << endl;
	}
	return 0;
}


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


def check(all_S_list):
    delta_list = [        [-1,0],
                   [0,-1],        [0,1],
                           [1,0]
                 ]

    for i in range(H):
        for j in range(W):
            
            if all_S_list[i][j] == "#":
            
                next_too_flag = False
                for d_i,d_j in delta_list:
                    check_i = i + d_i
                    check_j = j + d_j
                    
                    if check_i < 0 or (H-1) < check_i: continue
                    if check_j < 0 or (W-1) < check_j: continue
 
                    if all_S_list[check_i][check_j] == "#":
                        next_too_flag = True
                
                if next_too_flag == False:
                    return False
    
    return True

#----------
H,W = list(map(int, input().rstrip().split()))
all_S_list = [ list(input().strip()) for _ in range(H) ]
#----------
if check(all_S_list):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int D = sc.nextInt();
    int T = sc.nextInt();
    int S = sc.nextInt();
    
    if(D <= T * S){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


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

int main(){

  int a, b, c, n;
  int p[1111], m[1111], k[1111], q[1111];
  int data[333];

  while(cin >> a >> b >> c, a+=b+c){
    for(int i=332;i;) data[i--] = 2;
    
    cin >> n;
    for(int i=0;i<n;i++) cin >> p[i] >> m[i] >> k[i] >> q[i];
    
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(q[j]) data[p[j]] = data[m[j]] = data[k[j]] = 1;
	else{
	  if(data[p[j]] == 1 && data[m[j]] == 1) data[k[j]] = 0;
	  if(data[m[j]] == 1 && data[k[j]] == 1) data[p[j]] = 0;
	  if(data[p[j]] == 1 && data[k[j]] == 1) data[m[j]] = 0;
	}
      }
    }
    for(int i=0;i<a;) cout << data[++i] << endl;
  }
  
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a>b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD =1000000007;//1e9 + 7;





int main(){
    ll a,b,c,x,tmp,r;
    cin>>a>>b;
    x = a * b;
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
    cout<<x/b<<endl;

}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

macro_rules! read_value {
    ($next:expr, [graph1; $len:expr]) => {{
        let mut g = vec![vec![]; $len];
        let ab = read_value!($next, [(usize1, usize1)]);
        for (a, b) in ab {
            g[a].push(b);
            g[b].push(a);
        }
        g
    }};
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => (read_value!($next, usize) - 1);
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        read_value!($next, [$t; len])
    }};
    ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input!(k: usize);
    let mut seen = vec![false; k];
    let mut cur = 7 % k;
    let mut pos = 1;
    loop {
        if seen[cur] {
            puts!("-1\n");
            return;
        }
        if cur == 0 {
            puts!("{}\n", pos);
            return;
        }
        seen[cur] = true;
        cur = (10 * cur + 7) % k;
        pos += 1;
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 2344
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    int N; cin >> N;
    vector<int> t(N);
    vector<int> x(N);
    vector<int> y(N);
    for (int i = 0; i < N; i++) {
        scanf("%d %d %d", &t[i], &x[i], &y[i]);
    }
    bool flag = true;
    if ((x[0] + y[0]) % 2 == t[0] % 2) {
        if ((x[0] + y[0]) > t[0]) flag = false;
    } else {
        flag = false;
    }

    for (int i = 1; i < N; i++) {
        if ((x[i] + y[i]) % 2 == t[i] % 2) {
            if ((t[i] - t[i - 1]) < (abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]))) flag = false;
        } else {
            flag = false;
        }
    }

    if (flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
long long f[105];
int main()
{
    long long x;
    cin>>x;
    f[0]=2;
    for(int i=1;i<=x;i++)
    {
        f[i]=f[i-1]*2+2;
    }
    cout<<f[x]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

const int MAX=10000;
bool prime[MAX];
void make_prime(){
	for(int i = 0 ; i < MAX ; i ++){
		prime[i] = true;
	}
	
	prime[0] = false;
	prime[1] = false;
	
	for(int i = 2 ; i <= MAX ; i ++){
		if(prime[i]){
			for(int j = i+i ; j <= MAX ; j += i){
				prime[j] = false;
			}
		}
	}
}

int main(void){
	make_prime();
	int n;
	while(cin>>n,n){
		for(int i = n ; 2 <= i ; i --){
			if(prime[i] && prime[i-2]){
				cout<<i-2<<" "<<i<<endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
 
int main(){
  int n, m;
  cin >> n >> m;
  vector<int> vec(m);
  rep(i,n){
    int k;
    cin >> k;
    rep(j,k){
      int tmp;
      cin >> tmp;
      tmp--;
      vec.at(tmp)++;
    }
  }
  int cnt=0;
  rep(i,m){
    if(vec.at(i)==n) cnt++;
  }
    cout << cnt << endl; 
 
}

Measured memory_bytes: 256