akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
template<class T> ostream& operator<<(ostream& os, vector<T> const& v){
    rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" ");
    return os;
}

/*
  max 666*1000
 */

int P;
int a[6];
int val[6] = {500,100,50,10,5,1};

// x円はらう
int pay(int x){
    int rem = x;
    int c = 0;
    rep(i,6){
        int k = min(a[i], rem/val[i]);
        rem -= k*val[i];
        c += k;
    }
    return rem ? 1e8 : c;
}

// おつり
int change(int x){
    int rem = x;
    int c = 0;
    rep(i,6){
        int k = rem/val[i];
        rem -= k*val[i];
        c += k;
    }
    return c;
}

int main(){
    while(cin >> P && P){
        rep(i,6) cin >> a[i];
        reverse(a,a+6);
        int ans = 1e8;
        int M = 0;
        rep(i,6) M+=a[i]*val[i];
        loop(i,P,P+10001){
            int x = pay(i);
            if(x==1e8) continue;
            int y = change(i-P);
            //dump(x,y);
            ans = min(ans, x+y);
        }
        cout << ans << endl;
    }
}

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

int main() {
	char S[20];
	string T;
	string p;
	string Q;
	double m;
	int a = 0;
	int A = 0;
	int b = 0;
	int B = 0;
	int c = 0;
	int C = 0;
	int q, w, z;
	int n = 0;
	int x = 0;
	int y = 0;
	int ans = 0;
	cin >> a >> b;
	A = a + b;
	B = a - b;
	C = a * b;
	if (A >= B && A >= C) {
		cout << A;
	}
	else if (B >= A && B >= C) {
		cout << B;
	}
	else {
		cout << C;
	}

}

Measured memory_bytes: 256
n = input()
if n == '111':
    print('999')
elif n == '119':
    print('991')
elif n == '191':
    print('919')
elif n == '199':
    print('911')
elif n == '911':
    print('199')
elif n == '919':
    print('191')
elif n == '991':
    print('119')
elif n == '999':
    print('111')

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

using namespace std;

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQUE(a)  (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int n,a[5000],b[5000];

// O(N log N)
int main() {
	cin>>n;
	REP(i,n)cin>>b[i];
	int ans = 1e6;
	REP(i,b[0]+1){
		memcpy(a,b,sizeof(b));
		a[0]-=i;
		int t=i;
		REP(j,n-1){
			if(a[j]<1)continue;
			t+=a[j]*2;
			a[j+1]-=a[j];
		}
		t += max(0, a[n-1]);
		ans = min(ans, t);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3180
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1])

Measured memory_bytes: 38384
n, m, k = map(int, input().split())
parent = [i for i in range(n)]
club = [-1 for _ in range(n)]

def find(x):
  if x == parent[x]:
    return x
  ret =  find(parent[x])
  parent[x] = ret
  return ret

for count in range(1, k + 1):
  t, a, b = map(int, input().split())
  a -= 1
  b -= 1
  if t == 1:
    p_a = find(a)
    p_b = find(b)
    c_a = club[p_a]
    c_b = club[p_b]
    if c_a >= 0 and c_b >= 0 and c_a != c_b:
      print(count)
      break
    if c_a < 0 and c_b >= 0:
      club[p_a] = c_b
    parent[p_b] = p_a

  else:
    p_a = find(a)
    if club[p_a] < 0:
      club[p_a] = b
    if club[p_a] >= 0 and club[p_a] != b:
      print(count)
      break
else:
  print(0)


Measured memory_bytes: 13596
def main():
  n = int(input())  #nは入力回数
  num_list = [list(map(int, input().split())) for _ in range(n)]

  dp = [[0] * 3 for i in range(n+1)]
  for i in range(0,n):
    for j in range(3):
      for k in range(3):
        if(j==k):
          continue
        else:
          dp[i+1][k]=max(dp[i+1][k],dp[i][j]+num_list[i][k])
  print(int(max(dp[n][0],dp[n][1],dp[n][2])))

if __name__ == '__main__':
    main()

Measured memory_bytes: 74072
using System;
using System.Linq;

namespace AtCoderBeginnerContest152
{
	class Program
	{
		static void Main(string[] args)
		{
			var numbers = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

			var small = numbers.Min();
			var big = numbers.Max();

			for(var i = 0; i < big; i++)
			{
				Console.Write(small);
			}
		}
	}
}


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

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

  ll MOD = 1e9 + 7;
  int N; cin >> N;
  vector<ll> A(N, 0);
  vector<vector<ll>> iti(N + 1, vector<ll>(3, -1));
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (iti[A[i]][0] == -1) iti[A[i]][0] = i;
    else if (iti[A[i]][1] == -1) iti[A[i]][1] = i;
    else if (iti[A[i]][2] == -1) iti[A[i]][2] = i;
  }

  ll ans = 1;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0) {
      if (iti[0][0] == i) ans = 3;
      else if (iti[0][1] == i) ans = ans * 2 % MOD;
      else if (iti[0][2] == i) ans *= 1;
      else ans = 0;
    }
    if (A[i] > 0) {
      ll a0 = iti[A[i] - 1][0];
      ll a1 = iti[A[i] - 1][1];
      ll a2 = iti[A[i] - 1][2];
      if (a2 != -1 && a2 < i) {
        ll t = 3;
        if (a1 == -1) t--;
        if (a0 == -1) t--;
        ans = ans * t % MOD;
        iti[A[i] - 1][2] = -1;

      } else if (a1 != -1 && a1 < i) {
        ll t = 2;
        if (a0 == -1) t--;
        ans = ans * t % MOD;
        iti[A[i] - 1][1] = -1;

      } else if (a0 != -1 && a0 < i) {
        ans = ans * 1 % MOD;
        iti[A[i] - 1][0] = -1;
      } else {
        ans = 0;
      }
    }
    if (ans == 0) break;
  }

  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 6528
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    auto AS = readln.split.to!(long[]);
    long SUM;
    foreach (a; AS) SUM += a;
    long x;
    foreach (a; AS) {
        if (x + a >= SUM/2) {
            writeln(min((x+a)*2 - SUM, SUM - x*2));
            return;
        }
        x += a;
    }
}

