akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
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;}
//自作関数
template<class T> ll llpow(T x,T n){ll ans=1;while(n--){ans*=x;}return ans;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int n;
int main(){
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a.at(i);
    int countdiv2=0;
    for(int i=0;i<n;i++){
        while(!(a.at(i)%2)){
            a.at(i)/=2;
            countdiv2++;
        }
    }
    cout<<countdiv2<<endl;
    return 0;
}




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

int HM[288623],*END=HM+288621;

bool insert(int a){
    int *p=HM+a%288621;
    while(*p){
        if(*p==a) return true;
        if(++p==END) p=HM;
    }
    *p=a;
    return false;
}

int main(){
    int n{},a,c;
    while((c=getchar_unlocked()-'0')>=0) n*=10,n+=c;
    fr(i,n){
        a=0;
        while((c=getchar_unlocked()-'0')>=0) a*=10,a+=c;
        if(insert(a)){
            putchar_unlocked('N');
            putchar_unlocked('O');
            putchar_unlocked('\n');
            return 0;
        }
    }
    putchar_unlocked('Y');
    putchar_unlocked('E');
    putchar_unlocked('S');
    putchar_unlocked('\n');
}


Measured memory_bytes: 1408
N = gets.chomp.to_i
# A, B, C = gets.chomp.split.map(&:to_i)
# S = gets.chomp.chars

def solve
  x = (1.0*N) / 1.08
  x1 = x.ceil
  x2 = x.floor

  if (x1 * 1.08).floor == N
    p x1
    return
  end
  if (x2 * 1.08).floor == N
    p x2
    return
  end
  
  print ":(\n"
end

solve


Measured memory_bytes: 1788
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    a = list(map(int, input().split()))
    res = []
    #dp[i]:i番目の箱に入ってるかどうか
    dp = [0]*n

    #iの倍数の箱を調べる
    for i in range(n, 0, -1):
        #調べる箱列挙
        t = 0
        for j in range(i, n+1, i):
            t += dp[j-1]
        if t%2 != a[i-1]:
            res.append(i)
            dp[i-1] = 1

    if not 1 in a:
        print(0)
    else:
        if len(res)>0:
            print(len(res))
            print(*res)
        else:
            print(-1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14436
#include <bits/stdc++.h>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).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; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  std::string S; std::cin >> S;
  for(int i=0; i<sz(S); i++) {
    if(S.substr(i,2) == "hi") i++;
    else {
      std::cout << "No" << std::endl;
      return 0;
    }
  }
  std::cout << "Yes" << std::endl;
  return 0;
}



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

int main() {
  int A , B ;
  cin >> A >> B ;
  
  if (A == 1 && B != 1){
    cout << "Alice" << endl;
  }
  else if (A != 1 && B == 1){
    cout << "Bob" << endl;
  }
  
   else if (A>B){
    cout << "Alice" << endl;
  }
  else if (A==B){
    cout << "Draw" << endl;
  }
  else if (A<B){
    cout << "Bob" << endl;
  }
  
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define lld long double
#define MOD 1000000007
#define inf 1000000007
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
// ll power(ll x,ll y, ll md=inf){ll res = 1;x%=md;while(y){if(y&1)res = (res*x)%md;x *= x; if(x>=md) x %= md; y >>= 1;}return res;}
 
using namespace std;


#define endl '\n'
// #define int ll

signed main() {
	fast;

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

	pii v[200002];
	for(int i=0;i<h;i++) cin>>v[i].f>>v[i].s;

	map<int,int> mp;
	for(int i=1;i<=w;i++) mp[i] = 0;

	map<int,int> mini = {{0,w}};

	for(int i=0;i<h;i++) {
		int r = v[i].s;

		auto it = mp.lower_bound(v[i].f);


		if(r==w) {
			while(it!=mp.end() && it->f <= r) {
				auto it1 = it++;
				auto it2 = mini.find(it1->s);
				if(it2->s==1) mini.erase(it2);
				else it2->s --;
				mp.erase(it1);
			}
		}
		else {
			int mn = inf;

			while(it!=mp.end() && it->f <= r) {
				mn = min(mn, r+1-(it->f)+(it->s));
				auto it1 = it++;
				auto it2 = mini.find(it1->s);
				if(it2->s==1) mini.erase(it2);
				else it2->s --;
				mp.erase(it1);
			}

			if(mn<inf) {
				if(it!=mp.end() && it->f == r + 1) {
					if(it->s > mn) {
						auto it1 = mini.find(it->s);
						if(it1->s ==1) mini.erase(it1);
						else it1->s --;
						mini[mn]++;
						it->s = mn;
					}
				}
				else {
					mp.insert({r+1,mn});
					mini[mn]++;
				}
			}
		}

		if(mini.size()) cout<<mini.begin()->f+i+1<<endl;
		else cout<<-1<<endl;

	}
}

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

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

  int n;
  cin>>n;

  int count = n/2;
  count+=n%2;

  cout<<count<<'\n';

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_V = 20;

vvl dist(MAX_V, vl(MAX_V));
const ll n = 10;

int main() {
    ll h, w;
    cin >> h >> w;

    rep(i, n) {
        rep(j, n) {
            cin >> dist[i][j];
        }
    }
    
    rep(k, n) {
        rep(i, n) {
            rep(j, n) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    ll ans = 0;
    rep(i, h) {
        rep(j, w) {
            ll A;
            cin >> A;
            if(A != -1) {
                ans += dist[A][1];
            }
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <deque>
#include <algorithm>
#include <utility>
#include <stdio.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
#define for1(i,n) for (ll i=0;i<(n);i++)
#define for2(i,m,n) for (ll i=(m);i<(n);i++)
#define for3(i,m,n,d) for (ll i=(m);i<(n);i+=(d))
#define DEBUG 0
template <class T>
void dumplist(T list)
{
    for (auto item : list) {
        cout << item << " ";
    }
    cout << endl;
}


ll S[2001];
ll T[2001];
ll dp[2001][2001][2];
#define mod 1000000007

void solve()
{
    ll N,M;
    cin >> N >> M;
    for1(i,N) {
        cin >> S[i];
    }
    for1(i,M) {
        cin >> T[i];
    }
    dp[0][0][0] = 1;
    for1(i,N+1) {
        for1(j,M+1) {
            if (i >= 1 && j >= 1) {
                if (S[i-1]==T[j-1]) {
                    dp[i][j][0] += dp[i-1][j-1][0];
                    dp[i][j][0] += dp[i-1][j-1][1];
                    dp[i][j][0] %= mod;
                }
            }
            if (i >= 1) {
                dp[i][j][0] += dp[i-1][j][0];
                dp[i][j][0] %= mod;
            }
            if (j >= 1) {
                dp[i][j][1] += dp[i][j-1][0];
                dp[i][j][1] += dp[i][j-1][1];
                dp[i][j][1] %= mod;
            }
        }
    }
    cout << (dp[N][M][0]+dp[N][M][1]) % mod << endl;
}

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


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

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

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int n ;
  cin >> n ;
  vector<int> vec(n) ;
  vector<int> vecvec(n) ;
  int count = 0 ;
  
  rep(i, n){
    vecvec.at(i) = i+1 ;
  }
  
  rep(i, n){
    cin >> vec.at(i) ;
  }
 
  rep(i, n){
    if(vec.at(i)!=vecvec.at(i)){
      count++ ; 
    }
  }
  
  if(count==0 || count==2){
    cout <<"YES"<<endl ;
  }
  else{
    cout <<"NO"<<endl ;
  }  
    return 0 ;
}




Measured memory_bytes: 764
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

int a, b, c,N;
int A[1000], B[1000], C[1000], D[1000];
int flag[301];

int main(){
	cin >> a >> b >> c;
	while (a || b || c) {
		cin >> N;
		for (int i = 1; i <= a + b + c; i++) {
			flag[i] = 2;
		}
		for (int i = 0; i < N; i++) {
			cin >> A[i] >> B[i] >> C[i] >> D[i];
			if (D[i]) {
				flag[A[i]] = 1;
				flag[B[i]] = 1;
				flag[C[i]] = 1;
			}
		}
		for (int i = 0; i < N; i++) {
			if (!D[i]) {
				if (flag[A[i]] == 2 && flag[B[i]] == 1 && flag[C[i]] == 1)flag[A[i]] = 0;
				if (flag[A[i]] == 1 && flag[B[i]] == 2 && flag[C[i]] == 1)flag[B[i]] = 0;
				if (flag[A[i]] == 1 && flag[B[i]] == 1 && flag[C[i]] == 2)flag[C[i]] = 0;
			}
		}
		for (int i = 1; i <= a+b+c; i++) {
			cout << flag[i] << endl;
		}
		cin >> a >> b >> c;
	}
	return 0;
}

Measured memory_bytes: 2996
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli a;
    cin >> a;
    out(a + a * a + a * a * a);
}

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

int main() {
  int board[3][3];
  rep (i, 3) {
    rep (j, 3) {
      cin >> board[i][j];
    }
  }

  int a[3], b[3];
  bool flag;

  rep (i, board[0][0] + 1) {
    a[0] = board[0][0] - i;
    rep (j, 3) {
      b[j] = board[0][j] - a[0];
    }
    for (int j = 1; j < 3; j++) {
      a[j] = board[j][0] - b[0];
    }

    flag = true;
    rep (j, 3) {
      rep (k, 3) {
        int tmp = a[j] + b[k];
        if (tmp != board[j][k]) {
          flag = false;
          break;
        }
      }
      if (!flag) break;
    }
    if (flag) break;
  }

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

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
 
#define cinsc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOR(i,k,n)  for(int64 i=k;i<(int64)n;i++)
#define FORr(i,k,n)  for(int64 i=(int64)k;i>=n;i--)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define FOREACHr(it, l) for (auto it = l.rbegin(); it != l.rend(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define SQ(x) ((x)*(x))
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
 
//ONLINE_JUDGE   LOCAL
 
int64 powr(int64 x,int64 y,int64 p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0;
    while (y > 0){   
        if (y & 1)  
            res = (res*x) % p;   
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
} 
 
void  in_o(){
#ifndef LOCAL
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	cinsc;
}


int main() {
	  string s;
	  cin >> s;
	  int n = (int) s.size();
	  vector<int> a(n + 1);
	  for (int i = 0; i < n; i++) {
	    if (s[i] == '<') {
	      a[i + 1] = max(a[i + 1], a[i] + 1);
	    }
	  }
	  for (int i = n - 1; i >= 0; i--) {
	    if (s[i] == '>') {
	      a[i] = max(a[i], a[i + 1] + 1);
	    }
	  }
	  long long ans = 0;
	  for (int i = 0; i <= n; i++) {
	    ans += a[i];
	  }
	  cout << ans << '\n';
	  return 0;
}


Measured memory_bytes: 2820
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
  int top=0,s[100];
  char str[100];

  while((scanf("%s",str))!=EOF){
  	if(str[0]=='+'){
  		s[top-2]=s[top-2]+s[top-1];
  		top--;
  	}
  	else if(str[0]=='-'){
  		s[top-2]=s[top-2]-s[top-1];
  		top--;
  	}
  	else if(str[0]=='*'){
  		s[top-2]=s[top-2]*s[top-1];
  		top--;
  	}
  	else{
  		s[top]=atoi(str);
  		top++;
  	}
  }

	printf("%d\n",s[top-1]);
	
  return 0;
}



Measured memory_bytes: 2100
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
//const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int W, H, x, y;
	cin >> W >> H >> x >> y;

	printf("%.12lf ", (double)W*H / 2.0);
	if (W == 2*x && H == 2*y)
	{
		printf("1\n");
	}
	else
	{
		printf("0\n");
	}

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	ll h; cin >> h;
	ll x = 1;
	for( int i = 0; i < 50; ++i ){
		if( (x<<i) <= h && h < (x<<(i+1)) ){
			cout << (x<<(i+1))-1 << endl;
			return 0;
		}
	}
}

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

int canmake(int a, int b, ll mask) {
  if(a == b) return 1;
  set<int> s;
  s.emplace(a);
  for(int i = 50; i >= 1; i--) {
    if((mask >> i) & 1) {
      vector<int> v;
      for(int x : s) {
        if(x % i == b) return 1;
        if(x % i > b * 2 && !s.count(x % i)) v.emplace_back(x % i);
      }
      for(int e : v) s.emplace(e);
    }
  }
  return 0;
}

int canmakeAll(const vector<pair<int, int>> &to, ll mask) {
  for(auto p : to) {
    if(!canmake(p.first, p.second, mask)) return 0;
  }
  return 1;
}

ll solve() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n; cin >> n;
  vector<pair<int, int>> to;
    int a[50], b[50];
    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++) {
    if(a[i] != b[i] && a[i] <= 2 * b[i]) return -1;
    to.emplace_back(a[i], b[i]);
  }
  int last = 51;
  ll now = 0;
  while(1) {
    if(canmakeAll(to, now)) return now;
    for(int i = 1; i < last; i++) {
      if(canmakeAll(to, now | ((1ll << (i + 1)) - 1))) {
        last = i;
        now |= 1ll << i;
      }
    }
  }
}

int main() {
  cout << solve() << endl;
}



Measured memory_bytes: 256
import sys
import collections

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n, m = MI()
    G = [set() for _ in range(n+1)]
    for _ in range(m):
        a, b =MI()
        G[a].add(b)
        G[b].add(a)
    for i in range(n+1):
        G[i] = list(G[i])
    num = [-1]*(n+1)
    seen = [False]*(n+1)
    stack = []
    for i in range(1, n+1):
        if not seen[i]:
            stack.append(i)
            while stack:
                vertex = stack.pop(-1)
                seen[vertex] = True
                num[vertex] = i
            
                for j in range(len(G[vertex])):
                    neighbor = G[vertex][j]
                    if not seen[neighbor]:
                        stack.append(neighbor)
    c = collections.Counter(num)
    print(c.most_common()[0][1])

if __name__ == '__main__':
    main()

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

int main(){
  int n, x;

  do {
    int cnt = 0;
    cin >> n >> x;
    if(n == 0 && x == 0) break;
    for(int i = 1; i <= n - 2; i++){
      for(int j = i + 1; j <= n - 1; j++){
        for(int k = j + 1; k <= n; k++){
          if(i + j + k == x){
            cnt++;
          }
        }
      }
    }
    cout << cnt << '\n';
  } while(!(n == 0 && x == 0));

  return 0;
}



Measured memory_bytes: 3088
import sys
input = sys.stdin.buffer.readline

n, m = [int(i) for i in input().split()]

img_a = []
img_b = []

for i in range(n):
    img_a.append(list(input().strip()))

for i in range(m):
    img_b.append(list(input().strip()))


if img_a == img_b:
    print("Yes")
    sys.exit()

for i in range(0, n - m + 1):
    for j in range(0, n - m + 1):
        grid = [line[j:j + m] for line in img_a[i:i + m]]
        if grid == img_b:
            print("Yes")
            sys.exit()

print("No")


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

using namespace std;

#define int long long 
#define M 1000000007

string s[1010];
queue<pair<int,int> > qq;
int arr[1010][1010];
int vis[1010][1010];

void dfs(int i,int j,int mg,int n,int m){
	vis[i][j]=1;
	arr[i][j]=mg;
//	cout << "i " << i << " j " << j << endl;
	for(int p=i-2;p<=i+2;p++){
		for(int q=j-2;q<=j+2;q++){
			if(p>=0&&p<n&&q>=0&&q<m&&vis[p][q]==0&&s[p][q]!='#'){
//				cout << "i " << i << " j " << j << " p " << p << " q " << q << endl;
				arr[p][q]=min(mg+1,arr[p][q]);
				qq.push(make_pair(p,q));
			}
		}	
	}
	for(int p=i-1;p<=i+1;p++){
		for(int q=j-1;q<=j+1;q++){
			if(abs(j-q)+abs(i-p)>1){
				continue;
			}
			if(p>=0&&p<n&&q>=0&&q<m&&vis[p][q]==0&&s[p][q]!='#'){
//				cout << " p " << p << " q " << q << endl;
				dfs(p,q,mg,n,m);
			}
		}	
	}
}

signed main(){
//	int t;
//	cin >> t;
//	while(t--){
		int h,w;
		cin >> h >> w;
		int ch,cw;
		cin >> ch >> cw;
		int dh,dw;
		cin >> dh >> dw;
		for(int i=0;i<h;i++){
			cin >> s[i];
		}
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				arr[i][j]=LLONG_MAX;
			}
		}
		arr[ch-1][cw-1]=0;
		qq.push(make_pair(ch-1,cw-1));
		while(!qq.empty()){
			pair<int,int> p=qq.front();
			qq.pop();
			if(vis[p.first][p.second]){
				continue;
			}
			dfs(p.first,p.second,arr[p.first][p.second],h,w);
		}
		if(vis[dh-1][dw-1]==0){
			cout << -1 << endl;
		}
		else{
			cout << arr[dh-1][dw-1] << endl;
		}
//	}
}
 

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

//using namespace--------------------------------------------------------------------------------------------------------------
using namespace std;

//define-----------------------------------------------------------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1 << 25
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << "\n";
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)

