akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;

int h,w,n;
int inf = 0x3f3f3f3f;
char s[1005][1005];
// int vis[1005][1005];
int d[1005][1005];
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};
struct node{
    int x,y,st;
    node(int q,int qq){
        x = q;
        y = qq;
        st = 0;
    }
};
queue <node> q;

void bfs(int sx,int sy,int ex,int ey){
    while(!q.empty()){
        node no = q.front();
        if(no.x == ex && no.y == ey){
            break;
        }
        // vis[no.x][no.y] = 1;
        q.pop();
        for(int i=0;i<4;i++){
            int xx = no.x + dx[i];
            int yy = no.y + dy[i];
            if(xx>=0 && xx<h && yy>=0 && yy<w){
                if(d[xx][yy]==inf && s[xx][yy]!='X'){
                    d[xx][yy] = d[no.x][no.y] + 1;
                    q.push(node (xx,yy));
                }
            }
        }
    }
}

int ss[10];
int ee[10];

void dea(){
    for(int i=0;i<1005;i++){
        for(int j=0;j<1005;j++){
            d[i][j] = inf;
        }
    }
    // memset(vis,0,sizeof(vis));
    while(!q.empty()){
        q.pop();
    }
}
int main(){
    while(~scanf("%d%d%d",&h,&w,&n)){
        memset(ss,0,sizeof(ss));
        memset(ee,0,sizeof(ee));
        for(int i=0;i<h;i++){
            scanf("%s",&s[i]);
            for(int j=0;j<w;j++){
                if(s[i][j]=='S'){
                    ss[0]=i;
                    ee[0]=j;
                }
                if(s[i][j]>='0' && s[i][j]<='9'){
                    ss[s[i][j]-'0'] = i;
                    ee[s[i][j]-'0'] = j;
                }
            }
        }
        // for(int i=1;i<=n;i++){
        //     cout<<ss[i]<<" "<<ee[i]<<endl;
        // }
        int ans= 0;
        for(int i=0;i<n;i++){
            dea();
            q.push(node (ss[i],ee[i]));
            d[ss[i]][ee[i]] = 0;
            bfs(ss[i],ee[i],ss[i+1],ee[i+1]);
            ans += d[ss[i+1]][ee[i+1]];
        }
        printf("%d\n",ans);
    }
}


Measured memory_bytes: 8140
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>

using namespace std;

#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }

typedef long long LL;

const int N = (int) 0, mod = (int) 0;

