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

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        long l = sc.nextInt();
        double l1 = l / 3.0;
        double l2 = l / 3.0;
        double l3 = l / 3.0;

        System.out.println(l1 * l2 * l3);
    }



    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }
}


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

int main()
{
 int n;
 int a[1000], b[1000], c[1000];

 cin >> n;
 for(int i=0; i<n; i++) cin >> a[i] >> b[i] >> c[i];

 for(int i=0; i<n; i++){
  if(a[i]*a[i] == b[i]*b[i] + c[i]*c[i] | b[i]*b[i] == a[i]*a[i] + c[i]*c[i] | c[i]*c[i] == a[i]*a[i] + b[i]*b[i]) cout << "YES\n";
  else cout << "NO\n";
 }

 return 0;
}

Measured memory_bytes: 1132
#include <bits/stdc++.h>
#define ll long long
#define fort(i,n) for (int i = 1; i <= n; ++i)
#define pi pair<int,int>
#define vi vector<int>
#define pb push_back
#define sz size()
#define er erase
#define fr first
#define sc second
#define rc(x) return cout << x, 0
using namespace std;

int n,h,w;

int32_t main()
{
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n >> h >> w;
    cout << (n-h+1)*(n-w+1);
}


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

using namespace std;

typedef pair<int, int> p;
typedef long long ll;
const int inf = 1000000007;

int main() {
  ll n, x, m;
  cin >> n >> x >> m;
  vector<ll> a;
  vector<ll> ord(m, -1);
  ll tmp = x;
  ll si = 0;
  ll t = 0;
  a.push_back(tmp);
  ord[x] = 0;
  for (int i = 0; i < n; i++) {
    tmp = tmp * tmp % m;
    if (ord[tmp] != -1) {
      si = ord[tmp];
      t = i + 1 - ord[tmp];
      break;
    }
    ord[tmp] = i + 1;
    a.push_back(tmp);
  }
  vector<ll> ruiseki(a.size() + 1, 0);
  rep(i, a.size()) { ruiseki[i + 1] = ruiseki[i] + a[i]; }
  ll ans = 0;
  if (n <= a.size()) {
    ans = ruiseki[n];
    cout << ans << endl;
    return 0;
  }
  ll cnt = (n - si) / t;
  ll id = (n - si) % t;
  ans = (ruiseki[t + si] - ruiseki[si]) * cnt + ruiseki[si] +
        ruiseki[id + si] - ruiseki[si];
  cout << ans << endl;
  // rep(i, a.size()) cout << a[i] << ", ";
  // cout << endl;
  // rep(i, a.size() + 1) cout << ruiseki[i] << ", ";
  // cout << endl;
  // cout << si << endl;
  // cout << t << endl;
  return 0;
}

Measured memory_bytes: 4836
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define MOD 1000000007
#define oo 1000000000000000000
#define forr(i,n) for(ll i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0) ; cout.tie(0);
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define pb push_back
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
using namespace __gnu_pbds; 
using namespace std;

ll valueOfIndex(ordered_set&s , ll i){ return *(s.find_by_order(i)); }
ll indexOfValue(ordered_set&s , ll x){ return s.order_of_key(x); }
ll add(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a+b + p)%p;}
ll mul(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a*b + p)%p;} // __int128
ll power(ll x,ll n,ll p=MOD){ if(x==0) return 0; if(n==0 || x==1) return 1LL;
    ll r = (power(x,n/2,p))%p; if(n&1) return mul(mul(r,r,p) , x,p); else return mul(r,r,p);
}
ll inv(ll x){return power(x,MOD-2);}


void __sol(){
    
    int n; cin >> n;
    if(n%10==3) cout <<"bon";
    else if (n%10 ==0 || n%10==1 || n%10== 6 || n%10 ==8) cout <<"pon";
    else cout << "hon";
    
    return;
}


int main(){
    fastio
    ll tc=1; //cin >> tc;
    while(tc--) __sol();
    return 0;
}

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

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

    vector<long long> seen(M);
    for (long long i = 0; i < M; i++)
    {
        seen[i] = 0;
    }

    long long x = X;
    long long A;
    long long count = 0;
    long long preans = x;
    while(1)
    {
        if (seen[x] == 1)
        {
            break;
        }
        if (count == N-1)
        {
            cout << preans << endl;
            exit(0);
        }
        seen[x] = 1;    
        A = ((long long)pow(x, 2)) % M;
        preans += A;
        x = A;
        count++;
        
    }

    N = N-count-1;
    long long ans = 0;
    ans += preans;
    x = A;
    count = 0;
    preans = 0;
    for (long long i = 0; i < M; i++)
    {
        seen[i] = 0;
    }
    while(1)
    {
        if (seen[x] == 1)
        {
            break;
        }
        if (count == N)
        {
            cout << ans+preans << endl;
            exit(0);
        }
        seen[x] = 1;
        A = ((long long)pow(x, 2)) % M;
        preans += A;
        x = A;
        count++;
    }

    ans += (N / count) * preans;
    for (long long i = 0; i < N % count; i++)
    {
        A = ((long long)pow(x, 2)) % M;
        ans += A;
        x = A;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4340
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 100
void initialize(void);
void push(int);
int pop(void);
int isFull(void);
int isEmpty(void);
 int s[100];
int top;
int main(){
  int x,a1,a2;
  char s[100];
  initialize();

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      a1=pop();
      a2=pop();
      push(a1+a2);
    } 
    else if ( s[0] == '-' ){
	a1=pop();
	a2=pop();
	push(a2-a1);
    } 
    else if ( s[0] == '*' ){
	a1=pop();
	a2=pop();
	push(a1*a2);
    } 
    else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",pop());

  return 0;
}