Measured memory_bytes: 11520
#include<stdio.h>

int main(){
    int A, B, C;
    scanf("%d %d", &A, &B);

    if (A+B>=24){
        C=(A+B)-(((A+B)/24)*24);
        printf("%d", C);
    }
    else{
        C=A+B;
        printf("%d", C);
    }

    return 0;
}

Measured memory_bytes: 128
import sys

def main():
    input = sys.stdin.readline
    n = int(input())
    B_list = list(map(int, input().split()))

    if n == 2:
        sum_a0_a1 = B_list[0]*2
        print(sum_a0_a1)
        return

    first_a = B_list[0]
    last_a = B_list[n-2]
    sum_other_a = 0

    for i in reversed(range(0,n-2)):
        min_b = min(B_list[i+1],B_list[i])
        sum_other_a += min_b

    print(first_a + last_a + sum_other_a)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9112
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define rn return
#define fi first
#define se second
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;

const ll INF = 1LL << 50;

int main(){
    int N,M;
    cin >> N >> M;
    
    const int NMAX = 1000;
    const int MMAX = 2000;
    int a[MMAX], b[MMAX];
    ll c[MMAX];
    
    rep(i,M){
        cin >> a[i] >> b[i] >> c[i];
        c[i] = -c[i]; a[i]--; b[i]--;
    }
    
    ll dist[NMAX];
    rep(i,N){
        dist[i] = INF;
    }
    
    dist[0] = 0LL;
    
    rep(loop,N-1){
        rep(i,M){
            if (dist[a[i]]==INF) continue;
            if (dist[b[i]]>dist[a[i]]+c[i]){
                dist[b[i]] = dist[a[i]] + c[i];
            }
        }
    }
    ll ans = dist[N-1];
    
    bool negative[NMAX];
    rep(i,N){
        negative[i] = false;
    }
    
    rep(loo,N-1){
        rep(i,M){
            if (dist[a[i]] == INF) continue;
            if(dist[b[i]]>dist[a[i]]+c[i]){
                dist[b[i]] = dist[a[i]]+c[i];
                negative[b[i]] = true;
            }
            if (negative[a[i]]==true){
                negative[b[i]] = true;
            }
        }
    }
    
    if (negative[N-1])
        cout << "inf";
    else
        cout << -ans;
    rn 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>
#include <iomanip>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	string a;
	cin >> a;
	
	int n = (int)a.size();
	map<char, int> mp;
	
	for(int i = 0; i < n; ++i) {
		mp[a[i]]++;
	}
	
	ll ans = 1LL;
	for(int i = 0; i < n; ++i) {
		ans += n - i - 1 - (mp[a[i]] - 1);
		mp[a[i]]--;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3708
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>

using namespace std;

int main()
{
    int n;
    int m[2][110];
    int max = -1;

    cin >> n;

    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < n; j++) {
            cin >> m[i][j];
        }
    }

    for (int i = 0; i < n; i++) {
        int sum = 0;
        for (int j = 0; j <= i; j++) {
            sum += m[0][j];
        }

        for (int j = i; j < n; j++) {
            sum += m[1][j];
        }

        if (max < sum) max = sum;
    }

    cout << max << endl;

}


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

#define int long long
#define MOD ((int)1e9+7)
#define MAX_H 110
#define MAX_W 10

int H, W, K;
int amida[MAX_H][MAX_W];

int hoge[MAX_W];

int fuga(int t, int b){
	if(t == W-1) return hoge[t] = 1;
	if(b) return hoge[t] = fuga(t+1,!b);
	else return (hoge[t] = fuga(t+1, b))+fuga(t+1,!b);
}

signed main(){
	
	cin>>H>>W>>K;
	
	fuga(0,1); hoge[W] = 1;

	amida[0][1] = 1;
	
	for(int i = 1; i <= H; i++){
		for(int j = 1; j <= W; j++){
			amida[i][j] = amida[i-1][j]*hoge[j-1]%MOD*hoge[W-j]%MOD + amida[i-1][j-1]*hoge[j-1]%MOD*hoge[W-j+1]%MOD+amida[i-1][j+1]*hoge[j]%MOD*hoge[W-j]%MOD;
			amida[i][j] %= MOD;
		}
	}
	
	cout<<amida[H][K]<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

#define INF 100000000

bool a[200], b[200];

int main() {
	int n, m;
	cin >> n >> m;
	string s[110];
	rep(i, n) {
		cin >> s[i];
		rep(j, m) {
			a[i] = a[i] || (s[i][j] == '#');
			b[j] = b[j] || (s[i][j] == '#');
		}
	}
	rep(i, n) {
		rep(j, m) {
			if (a[i] && b[j])cout << s[i][j];
		}
		if (a[i])cout << endl;
	}
	return 0;
}

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

int main() {
	int N;
	cin >> N;
	int A[2][100];
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < N; j++) cin >> A[i][j];
	}
	int max_candies = 0;
	for (int i = 0; i < N; i++) { // どこでdownするかのN通り
		int candies = 0;
		for (int j = 0; j <= i; j++) candies += A[0][j]; // 0～iまで上段を足す
		for (int k = i; k < N; k++) candies += A[1][k]; // i～Nまで下段を足す。
		if (max_candies < candies) max_candies = candies; // 他パターンより大きければ更新
	}
	cout << max_candies << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

