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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll a,b;
    string S;
    cin >> a>>b;

    if(a*b<0){
        cout << "Zero" << endl;
    }
    else if(a==0||b==0){
        cout << "Zero" << endl;
    }
    else if(a>0){
        cout << "Positive" << endl;
    }
    else{
        ll tmp = b - a + 1;
        if (tmp%2==0){
            cout << "Positive" << endl;
        }
        else{
            cout << "Negative" << endl;
        }
    }
}


Measured memory_bytes: 3652
#include <stdio.h>
#define mn(a,b,c) ((a>b)?((b>c)?c:b):((a>c)?c:a))
short A[1005][1005],V[1005][1005],H[1005][1005];int M;
int main() {while (scanf("%d",&M)!=EOF && M) {int i,j,a=0;char T;for (i=0;i<M;i++) for (scanf("%*c"),j=0;j<M;j++) scanf("%c",&T),A[i][j]=H[i][j]=V[i][j]=(bool)(T=='.');
    for (i=1;i<M;i++) for (j=1;j<M;j++) H[i][j]+=(H[i][j]?H[i][j-1]:0),V[i][j]+=(V[i][j]?V[i-1][j]:0),A[i][j]=mn(A[i-1][j-1]+1,H[i][j],V[i][j]),a=((a<A[i][j])?A[i][j]:a);
    if (!a) for (i=0;i<M;i++) if (H[0][i] || H[i][0]) a=1;printf("%d\n",a);} return 0;}

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

int abs(int a){
	return 0 <= a ? a : -a;
}

int main(){
	int n, m;
	cin >> n >> m;
	int a[n], b[n], c[m], d[m];
	for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
	for(int i = 0; i < m; i++) cin >> c[i] >> d[i];
	for(int i = 0; i < n; i++){
		int dist = 1e9, ans;
		for(int j = 0; j < m; j++) if(abs(a[i] - c[j]) + abs(b[i] - d[j]) < dist){
			dist = abs(a[i] - c[j]) + abs(b[i] - d[j]);
			ans = j + 1;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; } 
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } 

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())

int n;
int t[110];
int m;
int p[110], x[110];

void init() {
}

void input() {
	cin >> n;
	REP(i, n) {
		cin >> t[i];
	}
	cin >> m;
	REP(i, m) {
		cin >> p[i];
		p[i]--;
		cin >> x[i];
	}
}

void solve() {
	int tmp = 0;
	REP(i, n) tmp += t[i];
	REP(i, m) {
		int res = tmp;
		res -= t[p[i]];
		res += x[i];
		cout << res << endl;
	}
}

int main() {
	init();
    input();
    solve();
	return 0;
}








Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int n, m, i, point[1000] = { 0 }, kyougi[1000] = { 0 }, ans = 0, tmp = 0, j;
	cin >> n >> m;
	for (i = 0; i < n; i++) {
		cin >> kyougi[i];
	}
	for (i = 0; i < m; i++) {
		int sinsa;
		cin >> sinsa;
		for (j = 0; j < n; j++) {
			if (kyougi[j] <= sinsa) {
				point[j]++;
				break;
			}
		}
	}
	for (i = 0; i < m; i++) {
		if (tmp < point[i]) {
			tmp = point[i];
			ans = i;
		}
	}
	cout << ans+1 << endl;
	return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll=long long;