void push(int x){
  // if(isFull) fprintf(stderr,"error\n");
  top++;
  s[top]=x;
}

int pop(){
  // if( isEmpty()) fprintf(stderr,"error\n");
  top--;
  return s[top+1];
}

int isEmpty(){
  return top==0;
}

int isFull(){
  return top>= MAX-1;
}

void initialize(void){

  top=0;
}

Measured memory_bytes: 548
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#define pi 3.14159265358979323846

using namespace std;

int main(void) {
	double r;
	cin >> r;
	cout << setprecision(20) << fixed << r*r*pi << " ";
	cout << setprecision(20) << fixed << 2*r*pi << endl;
	return 0;
}



Measured memory_bytes: 3272
k = [1, 1, 1,
     2, 1, 2, 1, 5, 2, 2,
     1, 5, 1, 2, 1, 14, 1, 5, 1, 5,
     2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

a=int(input())

print(str(k[a-1]))


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

int main()
{
	int n;
  cin >> n;
  int a[n];
  int f = 1;
  for(int i = 0; i < n; i++)
  {
     cin >> a[i];
    if(a[i] % 2 == 0)
    {
      if(a[i] % 3== 0 || a[i] % 5 == 0);
      else
      f = 0;
    }
  }
  if(f)
  cout << "APPROVED";
  else
    cout << "DENIED";
}

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

using namespace std;
#define n_max 1000

int main()
{
    int N, X;
    int m[n_max];
    int sum = 0;
    int min = 1001;

    cin >> N >> X;

    for(int i = 0; i < N; i++) {
        cin >> m[i];
        sum += m[i];
        if(min > m[i]) {
            min = m[i];
        }
    }
    
    cout << N + (X - sum) / min << endl;

    return 0;
}


Measured memory_bytes: 256
# solution

import io
import math
import scipy.sparse as s,numpy as n

f=n.loadtxt(open(0),skiprows=1)

g=s.csgraph.dijkstra(f)

h=n.where(g,g,1)

print(int(sum(t[j]*(t[j]<t+h[j]).all()for i,t in enumerate(h)for j in range(i)))*(f==g).all()or-1)

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

int main(){
  string S,T,Text;
  
  cin>>S>>T;
  for(int i=0;i<S.size();i++){
    if(T==S.substr(i)+S.substr(0,i)){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int T=sc.nextInt();
		int[][] are=new int[N][2];
		for(int i=0; i<N; i++) {
			are[i][0]=sc.nextInt();
			are[i][1]=sc.nextInt();
		}
		int cost=1145141919;
		for(int i=0; i<N; i++) {
			if(T>=are[i][1]) {
				cost=Math.min(cost, are[i][0]);
			}
		}
		if(cost==1145141919) {
			System.out.println("TLE");
		}
		else {
			System.out.println(cost);
		}
	}
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
#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(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;
typedef long long ll;

const int MOD = 1e9+7;
const int INF = 1e9;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    double N;
    cin>>N;
    double cnt = 0;
    rep1(i,N+1){
        if(i%2 == 1){
            cnt++;
        }
    }
    double ans = cnt/N;
    
    cout<<setprecision(10)<<ans<<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <memory.h>
#include <cmath>
#include <queue>


using namespace std;

typedef long long ll;

const int N = 2010;

string s;

int main(){
//	freopen("input.txt","r",stdin);
	cin >> s;
	int r = s.size() - 2;
	if(s[0] == s[s.size() - 1])
		r--;
	if(r & 1)
		puts("First");
	else
		puts("Second");
	return 0;
}

Measured memory_bytes: 512
a, b, m = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
minu = min(al) + min(bl)
for i in range(m):
    an, bn, wari = map(int, input().split())
    if minu > (al[an -1] + bl[bn -1] - wari):
        minu = (al[an -1] + bl[bn -1] - wari)
print(minu)

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

typedef long long ll;
typedef pair<int, int> P;

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    int ans = 0;
    if (2 * C < A + B) {
        int res = min(X, Y);
        ans += res * 2 * C;
        X -= res;
        Y -= res;
    } else {
        ans += A * X;
        ans += B * Y;
        X = 0;
        Y = 0;
    }

    if (X) {
        ans += min(A, 2 * C) * X;
    }
    if (Y) {
        ans += min(B, 2 * C) * Y;
    }

    cout << ans << endl;
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M; cin >> N >> M;
    vector<int> nodes[N];
    rep(i, M){
        int a, b; cin >> a >> b;
        a--; b--;
        nodes[a].push_back(b);
        nodes[b].push_back(a);
    }
    vector<int> v(N);
    rep(i, N) v[i] = i;
    int ans = 0;
    do{
        bool ok = true;
        for(int i = 0; i < N-1; i++){
            bool reach = false;
            int to = v[i+1];
            rep(j, nodes[v[i]].size()) if(to == nodes[v[i]][j]) reach = true;
            if(!reach) ok = false;
        }
        if(ok) ans++;
    }while(next_permutation(v.begin()+1, v.end()));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;

int main(void){
  int H, W;
  bool can = true;
  char s[100][100];
  cin >> H >> W;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> s[i][j];
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(s[i][j] == '#'){
        if(s[i - 1][j] == '.' && s[i + 1][j] == '.'
      && s[i][j - 1] == '.' && s[i][j + 1] == '.'){
          can = false;
        }
      }
    }
  }
  if(can) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

int main(void)
{
    int letters['z' - 'a' + 1];
    string s;

    cin >> s;
    //cout << s << "  xxx" << endl;

    string::size_type sz = s.size();
    //cout << sz << "   number" << endl;
    memset(letters, 0, sizeof(letters));
    for (string::size_type i = 0; i < sz; i++)
    {
        int idx = s.at(i) - 'a';
        //cout << idx << " ";
        letters[idx]++;
    }

    sz = 'z' - 'a' + 1;
    for (int i = 0; i < sz; i++)
    {
        if (letters[i] == 0)
        {
            char out = 'a' + i;
            cout << out << endl;
            return 0;
        }
    }

    cout << "None" << endl;

    return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  int n; cin >> n;
  bool f = 0;
  vector<int> a(n); for (int& x : a) cin >> x;
  int d = 1, cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] == d) ++d;
    else ++cnt;
  }
  if (cnt >= n) cout << "-1\n";
  else cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 1024