void combination(int n, vector<vector<int> >& comb)
{
    comb.assign(n+1, vector<int>(n+1, 0));
    for(int i=0; i<=n; ++i){
        comb[i][0] = 1;
        for(int j=1; j<=i; ++j)
            comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
    }
}


int main()
{
    string s;
    cin >> s;
    int n = s.size();

    vector<vector<int> > comb;
    combination(n/2, comb);

    bool center = n % 2;
    n /= 2;

    long long ret = 1;
    for(char c='a'; c<='z'; ++c){
        int m = count(s.begin(), s.end(), c);
        if(m % 2 == 1){
            if(!center){
                cout << 0 << endl;
                return 0;
            }
            center = false;
        }

        ret *= comb[n][m/2];
        n -= m/2;
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi >
#define vvvi vector<vvi >
#define INF 1e9
#define MOD 1e9+7
typedef long long llong;
using namespace std;

int main(){
	int n,k;
	cin>>n>>k;
	
	double sum=0;
	for(int i=1;i<=n;++i){
		int cnt=i;
		long double p=(double)1/n;
		while(cnt<k){
			cnt*=2;
			p/=2;
		}
		sum+=p;
	}
	
	printf("%.10f\n",sum);
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int k,a,b;
    cin>>k>>a>>b;
    int tmp=0;
    bool ok=false;
    while (tmp<=b)
    {
        tmp+=k;
        if(a<=tmp && tmp <=b) ok=true;
    }
    if(ok) cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
    
    
    return 0;
}

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

int main(){
	map<char, int> m;
	char a, b, c;
	m['A'] = 1;
	while(cin >> a >> c >> b)swap(m[a], m[b]);
	if(m['A'])cout << 'A' << endl;
	if(m['B'])cout << 'B' << endl;
	if(m['C'])cout << 'C' << endl;
	return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VS = vector<string>;
using graph = vector<vector<int>>;
int main()
{
int a;
cin>>a;
double pi=3.1415926635,ans=a*2*pi;
cout<<fixed << setprecision(10)<<ans<<endl;
    return 0;
}

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

 int main() {
   int N;
   cin >> N;
   string a;
   int res = 0;
   for (int i = 1; i < N + 1; i++) {
     a = to_string(i);
    if ( a.length() % 2 != 0) {
      res++;
    }
   }
   cout << res << '\n';
 }


Measured memory_bytes: 256
#include <iostream>
int main() {
	int N, A, B, C, D, X, Y;
	std::cin >> N >> A >> B >> C >> D;
	if (N%A >= 1) {
		X = N / A + 1;
	}
	else {
		X = N / A;
	}
	if (N%C >= 1) {
		Y = N / C + 1;
	}
	else {
		Y = N / C;
	}
	if (X * B < Y * D) {
		std::cout << X * B << std::endl;
	}
	if (X * B >= Y * D) {
		std::cout << Y * D << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3136
#include <iostream>
#include <vector>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXVAL = 200 * 1000 + 5;

int main() {
    int n; cin >> n;
    vector<int> v(n, 0);
    vector<int> w;

    for(int i = 0; i < n; i += 1) {
        int x; cin >> x;
        if(w.empty() or x != w.back()) {
            w.push_back(x);
        }
    }

    v = w;
    n = v.size();

    vector<vector<int>> sum(MAXVAL + 1, vector<int> (2, 0));
    vector<vector<int>> dp(n + 1, vector<int> (2, 0));

    dp[0][0] = 1;
    sum[v[0]][0] = 1;

    for(int i = 1; i < n; i += 1) {
        dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]) % MOD;
        dp[i][1] = sum[v[i]][0];
        sum[v[i]][0] = (sum[v[i]][0] + dp[i][0]) % MOD;
    }

    int ans = (dp[n - 1][0] + dp[n - 1][1]) % MOD;
    cout << ans << "\n";
}

Measured memory_bytes: 23668
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 998244353;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
const int biggg = 2000000000;
const long long biggest = 1000000000000000000LL;
const double eps = .0000000001; 


int main ()
{
  prep();
  int a, b, c, d;
  cin >> a >> b>> c >> d;
  bool tak = true;
  while (true){
      if (tak){
          c -= b;
          if (c <= 0){
              cout << "Yes";
              break;
          }
      }else{
          a -= d;
          if (a <= 0){
              cout << "No";
              break;
          }
      }
      tak = !tak;
  }
  return 0;
}


Measured memory_bytes: 3612
import java.util.*;
import java.text.*;

public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		while(true){
			int n = in.nextInt();
			int m = in.nextInt();
			int sumn = 0;
			int summ = 0;
			if((n|m)==0) break;
			int[] nlist = new int[n];
			int[] mlist = new int[m];
			for(int i=0; i<n; i++){
				nlist[i] = in.nextInt();
				sumn += nlist[i];
			}
			for(int i=0; i<m; i++){
				mlist[i] = in.nextInt();
				summ += mlist[i];
			}
			if((sumn-summ)%2!=0){
				System.out.println("-1");
			}else{
				boolean find = false;
				int changei = Integer.MAX_VALUE;
				int changej = Integer.MAX_VALUE;
				for(int i=0; i<n; i++){
					for(int j=0; j<m; j++){
						if((nlist[i]-mlist[j])*2==sumn-summ){
							changei = i;
							changej = j;
							find = true;
						}
					}
					if(find) break;
				}
				if((changei|changej)==Integer.MAX_VALUE){
					System.out.println("-1");
				}else{
					System.out.println(nlist[changei]+" "+mlist[changej]);
				}				
			}
		}
	}
}

Measured memory_bytes: 12000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	A
# CreatedDate:  2020-05-31 20:58:34 +0900
# LastModified: 2020-05-31 21:00:28 +0900
#


import os
import sys
#import numpy as np
#import pandas as pd


def main():
    a,b = map(int,input().split())
    print(a*b)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9152
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;
int L[303],R[303],X[303];

ll from[305][305];
ll to[305][305];
ll mo=1000000007;
vector<pair<int,int>> V[305];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	FOR(i,M) {
		cin>>L[i]>>R[i]>>X[i];
		V[R[i]+2].push_back({L[i]+2,X[i]});
	}
	
	from[0][1]=1;
	for(i=3;i<=N+2;i++) {
		ZERO(to);
		FOR(y,N+1) FOR(x,y) if(from[x][y]) {
			int mask=7;
			FORR(r,V[i]) {
				if(r.second==1) {
					if(r.first==i) mask&=7;
					else if(y<r.first) mask&=1;
					else mask=0;
				}
				if(r.second==2) {
					if(x>=r.first) mask=0;
					else if(y<r.first) mask&=6;
					else mask&=3;
				}
				if(r.second==3) {
					if(x>=r.first) mask&=7;
					else if(y>=r.first) mask&=4;
					else mask=0;
				}
			}
			if(mask&1) (to[x][y] += from[x][y])%=mo;
			if(mask&2) (to[x][i-1] += from[x][y])%=mo;
			if(mask&4) (to[y][i-1] += from[x][y])%=mo;
		}
		
		swap(from,to);
	}
	
	ll tot=0;
	FOR(i,N+3) FOR(j,N+3) tot+=from[i][j];
	cout<<tot%mo<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>

int main(){
   int a,b,c,k;
   int sum;
  
  scanf("%d %d %d %d",&a,&b,&c,&k);
  
  if(k<=a){
     sum=k;
  }  else if(k<=a+b){
     sum=a;
  }  else{
     sum=a-(k-a-b);
  }
  
  printf("%d\n",sum);

  return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int n;
  cin >> n;
  vi p(n), q(n);
  REP(i, n) { cin >> p[i]; }
  REP(i, n) { cin >> q[i]; }

  vi init(n);
  FOR(i, 1, n + 1) { init[i - 1] = i; }

  int pi = 0;
  do {
    bool flag = true;
    REP(i, n) {
      if (p[i] != init[i])
        flag = false;
    }
    if (flag) {
      break;
    }
    pi++;

  } while (next_permutation(ALL(init)));

  FOR(i, 1, n + 1) { init[i - 1] = i; }

  int qi = 0;
  do {
    bool flag = true;
    REP(i, n) {
      if (q[i] != init[i])
        flag = false;
    }
    if (flag) {
      break;
    }
    qi++;

  } while (next_permutation(ALL(init)));

  cout << abs(pi - qi) << endl;
}


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

using namespace std;
typedef long long ll;

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

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

int main(){
  int n;
  cin>>n;
  int c[n-1];
  int s[n-1];
  int f[n-1];
  for(int i = 0; i < n-1; i++){
    cin>>c[i]>>s[i]>>f[i];
  }
  for(int i = 0; i < n; i++){
    ll t = 0;
    for(int j = i; j < n-1; j++){
      if(t < s[j]) t = s[j];
      else if(t%f[j]==0) ;
      else t = (t+f[j])-(t%f[j]);
      
      t+=c[j];
    }
    cout<<t<<endl;
  }
  return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int,int>;
using pq = priority_queue<int>;
typedef long long ll;
string yes = "Yes\n";
string no = "No\n";

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

	cout << n*n - a << endl;
	return (0);
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

string s;
int n;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> s;
	int len = s.length();
	if (n < len) {
		cout << s.substr(0, n);
		cout << "...\n";
	}
	else cout << s << "\n";
	//system("pause");
	return 0;
}

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

int main(){
  int h, w;

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

    for( int i = 0; i < h; i++){
      for( int j = 0; j < w; j++){
        if( (i + j) % 2 != 0  ){ cout << "."; }
        else{ cout << "#"; }
      }
      cout << "\n";
    }
    cout << "\n";
  }

  return 0;
}

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

