akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

int N;

signed main() {
	cout << setprecision(20) << fixed;
	cin >> N;
	string s1_ans, s2_ans;
	string s1, s2;
	string res;
	char a[] = ".#";
	srand(time(NULL));
	int mode = 0;
	while (1) {
		rep(i, 2) rep(j, 2) {
			if (mode == 0) {
				s1 = s1_ans + a[i];
				s2 = s2_ans + a[j];
			}
			else {
				s1 = a[i] + s1_ans;
				s2 = a[j] + s2_ans;
			}
			cout << s1 << endl;
			cout << s2 << endl;
			cin >> res;
			if (res == "end") return 0;
			if (res == "T") {
				s1_ans = s1;
				s2_ans = s2;
				goto next;
			}
		}
		mode++;
	next:;
	}
}


Measured memory_bytes: 716
#include <cmath>
#include <cstdio>
#include <limits>
#include <tuple>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>
#include <iomanip>
#include <cctype>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  size_t si = s.size();
  bool flag = true;
  if (s.at(0) != 'A')
    flag = false;
  ll cnt = 0;
  for (int j = 2; j < si - 1; ++j) {
    if (s.at(j) == 'C') ++cnt;
  }
  if (cnt != 1) flag = false;

  string ss = s;
  transform(ss.begin(), ss.end(), ss.begin(), ::tolower);
  rep(i, si) {
    if (i == 0) continue;
    if (s.at(i) == 'C') continue;
    if (s.at(i) != ss.at(i))
      flag = false;
  }

  if (flag) cout << "AC" << endl;
  else cout << "WA" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
#define printd(x) printf("%.12f\n", ans);
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;

int main(void) {
    int N;
    scanf("%d",&N);
    if(N % 2 == 0)
        printf("%d",N/2);
        else printf("%d",N/2+1);

    return 0;
}

Measured memory_bytes: 256
a, b, c, d = gets.chomp.split.map(&:to_i)

all_num = b - (a-1)
c_num = b/c - (a-1)/c
d_num = b/d - (a-1)/d
cd_num = b/(c.lcm(d)) - (a-1)/(c.lcm(d))