// Problem : C - One Quadrillion and One Dalmatians
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include<set>
#include<map>
#include<bitset>
#define rep(i,a,b)  for(i=a;i<b;i++)
#define Sort(a)	sort(a.begin(),a.end())
#define rev(a)	reverse(a.begin(),a.end())
#define all(a)	(a).begin(),(a).end()
#define vll vector<long long int>
#define lli long long int
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define db double
#define M 1000000007
#define pi 3.1415926535897932384626433832795028841971
#define INF 1e18

#define MAX 200005

using namespace std;
lli min(lli a,lli b){return a<b?a:b;}
lli min(lli a,lli b,lli c){a=min(a,b);a=min(a,c);return a;}
lli max(lli a,lli b){return a>b?a:b;}
lli max(lli a,lli b,lli c){a=max(a,b);a=max(a,c);return a;}
lli dsum(lli n){lli ans=0;while(n){ans+=(n%10);n/=10;}return ans;}
lli power(lli a,lli b){lli res=1;while(b){if(b&1) res=res*a;a=a*a;b>>=1;}return res;}
lli Ceil(lli a,lli b){lli res=a/b;if(a%b!=0)	res++;return res;}

template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

lli dxx[]={1,1,0,-1,-1,-1,0,1};
lli dyy[]={0,1,1,1,0,-1,-1,-1};
lli dx[]={1,0,-1,0};
lli dy[]={0,1,0,-1};

struct pll{
	lli x,y;
};
bool comp(pll a,pll b){
	if(a.x==b.x)	return a.y<b.y;
	else	return a.x<b.x;
}
void ps(lli n) 
{ 
    lli arr[10000]; 
    lli i = 0; 
  
    // Step 1: Converting to number assuming 
    // 0 in number system 
    while (n) { 
        arr[i] = n % 26; 
        n = n / 26; 
        i++; 
    } 
  
    // Step 2: Getting rid of 0, as 0 is 
    // not part of number system 
    for (lli j = 0; j < i - 1; j++) { 
        if (arr[j] <= 0) { 
            arr[j] += 26; 
            arr[j + 1] = arr[j + 1] - 1; 
        } 
    } 
  
    for (lli j = i; j >= 0; j--) { 
        if (arr[j] > 0) 
            cout << char('a' + arr[j] - 1); 
    } 
  
    cout << endl; 
} 
void solve(lli the)
{
	char ch;
	db aa,bb,cc,dd,xx;
	string s1,s2,s3,str;
    lli i,j,k,a,b,c,d,n,m,l,r,x,y,z,low,high,mid,sum=0,ans=0,temp,t;
    cin >> n;
    if(n<=26){
    	n--;
    	ch='a'+n;
    	cout<<ch;return;
    }
    ps(n);
    
    
}













