akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{

    private static int n;

    private static int rec(int sum,int pre,int cnt)
    {

	if(sum > n)
	    return 0;

	if(sum == n)
	    return 1;

	if(cnt >= 3)
	    {
		//return sum == n?1:0;
		   
		int dif = n-sum;
		
		    int res = (int)Math.sqrt(dif);
		    if(res >= pre){
			if(res*res == dif)return 1;
		    }
		return 0;
		
	    }


	int counter = 0;
	for(int i=pre;sum+Math.pow(i,2)<=n;i++)
	    {
		counter += rec(sum+i*i,i,cnt+1);
	    }
	return counter;
    }

      public static void main(String args[])throws IOException
    {
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));


	while(true)
	    {

		n = Integer.parseInt(in.readLine());
		if(n == 0)
		    break;
		/*
		int cnt = 0;
		for(int i=1;i*i<=n;i++)
		    {
			if(i*i == n)
			    {
				cnt++;
				break;
			    }
			for(int j=i;j*j+i*i<=n;j++)
			    {
				if(j*j+i*i == n)
				    {
					cnt++;
					continue;
				    }
				for(int k=j;k*k+j*j+i*i<=n;k++)
				    {
					if(k*k+j*j+i*i == n)
					    {
						cnt++;
						continue;
					    }
					int dif = n-(k*k+j*j+i*i);
					int res = (int)Math.sqrt(dif);
					if(res*res == dif)cnt++;

					    
				    }
			    }
		    }
		


		System.out.println(cnt);
*/
		System.out.println(rec(0,1,0));
	    }
    }

}

Measured memory_bytes: 9560
#include <cstdio>
#include <algorithm>
long long s,ans;
int n,a[200003];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    std::sort(a+1,a+1+n);
    for(int i=2;i<=n;i++) s=(s+a[i-1])%1000000007,ans=(ans+s*a[i])%1000000007;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 2508
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
#include <cctype>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//typedef pair<ll,ll> A;
//vector<A> pc;
//int ABS(int a){return max(a,-a);}
ll a[100000];
ll dom[100001];
int main(){
  struct chan{
    ll a;
    ll b;
  };
  ll n;
  cin>>n;
  vector<chan> key(n);
  for(int i=0;i<n;i++){
    ll p;
    cin>>p;
    key[i].a=i+1;
    key[i].b=p;
  }
  sort(key.begin(),key.end(),[](const chan& x,const chan& y){
    return x.b<y.b;
  });
  for(int i=0;i<n;i++){
    cout<<key[i].a<<" ";
  }
  return 0;
}

Measured memory_bytes: 2432
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) #再帰定義

il = list(map(int, input().split()))

a = il[0]-1
b = il[1]
c = il[2]
d = il[3]

numa =  a- a//c - a//d + a//(c*d//gcd(c,d))
numb =  b- b//c - b//d + b//(c*d//gcd(c,d))

print(numb-numa)



      

Measured memory_bytes: 3060
'use strict'

const main = input => {
	const s = input.trim()
	let t1 = ''

	for (let i = 0; i < s.length; i++) {
		if (i % 2 === 0) t1 += s[i]
	}

	console.log(t1)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    int n, tmp;

    cin >> n;
    vector<int> v(n, 0);
    for(int i=0;i<n;++i)
    {
        cin >> tmp;
        v[i] = tmp;
    }

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

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

    if (sum > v[n-1])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
var
  a:array[0..10000006] of int64;
  n,s:int64;
  i:longint;
begin
  readln(n);
  for i:=1 to n do
    begin
      inc(s,i);
      a[i]:=i;
      if s>n then break;
    end;
  s:=s-n;
  for i:=1 to n do if (a[i]<>s) and (a[i]<>0) then writeln(a[i]);
end.

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

int main(int argc, char const *argv[])
{
    int h, n, a = 0, b;
    cin >> h >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> b;
        a += b;
    }

    if (h <= a)
    {
     
        cout << "Yes" << endl;
    }else
    {
        cout << "No" << endl;
    }
    
    
    
    return 0;
}


Measured memory_bytes: 256
mod = 10**9 + 7
def C():
    N = int(input())
    ans = 10**N - 2*9**N + 8**N
    print(ans%mod)
def A():
    N = int(input())
    if( N == 0):
        print(1)
    else:
        print(0)
def B():
    a,b,c,d = map(int,input().split())
    print(max(a*c,a*d,b*c,b*d))
B()


Measured memory_bytes: 9180
def lii():
    return list(map(int, input().split(' ')))

N, A, B = lii()
if A > B: print(0)
elif N == 1 and A < B: print(0)
elif N == 1 and A == B: print(1)
else:
    print((B-A) * (N-2) + 1)

Measured memory_bytes: 3060
N = int(input())
dp = []
dp.append([0] * N)
dp.append([0] * N)
dp.append([0] * N)
a, b, c = [int(x) for x in input().strip().split()]
dp[0][0] = a
dp[1][0] = b
dp[2][0] = c

for i in range(1, N):
    a, b, c = [int(x) for x in input().strip().split()]
    dp[0][i] = max(dp[1][i-1], dp[2][i-1]) + a
    dp[1][i] = max(dp[0][i-1], dp[2][i-1]) + b
    dp[2][i] = max(dp[1][i-1], dp[0][i-1]) + c


print(max(dp[0][N-1], dp[1][N-1], dp[2][N-1]))


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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