puts(all_num - c_num - d_num + cd_num)

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  vector<vector<int>>X(3);
  vector<int>a={1,3,5,7,8,10,12};
  vector<int>b={4,6,9,11};
  vector<int>c={2};
  X[0]=a;
  X[1]=b;
  X[2]=c;
  int x,y;
  cin>>x>>y;
  for(int i=0;i<3;i++){
    bool xx=false,yy=false;
    for(auto it:X[i]){
      if(x==it)xx=true;
      if(y==it)yy=true;
    }
    if(xx&&yy){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
///////////////////////////

int main(){fastio
    string s;cin>>s;
    string a,b;
    ll q;cin>>q;
    bool flip=false;
    while(q--){
        ll t;cin>>t;
        if(t==1){
            flip=!flip;
        }else{
            ll f;string ad;cin>>f>>ad;
            bool x=false;if(f==1)x=true;
            if(x^flip){
                a+=ad;
            }else{
                b+=ad;
            }
        }
    }
    reverse(a.begin(),a.end());
    string t=a+s+b;
    if(flip){
        reverse(t.begin(),t.end());
    }
    cout<<t<<endl;
    
    return 0;
}


Measured memory_bytes: 1300
n,m=map(int,input().split())
edge=[[]for _ in range(n)]
for _ in range(m):
  l,r,d=map(int,input().split())
  l-=1
  r-=1
  edge[l].append((r,d))
  edge[r].append((l,-d))
ans=[10**20]*n
inf=10**20
for i in range(n):
  if ans[i]!=inf:continue
  stack=[i]
  visited={i}
  ans[i]=0
  for node in stack:
    for mode,d in edge[node]:
      if ans[node]+d!=ans[mode]!=inf:exit(print("No"))
      if mode in visited:continue
      visited.add(mode)
      stack.append(mode)
      if ans[mode]==inf:
        ans[mode]=ans[node]+d
      else:
        if ans[node]+d!=ans[mode]:exit(print("No"))
print("Yes")

Measured memory_bytes: 90912
#include <stdio.h>

void qq(int n) {
    if(n<81) {
        printf("%dx%d=%d\n",n/9+1,n%9+1,(n/9+1)*(n%9+1));
        qq(n+1);
    }
}

int main(void) {
    qq(0);
    return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int a, b, x;
constexpr double PI = 3.14159265358979;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> a >> b >> x;
	double l = 0.0, r = 90.0;
	for(Int i=0; i<100; ++i){
		double m = (l + r) / 2;
		double t = 0.0;
		if(tan(PI*m/180) > (double)b/a){
			t = a*b*b*tan(PI*(90-m)/180)/2;
		}else{
			t = a*a*b - a*a*a*tan(PI*m/180)/2;
		}
		if(t >= x + 1e-10) l = m;
		else r = m;
//		cout << i << " " << l << " " << m << " " << t << "\n";
	}
	cout << fixed << setprecision(10) << l << "\n";
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    char op;
    while(true){
        cin >> a >> op >> b;
        if (op == '?'){
            break;
        }
        if ( op == '+'){
            cout << (a+b) << endl;
        }
        if ( op == '-'){
            cout << (a-b) << endl;
        }
        if ( op == '*'){
            cout << (a*b) << endl;
        }
        if ( op == '/'){
            cout << (a/b) << endl;
        }
          
          
          
          
          
          
          
    }
}


Measured memory_bytes: 3032
#include<cstdio>
#include<set>
#include<cstdlib>
#include<chrono>
#include<vector>
#include<utility>

using namespace std;

int d, c[100], s[400][100];
int m;
set<int> app[100];

int last(int d, int i) {
  return *(--app[i].upper_bound(d));
}

int next(int d, int i) {
  return *app[i].upper_bound(d);
}

int random(int x, int y) {
  return rand() % (y - x + 1) + x;
}

pair<int, vector<int>> init() {
  int sat = 0;
  vector<int> t(1);
  for (int i = 1; i <= d; i++) {
    int best = -2e9, best_j = 0;
    for (int j = 1; j <= 26; j++) {
       int tmp = 0;
       tmp += s[i][j];
       for (int k = 1; k <= 26; k++) {
         if (j == k) {
           continue;
         }
         tmp -= c[k] * (i - last(i, k));
       }
       if (tmp > best) {
         best = tmp;
         best_j = j;
       }
    }
    t.push_back(best_j);
    sat += s[i][t[i]];
    app[t[i]].insert(i);
    for (int j = 1; j <= 26; j++) {
      sat -= c[j] * (i - last(i, j));
    }
  }
  return {sat, t};
}

pair<int, vector<int>> init2() {
  int sat = 0;
  vector<int> t(1);
  for (int i = 1; i <= d; i++) {
    int best = -2e9, best_j = 0;
    for (int j = 1; j <= 26; j++) {
       int tmp = 0;
       tmp += s[i][j];
       for (int k = 1; k <= 26; k++) {
         if (j == k) {
           continue;
         }
         tmp -= c[k] * (i - last(i, k)) * 2;
       }
       if (tmp > best) {
         best = tmp;
         best_j = j;
       }
    }
    t.push_back(best_j);
    sat += s[i][t[i]];
    app[t[i]].insert(i);
    for (int j = 1; j <= 26; j++) {
      sat -= c[j] * (i - last(i, j));
    }
  }
  return {sat, t};
}

pair<int, vector<int>> climb(auto start, int sat, vector<int> t) {
  auto end = chrono::steady_clock::now();
  while (chrono::duration_cast<chrono::nanoseconds>(end - start).count() < 1.9e9) {
    int best = -2e9, best_i = 0, best_j = 0;
    for (int i = 1; i <= d; i++) {
      for (int j = 1; j <= 26; j++) {
        if (j == t[i]) {
          continue;
        }
        int tmp = 0;
        tmp -= s[i][t[i]];
        tmp -= c[t[i]] * (next(i, t[i]) - i) * (i - last(i - 1, t[i]));

        tmp += s[i][j];
        tmp += c[j] * (next(i, j) - i) * (i - last(i, j));
        if (tmp > best) {
          best = tmp;
          best_i = i;
          best_j = j;
        }
      }
    }
    if (best > 0) {
      app[t[best_i]].erase(best_i);
      app[best_j].insert(best_i);
      t[best_i] = best_j;
      sat += best;
    } else {
      break;
    }
    end = chrono::steady_clock::now();
  }
  return {sat, t};
}

int main() {
  scanf("%d", &d);
  for (int i = 1; i <= 26; i++) {
    scanf("%d", &c[i]);
    app[i].insert(0);
    app[i].insert(d+1);
  }
  for (int i = 1; i <= d; i++) {
    for (int j = 1; j <= 26; j++) {
      scanf("%d", &s[i][j]);
    }
  }
  auto start = chrono::steady_clock::now();
  auto tmp = init();
  auto res = climb(start, tmp.first, tmp.second);
  auto tmp2 = init2();
  auto res2 = climb(start, tmp2.first, tmp2.second);
  auto ans = res;
  if (res2.first > res.first) {
    ans = res2;
  }
  for (int i = 1; i <= d; i++) {
    printf("%d\n", ans.second[i]);
  }
}


Measured memory_bytes: 3524
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

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

template< typename T>
struct edge { 
   int from, to; 
   T cost; 
   edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
};

template< typename T>
using EDGE = vector< edge< T > >;

template< typename T>
vector< T > bellman_ford(EDGE< T > &es, int V, int s) {
   const auto INF = numeric_limits< T >::max();
   vector< T > dist(V, INF);
   dist[s] = 0;
   for (int i = 0; i < V - 1; i++) {
      for (auto &e : es) {
         if (dist[e.from] == INF) continue;
         dist[e.to] = min(dist[e.to], dist[e.from] + e.cost);
      }
   }
   for (auto & e : es) {
      if (dist[e.from] == INF) continue;
      if (dist[e.from] + e.cost < dist[e.to]) return vector< T >();
   }
   return dist;
}

int main() {
   int V, E, r;
   cin >> V >> E >> r;
   EDGE< int > edges;
   int s, t, d;
   for (int i = 0; i < E; i++) {
      cin >> s >> t >> d;
      edges.emplace_back(s, t, d);
   }
   
   auto res = bellman_ford(edges, V, r);
   if (res.empty()) cout << "NEGATIVE CYCLE" << endl;
   else {
      for (auto &aVertex : res) {
         if (aVertex == numeric_limits< int >::max()) cout << "INF" << endl;
         else cout << aVertex << endl;
      }
   }
   return 0;
}



Measured memory_bytes: 3148
c = ['' for _ in range(3)]
c[0] = list(map(int, input().split()))
c[1] = list(map(int, input().split()))
c[2] = list(map(int, input().split()))
ans = 'Yes'
for i in range(2):
    for j in range(2):
        if c[i][j] + c[i + 1][j + 1] != c[i][j + 1] + c[i + 1][j]:
            ans = 'No'
            break
    else:
        continue
    break
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <queue>

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


using namespace std;

int main() {

  int n; cin >> n;
  int m; cin >> m;

  vector<int> a;
  rep(i, m) {
    int x; cin >> x; x--;
    a.push_back(x);
  }

  int ans = 0;

  REP(i, 0, (int)a.size()-1) {
    ans = max(ans, (a[i+1]-a[i]) / 2);
  }

  if(a[0] != 0) {
    ans = max(ans, a[0]);
  }


  if(a[m-1] != n-1) {
    ans = max(ans, n - a[m-1] - 1);
  }

  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 3276
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
  double x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  printf ("%lf", sqrt( pow(x2 - x1, 2) + pow(y2 - y1, 2) ) );
  
  return 0;
}


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

#define debug(x) cout <<"DEBUG"<<" "<<#x<<":"<<x<<'\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

/* 円周率は M_PI を使おうね */
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;

/*FUNCs=================================================*/


/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);

    int n; cin >> n;
    if(n==0) {
        cout << 0 << '\n';
        return 0;
    }
    stack<char> s;
    while(n != 0) {
        if(n < 0) {
            if(n%2==0) {
                s.push('0');
                n = n/(-2);
            }else {
                s.push('1');
                n = n/(-2)+1;
            }
        }
        else {
            if(n%2==0) s.push('0');
            else s.push('1');
            n = -(n/2);
        }
    }
    while(!s.empty()){
        cout << s.top();
        s.pop();
    }
    cout << '\n';
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    long n, min = 0, diff = -1;
    scanf("%ld", &n);
    long input[200000];
    for (int i=0; i < n; i++){
        scanf("%ld", &input[i]);
    }
    //
    min = input[0];
    for(int i = 1; i < n; i++){
        if(input[i] - min > diff){
            diff = input[i] - min;
        }
        if(i == 1){
            diff = input[i] - min;   
        }
        if(input[i] < min){
            min = input[i];
        }
    }
    printf("%ld\n", diff);
    return 0;    
}