int main(){
    ll n,m,i,j,k;
    // double x,y,s,t;
    vector<ll> a(n),b(n);
    ll s,w;
    cin>>s>>w;

    w>=s ? cout<<"unsafe" : cout<<"safe";
    return 0;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long

using namespace std;

vector<long long> data, lazy;

void Add(int node, int b, int e, int l, int r, int val) {
    if (l > r) return;
    if (b == l && e == r) {
        lazy[node] += val;
        return;
    }
    
    int m = (b + e) / 2;
    Add(node * 2, b, m, l, min(r, m), val);
    Add(node * 2 + 1, m + 1, e, max(l, m + 1), r, val);
    data[node] = max(data[node * 2] + lazy[node * 2],  
            data[node * 2 + 1] + lazy[node * 2 + 1]);
}

long long Get() {
    return max(0LL, data[1] + lazy[1]);
}

int32_t main() {

    int n, m; cin >> n >> m;
    lazy.resize(4 * n, 0);
    data.resize(4 * n, 0);

    vector<tuple<int, int, int>> segs;
    for (int i = 0; i < m; ++i) {
        int l, r, w; cin >> l >> r >> w; --l; --r;
        segs.emplace_back(r, l, w);
    } 

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

    vector<long long> dp(n, 0);


    int at = 0;
    for (int i = 0; i < n; ++i) {
        while (at < m && get<0>(segs[at]) < i) {
            int l, r, w; tie(r, l, w) = segs[at++];
            Add(1, 0, n - 1, l, r, w);
        }
        Add(1, 0, n - 1, i, i, Get());
    }
    while (at < m) {
        int l, r, w; tie(r, l, w) = segs[at++];
        Add(1, 0, n - 1, l, r, w);
    }

    cout << Get() << endl;


    return 0;
}


Measured memory_bytes: 20720
#include <cstdio>

int n,Ans,a,t;

int Log(const int x){return x==1?0:Log(x>>1)+1;}

int main()
{
    for(scanf("%d",&n);n--;)
    {
        scanf("%d",&a);
        int c=Log(a),d=0;
        if(a!=(1<<c))d=1;
        if(t<c)Ans+=c-t,t=c;
        if(t>c)t=c,d=0;
        if(d)++Ans,++t;
    }
    printf("%d\n",Ans);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int q;
    cin>>q;
    bool rev = false;
    string start = "";
    while(q--) {
        int t;
        cin>>t;
        if(t==1) {
            rev = !rev;
        }
        else {
            int f;
            char c;
            cin>>f>>c;
            --f;
            if(rev)
                f = !f;
            if(f==0)
                start += c;
            else
                s += c;
        }
    }
    reverse(start.begin(), start.end());
    s = start + s;
    if(rev)
        reverse(s.begin(), s.end());
    cout<<s<<endl;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)
#define EPS         (1e-10)
#define EQ(a, b)    (abs((a)-(b)) < EPS)

using LL  = long long;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int n, m;cin >> n >> m;
    vector<bool> ok(n, false);
    string ans = "IMPOSSIBLE";
    for(int i=0;i<m;i++){
        int a, b;cin >> a >> b;a--;b--;
        int c = (a == 0 ? b : (b == n-1 ? a : -1));

        if(c == -1) continue;

        if(ok[c])
            ans = "POSSIBLE";
        else
            ok[c] = true;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
s = gets.chomp
n = s.size
l = nil

if n < 26
    l = "a"
else
    25.downto(1) do |i|
        next if s[i] < s[i-1]
        l = s[i-1].next
        s.slice!(i-1..25)
        break
    end
end

if l
    (l.."z").each do |c|
        next if s.include?(c)
        puts s + c
        break
    end
else
    puts -1
end

Measured memory_bytes: 1788
a, b, m = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

m1 = 10000000000
m2 = 10000000000
for i in al: m1 = min(m1, i)
for i in bl: m2 = min(m2, i)

ans = m1 + m2
#ans = 100000
#print(ans)
for i in range(m):
    x, y, z = map(int, input().split())
    t = al[x-1]+bl[y-1]-z
    ans = min(ans, t)

print(ans)


Measured memory_bytes: 71108
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
using namespace std;

#define ll long long

int main(){
    int N,T,ans = 1001,t_ = 0;
    cin >> N >> T;
    int c[N],t[N];
    for(int i = 0; i < N; i++){
        cin >> c[i] >> t[i];
        if(c[i] < ans && t[i] <= T){
            ans = c[i];
            t_ = 1;
        }
    }
    if(t_)cout << ans << endl;
    else cout << "TLE" << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
const int M=100010;
const int MOD=1000000007;
const int INF=1e16;
using ll=long long;

int zyou(int m){
	int ans=1;
	rep(i,0,m)ans*=2;
	return ans;
}

int main() {
	int n,m,i=0;
	ll ans=0,tmp=0;
	cin>>n>>m;
	ans=zyou(m)*((n-m)*100+1900*m);
	cout<<ans<<endl;
}

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

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define print(v) for(auto it=(v).begin();it!=(v).end();it++) {cout<<*it<<" ";}
#define ll long long
#define w(t) ll t;cin>>t;while(t--)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
using namespace std;

ll cost=1e18;

int main()
{
    ll n,m,x;
    cin>>n>>m>>x;
    vector<ll> books[n];
    forn(i,n)
    {
        forn(j,m+1)
        {
            ll x;
            cin>>x;
            books[i].pb(x);
        }
    }

    for(ll i=0;i<(1<<n);i++)
    {
        ll tot=0;
        vector<ll> val(m);
        for(ll j=0;j<n;j++)
        {
            if(i&(1<<j))
            {
                tot+=books[j][0];

                for(ll k=0;k<m;k++)
                {
                    val[k]+=books[j][k+1];
                }

            }
        }

        bool flag = true;

        forn(j,m)
        {
            if(val[j]<x)
            {
                flag=false;
                break;
            }
        }

        if(flag)
        {
            cost=min(tot,cost);
        }

    }

    if(cost==1e18)
        cout<<-1<<"\n";
    else
        cout<<cost<<"\n";


    return 0;
}


Measured memory_bytes: 3616
#include<stdio.h>
#define MAX 100


int main(){
  int n,i,j,N[MAX],A[MAX],b[MAX][MAX],C[MAX];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      b[i][j]=0;
    }
  }

  
  for(i=0;i<n;i++){
    scanf("%d%d",&N[i],&C[i]);
    N[i]--;
    for(j=0;j<C[i];j++){
      scanf("%d",&A[j]);
      A[j]--;
      b[N[i]][A[j]]=1;
    }
  }


  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)printf(" ");
      printf("%d",b[i][j]);
    }
    printf("\n");
  }

  return 0;

}



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