//typedef----------------------------------------------------------------------------------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ull;

//const------------------------------------------------------------------------------------------------------------------------
const double EPS = 1e-10;
const double PI = acos( -1.0 );

//global-----------------------------------------------------------------------------------------------------------------------
int a, b;
short c;

//function---------------------------------------------------------------------------------------------------------------------
int main() {
	while ( scanf( "%d %d", &a, &b ) ) {
		if ( a == 0 && b == 0 ) {
			return 0;
		}
		int mx = a + b;
		c = 0;
		FOR( i, 1, 5 ) {
			scanf( "%d %d", &a, &b );
			if ( mx < a + b ) {
				mx = a + b;
				c = i;
			}
		}
		printf( "%c %d\n", c + 'A', mx );
	}
	return 0;
}

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

int main(){
  ll n,t;
  int i;
  ll a[200006];
  ll ans = 0;

  scanf("%lld %lld", &n, &t);

  for(i = 0;i < n;i++){
    scanf("%lld", &a[i]);
  }

  for(i = 1;i < n;i++){
    if((a[i] - a[i - 1]) >= t) ans += t;

    else ans += a[i] - a[i - 1];
  }

  ans += t;

  printf("%lld\n", ans);

  return 0;
}

Measured memory_bytes: 1792
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int N = 2e6 + 5;
const int mod = 1e9 + 7;

