akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define MAX 110
#define INF 1e9
typedef pair<int,int> pii;
typedef pair<pii,int> State;

struct Edge{
  int to,cost;
  Edge() {}
  Edge(int to,int cost) : to(to),cost(cost) {}
};

int V,E;
vector<Edge> G[MAX];

int dijkstra(){
  priority_queue<State,vector<State>,greater<State> > Q;
  Q.push(State(pii(0,0),0));
  int dist[MAX][2];
  for(int i = 0 ; i < V ; i++){
    for(int j = 0 ; j < 2 ; j++){
      dist[i][j] = INF;
    }
  }
  dist[0][0] = 0;

  while(!Q.empty()){
    State p = Q.top(); Q.pop();
    int v = p.first.second;

    if(dist[v][p.second] < p.first.first) continue;

    for(int i = 0 ; i < (int)G[v].size() ; i++){
      if(dist[v][p.second] + G[v][i].cost < dist[G[v][i].to][p.second]){
        dist[G[v][i].to][p.second] = dist[v][p.second] + G[v][i].cost;
        Q.push(State(pii(dist[G[v][i].to][p.second],G[v][i].to),p.second));
      }
      if(p.second) continue;
      int d = G[v][i].to;
      for(int j = 0 ; j < (int)G[d].size() ; j++){
        if(dist[v][0] < dist[G[d][j].to][1]){
          dist[G[d][j].to][1] = dist[v][0];
          Q.push(State(pii(dist[G[d][j].to][1],G[d][j].to),true));
        }
      }
    }
  }
  return min(dist[V-1][0],dist[V-1][1]);
}

int main(){
  int a,b,c;
  while(cin >> V >> E, V){
    for(int i = 0 ; i < V ; i++){
      G[i].clear();
    }
    for(int i = 0 ; i < E ; i++){
      cin >> a >> b >> c;
      a--, b--;
      G[a].push_back(Edge(b,c));
      G[b].push_back(Edge(a,c));
    }
    cout << dijkstra() << endl;
  }
  return 0;
}

Measured memory_bytes: 1212
#include <stdio.h>

int main(){
	int a,k,b;
	scanf("%d%d%d",&k,&a,&b);
	for(int i=a;i<=b;i++){
	if(i%k==0) 
    {printf("OK");
    return 0;}
	}
	printf("NG");
	return 0;
}

Measured memory_bytes: 1724
n = int(input())
comment = [[-1 for _ in range(n)] for _ in range(n)]
for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = (int(x) for x in input().split())
        comment[i][x-1] = y

#print(comment)
ans = 0

for k in range(1 << n):
    flag = True
    for i in range(n):
        for j in range(n):
            if k >> i & 1 == 0 or comment[i][j] == -1:
                continue
            else:
                if ((k >> j) & 1) != comment[i][j]:
                    flag = False
                    break

    #print("{} {}".format(k,flag))
    if flag:
        ans = max(ans,bin(k).count("1"))
print(ans)


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long

const long long MOD = 1000000007;

int main(){
  ll n;
  cin>>n;
  ll ans=n*(n+1)/2;
  ll a=n/3,b=n/5,c=n/15;
  ans -= 3*a*(a+1)/2 + 5*b*(b+1)/2;
  ans += 15*c*(c+1)/2;
  cout<<ans<<endl;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];

		for(int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();
		int flag = -1;
		int k = a[0];
		int cnt = 0;
		for(int i = 1; i < N; i++) {
			if(a[i] == k) continue;
			if(flag == -1) {
				if(a[i] > k) {
					flag = 0;
				}else {
					flag = 1;
				}
			}else {
				if(flag == 0) {
					if(a[i] < k) {
						cnt++;
						flag = -1;
					}
				}else if(flag == 1){
					if(a[i] > k) {
						cnt++;
						flag = -1;
					}
				}
			}
			k = a[i];
		}
		System.out.println(cnt + 1);

	}
}

Measured memory_bytes: 49316
import sys
N,m=map(int,input().split())
ans=dict()

for _ in range(m):
    s,c=map(int,input().split())
    if not s in ans.keys():
        ans[s]=c
    else:
        if ans[s] != c:
            print(-1)
            sys.exit()

if N==1:
    rg=range(0,10)
elif N == 2:
    rg=range(10,100)
elif N == 3:
    rg=range(100,1000)
    
for n in rg:
    n=str(n)
    f=True
    for k in ans.keys():
        f = f & (int(n[k-1]) == ans[k])

    if f:
        print(n)
        sys.exit()
else:
    print(-1)

Measured memory_bytes: 38896
/* ex3_3
   moka223711 */

#include <stdio.h>

int main(void){
	int num, n, i = 1;
	scanf("%d %d", &num, &n);

	// numがn^i以上のとき、n進法はi桁で表せる
	// numをnで割り続けて何回割れるかをiでカウントする
	while(num >= n){
		num /= n;
		i++;
	}

	printf("%d", i);

	return 0;
}


Measured memory_bytes: 128
using System;
using System.IO;
using System.Linq;
using System.Text;

