akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll ans = 0 ;
string s ;
ll n ;
void solve(ll pos , ll curr , ll sum ){
     if(pos==n){
        ans=ans+curr+sum;
     }
     else{
       ll ano = s[pos]-'0';
       solve(pos+1,ano,sum+curr);
       solve(pos+1,curr*10+ano ,sum);
     }
}
int main(){
 cin >> s ;
 n=s.size();
 solve(1,s[0]-'0',0);
 cout << ans <<endl;
 return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<utility>
#include<queue>
#include<string>
#include<cmath>
#include<tuple>
#include<algorithm>
#define INF 1111111111
using namespace std;
typedef pair<int,int> P;
typedef tuple<int,int,int> tup;
typedef long long ll;
vector<int> vec(100100);
vector<int> passed(100100);
vector<int> dx = {-1,1};
int n,k;

int main() {
  int n,m;
  int amax,bmin;
  cin >> n >> m >> amax >> bmin;
  int a,b;
  for(int i=0;i<n;i++){
  	cin >> a;
    if(a>amax)
      amax = a;
  }
  for(int i=0;i<n;i++){
  	cin >> b;
    if(b<bmin)
      bmin = b;
  }
  cout << (amax >= bmin ? "War":"No War") << endl;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] arr = new int[N];
		int start = sc.nextInt();
		int output = 0;
		arr[0] = start;
		arr[1] = start;
		runner:for(int i = 1;i<N-1;i++) {
			int BI = sc.nextInt();
			
			if(BI>arr[i]) {
			}else {
				arr[i]=BI;
			}
			try {
				arr[i+1]=BI;
			}catch(Exception e) {
				break runner;
			}
		}
		for(int i = 0;i<N;i++) {
			//System.out.print(arr[i]+" ");
			output+=arr[i];
		}
		System.out.println(output);
	}

}


Measured memory_bytes: 22992
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AtCoder problem = new AtCoder(sc);
        problem.solve(out);

        out.flush();
    }

}

class AtCoder {

    final String S;

    AtCoder(FastScanner sc) {
        S = sc.next();
    }

    void solve(PrintWriter out) {
        int cnt = 0;
        final int N = S.length();
        for (int i = 0; i < N; i++) {
            if (Integer.parseInt(S.substring(i, i + 1)) == i % 2) cnt++;
        }
        out.println(Math.min(cnt, N - cnt));
    }

}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

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


Measured memory_bytes: 30164
<?php
    $n = trim(fgets(STDIN));
    $output = "";

    for($i = 1; $i <= $n; $i++){
        if($i % 3 == 0 || $i % 10 == 3 || preg_match("/3/",$i)){
            $output .= " ".$i;
            continue;
        }
    }
    echo $output."\n";

Measured memory_bytes: 15716
#include <iostream>

using namespace std;