int main() {
	string s;
	cin >> s;
	for (int j = 0; j < (int) s.size() - 1; ++j) {
		if (s[j] == 'A' && s[j + 1] == 'C') {
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
}






Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
 
/* Coding Space*/
class UF{
public:
  vi value;
  vi over; // When over < 0, 'over' keep number of node(using negative number). -1 means this tree is a node.
  int root(int index){
    int t = index;
    stack<int> stack_i;
    while(over[t] >= 0){
      stack_i.push(t);
      t = over[t];
    }
    while(!stack_i.empty()){
      int i = stack_i.top(); stack_i.pop();
      over[i] = t;
    }// reconnect
    return t;
  }
  void merge(int a,int b){
    if(this->root(a) == this->root(b)) return;
    over[root(a)] += over[root(b)]; // over have a number of nodes.
    over[root(b)] = root(a);
  }
  int NumNode(int a){
    return -over[root(a)];
  }
  UF(int Nodes){
    value.resize(Nodes);
    over.resize(Nodes);
    rep(i,Nodes)
      over[i] = -1;
  }
};
typedef tuple<int,int> tii;
int main(){
  UF road(2*100001);
  UF train(2*100001);
  int n,k,l; cin >> n >> k >> l;
  rep(i,k){
    int a,b; cin >> a >> b;a--,b--;
    road.merge(a,b);
  }
  rep(i,l){
    int a,b; cin >> a >> b;a--,b--;
    train.merge(a,b);
  }
  map<tii,int> m;
  rep(i,n){
    m[tii{road.root(i),train.root(i)}]++;
  }
  rep(i,n){
    cout << m[tii{road.root(i),train.root(i)}] << (i==n-1?"\n":" ");
  }
}

Measured memory_bytes: 15232
def resolve():
    '''
    code here
    '''
    N, M, K = [int(item) for item in input().split()]
    
    is_found = False
    for i in range(N+1):
        for j in range(M+1):
            if i*M + j*N -2*j*i == K:
                is_found = True
                break
    print('Yes') if is_found else print('No')

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9176
from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect
setrecursionlimit(1000000)


N,M = list(map(int,input().split()))

edges = [[] for _ in range(N)]

for i in range(M):
    L,R,D = list(map(int,input().split()))
    edges[L - 1].append((R -1,D))
    edges[R - 1].append((L-1, -D))


visited = [None] * N
place = [0] * N
inf = 10 ** 10


def walk(i):
    if visited[i]:
        return (i,i)
    visited[i] = True
    (n,m) = (inf, - inf)
    for j,d in edges[i]:
        #print(j,d)
        if visited[j] and place[j] != place[i] + d:
            print("No")
            exit()
        place[j] = place[i] + d
        (x,y) = walk(j)
        (n,m) = (min(n,x),max(m,y))
    return (n,m)

for i in range(N):
    if not visited[i]:
        place[i] = 0
    # 連結成分のminとmax
        (n,m) = walk(i)
        if m - n > 10 ** 9:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 134596
#include <stdio.h>

int main() {
	char v[50+2][50+2];
	int h, w;
	scanf("%d%d", &h, &w);
	for (int i = 0; i <= w + 1; i++) {
		if ( i == 0 || i == w+1) {
			for (int j = 1; j <= h; j++) {
				v[i][j] = '.';
			}
		} else {
			char s[51];
			scanf("%s", s);
			v[i][0] = v[i][h+1] = '.';
			for (int j = 1; j <= h; j++) {
				v[i][j] = s[j-1];
			}
		}
	}


	for (int i = 1; i < w; i++) {
		for (int j = 1; j < h; j++) {
			if( v[i][j] == '#') {
				if (v[i+1][j] == '.') {
				if (v[i-1][j] == '.') {
				if (v[i][j+1] == '.') {
				if (v[i][j-1] == '.') {
					printf("No\n");
					return 0;
				}}}}
			}
		} 
	}
	printf("Yes\n");	
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main()
{
	int a,b;
	string str;
	cin >> str;
	
	for(int i = 0;i<str.size();i++){
		if(str[i]=='A'){
			a=i;
			break;
		}
	}
	
	for(int i = 0;i<str.size();i++){
		if(str[str.size() - i]=='Z'){
			b=str.size() - i;
			break;
		}
	}
	
	cout << b-a+1 << endl;
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	ll a, b, c;
	cin >> a >> b >> c;
	if (c - a - b > 0 && 4 * a * b < (c - a - b) * (c - a - b)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))
 
using namespace std;
 
template<class T>bool chmax(T &a, const T &b) { if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(b<a) { a=b; return 1; } return 0; }
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-12;
const double PI = acos(-1.0);

const int MAX = 1e5+10;
ll fac[MAX],inv[MAX],finv[MAX];

void init() {
    fac[0] = 1, fac[1] = 1;
	inv[0] = 0, inv[1] = 1;
    finv[0] = 1, finv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(int n, int r) {
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD;
}

int main() {
	init();

	int n,k;
	cin >> n >> k;
	vi a(n);
	rep(i,n) cin >> a[i];

	sort(all(a));

	ll ma = 0,mi = 0;
	for(int i = 0; i < n; i++){
		mi = (mi+a[i]*nCr(n-i-1,k-1))%MOD;
		ma = (ma+a[i]*nCr(i,k-1))%MOD;
	}	

	if(mi > ma) ma += MOD;
	cout << (ma-mi)%MOD;

	return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define VS vector<string>
#define ll long long int
#define debug(x) cout << x << " :" <<#x << endl  
int main(void) {
    ll n, m;
    vector<ll> t(n);
    cin >> n >> m;
    REP(i,n) {
        cin >> t[i];
    }
    ll ans = m;
    REP(i,n-1) {
        if(t[i+1] < t[i] + m) ans += t[i+1] - t[i];
        else ans += m;
    }

    cout << ans << endl;                                                                             

}


Measured memory_bytes: 33024
#include<iostream>
using namespace std;
int main()
{
	int n,k;	cin>>n>>k;
	bool OK=false;
	for(int i=0;i<=n;i++){
		if(k-(i*2) == (n-i)*4)
			OK=true;
	}
	if(OK)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
		
		
}

Measured memory_bytes: 3128
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define int long long
#define double long double


using namespace std;
const int N = 500777;
int n, t, x, k;
int a[N];
int suf[N];


signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	//freopen("input.txt", "r", stdin);
    cin >> n;
    for (int i = 0; i <= n; i++){
        cin >> a[i];
    }
    for (int i = n; i >= 0; i--){
        suf[i] = suf[i + 1] + a[i];
    }
    int cur = 1;
    int sum = 0;
    if (a[0] > 1){
        cout << -1 << endl;
        return 0;
    }
    for (int i = 0; i < n; i++){
        sum += cur;
        //cout << cur << endl;
        if (a[i] >= cur){
            cout << -1 << endl;
            return 0;
        }
        cur -= a[i];
        if (cur > suf[i + 1]){
            cout << -1 << endl;
            return 0;
        }
        cur = min(suf[i + 1], cur *= 2);
    }
    sum += cur;
    if (cur < a[n]){
        cout << -1 << endl;
        return 0;
    }
    cout << sum << endl;
}


Measured memory_bytes: 5220
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N,M;
  cin >> N >> M;
  vector<int> cnt(N,0);
  for(int i=0;i<M;i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    cnt.at(a)++;
    cnt.at(b)++;
  }

  for(int i=0;i<N;i++){
    if(cnt.at(i)%2!=0){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;

  return 0;
}

Measured memory_bytes: 640
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/

#include <bits/stdc++.h>
using namespace std;

/* see https://github.com/pllk/cphb/
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
    tree_order_statistics_node_update> indexed_set;
 **/

typedef long long ll;
#define endl "\n"
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }

//typedef __int128 lll;
typedef pair<int, int> pii;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
    cini(n);
    cinai(a, n);

    double d=0.0;
    for(int i=0; i<n; i++)
        d+=1.0/a[i];
    d=1.0/d;
    cout<<d<<endl;

}



Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int a, b;
  int i;
  int sum = 0;

  scanf("%d %d", &a, &b);

  for(i=0; i<2; i++){
    if(a >= b){
      sum += a;
      a--;
    }
    else {
      sum += b;
      b--;
    }
  }

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

  return 0;

}

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

int main() {
  string S;
  cin >> S;
  int price = 0;
  
  for (int i = 0; i < 3; i++) {
    if (S.at(i) == 'o')
      price += 100; }
  
  cout << 700 + price << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
struct point
{
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    bool taka=true;
    while (true)
    {
        if (taka)
        {
            c-=b;
            if (c<=0)
            {
                bb;
            }
            taka=!taka;
        }
        else
        {
            a-=d;
            if (a<=0)
            {
                bb;
            }      
            taka=!taka;      
        }
    }
    if (taka)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    
}


Measured memory_bytes: 3668
using System;
using System.Linq;
using static System.Console;
using System.Collections.Generic;
class Program{
    public static void Main(){
		var input = ReadLine().Split(' ').Select(int.Parse).ToArray();
      	if(input[0]*500>=input[1]){
        	Write("Yes");
        }else{
        	Write("No");
        }
    }
}


Measured memory_bytes: 13268
#include <cstdio>

#define ll long long
#define maxn 50

//FILE *fin = fopen("1.in","r");
//FILE *fout = fopen("1.out", "w");

int main()
{
    ll n, a, b;
    scanf("%lld%lld%lld", &n, &a, &b);
    if (b <= a) printf("delicious");
    else if((b - a) <= n) printf("safe");
    else printf("dangerous");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int a,b; cin >> a >> b;
    cout << max(0,a-b*2) << endl;
    return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)turn idx;
#define deg_to_rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad_to_deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)

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

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

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  rep(i, 0, N) {
    cin >> H[i];
  }

  int ans = 0;
  int cnt = 0;

  rep(i, 0, N-1) {
    int h = H[i];
    int next_h = H[i+1];
    if (next_h <= h) {
      cnt += 1;
    } else {
      ans = max(ans, cnt);
      cnt = 0;
    }
  }

  ans = max(ans, cnt);

  cout << ans << endl;
};


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000000000000;
const double PI = acos(-1);

vector<int> to[2000];

int main()
{
    int n, x, y;
    cin >> n >> x >> y;

    rep(i, n - 1) {
        to[i].push_back(i + 1);
        to[i + 1].push_back(i);
    }
    to[x - 1].push_back(y - 1);
    to[y - 1].push_back(x - 1);

    vector<int> ans(n);
    rep(i, n) {
        queue<int> que;
        que.push(i);
        vector<int> dist(n, -1);
        dist[i] = 0;
        while (!que.empty()) {
            int now = que.front();
            que.pop();
            for (auto j : to[now]) {
                if (dist[j] != -1) continue;
                que.push(j);
                dist[j] = dist[now] + 1;
                if (j > i) ans[dist[j]]++;
            }
        }
    }

    rep(i, n - 1) {
        cout << ans[i + 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 3704
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

vector<string>sts{
	"light fly!	    00.00kg@48.00 kg ",
	"fly!	        48.00kg@51.00 kg ",
	"bantam!	    51.00kg@54.00 kg ",
	"feather!	    54.00kg@57.00 kg ",
	"light!	        57.00kg@60.00 kg ",
	"light welter!	60.00kg@64.00 kg ",
	"welter!	    64.00kg@69.00 kg ",
	"light middle!	69.00kg@75.00 kg ",
	"middle!	    75.00kg@81.00 kg ",
	"light heavy!	81.00kg@91.00 kg ",
	"heavy!	        91.00kg@99999 kg ",
};

int main() {
	string st;
	while (cin >> st) {
		ld d=stold(st);
		d-=eps;

		for (int i = 0; i < sts.size(); ++i) {
			int k=sts[i].find('@', sts[i].find('!') + 1);
			string need=sts[i].substr(k+1,5);
			ld amax=stold(need);
			if (d < amax) {
				string name;
				int aa = sts[i].find('!');
				name = sts[i].substr(0, aa);
	
				cout<<name<<endl;
				break;
			}
		}
	}
	return 0;
}



Measured memory_bytes: 3136
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int X = scan.nextInt();
        int T = scan.nextInt();
        int ans = N / X * T;
        if (0 < N % X) {
            ans += T;
        }
        System.out.println(ans);

    }
}


Measured memory_bytes: 35704
import sys
from collections import deque
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    s = inputs[0]
    max_count = 0
    for i in range(1, len(s)):
        front = s[0:i]
        tail = s[i:]
        front_kind = set()
        tail_kind = set()

        for f in front:
            front_kind.add(f)

        for t in tail:
            tail_kind.add(t)

        count = len(front_kind & tail_kind)
        max_count = max([count, max_count])
    return max_count


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 3692
#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>;

int main(){
   int n; cin>>n;
   vector<tuple<string,int,int>> a;
   for(int i=1;i<=n;i++){
      string s; cin>>s;
      int p; cin>>p;
      //大きい順にできるように
      p=-p;
      a.push_back(tie(s,p,i));
   }
   sort(a.begin(),a.end());
   rep(i,n) cout<<get<2>(a[i])<<endl;
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#define ll long long
#define pll pair<ll,ll>
using namespace std;
const int maxn=200010;
const int mod=1000000007;
int n,id[maxn],d[maxn],num;
ll mor[maxn];
vector<pll > f[maxn];
struct edge
{
	int t;
	edge *next;
}*con[maxn];
void ins(int x,int y)
{
	edge *p=new edge;
	p->t=y;
	p->next=con[x];
	con[x]=p;
}
void dp(int v,int fa)
{
	int mx=n+1;
	for(edge *p=con[v];p;p=p->next)
		if(p->t!=fa)
		{
			dp(p->t,v);
			if(d[p->t]>d[mx]) mx=p->t;
		}
	if(mx<=n) id[v]=id[mx],d[v]=d[mx]+1;
	else id[v]=++num;
	f[id[v]].push_back(make_pair(1,1));
	bool flag=0;
	for(edge *p=con[v];p;p=p->next)
		if(p->t!=fa&&p->t!=mx)
		{
			flag=1;
			for(int i=d[v]-d[p->t]-1;i<d[v];i++)
			{
				pll t=f[id[p->t]][i-d[v]+d[p->t]+1];
				mor[i]=(mor[i]*(t.first+t.second)%mod+f[id[v]][i].second*t.second%mod)%mod;
				f[id[v]][i].second=(f[id[v]][i].second*t.first%mod+f[id[v]][i].first*t.second%mod)%mod;
				f[id[v]][i].first=f[id[v]][i].first*t.first%mod;
			}
		}
	if(flag) 
		for(int i=0;i<d[v];i++)
	       	f[id[v]][i].first=(f[id[v]][i].first+mor[i])%mod,mor[i]=0;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		ins(i,x);
		ins(x,i);
	}
	d[n+1]=-1;
	dp(0,-1);
	ll tot=1,sum=0;
	for(int i=0;i<=d[0];i++)
	{
		int sz=(f[id[0]][i].first+f[id[0]][i].second)%mod;
		sum=(sum*sz%mod+f[id[0]][i].second*tot%mod)%mod;
		tot=tot*sz%mod;
	}
	printf("%lld",sum);
 	return 0;
}

Measured memory_bytes: 46192
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <bitset>
typedef long long ll;
#define inc(i) (++ (i))
#define dec(i) (-- (i))
#define Rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
#define rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
using namespace std;
 
const int N = 2000 + 7 , M = 4000000 + 7;
int n , Sum , A[N];
bitset <M> Dp;
 
int main() {
	scanf("%d" , &n);
	Rep(i , 1 , n) scanf("%d" , A + i) , Sum += A[i];
	Dp[0] = 1;
	Rep(i , 1 , n) Dp |= Dp << A[i];
	int Now = (Sum + 1) / 2;
	Rep(i , Now , Sum) if(Dp[i]) return printf("%d" , i) , 0;
	return 0;
}

Measured memory_bytes: 1792
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut s = vec![vec![]; m];
    for i in 0..m {
        let k: usize = read();
        for _ in 0..k {
            // sにはk個の各スイッチの1～Nの番号
            let a = read::<usize>() - 1;
            s[i].push(a);
        }
    }
    let p: Vec<usize> = (0..m).map(|_| read()).collect();

    let mut res = 0;
    for bit in 0..1 << n {
        let mut ok = true;
        for (i, switch) in s.iter().enumerate() {
            let mut con = 0;
            for &j in switch.iter() {
                if bit & 1 << j == 1 << j {
                    con += 1;
                }
            }
            if con % 2 != p[i] {
                ok = false;
                break;
            }
        }
        if ok {
            res += 1;
        }
    }
    println!("{}", res);
}

Measured memory_bytes: 4352
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		while(true) {
			int W = s.nextInt();
			int H = s.nextInt();
			if(W == 0 && H == 0)
				break;
			
			int[][] c = new int[H + 2][W + 2];
			boolean[][] passed = new boolean[H+2][W+2];
			
			Stack<int[]> stack = new Stack<int[]>();
			
			int index = 1;
			for(int i = 1; i < H + 1; i++) {
				for(int j = 1; j < W + 1; j++) {
					c[i][j] = s.nextInt();
					if(c[i][j] == 1)
						stack.add(new int[]{i, j, index++}); // y, x
				}
			}
			
			// vx ,vy
			int[] vx = { 0,  1,  1,  1,  0, -1, -1, -1};
			int[] vy = {-1, -1,  0,  1,  1,  1,  0, -1};
			
			int[] tmp;
			int tmpx, tmpy;
			int result = 0;
			index = 0;
			while(!stack.isEmpty()) {
				tmp = stack.pop();
				
				if(index != tmp[2]) {
					if(passed[tmp[0]][tmp[1]]) {
						continue;
					}
					index = tmp[2];
					result++;
					
				}else {
					
				}

				passed[tmp[0]][tmp[1]] = true;
				
				
				for(int i = 0; i < 8; i++) {
					tmpy = tmp[0] + vy[i];
					tmpx = tmp[1] + vx[i];
					if(passed[tmpy][tmpx])
						continue;
					if(c[tmpy][tmpx] == 1) {
						passed[tmpy][tmpx] = true;
						stack.add(new int[] {tmpy, tmpx, tmp[2]});
					}
				}
			}
			System.out.println(result);
		}
    }
}