using namespace std;

typedef long long ll;

int main () {
  ios::sync_with_stdio(false);

  string str;
  ll k;
  cin >> str >> k;

  vector<pair<char, ll>> blocks;
  for (char c : str) {
    if (blocks.empty() || blocks.back().first != c) {
      blocks.push_back(make_pair(c, 0LL));
    }
    blocks.back().second++;
  }

  if (blocks.size() == 1) {
    ll sz = k * (ll) str.size();
    cout << sz / 2 << endl;
    return 0;
  }

  if (blocks.front().first == blocks.back().first) {
    ll ans = 0;
    // count the first and last 1 time separately, k - 1 times together
    ans += blocks.front().second / 2;
    ans += blocks.back().second / 2;
    ans += (k - 1) * ((blocks.front().second + blocks.back().second) / 2);
    for (int i = 1; i < (int) blocks.size() - 1; i++) {
      ans += k * (blocks[i].second / 2);
    }
    cout << ans << endl;
    return 0;
  }

  ll ans = 0;
  for (int i = 0; i < (int) blocks.size(); i++) {
    ans += k * (blocks[i].second / 2);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>

using namespace std;

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

int main() {
    int h, w, d;
    cin >> h >> w >> d;

    int a;
    vector<array<int, 2>> xy(h * w + 1);
    rep(i, h) {
        rep(j, w) {
            cin >> a;
            xy[a] = {i, j};
        }
    } 

    vector<long> memo(h * w + 1);
    int j;
    rep(i, h * w) {
        j = i + 1;
        if(j <= d) {
            memo[j] = 0;
        } else {
            memo[j] = memo[j-d] + abs(xy[j][0] - xy[j-d][0]) + abs(xy[j][1] - xy[j-d][1]);
        }
    }

    int q, l, r;
    cin >> q;

    rep(i, q) {
        cin >> l >> r;
        cout << memo[r] - memo[l] << endl;
    }
}

Measured memory_bytes: 4128
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <vector>
using namespace std;

const int N=1e5+5;
int c[N], n, m;
 
int main(){
	scanf("%d%d", &n, &m);
	for(int i=0,a,b;i<m;++i){
		scanf("%d%d", &a, &b);
		++c[a];
		--c[b+1];
	}
	int ans = 0;
	for(int i=1;i<=n;++i){
		c[i] += c[i-1];
		if(c[i] == m) ++ans;
	}
	printf("%d\n", ans);
	return 0;
}


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

int main(){
	int N,X;
	cin >> N >> X;
	int now = 0;
	int count = 1;
	for (int i = 0; i < N; ++i) {
		int L;
		cin >> L;
		now += L;
		if (now <= X) {
			++count;
		}
	}    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(3);
  for (int i = 0; i < 3; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 1; i < 3; i++) {
    ans += a[i] - a[i - 1];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int llint;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29)
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,M,R;
int r[9];
int res;
bool visited[9];
int d[201][201];
int a,b,c;
void dfs(int c,int las,int dist){
    if(c == R+1){
        if(res > dist) res = dist;
        return;
    }
    for(int i = 1; i <= R; i++) if(!visited[i]){
        visited[i] = true;
        if(las == -1) dfs(c+1,i,0);
        else dfs(c+1,i,dist+d[r[las]][r[i]]);
        visited[i] = false;
    }
}
int main(){
    cin >> N >> M >> R;
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            if(i != j) d[i][j] = INF;
        }
    }
    for(int i = 1; i <= R; i++) cin >> r[i];
    for(int i = 0; i < M; i++){
        cin >> a >> b >> c;
        if(d[a][b] > c) d[a][b] = d[b][a] = c;
    }
    for(int k = 1; k <= N; k++){
        for(int i = 1; i <= N; i++){
            for(int j = 1; j <= N; j++){
                if(d[i][j] > d[i][k]+d[k][j]){
                    d[i][j] = d[i][k]+d[k][j];
                }
            }
        }
    }
    res = INF;
    dfs(1,-1,0);
    cout << res << endl;
}

 

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		sc.close();

		if(x<=6){
			System.out.println("1");
		}
		else if(x<=11){
			System.out.println("2");
		}
		else{
			long p = x/11;
			long q = x%11;

			if(q == 0){
				System.out.println(p*2);
			}
			else if(q <= 6){
				System.out.println(p*2+1);
			}
			else{
				System.out.println(p*2+2);
			}
		}
	}
}