main() {
  int N; cin >> N;
  vector<ll> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  ll ans = 0;
  while (1) {
    ll sum = 0;
    for (int i = 0; i < N; i++) sum += a[i] / N;
    if (sum > (N - 1) * N) {
      for (int i = 0; i < N; i++) {
        ll q = a[i] / N;
        a[i] += -q * N + (sum - q);
        ans += q;
      }
    } else {
      sort(a.begin(), a.end(), greater<int>());
      if (a[0] < N) break;
      ll q = a[0] / N;
      for (int i = 0; i < N; i++) {
        a[i] += (i == 0) ? -q * N : q;
      }
      ans += q;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = gets.to_i
a = Array.new(n)
n.times do |i|
    a[i] = gets.split << i
    a[i][1] = a[i][1].to_i
end
a.sort_by!{|i,j,k|i}
b = Hash.new{|h,k|h[k] = []}
a.each do |arr|
    b[arr[0]] << arr[1,2]
end
b.values.each do |arr|
    arr.sort_by!{|i,j|-i}
    arr.each do |i|
        puts i[1]+1
    end
end

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

typedef long long ll;

int main()
{
    int n,i,q;
    cin >> n >> q;
    int a,b;
    vector<vector<int>> c(n);
    for(i = 0;i < n-1;++i){
        cin >> a >> b;
        c.at(a-1).push_back(b-1);
        c.at(b-1).push_back(a-1);
    }
    vector<bool> visited(n,false);
    vector<int> ans(n,0);

    for(i = 0;i < q;++i){
        cin >> a >> b;
        ans.at(a-1) += b;
    }

    queue<int> que;
    visited.at(0) = true;
    for(i = 0;i < c.at(0).size();++i){
        que.push(c.at(0).at(i));
        ans.at(c.at(0).at(i)) += ans.at(0);
    }
    while(!que.empty()){
        int now = que.front();
        que.pop();
        visited.at(now) = true;
        for(i = 0;i < c.at(now).size();++i){
            int next = c.at(now).at(i);
            if(visited.at(next)){
                continue;
            }
            ans.at(next) += ans.at(now);
            que.push(next);
        }
    }
    for(i = 0;i < n;++i){
        cout << ans.at(i) << endl;
    }
    return 0;
}

Measured memory_bytes: 15604
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int A[3];
    for(int i=0;i<3;i++)
        cin >> A[i];

    if(A[0]+A[1]+A[2] >= 22)
        cout << "bust" << endl;
    else
        cout << "win" << endl;

}

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

using namespace std;
int main ()
{   typedef pair<int,int> pair;
    int n;
    int tmp,tmp2;
    int cnt1=0;
    int cnt2=0;
    map<int,int> g;
    map<int,int> k;
 	cin >> n;
    for(int i=0;i<n/2;i++){
        cin >> tmp >> tmp2;
       g[tmp]++;
       k[tmp2]++;
    }
    int maxk,maxv;
    int i=0;
    pair gM,g2M,kM,k2M;
    for(auto itr = g.begin(); itr != g.end(); ++itr) {
        if(i==0){
//cout << itr->first << " " << itr->second << endl;
            gM=pair(itr->first,itr->second);
            g2M=pair(0,0);
        }else if(itr->second>gM.second){
          g2M=gM;
          gM=pair(itr->first,itr->second);
        }else if(itr->second>g2M.second)g2M=pair(itr->first,itr->second);
        i++;
    }
    i=0;
    for(auto itr = k.begin(); itr != k.end(); ++itr) {
        if(i==0){
//cout << itr->first << " " << itr->second << endl;
            kM=pair(itr->first,itr->second);
            k2M=pair(0,0);
        }else if(itr->second>kM.second){
          k2M=kM;
          kM=pair(itr->first,itr->second);
        }else if(itr->second>k2M.second)k2M=pair(itr->first,itr->second);
        i++;
    }
    int ans;
//cout << kM.first << " " << kM.second <<endl;
//cout << k2M.first << " " << k2M.second <<endl;
//cout << gM.first << " " << gM.second <<endl;
//cout << g2M.first << " " << g2M.second <<endl;
    if(kM.first != gM.first)ans=n-kM.second-gM.second;
    else ans=min(n-kM.second-g2M.second,n-k2M.second-gM.second);
    cout << ans <<endl;
    return 0;
}












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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define mp(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int INF=1<<30;
const long long int INF_=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

const int point[]={0,60,70,80},mask=3;
int memo[5][2<<8],grid[5][5];

int DFS(int y,int b){
	int &res=memo[y][b];
	if(res!=-1) return res;
	
	int cnt[5];
	cnt[0]=b&mask;
	cnt[1]=(b&mask)+((b>>2)&mask);
	cnt[2]=((b>>2)&mask)+((b>>4)&mask);
	cnt[3]=((b>>4)&mask)+((b>>6)&mask);
	cnt[4]=(b>>6)&mask;
	if(y==4){
		int score=0;
		if(grid[y][0]!=-1) score+=point[(grid[y][0]+cnt[0])%4];
		if(grid[y][1]!=-1) score+=point[(grid[y][1]+cnt[1])%4];
		if(grid[y][2]!=-1) score+=point[(grid[y][2]+cnt[2])%4];
		if(grid[y][3]!=-1) score+=point[(grid[y][3]+cnt[3])%4];
		if(grid[y][4]!=-1) score+=point[(grid[y][4]+cnt[4])%4];
		return res=score;
	}

	rep(i,0,4){
		rep(j,0,4){
			rep(k,0,4){
				rep(l,0,4){
					int score=0;
					if(grid[y][0]!=-1) score+=point[(grid[y][0]+cnt[0]+i)%4];
					if(grid[y][1]!=-1) score+=point[(grid[y][1]+cnt[1]+i+j)%4];
					if(grid[y][2]!=-1) score+=point[(grid[y][2]+cnt[2]+j+k)%4];
					if(grid[y][3]!=-1) score+=point[(grid[y][3]+cnt[3]+k+l)%4];
					if(grid[y][4]!=-1) score+=point[(grid[y][4]+cnt[4]+l)%4];
					res=max(res,DFS(y+1,i+(j<<2)+(k<<4)+(l<<6))+score);
				}
			}
		}
	}

	return res;
}

void Solve(){
	int n;
	cin >> n;
	rep(i,0,n){
		fill_n((int*)memo,5*(2<<8),-1);
		rep(y,0,5){
			rep(x,0,5){
				cin >> grid[y][x];
				--grid[y][x];
			}
		}
		
		cout << DFS(0,0) << endl;
	}
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	Solve();
	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define itn int
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);i++)
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int p){
	for(int i=2;i<=sqrt(p);i++){
		if(!p%i)return false;
	}
	return true;
}
string s;
int ans=0,h;
signed main(){
	cin>>s;
	int n=s.size();
	rep(i,(1<<n)){
	    h=0;
	    for(int j=1;j<=n;j++){
	        if((i>>j)&1){
	            ans+=stoll(s.substr(h,j-h));
	            h=j;
	        }
	    }
	    if(h!=n)ans+=stoll(s.substr(h,n-h));
	}
	cout<<ans/2<<endl;
	return 0;
}

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

int main(){
  int N;
  cin>>N;
  int a[10000];
  for(int i=0;i<N;i++)
    cin>>a[i];

  int count=0;

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


Measured memory_bytes: 256
k = gets.to_i
i = 7
flg = Array.new(k)
count = 1

while true
  i %= k

  if i == 0
    puts count
    exit
  elsif flg[i]
    puts -1
    exit
  end

  flg[i] = true
  i = i * 10 + 7
  count += 1
end

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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// ここに処理を記述

    string S, T;
    cin >> S >> T;

    int A, B;
    cin >> A >> B;

    string U;
    cin >> U;

    if(S == U){
        A--;
    }
    else{
        B--;
    }

    cout << A << " "<< B << "\n";

return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int x,y,i,a,flg;
	scanf("%d %d",&x,&y);
	flg=0;
	for(i=0;i<=x;i++){
		a=i*4+(x-i)*2;
		if(a==y){
			flg=1;
			break;
		}
	}
	if(flg==1){
		printf("Yes\n");
	}
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 1636
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n; cin >> n;
	VI a(n); REP(i,n) cin >> a[i];
	sort(ALL(a));
	int s=1, p=0;
	int l=1;
	REP(i,n-1){
		if(a[i]==a[i+1]){
			l++;
		}
		else{
			if(l%2==0)
				p++;
			l=1;
			s++;
		}
	}
	if(l%2==0)
		p++;
	if(p%2==1)
		s--;
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f'3f3f3f3f;

signed main()
{
  int A, B, Q;
  i64 s[100010];
  i64 t[100010];

  cin >> A >> B >> Q;
  for (int i = 0; i < A; ++i) cin >> s[i];
  for (int i = 0; i < B; ++i) cin >> t[i];

  const auto getPos = [&](i64 a[], int len, int idx) {
    if (idx < 0 || idx >= len) return LINF;
    else return a[idx];
  };

  const auto getDist = [&](i64 a, i64 b, i64 x) {
    if (a > b) swap(a, b);

    if (a <= x && x <= b) return 2*min(b-x, x-a) + max(b-x, x-a);
    if (     x <= a) return b-x;
    if (          b <= x) return x - a;
    return LINF;
  };

  while(Q--) {
    i64 x; cin >> x;
    int sp = lower_bound(s, s+A, x) - s;
    int tp = lower_bound(t, t+B, x) - t;

    i64 leftS = getPos(s, A, sp-1);
    i64 rightS = getPos(s, A, sp);
    i64 leftT = getPos(t, B, tp-1);
    i64 rightT = getPos(t, B, tp);

    cout << min({
        getDist(leftS, leftT, x),
        getDist(leftS, rightT, x),
        getDist(rightS, leftT, x),
        getDist(rightS, rightT, x)
        }) << '\n';
  }

  return 0;
}



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

int h,w;
char g[30][30];

int rec(int ci, int cj){
    g[ci][cj] = '#';
    int ans = 1;
    int di[] = {0,1,0,-1};
    int dj[] = {1,0,-1,0};
    rep(i,4){
        int ni = ci + di[i];
        int nj = cj + dj[i];
        if(ni >= h || nj >= w || ni < 0 || nj < 0 || g[ni][nj] == '#') continue;
        ans += rec(ni,nj);
    }
    return ans;
}

int main(){
    while(scanf("%d%d",&w,&h), w != 0){
        rep(i,h) scanf("%s",g[i]);
        int ans = 0;
        rep(i,h)rep(j,w) if(g[i][j]=='@') ans = rec(i,j);
        printf("%d\n",ans);
    }
}

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

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr <<">>>>>>"<< #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

int main()
{
	
string s;
cin>>s;
cout<< (set<char>(s.begin(),s.end()).size()==s.size()?"yes":"no")<<endl;;
}



Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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; }
#define int long long

void solve() {
	ll n; cin >> n;
    if(n % 2 == 1) {
        cout << 0 << endl;
    } else {
        ll m = n / 2;
        ll cnt = 0;
        ll p = 1;
        for(ll i = 1; i <= 26 ; ++i) {
            p *= 5LL;
            cnt += m / p;
        }
        cout << cnt << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}


Measured memory_bytes: 256
YYMM = 'YYMM'
MMYY = 'MMYY'
AMB = 'AMBIGUOUS'
NA = 'NA'

aabb = input()

aa = aabb[0:2]
naa = int(aa)
bb = aabb[2:]
nbb = int(bb)

fYYMM = (1 <= nbb <= 12)
fMMYY = (1 <= naa <= 12)

if fYYMM and fMMYY:
    print(AMB)
elif fYYMM and not fMMYY:
    print(YYMM)
elif not fYYMM and fMMYY:
    print(MMYY)
elif not fYYMM and not fMMYY:
    print(NA)
else:
    assert(False)



Measured memory_bytes: 3064
from collections import defaultdict
edge = defaultdict(lambda: 0)
def inpl(): return [int(i) for i in input().split()]
N = int(input())
A = inpl()
for i in A:
    edge[i] += 1
doubled = []
for j,k in edge.items():
    if k >= 2:
        doubled.append(j)
    if k >= 4:
        doubled.append(j)
doubled = (sorted(doubled))
if len(doubled) < 2:
    print(0)
else:
    print(doubled[-1]*doubled[-2])

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

int main() {
    string s;
    cin>>s;
    int a;
    if(s=="Sunny")
        a=0;
    else if(s=="Cloudy")
        a=1;
    else if(s=="Rainy")
        a=2;
    switch(a){
        case 0:cout<<"Cloudy"<<endl;
            break;

        case 1:cout<<"Rainy"<<endl;
            break;

        case 2:cout<<"Sunny"<<endl;
            break;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#define BUG puts("no bug")
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define ll long long
#define ull unsigned long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define PER(a,b,c) for(int a=b;a>=c;a--)
#define lb(a) (a&(-a))
#define pp (p<<1)
#define ppp (p<<1|1)
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
using namespace std;
const int MAXN=1e6+5;
int n,m,t;
int father[MAXN];
int siz[MAXN];
int find(int x){ return father[x]==x?x:father[x]=find(father[x]);}
pi v[MAXN];
int ans[MAXN];
int cnt=0;
int main(){
    cin>>n>>m>>t;
    REP(i,1,n)father[i]=i,siz[i]=1;
    REP(i,1,m){
        sci(v[++cnt].first);
        sci(v[cnt].second);
        int x=find(v[cnt].first),y=find(v[cnt].second);
        if(x!=y){
            father[x]=y;
            siz[y]+=siz[x];
        }
    }
    REP(i,1,t){
        sci(v[++cnt].first);
        sci(v[cnt].second);
    }
    REP(i,1,n)ans[i]=siz[find(i)];
    REP(i,1,cnt){
        int x=find(v[i].first),y=find(v[i].second);
        if(x==y)ans[v[i].first]--,ans[v[i].second]--;
    }
    REP(i,1,n)printf("%d ",ans[i]-1);
}

Measured memory_bytes: 9984
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <iostream>
#include <string>

#include <algorithm>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define PB push_back
#define MP make_pair

#define FOR(i, b, e) for(int i=(b);i<(e);i++)
#define REP(i, n) FOR(i,0,n)

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VPII;

const int MOD = 1000000007;
const int INF = 1e9;

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

const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }

int L;

int main() {
    cin >> L;
    double ans = powl(L / 3.0, 3);
    // cout << ans << endl;
    printf("%.12f\n", ans);
    return 0;
}

Measured memory_bytes: 512
#!/usr/bin/env python3

import numpy as np

n = int(input())
x_y = [list(map(int, input().split())) for _ in range(n)]

xy = [i+j for i, j in x_y]

ans1 = max(xy)-min(xy)


xy_rev = [i-j for i, j in x_y]
min_index = np.argmin(xy_rev)
max_index = np.argmax(xy_rev)

x1, y1 = x_y[max_index]
x2, y2 = x_y[min_index]

ans2 = abs(x2-x1)+abs(y2-y1)

print(max(ans1, ans2))


Measured memory_bytes: 80912
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
    public static void main(String[] args) throws IOException{
        FastReader in = new FastReader();
        FastWriter out = new FastWriter();
        String a = in.nextLine();
        int ans = 0;
        for (int i = 0; i < a.length()/2; i++){
            if (a.charAt(i) != a.charAt(a.length()-(i+1))){
                ans++;
            }
        }
        out.pl(ans);
        out.close();
    }
}
class FastReader{ 
    BufferedReader br; 
    StringTokenizer st; 
    public FastReader() { 
        br = new BufferedReader(new InputStreamReader(System.in)); 
    } 
    String next(){ 
        while (st == null || !st.hasMoreElements()) { 
            try{ 
                st = new StringTokenizer(br.readLine()); 
            }catch (IOException  e){ 
                e.printStackTrace(); 
            } 
        } 
        return st.nextToken(); 
    } 
    int nextInt(){ 
        return Integer.parseInt(next()); 
    } 
    long nextLong(){ 
        return Long.parseLong(next()); 
    } 
    double nextDouble(){ 
      return Double.parseDouble(next()); 
    } 
    String nextLine(){ 
        String str = ""; 
        try{ 
            str = br.readLine(); 
        } 
        catch (IOException e){ 
            e.printStackTrace(); 
        } 
        return str; 
    } 
}
class FastWriter{
    PrintWriter out;
    FastWriter(){
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	out.flush();
    }
    void pl(Object o){
        out.write(o.toString());
	    out.write("\n");
        out.flush();
    }
    void pl(){
        out.write("\n");
    }
    void p(Object o){
        out.write(o.toString());
    }
    void close(){
        out.flush();
        out.close();
    }  
}


Measured memory_bytes: 33180
// template version 1.6
// {{{ define basic macro
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
// varibable settings
#define int long long
#define INF 1000000000000000000LL
// #define INF 2147483647
#define MOD 1000000007LL
// #define MOD 998244353LL
#define infile "../test/sample-1.in"

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)
template<class T, size_t N> size_t sza(const T (&array)[N]) { return N; }
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
template<class T=int> T in() {T x; cin>>x; return (x);}
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}