Measured memory_bytes: 46352
#!/usr/bin/env python3
n = int(input())
cur_t = 1
cur_a = 1
for i in range(n):
    t, a = map(int, input().split())
    times = max(-(-cur_t // t), -(-cur_a // a))
    cur_t = t * times
    cur_a = a * times
    # print(cur_t, cur_a)
print(cur_t + cur_a)


Measured memory_bytes: 38768
import numpy as np
A_1 = list(map(int, input().split()))
A_2 = list(map(int, input().split()))
A_3 = list(map(int, input().split()))

bingo = np.array([A_1, A_2, A_3])
N = int(input())
for i in range(N):
    bingo[bingo == int(input())] = 0

def check():
    for i in range(3):
        if bingo[i][0] == 0 and bingo[i][1] == 0 and bingo[i][2] == 0:
            return True
        if bingo[0][i] == 0 and bingo[1][i] == 0 and bingo[2][i] == 0:
            return True
    if bingo[0][0] == 0 and bingo[1][1] == 0 and bingo[2][2] == 0:
        return True
    if bingo[0][2] == 0 and bingo[1][1] == 0 and bingo[2][0] == 0:
        return True

if check():
    print('Yes')
else:
    print('No')

Measured memory_bytes: 12492
def switch_combination_of_light_on():
    # 入力
    N, M = map(int, input().split())
    K = list()
    S = list()
    for _ in range(M):
        dummy = list(map(int, input().split()))
        K = dummy.pop(0)
        S.append(dummy)
    P = list(map(int, input().split()))
    # 組み合わせ処理
    result = 0
    for bit in range(1 << N):
        right_on = False
        for i in range(M):
            count = 0
            for j in S[i]:
                if bit & (1 << j - 1):
                    count += 1
            if count % 2 == P[i]:
                right_on = True
            else:
                right_on = False
                break
        if right_on:
            result += 1
    # 出力
    print(result)

switch_combination_of_light_on()

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

void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}





int main(void){
   int N,A,B;
   scanf("%d %d %d",&N,&A,&B);
   if(N*A<=B){
      printf("%d",N*A);
   }else{
      printf("%d",B);
   }
   
   return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
    int a, b;
    int count[200];
    int count_n = 0;
    while (scanf("%d %d", &a, &b) != EOF)
    {
        double t = a + b;
        count[count_n] = 1;
        while (t >= 10)
        {
            t *= 0.1;
            count[count_n]++;
        }
        count_n++;
    }
    int n;
    for (n = 0; n < count_n; n++)
    {
        printf("%d\n", count[n]);
    }
    return 0;
}


Measured memory_bytes: 2072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(int argc, char const *argv[])
{
	int n;
	ll ans = 0;
	scanf("%d",&n);
	for(register int i = 1;i <= n;i++)
		if(i % 3 != 0 && i % 5 != 0)
			ans += i;
	printf("%lld\n",ans);
	return 0;
}

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

typedef long long ll;
typedef long double ld; 
typedef double db; 
typedef string str; 

typedef pair<int, int> pi;
typedef pair<ll,ll> pl; 
typedef pair<ld,ld> pd; 

typedef vector<int> vi; 
typedef vector<ll> vl;
typedef vector<ld> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound 
#define ub upper_bound 

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 1000001;

ll A, B;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    cin >> A >> B;
    cout << A * B / __gcd(A, B);
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


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

#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define ALL( a )        (a).begin(), (a).end()             

int main() {
	int n, p;

	while( 1 ) {
		cin >> n >> p;
		if( n == 0 && p == 0 ) break;

		vector<int> stone( n );
		int j = 0, ok = p;
		while( 1 ){
			bool flag = false;
			for( int i = 0; i < p; i++ ) { stone[j % n]++; j++; }
			p = 0;
			while( 1 ) {
				if( stone[j % n] > 0 ) {
					if( stone[j % n] == ok ) { cout << j % n << endl; flag = true; }
					p = stone[j % n];
					stone[j % n] = 0;
					j++;
					break;
				}
				j++;
			}
			if( flag ) break;
		}	
	}

}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

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



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

    set<int> memo;
    REP(i, K) {
        int tmp, tmp2;
        cin >> tmp;
        REP(j, tmp) {
            cin >> tmp2;
            memo.insert(tmp2);
        }
    }

    cout << N - memo.size() << endl;
    return 0;
}



Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
 