Measured memory_bytes: 21844
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    a,b,c,x,y = readInts()

    # ABピザは2枚セットで
    c *= 2

    # 1500, 2000, 3800

    if x > y: # 3通りしかない aとbをx,y個ずつ買う ||
    # ピザ2枚セットを大きいほう個買う || 2枚セットを小さいほう買って、残りは大きいほう
        ans = min(a * x + b * y, c * x, c * y + a*(x-y))
    else:
        ans = min(a * x + b * y, c * y, c * x + b * (y-x))
    print(ans)
if __name__ == '__main__':
  main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll X;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>X;
	for(ll a=-1000;a<=1000;a++) {
		for(ll b=-1000;b<=1000;b++) {
			ll A=a*a*a*a*a;
			ll B=b*b*b*b*b;
			if(A-B==X) {
				cout<<a<<" "<<b<<endl;
				return;
			}
		}
	}
	assert(0);
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 3660
#include <stdio.h>

int main(void){
int a;
int aa;
int b;
scanf("%d%d",&a,&b);
while(1){
if(a > b){
printf("%d %d\n",b,a);}
else{
printf("%d %d\n",a,b);}
scanf("%d%d",&a,&b);
if(a==0 && b==0)break;
}}


Measured memory_bytes: 1980
import java.util.*;
public class Main {
	static senshu[][] list = new senshu[3][8];
	static senshu[] sani = new senshu[18];
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		for(int s=0;s<3;s++)for(int k=0;k<8;k++){
			int ban = in.nextInt();
			double time = in.nextDouble();
			list[s][k]=new senshu(ban,time);
		}
		for(int i=0;i<3;i++)Arrays.sort(list[i]);
		int cnt = 0;
		for(int i=0;i<3;i++){
			System.out.println(list[i][7].ban+" "+list[i][7].time);
			System.out.println(list[i][6].ban+" "+list[i][6].time);
			for(int s=5;s>=0;s--){
				sani[cnt]=list[i][s];
				cnt++;
			}
		}
		Arrays.sort(sani);
		System.out.println(sani[sani.length-1].ban+" "+sani[sani.length-1].time);
		System.out.println(sani[sani.length-2].ban+" "+sani[sani.length-2].time);
	}
}