Measured memory_bytes: 4264
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
#define MAX_N 50000
#define MAX_M 20

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int dp[MAX_M+1][MAX_N+1];
int n, m, d[MAX_M];

int main(){
  scanf("%d%d", &n, &m);
  rep(i, m) scanf("%d", d+i);

  rep(i, MAX_M+1) rep(j, MAX_N+1) dp[i][j] = INF;
  dp[0][0] = 0;
  rep(i, m){
    rep(j, n+1){
      dp[i+1][j] = min(dp[i][j], dp[i+1][j-d[i]] + 1);
    }
  }

  printf("%d\n", dp[m][n]);
  return 0;
}

Measured memory_bytes: 5292
#include <iomanip>
#include <iostream>
#include <vector>

int main(int argc, char *argv[]) {
  int n, k;
  std::cin >> n >> k;
  double ans = 0;
  for (int i = 1; i <= n; ++i) {
    double a = 1. / n;
    int t = i;
    while (t < k) {
      t *= 2;
      a /= 2;
    }
    ans += a;
  }

  std::cout << std::setprecision(12) << std::fixed << ans << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
   
	int a;
	int b;
	cin >> a;
	cin >> b;
	int d, e, f;
	d = a + b;
	e = a - b;
	f = a * b;
	int u;
	u = max(d, e);
	u = max(u,f);

	cout << u;
}