void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;
 
  cout << endl;
}
 
int main(){
  int n;
  cin >> n;
  call(n);
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        string s;
        cin >> s;
        int n = s.length();
        int z = 0, o = 0;
        for(int i = 0; i < n; i++){
            if(s[i] == '0'){
                z++;
            }else{
                o++;
            }
        }
        cout << 2 * min(o, z) << '\n';
    }
}

Measured memory_bytes: 31872
H, W = map(int, input().split())
A = [input() for i in range(H)]
P = [0]*H; Q = [0]*W
for i in range(H):
    P[i] = all(A[i][j] == '.' for j in range(W))
for i in range(W):
    Q[i] = all(A[j][i] == '.' for j in range(H))
for i in range(H):
    if P[i]:
        continue
    r = []
    for j in range(W):
        if Q[j]:
            continue
        r.append(A[i][j])
    print(*r, sep='')

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

using namespace std;

using ll= long long;

#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _set(x) __builtin_popcount(x)
#define PI  3.14159265358979323846264338327950L
#define mod 1000000007

ll bp(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1){
            res = res*a%mod;
        }
        a = a*a%mod;
        b>>=1;
    }
    return res;
}
void solve(){
    int n;
    cin>>n;
    map<pair<ll,ll>,ll> m;
    ll a,b;
    ll z= 0,a01=0,a10= 0;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        if(a==0 && b==0){
            z++;
        }else if(a==0){
            a01++;
        }else if(b==0){
            a10++;
        }else{
            ll g= __gcd(abs(a),abs(b));
            a/= g,b/=g;
            if(b<0){
                a*=-1,b*=-1;
            }
            m[{a,b}]++;
        }
    }
    ll ans= (bp(2,a01)+bp(2,a10)-1+mod)%mod;
    map<pair<ll,ll> ,bool> vis;
    for(auto &k: m){
        if(vis[k.first])
            continue;
        a= k.first.first;
        b= k.first.second;
        vis[{a,b}]=1;
        swap(a,b);
        a *=-1;
        if(b<0){
            a*= -1,b*=-1;
        }
        a01= k.second;
        a10 = m[{a,b}];
        ans *= (bp(2,a01)+bp(2,a10)-1+mod)%mod;
        ans %= mod;
        vis[{a,b}]=1;
    }
    cout<< (ans+z-1+mod)%mod<<"\n";
}
int32_t main(){
	IOS
	// freopen("input.txt","r",stdin);
	int _;
	// cin>>_;
	_=1;
	while(_--){
        solve();
    }
	return 0;
}