class senshu implements Comparable<senshu>{
	int ban;
	double time;
	senshu(int ban,double time){
		this.ban=ban;
		this.time=time;
	}
	public int compareTo(senshu o) {
		if(o.time<this.time)return -1;
		else if(o.time>this.time)return 1;
		else return 0;
	}
}

Measured memory_bytes: 20104
<?php
fscanf(STDIN, "%d %d", $h, $n);
$array = explode(' ', trim(fgets(STDIN)));
for($i = 0; $i < $n; $i++){
    $h -= $array[$i];
}
if($h > 0){
    echo 'No';
}else{
    echo 'Yes';
}

?>

Measured memory_bytes: 12792
n=int(input())
lst=[]
for i in range(n):
    l=list(map(int, input().split()))
    lst.append(l)
lst=sorted(lst,key=lambda x:x[1])
point=0
is_possible=True
for l in lst:
    point+=l[0]
    if point>l[1]:
        is_possible=False
if is_possible:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 55264
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
template <typename T> bool chmin(T &a, const T &b) {if(a > b){a = b; return true;} return false;}
template <typename T> bool chmax(T &a, const T &b) {if(a < b){a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill (A (&array)[N], const T & val) {fill ((T*)array, (T*)(array+N), val);}
V<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
V<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

// UnionFind
// coding: https://youtu.be/TdR816rqc3s?t=726
// comment: https://youtu.be/TdR816rqc3s?t=6822
template<class Abel> struct WeightedUnionFind {
    vector<int> par;
    vector<Abel> diff_weight;
    /*
    WeightedUnionFind(int n=0, Abel SUM_UNITY=0) {init(n, SUM_UNITY);}
    void init(int n=0, Abel SUM_UNITY=0) {
        par.resize(n); diff_weight.resize(n);
        for(int i=0; i<n; i++) par[i]=-1, diff_weight[i]=SUM_UNITY;
    }
    */
    
    
    WeightedUnionFind(int n=0, Abel SUM_UNITY = 0): par(n,-1), diff_weight(n) {
        for (int i = 0; i < n; i++) diff_weight[i] = SUM_UNITY;
    }
    
    int root(int x) {
        if (par[x] < 0) return x;
        int r = root(par[x]);
        diff_weight[x] += diff_weight[par[x]];
        return par[x] = r;//根につなぐ
    }
    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x,y), w = -w;
        par[x] += par[y];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }
    bool same(int x, int y) { return root(x) == root(y);}
    int size(int x) { return -par[root(x)];}
    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }
    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};

int main () {
    int n, m; cin >> n >> m;
    WeightedUnionFind<int> uf(n);
    rep(i, m) {
        int l, r, d; cin >> l >> r >> d; l--; r--;
        if (uf.same(l, r)) {
            int diff = uf.diff(l, r);
            if (diff != d) {
                puts("No");
                return 0;
            }
        }
        else {
            uf.merge(l, r, d);
            //printf("d[%d][%d]=%d\n", l, r, uf.diff(l, r));
        }
    }
    puts("Yes");
    return 0;
}

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


int main() {
  int d;
  long long g;
  cin >> d >> g;
  long long p[d], c[d];
  long long ans = 1<<29;

  for (int i = 0; i < d; i++) {
    cin >> p[i] >> c[i];
  }

  for (int bit = 0; bit < (1 << d); bit++) {
    long long count = 0;
    long long sum = 0;
    for (int i = 0; i < d; i++){
      if (bit & (1 << i)) sum += 100 * p[i] * (i+1) + c[i], count+= p[i]; 
    }
    if (sum >= g) ans = min(ans, count);
    else {
      for (int i = d-1; i >= 0; i--) {
        if (bit & (1 << i)) continue;
        for (int j = 0; j < p[i]; j++) {
          if(sum >= g) break;
          sum += 100 * (i+1);
          count++;
        }
      }
    ans = min(ans, count);
    }
    }
    cout << ans << endl;    
}

Measured memory_bytes: 256
//author-jayesh parmar
#include <bits/stdc++.h>
#define ll 					long long
#define abs(x) 				x>0?x:(-x)
#define pb                  push_back
#define pf                  push_front
#define eb                  emplace_back
#define popb                pop_back
#define popf                pop_front
#define mp                  make_pair
#define mt                  make_tuple
#define ff                  first
#define ss                  second
#define vll                 vector<ll>
#define vvl                 vector<vll>
#define pll                 pair<ll,ll>
#define mll                 map<ll,ll>
#define ub                  upper_bound
#define lb                  lower_bound
#define bs                  binary_search
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define get(tup,ind)        get<ind>(tup)
#define sv(i,s,e,v) for(ll i=(s);i<(e);i++){int ip;,cin>>ip;,v.pb(ip);}   
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main() 
{
	fast
	string s;
	int a=0,b=0;
	cin >> s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='A')
			a++;
		else
			b++;
	}
	if(a && b)
		cout << "Yes"; 
	else
		cout << "No";

	return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define s second
#define f first
long long const mod = 1000000007;
#define inf 1000000000000000000
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod)+mod)%mod;}
inline ll mul(ll a, ll b){ return (((a%mod)*(b%mod))%mod+mod)%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

ll power(ll x,ll y,ll m)
{
    if (y == 0)
        return 1;
    ll p = power(x, y/2, m) % m;
    p = (p * p) % m;
    return (y%2 == 0)? p : (x * p) % m;
}

ll modInv(ll x)
{
    return power(x,mod-2,mod)%mod;
}



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll h,w;
    cin>>h>>w;
    if(h==1||w==1)
        cout<<"1\n";
    else if(w%2==0)
    {
        cout<<(w/2)*h<<endl;
    }
    else
    {
        ll ans1=(w/2)*(h/2);
        h=h-h/2;
        ll ans2=((w/2)+1)*h;
        cout<<ans1+ans2<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
n = int(input())
P = map(int,input().split())
p = [i for i in P]
count =0
for i in range(len(p)-2):
    q = ()
    q = p[i:i+3]
    if len(q) == 3:
        a = q[1]
        q.sort()
        if a == q[1]:
            count += 1

print(count)

Measured memory_bytes: 3060
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String a=scan.next();
		for(int i=0;i!=a.length();i++) {
			char b=a.charAt(i);
			if(b==',') {
				b=' ';
			}
			System.out.print(b);
		}
		System.out.println();
	}
	}