int main()
{
	long long int t=1,c=1;
	// scanf("%lld",&t);
	while(t--){
		solve(c);
		c++;
	}
	return 0;
}
/* UJJWAL KESHRI */

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n,x;
    cin>>n>>x;
    vector<int> l(n);
    rep(i,n) cin>>l[i];
    int d=0,cnt=1;
    rep(i,n){
        if(d+l[i]<=x) cnt++;
        d+=l[i];
    }
    cout<<cnt;
}

Measured memory_bytes: 3572
/*Huyyt*/
#include<bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int dir[8][2] = {{0, 1}, {1, 0}, {0, -1}, { -1, 0}, {1, 1}, {1, -1}, { -1, -1}, { -1, 1}};
const int mod = 998244353, gakki = 5 + 2 + 1 + 19880611 + 1e9;
const int MAXN = 2e5 + 5, MAXM = 2e5 + 5, N = 3e5 + 5;
int to[MAXM << 1], nxt[MAXM << 1], Head[MAXN], tot = 1;
inline void addedge(int u, int v)
{
        to[++tot] = v;
        nxt[tot] = Head[u];
        Head[u] = tot;
}
ll Qpow(ll a, ll b)
{
        ll ans = 1, base = a;
        while (b != 0)
        {
                if (b & 1 != 0)
                {
                        ans = (ans * base) % mod;
                }
                base = (base * base) % mod;
                b >>= 1LL;
        }
        return ans % mod;
}
ll Inv(ll a)
{
        return Qpow(a, mod - 2);
}
ll fact[N], Invfact[N], anser = 0;
ll ncr(ll n, ll r)
{
        if (r < 0 || n < 0)
        {
                return 0;
        }
        if (n < r)
        {
                return 0;
        }
        ll a = fact[n];
        a = (a * Invfact[r]) % mod;
        a = (a * Invfact[n - r]) % mod;
        return a;
}
int main()
{
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        ll n, A, B, K;
        cin >> n >> A >> B >> K;
        Invfact[0] = Invfact[1] = fact[0] = fact[1] = 1;
        for (ll i = 2; i <= 3e5 + 1; i++)
        {
                fact[i] = (fact[i - 1] * i) % mod;
                Invfact[i] = Inv(fact[i]);
        }
        ll remain;
        for (ll i = 0; i <= n; i++)
        {
                remain = K - i * A;
                if (remain >= 0 && remain % B == 0 && remain / B <= n)
                {
                        anser = (anser + (ncr(n, i) * ncr(n, remain / B) % mod)) % mod;
                }
        }
        cout << anser << endl;
        return 0;
}


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