int power(int x, int y) {
    int res = 1;
    while(y) {
        if(y & 1) 
            res = res * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return res;
}

int fac[N], inv[N];

void pre() { 
    fac[0] = inv[0] = 1;
    for(int i = 1; i <= N; i++) {
        fac[i] = i * fac[i - 1] % mod;
        inv[i] = power(fac[i], mod - 2);
    }
}

int ncr(int n, int r) {
    if(n < 0 || r > n)
        return 0;
    return fac[n] * inv[r] % mod * inv[n - r] % mod;
}

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

    int T = 1; 
    // cin >> T; 
    while (T--) {
        int k;
        string s;
        cin >> k >> s;

        int n = s.size();
        int ans = 0;
        for(int i = n; i <= n + k; i++) {
            int x = ncr(n + k, i);
            int y = power(25, n + k - i);
            ans = (ans + x * y) % mod;
        }        
        cout << ans << '\n';
    }
    
    return 0;
}



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

int main() {
    int N, M; cin >> N >> M;
    
    vector<vector<int>> S(M);
    REP(i, 0, M) {
        int k; cin >> k;
        S[i].resize(k);
        REP(j, 0, k) cin >> S[i][j];
    }

    vector<int> P(M);
    REP(i, 0, M) cin >> P[i];

    int ans = 0;
    for (int bit = 0; bit < (1 << N); bit++) {
        bool ok = true;
        REP(i, 0, M) {
            int count = 0;
            for (auto s : S[i]) {
                if (bit & (1 << (s - 1))) count++;
            }
            if (count % 2 != P[i]) ok = false;
        }
        if (ok) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,c,x,a,b,p,q,mn=1e9;
vector<int> l,r;
int main()
{
	l.push_back(0);
	r.push_back(0);
	scanf("%d%d",&n,&c);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		if(x>=0)
		{
			r.push_back(x);
		}else
		{
			l.push_back(-x);
		}
	}
	sort(l.begin(),l.end());
	sort(r.begin(),r.end());
	a=l.size()-1;
	b=r.size()-1;
	for(int i=0;i<=c;i++)
	{
		p=i;
		q=c-i;
		if(p<=a&&q<=b)
		{
			mn=min(mn,min(l[p],r[q])+r[q]+l[p]);
		}
	}
	printf("%d\n",mn);
}

Measured memory_bytes: 3928
/*
 *  Author : Jun_SH
 *  Solution for ABC 142 A
 */
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
    int f=1,x=0;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 f*x;
}
main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    if(n&1){
        cout<<(double)((n+1)/2)/n<<endl;
    }
    else cout<<(0.5)<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int solve(int, int);
 