Measured memory_bytes: 256
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int N;
	cin>>N;
	int ans=0;
	int p=0;
	for (int i = 0; i < N; ++i)
	{
		int h;
		cin>>h;
		if(h>=p)
		{
			ans++;
			p=h;
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int d,n,result=0;
    cin>>n>>d;
    vector<vector<int>> v(n,vector<int> (d));
    REP(i,n){
        REP(j,d){
            cin>>v[i][j];
        }
    }
    int dist;
    REP(i,n-1){
        FOR(j,i+1,n){
            dist=0;
            REP(k,d){
                dist+=(v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
                //cout << dist << endl;
            }
          //  cout << dist << endl;
            if(abs(sqrt(dist)-(double)((int)(sqrt(dist))))<=0.000000001){
                result++;
            }
        }
    }   
    cout<<result<<endl;

    return 0;
}


Measured memory_bytes: 888
#include <iostream>

int n, k;
bool D[10];

bool check( int n ) {
    while (n > 0) {
        if ( D[ n%10 ] ) return false;
        n /= 10;
    }
    return true;
}

void solve() {
    int ans = n;
    bool flag = true;
    while ( flag ) {
        if ( check( ans ) ) {
            std::cout << ans << std::endl;
            flag = false;
        } else {
            ++ans;
        }
    }
}

int main() {
    std::cin >> n >> k;
    for (int i=0; i<k; ++i) {
        int idx;
        std::cin >> idx;
        D[idx] = true;
    }
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
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;}

int main(){
  int s,w;
  cin >> s >> w;
  if (s <= w) cout << "unsafe" << endl;
  else cout << "safe" << endl;
}


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

int main() {
  int n;
  cin >> n;
  vector<long long> v(n+1);
  v[0] = 2;
  v[1] = 1;
  for(int i = 2; i < n+1; i++) {
    v[i] = v[i-1]+v[i-2];
  }
  cout << v[n];
}

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

typedef long long ll;

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n = 0;
    cin >> n;
    float ans = 1.08;

    ll index = -1;
    for(int i = 1; i <= 50000; i++) {
        if(floor(ans * i) == n) {
            index = i;
            break;
        }
    }

    if(index == -1) {
        cout << ":(" << endl;
    }
    else cout << index << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000000000;
int dp[100010];
int main(){
    int n; cin >> n;
    vector<int> h(n);
    for(int i=0;i<n;++i) cin >> h[i];
    for(int i=0;i<100010;++i) dp[i] = MAX;
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);
    for(int i=0;i<n;++i){
        dp[i+2] = min(dp[i+1]+abs(h[i+2]-h[i+1]),dp[i+2]);
        dp[i+2] = min(dp[i]+abs(h[i+2]-h[i]),dp[i+2]);
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
import itertools

n, m = map(int, input().split())
path = [[False] * n for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    path[a-1][b-1] = True
    path[b-1][a-1] = True

#print(path)
ans = 0
x = list(itertools.permutations(range(1,n)))
for i in range(len(x)):
    u = list(x[i])
    w = [0] + u
    ok = 0
    for j in range(n-1):
        if path[w[j]][w[j+1]]:
            ok += 1
        else:
            break

    if ok == n-1:
        #print(w)
        ans += 1

print(ans)

Measured memory_bytes: 40944
import java.util.Scanner;
public class Main {

    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	// 入力
    	int n = sc.nextInt();
    	int m = sc.nextInt();
    	int x = sc.nextInt();
    	int y = sc.nextInt();

    	int xl = -100;
    	int ys = 100;
    	String ans = " War";

    	for (int i = 0; i < n; i++){
        	int xn = sc.nextInt();
        	if (xn > xl){
        		xl = xn;
        	}
    	}

    	for (int j = 0; j < m; j++){
        	int ym = sc.nextInt();
        	if (ym < ys){
        		ys = ym;
        	}

    	}


    	if (x < ys && ys <= y && xl < ys){
    		ans = "No War";

    	}


    	// 出力
    	System.out.println(ans);
    }
}

Measured memory_bytes: 23764
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <stack>
#include <algorithm>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
//typedef pair<int, int> P;
//typedef pair<llong, llong> LP;
//typedef pair<int, P> PP;
//typedef pair<llong, LP> LPP;

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

int P[12];
int Q[12]{ 6,5,4,3,2,7,6,5,4,3,2,1 };

int main() {
	int n;
	REP(i, 12) {
		char c = getchar();
		if (c == '?') {
			P[i] = -1;
			n = i;
		}
		else P[i] = c-'0';
	}
	int x = 0;
	REP(i, 11) {
		if (P[i] < 0)continue;
		x += P[i] * Q[i];
		x %= 11;
	}
	int ans;
	int ansn = 0;
	if (n != 11) {
		REP(i, 10) {
			int y = x;
			y += i*Q[n];
			if ((y % 11 <= 1 ? 0 : (11 - y % 11)) == P[11]) {
				ans = i;
				ansn++;
			}
		}

	}
	else {
		ans = x % 11 <= 1 ? 0 : (11 - x % 11);
		ansn++;
	}
	if (ansn == 1)printf("%d\n", ans);
	else printf("MULTIPLE\n");
	return 0;
}


Measured memory_bytes: 932
#整数値入力 1文字の入力
def input_one_number():
    return int(input())

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

#整数値龍力　複数の入力(配列)
def input_multiple_number_as_list():
    return list(map(int, input().split()))


n,m = input_multiple_number()

#UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    
    #要素xが属するグループの根を返す
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    #要素xが属するグループと要素yが属するグループとを併合する
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    #要素xが属するグループのサイズ（要素数）を返す
    def getGroupSize(self, x):
        return -self.parents[self.find(x)]

    #要素x, yが同じグループに属するかどうかを返す
    def isSame(self, x, y):
        return self.find(x) == self.find(y)

    #要素xが属するグループに属する要素をリストで返す
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    #すべての根の要素をリストで返す
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    #グループの数を返す
    def getNumGroup(self):
        return len(self.roots())
    
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

re = UnionFind(n)

for _ in range(m):
	a,b = input_multiple_number()
	re.union(a-1,b-1)

mmax = 0
for nood in re.roots():
	g = re.getGroupSize(nood)
	if mmax < g:
		mmax = g
print(mmax)

Measured memory_bytes: 18252
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const int MOD = 1e9 + 7;

int main(){
	int A, B, C;
	cin >> A >> B >> C;

	string ans;
	if (A == B) {
		if (B != C) {
			ans = "Yes";
		} else {
			ans = "No";
		}
	} else {
		if (B == C || C == A) {
			ans = "Yes";
		} else {
			ans = "No";
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>

#define rep(i, n) for (int i{0}; i < static_cast<int>(n); ++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define eb emplace_back
#define each(i,c) \
  for( \
      __typeof((c).begin()) i{(c).begin()}, __typeof((c).end()) end{(c).end()}; \
      i != end; \
      ++i \
  )
#define dbg(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

constexpr int inf = (int)1e9;
constexpr double INF = 1e12, EPS = 1e-9;
constexpr int MX = 2010;
constexpr int mod = inf + 7;

int n, m, q;
int L[MX][MX], R[MX][MX];
int memo[MX][MX];

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

  char prevc = '>';
  ll a[s.length() + 1];

  rep(i, s.length() + 1) { a[i] = 0; }

  vi v{};

  rep(i, s.length()) {
    if (s[i] == '<' && prevc == '>') {
      ll j{i};
      ll num{0};
      while (true) {
        a[j] = max(a[j], num++);
        if (j == s.length() || s[j] == '>') break;
        ++j;
      }

      j = i;
      num = 0;

      while (true) {
        a[j] = max(a[j], num++);
        if (j == 0 || s[j - 1] == '<') break;
        --j;
      }
    }

    prevc = s[i];
  }

  if (s[s.length() - 1] == '>') {
    ll j = s.length();
    ll num = 0;

    while (true) {
      a[j] = max(a[j], num++);
      if (j == 0 || s[j - 1] == '<') break;
      --j;
    }
  }

  ll sum{0};
  rep(i, s.length() + 1) {
    sum += a[i];
  }

  cout << sum << endl;
}


Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,H,W,ans=0;
  cin>>N>>H>>W;
  rep(i,0,N){
    int X,Y;
    cin>>X>>Y;
    if(X>=H&&Y>=W)
      ans++;
  }
  cout<<ans;
  }


Measured memory_bytes: 384
#include <iostream>
using namespace std;
typedef long long ll;
ll MOD = 1000000007LL;
int C[200005];
int D[200005];
int P[200005];
ll dp[200005];
int main() {
  ios::sync_with_stdio(false);
  int N, d;
  cin >> N;
  for (int i=1; i<=N; i++) {
    cin >> C[i];
  }
  for (int i=1; i<=N; i++) {
    if (C[i] == C[i-1]) continue;
    if (P[C[i]] > 0) {
      D[P[C[i]]] = i;
    }
    P[C[i]] = i;
  }
  dp[1] = 1;
  for (int i=1; i<N; i++) {
    dp[i+1] += dp[i];
    dp[i+1] %= MOD;
    if (D[i] > 0) {
      dp[D[i]] += dp[i];
      dp[D[i]] %= MOD;
    }
  }
  cout << dp[N] << endl;
}

Measured memory_bytes: 4224
#include <stdio.h>
int main(void){
	int a,b,c,ab,bc,ca;
	scanf("%d%d%d",&a,&b,&c);
	ab=(a-b>0?a-b:b-a);
	bc=(b-c>0?b-c:c-b);
	ca=(c-a>0?c-a:a-c);
	if(ab>bc){
		if(bc>ca){
			printf("%d",bc+ca);
		}else if(ab>ca){
			printf("%d",bc+ca);
		}else{
			printf("%d",ab+bc);
		}
	}else if(ab>ca){
		printf("%d",ab+ca);
	}else if(bc>ca){
		printf("%d",ab+ca);
	}else{
		printf("%d",ab+bc);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
//#define MOD 1000000007
const int INF = 1LL<<30;

vector<int> q[101010];

int main() {
    int n,m;
    cin>>n>>m;
    
    vector<int> a(n),b(n);
    rep(i,n){
        cin>>a[i]>>b[i];
        q[a[i]].push_back(b[i]);
    }

    priority_queue<int> que;
    int ans=0;
    for(int i=1;i<m+1;i++){
        for(auto e : q[i]) que.push(e);
        if(!que.empty()){
            ans+=que.top();
            que.pop();
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 9488
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

const int MAXN = 100050;
int a[MAXN], b[MAXN], c[MAXN];
int n;
ll ans;

ll go(int i) {
    int bx = b[i];
    if (a[0] >= bx || c[n-1] <= bx) return 0;
    int ai = 0;
    int jump = 1 << 20;
    while (jump) {
        if (ai + jump < n && a[ai+jump] < bx) ai += jump;
        jump >>= 1;
    }   
    int ci = n-1;
    jump = 1 << 20;
    while (jump) {
        if (ci - jump >= 0 && c[ci-jump] > bx) ci -= jump;
        jump >>= 1;
    }
    return (ll) (ai+1) * (n-ci);
}

void solve() {
    sc(n);
    sca(a, n);
    sca(b, n);
    sca(c, n);
    sort(a, a+n);
    sort(b, b+n);
    sort(c, c+n);
    ans = 0;
    fo(i, n) {
        ans += go(i);
    }
    cout << ans;
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
     long long n,m,x,i,count=0,sum=0,count1=0,count2=0;
     cin>>n>>m>>x;
     stack<long long> a,b,c;
     long long arra[n],arrb[m];
     for(i=0;i<n;i++)
     cin>>arra[i];
     for(i=0;i<m;i++)
     cin>>arrb[i];
     for(i=n-1;i>=0;i--)
     a.push(arra[i]);
     for(i=m-1;i>=0;i--)
     b.push(arrb[i]);
     while(!a.empty()&&sum+a.top()<=x)
     {
         sum=sum+a.top();
         i=a.top();
         a.pop();
         c.push(i);
         count1++;
     }
     count=count1;
     while(count1>=0&&!b.empty())
     {
         sum=sum+b.top();
         b.pop();
         count2++;
         while(sum>x&&!c.empty())
         {
             count1--;
             sum=sum-c.top();
             c.pop();
         }
         if(sum<=x&&count1+count2>count)
         count=count1+count2;
     }
     cout<<count;
}


Measured memory_bytes: 10036
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0155

"""
import sys
from sys import stdin
from math import sqrt
input = stdin.readline


def dijkstra(s, G):
    BLACK, GRAY, WHITE = 0, 1, 2
    d = [float('inf')] * 101
    color = [WHITE] * 101
    p = [-1] * 101

    d[s] = 0
    while True:
        mincost = float('inf')
        # ??\??????????????§??????????????¨?????????????????????u???????????????
        for i in range(101):
            if color[i] != BLACK and d[i] < mincost:  # S????±???????????????????S??¨??\?¶?????????????????????????????????????????°???????????????????
                mincost = d[i]
                u = i  # u??????????????????ID
        if mincost == float('inf'):
            break
        color[u] = BLACK  # ?????????u???S????±???????????????´???
        for v in range(101):
            if color[v] != BLACK and G[u][v] != float('inf'):
                # v????????????????????????????????°??????S???????????£???u????????????????????????????????????????????°??????????????±??§??´??°??????
                if d[u] + G[u][v] < d[v]:
                    d[v] = d[u] + G[u][v]
                    p[v] = u
                    color[v] = GRAY
    return d, p


def main(args):
    while True:
        n = int(input())
        if n == 0:
            break

        G = [[float('inf')] * (100+1) for _ in range(100+1)]
        data = []
        for _ in range(n):
            b, x, y = map(int, input().split())
            data.append([b, x, y])

        for i in range(n):
            b1, x1, y1 = data[i]
            for j in range(n):
                b2, x2, y2 = data[j]
                if b1 == b2:
                    continue
                dist = sqrt((x1 - x2)**2 + (y1 - y2)**2)
                if dist <= 50.0:
                    G[b1][b2] = dist
                    G[b2][b1] = dist

        m = int(input())
        for _ in range(m):
            s, g = map(int, input().split())
            if s == g:
                print(s)
                continue
            if (not 1<= s <= 100) or (not 1<= g <= 100):
                print('NA')
                continue
            d, p = dijkstra(s, G)
            if d[g] == float('inf'):
                print('NA')
            else:
                path = [g]
                while p[g] != s:
                    path.append(p[g])
                    g = p[g]
                path.append(s)
                rev = path[::-1]
                print(' '.join(map(str, rev)))


def main2(args):
    while True:
        n = int(input())
        if n == 0:
            break

        for _ in range(n):
            b, x, y = map(int, input().split())

        m = int(input())
        for _ in range(m):
            s, g = map(int, input().split())
            print('NA')


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 7984
s = list(map(int, input().split()))
n = s[0]
a = s[1]
flag=0
ans=0
for i in range(1009):
    za=int(i*0.08)
    zb=int(i*0.1)
    if za==n and zb==a:
        flag=1
        ans=i
        break
if flag:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 3064
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long lon
long long n,a[N],q,b,c;
map<long long,long long> mp;
long long ans;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i],mp[a[i]]++,ans+=a[i];
	cin>>q;
	for(int i=1;i<=q;i++)
	{
		cin>>b>>c;
		ans+=(c-b)*mp[b];
		mp[c]+=mp[b];
		mp[b]=0;
		cout<<ans<<'\n';
	}
	return 0;
}

Measured memory_bytes: 9828
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

///////////////////////////





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

	ll S[100];

	rep(i, s.size()) S[i] = s[i] - '0';

	ll ans = 1000;

	rep(i, s.size() - 2) {
		ll x = 100 * S[i] + 10 * S[i + 1] + S[i + 2];
		ans = min(ans, abs(x - 753));
	}

	cout << ans;


	system("PAUSE");
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 998244353ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));
ll dp[3010][3010];
int main()
{
    cout << fixed << setprecision(30);
    ll N, S;
    cin >> N >> S;
    vector<ll> A(N);
    loop(i, N) cin >> A[i];
    dp[0][0] = 1;
    loop(i, N)
    {
        loop(j, S + 1)
        {
            dp[i + 1][j] += 2 * dp[i][j];
            if (j >= A[i])
                dp[i + 1][j] += dp[i][j - A[i]];
            dp[i + 1][j] %= mod;
        }
    }
    putout(dp[N][S]);
    return 0;
}

Measured memory_bytes: 74116
#include<stdio.h>

 int main(void)
 {
	 int n=1,x,i,j,k,a=0;
	 
	 while((n!=0)||(x!=0))
	 {
		 scanf("%d %d",&n,&x);
		 if((n!=0)||(x!=0))
		 {
			 a=0;
			 for(i=1;i<n-1;i++)
			 {
				 for(j=i+1;j<n;j++)
				 {
					 for(k=j+1;k<n+1;k++)
					 {
						 if(i+j+k==x)
						 {
							 a++;
						 }
					 }
				 }
			 }
			 printf("%d\n",a);
		 }
	 }
 return 0;

 }


Measured memory_bytes: 2044
import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        char[] s=fsc.next().toCharArray();
        fsc.close();
        long ans=0;
        for(int i=0;i<(1<<(s.length-1));i++){
            String now=""+s[0];
            long sum=0;
            for(int bit=0;bit<s.length-1;bit++){
                if((i&(1<<bit))!=0){
                    sum+=Long.valueOf(now);
                    now=""+s[bit+1];
                } else{
                    now+=s[bit+1];
                }
            }
            sum+=Long.valueOf(now);
            ans+=sum;
        }
        System.out.println(ans);
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;



int main()
{
  string sa, sb, sc ;
  cin >> sa >> sb >> sc ;
  int na = sa.size() ;
  int nb = sb.size() ;
  int nc = sc.size() ;
  
  int counta = 0 ;
  int countb = 0 ;
  int countc = 0 ;
  
  char s ='a' ;
  int i = 0 ;
  int j = 0 ;
  int l = 0 ;  
  
  while(true){
    if(s=='a'){
      if(counta==na){
        cout <<"A"<<endl ;
        return 0 ;
      }
      s = sa.at(i) ;
      i++ ;
      counta++ ;
    }
    else if(s=='b'){
            if(countb==nb){
        cout <<"B"<<endl;
        return 0 ;
      }
      s = sb.at(j) ;
      j++ ;
      countb++ ;

    }
    else{
      if(countc==nc){
        cout <<"C"<<endl ;
        return 0 ;
      }
      s = sc.at(l) ;
      l++ ;
      countc++ ;
      
    }
  }
      


  return 0 ;
}



Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (N, K) = listOfInt()
    val k2 = K * 2
    val k4 = K * 4
    val B = Array(k2 + 1) { IntArray(k2 + 1) }
    repeat(N) {
        val xyc = listOfString()
        val c = xyc[0].toInt() % k2
        val r = xyc[1].toInt() % k2
        if (xyc[2] == "B") B[r][c] += 1 else B[r][(c + K) % k2] += 1
    }
    val S = Array(k4 + 1) { IntArray(k4 + 1) }
    for (r in 0 until k4) for (c in 0 until k4) S[r][c + 1] = S[r][c] + B[r % k2][c % k2]
    for (r in 0 until k4) for (c in 0 .. k4) S[r + 1][c] += S[r][c]
    var ans = 0
    fun num(r: Int, c: Int) = S[r + K][c + K] - S[r][c + K] - S[r + K][c] + S[r][c]
    for (r in 0 .. k2) for (c in 0 .. k2) {
        val b = num(r, c) + num(r + K, c + K)
        ans = Math.max(ans, b)
    }
    println(ans)
}

fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun nextInt(offset: Int = 0) = nextInt() + offset
fun nextLong() = java.lang.Long.parseLong(next())
fun nextLong(offset: Long = 0L) = nextLong() + offset
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }



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

tuple<ll, ll, ll> egcd(ll a, ll b){
    if(a==0)
        return make_tuple(b, 0, 1);
    ll g, y, x;
    tie(g, y, x) = egcd(b%a, a);
    return make_tuple(g, x-(b/a)*y, y);
}

ll modinv(ll a, ll m){
    ll g, x, y;
    tie(g, x, y) = egcd(a, m);
    if(g != 1)
        assert(false);
    else
        return x % m;
}

ll factorial(ll n, ll m){
    ll ans = 1;
    for(ll i = 2; i <= n; i++){
        ans = (ans * i) % m;
    }
    return ans;
}

ll combination(ll n, ll r, ll m){
    return ((factorial(n, m) * modinv(factorial(r, m), m)) % m) * modinv(factorial(n-r, m), m) % m;
}

ll mpow(ll x, ll n, ll m){
    ll ans = 1;
    for(; n > 0; n >>=1, x = x * x % m){
        if(n%2 == 1){
            ans = ans * x % m;
        }
    }
    return ans;
}

ll inv(ll a, ll m){
    return mpow(a, m-2, m);
}

int main(void){
    const ll MOD = 1000000007;
    ll n, a[2];
    cin >> n >> a[0] >> a[1];
    ll sub = 0;
    for(int i = 0; i < 2; i++){
        ll x=1;
        for(ll j = n; j >= n-a[i]+1; j--)
            x = x * j % MOD;
        ll y = 1;
        for(ll j = a[i]; j >= 1; j--) y = y * j % MOD;
        ll add = x * inv(y, MOD) % MOD;
        sub = (sub + add) % MOD;
    }
    cout << (((mpow(2, n, MOD) - 1) + MOD) - sub) % MOD << endl;
}

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

int main() {
    int h, m, s;
    int S;

    cin >> S;

    h = S / 3600;
    S %= 3600;

    m = S / 60;
    S %= 60;

    s = S;

    cout << h << ":" << m << ":" << s << endl;
    return 0;
}


Measured memory_bytes: 3120
N=int(input())
if N==0:
    print("Yes")
    exit()

P=[]
M=[]
for i in range(N):
    s=input()
    f=0
    m=0
    cnt=0
    for j in range(len(s)):
        if s[j]=="(":
            cnt+=1
        else:
            cnt-=1
            if cnt<m:
                m=cnt
    if cnt>=0:
        P.append([m,cnt])
    else:
        M.append([m-cnt,-cnt])
P.sort(reverse=True)
M.sort(reverse=True)
#print(P)
#print(M)
SUM=0
for i,j in P:
    SUM+=j
for i,j in M:
    SUM-=j
if SUM!=0:
    print("No")
    exit()

SUMP=0
for i,j in P:
    if SUMP>=(-i):
        SUMP+=j
    else:
        print("No")
        exit()
        
SUMM=0
for i,j in M:
    if SUMM>=(-i):
        SUMM+=j
    else:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 228724