/*
   check for overflows int long long
   correct size of array
*/

Measured memory_bytes: 53608
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n;
	int cnt;
	int ans = 0;
	int j;
	scanf("%d",&n);

	for (int i = 1; i <= n; ++i)
	{
		j = i;
		cnt = 0;
		while(j != 0){
			j /= 10;
			++cnt;
		}
		if(cnt % 2)	++ans;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INT long long
using namespace std;
INT a, b;
int main()
{
   // ios::sync_with_stdio(flase);
    cin>>a>>b;
    if( a%b == 0 ) return cout<<-1<<endl, 0;
    for(INT i = a ; ; i+=a )
    {
        if( i%b != 0 ) return cout<<i<<endl, 0;
    }
}


Measured memory_bytes: 256
A,B=map(int,input().split())
if (2*A-1)>=(2*B-1) and (2*A-1)>=(A+B):
    print(2*A-1)
elif (2*B-1)>=(2*A-1) and (2*B-1)>=(A+B):
    print(2*B-1)
elif (A+B)>=(2*A-1) and (A+B)>=(2*B-1):
    print(A+B)

Measured memory_bytes: 9104
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> res;
	res.push_back(2);
	res.push_back(5);
	int sum = 7;
	int k = 6;
	while (res.size() < N) {
		if (k % 2 == 0 || k % 3 == 0 || k % 5 == 0) {
			res.push_back(k);
			sum += k;
		}
		k++;
	}
	if (res.back() % 2 == 1) {
		res.back()++;
		sum++;
	}
	if (sum % 2 == 1) {
		res[0] = 3;
		sum++;
	}
	//if (N > 3) {
		while (sum % 30 != 0) {
			res.back() += 2;
			sum += 2;
		}
	//}
	for (int i = 0; i < res.size(); i++) {
		if (i > 0)cout << " ";
		cout << res[i];
	}
	cout << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<cstdlib>
#include<vector>
#include<algorithm>
#include<functional>


#define ll long long int

using namespace std;

int main() {
  string s;

  cin >> s;

  int result = 0;
  for(int i = 0; i < 4; i++) {
    if(s[i] == '+') {
      result++;
    } else {
      result--;
    }
  }

  cout << result << endl;
}


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

using namespace std;

#define ll					long long
#define vi					vector<int>
#define vii					vector<vi>
#define ALL(s)			(s).begin(),(s).end()
#define ALLn(s)			s,s+n
#define pii					pair<int, int>
#define pll					pair<ll, ll>
#define si					set<int>
#define mp					make_pair
#define F						first
#define S						second
#define pb					push_back
#define tc(t)				int t; cin >> t; while(t--)
#define _						ios_base::sync_with_stdio(false); cin.tie(NULL);

template <typename Iter>
size_t index_of(Iter first, Iter last, int x)
{
    size_t i = 0;
    while (first != last && *first != x) ++first, ++i;
    return i;
}

const ll MOD = 1e9 + 7;
const ll INF = 1<<29;
const ll MAX_N = 1e6 + 7;

ll lun[100001];
queue<ll> q;
int ptr = 9;

void bfs() {
	while(!q.empty()) {
		ll lunlun = q.front();
		q.pop();
		ll last = lunlun%10;
		ll start = lunlun*10 + (last - 1);
		ll end = lunlun*10 + (last + 1);

		if(last == 0) start++;
		if(last == 9) end--;
		if(ptr == 100001) break;
		for(ll i = start; i <= end; ++i) {
			if(ptr == 100001) break;
			lun[ptr++] = i;
			q.push(i);
		}
	}
		
}

void solve() {
	int n;
	cin >> n;
	//for(int i = 0; i < n; ++i)
		cout << lun[n-1] << "\n";
}

int main() {_

	for(int i = 0; i < 9; ++i) {
		lun[i] = i+1;
		q.push(i+1);
	}
	bfs();
	solve();
	

}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define ll long long
#define maxn 200005 /*rem*/
#define mod 998244353
#define db double
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pi pair<int, int>
#define fi first
#define se second

template <typename T> bool chkmax(T &x,T y){return x<y?x=y,true:false;}
template <typename T> bool chkmin(T &x,T y){return x>y?x=y,true:false;}

using namespace std;
ll ksm(ll a, ll b) {
   if (!b) return 1;
   ll ns = ksm(a, b >> 1);
   ns = ns * ns % mod;
   if (b & 1) ns = ns * a % mod;
   return ns;
}
char inp[maxn];
int main() {
	scanf("%s", inp);
	int l = strlen(inp);
	for (int j = 0; j < l; j++)
		if (inp[j] == '?') inp[j] = 'D';
	printf("%s\n", inp);
	return 0;
}


Measured memory_bytes: 3956
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>

#pragma warning( disable: 4996 )

using namespace std;

typedef long long ll;

#define INF 100000000
#define EPS 1e-9

#define MAX_W 50
#define MAX_H 50

int w, h;
int maze[MAX_H][MAX_W];

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

vector<int> ans_list;

void solve(int x, int y){

	maze[y][x] = 0;

	for (int i = 0; i < 8; i++){
		int nx = x + dx[i];
		int ny = y + dy[i];
		if (nx >= 0 && nx < w && ny >= 0 && ny < h && maze[ny][nx] == 1)
			solve(nx, ny);
	}

}

int main(){

	while (true){
	
		cin >> w >> h;
		if (w == 0 && h == 0)
			break;

		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				cin >> maze[i][j];
			}
		}

		int ans = 0;

		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				if (maze[i][j] == 1){
					solve(j, i);
					ans++;
				}
			}
		}
	
		ans_list.push_back(ans);

	}

	for (int i = 0; i < ans_list.size(); i++){
		cout << ans_list[i] << endl;
	}

	return 0;

}