int n, A[2000];
 
int main(){
  int q, m[2000], i;
 
  scanf("%d", &n);
  for(i=0; i<n; i++) scanf("%d", &A[i]);
  scanf("%d", &q);
  for(i=0; i<q; i++) scanf("%d", &m[i]);
 
  for(i=0; i<q; i++){
    if(solve(0, m[i]) == 1) printf("yes\n");
    else printf("no\n");
  }
   
  return 0;
}
 
int solve(int i, int m){
  if(m == 0) return 1;
  if(i >= n) return 0;
  return ( solve(i+1, m) || solve(i+1, m-A[i]) );
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

#define UQ(v) (v.erase(unique(ALL(v)), v.end()) - v.begin())

LL n, k, x[50], y[50], p[50][50], s[51][51];
vector<LL> vx, vy;
map<LL, LL> mx, my;

int main() {
	cin >> n >> k;
	inc(i, n) { cin >> x[i] >> y[i]; }
	
	inc(i, n) {
		vx.PB(x[i]);
		vy.PB(y[i]);
	}
	
	sort(ALL(vx));
	sort(ALL(vy));
	int xx = UQ(vx);
	int yy = UQ(vy);
	inc(i, xx) { mx[vx[i]] = i; }
	inc(i, yy) { my[vy[i]] = i; }
	
	inc(i, n) { p[mx[x[i]]][my[y[i]]]++; }
	
	// ----  s: p の２次元累積和
	inc1(i, xx) {
	inc1(j, yy) {
		s[i][j] = p[i - 1][j - 1];
	}
	}
	inc1(i, xx) {
	inc1(j, yy) {
		s[i][j] += s[i - 1][j];
	}
	}
	inc1(i, xx) {
	inc1(j, yy) {
		s[i][j] += s[i][j - 1];
	}
	}
	// ----
	
	LL ans = 4e18;
	inc(xh, xx) {
	inc(xl, xh) {
	inc(yh, yy) {
	inc(yl, yh) {
		#define R(xl, xh, yl, yh) (s[xh][yh] - s[xh][yl] - s[xl][yh] + s[xl][yl])
		int c = R(xl, xh + 1, yl, yh + 1);
		LL v = (vx[xh] - vx[xl]) * (vy[yh] - vy[yl]);
		if(c >= k) { setmin(ans, v); }
	}
	}
	}
	}
	
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;

/*

        Bismillahir Rahmanir Rahim
        Problem :
        Problem Link :
        Topics :
        Solver : Masud Parves
        I Love Code More than Sharks Love Blood <3
*/


#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define SZ(a)           (int)a.size()
#define all(a)  a.begin(), a.end()
#define allr(a)  a.rbegin(), a.rend()


#define sf(a)           scanf("%d",&a)
#define sff(a,b)        scanf("%d %d",&a,&b)
#define sfff(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int zz=1 ; zz<=t ; zz++)
#define PRINT_CASE printf("Case %d: ",zz)
#define Debug(x)            cout<<#x " = "<<(x)<<endl
#define NOT_VISITED 0
#define IS_VISITED 1
#define WHITE 0
#define GRAY 1
#define BLACK 2



int fx[4]= {1,-1,0,0};
int fy[4]= {0,0,1,-1};

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N  (1<<pos);}
//int Reset(int N,int pos){return N= N & ~(1<<pos);}
//bool Check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/


const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)2e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<int, ll> pill;