int solve(){
  int N,M,C;cin>>N>>M>>C;

  int B[M]; rep(i, M) {cin>>B[i];}
  int res = 0;
  rep(i, N){
    int A[M];
    rep(i, M) {cin>>A[i];}
    dump_1d(B, M);
    dump_1d(A, M);
    int tmp = C;
    rep(m, M){
      tmp += A[m] * B[m];
    }
    if (tmp>0) res++;
  }
  cout << res << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


s = int(input())


def func(n):
    if n % 2 == 0:
        return n//2
    else:
        return 3*n+1


S = {s}
# print(S)
for i in range(10**6):
    s = func(s)
    # print(s)
    if s in S:
        print(i+2)
        break
    else:
        S.add(s)
        # print(S)


Measured memory_bytes: 3828
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce
from operator import mul
from pprint import pprint



sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


def digit_dp(n, f):
    dp = [[[0] * f for _ in range(2)] for _ in range(10002)]
    dp[0][0][0] = 1
    l = len(n)
    for i in range(l):
        max_d = int(n[i])
        for j in range(2):
            for ki in range(f):
                for di in range(10 if j else max_d + 1):
                    dp[i + 1][j or (di < max_d)][(ki + di) % f] += dp[i][j][ki]
                    dp[i + 1][j or (di < max_d)][(ki + di) % f] %= mod
    return dp[l][0][0] + dp[l][1][0] - 1


k = input()
d = I()
print(digit_dp(k, d) % mod)


Measured memory_bytes: 101728
#include <iostream>
    #include <cmath>
    #include<bits/stdc++.h>
    using namespace std;
     
    int main()
    {
        long long n,m,d;
        cin >> n >> m >> d;
        double ans = 0.0;
        if(d == 0){
            ans = (double)m/(double)n;
            if(n == 1) ans = m-1;
            cout << ans << endl;
            return 0;
        }
        double a = (n-d)*2.0/pow(n,2);
        cout << fixed << setprecision(10) << a * (double)(m-1) << endl;
        return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<ll> a(n);
    ll b = 0;
    rep(i, n) { cin >> a[i]; b ^= a[i]; }
    rep(i, n) cout << (b^a[i]) << " ";
    cout << "\n";
    return 0;
}

Measured memory_bytes: 4740
import Control.Monad

toInt :: String -> Int
toInt = read :: String -> Int

main = do
  n <- fromIntegral . toInt <$> getLine
  [d, x] <- map fromIntegral . map toInt . words <$> getLine
  a <- map fromIntegral . map toInt <$> replicateM n getLine
  print $ floor (x + fromIntegral (sum . map ceiling . map (\y -> d/y) $ a))


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

// ===========================================================================
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a){
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// ===========================================================================

mint nCr(ll n, ll r)
{
    mint x=1, y=1;
    rep(i, r)
    {
        x *= n - i;
        y *= i + 1;
    }

    return x/y;
}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //-----------------------------------------
    ll n, a, b;
    cin >> n >> a >> b;
    mint ans;

    ans = mint(2).pow(n) - 1 - nCr(n, a) - nCr(n, b);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type_a,class Type_b> void chmax(Type_a &a,const Type_b &b){if(a<b)a=b;}
template<class Type_a,class Type_b> void chmin(Type_a &a,const Type_b &b){if(a>b)a=b;}
template<class Type> Type igcd(Type x,Type y){if(x==0||y==0)return (x>y)?x:y;return (y%x)?igcd(y%x,x):x;}
template<class Type> Type ilcm(Type x,Type y){return x/igcd(x,y)*y;}
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

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

int main(){
	int h,w;
	cin>>h>>w;
	
	vector<string> s(h);
	REP(i,h) cin>>s[i];
	
	vvi jud(h,vi(w,0));
	REP(i,h)REP(j,w){
		if(jud[i][j] or s[i][j]=='.'){}
		else{
			bool flag=false;
			REP(k,4){
				int ny=i+dy[k];
				int nx=j+dx[k];
				
				if(0<=ny and ny<h and 0<=nx and nx<w){
					if(s[ny][nx]=='#') flag=true;
				}
			}
			if(flag){}
			else{
				cout<<"No"<<endl;
				return 0;
			}
			
		}
	}
	
	cout<<"Yes"<<endl;
}

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

using namespace std;

#define sz(x) (int) x.size()
#define all(a) a.begin(), a.end()

const double pi = acos(-1.0);


int main() {

    double r;
    cin >> r;

    printf("%.12lf\n", 2 * pi * r);

    return 0;
}


Measured memory_bytes: 3752
n, a, b = map(int ,input().split())

ans = n

if (b - a) % 2 == 0:
    ans = min(ans, (b - a) // 2)

left = a-1
right = n - b
if (b - a) % 2 == 1:
    left += 1
    right += 1
ans = min(ans, left + (b-a) // 2)
ans = min(ans, right + (b-a) // 2)

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    int com,n,q,x,y,p,t,i,j;
    long long s;
    int a[100000],b[100000];
    j=0;
    cin>>n>>q;
    for(i=0;i<n;i++){
            a[i]=pow(2,31)-1;
    }
    for(i=0;i<q;i++){
        cin>>com>>x>>y;
        if(com==0){
            a[x]=y;
        }
        if(com==1){
            s=pow(2,31);
            for(p=x;p<y+1;p++){
                if(s>a[p]){
                    s=a[p];
                    t=p;
                }
            }
            if(com==1){
                j++;
                b[j]=a[t];
            }
        }
    }
    for(i=1;i<j+1;i++){
            cout<<b[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int maxV=51;
int dp[maxV][maxV][maxV*maxV];

signed main(){
	int n,a;cin>>n>>a;
	vector<int> x(n);
	for(auto&& w:x)cin>>w;

	fill(dp[0][0],dp[maxV][0],0);
	dp[0][0][0]=1;

	for(int i=0;i<n;i++){
		for(int j=0;j<=i;j++){
			for(int s=0;s<maxV*maxV;s++){
              if(dp[i][j][s]==0)continue;
				dp[i+1][j][s]+=dp[i][j][s];
				dp[i+1][j+1][s+x[i]]+=dp[i][j][s];
			}
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)ans+=dp[n][i][i*a];
	cout<<ans<<endl;

}

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

using namespace std;



int main()
{
    int n,x,mn,ans=1,i;
    cin>>n>>x;
    mn=x;
    for(i=2;i<=n;i++)
    {
        cin>>x;
        mn=min(mn,x);
        ans+=(mn==x);
    }
    cout<<ans<<"\n";
    return 0;
}


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


int main() {
    long long a;
    string b;
    cin >> a >> b;

    long long bs = (b[0] - '0') * 100 + (b[2] - '0') * 10 + (b[3] - '0');



    cout << (a * bs) / 100 << endl;
    return 0;
}



Measured memory_bytes: 3608
N, x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
for k in range(1,N):
    if a[k-1] + a[k] > x:
        if a[k]+a[k-1]-x <= a[k]:
            ans += (a[k]+a[k-1])-x
            a[k] -= (a[k]+a[k-1])-x
        else:
            ans += a[k]+a[k-1]-x
            a[k-1] -= a[k]-x
            a[k] = 0
print(ans)


Measured memory_bytes: 63984
#pragma optimize("unroll-loops,no-stack-protector")
#include <bits/stdc++.h>
using namespace std;
// using namespace __gnu_pbds;
// #include <ext/pb_ds/assoc_container.hpp>
// typedef tree<int,null_type,less<int>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define Max(a,b,c) max(a,max(b,c))
#define Min(a,b,c) min(a,min(b,c))
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define pc(x)  __builtin_popcount (x)
#define vl vector< ll >
#define sorts(v) sort(v.begin(),v.end())
#define sortg(v) sort(v.begin(),v.end(),greater<ll>())
#define ss second
#define ff first
#define ll long long
#define ld long double
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1e18)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod 1000000007
#define mem(x,y) memset(x,y,sizeof(x))
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define gcd __gcd
#define primeDEN 727999983
#define nx_pe next_permutation(s.begin(),s.end())
#define cl cout<<"\n"
#define sp(x) setprecision(x)
const ll N=105,M=1e5+5;
ll dp[M];
ll n,k;
ll a[N];



void solve()
{
    cin>>n>>k;
    f(i,1,n+1)cin>>a[i];
    f(i,1,k+1)
    {
        f(j,1,n+1)
        {
            if(a[j]<=i)
            {
                if(dp[i-a[j]]==0)dp[i]=1;
            }
        }
    }
    
    if(dp[k])cout<<"First\n";
    else cout<<"Second\n";
    

}


    
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("ouput.txt", "w", stdout) ;
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;
    std::ios::sync_with_stdio(false);
    ll te=1;
    // cin>>te;
    while(te--){
        solve();
    }
    
}


Measured memory_bytes: 4408
#include<bits/stdc++.h>
using namespace std;
int main(){
string s,t;
cin>>s;
cin>>t;
int m=s.size();
int n=t.size();
//cout<<m<<endl;

int dp[m+1][n+1];
for(int i=0;i<=m;i++){
for(int j=0;j<=n;j++){
if(i==0 || j==0) 
dp[i][j]=0;
else if
(s[i-1]==t[j-1])dp[i][j]=1+dp[i-1][j-1];
else
dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
//cout<<dp[i][j]<<endl;



}
}
//cout<<dp[0][0]<<endl;

int index=dp[m][n];
char a[index];
a[index]= ' ';

int i=m,j=n;

while(j>0 && i>0){
if(s[i-1]==t[j-1]){
a[index-1]=s[i-1];
//cout<<a[index];
i--;
j--;
index--;
}
else if(dp[i-1][j]>dp[i][j-1])
i--;
else
j--;
} 
for(int i=0;i<dp[m][n];i++){
cout<<a[i];
}

return 0;
}

Measured memory_bytes: 35456
import sys
#from collections import deque
#from functools import *
#from fractions import Fraction as f
from copy import *
from bisect import *	
#from heapq import *
from math import gcd,ceil,sqrt
from itertools import permutations as prm,product
 
def eprint(*args):
    print(*args, file=sys.stderr)
zz=1
 
#sys.setrecursionlimit(10**6)
if zz:
	input=sys.stdin.readline
else:	
	sys.stdin=open('input.txt', 'r')
	sys.stdout=open('all.txt','w')
di=[[-1,0],[1,0],[0,1],[0,-1]]
def inc(d,c,x=1):
	d[c]=d[c]+x if c in d else x
def bo(i):
	return ord(i)-ord('A')	
def li():
	return [int(xx) for xx in input().split()]
def fli():
	return [float(x) for x in input().split()]	
def comp(a,b):
	if(a>b):
		return 2
	return 2 if a==b else 0		
def gi():	
	return [xx for xx in input().split()]
def fi():
	return int(input())
def pro(a): 
	return reduce(lambda a,b:a*b,a)		
def swap(a,i,j): 
	a[i],a[j]=a[j],a[i]	
def si():
	return list(input().rstrip())	
def mi():
	return 	map(int,input().split())			
def gh():
	sys.stdout.flush()
def isvalid(i,j):
	return 0<=i<n and 0<=j<m and a[i][j]!="."
def bo(i):
	return ord(i)-ord('a')	
def graph(n,m):
	for i in range(m):
		x,y=mi()
		a[x].append(y)
		a[y].append(x)

t=1
mod=998244353



while t>0:
	t-=1
	n,k,m=mi()
	vis={}
	cycle=[]
	i=ans=0
	while k not in vis:
		cycle.append(k)
		vis[k]=i
		i+=1
		ans+=k
		if i==n:
			print(ans)
			exit(0)
		k=(k**2)%m
		if k in vis:
			cycle=cycle[vis[k]:]
			n-=i

	s=sum(cycle)
	p=n%len(cycle)
	z=len(cycle)
	print(ans+(n//z)*s+sum(cycle[:p]))	




Measured memory_bytes: 84364