int main()
{
	int n, m;
	int k;
	int a[50];
	int number;
	int count;

	cin >> n >> m;

	for (int i = 0; i < 50; i++)
	{
		a[i] = 0;
	}

	for (int i = 0; i < n; i++)
	{
		cin >> k;

		for (int j = 0; j < k; j++)
		{
			cin >> number;
			a[number - 1]++;
		}
	}
	count = 0;
	for (int i = 0; i < m; i++)
	{
		if (a[i] == n)
			count++;
	}
	
	cout << count;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

signed main(){
  int n,m,k;
  cin>>n>>m>>k;
  bool flag=false;
  rep(i,n+1)rep(j,m+1){
    if(i*(m-j)+j*(n-i)==k){
      flag=true;
      break;
    }
  }
  cout<<(flag?"Yes":"No")<<endl;
  return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        int a, b, c;
        cin>>a>>b>>c;
        if(a*a+b*b==c*c || b*b+c*c==a*a || c*c+a*a==b*b)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    return 0;
}








Measured memory_bytes: 2976
#include <stdio.h>
int main (int argc, char * argv[])
{
    int W,H;
    while(1){
        scanf("%d %d",&H,&W);
        if(W==0&&H==0){
            break;
        }
        for(int j=0;j<H;j++){
            for(int i=0;i<W;i++){
                if((j>0&&H-1>j)&&(i>0&&W-1>i)){
                    printf(".");
                }else{
                    printf("#");
                }
                
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2032
n = int(input())
l = sorted(map(int,input().split()))

ans = 0

for a in range(n):
    for b in range(a+1,n):
        for c in range(b+1,n):
            if  l[a] != l[b] != l[c] and l[a]+l[b] > l[c]:
                ans += 1
print(ans)

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

typedef struct List {
	struct List *next;
	int v;
} list;

int main()
{
	int i, u, w, N, T, A;
	scanf("%d %d %d", &N, &T, &A);
	list **adj = (list**)malloc(sizeof(list*) * (N + 1)), *d = (list*)malloc(sizeof(list) * (N - 1) * 2);
	for (i = 1; i <= N; i++) adj[i] = NULL;
	for (i = 0; i < N - 1; i++) {
		scanf("%d %d", &u, &w);
		d[i*2].v = w;
		d[i*2+1].v = u;
		d[i*2].next = adj[u];
		d[i*2+1].next = adj[w];
		adj[u] = &(d[i*2]);
		adj[w] = &(d[i*2+1]);
	}
	
	int dist[2][100001] = {}, q[100001], head, tail;
	list *p;
	dist[0][A] = 1;
	q[0] = A;
	for (head = 0, tail = 1; head < tail; head++) {
		u = q[head];
		for (p = adj[u]; p != NULL; p = p->next) {
			w = p->v;
			if (dist[0][w] == 0) {
				dist[0][w] = dist[0][u] + 1;
				q[tail++] = w;
			}
		}
	}
	dist[1][T] = 1;
	q[0] = T;
	for (head = 0, tail = 1; head < tail; head++) {
		u = q[head];
		for (p = adj[u]; p != NULL; p = p->next) {
			w = p->v;
			if (dist[1][w] == 0 && dist[1][u] + 1 < dist[0][w]) {
				dist[1][w] = dist[1][u] + 1;
				q[tail++] = w;
			}
		}
	}
	
	int max = 0;
	for (i = 1; i <= N; i++) if (dist[1][i] > 0 && dist[0][i] - 2 > max) max = dist[0][i] - 2;
	printf("%d\n", max);
	fflush(stdout);
	return 0;
}

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

int main(){
  int A, B;
  cin >>A>>B;
  
  if((A+B)%2==0){
    cout <<(A+B)/2<< endl;
  }else{
    cout << "IMPOSSIBLE" << endl;
  }
  
  return 0;
}

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

int abso(int a)
{
    if(a<0)
        return a*(-1);
    else
        return a;
}


int main()
{

    int x,a,b;
    cin>>x>>a>>b;

    if(abso(x-a)<=abso(x-b))
        cout<<"A"<<endl;
    else
        cout<<"B"<<endl;


    return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int number = n % 10;
    if (number == 3) {
        cout << "bon" << "\n";
    } else if (number == 0 || number == 1 || number == 6 || number == 8) {
        cout << "pon" << "\n";
    } else {
        cout << "hon" << "\n";
    }
    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <string.h>

int main() {
	char s[256];
	int f = 0, i = 0;

	gets(s);

	while (s[i] != '\0') {
		if ((i % 2) == 0) {
			if ('L' == s[i]) {
				f = 1;
				break;
			}
		}
		else if ('R' == s[i]) {
			f = 1;
			break;
		}
		i++;
	}

	if (f == 0) {
		printf("Yes\n");
	//	printf("%d", i);
	}
	else {
		printf("No\n");
	//	printf("%d", i);
	}

	return 0;
}

Measured memory_bytes: 128
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    var size = input[0].split(' ');
    var n = parseInt(size[0], 10);
    var m = parseInt(size[1], 10);
    var a = new Array(m);
    var b = new Array(m);
    var graph = new Array(n);
    for (var i = 0; i < n; i++) {
        graph[i] = new Array(n);
        for (var j = 0; j < n; j++) {
            graph[i][j] = false;
        }
    }
    for (var i = 0; i < m; i++) {
        var link = input[i + 1].split(' ');
        a[i] = parseInt(link[0], 10);
        b[i] = parseInt(link[1], 10);
        graph[a[i] - 1][b[i] - 1] = true;
        graph[b[i] - 1][a[i] - 1] = true;
    }

    var bridge = 0;
    for (var i = 0; i < m; i++) {
        graph[a[i] - 1][b[i] - 1] = false;
        graph[b[i] - 1][a[i] - 1] = false;

        var visited = new Array(n);
        for (var j = 0; j < n; j++) {
            visited[j] = false;
        }

        dfs(1, graph, visited);
        for (var j = 0; j < n; j++) {
            if (!visited[j]) {
                bridge++;
                break;
            }
        }

        graph[a[i] - 1][b[i] - 1] = true;
        graph[b[i] - 1][a[i] - 1] = true;
    }

    console.log(bridge);

    return 0;
}

function dfs(pos, graph, visited) {
    visited[pos - 1] = true;

    for (var i = 0; i < graph.length; i++) {
        if (visited[i]) {
            continue;
        }
        if (graph[pos - 1][i]) {
            dfs(i + 1, graph, visited);
        }
    }
}


Measured memory_bytes: 11596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
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 (a>b) { a=b; return true; } return false; }

const ll INF = 1LL<<60;

int main(){
    int n;
    cin >> n;
    vector<pair<ll, ll>> r(n);
    rep(i,n){
        ll x, l;
        cin >> x >> l;
        r[i].first = x + l;
        r[i].second = x - l;
    }
    sort(all(r));

    ll left = -INF;
    int ans = 0;
    rep(i,n){
        if (left <= r[i].second){
            left = r[i].first;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4812
#include<bits/stdc++.h>
using namespace std;
int main(){
	int t=1;
	//cin>>t;
	while(t--){
		// int n;
		// cin>>n;
		// vector<int>v(n);
		// for(int i=0;i<n;i++){
		// 	cin>>v[i];
		// }
		// int res;
		// cout<<res<<endl;
		int a,b;
		cin>>a>>b;
		cout<<floor((a*3+b)/2)<<endl;
	}
}

Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read


def main():
    N, *CSF = map(int, read().split())
    train = [0] * (N - 1)
    for i, t in enumerate(zip(*[iter(CSF)] * 3)):
        train[i] = t

    ans = [0] * N
    for i in range(N - 1):
        t = 0
        for c, s, f in train[i:]:
            if t < s:
                t = s + c
            elif t % f == 0:
                t += c
            else:
                t += f - (t % f) + c
        ans[i] = t

    print('\n'.join(map(str, ans)))
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9076
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
template <class T>
T _gcd(T a, T b) {
	return a % b ? _gcd(b, a % b) : b;
}
template <class _It>
typename iterator_traits<_It>::value_type
gcd(_It first, _It last) {
	using value_type = typename iterator_traits<_It>::value_type;
	value_type result = *first;
	for (; first != last; ++first) result = _gcd(result, *first);
	return result;
}
int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (auto& i : A) cin >> i;
    auto G = gcd(A.begin(), A.end());
    auto M = *max_element(A.begin(), A.end());
    cout << (K % G == 0 && K <= M ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
#define SEGMAX 131072
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	ll n, m;

	cin>>n>>m;

	if(m/2<=n){
		cout<<m/2<<endl;
	}else{
		cout<<n+(m-2*n)/4<<endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <numeric>

using namespace std;
using ll = long long;

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

    string S;
    cin >> S;

    vector<ll> ones;
    vector<ll> zeros;

    ll count = 1;
    char current = S[0];

    for (int i = 1; i < N; ++i) {
        if (current == S[i]) {
            ++count;
            continue;
        }

        // current 1= S[i]

        if (current == '0') {
            zeros.emplace_back(count);
        } else {
            ones.emplace_back(count);
        }

        current = S[i];
        count = 1;
    }

    if (current == '0') {
        zeros.emplace_back(count);
    } else {
        ones.emplace_back(count);
    }

    if (S[0] == '0') {
        ones.insert(begin(ones), 0);
    }

    if (S[S.size()-1] == '0') {
        ones.emplace_back(0);
    }

    // 0の塊がK個以下なら全て反転させればよいのでSの長さが答え
    if (zeros.size() <= K) {
        cout << S.size() << endl;
        return 0;
    }

    ll sum = 0;
    for (int i = 0; i < K; ++i) {
        sum += zeros[i];
        sum += ones[i];
    }
    sum += ones[K];

    ll ans = sum;
    for (int i = 0; i + K < zeros.size(); ++i) {
        sum -= zeros[i];
        sum -= ones[i];
        sum += zeros[i+K];
        sum += ones[i+K+1];

        ans = max(ans, sum);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1404
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> broken(n);
    rep(i,m) {
        int a;
        cin >> a;
        broken[a] = 1;
    }
    vector<int> dp(n+2);
    dp[n] = 1;
    const int mod = 1e9 + 7;
    for (int i = n-1; i >= 0; i--) {
        if (broken[i]) continue;
        dp[i] = (dp[i+1] + dp[i+2])%mod;
    }
    cout << dp[0] << endl;
    return 0;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
int k,a[5000000][3],f[2000000],d[2000000],l,r,last[1000000],kk;
bool flag[1000000];
void doit(int x,int y,int z){a[++kk][0]=last[x];a[kk][1]=y;a[kk][2]=z;last[x]=kk;}
int main(){
	cin>>k;for (int i=0;i<k;i++)
		for (int j=0;j<=9;j++)doit(i%k,(i*10+j)%k,j);//,cout<<i<<' '<<(i*10+j)%k<<' 'k;
	memset(f,10,sizeof(f));for (int i=1;i<=9;i++)f[i]=i,d[++r]=i,flag[i]=1;
	while (l!=r){
		l=l==1000000?0:l+1;for (int i=last[d[l]];i;i=a[i][0])
			if (a[i][2]+f[d[l]]<f[a[i][1]]){
				f[a[i][1]]=a[i][2]+f[d[l]];
				if (!flag[a[i][1]]){flag[a[i][1]]=1;r=r==1000000?0:r+1;d[r]=a[i][1];}
			}flag[d[l]]=0;
	}cout<<f[0]<<endl;
}

Measured memory_bytes: 27392
until (n = gets.chomp) == "0000"
  if n.to_i % 1111 == 0
    puts "NA"
  else
    ans = 0
  
    until n == "6174"
      ans += 1
      s = n.split("").sort.join
      l = s.reverse
      n = "%04d" % (l.to_i - s.to_i)
    end
    
    puts ans
  end
end

Measured memory_bytes: 9596
from collections import defaultdict
import sys
sys.setrecursionlimit(10**7)
def dfs(v,t,f,used):
    if v==t:
        return f
    used[v]=True
    for nv,cap in G[v].items():
        if not used[nv] and cap>0:
            d=dfs(nv,t,min(f,cap),used)
            if d>0:
                G[v][nv]-=d
                G[nv][v]+=d
                return d
    return 0

def Max_Flow(s,t):
    flow=0
    while(True):
        used=[False]*X
        f=dfs(s,t,INF,used)
        if f==0:
            return flow
        flow+=f

INF=float('inf')
N,M=map(int,input().split())
X=N*M+2

Num={}
def ID(i,j):return Num[(i,j)]

G=[defaultdict(int) for i in range(X)]
T=[list(input()) for i in range(N)]
s,t=0,N*M+1
cnt=1
for i in range(N):
    for j in range(M):
        if T[i][j]=='#':
            continue
        Num[(i,j)]=cnt
        cnt+=1
        if (i+j)%2==0:
            G[s][ID(i,j)]=1
            G[ID(i,j)][s]=0
        else:
            G[ID(i,j)][t]=1
            G[t][ID(i,j)]=0
DX,DY=[0,1,0,-1],[1,0,-1,0]
for i in range(N):
    for j in range(M):
        if T[i][j]=='#' or (i+j)%2==1:
            continue
        for dx,dy in zip(DX,DY):
            if i+dx<0 or i+dx>=N or j+dy<0 or j+dy>=M:
                continue
            if T[i+dx][j+dy]=='#':
                continue
            G[ID(i,j)][ID(i+dx,j+dy)]=1
            G[ID(i+dx,j+dy)][ID(i,j)]=0

res=Max_Flow(s,t)
for i in range(N):
    for j in range(M):
        if T[i][j]=='#' or (i+j)%2==1:
            continue
        for dx,dy in zip(DX,DY):
            if i+dx<0 or i+dx>=N or j+dy<0 or j+dy>=M:
                continue
            if T[i+dx][j+dy]=='#':
                continue
            if G[ID(i,j)][ID(i+dx,j+dy)]==0:
                if dx==1:
                    T[i][j]='v'
                    T[i+dx][j+dy]='^'
                if dx==-1:
                    T[i][j]='^'
                    T[i+dx][j+dy]='v'
                if dy==1:
                    T[i][j]='>'
                    T[i+dx][j+dy]='<'
                if dy==-1:
                    T[i][j]='<'
                    T[i+dx][j+dy]='>'
                    
print(res)
for i in range(N):
    print(''.join(T[i]))

Measured memory_bytes: 162920
N, M = map(int, input().split())

mat_N = []
for _ in range(N):
    mat_N.append(input())
mat_M = []
for _ in range(M):
    mat_M.append(input())

def chk(y, x):
    for k in range(M):
        if mat_N[y + k][x:M + x] != mat_M[k]:
            return False
    return True

if M <= N:
    for y in range(N-M+1):
        for x in range(N-M+1):
            if chk(y, x):
                print("Yes")
                exit()
print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}


//for(int i = ; i < ; i++){}

int main(){
  string n;
  cin>>n;
  if(n[0]=='9'||n[1]=='9') cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}




Measured memory_bytes: 256
using System;
using System.IO;
using System.Runtime.InteropServices;

namespace Contest
{
    struct S
    {
        public int X, Y;

        public S(int x, int y)
        {
            X = x;
            Y = y;
        }
    }
    class Program
    {
        private Scanner sc;

        public void Solve()
        {
            sc = new Scanner();
            int N = sc.NextInt();
            int K = sc.NextInt();
            if (K == 1)
            {
                Console.WriteLine(0);
                return;
            }
            Console.WriteLine(N - K);
        }



        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: 13140
N = int(input())
CSF = [list(map(int, input().split())) for _ in range(N - 1)]

def ceil(x, y):
  return (x -1) // y + 1

for i in range(N - 1):
  n = 0  
  for j in range(i, N - 1):
    c, s, f = CSF[j]
    if n <= s:
      n = s
    n = s + ceil(n - s, f) * f + c
  print(n)
print(0)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,l,eat;
    cin >> n >> l;
    int r = l+n-1;
    
    if(l>=0){
        eat = l;
    } else if(r<=0){
        eat = r;
    } else {
        eat = 0;
    }
    
    int taste = (r+l)*(r-l+1)/2-eat;
    cout << taste << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	if n == 1 {
		fmt.Fprintln(writer, "First")
		return
	}
	ee := make([][]edge, n)
	for i := 0; i < n-1; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner) - 1
		appendEdge(a, b, i, ee)
		appendEdge(b, a, i, ee)
	}
	dd := make([]int, n)
	dfs(0, -1, 0, dd, ee)
	win := make([]bool, n+1)
	win[0] = true
	for i := 2; i < n+1; i++ {
		win[i] = !(win[i-1] && win[i-2])
	}
	mx := -1
	for i := 0; i < n; i++ {
		mx = maxint(mx, dd[i])
	}
	if win[mx] {
		fmt.Fprintln(writer, "First")
		return
	}
	fmt.Fprintln(writer, "Second")
}

func dfs(c, p, d int, dd []int, ee [][]edge) int {
	dd[c] = d
	ch := &choku{}
	heap.Init(ch)
	heap.Push(ch, d)
	heap.Push(ch, d)
	for _, e := range ee[c] {
		if e.to == p {
			continue
		}
		h := dfs(e.to, c, d+1, dd, ee)
		heap.Push(ch, h)
		heap.Pop(ch)
	}
	h0 := heap.Pop(ch).(int)
	h1 := heap.Pop(ch).(int)
	dd[c] = h0 + h1 - d<<1
	return h1
}

type choku []int

func (h choku) Len() int           { return len(h) }
func (h choku) Less(i, j int) bool { return h[i] < h[j] }
func (h choku) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }
func (h *choku) Push(x interface{}) {
	*h = append(*h, x.(int))
}
func (h *choku) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

func maxint(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func appendEdge(from, to, id int, ee [][]edge) {
	ee[from] = append(ee[from], edge{
		to: to,
		id: id,
	})
}

type edge struct {
	to, id int
}


Measured memory_bytes: 136448
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
int main(){
   string a;
   cin>>a;
   if(a[0]==a[1]&&a[1]==a[2])cout<<"No"<<endl;
   else cout<<"Yes"<<endl;

}


Measured memory_bytes: 256
n = gets.chop.to_i
h = gets.chop.split.map(&:to_i)

f = []
n.times { f << 0}

ans = 0
tmp = []

while 1 do
  break if h == f

  for i in 0..n-1 do
    tmp << i unless h[i] == f[i]

    if (h[i] == f[i] || i == n-1) && !tmp.empty? then
      ans +=1
      tmp.each {|k| f[k] +=1 }
      tmp = []
    end
  end
end

puts ans


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


int main()
{
	string s,t;
	cin>>s>>t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end(),greater<char>());
	if(s<t) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Queue;

public class Main {

  public static void main(String[] args) {
    
    new Main().run();
  }

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      Graph graph = new Graph(n);
      int[] ajacent;
      String[] vInfo;
      int id,degree;

      for(int i=0; i<n; i++) {
        vInfo  = br.readLine().split(" ");
        id     = Integer.parseInt(vInfo[0]);
        degree = Integer.parseInt(vInfo[1]);
        ajacent = new int[degree];
        for(int j=0; j<degree; j++) {
          ajacent[j] = graph.convIdToIndex( Integer.parseInt(vInfo[j+2]) );
        }
        graph.setVertex(id, ajacent);
      }

      graph.vertexSearch();

      graph.dispReport();
    }
    catch (IOException e) {
      System.err.println(e);
    }
  }

  class Graph {

    Vertex[] vertices;
    Queue<Vertex> queue;
    int time;

    public Graph(int size ) {
      vertices  = new Vertex[size];
      queue = new ArrayDeque<>(size);
      time = 0;
    }

    public void setVertex(int id) {
      vertices[convIdToIndex(id)] = new Vertex(id);
    }
    public void setVertex(int id, int[] ajacent) {
      setVertex(id);
      setAjacent(id, ajacent);
    }
    public void setAjacent(int id, int[] ajacent) {
      vertices[convIdToIndex(id)].ajacent = ajacent;
    }
    public void vertexSearch() {
      breadthFirstSearch(0);
    }
    public void dispReport() {
      StringBuilder buf = new StringBuilder();

      for (Vertex v : vertices) {
          buf.append(v.id).append(" ")
             .append(v.distance).append("\n");
      }

      System.out.print(buf);
    }
    public int convIdToIndex(int id) {
      return id-1;
    }

    private void breadthFirstSearch(int index) {
      vertices[index].state = Vertex.GRAY;
      vertices[index].distance = 0;
      queue.offer(vertices[index]);

      Vertex v;
      while(queue.peek() != null) {
        v = queue.poll();
        for (int ajcIndex : v.ajacent) {
          if(vertices[ajcIndex].state == Vertex.WHITE) {
            vertices[ajcIndex].state = Vertex.GRAY;
            vertices[ajcIndex].distance = v.distance + 1;
            queue.offer(vertices[ajcIndex]);
          }
        }
        v.state = Vertex.BLACK;
      }
    }

    class Vertex {

      static final int WHITE = 0;
      static final int GRAY  = 1;
      static final int BLACK = 2;
      int id;
      int index;
      int state;
      int[] ajacent;
      int findTime;
      int doneTime;
      int distance;

      public Vertex(int id) {
        this.id = id;
        index = id-1;
        state = WHITE;
        distance = -1;
      }
    }
  }
}


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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef long long ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define fi first
#define se second

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

    int k;
    cin >> k;
    if(k%7==0)
        k/=7;
    if(k==1)
    {
        cout << "1\n";
        return 0;
    }
    if(k%2==0 || k%5==0)
    {
        cout << "-1\n";
        return 0;
    }
    ll tren = 1, ans = 1;
    while(tren)
    {
        tren = (tren*10+1)%k;
        ++ans;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
const int N = 100000 + 5;
struct node{
	int x;
	string s;
}a[N];
int vis[N],vis1[N];
int main()
{
    int n,m;
    cin >> n >> m;
    int sum1 = 0,sum2 = 0;
    for(int i = 0; i < m; i++){
    	cin >> a[i].x >> a[i].s;
    	if(a[i].s == "AC")
    		vis1[a[i].x] = 1;
    }
    for(int i = 0; i < m; i++){
    	if(vis1[a[i].x] == 1){
	    	if(a[i].s == "AC"){
	    		if(vis[a[i].x] == 0){
	    			vis[a[i].x] = 1;
	    			sum1++;
				}
			}
			if(a[i].s == "WA"){
				if(vis[a[i].x] == 0){
					sum2++;
				}
			}	
		}
	}
	cout << sum1 << " " << sum2 << endl;
    return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define LIM 100000000
using namespace std;

unordered_map<char, int> mp;

double calc(int fix[], int move_max[], int move_min[], double t) {
    double x_max = max((double) fix[0], max(t + move_max[0], -t + move_max[1]));
    double x_min = min((double) fix[1], min(t + move_min[0], -t + move_min[1]));
    double y_max = max((double) fix[2], max(t + move_max[2], -t + move_max[3]));
    double y_min = min((double) fix[3], min(t + move_min[2], -t + move_min[3]));
    return (x_max - x_min) * (y_max - y_min);
}

int main() {
    mp['R'] = 0;
    mp['L'] = 1;
    mp['U'] = 2;
    mp['D'] = 3;
    int n;
    cin >> n;
    int fix[4] = {- LIM * 3, LIM * 3, - LIM * 3, LIM * 3}, move_max[4] = {- LIM * 3, - LIM * 3, - LIM * 3, - LIM * 3}, move_min[4] = {LIM * 3, LIM * 3, LIM * 3, LIM * 3}; // RLUD
    for (int i = 0; i < n; i++) {
        char c;
        int x, y;
        cin >> x >> y >> c;
        int index = mp[c];
        if (c == 'L' || c == 'R') {
            move_max[index] = max(move_max[index], x);
            move_min[index] = min(move_min[index], x);
            fix[2] = max(y, fix[2]);
            fix[3] = min(y, fix[3]);
        } else {
            move_max[index] = max(move_max[index], y);
            move_min[index] = min(move_min[index], y);
            fix[0] = max(x, fix[0]);
            fix[1] = min(x, fix[1]);
        }
    }
    double ans = 1e17, prev_ans = 2e17;
    double left_limit = 0, right_limit = 1e9;
    double l = (left_limit * 2 + right_limit) / 3;
    double r = (left_limit + right_limit * 2) / 3;
    //while (abs(prev_ans - ans) > 1e-11) {
    for (int i = 0; i < 200; i++) {
        if (calc(fix, move_max, move_min, l) < calc(fix, move_max, move_min, r)) {
            right_limit = r;
        } else {
            left_limit = l;
        }
        l = (left_limit * 2 + right_limit) / 3;
        r = (left_limit + right_limit * 2) / 3;
        prev_ans = ans;
        ans = calc(fix, move_max, move_min, (l + r) / 2);
    }
    cout << fixed;
    cout << setprecision(15) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if i * 500 + j * 100 + k * 50 == X:
                ans += 1
print(ans)

Measured memory_bytes: 3060
from collections import defaultdict
n, m = map(int, input().split())
l = [tuple(map(int, input().split())) for i in range(m)]
graph = [[False] * n for i in range(n)]

for a, b in l:
    graph[a-1][b-1] = True
    graph[b-1][a-1] = True


def dfs(x):
    visited[x] = True
    for i in range(n):
        if graph[x][i] is False:
            continue
        if visited[i] is True:
            continue
        dfs(i)


ans = 0
for i in range(m):
    graph[l[i][0]-1][l[i][1]-1] = False
    graph[l[i][1]-1][l[i][0]-1] = False
    visited = [0] * n
    dfs(0)
    if sum(visited) != n:
        ans += 1
    graph[l[i][0]-1][l[i][1]-1] = True
    graph[l[i][1]-1][l[i][0]-1] = True
print(ans)


Measured memory_bytes: 3316
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	int c[200001];
	for(int i = 0; i < n; i++){
		cin >> c[i];
	}
	long long int res[200001];
	long long int sumByColor[200001] = {};
	vector<int> prev(200001, -1);
	res[0] = 1;
	prev[c[0]] = 0;
	sumByColor[c[0]] = 1;
	for(int i = 1; i < n; i++){
		res[i] = res[i - 1];
		if(prev[c[i]] < i - 1){
			res[i] += sumByColor[c[i]];
			res[i] %= mod;
			sumByColor[c[i]] += res[i - 1];
			sumByColor[c[i]] %= mod;
		}
		prev[c[i]] = i;
		// cout << i << " " << res[i] << endl;
	}
	cout << res[n - 1] << endl;
}

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

void print_lcs(string s, string t)
{
    int i,j,m,n;
    m = s.length();
    n = t.length();
    int  dp[m+1][n+1];
    //Creating the bottom-up table
    for(i=0;i<=m;i++)
    {
        for(j=0;j<=n;j++)
        {
            if(i==0||j==0)
            {
                dp[i][j] = 0;
            }
            else if(s.at(i-1)==t.at(j-1))
            {
                dp[i][j] = 1 + dp[i-1][j-1]; 
            }
            else
            {
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    //Printing the lcs
    int total_len = dp[m][n];
    char lcs[total_len+1];
    lcs[total_len] = '\0'; //ending literal
    i = m;
    j = n;
    while(i>0&&j>0)
    {
        //if charachters are same
        if(s.at(i-1)==t.at(j-1))
        {
            lcs[total_len-1] = s.at(i-1);
            total_len--;
            i--;
            j--;
        }
        else if(dp[i-1][j]>dp[i][j-1])
        {
            i--;
        }
        else j--;
    }
    cout<<lcs<<endl;
}

int main()
{
    string s,t;
    cin>>s;
    cin>>t;
    print_lcs(s,t);
    return 0;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
#define mst(a,b) memset(a,b,sizeof(a))
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define eps 1e-3
inline int lowbit(int x){ return x & -x; }
const int N = 1e6 + 10;
const int mod = (int) 1e9 +7;
const int INF = 0x3f3f3f3f;
const long long LINF = (1LL << 62);
typedef long long LL;
typedef unsigned long long ULL;
const double PI = acos(-1.0);
using namespace std;

char buf[100000],*p1=buf,*p2=buf;
inline char nc(){
  return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline bool read(int & x){
  char c=nc();x=0;
  if(c==EOF) return false;
  bool flag = false;
  for(;!isdigit(c);c=nc()) flag = true;
  for(;isdigit(c);x=x*10+c-'0',c=nc());
  if(flag) x *= -1;
  return true;
}
inline bool readL(LL & x){
  char c=nc();x=0;
  if(c==EOF) return false;
  bool flag = false;
  for(;!isdigit(c);c=nc()) flag = true;
  for(;isdigit(c);x=x*10+c-'0',c=nc());
  if(flag) x *= -1;
  return true;
}

map<string, bool> mp;

int main(){
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
//    freopen("out.txt","w",stdout);
#endif
//  printf("%d", 2147483647 >> 30);
  int n;
  cin >> n;
  string pre = "";
  for(int i = 0; i < n; i++) {
    string tmp;
    cin >> tmp;
    if(i) {
      if(tmp[0] != pre[pre.length() - 1] || mp.find(tmp) != mp.end()) {
        printf("No\n");
        return 0;
      }
    }
    mp[tmp] = true;
    pre = tmp;
  }
  printf("Yes\n");
  return 0;
}


Measured memory_bytes: 256
NN = 2020202
MOD = 10**9+7
INF = float("inf")

f = [0]*NN
rf = [0]*NN
inv = [0]*NN
f[0], f[1] = 1, 1
rf[0], rf[1] = 1, 1
inv[1] = 1

for i in range(2, NN):
    f[i] = (f[i-1] * i) % MOD
    inv[i] = (-inv[MOD % i] * (MOD // i)) % MOD
    rf[i] = (rf[i-1] * inv[i]) % MOD


def C(n, r):
    # if r < 0 or n < r:
    #     return 0
    # r = min(r, n - r)
    return (f[n] * rf[r] * rf[n-r]) % MOD


r1, c1, r2, c2 = map(int, input().split())
ans = C(r2+c2+2, r2+1) - C(r1+c2+1, r1) - C(r2+c1+1, c1) + C(r1+c1, r1)
print(ans % MOD)

Measured memory_bytes: 88300
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int N;
  cin>>N;
  double a[N];
  double p = 0;
  for(int i = 0;i<N;i++){
    cin>>a[i];
    p += 1/a[i];
  }
  cout << 1/p << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#define ll long long 
using namespace std;

int main() {
	int w, h, n, a, x, y, up, down, right, left;
	cin >> w >> h >> n;
	up = h;
	down = 0;
	right = w;
	left = 0;
	for (int i = 0; i < n; i++) {
		cin >> x >> y >> a;
		if (a == 1 && x > left) {
			left = x;
		}
		if (a == 2 && x < right) {
			right = x;
		}
		if (a == 3 && y > down) {
			down = y;
		}
		if (a == 4 && y < up) {
			up = y;
		}
	}
	if (right > left && up > down) {
		cout << (up - down)*(right - left) << endl;
	} else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int N, K, output = 1;
  scanf("%d %d", &N, &K);
  for(int i = 0; i < N; i++) {
    (output + K > output*2) ? output *= 2 : output += K;
  }
  printf("%d\n", output);
  
  return 0;
}

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

public class Main {
	
	public static void main(String[] args) {
		new Main().run();
	}
	
	int n,q,solvePoint;
	int[] A,m;
	boolean[] isSolve;
	
	public void run(){
		
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		A = new int[n];
		
		for (int i = 0; i < n; i++) {
			A[i]= sc.nextInt();
		}
		q = sc.nextInt();
		m = new int[q];
		
		for (int i = 0; i < m.length; i++) {
			m[i]= sc.nextInt();
		}
		isSolve = new boolean[q];
		Arrays.fill(isSolve,false);
		
		solvePoint = 0;
		
		for (int i = 0; i < m.length; i++) {
			solve(0, m[i]);
			solvePoint++;
			if(isSolve[i]){
				System.out.println("yes");
			}
			else{
				System.out.println("no");
			}
		}
		
	}
	public void solve(int i,int mi){
		
		if(i==n){
			if (mi==0) {
				isSolve[solvePoint]= true;
			}
			return;
		}
		
		solve(i+1,mi);
		solve(i+1,mi-A[i]);
	}
}

Measured memory_bytes: 26880
#include <stdio.h>
int main(void){
    int i, j;
    int h, w;
    short ishash = 1;
    while((scanf("%d %d", &h, &w))&&((h != 0)||(w != 0))){
        for(i = 0; i < h; i++){
            if((i+1)%2)
                ishash = 1;
            else
                ishash = -1;
            for(j = 0; j < w; j++){
                if(ishash == 1)
                    putchar('#');
                else
                    putchar('.');
                ishash *= -1;
            }
            putchar('\n');
        }
        putchar('\n');
    }
    return 0;
}


Measured memory_bytes: 572
(let ((k (read)))
  (loop :named main
        :with s := 7
        :for i :from 1 :to 1000000
        :if (= (mod s k) 0)
        :do (progn
              (format t "~A~%" i)
              (return-from main))
        :else
        :do (setf s (mod (+ (* s 10) 7) k))
        :finally (format t "-1~%")))


Measured memory_bytes: 24556
from collections import Counter

def main():
    num = int(input())
    data = list(map(int, input().split()))

    num_c = Counter(data)
    if len(num_c) > 3:
        print('No')
    else:
        if len(num_c) == 1:
            if num_c[0] == num:
                print('Yes')
            else:
                print('No')
        elif num % 3 == 0:
            if len(num_c) == 2:
                if num_c[0] == num // 3:
                    print('Yes')
                else:
                    print('No')
            else:
                num_c = list(num_c.items())
                aaa = num_c[0][0] ^ num_c[1][0] ^ num_c[2][0]
                if aaa == 0 and num_c[0][1] == num_c[1][1] and num_c[1][1] == num_c[2][1]:
                    print('Yes')
                else:
                    print('No')
        else:
            print('No')







if __name__ == '__main__':
    main()


Measured memory_bytes: 60784
n = int(input())
s = input()

r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')

ans = r_cnt * g_cnt * b_cnt

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1

print(ans)

Measured memory_bytes: 9192
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

// -----------------------------------------------------------------------------------------------------

// -----------------------------------------------------------------------------------------------------

let main() =
    let n = read int
    let st = SortedDictionary<string, int>(StringComparer.OrdinalIgnoreCase)
    for i in 0 .. n - 1 do
        let s = read string
        if st.ContainsKey(s) then st.[s] <- st.[s] + 1 else st.Add(s, 1)
    let cnt = Seq.maxBy (fun (kv: KeyValuePair<string, int>) -> kv.Value) st
    for kv in st do
        if cnt.Value = kv.Value then puts kv.Key
    ()

// -----------------------------------------------------------------------------------------------------
main()
writer.Dispose()


Measured memory_bytes: 38460
import sys
import math
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

a,b = LS()
b = b.replace(".","")
x = int(a)
y = int(b)

ret = x*y // 100
print(ret)

Measured memory_bytes: 9204