namespace Contest
{
    class Program
    {
        private Scanner sc;

        public void Solve()
        {
            sc = new Scanner();
            int K = sc.NextInt();
            int X = sc.NextInt();
            var ar = (new int[K * 2 - 1]).Select((i, index) => X - K + 1 + index).ToArray();
            Console.WriteLine(string.Join(" ",ar));
        }

        static void Main() => new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
        _separator = ' ';
    }
    private readonly char _separator;
    private readonly StreamReader _stream;
    private int _pos;
    private string[] _line;
    #region get a element
    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(_separator);
            _pos = 0;
        }
        return _line[_pos++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    #endregion
    #region convert array
    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }
    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }
    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }
    #endregion
    #region get array
    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(_separator);
        _pos = _line.Length;
        return _line;
    }
    public int[] IntArray()
    {
        return ToIntArray(Array());
    }
    public long[] LongArray()
    {
        return ToLongArray(Array());
    }
    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }
    #endregion
}

Measured memory_bytes: 13396
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pll >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 

const ll mod = 1e9+7;
const ll inf=1e18+1e17;
//const ll mod = 998244353;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}

const ll N =2e5 + 6;

vii graph[N];
int arr[N];
void solve(){
	int n,m;
	cin>>n>>m;
	
	for ( int i=0;i<n;i++)
		cin>>arr[i];
	for ( int i=0;i<m;i++){
		int aa,bb;
		cin>>aa>>bb;
		aa--;bb--;
		graph[aa].pb( bb);
		graph[bb].pb( aa);
	}

	int count=0;
	for ( int i=0;i<n;i++){
		bool bo=true;
		for ( int j: graph[i]){
			if (arr[j]>=arr[i])
				bo=false;
		}
		if ( bo )
			count++;
	}
	cout<<count<<'\n';
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	/*#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif	*/
    ll t=1;
	//cin>>t;
    for (ll i=1;i<=t;i++){
    //	cout<<"Case #"<<i<<": ";
    	solve();
 	}
}