int main() {
    CIN
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll a,b,c,d,total;
    cin >> a >> b >> c >> d;


    ll e = (c*d)/__gcd(c,d);

    total = b/c - (a-1)/c + b/d - (a-1)/d;
    total -= (b/e - (a-1)/e);

    cout << b - a +1 - total << endl;

    return 0;
}


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

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

	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])cout << "Bad" << endl;
	else cout << "Good" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int calc(int c,int h,int w){
   return max({h*c,h/2*(w-c),(h/2+1)*(w-c)})- min({h*c,h/2*(w-c),(h/2+1)*(w-c)});
}
int main(){
  int h,w;
  cin>>h>>w;
  if(h%3==0||w%3==0){
     cout<<0; 
  }else{
     int a=0,b=h*w/3;
     if(h%2==0&&w%2==0){
        a=min(h/2,w/2); 
     } else if(h%2==0){
         a=min(h/2,w);
     } else if(w%2==0){
        a=min(h,w/2); 
     }else{
     a=min(h,w);
        int c=b/h;
        a=min({a,calc(c,h,w),calc(c+1,h,w)});
        c=b/w;
        a=min({a,calc(c,w,h),calc(c+1,w,h)});
     }
     cout<<a;
  }
  return 0;
}


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

using namespace std;
typedef long long ll;