Measured memory_bytes: 1284
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long ll;
const long double PI=3.141592653589793;
const long double eps = 1e-9;
struct point{
    long double theta,x,y;
    bool operator<(const point& r)const{
        return theta<r.theta-eps;
    }
};

int main(){
    int N;
    cin >> N;
    vector<point> v;
    for(int i=0;i<N;i++){
        int x,y;
        cin >> x >> y;
        if(x==0 && y==0) continue;
        if(x>0 && y>=0){
            long double theta = (x!=0? atan2(y,x):PI/2);
            v.push_back({theta,x,y});
        }else if(x<=0 && y>0){
            long double theta = (y!=0? atan2(-x,y):PI/2);
            v.push_back({PI/2+theta,x,y});
        }else if(x<0 && y<=0){
            long double theta = (x!=0? atan2(-y,-x):PI/2);
            v.push_back({PI+theta,x,y});
        }else{
            long double theta = (y!=0? atan2(x,-y):PI/2);
            v.push_back({3*PI/2+theta,x,y});
        }
    }
    sort(v.begin(),v.end());
    long double ans = 0;
    for(int i=0;i<v.size();i++){
        long double nx = 0,ny = 0,upper_theta = v[i].theta+PI;
        for(int j=0;j<v.size();j++){
            int t = (i+j)%v.size();
            if((i<=t && v[t].theta<=upper_theta-eps) || (t<i && 2*PI+v[t].theta<=upper_theta-eps)){
                nx += v[t].x,ny += v[t].y;
                ans = max(ans,sqrtl(nx*nx+ny*ny));
            }
        }
        ans = max(ans,sqrtl(nx*nx+ny*ny));
    }
    cout << fixed;
    cout << setprecision(12) << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
const int N = 1e5+5;
struct Edge{
    int v;
    int next;
    int id;
};
int head[N]; Edge e[2*N]; int size = 0;
int ban[N]; int Q[N];
int color[N];

void addEdge(int u,int v,int id){
    size++;
    e[size].v = v, e[size].id = id, e[size].next = head[u];
    head[u] = size;
}

int max(int a,int b){ return a>b?a:b; }

int solve(int s){
    int h = 0, t = -1;
    int res = 0;
    ban[s] = -1;
    Q[++t] = s;
    while(h<=t){
        int u = Q[h++];
        //printf("u = %d\n",u);
        int cur = 0;
        for(int i = head[u]; i; i = e[i].next){
            int v = e[i].v;
            if(ban[v]==0){
                cur++;
                if(cur==ban[u]) cur++;
                color[e[i].id] = cur;
                ban[v] = cur;
                res = max(res,cur);
                Q[++t] = v;
            }
        }
    }
    return res;
}

int main(){
    int n;
    scanf("%d",&n);
    for(int i = 0; i < n-1; i++){
        int u,v;
        scanf("%d%d",&u,&v);
        addEdge(u,v,i);
        addEdge(v,u,i);
    }
    printf("%d\n",solve(1));
    for(int i = 0; i < n-1; i++) printf("%d\n",color[i]);
    return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;



int main() {
	string S, T;
	int flag = 0;

	cin >> S;
	cin >> T;

	if (S + "a" == T)++flag;
	if (S + "b" == T)++flag;
	if (S + "c" == T)++flag;
	if (S + "d" == T)++flag;
	if (S + "e" == T)++flag;
	if (S + "f" == T)++flag;
	if (S + "g" == T)++flag;
	if (S + "h" == T)++flag;
	if (S + "i" == T)++flag;
	if (S + "j" == T)++flag;
	if (S + "k" == T)++flag;
	if (S + "l" == T)++flag;
	if (S + "m" == T)++flag;
	if (S + "n" == T)++flag;
	if (S + "o" == T)++flag;
	if (S + "p" == T)++flag;
	if (S + "q" == T)++flag;
	if (S + "r" == T)++flag;
	if (S + "s" == T)++flag;
	if (S + "t" == T)++flag;
	if (S + "u" == T)++flag;
	if (S + "v" == T)++flag;
	if (S + "w" == T)++flag;
	if (S + "x" == T)++flag;
	if (S + "y" == T)++flag;
	if (S + "z" == T)++flag;

	if (flag >= 1)cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/operators.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	template<class T>constexpr T pow(T val, std::uint64_t p)
	{
		auto ret = T(1);
		for (auto i : boost::irange(0, 63))
		{
			if (p & (1ULL << i))
			{
				ret *= val;
			}
			val *= val;
		}
		return ret;
	}
	template<std::uint64_t Mod>class modnum :
		private boost::addable<modnum<Mod>>,
		private boost::subtractable<modnum<Mod>>,
		private boost::multipliable<modnum<Mod>>,
		private boost::dividable<modnum<Mod>>
	{
		std::uint64_t val;
		void clamp()
		{
			val %= Mod;
		}
	public:
		modnum() = default;
		modnum(std::int64_t v) :val()
		{
			if (v < 0)
			{
				v += (std::abs(v) / Mod + 1) * Mod;
			}
			val = v;
			clamp();
		}
		modnum(std::uint64_t v) :val(v)
		{
			clamp();
		}
		modnum(std::int32_t v) :modnum(static_cast<std::int64_t>(v))
		{

		}
		modnum(std::uint32_t v) :modnum(static_cast<std::uint64_t>(v))
		{

		}
		friend std::ostream& operator<<(std::ostream& os, modnum const& num)
		{
			return os << num.val;
		}
		auto& operator+=(modnum const& rhs)
		{
			val += rhs.val;
			clamp();
			return *this;
		}
		auto& operator-=(modnum const& rhs)
		{
			val += Mod - rhs.val;
			clamp();
			return *this;
		}
		auto& operator*=(modnum const& rhs)
		{
			val *= rhs.val;
			clamp();
			return *this;
		}
		auto& operator/=(modnum const& rhs)
		{
			val *= pow(rhs, Mod - 2).val;
			clamp();
			return *this;
		}
		auto const& operator*()const
		{
			return val;
		}
	};
}
using mod_t = lib::modnum<1000000007>;

void Main()
{
	int N, K;
	std::cin >> N >> K;
	std::vector<std::int64_t> sum(N + 2);
	for (auto i : boost::irange(1, N + 2))
	{
		sum[i] = sum[i - 1] + i;
	}
	mod_t result = 1;
	for (auto i : boost::irange(K, N + 1))
	{
		auto min = sum[i];
		auto max = sum.back() - sum[N + 1 - i];
		result += max - min + 1;
	}
	std::cout << result << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 4772