Measured memory_bytes: 21588
#include <iostream>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll N, A[100000];

int main(void) {
  cin >> N;
  REP(i, 0, N) cin >> A[i];

  ll sa = 0;
  REP(i, 0, N) sa += A[i];

  if(sa % (N * (N + 1) / 2) != 0) {
    cout << "NO" << endl;
  } else {
    ll k = sa / (N * (N + 1) / 2);
    ll cnt = 0;
    bool f = 1;
    REP(i, 0, N) {
      ll x = (-A[(i + 1) % N] + A[i] + k);
      f = f && x >= 0 && x % N == 0;
      cnt += x / N;
    }
    cout << (f && cnt == k ? "YES" : "NO") << endl;
  }
}


Measured memory_bytes: 1024
/*Alohomora*/
#include<bits/stdc++.h>
#define ll         long long
#define fl(i,n)    for(i=0;i<n;i++)
#define fld(i,a,b) for(i=a;i>b;i--)
#define fli(i,a,n) for(i=a;i<n;i++)
#define inp(i,a,n) for(i=0;i<n;i++) {cin>>a[i];}
#define op(i,a,n)  for(i=0;i<n;i++) {cout<<a[i]<<" ";}
#define pb         push_back
#define mp         make_pair
#define mod1        987654319 
#define speedup    ios_base::sync_with_stdio(false),cin.tie(0)
using namespace std;
ll fact(ll n){ if(n==0){return 1;}return (n*fact(n-1))%mod1;}
ll power(ll x, ll y,ll mod){ll out = 1;while (y > 0){if (y & 1) out=(out*x)%mod;y = y>>1;x = (x*x)%mod;}return out%mod;}
ll inverse(ll a){return power(a,mod1-2,mod1);}
ll gcd(ll a,ll b){if(b==0){return a;}gcd(b,a%b);}
ll a[2000000];
void sieve(){ll i,j;fli(i,2,1000001){if(a[i]==0){for(j=i*i;j<1000001;j+=i){a[j]=1;}}}}
map<ll,vector<ll> >m1;
vector<ll>v1;
bool compar(const pair<ll,ll> &a, const pair<ll,ll> &b) 
{ 
    return (a.second < b.second);
} 
ll level[1000000];
vector<ll>root;
set<ll>s1;
void factorise(long long n) 
{ 
    while (!(n%2)) 
    { 
        n >>= 1; 
        s1.insert(2);
    } 
    for (long long i=3; i<=sqrt(n); i+=2) 
    { 
        while (n%i==0) 
        { 
        	s1.insert(i);
            n=n/i; 
        } 
    } 
  	if (n>2) 
  	{
       s1.insert(n);
	}
} 
void comp()
{
	ll l,i,j,k,q,n,m,temp=0,sum,count=0;
	cin>>l;
	cout<<3*l*l<<endl;
} 
int main()
{
	speedup;
	ll i=0,t;
	ll n;
	//cin>>t;
	t=1;
	while(t--)
	{
	 comp();
	}
}

Measured memory_bytes: 2304
#include<stdio.h>
int main()
{
    int a, b, all=1, i;
    scanf("%d%d",&a,&b);
    for(i=0;;i=i+1)
    {
        if(all>=b)
            break;
        else all--,all +=a;
    }
    printf("%d\n",i);
}


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

int ans(long long a,long long b){
    if (a==0 & b>0){
        return(b);
    }
    if(b==0 & a>0){
        return(a+1);
    }
    if (a==0 & b<0){
        return(-b+1);
    }
    if(b==0 & a<0){
        return(-a);
    }
    //both positive
    if(a>0 & b>0){
        if(a>b){
            long long diff = a-b;
            return(diff+2);
        }
        if(a<b){
            long long diff1 = b-a;
            return(diff1);
        }
    }
    //a positive b negative
    if(a>0 & b<0){
        if(a == -b){
            return(1);
        }
        if(-a > b){
            return((-b-a)+1);
        }
        if(-a < b){
            return((b+a)+1);
        }
    }
    //a negative b positive
    if(a<0 & b>0){
        if(-a == b){
            return(1);
        }
        if(-a > b){
            return((-a-b)+1);
        }
        if(-a < b){
            return(b+a+1);
        }
    }
    //both negative
    if(a<0 & b<0){
        if(a>b){
            return(-b+a+2);
        }
        if(a<b){
            return(-a+b);
        }
    }
}

int main(){
    long long x,y;
    cin>>x>>y;
    cout<<ans(x,y);
}

Measured memory_bytes: 256
# ABC148a

import logging


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10 ** 6)

    def dump(*args):
        sys.stderr.write(str(args))
    # 再帰関数を使わない限りPypyで出すこと

    a = int(input())
    b = int(input())
    print(*set([1, 2, 3]).difference(set([a]), set([b])))
    #dump('Error occurred!', 1, 136513, [2521.26262, 624652])


if __name__ == '__main__':
    main()