int func(int n){
    if((n&1)==0){
        return n/2;
    }else{
        return 3*n+1;
    }
}

int main(){
    int s;
    cin>>s;
    int ans=4;
    while(s!=1&&s!=2&&s!=4){
        s = func(s);
        ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_lr(i,l,r) for(int i=(l);i<(r);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;

int main() {

	int x, y, z, k;
	cin >> x >> y >> z >> k;
	V<ll> a(x), b(y), c(z);
	rep(i, x)cin >> a[i];
	rep(i, y)cin >> b[i];
	rep(i, z)cin >> c[i];
	sort(all(a));
	sort(all(b));
	sort(all(c));

	ll l = 2, r = 30000000001;
	while (r - l > 1) {
		
		ll m = (l + r) / 2;
		ll cnt = 0;
		rep(i, x)rep(j, y) {
			ll res = m - a[i] - b[j];
			cnt += c.end() - lower_bound(all(c), res);
		}
		if (cnt >= k)l = m;
		else r = m;
	}

	V<ll> ans;
	rep(i, x)rep(j, y) {
		ll res = l - a[i] - b[j];
		int cnt = c.end() - lower_bound(all(c), res);
		rep(s, cnt)ans.push_back(a[i] + b[j] + c[z - 1 - s]);
	}

	sort(all(ans), greater<ll>());
	rep(i, k)cout << ans[i] << endl;

}

Measured memory_bytes: 134440
s = str(input())

if s == 'SUN':
    print(7)
if s == 'MON':
    print(6)
if s == 'TUE':
    print(5)
if s == 'WED':
    print(4)
if s == 'THU':
    print(3)
if s == 'FRI':
    print(2)
if s == 'SAT':
    print(1)

Measured memory_bytes: 9012
#include <iostream>
#define ns namespace
#define mod %

using ns std;

int deq[500000]={0};
int p1=250000,p2=250000;

int main(int argc, char** argv) 
{
	int n;
	cin>>n;
	cin>>deq[p2];
	for(int i=0;i<n-1;i++)
	{
		if(i mod 2) cin>>deq[++p2];
		else cin>>deq[--p1];
	}
	if(n mod 2)
	{
		for(int i=p2; i>=p1; i--)
		cout<<deq[i]<<' ';
		cout<<endl;
	}
	else
	{
		for(int i=p1; i<=p2; i++)
		cout<<deq[i]<<' ';
		cout<<endl;
	}
	return 0;
}

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

int main() {
	int64_t N, A, B;
	cin >> N >> A >> B;

	int64_t ans = 0;
	if (A > B) {
		ans = 0;
	}
	else if (N == 1) {
		ans = (A == B) ? 1 : 0;
	}
	else {
		ans = (B - A) * (N - 2) + 1;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
char an[SIZE],s[SIZE],t[SIZE];
int main(){
   DRI(N);
   RS(s);
   RS(t);
   REPP(i,N,N*2+1){
       REP(j,N){
           an[j]=s[j];
           an[i-N+j]=t[j];
       }
       bool err=0;
       REP(j,N){
           if(an[j]!=s[j])err=1;
           if(an[i-N+j]!=t[j])err=1;
       }
       if(!err)return 0*printf("%d\n",i);
   }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back
#define fi first
#define se second

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;
}
void cmps(vector<int>&v,int &i){
	i=lower_bound(all(v),i)-v.begin();
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N,M;
bool con1[200005],con2[200005];
signed main(){
	cin>>N>>M;
	rep(i,M){
		int a,b;cin>>a>>b;a--;b--;
		if(a>b)swap(a,b);
		if(a==0)con1[b]=true;
		if(b==N-1)con2[a]=true;
	}
	REP(i,N-1){
		if(con1[i]&&con2[i]){
			cout<<"POSSIBLE"<<endl;return 0;
		}
	}
	cout<<"IMPOSSIBLE"<<endl;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define ll long long
  #define int long long
  #define double long double
  #define max(a,b) (a>b?a:b)
  #define min(a,b) (a<b?a:b)
  #define mp make_pair
  #define pb push_back
  #define inf INT_MAX
  #define f first
  #define s second
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define all(v) v.begin(), v.end()
  #define mod INT_MAX 
  const int MOD=1e9+7;
  const int N=2e5+2;

  int32_t main()
  {
    /*#ifndef ONLINE_JUDGE
       freopen("in.txt","r",stdin);
       freopen("out.txt","w",stdout);
    #endif*/
       IOS
       int n=5;
       for(int i=1;i<=5;i++)
       {
       	int x;
       	cin>>x;
       	if(x==0)
       	{
       		cout<<i;
       		return 0;
       	}
       }
       return 0;
      }

Measured memory_bytes: 3596
//Binary_search:二分探索法に依る検索
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vecll = vector<long long>;
#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)

int main()
{
    ll n, q, k;
    vecll a;

    cin >> n;
    a.resize(n);
    for (auto &x : a)
        cin >> x;

    cin >> q;
    rep(i, q)
    {
        cin >> k;
        cout << distance(a.begin(), lower_bound(all(a), k)) << endl;
    }

    return 0;
}


Measured memory_bytes: 3548
var
    n,m,x,y,max,min,a,b,i:longint;
begin
    readln(n,m,x,y);
    max:=-maxlongint;min:=maxlongint;
    for i:=1 to n do
        begin
            read(a);
            if a>max then max:=a;
        end;
    for i:=1 to m do
        begin
            read(b);
            if b<min then min:=b;
        end;
    if (x>=y) or (max>=min) or (max>=y) or (min<=x) then writeln('War') else writeln('No War')
end.

Measured memory_bytes: 128
from operator import itemgetter
N,T=map(int,input().split())
st=sorted([list(map(int,input().split())) for i in range(N)],key=itemgetter(1))
INF=float("inf")
cost=INF
for cn,tn in st:
  if tn<=T:
    cost=min(cost,cn)
  else:
    break
print("TLE" if cost==INF else cost)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <functional>
#include <algorithm>
#include <stack>
#include <list>
#include <queue>
//#include <iostream>
//#include <sstream>
using namespace std;
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define pf printf
#define sf scanf
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str()
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define deb(x) cout << #x" = " << x << '\n'
#define debd(x) pf("%s = %d\n", #x, x)
#define debs(x) pf("%s = %s\n", #x, s)
#define debll(x) pf("%s = %lld\n", #x, x)
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())
//typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
//bitmask
int onbit(int x, int pos) {x |= (1 << pos); return pos;}
int offbit(int x, int pos) {x &= ~(1 << pos); return x;}
int test(int x, int pos) {return x & (1 << pos);}
int flip(int x, int pos) {x ^= (1 << pos); return x;}
int lsb(int x) {return x & (-x);}
int onbitall(int x, int pos) {x = (1 << pos)-1; return x;}
//constants
const double EPS = 1e-9;
const double PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
//moves
const int dx1[] = {0, 1, 0, -1};
const int dy1[] = {1, 0, -1, 0};
const int dx2[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy2[] = {-1, 0, 1, -1, 1, -1, 0, 1};

int w, a, b;

bool inside(int x) {
	return x >= a && x <= a+w;
}

int main() {
//    freopen("input.in", "r", stdin);
	sf("%d %d %d", &w, &a, &b);
	bool connect = (inside(b) || inside(b+w) || (b < a && b+w > a+w));
	
	int res = (connect ? 0 : (b > a ? b-(a+w) : a-(b+w)));
//	debd(a-(b+w));
	pf("%d\n", (connect ? 0 : res));
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int a,b;cin >> a >> b;
	if(a >= 13)cout << b << endl;
	else if(a >= 6)cout << b/2 << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxn=1000005;
vector<ll> dp(maxn,0);
int main()
{
    int n;
    cin>>n;
    vector<ll> a(n);
   for(ll i=0;i<n;i++) cin>>a[i];
    for(ll num:a)
    {
        if(dp[num]!=0)
        {
            dp[num]=2;
            continue;
        }
        else
        {
            for(ll j=num;j<maxn;j+=num)
             dp[j]++;
        }
    }
    ll ans=0;
    for(ll num:a) if(dp[num]==1) ans++;
    cout<<ans;
    
}

Measured memory_bytes: 12724
using System;
using System.Linq;

namespace AtCoder_Beginner_Contest_051_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] kj = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int K = kj[0], S = kj[1];
            int answer=0;
            for (int i = 0; i <= S; i++)
            {
                if (i <= K)
                {
                    for (int k = 0; k <= S-i;k++)
                    {
                        if (k <= K)
                        {
                            if (S - i - k <= K)
                            {
                                answer++;
                            }
                        }
                    }
                }
            }
            Console.WriteLine(answer);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 2776
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;




int main(){

	ll A,B;
	scanf("%lld %lld",&A,&B);

	vector<ll> V;

	V.push_back(1);

	for(ll i = 2; i*i <= A; i++){
		if(A%i == 0){
			V.push_back(i);

			while(A%i == 0)A /= i;
		}
	}
	if(A > 1)V.push_back(A);

	V.push_back(1);

	for(ll i = 2; i*i <= B; i++){
		if(B%i == 0){
			V.push_back(i);

			while(B%i == 0)B /= i;
		}
	}
	if(B > 1)V.push_back(B);

	sort(V.begin(),V.end());

	int ans = 0;


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

		if(V[i] == V[i-1])ans++;
	}

	printf("%d\n",ans);

	return 0;
}


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

using namespace std;

int main(int argc,char * argv[])
{
	int n;
	scanf("%d", &n);
	bool inc = true, dec = true;
	int last = -1;
	int ans = 0;
	for (int i = 1;i <= n;++i)
	{
		int x;
		scanf("%d", &x);
		if (last == -1) last = x;
		else
		{
			if (x > last) dec = false;
			if (x < last) inc = false;
			if (dec == false && inc == false)
			{
				ans++;
				inc = dec = true;
			}
			last = x;
		}
	}
	printf("%d\n", ans + 1);
	return 0;
}

Measured memory_bytes: 128