akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DTriangles solver = new DTriangles();
        solver.solve(1, in, out);
        out.close();
    }

    static class DTriangles {
        static void CountTriangles(int[] A) {
            int n = A.length;

            Arrays.sort(A);

            int count = 0;

            for (int i = n - 1; i >= 1; i--) {
                int l = 0, r = i - 1;
                while (l < r) {
                    if (A[l] + A[r] > A[i]) {

                        count += r - l;

                        r--;
                    } else // if not possible check for
                    {
                        l++;
                    }
                }
            }
            System.out.println(count);
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                int temp = in.nextInt();
                a[i] = temp;
//            t.insertElement(temp);
            }
            CountTriangles(a);
//        Collections.sort(
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
// clang-format off

using LL = long long;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
 
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
// clang-format on
const string YES = "Yes";
const string NO = "No";

void solve(long long N) {
  // solver code

  if (N % 10 == 7 || (N / 10) % 10 == 7 || (N / 100) % 10 == 7) {
    cout << YES << endl;
  } else {
    cout << NO << endl;
  }
}

int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
vector <int> a[100010];
ll cnt1, cnt2, xx;
bool vis[100010][2];
void dfs(int x, bool l){
  if(vis[x][l])
    return;
  if(l){
    if(vis[x][0])
      xx=1;
    ++cnt1;
  }
  else{
    if(vis[x][1])
      xx=1;
    ++cnt2;
  }
  vis[x][l]=1;
  for(int i=0; i<a[x].size(); ++i){
    dfs(a[x][i], !l);
  }
}

int main(){
  ll n, m;
  while(cin>>n>>m){
    xx=cnt1=cnt2=0;
    memset(vis, 0, sizeof vis);
    for(int i=1; i<=n; ++i)
      a[i].clear();
    int x, y;
    for(int i=0; i<m; ++i){
      scanf("%d%d",&x,&y);
      a[x].push_back(y);
      a[y].push_back(x);
    }
    dfs(1,0);
    ll ans;
    if(xx){
      ans=n*(n-1)/2-m;
    }
    else{
      ans=cnt1*cnt2-m;
    }
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 7936
#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 R;
    cin >> R;
    double leng;

    leng = 2 * 3.14 * R;

    cout << leng << endl;
    return 0;
}

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

int main() {
    int n, d;
    cin >> n >> d;

    int result = 0;
    float distance;
    int x[10][10];

    for (int i = 0; i < n; i++) {
        for (int ii = 0; ii < d; ii++) {
            cin >> x[i][ii];
        }
    }

    for (int i = 0; i < n; i++) {
        for (int ii = (i + 1); ii < n; ii++) {
            distance = 0.0;

            for (int iii = 0; iii < d; iii++) {
                distance += pow(abs(x[i][iii] - x[ii][iii]), 2);
            }

            distance = sqrt(distance);

            if (floor(distance) == distance) {
                result++;
            }
        }
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
//B - ss 2017/07/01
#include <bits/stdc++.h>
using namespace std;

bool is_evenstring(string s){
    int len=s.length();
    if(len%2!=0) return false;
    string s1,s2;
    s1=s.substr(0,(len-1)/2+1);
    s2=s.substr(len/2,len-1);
    if(s1==s2) return true;
    return false;
}

int main(){
    string s; cin >> s;
    int len=s.length();
    for(int i=len;i>=0;--i){
        string s1=s.substr(0,i-1);
        if(is_evenstring(s1)){cout << s1.length() << endl;return 0;}
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin>>a;
  char b[a];
  char c[a];
  for(int i=0;i<a;i++){
    cin>>b[i];
  }
    for(int i=0;i<a;i++){
    cin>>c[i];
  }
    for(int i=0;i<a;i++){
   cout<<b[i]<<c[i];
  }
}

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

#define fill(a,val) memset(a, (val), sizeof a)
#define pb push_back
#define lli long long int
#define scantype long long int
#define endl "\n"
#define unique(x) x.erase(unique(x.begin(),x.end()), x.end())

lli MOD  = 1000000007;
lli inf = 1e15;

void scan(scantype &x);
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli string_to_number(string s){lli x=0; stringstream convert(s); convert>>x; return x;}
lli add(lli a,lli b){lli x = (a+b)%MOD; return x; }
lli mul(lli a,lli b){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b){lli x = (a-b+MOD)%MOD; return x; }
lli divi(lli a,lli b){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}

#define N 100003

int main(void)
{
  int n;
  cin>>n;

  pair<lli,int> a[n];

  for(int i=0;i<n;i++)
  {
  	scan(a[i].first);
  	a[i].second = i;
  }

  sort(a,a+n);
  
 // for(int i=0;i<n;i++)
  //	cerr<<a[i].first<<" ";
 // cerr<<endl;

  pair<int,lli> dp[n];

  for(int i=0;i<n;i++)
  {
  	lli last = a[i].first;

  	if(i>0)
  		last += dp[i-1].first;
  	//cerr<<"oh "<<i<<" "<<last<<endl;
  	int till=i;
  	for(till=i+1;till<n;till++)
  	{
  		if(a[till].first<=(last<<1))
  			last += a[till].first;
  		else break;
  	}
  	for(int j=i;j<till;j++)
  	{
  		dp[j].first = last;
  		dp[j].second = till-1;
  	}
  	//cerr<<i<<" "<<till-1<<" "<<last<<endl;
  	i = till-1;
  }
  int res = 0;
  //cerr<<endl<<endl;
  for(int i=0;i<n;i++){
  	//cerr<<dp[i].first<<" "<<dp[i].second<<endl;
  	if(dp[i].second==n-1)
  		res++;
  }
  cout<<res;
  return 0;
}


void scan(scantype &x)
{
    register int c = getchar(); //for negative/positive
    x = 0;
    int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = getchar());
    if(c=='-') {neg=1;c=getchar();}
    for(;c>47 && c<58;c = getchar()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}



Measured memory_bytes: 3328
#include <bits/stdc++.h>
#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 main(){
	string str;
	cin >> str;
	bool even[26];
	fill(even, even+26, true);
	REP(i, str.length()){
		int idx = (int)(str[i]-'a');
		even[idx] = !even[idx];
	}
	REP(i, 26){
		if(!even[i]){
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin>>N;
  int K=N/1.08;
  if((int)(K*1.08)==N)
    cout<<K<<endl;
  else if((int)((K+1)*1.08)==N)
    cout<<K+1<<endl;
  else
    cout<<":("<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
using namespace std;

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

// Computing lucas number
// 
// l0 = 2, l1 = 1
// ln = l(i-1) + l(i-2)
ll lucas_num(int N) {
  ll l0 = 2; ll l1 = 1;
  vector<ll> lucas(87);

  if (N == 1) return l1;
  
  lucas.at(0) = l0; lucas.at(1) = l1;
  for (int i = 2; i <= N; i++)
  {
      /* code */
      lucas[i] += lucas[i - 1] + lucas[i - 2]; 
  }
  return lucas.at(N);
}

int main() {
  int N;
  cin >> N; 
  
  ll ans = lucas_num(N);
  for (int i = 86; i >= 0; i++)
  {
      /* code */
  }
  
  printf("%lld\n", ans);
//   cout << ans << endl;
  return 0;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);}
template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}

constexpr double PI = (acos(-1));
constexpr double EPS = (1e-7);

double rad_to_deg(double n){
  return n*180.0/PI;
}
double deg_to_rad(double n){
  return n*PI/180.0;
}

main(){

  cout<<fixed<<setprecision(10);

  double a,b,x;
  cin>>a>>b>>x;

  double volume = a*a*b;
  double half = volume/2.0;

  if(x==half){
    cout<<(45.0)<<endl;
  }
  else if(x==volume){
    cout<<(0.0)<<endl;
  }
  else if(x>half){
    // 半分以上
    double theta = atan2(2*(volume-x),a*a*a);
    double ans = rad_to_deg(theta);
    cout<<(ans)<<endl;
  }
  else if(x<half){
    // 半分以下
    double theta = atan2(a*b*b,2*x);
    double ans = rad_to_deg(theta);
    cout<<(ans)<<endl;
  }

}

















/*

main(){

  cout<<fixed<<setprecision(10);

  double a,b,x;
  cin>>a>>b>>x;

  double s=a*a;
  double t=a*a*b;
  double border_rad=rad_to_deg(atan2(a,b));
  double border_vol=a*b/2*a;

  if(x==t){
    cout<<0<<endl;
  }
  else if(x==border_vol){
    cout<<45.0<<endl;
  }
  else if(x>border_vol){
    // ans > 45
    // 下側の三角柱を計算する
    auto chk = [&](double kakudo){
      double theta=deg_to_rad(kakudo);
      double _a=b/tan(theta);
      double _t=a*_a*b/2.0;
      dump(_t,x);
      return _t>x;
    };
    double high=border_rad,low=0.0;
    while(high-low>(1e-7)){
      double mid=(high+low)/2.0;
      dump("mid",mid);
      if( chk(mid) )low=mid;
      else high=mid;
    }
    dump(high,low);
  }
  else if(x<border_vol){
    // ans < 45
    // 上側の三角柱を計算する
    auto chk = [&](double kakudo){
      double theta=deg_to_rad(kakudo);
      double _b=a*tan(theta);
      double _t=a*a*_b/2.0;
      dump(t,_t,t-_t,x);
      return (t-_t)>x;
    };
    double high=90.0,low=border_rad;
    while(high-low>(1e-9)){
      double mid=(high+low)/2.0;
      cout<<"mid: "<<mid<<endl;
      if( chk(mid) )low=mid;
      else high=mid;
    }
    dump(high,low);
  }

}

*/

Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int, input().split()))
    x = 3**n
    ans = 0
    for i in range(x):
        p = i
        buf = 1
        for j in range(n):
            q = p%3
            if q == 0:
                buf *= a[j] - 1
            elif q == 1:
                buf *= a[j]
            else:
                buf *= a[j] + 1
            p //= 3
        if buf % 2 == 0:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()


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

int main() {
  int n,k;
  cin>>n>>k;
  long long total=0;
  
  total+=k;
  for(int i=0;i<(n-1);i++){
      total*=(k-1);
  }
  cout << total << endl;
  return 0;
}

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

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

  if(A!=B &&B!=C && A!=C) {
    cout << "No";
  }

  else if(A==B && B==C) {
    cout << "No";
  }

  else {
    cout << "Yes";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define send {ios_base::sync_with_stdio(false);}
#define help {cin.tie(NULL); cout.tie(NULL);}
#define f first
#define s second
#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}
typedef long long ll;
typedef long double lld;
typedef unsigned long long ull;
 
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v);
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {
	cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";
}
template<typename A, typename B> istream& operator>>(istream& cin, pair<A, B> &p) {
	cin >> p.first;
	return cin >> p.second;
}
 
mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(61378913);
/* usage - just do rng() */
 
void usaco(string filename) {
  // #pragma message("be careful, freopen may be wrong")
	freopen((filename + ".in").c_str(), "r", stdin);
	freopen((filename + ".out").c_str(), "w", stdout);
}
 
const lld pi = 3.14159265358979323846;
// const ll mod = 1000000007;
// const ll mod = 998244353;
// ll mod;
 


ll n, m, k, q, l, r, x, y, z;
const ll template_array_size = 1e6 + 625;
ll a[template_array_size];
ll b[template_array_size];
ll c[template_array_size];
string s, t;
ll ans = 0;



void solve(int tc = 0) {
	cin >> s;
	
	reverse(s.begin(), s.end());
	
	ll c[2020];
	memset(c, 0, sizeof(c));
	ll r = 0, p = 1;
	++c[0];
	ll ans = 0;
	for (ll i = 0; i < s.length(); i++) {
		r = (r + p * (s[i] - '0')) % 2019;
		p = (p * 10) % 2019;
		ans += c[r]++;
	}
	cout << ans << '\n';
}
 
int main() {
	#ifdef galen_colin_local
		auto begin = std::chrono::high_resolution_clock::now();
	#endif
	
	send help
 
	#ifndef galen_colin_local
		// usaco("cowland");
	#endif
	
	// usaco("cowland");
 
	int tc = 1;
	// cin >> tc;
	for (int t = 0; t < tc; t++) solve(t);
	
	#ifdef galen_colin_local
		auto end = std::chrono::high_resolution_clock::now();
		cout << setprecision(4) << fixed;
		// cout << "Execution time: " << std::chrono::duration_cast<std::chrono::duration<double>>(end - begin).count() << " seconds" << endl;
	#endif
} 

Measured memory_bytes: 3728
// https://atcoder.jp/contests/atc001/tasks/unionfind_a

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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() {
    double n,m,d;
    cin >> n >> m >> d;

    cout << setprecision(15);

    if(d==0){
      cout << (m-1) / n << endl;
    } else {
      cout << (m-1) * (n-d) * 2 / (n*n) << endl;
    }
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, i;
	char s[10001];

	scanf("%d", &n);
	scanf("%s", s);

	for (i = 0; s[i] != '\0'; i++) //配列s[iに入ってる文字の、次の文字を代入する
	{
		s[i] = 'A' + (s[i] - 'A' + n) % 26;
	}

	printf("%s", s);

	return 0;
}

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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);

int n, q;
std::vector<int> g[200005];
bool used[200005];
ll ans[200005];
int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    std::cin >> n >> q;
    std::fill(used, used + n, false);

    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        std::cin >> a >> b;

        --a, --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    for (int i = 0; i < q; ++i) {
        int p, x;
        std::cin >> p >> x;

        --p;
        ans[p] += x;
    }

    std::queue<int> que;
    que.push(0);
    used[0] = true;
    while (!que.empty()) {
        auto p = que.front();
        que.pop();

        int m = (int)g[p].size();
        for (int i = 0; i < m; ++i) {
            auto ne = g[p][i];
            if (!used[ne]) {
                ans[ne] += ans[p];
                que.push(ne);
                used[ne] = true;
            }
        }
    }

    for (int i = 0; i < n; ++i)
        std::cout << ans[i] << " ";
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 16500
#include<stdio.h>
int main (void)
{
	int i=0,j, array[10000];
	do{
		scanf("%d",&array[i]);
		i++;
	}
	while(array[i-1]!=0) ;
	for(j=1;j<i;j++){
		printf("Case %d: %d\n",j,array[j-1]);
	}
	return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
using ll = long long;
using namespace std;

int const MOD = 1e9 + 7;

int main(void)
{
    ll H, W, K;
    cin >> H >> W >> K;
    ll dp[110][10] = {};
    int fib[9] = {1, 1, 2, 3, 5, 8, 13, 21, 34};

    dp[0][1] = 1; //横幅は1~Wまで
    for (int i = 0; i <= H; ++i)
    {
        for (int j = 1; j <= W; ++j)
        {
            ll X, Y, Z;
            X = Y = Z = 0;
            if (j >= 2)
                X = fib[j - 2] * fib[W - j];
            Y = fib[j - 1] * fib[W - j];
            if (j <= W - 1)
                Z = fib[j - 1] * fib[W - j - 1];
            dp[i + 1][j - 1] = (dp[i + 1][j - 1] + (X * dp[i][j]) % MOD) % MOD;
            dp[i + 1][j] = (dp[i + 1][j] + (Y * dp[i][j]) % MOD) % MOD;
            dp[i + 1][j + 1] = (dp[i + 1][j + 1] + (Z * dp[i][j]) % MOD) % MOD;
        }
    }

    cout << dp[H][K] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	double x;
	while(cin>>x){
		if(x<=48.0)cout<<"light fly";
		else if(x<=51.0)cout<<"fly";
		else if(x<=54.0)cout<<"bantam";
		else if(x<=57.0)cout<<"feather";
		else if(x<=60.0)cout<<"light";
		else if(x<=64.0)cout<<"light welter";
		else if(x<=69.0)cout<<"welter";
		else if(x<=75.0)cout<<"light middle";
		else if(x<=81.0)cout<<"middle";
		else if(x<=91.0)cout<<"light heavy";
		else 			cout<<"heavy";
		cout<<endl;
	}
}

Measured memory_bytes: 1220
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 c = sc.nextInt();
        int[] b = new int[m];
        for (int j = 0; j < m; j++) {
            b[j] = sc.nextInt();
        }
        int count = 0;

        for (int i = 0; i < n; i++) {
            int add = 0;
            for (int j = 0; j < m; j++) {
                int[] a = new int[m];
                a[j] = sc.nextInt();
                add += a[j] * b[j];
            }
            if (add + c > 0){
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 23764
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct Node{
  int k;
  struct Node *right;
  struct Node *left;
  struct Node *parent;
};

struct Node *root, *NIL;

void Insert(int);
void Inorder(struct Node *);
void Preorder(struct Node *);
struct Node * Find(struct Node *, int);
void Delete(struct Node *);
struct Node * Minimum(struct Node *);
struct Node * Successor(struct Node *);

int main(){
  int i,n,value,findnum;
  char C1[10];

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    scanf("%s",C1);

    if(strcmp(C1,"insert") == 0){
      scanf("%d",&value);
      Insert(value);
    }
    else if(strcmp(C1,"print") == 0){
      Inorder(root);
      printf("\n");
      Preorder(root);
      printf("\n");
    }
    else if(strcmp(C1,"find") == 0){
      scanf("%d",&value);
      struct Node *F = Find(root,value);
      if(F != NIL) printf("yes\n");
      else printf("no\n");
    }
    else if(strcmp(C1,"delete") == 0){
      scanf("%d",&value);
      Delete(Find(root,value));
    }
  }

    return 0;
}

void Insert(int n){
struct  Node *p = root;
struct  Node *q = NIL;
struct  Node *r;

 r = (struct Node *)malloc(sizeof(struct Node));
 r -> k = n;
 r -> left = NIL;
 r -> right = NIL;

 while(p != NIL){
   q = p;
   if(r->k < p->k){
     p = p -> left;
   }
   else{
     p = p -> right;
   }
 }

 r -> parent = q;
  if(q == NIL){
    root = r;
  }
  else{
    if(r->k < q->k){
      q -> left = r;
    }
    else{
      q -> right = r;
    }
  }
}

void Inorder(struct Node *x){
  if(x == NIL) return;
  Inorder(x -> left);
  printf(" %d",x -> k);
  Inorder(x -> right);
}

void Preorder(struct Node *x){
  if(x == NIL) return;
  printf(" %d",x -> k);
  Preorder(x -> left);
  Preorder(x -> right);
}

struct Node * Find(struct Node *x, int n){
  while(x != NIL && n != x -> k){
    if(n < x -> k ) x = x -> left;
    else x = x -> right;
  }
  return x;
}

void Delete(struct Node *x){
  struct Node *y;
  struct Node *z;

  if(x -> left == NIL || x -> right == NIL) y = x;
  else y = Successor(x);

  if(y -> left != NIL) z = y -> left;
  else z = y -> right;

  if(z != NIL) z -> parent = y -> parent;

  if(y -> parent == NIL){
    root = y;
  }
  else {
    if(y == y -> parent -> left) y -> parent -> left = z;
    else y -> parent -> right = z;
  }

  if(y != x) x -> k = y -> k;

  free(y);
}

struct Node * Minimum(struct Node *x){
  while(x -> left != NIL) x = x -> left;
  return x;
}

struct Node * Successor(struct Node *x){
  struct Node *y;

  if(x -> right != NIL) return Minimum(x -> right);

  y = x -> parent;
  while(y != NIL && x == y -> right){
    x = y;
    y = y -> parent;
  }
  return y;
}



Measured memory_bytes: 20492
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define rep(i, n) FOR(i, 0, n)
#define repi(i, n) FOR(i, 1, n + 1)
#define pp(v) cout << #v "=" << (v) << endl;
#define ppa(v) cout << "----\n"; rep(i,v.size()) cout << #v << "[" << i << "] = " << v[i] << endl;
#define div_ceil(a,b) ((a) + ((b) - 1)) / (b)
using namespace std;
using Graph = vector<vector<int>>;

int main() {
  int n,d,x;cin>>n>>d>>x;
  vector<int> a(n);rep(i,n) cin>>a[i];

  int ans = x;
  rep(i,n) rep(j,d) {
    int day = a[i] * j + 1;
    if (day > d) continue;
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python
"""AtCoder Beginner Contest 169: C - Multiplication 3
https://atcoder.jp/contests/abc169/tasks/abc169_c
"""

__author__ = 'bugttle <bugttle@gmail.com>'

from decimal import Decimal

def main():
    inputs = input().split()
    A, B = int(inputs[0]), Decimal(inputs[1])

    print(int(A * B))

if __name__ == '__main__':
    main()


Measured memory_bytes: 10068
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       String  S = sc.next();
       char[] c = S.toCharArray();

       long[][] dp = new long[c.length+15][13];
       
       if(c[c.length-1]=='?') {
    	   for(int i=0;i<10;i++) {
    		   dp[0][i]=1;
    	   }
       } else {
    	   dp[0][Character.getNumericValue(c[c.length-1])]=1;
       }
       
       int amari=1;
       for(int i=1;i<c.length;i++) {
    	   amari=(amari*10)%13;
    	   if(c[c.length-1-i]=='?') {
    		   for(int j=0;j<10;j++) {
    			   for(int k=0;k<13;k++) {
        			   dp[i][(k+j*amari)%13]=(dp[i][(k+j*amari)%13]+dp[i-1][k])%mod;    				   
    			   }
    		   }
    	   } else {
    		   int tmp=Character.getNumericValue(c[c.length-1-i]);
			   for(int k=0;k<13;k++) {
    			   dp[i][(k+tmp*amari)%13]=(dp[i][(k+tmp*amari)%13]+dp[i-1][k])%mod;    				   
			   }
    	   }
       }

       System.out.println(dp[c.length-1][5]);
       
   }
}

Measured memory_bytes: 38984
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}

constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;

signed main()
{
    int N, x; cin >> N >> x;
    vi a(N);

    rep(i, N) cin >> a[i];

    ll ans = 0;

    for (int i = 1; i < N; ++i) {
        if (a[i] + a[i - 1] > x) {
            int v = a[i] + a[i - 1] - x;
            if (a[i] < v) {
                int d = v - a[i];
                a[i] = 0;
                a[i - 1] -= d;
            } else {
                a[i] -= v;
            }
            ans += v;
        }
    }

    cout << ans << endl;
}


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

int main(){
  int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  if(abs(a-c)<=d || (abs(a-b)<=d&&abs(b-c)<=d)) printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 1644
x = input().split()
a, b = [int(x) for x in x]
if a < b:
    print("a" + " " + "<" + " " + "b")
elif a > b:
    print("a" + " " + ">" + " " + "b")
elif a == b:
    print("a" + " " + "==" + " " + "b")


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

int main(){
  int n, h;
  int a[100001] = {};
  int b[100001] = {};
  cin >> n >> h;
  for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
  sort(b, b+n); sort(a, a+n);
  int sum = 0;;
  for(int i = n-1; i >= 0; i--){
    if(h <= 0 || b[i] < a[n-1]) break;
    h -= b[i]; sum++;
  }
  if(h > 0){
    sum += h / a[n-1];
    sum += (h % a[n-1] > 0) ? 1 : 0;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){ 
  int x,a[4],i,tx[8]; 
  char opa='-',opb='-',opc='-'; 
  scanf("%d",&x); 
  for(i=3;i>=0;i--){ 
    a[i]=x%10; x=(x-(x%10))/10; }
  tx[0]=a[0]+a[1]+a[2]+a[3];
  tx[1]=a[0]+a[1]+a[2]-a[3]; 
  tx[2]=a[0]+a[1]-a[2]+a[3]; 
  tx[3]=a[0]+a[1]-a[2]-a[3]; 
  tx[4]=a[0]-a[1]+a[2]+a[3]; 
  tx[5]=a[0]-a[1]+a[2]-a[3]; 
  tx[6]=a[0]-a[1]-a[2]+a[3]; 
  tx[7]=a[0]-a[1]-a[2]-a[3]; 
  for(i=0;i<8;i++){ 
    if(tx[i]==7){ if(i<4)opa='+';
                 if(i%4<2)opb='+';
                 if(i%2==0)opc='+'; 
                 printf("%d%c%d%c%d%c%d=7",a[0],opa,a[1],opb,a[2],opc,a[3]); 
                 return 0; } } return 0; }


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

int64_t sigma_xor(int64_t num){
	int64_t tmp_ans = 0;

	int res4 = num%4;
	if((res4 == 1) || (res4 == 2)){	tmp_ans += 1;	}

	bool flag = false;
	if((num%2)==0){	flag =true;	}

	num /= 2;
	int64_t keta = 1;
	while(true){
		keta *= 2;

		int res2;
		res2 = num %2;
		if(flag && (res2 == 1)){
			tmp_ans += keta;
		}

		num /= 2;
		if(num == 0){
			break;
		}
	}

	return tmp_ans;
}



int main(){
	int64_t a, b;
	cin >> a >> b;

	int64_t sigma_s = sigma_xor(a-1);
	int64_t sigma_e = sigma_xor(b);

	int64_t ans = sigma_s^sigma_e;

	cout << ans << endl;

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  int a,b;
  a = N / 100;
  b = N - (a*100);
  int cnt;
  cnt = 0;
  if(a <= 12&& a>0){
      cnt += 1;
  }
  if(b <= 12 && b>0){
      cnt += 2;
  }
  if(cnt ==3){
      cout <<"AMBIGUOUS";
  }
  if(cnt == 2){
      cout <<"YYMM";
  }
  if(cnt ==1){
      cout << "MMYY";
  }
  if(cnt ==0){
      cout << "NA";
  }
}

Measured memory_bytes: 256
n,m,c =map(int,input().split())
B = [int(i) for i in input().split()]

A = [[int(i) for i in input().split()] for _ in range(n)]
ans = 0

ans_list = []
for i in range(n):
  x = 0
  for j in range(m):
    x += A[i][j]*B[j]
    if j == m-1:
      ans_list.append(x+c)
      
for i in range(len(ans_list)):
  if ans_list[i] >0:
               ans+=1
               
print(ans)     

               

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

#define PI 3.14159265358979323846264338327950288419

using namespace std;

int h, w, n;
int sr, sc;
char str1[200005];
char str2[200005];

bool must_fall(int m, int sp, char dec, char inc){
	// one-dimensional version
	// try < 1
	int cp = sp;
	for(int i = 1; i <= n; i++){
		if(str1[i] == dec){
			cp--;
			if(cp == 0){
				return true;
			}
		}
		if(str2[i] == inc && cp < m){
			cp++;
		}
	}
	// try > m
	cp = sp;
	for(int i = 1; i <= n; i++){
		if(str1[i] == inc){
			cp++;
			if(cp > m){
				return true;
			}
		}
		if(str2[i] == dec && cp > 1){
			cp--;
		}
	}
	return false;
}

int main(){
	scanf("%d %d %d", &h, &w, &n);
	scanf("%d %d", &sr, &sc);
	scanf(" %s", str1 + 1);
	scanf(" %s", str2 + 1);
	if(must_fall(h, sr, 'U', 'D')){
		printf("NO\n");
	}else if(must_fall(w, sc, 'L', 'R')){
		printf("NO\n");
	}else{
		printf("YES\n");
	}
	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>
#include <stack>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

vector<vector<char>> ans(8,vector<char>(8,'.'));
vector<bool> rs(8);
vector<bool> cs(8);
vector<bool> ds(15); // diagnal. r-c+7
vector<bool> rds(15); // reverse. r+c

bool backtrack(ll r) {
  if (r == 8) { return true; } // reached to last

  if (rs[r]) { return backtrack(r+1); } // already fixed. skip.
  rep(c,8) {
    if (cs[c]) { continue; }
    if (ds[r-c+7]) { continue; }
    if (rds[r+c]) { continue; }

    // Here, (r,c) is valid
    rs[r] = true;
    cs[c] = true;
    ds[r-c+7] = true;
    rds[r+c] = true;
    ans[r][c] = 'Q';
    if (backtrack(r+1)) {
      return true;
    }
    // Here, revert state
    rs[r] = false;
    cs[c] = false;
    ds[r-c+7] = false;
    rds[r+c] = false;
    ans[r][c] = '.';
  }
  return false;
}

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll k;
  cin >> k;
  rep(iter,k) {
    ll r,c;
    cin >> r >> c;
    rs[r] = true;
    cs[c] = true;
    ds[r-c+7] = true;
    rds[r+c] = true;
    ans[r][c] = 'Q';
  }
  backtrack(0);

  rep(r,8) {
    rep(c,8) {
      cout << ans[r][c];
    }
    cout << endl;
  }
}



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

#define endl '\n'

void solve()
{
	int n ;
	cin >> n ;
	int abc[n][3] ;
	for (int i = 0 ; i < n ; i++) cin >> abc[i][0] >> abc[i][1] >> abc[i][2] ;
	int dp[n][3] ;
	dp[0][0] = abc[0][0] ; dp[0][1] = abc[0][1] ; dp[0][2] = abc[0][2] ;
	for ( int i = 1 ; i < n ; i++ )
	{
         dp[i][0] = abc[i][0] + max ( dp[i - 1][1] , dp[i - 1][2] ) ;
		 dp[i][1] = abc[i][1] + max ( dp[i - 1][0] , dp[i - 1][2] ) ;
		 dp[i][2] = abc[i][2] + max ( dp[i - 1][0] , dp[i - 1][1] ) ;
	}
	int ans = max( { dp[n - 1][0] , dp[n -1][1] , dp[n - 1][2] } ) ; 
	cout << ans << endl ;
}
int main()
{
    solve() ;
}

Measured memory_bytes: 5828
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}

vector<ll> pw2(51,1);vector<ll> pw10(19,1);
ll high_order_bit(ll n){
    ll tmp=1,i=-1;
    while(tmp<=n){
        tmp*=2;
        i++;
    }
    if(n==0) return 0;
    else return i;
}
vector<ll> binary_expansion(ll n){
    vector<ll> B(high_order_bit(n)+1);
    ll tmp=n;
    for(ll i=high_order_bit(n);i>=0;i--){
        B[i]=tmp/pw2[i];
        tmp%=pw2[i];
    }
    return B;
}
vector<ll> divisor(ll x){
    vector<ll> div;
    for(int i=1;i*i<=x;i++){
        if(i*i!=x && x%i==0){
            div.pb(i);
            div.pb(x/i);
        }
        else if(x%i==0) div.pb(i);
    }
    return div;
}
vector<ll> vectorprime(ll x){
    vector<bool> is_prime(x+1);
    vector<ll> prime;
    rep(i,x+1) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    for(int i=2;i<=x;i++){
        if(is_prime[i]){
            prime.pb(i);
        }
        for(int j=i*2;j<=x;j+=i) is_prime[j]=false;
    }
    return prime;
}

int main(){
    {rep1(i,50) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll A,B,C; cin>>A>>B>>C;
    if(C-A-B > 0){
        cout<<(4*A*B<(C-A-B)*(C-A-B)?"Yes":"No");
    }
    else cout<<"No";
    
}


Measured memory_bytes: 3584
#include<iostream>
#include<map>
#include<vector>
#include<set>
#include<string>
using namespace std;
int main(){
	int n;
	string str;
	set<string> st;
	cin >> str;
	cin >> n;
	for(int i=0;i<str.size();i++){
		string sub="";
		for(int j=i;j<=n+i&&j<str.size();j++){
			sub += str[j];
			st.insert(sub);
		}
	}
	auto it = st.begin();
	n--;
	while(n--)it++;
	cout << *it << endl;
	return 0;
}

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

class Trees{
  vector<long> par;
  vector<long> rank;
  vector<long> cb,cw;
  
  public:
  long root(long i){
    long rt;
    if(par[i]==i){rt=i;rank[i]=1;}
    else{rt=root(par[i]);par[i]=rt;rank[i]=2;}
    return rt;
  }
  void unite(long i,long j){
    long rki=rank[i];long rkj=rank[j];
    if(rki<rkj){par[root(i)]=root(j);rank[i]++;}
    else{par[root(j)]=root(i);rank[j]++;}
  }
  bool same(long i,long j){
    return root(i)==root(j);
  }
  Trees(long n){
    for(long i=0;i<n;i++){par.push_back(i);rank.push_back(1);cb.push_back(0);cw.push_back(0);};
  }
  void count(long i,char c){
    if(c=='#')cb[root(i)]++;
    else if(c=='.')cw[root(i)]++;
  }
  long solve(){
    long ans=0;
    for(long i=0;i<cb.size();i++)ans+=cb[i]*cw[i];
    return ans;
  }
};

int main(){
  long H,W;cin>>H>>W;
  vector<string>S(H);for(long i=0;i<H;i++)cin>>S[i];
  Trees tree(H*W);
  for(long i=0;i<H;i++)for(long j=0;j<W-1;j++)if(S[i][j]!=S[i][j+1])tree.unite(i*W+j,i*W+j+1);
  for(long i=0;i<H-1;i++)for(long j=0;j<W;j++)if(S[i][j]!=S[i+1][j])tree.unite(i*W+j,i*W+j+W);
  for(long i=0;i<H;i++)for(long j=0;j<W;j++)tree.count(i*W+j,S[i][j]);
  cout<<tree.solve();
}

Measured memory_bytes: 5720
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,H,W;
    cin >> N >> H >> W;
    int cnt = 0;
    rep(i,0,N){
        int h,w;
        cin >> h >> w;
        if(h >= H && w >= W)cnt++;
    }
    cout << cnt << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
    }
    
    vector<vector<ll>> dp(n, vector<ll>(2, -1e18));
    dp[0][0] = a[0];
    dp[0][1] = -a[0];
    REP(i, 1, n){
        dp[i][0] = max(dp[i-1][0]+a[i], dp[i-1][1]-a[i]);
        dp[i][1] = max(dp[i-1][0]-a[i], dp[i-1][1]+a[i]);
    }
    cout << dp[n-1][0] << endl;

    return 0;
}

/*
int main() {

    int n;
    cin >> n;
    ll ans = 0;
    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
        ans += abs(a[i]);
    }

    int minus = 0;
    ll m = 1 << 30;
    rep(i, n){
        if(a[i] < 0){
            minus++;
        }
        if(a[i] == 0){
            minus = 0;
            break;
        }
        m = min(m, abs(a[i]));
    }
    if(minus%2 == 0){
        cout << ans << endl;
    }
    else{
        cout << ans - 2*m << endl;
    }
    return 0;
}
*/

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

vector<int>G[1010];
int g[5050],h[5050],f[1010],x,n,a[1010];

void U(int &x,int y){
	x=min(x,y);
}

void dfs(int x){
	for (auto y:G[x]) dfs(y);
	memset(g,33,sizeof g); g[0]=0;
	int b,c;
	for (auto y:G[x]){
		memset(h,33,sizeof h);
		b=f[y], c=a[y];
		for (int i=0;i<=5001;++i)
			U(h[min(i+b,5001)],g[i]+c),
			U(h[min(i+c,5001)],g[i]+b);
		memcpy(g,h,sizeof g);
	}
	for (int i=0;i<=5001;++i){
		if (i<=a[x]) U(f[x],g[i]);
		if (g[i]<=a[x]) U(f[x],i);
	}
	if (f[x]>1e8) exit(0*puts("IMPOSSIBLE"));
}

int main(){
	cin>>n;
	for (int i=2;i<=n;++i) cin>>x, G[x].push_back(i);
	for (int i=1;i<=n;++i) cin>>a[i];
	memset(f,33,sizeof f);
	dfs(1);
	puts("POSSIBLE");
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define hackcyborg shresth_walia
#define ll long long int
#define ld long double
#define pb push_back
#define p1 1232
#define mod 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
long long binpow(long long a, long long b, long long m=mod) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int main()
{
   IO
   ll n;
   cin>>n;
   ll w=sqrt(n);
   ll ans=0;
   for(ll x=2;x<=w;x++)
   {
       if(n%x==0)
       {   ll co=0;
           while(n%x==0)
           {
               n/=x;
               ++co;
           }
           ll i=1;
           while(co>=i)
           {
               co-=i;
               ++i;
               ++ans;
           }
       }
   }
   if(n>1)
   {
       ++ans;
   }
   cout<<ans<<"\n";
}


Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    string S,T;
    cin>>S>>T;
    int ls=S.length();
    int lt=T.length();
    int ans=INF;
    rep(i,ls-lt+1){
        int cnt=0;
        rep(j,lt){
            if(S[j+i]!=T[j])cnt++;
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<iomanip>
using namespace std;
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point{
	public:
		double x, y;

		Point(double x = 0, double y = 0): x(x), y(y) {}

		Point operator + (Point p){ return Point(x + p.x, y + p.y);}
		Point operator - (Point p){ return Point(x - p.x, y - p.y);}
		Point operator * (double a){ return Point(a * x, a * y);}
		Point operator / (double a){ return Point(x / a, y / a);}

		double abs(){ return sqrt(norm());}
		double norm(){ return x * x + y * y;}

		bool operator < (const Point &p) const{
			return x != p.x ? x < p.x : y < p.y;
		}

		bool operator == (const Point &p) const{
			return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
		}
};

typedef Point Vector;

double dot(Vector a, Vector b){
	return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b){
	return a.x * b.y - a.y * b.x;
}
int ccw(Point p0, Point p1, Point p2){
	Vector a = p1 - p0;
	Vector b = p2 - p0;
	if(cross(a, b) > EPS) return COUNTER_CLOCKWISE;
	if(cross(a, b) < -EPS) return CLOCKWISE;
	if(dot(a, b) < -EPS) return ONLINE_BACK;
	if(a.norm() < b.norm()) return ONLINE_FRONT;

	return ON_SEGMENT;
}
int main(){
	char line[100];
	while(fgets(line, sizeof(line), stdin) != NULL){
		Point p[6];
		sscanf(line, "%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &p[0].x, &p[0].y, &p[1].x, &p[1].y, &p[2].x, &p[2].y, &p[3].x, &p[3].y);
		p[4] = p[0], p[5] = p[1];
		bool is_counter_clockwise;
		if(ccw(p[0], p[1], p[2]) == 1) is_counter_clockwise = true;
		else is_counter_clockwise = false;
		bool flag = true;
		if(is_counter_clockwise){
			for(int i = 1; i <= 4; i++){
				if(ccw(p[i - 1], p[i], p[i + 1]) != 1) flag = false;
			}
		}else{
			for(int i = 1; i <= 4; i++){
				if(ccw(p[i - 1], p[i], p[i + 1]) != -1) flag = false;
			}
		}
		if(flag) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
#define N 102
int n;
struct point{
	int x;
	int y;
	bool operator <(point p1){
		return x>p1.x;
	}
}red[N], blue[N];
int main(){
	ios::sync_with_stdio(false);
	int i, j=0, cnt = 0, used[N] = {0}, k, kj;
	cin>>n;
	for(i=0; i<n; i++)
		cin>>red[i].x>>red[i].y;
	for(i=0; i<n; i++)
		cin>>blue[i].x>>blue[i].y;
	sort(red, red+n);
	sort(blue, blue+n);
	for(i=0; i<n; i++){
		k = 2*N;
		for(j=0; j<n; j++){
			if(!used[j] && red[i].x<blue[j].x && red[i].y<blue[j].y){
				if(k>blue[j].y){
					k = blue[j].y;
					kj = j;
				} 				
			}			
		}
		if(k!=2*N){
			cnt++;
			used[kj] = 1;
		}			
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    map<int, int> m;
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        if (m.count(a) == 0)
        {
            m[a] = 1;
        }
        else
        {
            m[a]++;
        }
    }
    int Q;
    cin >> Q;
    long long prev = -1;
    for (int i = 0; i < Q; i++)
    {
        int b, c;
        cin >> b >> c;
        if (prev == -1)
        {
            m[c] = m[c] + m[b];
            m[b] = 0;
            prev = 0;
            for (const auto &[key, value] : m)
            {
                prev += key * value;
            }
        }
        else
        {
            prev += (c - b) * m[b];
            m[c] = m[c] + m[b];
            m[b] = 0;
        }
        cout << prev << endl;
    }
}


Measured memory_bytes: 7972
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N];
string s, t;
int32_t main(){_

   cin >> s >> t;

   int cnt = 0;
   for (int i = 0; i < 3; ++i)
   {
      cnt += (s[i] == t[i]);
   }
   
   cout<<cnt;

   return 0;
}

Measured memory_bytes: 764
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s,t = input().split()
    a,b = LI()
    d = {}
    d[s] = a
    d[t] = b
    u = input()
    d[u] -= 1
    print(d[s],d[t])
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 38484