Measured memory_bytes: 43628
#include <bits/stdc++.h>
 
using namespace std;
 
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
 
int main() {
  
  int N, K;
  while(cin >> N >> K && (N|K)) {
    int C[N]; rep(i, N) { cin >> C[i]; }
    
    int mx1 = 1;
    rep(i, N) {
      int mul = 1;
      REP(j, i, i+K) {
        if(j >= N) {
          mul = 0; break;
        }
        mul *= C[j];
      }
      mx1 = max(mx1, mul);
    }
    
    int ans = -1<<29;
    rep(i, N) REP(j, i+1, N) {
      swap(C[i], C[j]);
      rep(k, N) {
        int mul = 1;
        REP(l, k, k+K) {
          if(l >= N) {
            mul = -1<<29; break;
          }
          mul *= C[l];
        }
        ans = max(ans, mul-mx1);
      }
      swap(C[i], C[j]);
    }
    
    if(ans < 0) {
      cout << "NO GAME\n";
    }
    else {
      cout << ans << endl;
    }
  }
   
  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
#define endl '\n'
using namespace std;
const int N=1e5+5;
int pre1[N],pre2[N],q;
string n,m;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>m>>q;
	for(int i=0;i<n.size();++i) {
		pre1[i+1]=pre1[i];
		if(n[i]=='A') ++pre1[i+1];
		else pre1[i+1]+=2;
	}
	for(int i=0;i<m.size();++i) {
		pre2[i+1]=pre2[i];
		if(m[i]=='A') ++pre2[i+1];
		else pre2[i+1]+=2;
	}
	for(int i=0;i<q;++i) {
		int a,b,c,d,x,y;
		cin>>a>>b>>c>>d;
		x=pre1[b]-pre1[a-1];
		y=pre2[d]-pre2[c-1];
		if(abs(x-y)%3==0)
			cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int A = 0;
  for ( int i = 0; i < 3; i++ )
    if ( S.at(i) == T.at(i) )
      A++;
      cout << A << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <queue>
#include <complex>

using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) reep((i),0,(n))
#define F first
#define S second
#define mkp make_pair
#define PB push_back
#define ALL(v) v.begin(),v.end()
#define maxs(a,b) (a=max(a,b))
#define mins(a,b) (a=min(a,b))
const int INF = 0x3f3f3f3f;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef pair<int, int> pii;
// typedef pair<,pii> P;

typedef complex<double> P;

#define EPS (1e-8)
double dot(P a, P b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double cross(P a, P b) {
	return a.real() * b.imag() - a.imag() * b.real();
}

double distance_l_p(P a, P b, P c) {
	return abs(cross(b - a, c - a)) / abs(b - a);
}

template<class T>
T sq(T a){
	return a*a;
}

double dd[]={1,-1};

bool check(P a,P b,P p,double r,double c){
	double d = distance_l_p(a,b,p);
	if(r-d>EPS){
		return false;
	}
	if(c-(d-r)>-EPS) return true;
	return false;
}

int main() {
	int n;
	while(cin >> n, n) {
		vector<pair<P, P>> v(n);
		vector<pair<P, P>> w;
		rep(i, n) {
			double a, b, c, d;
			cin >> a >> b >> c >> d;
			v[i] = mkp(P(a, b), P(c, d));
			w.PB(mkp(P(a,b),P(c+d,d)));
			w.PB(v[i]);
		}
		vector<pair<P,P>> line;
		rep(i,w.size()){
			rep(j,i){
				double xp=w[j].F.real()-w[i].F.real();
				double yp=w[j].F.imag()-w[i].F.imag();
				double r = w[i].S.real();
				double R = w[j].S.real();
				// cout<<xp<<" "<<yp<<" "<<endl;
				if(sq(xp)+sq(yp)-sq(r+R)>=0){
					rep(k,2){
						double xq,yq,xx,yy;
						P p;
						xq = r*(xp*(r+R)+dd[k]*yp*sqrt(sq(xp)+sq(yp)-sq(r+R)))/(sq(xp)+sq(yp));
						yq = r*(yp*(r+R)-dd[k]*xp*sqrt(sq(xp)+sq(yp)-sq(r+R)))/(sq(xp)+sq(yp));
						// cout<<"xq yq "<<xq<<" "<<yq<<endl;
						p = P(xq,yq) * P(0,1) + P(xq,yq) + w[i].F;
						line.PB(mkp(P(xq,yq)+w[i].F,p));
						// cout<<i<<" "<<j<<endl;
					}
				}
				R=-R;
				if(sq(xp)+sq(yp)-sq(r+R)>=0){
					rep(k,2){
						double xq,yq,xx,yy;
						P p;
						xq = r*(xp*(r+R)+dd[k]*yp*sqrt(sq(xp)+sq(yp)-sq(r+R)))/(sq(xp)+sq(yp));
						yq = r*(yp*(r+R)-dd[k]*xp*sqrt(sq(xp)+sq(yp)-sq(r+R)))/(sq(xp)+sq(yp));
						// cout<<"xq yq "<<xq<<" "<<yq<<endl;
						p = P(xq,yq) * P(0,1) + P(xq,yq) + w[i].F;
						line.PB(mkp(P(xq,yq)+w[i].F,p));
					}
				}
			}
		}
		int ans = 1;
		for(auto z:line){
			// cout<<z.F<<" "<<z.S<<endl;
			int tmp = 0;
			rep(i,n){
				if(check(z.F,z.S,v[i].F,v[i].S.real(),v[i].S.imag())){
					tmp++;
				}
			}
			maxs(ans,tmp);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 4524