int main(){
    int N, T, in1, in2, flag = 0;
    vector <int> cost, t;

    cin >> N >> T;
    while(cin >> in1 >> in2){
        if(in2 <= T){
            cost.push_back(in1);
            flag = 1;
        }
    }
    if(flag == 1){
        sort(cost.begin(), cost.end());
        cout << cost[0] << endl;
    }else{
        cout << "TLE" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.end()

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; }

using ll = long long;
using ull = unsigned long long;
using namespace std;

const ll MOD = 1000000007;

int main(){
  int n; cin >> n;
  ll ans = 0;
  ll sum = 0;
  rep(i,n){
    ll a; cin >> a;
    ans += a * sum % MOD; ans %= MOD;
    sum += a; sum %= MOD;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3628
#include <iostream>
#include <string.h>
using namespace std;
int main(void){
    int i=0;
    int num = 0;
    int numAC = 0, numWA = 0, numTLE = 0, numRE = 0;
    // 数字入力
    cin >> num;

    string a[100000];
    string b;
    while(cin>>b){
        a[i] = b;
        if (a[i] == "AC"){
            numAC++;
        }
        else if (a[i] == "WA"){
            numWA++;
        }
        else if (a[i] == "TLE"){
            numTLE++;
        }
        else if (a[i] == "RE"){
            numRE++;
        }
        i++;

        if (i == num){
            break;
        }
        else{
            continue;
        }
    }
    cout << "AC x  " << numAC << endl;
    cout << "WA x  " << numWA << endl;
    cout << "TLE x  " << numTLE << endl;
    cout << "RE x  " << numRE << endl;
       
}

Measured memory_bytes: 6772
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, cnt = 0;
  string s;
  cin >> n >> s ;
  for(int i = 0; i < n-2; i++) {
    if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') cnt++;
  }
  cout << cnt;
}

Measured memory_bytes: 3632
// Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;

#ifdef LOCAL
#include "contest.h"
#else
#define error(args...) 
#endif

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}

int main(){
    iostream_init();
    string s;
    cin >> s;
    int ans = s.size() - 1;
    for(int t = 0; t < s.size(); t++) for(int c = 'a'; c <= 'z'; c++) {
        bool ok[101] = {};
        for(int i = 0; i + t < s.size(); i++) {
            for(int j = 0; j <= t; j++) {
                if(s[i+j] == c) {
                    ok[i] = true;
                }
            }
        }
        int sm = 0;
        REP(i, s.size() - t) if(ok[i]) sm++;
        if(sm == s.size() - t) {
            ans = min(ans, t);
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
using lint=long long;
int main(){
  lint N,x; cin>>N>>x;
  lint a[100000];
  for(int i=0;i<N;i++)
    cin>>a[i];
  lint res=0;
  // 左端がxを超えていたら減らす
  lint d=a[0]-x;
  if(d>0){
    a[0]-=d;
    res+=d;
  }
  // 左から順に減らしていく
  for(int i=1;i<N;i++){
    lint sum2=a[i-1]+a[i];
    lint over=sum2-x;
    if(over>0){
      a[i]-=over;
      res+=over;
    }
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
#define MOD (ll)(1e9+7)
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;


signed main(){
    ll n;
    cin >> n;
    ll k;
    cin >> k;
    ll temp = 1; 
    rep(i,0,n){
        if(temp*2 > temp + k){
            temp += k;
        }
        else{
            temp *= 2;
        }
    }
    cout << temp << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int selectionSort(int a[],int n)
{
    int i,j,t,sum=0,min;
    for(i=0;i<n-1;i++)
    {
        min=i;
        for(j=i;j<n;j++)
        {
            if(a[j]<a[min])
                min=j;
        }
        if(i!=min)
        {
            t=a[i];
            a[i]=a[min];
            a[min]=t;
            sum++;
        }
    }
    return sum;
}
int main()
{
    int a[100],n,i,sum;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i];
    sum=selectionSort(a,n);
    for(i=0;i<n;i++)
    {
        if(i)
            cout<<" ";
        cout<<a[i];
    }
    cout<<endl;
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

bool cmp(pair<int,int> a, pair<int,int> b){
	if( a.second == b.second ) return a.first < b.first;
	return a.second > b.second;
}
int main(){
	map<int,int> mii;
	vector<pair<int,int> > vp;
	int n;
	while(~scanf("%d",&n)){
		mii[n]++;
	}
	map<int,int>::iterator it;
	for(it=mii.begin(); it!=mii.end(); it++)vp.push_back(*it);
	sort(vp.begin(), vp.end(), cmp);
	int i;
	for(i=1; i<vp.size() && vp[i].second==vp[i-1].second; i++);
	rep(j,i)printf("%d\n",vp[j].first);
	/*
	rep(j,vp.size()){
		printf("%d %d\n",vp[j].first, vp[j].second);
	}
	*/
	return 0;
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

#diverta2019-A
ans=0
n,k=mii()

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

print(n-k+1)

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

int main(){
    int N;
    long A[100002];
    long B[100002];
    long C[100002];
    long long ans = 0;

    cin >> N;
    for(int i=0;i<N;i++) cin >> A[i];
    for(int i=0;i<N;i++) cin >> B[i];
    for(int i=0;i<N;i++) cin >> C[i];

    sort(A, A+N);
    sort(B, B+N);
    sort(C, C+N);

    for(int i=0;i<N;i++){
        long b = B[i];
        ans += (lower_bound(A, A+N, b) - A) * (N - (upper_bound(C, C+N, b) - C));
        // cout << lower_bound(A, A+N, b) - A << endl;
        // cout << N - (upper_bound(C, C+N, b) - C) << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#pragma region include
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LLINF = 4e18;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); }
#pragma endregion

int main() {
    int n; input(n);
    vector<int> a(n); input(a);
    vector<bool> ans(n,false);
    for (int i = n; i >= 1; i--) {
        int c = 0;
        for (int j = i*2; j <= n; j+=i) {
            if (ans[j - 1]) c++;
        }
        if (c % 2 != a[i - 1]) ans[i - 1] = true;
    }
    int cnt = 0;
    REP(i, n) {
        if (ans[i]) cnt++;
    }
    cout << cnt << endl;
    REP(i, n) {
        if (ans[i]) cout << i + 1 << endl;
    }
    getchar(); getchar();
}

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

main(){
	int n,k;
	cin >> n >> k;
	int a[n],ans;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}

	ans=(n-1)/(k-1);
	if( (n-1)%(k-1)!=0 )
		ans++;
	cout << ans <<endl;
}




Measured memory_bytes: 640
' Imports System.Collections.Generic
' Imports System.Text
' Imports System.Text.RegularExpressions

Class Main
    Public Shared Sub Main()
        Dim A, B As Integer
        Dim arr() As String
        arr = Split(Console.ReadLine())
        A = arr(0) : B = arr(1)
        Console.WriteLine(If(A <= 9 AndAlso B <= 9, A * B, -1))
        Return
    End Sub
End Class


Measured memory_bytes: 28300
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int H, W, K;
	cin >> H >> W >> K;
	vector<string> c(H);
	rep(i, H)
		cin >> c[i];
	int NH = 1;
	int NW = 1;
	rep(i, H)
		NH *= 2;
	rep(j, W)
		NW *= 2;
	int ans = 0;
	rep(bH, NH) {
		rep(bW, NW) {
			vector<string> ctmp = c;
			int S = 0;
			rep(i, H) {
				rep(j, W) {
					if ((bH >> i) % 2 || (bW >> j) % 2)
						ctmp[i][j] = '.';
					if (ctmp[i][j] == '#')
						S++;
				}
			}
			if (S == K)
				ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

template <class T1, class T2>
inline void chmax(T1 &a, const T2 &b)
{
    if (a < b)
    {
        a = b;
    }
}
template <class T1, class T2>
inline void chmin(T1 &a, const T2 &b)
{
    if (a > b)
    {
        a = b;
    }
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;

int main()
{
    ll D, T, S;
    cin >> D >> T >> S;
    if (D <= T * S)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3592
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

int main() {
    int n;
    cin >> n;
    VVI a(n,VI(n));
    VVI b(n,VI(n));
    VVI c(n,VI(n));
    REP(i,0,n) REP(j,0,n) {
        cin >> a[i][j];
        b[i][j] = a[i][j];
        c[i][j] = a[i][j];
    }
    REP(i,0,n) REP(j,0,n) REP(k,0,n) {
        if (k == i || k == j) continue;
        //cerr << i << " " << j << " " << k << " ";
        //cerr << b[i][j] << " " << b[i][k] << " " << b[k][j] << endl;
        if (b[i][j] >= b[i][k] + b[k][j]) {
            b[i][j] = b[i][k] + b[k][j];
            c[i][j] = 0;
        }
    }
    REP(i,0,n) REP(j,0,n) {
        //cerr << b[i][j] << endl;
        if (a[i][j] != b[i][j]) {
            cout << -1 << endl;
            return 0;
        }
    }
    LL cnt = 0;
    REP(i,0,n) REP(j,0,n) {
        if (i > j) cnt += c[i][j];
    }
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
using namespace std;

int main() {
    int N;
    cin >> N;
    
    if (N / 10 == 9 || N % 10 == 9)cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

s = []
sum = 0
min_nonten = 999
all_ten = True
for i in range(N):
    s.append(int(input()))
    sum += s[i]
    if(s[i] % 10 != 0):
        all_ten = False
        if(min_nonten > s[i]):
            min_nonten = s[i]


if(sum % 10 != 0):
    print(sum)
elif(all_ten):
    print(0)
else:
    print(sum - min_nonten)

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


int main(){
  int n;
  cin >> n;
  for(int i=n; i<=999; i++){
    string s = to_string(i);
    if(s[0]==s[1] && s[1]==s[2]){
      cout << s << endl;
      return 0;
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> A(300);
	A[0] = N;
	for(int i = 1; i < 300; ++i) {
		if(A[i - 1] % 2 == 0) A[i] = A[i - 1] / 2;
		else A[i] = 3 * A[i - 1] + 1;
	}
	int ans = -1;
	for(int i = 1; i <= 300 && ans == -1; ++i) {
		for(int j = 0; j < i; ++j) {
			if(A[i] == A[j]) {
				ans = i;
			}
		}
	}
	cout << ans + 1 << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int main() {
  int H, W, D;
  cin >> H >> W >> D;
  vector<pair<int, int> > list(H * W + 1, pair<int, int>());
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int d;
      cin >> d;
      list[d] = make_pair(i, j);
    }
  }

  vector<ll> rw(H * W + 1, 0);
  for (int i = 1; i <= H * W - D; i++) {
    rw[i + D] = rw[i]
     + abs(list[i + D].first - list[i].first)
     + abs(list[i + D].second - list[i].second);
  }

  int Q;
  cin >> Q;
  while(Q--) {
    int l, r;
    cin >> l >> r;
    cout << rw[r] - rw[l] << endl;
  }

  return 0;
}


Measured memory_bytes: 2560
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost;
//using namespace multiprecision;  

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

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

    int h,w;
    cin >> h >> w;

    if(h == 1 || w == 1){
        cout << 1 << '\n';
        return 0;
    }

    int res = h / 2 * w;
    if(h & 1){
        res += updiv(w,2);
    }

    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cstring>
const int MAXN=1e7;
using namespace std;
int dp[MAXN],f[MAXN];
int cnt;
int main()
{
	int now;
	dp[++cnt]=1;
	now=6;
	dp[++cnt]=6;
	while(now<=100000)
	{
		now*=6;
		dp[++cnt]=now;
	}
	now=9;
	dp[++cnt]=9;
	while(now<=100000)
	{
		now*=9;
		dp[++cnt]=now;
	}
	int n;
	int ans=0;
	memset(f,0x7f,sizeof(f));
	sort(dp+1,dp+cnt+1);
	scanf("%d",&n);
	f[0]=0;
	for(int i=0;i<=n;i++)
	{
		for(int k=1;k<=cnt && dp[k]<=i;k++)
		{
			if(i-dp[k]<0) break;
			f[i]=min(f[i],f[i-dp[k]]+1);
		}
	}
	printf("%d",f[n]);
	return 0;
} 

Measured memory_bytes: 41216
h,*s=open(0)
h,w,k,*m=map(int,h.split())
b=w
while b:
 b-=1;r=t=j=-1;d=[0]*h
 while~j+w:
  j+=1;i=c=0
  while h-i:
   d[c]+=s[i][j]>'0';f=t<j
   if d[c]>k:d=[0]*h;r+=1-h*w*~-f;t=j;j-=f;break
   c+=b>>i&1;i+=1
 m+=r-~c,
print(min(m))

Measured memory_bytes: 43228
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

int n,t,a[200050];
long long sum;
long long lastTime;

int main(){
	scanf("%d%d",&n,&t);
	for (int i=1;i<=n;i++){
		a[i]=read();
	}
	lastTime=t;
	sum=t;
	for (int i=1;i<=n;i++){
		if (lastTime<=a[i]){
			sum=sum+t;
		}
		else if (lastTime>a[i]){
			sum=sum+(a[i]+t-lastTime);
		}
		lastTime=t+a[i];
	}
	printf("%lld",sum);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <map>
#define MAXN (500 + 5)
#define INF (0x7fffffff)
#define LL long long
#define pii pair<int, in>
using namespace std;
const int xy[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int n, m;
bool qwq[MAXN][MAXN];
int main()
{
	memset(qwq, false, sizeof(qwq));
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
	{
		string srs;
		cin >> srs;
		for (int j = 1; j <= m; j++)
			qwq[i][j] = (srs[j - 1] == '#');
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
			if (qwq[i][j])
			{
				bool ok = false;
				for (int k = 0; k < 4; k++)
					if (qwq[i + xy[k][0]][j + xy[k][1]])
					{
						ok = true;
						break;
					}
				if (!ok)
				{
					cout << "No";
					return 0;
				}
			}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>

const int MAXN=100011;

int N;
char str[MAXN];

bool isWolf[MAXN];

void Shift(){
	for(int i=2;i<N;++i){
		if(isWolf[i-1]){
			if(str[i-1]=='x')
				isWolf[i]=isWolf[i-2];
			else	isWolf[i]=!isWolf[i-2];
		}
		else{
			if(str[i-1]=='o')
				isWolf[i]=isWolf[i-2];
			else	isWolf[i]=!isWolf[i-2];
		}
	}
}

bool Test(int a){
	int p=a-1;if(p<0)	p+=N;
	int n=a+1;if(n>=N)	n-=N;
	if(isWolf[a]^(str[a]=='o'))
		return isWolf[p]==isWolf[n];
	return isWolf[p]!=isWolf[n];
}

bool Test(){
	bool ret=true;
	for(int i=0;i<N;++i){
		ret&=Test(i);
	}
	return ret;
}

void Show(){
	for(int i=0;i<N;++i){
		if(isWolf[i])
			printf("W");
		else	printf("S");
	}
	puts("");
	exit(0);
}

int main(){
	
	scanf("%d", &N);
	
	scanf("%s", str);
	
	isWolf[0]=false;isWolf[1]=false;
	Shift();
	if(Test())	Show();
	
	isWolf[0]=false;isWolf[1]=true;
	Shift();
	if(Test())	Show();
	
	isWolf[0]=true;isWolf[1]=false;
	Shift();
	if(Test())	Show();
	
	isWolf[0]=true;isWolf[1]=true;
	Shift();
	if(Test())	Show();
	
	puts("-1");
	
	return 0;
}

Measured memory_bytes: 512
// ref: https://img.atcoder.jp/arc097/editorial.pdf

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int a, b, c, d; cin >> a >> b >> c >> d;
    cout << ( (abs(b-a)<=d && abs(c-b)<=d) || abs(c-a)<=d ? "Yes":"No") << endl;
    
    return 0;
}

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

int main()
{
	int a, b;
	std::string operand;
	std::cin >> a;
	std::cin >> b;

	if (a > b)
	{
		operand = ">";
	}
	else if (a < b)
	{
		operand = "<";
	}
	else
	{
		operand = "==";
	}

	std::cout << "a" << " " << operand << " " << "b" << std::endl;

	return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 100005;
const int MAXV = 100005;
ll w[MAXN], v[MAXN];
ll dp[MAXN];
int main()
{
    int N, W;
    cin >> N >> W;
    for (int i = 1; i <= N; i++)
        cin >> w[i] >> v[i];
    for (int i = 1; i <= MAXV; i++) dp[i] = 1e12;
    dp[0] = 0;
    for (int i = 1; i <= N; i++)
    {
        for (int j = MAXV; j >= v[i]; j--)
        {
            dp[j] = min(dp[j], dp[j-v[i]] + w[i]);
        }
    }
    for (int i = MAXV; i >= 0; i--)
    {
        if (dp[i] <= W)
        {
            cout << i; return 0;
        }
    }
}


Measured memory_bytes: 1024
x1, y1, x2, y2 = list(map(int, input().split()))
dx = +(y1-y2)
dy = -(x1-x2)
x3, y3, x4, y4 = x2+dx, y2+dy, x1+dx, y1+dy
print(x3, y3, x4, y4)

Measured memory_bytes: 3060
N,K=map(int,input().split())
MOD = 998244353
dp = [0]*(N+1)

LR = []
for _ in range(K):
    l, r = map(int, input().split())
    LR.append((l,r))

LR.sort()
dp[1] = 1
dp_sum = [0]*(N+1) # dp[i]の累積和
dp_sum[1] = 1

for i in range(2, N+1):
    for l, r in LR:
        if i - l >= 1:
            dp[i] += dp_sum[i-l] - dp_sum[max(0, i-r-1)]
            dp[i] %= MOD
    dp[i] %= MOD
    dp_sum[i] = dp_sum[i-1] + dp[i]
        
print(dp[N]%MOD)

Measured memory_bytes: 71224
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = Long.parseLong(sc.next());
        long b = Long.parseLong(sc.next());
        long n = a;
        int count = 1;
        while(true) {
            n = 2*n;
            if(n > b) break;
            count++;
        }
        System.out.println(count);
    }  
}

Measured memory_bytes: 21588
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    int dp[n+2];
    memset(dp,0,sizeof(dp));
    dp[0]=0;
    dp[1]=abs(a[0]-a[1]);
    //cout<<"dp[1] is "<<dp[1]<<endl;
    for(int i=2;i<n;i++)
    {
        dp[i]=min(dp[i-2]+abs(a[i-2]-a[i]),dp[i-1]+abs(a[i-1]-a[i]));
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;
//DP用
template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

//a^n mod を計算する関数
long long modpow(long long a,long long n,long long mod) {
    long long res = 1;
    while(n > 0) {
        if(n % 2 == 1) {
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//a^(-1) mod すなわちaの逆元を返す関数
long long modinv(long long a,long long mod) {
    return modpow(a,mod-2,mod);
}

//最大公約数をを返す関数
long long gcd (long long a,long long b) {
    if(a % b == 0) {
        return b;
    }else {
        return (gcd(b,a%b));
    }
}

const long long INF = 1LL << 60;
const long long P = 1000000007;

//nCkを求める関数
long long conbi (long long n,long long k) {
    long long res = 1;
    long long inv;
    for(long long i = n-k+1; i <= n; i++) {
        res *= i;
        res %= P;
    }
    for(long long i = 1; i <= k; i++) {
        inv = modinv(i,P);
        res *= inv;
        res %= P;
    }
    return res;
}

int main() {
    int a[3][3];
    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 3; j++) {
            cin >> a[i][j];
        }
    }
    int n;
    cin >> n;
    int b[n];
    for(int i = 0; i < n; i++) {
        cin >> b[i];
    }
    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 3; j++) {
            for(int k = 0; k < n; k++) {
                if(a[i][j] == b[k]) {
                    a[i][j] = 0;
                }
            }
        }
    }
    bool flag = false;
    if(a[0][0] == 0 && a[0][1] == 0 && a[0][2] == 0) {
        flag = true;
    }
    if(a[1][0] == 0 && a[1][1] == 0 && a[1][2] == 0) {
        flag = true;
    }
    if(a[2][0] == 0 && a[2][1] == 0 && a[2][2] == 0) {
        flag = true;
    }
    if(a[0][0] == 0 && a[1][0] == 0 && a[2][0] == 0) {
        flag = true;
    }
    if(a[0][1] == 0 && a[1][1] == 0 && a[2][1] == 0) {
        flag = true;
    }
    if(a[0][2] == 0 && a[1][2] == 0 && a[2][2] == 0) {
        flag = true;
    }
    if(a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0) {
        flag = true;
    }
    if(a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0) {
        flag = true;
    }
    
    if(flag == true) {
        cout << "Yes";
    }else {
        cout << "No";
    }
    
    return 0;
}



Measured memory_bytes: 384