Measured memory_bytes: 11504
#include <cstdio>
#include <algorithm>
#include <ctype.h>
const int bufSize = 1e6;
inline char nc()
{
    #ifdef DEBUG
    return getchar();
    #endif
    static char buf[bufSize], *p1 = buf, *p2 = buf;
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, bufSize, stdin), p1 == p2) ? EOF : *p1++;
}
inline void read(char *s)
{
    static char c;
    for (; !isalpha(c); c = nc());
    for (; isalpha(c); c = nc()) *s++ = c;
    *s = '\0';
}
template<typename T>
inline T read(T &r)
{
    static char c;
    static int flag;
    flag = 1, r = 0;
    for (c = nc(); !isdigit(c); c = nc()) if (c == '-') flag = -1;
    for (; isdigit(c); c = nc()) r = r * 10 + c - 48;
    return r *= flag;
}
int x;
int main()
{
    read(x);
    if(x <= 599) puts("8");
    else if(x <= 799) puts("7");
    else if(x <= 999) puts("6");
    else if(x <= 1199) puts("5");
    else if(x <= 1399) puts("4");
    else if(x <= 1599) puts("3");
    else if(x <= 1799) puts("2");
    else puts("1");
    return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define int long long
#define ll long long 
#define rep(i,a,b) for(signed i=a;i<(b);++i)
#define erep(i,a,b) for(signed i=a;i<=(b);++i)
#define per(i,a,b) for(signed i=(a);i>(b);--i)
#define eper(i,a,b) for(signed i=(a);i>=b;--i)
#define fore(i, x, a) for(auto &&x:a) 
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define pb emplace_back
#define mp make_pair
#define ALL(x) begin(x),end(x)
#define F first
#define S second
#define debug(x)  cout << #x << ": " << (x) << '\n';
const long long INF=1001001001001001001;
const int MOD=(int)1e9 + 7;
const double EPS=1e-9;
using namespace std;
using Pii = pair<int,int>;
using vii = vector<int>;
template<class T>using  PS_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>using vv = vector<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> ostream& operator<<(ostream &os,const vector<vector<T> > &v) {
    ITR(u,begin(v),end(v))ITR(w,begin(*u),end(*u))os<<*w<<(w==end(*u)-1?"\n":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct edge { int from, to, cost; };
int dy[]={0, 1, -1, 0}; int dx[]={1, 0, 0, -1};
// cout << fixed << setprecision(10) << val;

int a, b, c;
signed main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
  cin >> a >> b >> c;
  cout << max(0LL, c - (a - b)) << endl;
  return 0;
}




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

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

Measured memory_bytes: 3628
s = input()
ans = 0
if int(s[0]) >= int(s[1]) and int(s[0]) >= int(s[2]):
    ans = int(s[0]) * 100 + int(s[0]) * 10 + int(s[0]) * 1
else:
    ans = int(s[0]) * 100 + int(s[0]) * 10 + int(s[0]) * 1 + 111
print(ans)

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

int main()
{
    string S1, S2;
    cin >> S1 >> S2;
    for(int i=0; i<3; i++)
    {
        if(S1[i] != S2[2-i])
        {
            cout << "NO" << endl;
            return 0;
        }     
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.ArrayList;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line;
        while (!(line = br.readLine()).equals("0")) {
            HashMap<Integer, Long> map = new HashMap<Integer, Long>();
            ArrayList<Integer> shine = new ArrayList<Integer>();
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                String[] input = br.readLine().split(" ");
                int e = Integer.parseInt(input[0]);
                if (!shine.contains(e))
                    shine.add(e);
                long p = Long.parseLong(input[1]);
                long q = Long.parseLong(input[2]);

                if (map.containsKey(e)) {
                    if (map.get(e) == Long.MAX_VALUE) {
                        continue;
                    }
                    if (p * q + map.get(e) >= 1000000) {
                        map.put(e, Long.MAX_VALUE);
                    } else {
                        map.put(e, p * q + map.get(e));
                    }
                } else {
                    if (p * q >= 1000000) {
                        map.put(e, Long.MAX_VALUE);
                    } else {
                        map.put(e, p * q);
                    }
                }
            }

            boolean isNA = true;
            for (Object x : shine.toArray()) {
                int e = (int) x;
                if (map.get(e) == Long.MAX_VALUE) {
                    System.out.println(e);
                    isNA = false;
                }
            }

            if (isNA)
                System.out.println("NA");
        }
    }
}


Measured memory_bytes: 26848
n=int(input())
a=list(map(int, input().split()))
count=0
if a[-1]==len(a):
    a[-1],a[-2]=a[-2],a[-1]
    count+=1
    
for i in range(len(a)):
    if a[i]==i+1:
        a[i],a[i+1]=a[i+1],a[i]
        count+=1
print(count)

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

using i64 = int64_t;

constexpr i64 MAX_N = 1299709 + 1;

i64 prime[MAX_N]; // i番目の素数
bool is_prime[MAX_N + 1];   // is_prime[i]がtrueならばiは素数

// n以下の素数の数を返す
i64 sieve(i64 n) {
    i64 p = 0;
    for (i64 i = 0; i <= n; i++)
        is_prime[i] = true;
    is_prime[0] = false;
    is_prime[1] = false;
    for (i64 i = 2; i <= n; i++) {
        if (is_prime[i]) {
            prime[p++] = i;
            for (i64 j = 2 * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
    return p;
}

int main(){
    i64 n;
    sieve(MAX_N-1);
    while(cin >> n, n != 0){
        if(is_prime[n]){
            cout << 0 << endl;
            continue;
        }
        for(int i=0;i<100000;++i){
            if(prime[i] > n){
                cout << prime[i] - prime[i-1] << endl;
                break;
            }
        }
    }

    return 0;
}



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

int main(){
  int N, X;
  cin >> N >> X;
  vector<int> L(N), D(N+1);
  rep(i,N) cin >> L[i];
  int ans = 1;
  for(int i=1;i<=N;++i){
    D[i]=D[i-1]+L[i-1];
    if (D[i] <= X){
      ans++;
    }
  }
  cout << ans << endl;
}

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

public class Main {

    private static long lowerBound(long[] x, long bj) {
        int leftIdx = -1;
        int rightIdx = x.length;
        while (rightIdx - leftIdx > 1) {
            int middleIdx = (leftIdx + rightIdx) / 2;
            if (bj <= x[middleIdx]) {
                rightIdx = middleIdx;
                continue;
            }
            leftIdx = middleIdx;
        }
        return rightIdx;
    }

    private static long upperBound(long[] x, long bj) {
        int leftIdx = -1;
        int rightIdx = x.length;
        while (rightIdx - leftIdx > 1) {
            int middleIdx = (leftIdx + rightIdx) / 2;
            if (bj < x[middleIdx]) {
                rightIdx = middleIdx;
                continue;
            }
            leftIdx = middleIdx;
        }
        return rightIdx;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        long[] b = new long[n];
        long[] c = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
        }
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextLong();
        }
        for (int i = 0; i < n; i++) {
            c[i] = sc.nextLong();
        }
        Arrays.sort(a);
        Arrays.sort(b);
        Arrays.sort(c);

        long count = 0;
        for (int j = 0; j < n; j++) {
            long bj = b[j];
            long aiCount = lowerBound(a, bj);
            long ckCount = n - upperBound(c, bj);
            count += aiCount * ckCount;
        }
        System.out.println(count);
    }

}


Measured memory_bytes: 97632
N,M,X=map(int, input().split())
List=[list(map(int,input().split())) for i in range(N)]



ans=10000000000000
for j in range(1,2**(N+1)-1):
    combinationlist=list(map(int, [i for i in format(2**(N+1)+j,'b')]))
    del combinationlist[0]
    sumoflist=[sum(combinationlist[s]*List[s][k] for s in range(N)) for k in range(M+1)]
    flag=True
    for t in range(1,M+1):
        if sumoflist[t]<X:
            flag=False
            break
    if flag and sumoflist[0]<ans:
        ans=sumoflist[0]

if ans!=10000000000000:
    print(ans)
else:
    print(-1)

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

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

	int len = (int) s.size();
	int res = 0;
	for(int i = 0; i < len; i++){
		for(int l = 0; l <= len; l++){
			if(i+l > len) continue;

			bool flag = true;
			for(int j = i; j < i+l; j++){
				if(s[j] != 'A' and s[j] != 'T' and s[j] != 'G' and s[j] != 'C'){
					flag = false;
					// printf("j=%d\n", j);
				}
			}

			// printf("i=%d, l=%d, flag=%d\n", i, l, flag);
			if(flag) res = max(res, l);
		}
	}

	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
const int INFTY =2147483647;
int main(){
    int n,ans=0;
    string s;
    cin>>n;
    map<string, int> m;
    REP(i,n){
        cin>>s;
        m[s]++;
    }
    for(auto i:m){
        ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 19244
#include <iostream>
//#include<stdio.h>
using namespace std;
int main() {
    bool a=0,b=0,c=0;
    string s;
    cin>>s;
    for(int i=0;i<3;i++){
        if(s[i]=='a')a=1;
        if(s[i]=='b')b=1;
        if(s[i]=='c')c=1;
    }
    if(a==1&&b==1&&c==1){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAXN = 100005;
struct ii {
	ll a, b, c;
	bool operator < (ii o) const {
		return a < o.a;
	}
};

ll N, M, poin[MAXN], par[MAXN], sum[MAXN], cnt[MAXN];
ii edge[MAXN];

ll find(ll x) {
	return par[x] == x? x: par[x] = find(par[x]);
}

void merge(ll x, ll y) {
	x = find(x), y = find(y);
	if (x == y) return;
	par[x] = y;
	sum[y] += sum[x];
	cnt[y] += cnt[x];
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	
	cin >> N >> M;
	for (ll i = 1; i <= N; i++) cin >> poin[i];
	for (ll i = 0; i < M; i++) {
		ll x, y, z;
		cin >> x >> y >> z;
		edge[i] = {z, x, y};
	}
	sort(edge, edge+M);
	
	for (int i = 1; i <= N; i++) {
		par[i] = i;
		sum[i] = poin[i];
	}
	ll ans = M;
	for (int i = 0; i < M; i++) {
		int x = find(edge[i].b), y = find(edge[i].c);
		if (x == y) {
			cnt[x]++;
			if (edge[i].a <= sum[x]) {
				ans -= cnt[x];
				cnt[x] = 0;
			}
		} else {
			merge(x, y);
			cnt[y]++;
			if (edge[i].a <= sum[y]) {
				ans -= cnt[y];
				cnt[y] = 0;
			}
		}
	}
	cout << ans << "\n";
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define X first
#define Y second
#define debug(x) cerr << #x << ": " << x << endl;
#define ll long long int
#define endl '\n'
#define mp make_pair
#define pb push_back
#define rep(i,l,r) for (ll i=l; i<r; i++)
#define repr(i,r,l) for (ll i=r; i>=l; i--)
using namespace std;
const long long int N=2e6+30;
int main(){
    string s;
    cin >> s;
    if (s[s.size()-1] == 's') cout << s << "es" << endl;
    else cout << s << 's' << endl;
}



Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
using namespace std;

ll ans;
string a, b;

inline void work(){
	cin >> a >> b;
	REP(i, 0, a.size() - 1)
		if (a[i] != b[i]) ans++;
	printf("%lld\n", ans);
}

int main(){
	work();
	return 0;
}

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

int main() {
  int H, W; cin >> H >> W;
  vector<string> A(H);
  for (int i = 0; i < H; i++) cin >> A.at(i);
  map<char, int> M;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (M.count(A.at(i).at(j))) M[A.at(i).at(j)]++;
      else M[A.at(i).at(j)] = 1;
    }
  }
  int cnt_odd = 0, cnt2 = 0;
  for (auto p : M) {
    if (p.second % 2 == 1) cnt_odd++;
    if (p.second % 4 == 2) cnt2++;
  }
  bool can = false;
  if (H % 2 == 0 && W % 2 == 0) {
    if (cnt_odd == 0 && cnt2 == 0) can = true;
  }
  else if (H % 2 == 1 && W % 2 == 1) {
    if (cnt_odd == 1 && cnt2 <= H/2 + W/2) can = true;
  }
  else {
    if (H % 2 == 1) {
      if (cnt_odd == 0 && cnt2 <= W / 2) can = true;
    }
    else {
      if (cnt_odd == 0 && cnt2 <= H / 2) can = true;
    }
  }
  if (can) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;
 
int main(){
    int A;
    cin >> A;
    if(A/10 == 9){
        cout << "Yes" << endl;
    }
    else if((A-9) % 10 == 0){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define int long long
using namespace std;

typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N;
    cin >> N;
    vector< vector<int> > F(N, vector<int>(10)), P(N, vector<int>(11));
    REP(i, N){
        readvec(F[i]);
    }
    REP(i, N){
        readvec(P[i]);
    }
    int ans = -1000000000000000;
    int b[10];
    FOR(i, 1, 1 << 10){
        REP(j, 10){
            b[j] = (i >> j) & 1;
        }
        int tmp = 0;
        REP(j, N){
            int count = 0;
            REP(k, 10){
                if(b[k] == 1 && F[j][k] == 1) count++;
            }
            tmp += P[j][count];
        }
        ans = max(ans, tmp);
    }

    cout << ans;

    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld  double
#define pii pair<int,int>
#define pb push_back
#define N 1000003
#define inf (ll)1e9+11
#define warmup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int mod=1e9+7;
int dp[N][2][2];

signed main()
{
    warmup
    
    string st,s("0");
    cin>>st;
    s+=st;
    int i,sz=s.size();
    dp[sz][0][0]=dp[sz][0][1]=0;
    dp[sz][1][0]=dp[sz][1][1]=2;
    for(i=sz-1;i>=1;--i)
    {
        dp[i][0][0]=s[i]-'0'+min(dp[i+1][0][0],dp[i+1][0][1]);
        dp[i][0][1]=s[i]-'0'+min(dp[i+1][1][0],dp[i+1][1][1]);
        dp[i][1][0]=11-(s[i]-'0')+min(dp[i+1][0][0],dp[i+1][0][1]);
        dp[i][1][1]=11-(s[i]-'0')+min(dp[i+1][1][0],dp[i+1][1][1])-2;
    }   
    cout<<min({dp[1][0][0],dp[1][0][1],dp[1][1][0],dp[1][1][1]});
    
    return 0;
}


Measured memory_bytes: 17948
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using LL = long long;
using P = pair<int,int>;
 
 
int main(){
	int M, D;
	cin >> M >> D;
	int ans = 0;
	for(int i = 1; i <= M; ++i){
		for(int j = 1; j <= D; ++j) {
			int d1, d2;
			d1 = j % 10;
			d2 = j / 10 % 10;
			if(d1==1||d2==1) continue;
			if(d1*d2==i){
			   	ans++;
			}
		}
	}
	cout << ans << endl;
}
 
 
 
 
 
 

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int n,k;
int ans = 0;
int main() {
    cin>>n>>k;

    //ans = k%n;
    if(n%k == 0)
        ans = 0;
    else
        ans = 1;
        
    cout << ans << endl;
    return 0;
}

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

using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long LL;
typedef pair<int,int> PI;
typedef vector<LL> VL;
typedef vector<VL> VLL;
typedef pair<LL,LL> PLL;
typedef unsigned long long ULL;
typedef pair<double,double> PD;

#define FOR(x, b, e) for(int x = b; x<= (e); x++)
#define FORD(x, b, e) for(int x = b; x>= (e); x--)
#define REP(x, n) for(int x = 0; x<(n); ++x)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(x) ((int)(x).size())

#define PB push_back
#define IN insert
#define ST first
#define ND second
#define INF 2000000011
#define MOD 1000000007

#define MAXS

LL go(){
	
	LL n,a,b;
	cin>>n>>a>>b;
	
	if((a-b)%2==0)
		return (b-a)/2;

	LL wyn=0;
	if((a-1)<=(n-b)){
		wyn+=a;
		b-=a;
		a=1;
	}
	else{
		wyn+=n-b+1;
		a+=n-b+1;
		b=n;
	}
	
	return wyn+(b-a)/2;
}

int main(){
	
	ios::sync_with_stdio(0); cin.tie(0);
	cout<<go();
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
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 (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
rep(i, n){
    cin >> a[i];
 }
sort(a.begin(),a.end(),greater<int>());
int alice=0, bob=0;
rep(i,n){
    if(i%2==0){
        alice += a[i];
    }
    else{
        bob += a[i];
    }
}
cout << alice - bob << endl;

//system("pause");
return 0;
}

Measured memory_bytes: 256
#ifndef DEBUG
#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i <= i##_len; ++i)
#define rep3(i, l, r) for (int i = l, i##_len = (r); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = l, i##_len = (r); i <= i##_len; ++i)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
typedef int64_t Int;
typedef long double Ld;

using namespace std;
template <class T>
using Graph = vector<vector<T>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 62;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

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

template <typename T>
inline T Gcd(T a, T b) {
    T c;
    while (b) {
        c = b;
        b = a % b;
        a = c;
    }
    return a;
}

Int Lcm(Int a, Int b) {
    if (a < b) {
        swap(a, b);
    }

    return a / Gcd(a, b) * b;
}

vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }

    return ret;
}

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

    Int n, x, m;
    cin >> n >> x >> m;

    set<Int> s;
    Int a = x;
    Int ans = 0;
    while (s.count(a) == 0) {
        s.insert(a);
        ans += a;

        a = (a * a) % m;
    }

    Int tem = a;
    Int rocnt = 0;
    Int sum = 0;
    do {
        rocnt++;
        sum += a;

        a = (a * a) % m;
    } while (a != tem);

    if (n < rocnt) {
        ans = 0;
        a = x;
        for (Int i = 0; i < n; i++) {
            ans += a;

            a = (a * a) % m;
        }

    } else {
        Int ro = (n - s.size()) % rocnt;
        for (Int i = 0; i < ro; i++) {
            ans += a;

            a = (a * a) % m;
        }

        ans += sum * ((n - s.size() - ro) / rocnt);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5932
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <string.h>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
int GCD(int a, int b) {
	return b ? GCD(b, a%b) : a;
}
//sort(a, a + N, greater<int>())   // descend
//sort(a, a+N)                    //  ascend

using ll = long long;
using namespace std;

int main() {
	int n;
	cin >> n;
	int w[110];
	for (int i = 0; i < n; i++) cin >> w[i];
	int sum = 0;
	int sum2 = 0;
	int minw = 10000000;

	for (int t = 0; t < n; t++) {
		for (int i = 0; i < t; i++) sum += w[i];
		for (int j = t; j < n; j++) sum2 += w[j];
		int p = abs(sum2 - sum);
		minw = min(minw, p);
		sum = 0; 
		sum2 = 0;
	}
	
	cout << minw;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 305;
int n;
ld dp[N][N][N];
bool mark[N][N][N];

ld solve(int f1, int f2, int f3){
	if(f1 == 0 && f2 == 0 && f3 == 0)
		return 0;
	ld &ans = dp[f1][f2][f3];
	if(mark[f1][f2][f3])
		return ans;
	ans = 1;
	mark[f1][f2][f3] = 1;
	if(f1)
		ans += ((ld)f1 / n) * solve(f1 - 1, f2, f3);
	if(f2)
		ans += ((ld)f2 / n) * solve(f1 + 1, f2 - 1, f3);
	if(f3)
		ans += ((ld)f3 / n) * solve(f1, f2 + 1, f3 - 1);
	ans /= (1 - (ld)(n - f1 - f2 - f3) / n);
	return ans;
}

int main() {
	cin >> n;
	int f[4] = {};
	for(int i = 0; i < n; i++){
		int a;
		cin >> a;
		f[a]++;
	}
	cout << fixed << setprecision(12) << solve(f[1], f[2], f[3]);
	return 0;
}



Measured memory_bytes: 228684
//In The Name Of God
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef pair<ll, ll> ii;
typedef pair<int, ii> iii;
typedef pair<double, double> dd;
typedef pair<dd, double> ddd;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<dd> vdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ii> vii;
typedef vector<vii> vvii;

#define forn(i, n) for (int i = 0; i < n; i++)
#define forr(i, n) for (int i = n; i >= 0; i--)
#define forne(i, x, n) for (int i = x; i < n; i++)
#define forre(i, x, n) for (int i = n; i >= x; i--)
#define all(a) (a).begin(), (a).end()
#define eps 1e-9

vi al[22];
int mat[22][22];
ll dp[1LL << 21], mod = 1e9 + 7;

void add(ll &a, ll b) {
    (a += b) %= mod;
}

int main() {
    ios::sync_with_stdio(false);
    int n; cin >> n;
    forn(i, 1LL << n) {
        al[__builtin_popcount(i)].push_back(i);
    }
    dp[0] = 1;
    forn(i, n) forn(j, n) cin >> mat[i][j];
    forn(k, n) {
        for(auto &i: al[k]) {
            forn(j, n) if (mat[k][j] && (i & (1 << j)) == 0)
                    add(dp[i | (1 << j)], dp[i]);
        }
    }
    cout << dp[(1 << n) - 1] << endl;


    return 0;
}


Measured memory_bytes: 39840
#include <iostream>

using namespace std;

int main(){
  int n, min, max;
  max = -1;
  min = 1001;
  cin >> n;
  for (int i=0;i<n;i++) {
    int a;
    cin >> a;
    if (a < min) {
      min = a;
    }
    if (max < a) {
      max = a;
    }
  }
  cout << max - min << endl;
}


Measured memory_bytes: 256
/*    Isn't it lovely, all alone?              */
/*    Heart made of glass, my mind of stone    */
/*    Tear me to pieces, skin to bone          */
/*    Hello, welcome home                      */

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;
ll mod=1000000007;


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

ll t=1;
//cin>>t;
while(t--)
{

char c;
cin>>c;

char b;

b=tolower(c);

if(b==c)
cout<<"a"<<endl;
else
cout<<"A"
<<endl;


}
return 0;
}




Measured memory_bytes: 3652
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

typedef tuple<int, int, int, int> tup;

tup rotate(tup& t){
    int a, b, c, d;
    tie(a, b, c, d) = t;
    return make_tuple(b, c, d, a);
}

bool check(tup& s, tup& t, int& c){
    if(s == t){
        c--;
    }
    t = rotate(t);
    if(s == t){
        c--;
    }
    t = rotate(t);
    if(s == t){
        c--;
    }
    t = rotate(t);
    if(s == t){
        c--;
    }
    return c;
}

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

    int n;
    cin >> n;
    vector<tup> v(n);
    map<tup, int> m;
    rep(i, n){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        tup t = make_tuple(a, b, c, d);
        v[i] = t;

        m[t]++;
        t = rotate(t);
        m[t]++;
        t = rotate(t);
        m[t]++;
        t = rotate(t);
        m[t]++;
    }

    int ans = 0;
    rep(i, n){
        tup t = v[i];
        m[t]--;
        t = rotate(t);
        m[t]--;
        t = rotate(t);
        m[t]--;
        t = rotate(t);
        m[t]--;

        int a, b, c, d;
        tie(a, b, c, d) = t;
        for(int j = i + 1; j < n; j++){
            tup t1 = v[j];
            rep(k, 4){
                int e, f, g, h;
                tie(e, f, g, h) = t1;
                t1 = rotate(t1);

                tup t2 = make_tuple(b, a, h, g);
                tup t3 = make_tuple(c, b, g, f);
                tup t4 = make_tuple(d, c, f, e);
                tup t5 = make_tuple(a, d, e, h);

                int c2 = m[t2];
                int c3 = m[t3];
                int c4 = m[t4];
                int c5 = m[t5];

                check(t1, t2, c2);
                check(t1, t3, c3);
                check(t2, t3, c3);
                check(t1, t4, c4);
                check(t2, t4, c4);
                check(t3, t4, c4);
                check(t1, t5, c5);
                check(t2, t5, c5);
                check(t3, t5, c5);
                check(t4, t5, c5);

                if(c2 <= 0 || c3 <= 0 || c4 <= 0 || c5 <= 0){
                    continue;
                }
                ans += c2 * c3 * c4 * c5;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 100096
#include<cstdio>
#include<iostream>
#define MN 2005
using namespace std;
int n,m,q,h[MN][MN],l[MN][MN],z[MN][MN];
char a[MN][MN];
int main()
{
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;i++) scanf("%s",a[i]+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++){
            z[i][j]=z[i-1][j]+z[i][j-1]-z[i-1][j-1];
            h[i][j]=h[i-1][j]+h[i][j-1]-h[i-1][j-1];
            l[i][j]=l[i-1][j]+l[i][j-1]-l[i-1][j-1];
            if(a[i][j]=='1'){
                z[i][j]++;
                if(a[i][j-1]=='1') h[i][j]++;
                if(a[i-1][j]=='1') l[i][j]++;
            }
        }
    while(q--){
        int xa,ya,xb,yb,t1,t2;
        scanf("%d%d%d%d",&xa,&ya,&xb,&yb);
        t1=z[xb][yb]-z[xb][ya-1]-z[xa-1][yb]+z[xa-1][ya-1];
        t2=h[xb][yb]-h[xb][ya]-h[xa-1][yb]+h[xa-1][ya];
        t2+=l[xb][yb]-l[xb][ya-1]-l[xa][yb]+l[xa][ya-1];
        printf("%d\n",t1-t2);
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  bool div = false;
  for(int i = 1 ; i < 10 ; i++){
  	for(int j = 1 ; j < 10 ; j++){
    	if( i*j == N){
          	div = true;
        }
    }
  }
  if(div){
  	cout << "Yes" << endl;
  }
  else{
  	cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;

int main() {
	int N;
  in(N);
  vl A(N);
  rep(i,N) in(A[i]);
  sort(all(A));
  out(A[N-1]-A[0]);
}
  

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vst = vector<st>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;


int main(){
  ll h, w;
  cin >> h >> w;
  vector<vchar> s(h, vchar(w));
  rep(i, 0, h){
    st str;
    cin >> str;
    rep(j, 0, w) s.at(i).at(j) = str.at(j);
  }

  bool ans = true;
  vll dx = {0, 0, 1, -1};
  vll dy = {1, -1, 0, 0};
  rep(i, 0, h)rep(j, 0, w)if(s.at(i).at(j) == '#'){
    bool count = false;
    rep(k, 0, 4){
      if(i + dx.at(k) >= 0 && i + dx.at(k) < h && j + dy.at(k) >= 0 && j + dy.at(k) < w)if(s.at(i + dx.at(k)).at(j + dy.at(k)) == '#') count = true;
    }
    if(!count) ans = false;
  }
  cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
//Bismillah Hir Rehmanir Rahim
//Allah knows best
#include<bits/stdc++.h>
using namespace std;
#define start ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f(i, a, n) for( i=a; i<n;i++)
#define ll long long
#define pi 3.141592653589793
#define vi              vector<int>
#define si              set<int>
#define pb              push_back
#define mp              make_pair
#define mod             1000000007
#define rr              return 0
#define ff              first
#define in              insert
#define ss              second
#define setbits(x)      __builtin_popcountll(x)
#define zrbits(x)       __builtin_ctzll(x)
#define deb(x)          cout << #x << " = " << x << endl
int main()
{
    start;
    ll i,j,n,m,k;
    cin>>n>>m>>k;
    i=ceil((1.0*n)/(1.0*m));
    cout<<k*i<<endl;
    rr;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[200009], dl[200009], dr[200009],s[200009];
main(){
    ll n;
    cin >> n;
    for(ll i = 1; i <= n; i++){
        cin >> a[i];
        s[i] = s[i-1] + a[i];
    }
    ll p = 1;
    for(ll i = 2; i <= n; i++){
        while(s[p+1] * 2 <= s[i]) p++;
        dl[i] = min(abs(s[i] - 2*s[p]), abs(s[i]-2*s[p+1]));
    }
    p = n ;
    for(ll i = n - 1; i >= 1; i--){
        while((s[n] - s[p-2]) * 2 <= (s[n] - s[i-1])) p--;
        dr[i] = min(abs((s[n] - s[i-1]) - 2*(s[n] - s[p-1])),abs((s[n] - s[i-1]) - 2*(s[n] - s[p-2])));
    }
    ll ans = 1e18;
    for(ll i = 2; i <= n-2; i++){

        ll Sl = s[i], Sr = s[n] - s[i];
        ll d1 = dl[i], d2 = dr[i+1];
        ll s1 = (Sl+d1)/2, s2 = (Sl - d1)/2;
        ll s3 = (Sr+d2)/2, s4= (Sr - d2)/2;
        ans = min(ans, max(s1,s3)-min(s2,s4));
    }
    cout << ans << endl;
    //2x-(Sl)=d
}


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

const int mxn = 1e6 + 10;
int AA[mxn];

void solve() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		int k;
		cin >> k;
		for (int j = 0; j < k; ++j) {
			int x;
			cin >> x;
			x--;
			AA[x] |= 1 << i;
		}
	}
	int need = 0;
	for (int i = 0; i < m; ++i) {
		int v;
		cin >> v;
		if (v == 1)
			need |= 1 << i;
	}
	int ans = 0;
	for (int i = 0; i < (1 << n); ++i) {
		int now = 0;
		for (int j = 0; j < n; ++j) {
			if ((i >> j) & 1)
				now ^= AA[j];
		}
		if (now == need)
			ans++;
	}
	cout << ans << "\n";
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t = 1;
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		System.out.println(a*b+" "+(2*a+2*b));
	}
}

Measured memory_bytes: 26064
import numpy as np

n, m = map(int,input().split())
a = [input().split() for i in range(n)]
b = [input().split() for i in range(m)]

aa = np.zeros((n,n), dtype=int)
for i in range(n):
    for j in range(n):
        if a[i][0][j] == '#':
            aa[i][j] = 1

bb = np.zeros((m,m), dtype=int)
for i in range(m):
    for j in range(m):
        if b[i][0][j] == '#':
            bb[i][j] = 1

flg = False
for i in range(n-m+1):
    for j in range(n-m+1):
        aaa = aa[i:i+m,j:j+m]
        if np.all(aaa == bb):
            flg = True

print('Yes') if flg else print('No')

Measured memory_bytes: 27224
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		if(A * B % 2 == 0) {
			System.out.println("Even");
		}else {
			System.out.println("Odd");
		}
	}
}

Measured memory_bytes: 20820
#include<bits/stdc++.h>
using namespace std;
char c[100007];
int main(){
    scanf("%s",c);int l=strlen(c),g=0;
    for(int i=0;i<l;++i)if(c[i]=='g')g++;
    printf("%d\n",min(l/2,g)-min(l-l/2,l-g));
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <cmath>
#define INF 1000000007
using namespace std ;

int main(int argc, char const *argv[])
{

	int a ;
	int b ;

	cin>>a>>b ;

	string s1,s2 ;

	for(int i = 0 ; i < a ; i++) s1.push_back(b + '0') ;

	for(int i = 0 ; i < b ; i++) s2.push_back(a + '0') ;

	if(s1 < s2) cout<<s1<<endl ;
	else cout<<s2<<endl ;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


using pll = pair<long long, long long>;
int N, M;
vector<long long> A, B, C;

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

    while (cin >> N >> M) {
        A.resize(N);
        for (int i = 0; i < N; ++i) cin >> A[i];
        sort(A.begin(), A.end());

        //COUT(A);

        B.resize(M);
        C.resize(M);
        for (int i = 0; i < M; ++i) cin >> B[i] >> C[i];

        vector<int> id(M);
        iota(id.begin(), id.end(), 0);
        sort(id.begin(), id.end(), [&](int i, int j) {
                return C[i] > C[j];});

        //COUT(id);

        long long sum = 0;
        long long iter = 0;
        for (auto i : id) {
            long long b = B[i], c = C[i];

            //cout << i << ": " << b << ", " << c << endl;
            
            for (int j = 0; j < b; ++j) {
                if (iter >= N) break;
                sum += max(A[iter], c);

                //cout << iter << ": " << A[iter] << ", " << c << ";; " <<  max(A[iter], c) << endl;
                
                ++iter;
            }
        }
        for (int i = iter; i < N; ++i) sum += A[i];
        
        cout << sum << endl;
    }
}


















Measured memory_bytes: 3072