typedef struct {
    bool L, R;
} p_t;

int main() {
    Int n, k;
    cin >> n >> k;
    double res = 0.0;
    for (Int i = 1; i <= n; i++) {
        Int point = i;
        double add = 1.0 / (double)n;
        while (point < k) {
            add /= 2;
            point *= 2;
        }
        res += add;
    }
    printf("%.12lf\n", res);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll;
//ll power(ll a,ll b,ll mod){return b?power(a*a%mod,b/2,mod)*(b%2?a:1)%mod:1;}
inline ll power(ll a,ll b,ll mo)
{
    ll ans=1;
    a%=mo;
    while (b)
    {
        if (b&1) ans=ans*a%mo;
        b>>=1;
        a=a*a%mo;
    }
    return ans;
}
int main(){
    ll n,cnt=0;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<n;i++){
        if(s[i]=='1') cnt++;
    }
    //cout<<cnt<<endl;
    ll ans1=0,ans2=0,ans;
    if(cnt>1){
        for(ll i=0;i<n;i++){
            if(s[i]=='1') ans1=(ans1+power(2,n-i-1,cnt-1))%(cnt-1),ans2=(ans2+power(2,n-i-1,cnt+1))%(cnt+1);
        }
        //cout<<ans1<<" "<<ans2<<endl;
        for(ll i=0;i<n;i++){
            if(s[i]=='0'){
                ans=(ans2+power(2,n-i-1,cnt+1))%(cnt+1);
                int cnt=1;
                while(ans){
                    ans=ans%__builtin_popcount(ans);
                    cnt++;
                }
                cout<<cnt<<endl;
            }else{
                ans=(ans1+((cnt-1)-power(2,n-i-1,cnt-1)%(cnt-1))%(cnt-1))%(cnt-1);
                //if(i==21) cout<<ans<<endl;
                int cnt=1;
                while(ans){
                    ans=ans%__builtin_popcount(ans);
                    cnt++;
                }
                cout<<cnt<<endl;
            }
        }
    }else if(cnt==1){
        for(int i=0;i<n;i++){
            if(s[i]=='1') ans2=(ans2+power(2,n-i-1,cnt+1))%(cnt+1);
        }
        for(ll i=0;i<n;i++){
            if(s[i]=='0'){
                ans=(ans2+power(2,n-i-1,cnt+1))%(cnt+1);
                int cnt=1;
                while(ans){
                    ans=ans%__builtin_popcount(ans);
                    cnt++;
                }
                cout<<cnt<<endl;
            }else{
                cout<<0<<endl;
            }
        }
    }else{
        for(int i=0;i<n;i++) cout<<1<<endl;
    }
	return 0;
}


Measured memory_bytes: 3752
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Stack;

public class Main{
	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static int mod = (int) (1e9+7);
	static long cf = 998244353;
    static final int MAX = (int) 1e6;
    public static List<Pair>[] edges;
    public static int[][] parent;
    public static int col = 20;
    public static long[] Bit;
    public static long[] fac,inv;
    public  static int[] prime; 
    public static long[] dp;
	public static FastReader sc = new FastReader();
	public static void main(String[] args) {
	//	Scanner sc = new Scanner(System.in);
 
		  int N = sc.nextInt();
          int[] B = new int[N];
          for (int i = 0; i < N - 1; i++) 
              B[i] = sc.nextInt();
          long ans = 0;
          ans = B[0];
          for (int i = 1; i <= N - 2; i++) {
              ans += Math.min(B[i - 1], B[i]);
          }
          ans += B[N - 2];

          out.println(ans);
	 
		 
		out.close();
	}

	
	static class Pair{
		int x;
		int y;
		Pair(int x,int y){
			this.x = x;
			this.y = y;
		}
	}
	
}

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

void solve(std::vector<std::string> s) {
    string res;
    for (int i = 0; i < 3; i++) {
	res.push_back(toupper(s[i][0]));
    }
    cout << res << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  std::vector<std::string> s(3);
  for (int i = 0; i < 3; i++) {
    std::cin >> s[i];
  }
  solve(std::move(s));
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT32_MAX;

ll i,j;





int main(){
   ll N;
   cin>>N;
   ll ans=0;
   rep(i,N+1)if(i%3!=0&&i%5!=0)ans+=i;
   cout<<ans<<endl;
}

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


#define testcases ll t;cin>>t;while(t--)
#define queries ll q;cin>>q;while(q--)
#define ll long long 
#define loop(i,x,n) for(ll i=x;i<n;i++)
#define ff first
#define ss second
#define pb push_back
#define elif else if
#define flush cout<<endl;
#define mod 1000000007


int main(){

   long a,b,c;
   cin>>a>>b>>c;;



   string s = (a+b+c)>=22 ?  "bust" : "win";

   cout<<s;
   flush;


    

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll h;
	cin>>h;
	ll ans=0;
	ll zan=1;
	while(h!=0){
		ans+=zan;
		zan*=2;
		h/=2;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3576
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 3456;
int dp[MAXN];
vector<int> G[MAXN];

int main() {
    int N, T;
    scanf("%d %d", &N, &T);
    vector<pii> V;
    for (int i = 0; i < N; i++) {
        int A, B;
        scanf("%d %d", &A, &B);
        V.push_back(make_pair(A, -B));
    }
    for (int i = 0; i < MAXN; i++) {
        sort(G[i].rbegin(), G[i].rend());
    }
    sort(V.begin(), V.end());
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int A = V[i].first, B = -V[i].second;
        ans = max(ans, dp[T - 1] + B);
        for (int j = T - 1; j >= A; j--) {
            dp[j] = max(dp[j], dp[j - A] + B);
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

using namespace std;

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

int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (auto &a : A) cin >> a;

  vector<long long> AS(N + 1);
  for (int i = 0; i < N; i++) {
    AS[i + 1] = AS[i] + A[i];
  }

  vector<vector<long long>> dp(N + 5, vector<long long>(N + 5, 1e15));
  for (int l = N; l >= 0; l--) {
    for (int r = l; r <= N; r++) {
      if (l == r) {
        dp[l][r] = 0;
        continue;
      }
      for (int c = l; c < r; c++) {
        chmin(dp[l][r], dp[l][c] + dp[c + 1][r] + (AS[r + 1] - AS[l]));
      }
    }
  }
  cout << dp[0][N - 1] << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 1536
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <tuple>
#include <stdlib.h>
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<pair<int, int>>A(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i].first;
		A[i].second = i + 1;
	}
	sort(A.begin(), A.end());
	for (int i = 0; i < N; i++)
	{
		cout << A[i].second << endl;
	}
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
ll MOD = 1000000007;
ll INF =1<<30;

int main(){
    int n,m;
    cin >> n;
    vector<string>s(n),t(m);
    rep(i,n)cin >>s[i];
    cin>>m;
    rep(i,m)cin >>t[i];
    map<string,int>mp;
    rep(i,n){
        mp[s[i]]++;
    }
    rep(i,m) if(mp[t[i]]>0)mp[t[i]]--;
    int ans = 0;
    for(auto x:mp){
        if(x.second>ans) ans=x.second;
    }
    cout << ans <<endl;
}

Measured memory_bytes: 4292
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
using db = double;
#define INF 2000000000
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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメaモ
数値型から文字列に変換　to_string(number);これは簡単
文字列から数値型に変換　stoi(number)
文字列からllに変換　stoll(number)
__gcd(a,b)は最大公約数を取ってくれる、aとb
の大きい方をNとしたとき、計算量は log(N);
*/
const int mod = 1e9 + 7;

//ここから書き始める
int main(){
	ll n ;// nは整数
	cin >> n; // 毎回入力するのをテンプレートに
	vector<ll> v(n); //使うならrepで入力すること
	
	rep(i,n) cin >> v[i];

	ll ans  =0 ;
	rep(i,n-1){
		for(int j = i + 1 ; j < n; j++){
			ans += v[i]*v[j];
		}
	}
	cout << ans << endl;

		
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    int d = Integer.parseInt(str[3]);
    System.out.println((Math.abs(b-a)<=d && Math.abs(c-b)<=d)
                       || Math.abs(c-a)<=d?"Yes":"No");
  }
}

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

const int MOD = 1e+9 + 7;


int main()
{
    int H, W, K;
    cin >> H >> W >> K;


    vector<vector<int>> dp(H+1, vector<int>(W, 0));
    dp[0][0] = 1;
    for( int i = 0; i < H; ++i ){
        for( int j = 0; j < W; ++j ){
            // あみだの位置について全探索
            for( int k = 0; k < 1<<(W-1); ++k ){
                //隣り合って横線が引かれている場合はダメ
                bool is_adj = false;
                for( int l = 0; l < W-1; ++l ){
                    if( k & 1<<l and k & 1<<(l+1) ){
                        is_adj = true; 
                        break;
                    }
                }
                if( !is_adj){
                    if( k & 1<<(j-1) ) dp[i+1][j] += dp[i][j-1];
                    if( !(k & 1<<j) and !(k & 1<<(j-1)) ) dp[i+1][j] += dp[i][j];
                    if( k & 1<<j ) dp[i+1][j] += dp[i][j+1];
                    dp[i+1][j] %= MOD;
                }
            }
        }
    }
    cout << dp[H][K-1] << endl;

    return 0;
}

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

int N;

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

  cin >> N;
  long long a[N];

  for (int i = 0; i < N; i++) {
    cin >> a[i];
    if (a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  long long multiply = 1;

  for (int i = 0; i < N; i++) {
    if (multiply > 1000000000000000000 / a[i]) {
      cout << -1 << endl;
      return 0;
    }
    multiply *= a[i];
  }
  cout << multiply << endl;
}

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

using namespace std;

int maximo(int a, int b){
  if(a > b)
    return a;
  return b;
}

int main() {
  int a, b, c, max, area;
  cin >> a >> b >> c;
  max = maximo(a, b);
  max = maximo(max, c);
  if(max == a)
    area = (b * c)/2;
  else if(max == b)
    area = (a * c)/2;
  else if(max == c)
    area = (a * b)/2;

  cout << area << endl;
}

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

int main() {
  int N;
  cin >> N;
  double ans = 0;
  
  for (int i = 0; i < N; ++i) {
    double num;
    string S;
    cin >> num >> S;
    if (S == "BTC") {
      ans += 380000.0 * num;
    }
    else {
      ans += num;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<stack>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
int a[100005];
int main(void)
{
    int n;
    while(cin>>n)
    {
        int cot=0;
        for(int i=1;i<=n;i++)
            cin>>a[i];
        for(int i=1;i<=n;i++)
        {
            if(a[i]==i)
            {
                swap(a[i],a[i+1]);
                cot++;
            }
        }
        cout<<cot<<endl;
    }
    return 0;
}


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

int main() {
        int a, b;
        scanf("%d%d", &a, &b);
        printf("%d\n", (a + b + 1) / 2);
        return 0;
}



Measured memory_bytes: 256
s=input()
hi=5
ans=0
for i in range(len(s)):
    if(hi==s[i]):
        ans+=1
        if(s[i]=='0'):
            s=s[:i]+'1'+s[i+1:]

        else:
            s=s[:i]+'0'+s[i+1:]
    hi=s[i]
print(str(ans))



Measured memory_bytes: 3440
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n; cin >> n;
    string s; cin >> s;

    if(n % 2 == 1){
        cout << "No";
        return 0;
    }

    ll n2 = n / 2;
    rep(i, n2){
        if(s[i] != s[i+n2]){
            cout << "No";
            return 0;
        }
    }

    cout << "Yes";



    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000000000
#define MAXN        10000005
#define mod         998244353  
#define pi          3.1415926535897932384626433
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    cout<<n+n*n+n*n*n;
}

Measured memory_bytes: 3664
#include<iostream>
#include<string>
#include<algorithm>
#include <vector>

using namespace std;
int main(void){
    string tmp,cp;
    vector<string> str;

    for(int i=0;i<2;i++){
        cin >> tmp;
        str.push_back(tmp);
    }
    sort(str.at(0).begin(),str.at(0).end());
    cp=str.at(0);
    sort(str.at(1).begin(),str.at(1).end());
    reverse(str.at(1).begin(),str.at(1).end());
    sort(str.begin(),str.end());

    if(str.at(0)!=str.at(1)&&str.at(0)==cp)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int>P;

int main(void){
    string s; cin >> s;
    if(s=="Sunny") cout << "Cloudy" << endl;
    else if(s=="Rainy") cout << "Sunny" << endl;
    else cout << "Rainy" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>

using namespace std;

int main(){
	int n, i, temp;
	cin >> n;
	map<long long, int> mp;

	for (i = 0; i < n; i++) {
		cin >> temp;
		auto itr = mp.find(temp);
		if (itr != mp.end()) {
			mp[temp]++;
		} else {
			mp[temp] = 1;
		}
	}

	if (mp.size() > 3) {
		cout << "No";
		return 0;
	}

	if (mp.size() == 1){
		for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
			if (itr->first != 0) {
				cout << "No";
				return 0;
			}
		}
		cout << "Yes";
		return 0;
	}

	if (n % 3 != 0) {
		cout << "No";
		return 0;
	}

	if (mp.size() == 2){
		long long b[2];
		i = 0;
		for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
			b[i] = itr->first;
			i++;
		}
		if (b[0] != 0 && b[1] != 0) {
			cout << "No";
			return 0;
		}
		if (b[0] == 0 && mp[b[0]] != n / 3) {
			cout << "No";
			return 0;
		}
		if (b[1] == 0 && mp[b[1]] != n / 3) {
			cout << "No";
			return 0;
		}
	}

	if (mp.size() == 3){
		long long b[3];
		i = 0;
		for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
			b[i] = itr->first;
			i++;
			if (itr->second != n / 3) {
				cout << "No";
				return 0;
			}
		}

		if ((b[0] ^ b[1]) != b[2]) {
			cout << "No";
			return 0;
		}
	}

	cout << "Yes";
	return 0;
}

Measured memory_bytes: 5120
N, M = map(int, input().split())
H = list(map(int, input().split()))

A = [0]*M
B = [0]*M
for i in range(M):
    A[i],B[i] = map(int, input().split())

import copy

C = [[] for j in range(N)]

for i in range(N):
    C[i].append(copy.copy(H[i]))

for i in range(M):
    if C[A[i]-1][0]<=H[B[i]-1]:
        C[A[i]-1].append(copy.copy(H[B[i]-1]))
    if C[B[i]-1][0]<=H[A[i]-1]:
        C[B[i]-1].append(copy.copy(H[A[i]-1]))

ans = 0
for i in range(N):
    if list([H[i]]) == C[i]:
        ans += 1
print(ans)

Measured memory_bytes: 32012
n,w=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
dp=[[0 for _ in range(w+1)] for _ in range(n+1)]

for i in range(1,n+1):
  for j in range(w+1):
    if j-a[i-1][0]>=0:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-a[i-1][0]]+a[i-1][1])
    else:
      dp[i][j]=dp[i-1][j]
    
print(dp[n][w])

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

int main() {
  int N;
  cin >> N;
  int count = 1;

  vector<int> mochi(N);

  for (int i = 0; i < N; i++) {
 	cin >> mochi[i];
  }

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

  for (int i = 0; i < N-1; i++) {
    	if((mochi[i + 1] - mochi[i]) != 0) {
 		count++;
	}
  }

  cout << count << endl;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  vector<int32> a(n);
  REP(i,n)cin >> a[i];
  sort(ALL(a));
  if(a[0] == 0){
    ANS(0);
    return 0;
  }
  int64 ans = 1;
  REP(i,n){
    if(ans > (int64)1e18 / a[i]){
      ANS(-1);
      return 0;
    }
    ans *= a[i];
  }
  if(ans > (int64)1e18)ans = -1;
  ANS(ans);
  return 0;
}

Measured memory_bytes: 3992
#include <stdio.h>

int     main(void){
    int             i;
    int             input_date, min, max;
    long long int   sum;
    
    scanf("%d%d", &i, &input_date);
    min=max=sum=input_date;
    while (--i > 0){
        scanf("%d", &input_date);
        sum = sum + input_date;
        if (input_date > max) max = input_date;
        if (input_date < min) min = input_date;
    }
    printf("%d %d %lld\n", min, max, sum);
    return (0);
}


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

int main() {
	string x;
	cin >> x;
	vector<string> v = {"Sunny", "Cloudy", "Rainy"};
	for(int i = 0; i < 3; i++) {
		if(x == v[i]) {
			cout << v[(i+1) % 3] << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<cmath>
#include<iostream>
using namespace std;
int main(){
	long a,b,c;
	cin >> a >> b >> c;
	if(a*b*c%2==0) cout << 0 << endl;
	else cout << (a<b ? a*(b<c ? b: c) : b*(a<c ? a: c)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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; }

// dp[i][smaller][j] := 上からi桁目までの総和 % D == j
ll dp[10005][2][105];

int main() {
    string k; int d;
    cin >> k >> d;

    int n = k.size();
    dp[0][0][0] = 1;

    for (int i = 0; i < n; i++) {
        for (int smaller = 0; smaller < 2; smaller++) {
            for (int j = 0; j < d; j++) {
                int now = k[i] - '0';
                for (int x = 0; x <= (smaller ? 9 : now); x++) {
                    dp[i+1][smaller || x < now][(j+x) % d] += dp[i][smaller][j];
                    dp[i+1][smaller || x < now][(j+x) % d] %= MOD;
                }
            }
        }
    }
    ll ans = (dp[n][0][0] + dp[n][1][0] - 1) % MOD;
    if (ans < 0) ans += MOD;
    cout << ans << endl;
}


Measured memory_bytes: 16640
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#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() {
  string s, t, r, p;
  int n;
  cin >> s >> n;
  vector<string> out;
  int a, b;
  rep(i, n) {
    cin >> t >> a >> b;
    if (t == "print") {
      out.push_back(s.substr(a, b - a + 1));
    } else if (t == "reverse") {
      r = s;
      for (int j = a; j <= b; ++j) {
        r[j] = s[b + a - j];
      }
      s = r;
    } else {
      cin >> p;
      s.replace(a, b - a + 1, p);
    }
  }

  rep(i, out.size()) cout << out[i] << endl;

  return 0;
}


Measured memory_bytes: 3232
N = int(input())
scores = []
for i in range(N):
  scores.append(list(map(int, input().split())))
D = scores[0]
for day in range(1, N):
  D = [max(D[:i] + D[i+1:]) + scores[day][i] for i in range(len(D))]

print(max(D))

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

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int n,m,ans;
char a[105][105];
int s[105][105],d[105][105][105][105];

int sum(int lx,int rx,int ly,int ry){return (lx<=rx&&ly<=ry?s[rx][ry]-s[rx][ly-1]-s[lx-1][ry]+s[lx-1][ly-1]:0);}

int main(){
	n=readint(); m=readint();
	for(int i=1;i<=n;i++) scanf("%s",a[i]+1);
	int tx=0,ty=0;
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(a[i][j]=='E') tx=i,ty=j;
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+(a[i][j]=='o');
	d[1][1][1][1]=0;
	for(int i=1;i<=tx;i++){
		for(int j=1;j<=n-tx+1;j++){
			for(int k=1;k<=ty;k++){
				for(int l=1;l<=m-ty+1;l++){
					int U=tx-i+1,D=tx+j-1,L=ty-k+1,R=ty+l-1;
//					cout<<"test "<<i<<' '<<j<<' '<<k<<' '<<l<<' '<<d[i][j][k][l]<<' '<<U<<' '<<D<<' '<<L<<' '<<R<<endl;
					if(U>1) chkmax(d[i+1][j][k][l],d[i][j][k][l]+(D-tx<U-1?sum(U-1,U-1,max(L,R-ty+1),min(R,m-ty+L)):0));
					if(D<n) chkmax(d[i][j+1][k][l],d[i][j][k][l]+(n-tx+U>=D+1?sum(D+1,D+1,max(L,R-ty+1),min(R,m-ty+L)):0));
					if(L>1) chkmax(d[i][j][k+1][l],d[i][j][k][l]+(R-ty<L-1?sum(max(U,D-tx+1),min(D,n-tx+U),L-1,L-1):0));
					if(R<m) chkmax(d[i][j][k][l+1],d[i][j][k][l]+(m-ty+L>=R+1?sum(max(U,D-tx+1),min(D,n-tx+U),R+1,R+1):0));
				}
			}
		}
	}
	cout<<d[tx][n-tx+1][ty][m-ty+1]<<endl;
	return 0;
}

Measured memory_bytes: 229632
#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() {
  while (true) {
    int n, x;
    cin >> n >> x;
    if (n == 0 && x == 0) {
      return 0;
    }
    int ans = 0;
    FOR(i, 1, n + 1) {
      FOR(j, i + 1, n + 1) {
        FOR(k, j + 1, n + 1) {
          if (i + j + k == x)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3112
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <list>
#include <bitset>
#include <vector>
using namespace std;

#define I64d_OJ

//#ifdef I64d_OJ
//#define LL __int64
//#endif // I64d_OJ
#ifdef I64d_OJ
#define LL long long
#endif // I64d_OJ

typedef unsigned LL ULL;
typedef unsigned uint;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;
typedef vector<int> vi;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-f; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define ls rt<<1
#define rs rt<<1|1
#define MID(a,b) (((LL)(a)+(LL)(b))>>1)
#define absx(a) ((a)<0?-(a):(a))
#define MK(a,b) make_pair(a,b)
#define PB(a) push_back(a)
#define lowbit(x) ((x)&-(x))

#define lc c[x][0]
#define rc c[x][1]

template< typename T >
inline void Max(T &a,T &b){if(a<b) a=b;}
template< typename T>
inline void Min(T &a,T &b){if(a>b) a=b;}

const double pi=(double)acos(-1.0);
const double eps=(double)1e-8;
const int INF = (int) 0x3f3f3f3f;
const int MOD = (int) 1e9+7;
const int MAXN =(int) 1e3+10;
const int MAXM = (int) 3e6+10;

///--------------------START-------------------------
char a[15][MAXN];
int s[15][MAXN];
int H,W,K;

int cal2(int aa,int bb,int cc,int dd){
    return s[cc][dd]+s[aa][bb]-s[cc][bb]-s[aa][dd];
}

int cal(int x){
    int pre=0,cur=1;
    int cnt=0;
//    printf("x = %d\n",x);
    while(cur<=W){
        int mx=0;
        int i=0,j=0;
        while(i<H){
            j=i+1;
            while(j<H){
                if(x&(1<<(j-1))) break;
                j++;
            }
            mx=max(mx,cal2(i,pre,j,cur));
//            printf("x = %d,i = %d,j = %d,pre=%d,cur=%d,mx = %d\n",x,i,j,pre,cur,mx);
            i=j;
        }
        if(mx>K){
            if(cur-pre==1) return INF;
            cnt++;
//            printf("x = %d, i = %d, j  = %d\n",x,pre,cur-1);
            pre=cur-1;
        }
        else{
            cur++;
        }
    }
    return cnt;
}

void work(){
    scanf("%d%d%d",&H,&W,&K);
    for(int i=1;i<=H;i++) scanf("%s",a[i]+1);
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            s[i][j]=s[i][j-1]+(a[i][j]=='1');
        }
        for(int j=1;j<=W;j++){
            s[i][j]+=s[i-1][j];
        }
    }
    int FULL = (1<<H-1);
    int ans=(H-1)*(W-1);
    for(int bit=0;bit<FULL;bit++){
        int cost=cal(bit);
        int tmp=0;
        for(int i=0;i<H-1;i++)if(bit&(1<<i)) tmp++;
//        printf("x = %d, tmp = %d, cost = %d\n",bit,tmp,cost);
        ans=min(ans,cost+tmp);
    }
    printf("%d\n",ans);
}

///--------------------END-------------------------
int main(){
#ifdef NNever
//freopen("data.in","r",stdin);
///freopen("out.txt","w",stdout);
#endif // NNever
    work();
    return 0;
}





Measured memory_bytes: 256
#include<cstdio>
#include<cmath>

using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	int nn = n;
	printf("%d:",n);
	bool cnt = true;
	while (1){
		if (n % 2 == 0){
			printf(" 2");
			n /= 2;
			cnt = false;
		}
		else break;
	}
	while (1){
		if (n % 3 == 0){
			printf(" 3");
			n /= 3;
			cnt = false;
		}
		else break;
	}
	for (int i = 3; i <= nn; i += 2){
		bool gouseisuu = false;
		for (int j = 3; j <=i; j += 2){
			if (i%j == 0){
				gouseisuu = true;
				break;
			}
			if (!gouseisuu){
				while (1){
					if (n%i == 0){
						printf(" %d", i);
						n /= i;
						cnt = false;
					}
					else break;
				}
			}
		}
		if (n == 1)break;
		if (n == nn && cnt == true && i >= sqrt(n))break;
	}
	if (cnt)printf(" %d", nn);
	printf("\n");
}

Measured memory_bytes: 1028
import math
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]
xy.sort(key = lambda x:math.atan2(x[1],x[0]))
xyrad = [math.atan2(xy[i][1],xy[i][0]) for i in range(n)]
ans = []
x,y = list(zip(*xy))
xsum,ysum = sum(x),sum(y)
eps = 10**-8
for i in range(n):
  xs,ys = 0,0
  for j in range(i,i+n):
    xs += xy[j%n][0]
    ys += xy[j%n][1]
    ans.append(math.hypot(xs,ys))
print(max(ans))

Measured memory_bytes: 38896
#include<stdio.h>

int main(){
	int a, b, c, d = 0, e = 0;
	while(scanf("%d,%d,%d", &a, &b, &c) != EOF){
		if(a * a + b * b == c * c) d++;
		if(a == b) e++;
	}
	printf("%d\n%d\n", d, e);
	return 0;
}

Measured memory_bytes: 596
h,n = io.read("*n","*n","*l")
al = io.read()
for a in string.gmatch( al,"%d+" ) do
    h = h - tonumber(a)
  io.stderr:write(tostring(h).."\n")
end

if h <= 0 then 
    print("Yes")
else 
    print("No")
end

Measured memory_bytes: 4772
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.contains("A") && s.contains("B")){
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }
}

Measured memory_bytes: 21716
#include <stdio.h>
int main(void){
    int a,i,max,mini,n;
    long long int sum;
    max=-1000000;
    mini=1000000;
    sum=0;
    scanf("%d",&n);
 
    for (i=1 ; i<=n ; i=i+1){
        scanf("%d",&a);
        if(mini>a) mini=a;
        if(max<a) max=a;
        sum=sum+a;
    }
    printf("%d %d %lld\n",mini,max,sum);
    return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i) 
typedef long long ll;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
/*
	　　　  　 ,ﾍ／L──- 、
	　　　   　Lﾆ)r_」=＝= ｲ
	　　 　,ﾍ、i ﾉノλﾉﾊﾉﾍ
	　　   ,'　｀(ﾊﾘ ﾟ ヮﾟﾉi)　',
	　　 .i　　 >〈(つ,i!と)　　i
	　　  vﾍγk´_/___i,ゝﾍノ
	　　　　　 ｀ﾞr_,ｨ_ｧﾞ´
*/
int n;
int a; cin >> n;
cin >> a;
if (n <= 5) {
	cout << 0 << endl;
}
else if (n <= 12) {
	cout << a / 2 << endl;
}
else {
	cout << a << endl;
}
return 0;
}


Measured memory_bytes: 256
//設定言語check
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;

int main(){
  int D, check = 0, count = 0 ;
  int C[27] ;
  cin >> D ;
  int S[27][D+1], choice[D+1] = {}, history[27] = {} ;
  for(int i=1;i<27;i++) cin >> C[i] ;
  for(int i=1;i<(D+1);i++){
    for(int j=1;j<27;j++){
      cin >> S[j][i] ;
    }
  }
  for(int date=1;date<(D+1);date++){
    int search = 0, maxi = -1 ;
    for(int i=1;i<27;i++){
      if(maxi <= ( S[i][date] + (date - history[i] ) * C[i] ) ){
        search = i ;
        maxi = S[i][date] + (date - history[i] ) * C[i] ;
      }
    }
    choice[date] = search ;
    history[search] = date ; 
    cout << search << endl ;
  }
  return 0 ;
}  

Measured memory_bytes: 3644
// 2011/01/23 Tazoe

#include <iostream>
#include <string>
using namespace std;

int main()
{
	string cls[9];
	int n_am[9];
	int n_pm[9];

	for(int i=0; i<9; i++)
		cin >> cls[i] >> n_am[i] >> n_pm[i];

	for(int i=0; i<9; i++)
		cout << cls[i] << ' ' << n_am[i]+n_pm[i] << ' ' << n_am[i]*200+n_pm[i]*300 << endl;

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

const ll MOD = 1000000007;
string s;
ll LA[100010], RC[100010];
ll LL[100010], RR[100010];

ll mod_pow(ll x, ll n, ll mod) {
  ll res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> s;  
  for (int i = 0; i < s.size(); i++) {
    LA[i + 1] = LA[i] + (s[i] == 'A');
    LL[i + 1] = LL[i] + (s[i] == '?');
  }
  for (int i = s.size() - 1; i - 1 >= 0; i--) {
    RC[i - 1] = RC[i] + (s[i] == 'C');
    RR[i - 1] = RR[i] + (s[i] == '?');
  }
  ll ans = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'A' || s[i] == 'C') continue;
    ll tmp = 1;
    tmp *= mod_pow(3, LL[i] + RR[i], MOD);
    tmp %= MOD;
    tmp *= (LL[i] * mod_pow(3, MOD - 2, MOD) % MOD + LA[i]) % MOD;
    tmp %= MOD;
    tmp *= (RR[i] * mod_pow(3, MOD - 2, MOD) % MOD + RC[i]) % MOD;
    tmp %= MOD;
    ans += tmp;
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;

bool prime[10001];
vector<int> pr;
int sum[10001];

void P(){
	sum[0] = 1;
	for(int i = 2; i < 10001; i++) prime[i] = true;
	for(int i = 2; i < 10001; i++){
		if(!prime[i]) continue;
		pr.push_back(i);
		for(int j = i*2; j < 10001; j += i) prime[j] = false;
	}
	rep(i,pr.size()){
		int x = 0;
		for(int j = i; j < pr.size(); j++){
			x += pr[j];
			if(x > 10000) break;
			sum[x]++;
		}
	}
}

int main(){
	P();
	int n;
	while(cin >> n){
		if(n == 0) break;
		cout << sum[n] << endl;
	}
}

Measured memory_bytes: 1280
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <map>
#include <cstring>

using namespace std;

typedef long long LL;

#define MAXN 70
#define mo 1000000007

inline int cmp(int x,int y)
{
    return (x<y ? 0 : (x>y ? 2 : 1));
}
LL n;
int a[MAXN], f[MAXN][3][3][2];

void Init()
{
    cin >> n;
    for(int i = 1; i <= 60; ++i, n >>= 1)
        a[i] = n & 1;
}

void Dp()
{
    int i, j, k, l, m, o, ans = 0;
    f[0][1][1][0] = 1;

    for(i = 1; i <= 60; ++i)
        for(j = 0; j < 3; ++j)
            for(k = 0; k < 3; ++k)
                for(l = 0; l < 2; ++l)
                    for(m = 0; m < 2; ++m)
                        for(o = 0; o <= m; ++o){
                            int &res = f[i][(m ^ o) < a[i] ? 0 : ((m ^ o) == a[i] ? j : 2)][(m + o + l) % 2 < a[i] ? 0 : ((m + o + l) % 2 == a[i] ? k : 2)][(m + o + l) >> 1];
                            res = (res + f[i - 1][j][k][l]) % mo;
                        }

    for(j = 0; j < 2; ++j)
        for(k = 0; k < 2; ++k)
            ans = (ans + f[60][j][k][0]) % mo;
    printf("%d\n", ans);
}

int main()
{
    Init();
    Dp();
    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++)

int main() {
  int numMax = 3, count = 0;
  string s;

  cin >> s;

  rep(i,numMax)
    if(s.at(i)=='1')
      count++;

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
a,b,c = map(int,input().split())
d,e,f = map(int,input().split())
g,h,i = map(int,input().split())

if a+e+i == b+f+g == c+d+h == a+f+h == c+e+g == b+d+i:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9152
/**
 *		author:  zvm
 *		created: 25.09.2020 13:51:29
**/

#include <bits/stdc++.h>

using namespace std ;

typedef long long int ll ;
const ll INF = 1e18 ;

int main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);	

	int n ;
	cin >> n ;

	vector<int> a(n), b(n), c(n);

	for( int i = 0 ; i < n ; ++i ) {
		cin >> a[i] ;
	}
	for( int i = 0 ; i < n ; ++i ) {
		cin >> b[i] ;
	}
	for( int i = 0 ; i < n ; ++i ) {
		cin >> c[i] ;
	}

	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());

	vector<pair<int,ll>> good(n);
	for( int i = 0 ; i < n ; ++i ) {
		good[i].first = b[i] ;
		good[i].second = c.end() - upper_bound(c.begin(),c.end(),b[i]) ;
	}

	for( int i = n-2 ; i >= 0 ; --i ) {
		good[i].second += good[i+1].second ;
	}

	ll ans = 0 ;
	for( int i = 0 ; i < n ; ++i ) {
		pair<int,ll> to_find{a[i],INF};
		auto pos = upper_bound(good.begin(),good.end(),to_find) ;
		if( pos != good.end() ) {
			ans += (*pos).second ;
		}
	}
	
	cout << ans << endl ;
}


Measured memory_bytes: 6052
def main():
    _ = int(input())
    a = list(map(int,input().split()))
    if 1 in a:
        x = 1
        ans = 0
        for i in a:
            if x == i:
                x += 1
            else:
                ans += 1
        print(ans)
    else:
        print(-1)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 77516
#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
#define init(c) memset(c,0,sizeof c)
#define S second
#define F first
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=20000005;
int n,k,x,t,a,b,m;
string s;
vi v;
 
void solve(){
	cin >> n;
	int mx = 0;
	ll ans=0;
	for(int i =0;i<n;i++){
		cin >> x;
		if(mx>x){
			ans+=mx-x;
		}
		mx = max(mx,x);
	}
	cout << ans;
 
}
 
int main(){

	t=1;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string str;
  cin >> str;
  int head = atoi((str.substr(0,2)).c_str());
  int tail = atoi((str.substr(2,2)).c_str());
  if(1 <=head&&head<=12){
    if(1 <=tail&&tail<=12){
      cout<<"AMBIGUOUS" << endl;
    }else{
      cout << "MMYY" <<endl;
    }

  }else if(1 <=tail&&tail<=12){
    cout << "YYMM" <<endl;
  }else{
    cout << "NA" <<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <queue>

using namespace std;

struct Swimer {
  int time;
  int end;
  int lap;
  int lane;
  Swimer(int time, int end, int lap, int lane) :
    time(time), end(end), lap(lap), lane(lane) {;}
  bool operator<(const Swimer &rhs) const {
    if (end != rhs.end) { return end > rhs.end; }
    return time > rhs.time;
  }
};

int n;
int block[2];

int main() {
  while (scanf("%d", &n), n) {
    int ans = 0;
    memset(block, 0, sizeof(block));
    priority_queue<Swimer> que;
    for (int i = 0; i < n; i++) {
      int t, c;
      scanf("%d %d", &t, &c);
      que.push(Swimer(t, 0, c, 0));
    }
    while (!que.empty()) {
      Swimer swimer = que.top();
      que.pop();
      ans = max(ans, swimer.end);
      if (swimer.lap == 0) { continue; }
      //cout << swimer.time << " " << swimer.end << " " << swimer.lap << " " << swimer.lane << endl;
      int nend = swimer.end + swimer.time;
      if (block[swimer.lane] > nend) {
        nend = block[swimer.lane];
      } else {
        block[swimer.lane] = nend;
      }
      int nlane = (swimer.lane + 1) & 1;
      int nlap = swimer.lap;
      if (nlane == 0) { nlap--; }
      que.push(Swimer(swimer.time, nend, nlap, nlane));
    }
    printf("%d\n", ans);
  }
}

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

int main(){

    int c[3][3];
    rep(i,3){
        rep(j,3){
            cin >> c[i][j];
        }
    }

    int a[3],b[3];

    for(int i=0;i<=100;i++){
        a[0]=i;
        rep(j,3){
            b[j]=c[j][0]-a[0];
        }
        rep(j,3){
            a[j]=c[0][j]-b[0];
        }
        bool f=true;
        rep(j,3){
            rep(k,3){
                if(c[j][k]!=a[k]+b[j]){
                    f=false;
                }
            }
        }
        if(f){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256