akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// Look at me please ... that's what she said
#define MOD 1000000007
using namespace std;
const ll INF = 1e6 + 9;
int main(){
    ios::sync_with_stdio(false);
    //cin.tie(0); ///activate when submit
    string s;
    cin>>s;
    if(s=="SUN")cout<<"7"<<endl;
    else if(s=="MON")cout<<"6"<<endl;
    else if(s=="TUE")cout<<"5"<<endl;
    else if(s=="WED")cout<<"4"<<endl;
    else if(s=="THU")cout<<"3"<<endl;
    else if(s=="FRI")cout<<"2"<<endl;
    else if(s=="SAT")cout<<"1"<<endl;
    return 0;
}    

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){
    string str;
    cin >> str;
    if(str == "Sunny"){
        cout << "Cloudy\n";
    }else if(str == "Cloudy"){
        cout << "Rainy\n";
    }else{
        cout << "Sunny\n";
    }
}

Measured memory_bytes: 256
/*......................*/
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double   ld;

//#include <ext/pb_ds/assoc_container.hpp>   
//#include <ext/pb_ds/tree_policy.hpp>  
//#include <functional> 
//using namespace __gnu_pbds;  
//typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> OST;           //unique elements 

#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1000000007
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                      cin.tie(NULL);
#define    pb                       push_back
#define    pf                       push_front
#define    mp                       make_pair
#define    T                        int t; cin >> t; while(t--)
#define    ff                       first
#define    ss                       second
#define    all(container)           container.begin() , container.end()
#define    sz(container)            (int)container.size()
#define    pii                      pair <int , int>
#define    pll                      pair <long long int , long long int>
#define    setp(x)                  setprecision(x)
#define    ook(x)                   order_of_key(x)
#define    fbo(x)                   find_by_order(x)

//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

void solve(){
   
}

int main(){                                       //constraints , long long
     speed upp
     int a , b , c;
     cin >> a >> b >> c;
     b = a-b;
     c = max(0 , c - b);
     cout << c << '\n';
}








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

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

    int N, M;
    cin >> N >> M;

    int min = 10000000;
    int max = 0;
    rep(i,M) {
        int l, r;
        cin >> l >> r;

        if (max < l) max = l;
        if (min > r) min = r;
    }

    cout << std::max(0, min - max + 1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int a, b;
    cin >> a >> b;
    cout << ( a + b + 1 ) / 2 << endl; 
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int a,b;
  cin>>a>>b;
  int ans=1;
  int f=0;
  while(ans<=50*25)
  {
      int x,y;
      x=ans*0.08;
      y=ans*0.1;
      //cout<<x<<" "<<y<<endl;
   if(x==a && y==b)
   {
     cout<<ans<<endl;
     f=1;
     break;
   }
   ans++;
  }
  if(f!=1)
    cout<<"-1"<<endl;
  return 0;
}

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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if((a+b)>(c+d)) cout << "Left" << endl;
  else if((a+b)==(c+d)) cout << "Balanced" << endl;
  else cout << "Right" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    int n,ma,mb;
    cin>>n>>ma>>mb;
    int a[n],b[n],c[n];
    rep(i,n){
        cin>>a[i]>>b[i]>>c[i];
    }
    int dp[500][500];
    for(int i=0;i<500;i++)for(int j=0;j<500;j++) dp[i][j]=INF;
    dp[0][0]=0;
    rep(i,n){
        for(int j=499;j>=0;j--){
            for(int k=499;k>=0;k--){
                if(dp[j][k]==INF) continue;
                dp[j+a[i]][k+b[i]]=min(dp[j+a[i]][k+b[i]],dp[j][k]+c[i]);
            }
        }
    }
    int ans=INF;
    if(ma==mb){
        for(int i=1;i<500;i++){
            ans=min(ans,dp[i][i]);
        }
    }
    else{
        int sta=ma,stb=mb;
        while(sta<500&&stb<500){
            ans=min(ans,dp[sta][stb]);
            sta+=ma;
            stb+=mb;
        }
    }
    if(ans==INF){cout<<-1<<endl;}
    else{cout<<ans<<endl;}
    return 0;
}


Measured memory_bytes: 1280
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val a = Array(n) { sc.nextInt() }
    val sum = Array(n + 1) { 0L }
    for (i in 0 until n) {
        sum[i + 1] = sum[i] + a[i]
    }
    var count = 0L
    val map = mutableMapOf<Long, Int>()
    for (i in 0..n) {
        count += map[sum[i]] ?: 0
        map[sum[i]] = (map[sum[i]] ?: 0) + 1
    }
    println(count)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 63172
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int x;
    cin >> x;

    cout << (x >= 30 ? "Yes" : "No") << endl;

    return 0;
}

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, int> P;
const ll INF = 1e15;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;


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

    if (h == 1 || w == 1) {
        cout << 1 << endl;
        ret();
    }

    cout << (w * h + 1) / 2 << endl;

}


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

typedef struct Card{
  char suit;
  int value;
  int check;
}Card;


void QuickSort(Card*,int,int);
int Partition(Card*,int,int);

main(){
  int i,n,count=0;
  Card *A;
  char c;
  scanf("%d%c",&n,&c);

  A=(Card *)malloc(sizeof(Card)*(n));
  
  for(i=0;i<n;i++){
    scanf("%c%d%c",&A[i].suit,&A[i].value,&c);
    A[i].check=i;
  }

  QuickSort(A,0,n-1);
  
  for(i=0;i<n-1;i++){
    if(A[i].value==A[i+1].value && A[i].check>A[i+1].check)count=1;
  }

  if(count==0)printf("Stable\n");
  else printf("Not stable\n");

  for(i=0;i<n;i++){
    printf("%c %d\n",A[i].suit,A[i].value);
      }
  return 0;
}

void QuickSort(Card *A,int p,int r){
  int q;

  if(p<r){
    q=Partition(A,p,r);
    QuickSort(A,p,q-1);
    QuickSort(A,q+1,r);
  }
}

int Partition(Card *A,int p,int r){
  int x,i,j;
  Card temp;
  x=A[r].value;
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j].value<=x){
      i++;
      temp=A[i];
      A[i]=A[j];
      A[j]=temp;
    }
  }
  temp=A[i+1];
  A[i+1]=A[r];
  A[r]=temp;
  return i+1;
}

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

int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(max(a*c, a*d), max(b*c, b*d)) << endl;
    return 0;
}

Measured memory_bytes: 3628
// ALDS_1_2_C.cpp
// Stable Sort

#include <iostream>
#include <vector>
#include <string>
using namespace std;
const int V = 10;

void myswap(int& a, int& b)
{
	int t = a;
	a = b;
	b = t;
}

void myswap(char& a, char& b)
{
	int t = a;
	a = b;
	b = t;
}

void isStable(string s, string t) {
	if (s == t)
		cout << "Stable" << endl;
	else
		cout << "Not stable" << endl;
}

void trace(vector<int> &nums, vector<char> &labels, int N) {
	for (int i = 0; i < N; i++) {
		if (i > 0) {
			cout << " ";
		}
		cout << labels[i] << nums[i];
	}
	cout << endl;
}

void BubbleSort(vector<int> &nums, vector<char> &labels, int N) {
	for (int i = 0; i < N; i++) {
		for (int j = N - 1; j > i; j--) {
			if (nums[j] < nums[j - 1]) {
				myswap(nums[j], nums[j - 1]);
				myswap(labels[j], labels[j - 1]);
			}
		}
	}
}

void SelectionSort(vector<int> &nums, vector<char> &labels, int N) {
	for (int i = 0; i < N; i++) {
		int minPos = i;
		for (int j = i; j < N; j++) {
			if (nums[j] < nums[minPos]) minPos = j;
		}
		myswap(nums[i], nums[minPos]);
		myswap(labels[i], labels[minPos]);
	}
}


int main()
{
	int N;
	cin >> N;
	vector<int> nums(N);
	vector<char> labels(N);
	vector<string> strs(V);
	for (int i = 0; i < N; i++) {
		cin >> labels[i] >> nums[i];
		strs[nums[i]].push_back(labels[i]);
	}
	// s????¨???????????????????
	string s;
	for (int i = 1; i < V; i++) {
		s.append(strs[i]);
	}
	vector<int> nums1(nums);
	vector<char> labels1(labels);
	vector<int> nums2(nums);
	vector<char> labels2(labels);

	BubbleSort(nums1, labels1, N);
	trace(nums1, labels1, N);
	string t1;
	for (int i = 0; i < labels1.size(); i++) {
		t1.push_back(labels1[i]);
	}
	isStable(s, t1);

	SelectionSort(nums2, labels2, N);
	trace(nums2, labels2, N);
	string t2;
	for (int i = 0; i < labels2.size(); i++) {
		t2.push_back(labels2[i]);
	}
	isStable(s, t2);

	return 0;
}

Measured memory_bytes: 3160
#include <stdio.h>

int main() {
  int n, i;
  int digits[20];
  while (1) {
    scanf("%d", &n);
    if (n < 0) {
      return 0;
    }
    if (n == 0) {
      puts("0");
      continue;
    }
    for (i = 0; n > 0; ++i) {
      digits[i] = n % 4;
      n /= 4;
    }
    while (i > 0) {
      printf("%d", digits[i - 1]);
      --i;
    }
    puts("");
  }
}

Measured memory_bytes: 1040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
const int mod = 998244353;
struct mint {
ll x;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
int main(){
    ll n,s;cin>>n>>s;
    vl a(n);rep(i,n)cin>>a[i];
    vector<mint> q(s+1);
    mint ans=0;
    rep(i,n){
        q[0]+=1;
        {
            vector<mint> q2(s+1);
            rep(j,s+1){
                q2[j]+=q[j];
                if(j+a[i]<=s) q2[j+a[i]]+=q[j];
            }
            q=q2;
        }
        ans+=q[s];
    }
    cout<<ans.x<<endl;
    return 0;
}

Measured memory_bytes: 256
import itertools

n, m, q = map(int, input().split())
requirements = [list(map(int, input().split())) for _ in range(q)]
maximum = 0

for array in itertools.combinations_with_replacement(range(m), n):
  score = 0
  for r in requirements:
    if array[r[1] - 1] - array[r[0] - 1] == r[2]:
      score += r[3]
  maximum = max(maximum, score)
  
print(maximum)

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

int main() {

long N,K;
cin>>N>>K;
vector<long> s(N);

for(int i=0;i<K;i++){
  int d;
  cin>>d;
  for(int j=0;j<d;j++){
    int a;
    cin>>a;
    s[a-1]++;
  }
}

long ans=0;
for(int i=0;i<N;i++){
  if(s[i]==0) ans++;
}
cout<<ans<<endl;
}


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

int main(){
    int N;
    cin >> N;
    long long int A[100000];
    int t=0;
    int k=0;
    for(int i=0;i<N;i++){
        cin >> A[i];
        if(A[i]==0){k=1;}
    }
    long long int max = pow(10,18);
    long long int answer = 1;
    int i=0;
    long long int Amx;
    while(t==0 && i<N){
        if(A[i]>Amx){
            t=1;
            break;
        }
        answer = answer*A[i];
        i=i+1;
        Amx = max/answer;
        if(answer<=max){t=0;}
        else{t=1;}
    }


    if(k==1){answer=0;}
    else if(t==1){answer=-1;}
    cout << answer << endl;
    
}

Measured memory_bytes: 4404
import scala.io.StdIn.{readInt, readLine};
object Main {
    def main(args: Array[String]): Unit = {
        val n = readInt;
        val g = new Graph(n);
        (0 until n).foreach { i => 
            readLine.split(" ").map(_.toInt).toList match {
                case src :: d :: dst => g.add(src, dst);
                case _ => ()
            }
        }
        g.depthFirstSearch.zipWithIndex.foreach { e => e match {
                case ((discover, finish), node) => println("%d %d %d".format(node + 1, discover, finish));
            }
        }
    }
}
class Graph(n: Int) {
    val size = n + 1;
    val matrix = Array.ofDim[Int](size, size);
    def add(src: Int, dsts: Seq[Int]): Unit = if (src > 0 && src < size) {
        dsts.foreach { d => if (d > 0 && d < size) matrix(src)(d) = 1};
    }
    def dump(): Unit = matrix.slice(1, size).foreach { a => println(a.slice(1, size).mkString(" "))}
    def depthFirstSearch(): Array[(Int, Int)] = {
        val status = new Array[(Int, Int)](size);
        def go(curr: Int, discoverTime: Int): Int = {
            if (curr >= size) {
                discoverTime;
            } else {
                status(curr) = (discoverTime, -1);
                val finishTime = 1 + (1 until size).foldLeft(discoverTime) { (time, i) => 
                    if (matrix(curr)(i) == 1 && status(i) == null) go(i, time + 1) else time;
                };
                status(curr) = (discoverTime, finishTime);
                finishTime;
            }
        } 
        (1 until size).foldLeft(0) { (time, i) => 
            if (status(i) == null) go(i, time + 1)else time;
        }
        status.slice(1, size);
    }
}


Measured memory_bytes: 44792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  string s;cin>>s;
  int n = 0,m = 0;
  rep(i,s.size())if(s[i] == '0')n++;else m++;

  print(min(n,m)*2);
  return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
  long long int n;
  cin>>n;
  int a;
  for(int i=sqrt(n);i>0;i--)
  {
  if(n%i==0)
  {
  a=i;
  break;
  }
}
  cout<<a+n/a-2;
}


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

int main(){
   char S[20];
   char T[21];
   scanf("%s",S);
   scanf("%s",T);
   int size1=strlen(S);
   int size2=strlen(T);
   int cnt=0;
   
   if(size1>=1&&size1<=10&&size2==size1+1){
      for(int i=0;S[i]!='\0';i++){
         if(S[i]==T[i]){
            cnt++;
         }
      }
      if(cnt==size1&&T[size2-1]>=97&&T[size2-1]<=122){
         printf("Yes");
      }
      else{
         printf("No");
      }
   }
   return 0;
}

Measured memory_bytes: 1728
def make_devisor(N):
    table=[]
    for i in range(1,int(N**0.5)+1):
        if N%i==0:
            table.append(i)
            if i!=(N//i):
                table.append(N//i)
    return table

def main():
    N=int(input())
    ans=len(make_devisor(N-1))-1
    d=make_devisor(N)
    for i in d:
        if i==1:
            continue
        tmp=0
        n=N
        while tmp==0:
            n//=i
            tmp=n%i
        if tmp==1:
            ans+=1
    print(ans)

main()

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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)

const int INF = 1e9;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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


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

  ll X;

  cin >> X;

  vector<int> min_val(100);
  REP(i, 100){

    int five_num = int(i/5);
    int amari = i - five_num * 5;
    int four_num = int(amari/4);
    int other = amari - 4 * four_num;
    int thre_num = int(other/3);
    int nokori = other - 3 * thre_num;
    int two_num = int(nokori/2);
    int fin = nokori - 2 * two_num;
    int val = five_num + four_num + thre_num + two_num + fin;
    min_val[i] = val;
        }

  int dif = X%100;
  int conf = min_val[dif];
  ll need = conf * 100 + conf;
  if (need <= X){cout << "1" << endl;}
  else cout << "0" << endl;


  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,b,c,w,s;
    scanf("%d %d %d",&a,&b,&c);
        if(a > c) { w = a;
                   s = c;
                   a = s;
                   c = w;
        } else {a = a;
                c = c;
                } 
        if(a > b) { w = a;
                   s = b;
                   a = s;
                   b = w;
        } else {a = a;
                c = c;
                }
        if(b > c) { w = b;
                   s = c;
                   b = s;
                   c = w;
        } else {b = b;
                c = c;
                }
    printf("%d %d %d\n",a,b,c);

    return 0;
}                   



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

using namespace std;

int INF = 1e9 + 5;

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

    int n;
    cin >> n;
    
    vector<int> h(3);
    for(auto&x : h)
    {
        cin >> x;
    }
    
    --n;

    vector<int> dp(h),dp2(3);
    while(n--)
    {
        for(auto&x : h)
        {
            cin >> x;
        }
        
        for(int i=0; i<3; ++i)
        for(int j=0; j<3; ++j)
        {
            if(i != j)
            {
                dp2[i] = max(dp2[i],dp[j]+h[i]);
            }
        }
        
        dp = dp2;
    
    }
    
    cout << *max_element(begin(dp),end(dp));
    
}


Measured memory_bytes: 256
/**
*    author:  yuya1234
*    created: 09.07.2020 13:00:32
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define ALL(v) (s).begin(), (s).end()
#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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

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

  int a[n];
  MEMSET(a,-1);

  int flg=true;
  REP(i,m)
  {
    int s,c;
    cin>>s>>c;

    if(a[s-1]==-1)a[s-1]=c;
    else if(a[s-1]!=c)
    {
      flg=false;
      break;
    }
  }

  if(flg && n==1 && a[0]<=0)
  {
    cout<<0<<endl;
  }
  else if(flg && a[0]!=0)
  {
    REP(i,n)
    {
      if(i==0)
      {
        if(a[i]==-1)cout<<1;
        else cout<<a[i];
      }
      else
      {
        if(a[i]==-1)cout<<0;
        else cout<<a[i];
      }
    }
    cout<<endl;
  }
  else cout<<-1<<endl;

  return 0;
}

Measured memory_bytes: 3644
/*
 * C.cpp
 *
 *  Created on: 2016/07/25
 *      Author: joi
 */

#include <bits/stdc++.h>

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

using namespace std;

int N,K;

bool check[10];

bool C(int x){
	while (x){
		if (check[x%10]){
			return false;
		}
		x/=10;
	}
	return true;
}

int main(){
	cin>>N>>K;
	REP(i,K){
		int d;
		cin>>d;
		check[d]=true;
	}
	while (!C(N)){
		N++;
	}
	cout<<N<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
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; }

ll f[1000000] = {};

ll fib(ll i) {
    if (i < 2)return f[i];
    if (f[i] != 0)return f[i];
    return f[i] = (fib(i - 1) + fib(i - 2)) % mod;
}
int main() {
    f[0] = 0; f[1] = 1;
    int n, m;
    cin >> n >> m;
    VI a(m+2);
    a[0] = -1;
    eFOR1(i, m)cin >> a[i];
    a[m + 1] = n + 1;
    ll ans = 1;
    vector<ll> b;
    FOR(i, m + 1) {
        if (a[i + 1] - a[i] == 1) {
            cout << 0 << endl;
            return 0;
        }
        if (a[i + 1] - a[i])b.push_back(a[i + 1] - a[i] - 1);
    }
    for (ll i : b) {
        ans *= fib(i);
        ans %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4096
h,w = list(map(int, input().split()))
b = [input() + '#' for _ in range(h)]
b.append('#' * (w + 1))
ans = [[0]*w for _ in range(h)]

for r in range(h):
    c = 0
    while c < w:
        if b[r][c] == '#':
            c += 1
        else:
            st = c
            while b[r][c] == '.':
                c += 1
            for i in range(st, c):
                ans[r][i] += (c - st)

for c in range(w):
    r = 0
    while r < h:
        if b[r][c] == '#':
            r += 1
        else:
            st = r
            while b[r][c] == '.':
                r += 1
            for i in range(st, r):
                ans[i][c] += (r - st)

import itertools
print(max(itertools.chain.from_iterable(ans))-1)


Measured memory_bytes: 111188
if(__name__ =="__main__"):
    N = int(input())
    a =[int(i) for i in input().split()]
    b = []
    for i in range(N-1,-1,-2):
        b.append(a.pop(i))
        #print(b)
        # b = b[::-1] TLE:O(N)    
        #print(b)
    b.extend(a)
    print(' '.join(map(str,b)))

Measured memory_bytes: 27972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

int main(){
    int h, w;   cin >> h >> w;
    map<ll, ll> key;
    REP(i, h) REP(j, w){
        char c; cin >> c;
        key[c-'a'] += 1;

    }

    int four=0, two=0, one=0;
    for(auto c: key){
        if(c.second%4==0) four += 1;
        else if(c.second%4==2) two += 1;
        else one += 1;
    }
    one -= w%2*h%2;
    
    int x=0;
    if(h%2 == 1) x += w / 2;
    if(w%2 == 1) x += h / 2;
  
    
    string ans="Yes";
    if(0<one || x<two) ans="No";
    //cout << one << two << four << endl;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
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;
}
const int MOD = 1000000007;

int main() {
    int N;
    string s;
    cin >> N >> s;
    int ans = 0;
    rep(i, 0, N - 1) {
        set<char> se1;
        set<char> se2;
        rep(j, 0, N) {
            if(i >= j) {
                se1.insert(s[j]);
            } else {
                se2.insert(s[j]);
            }
        }
        int syu = 0;
        for(auto ss : se1) {
            if(se2.count(ss) != 0) {
                syu++;
            }
        }
        chmax(ans, syu);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n,m,x = map(int,input().split())
ca = [list(map(int,input().split())) for i in range(n)]

c = [0]*n
a = [0]*n

for i in range(n):
    c[i],a[i] = ca[i][0],ca[i][1:]

INF = 10**9
ans  = INF

for i in range(1<<n):
    understanding = [0]*m
    cost = 0
    for j in range(n):
        if ((i>>j)&1):
            cost += c[j]
            for k in range(m):
                understanding[k] += a[j][k]
    ok = True
    for s in range(m):
        if understanding[s] < x:
            ok = False
    if ok:
        ans = min(ans, cost)

if ans == INF:
    ans = -1

print(ans)


Measured memory_bytes: 9084
#include<stdio.h>
#include<string.h>
int main() {

	
	int i,a, b, k;

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


	for (i = 0; i < k; i++) {
		if (i % 2) {
			b /= 2;
			a += b;
		}
		else {
			a /= 2;
			b += a;
		}
	}
	printf("%d %d", a, b);
	return 0; 
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define mt make_tuple;
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  int n,m;
  cin >> n >> m;
  int a[n];
  priority_queue<int > q;
  rep(i,n){
    cin>>a[i];
    q.push(a[i]);
  }
  while(m--){
    int t=q.top();q.pop();
    //    cout << t << endl;
    q.push(t/2);
  }
  ll ans=0;
  rep(i,n){
    ans+=q.top();q.pop();
    //    cout << ans << endl;
  }
  cout << ans << endl;
  return 0;
    

}


Measured memory_bytes: 1148
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
    int n;
    cin>>n;
    cout<<n/3<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> P;
const LL MOD = 1000000007LL;
LL a[1000];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> a[i];
	LL even = 0, odd = 0;
	for (int i = 0; i < N; i++) {
		if (a[i] <= 0) continue;
		if (i % 2 == 0) even += a[i];
		else odd += a[i];
	}
	if (odd == 0 && even == 0) {
		int pos = 0;
		for (int i = 0; i < N; i++) if (a[pos] < a[i]) pos = i;
		cout << a[pos] << endl;
		cout << N - 1 << endl;
		for (int i = 0; i < pos; i++) cout << 1 << endl;
		for (int i = pos + 1; i < N; i++) cout << N - i + 1 << endl;
		return 0;
	}
	cout << max(even, odd) << endl;
	vector<int> ans;
	vector<int> sel;
	if (odd <= even) {
		for (int i = 0; i < N; i += 2) if (a[i] > 0) sel.push_back(i);
	}
	else {
		for (int i = 1; i < N; i += 2) if (a[i] > 0) sel.push_back(i);
	}
	for (int i = 0; i < N - sel.back() - 1; i++) ans.push_back(N - i);
	for (int i = 0; i < sel[0]; i++) ans.push_back(1);
	for (int i = 1; i < sel.size(); i++) {
		for (int j = 0; j < (sel[i] - sel[i - 1]) / 2 - 1; j++) ans.push_back(3);
		ans.push_back(2);
	}
	cout << ans.size() << endl;
	for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int n,m;
    cin >> n;
    vector<int> t(n);
    rep(i,n) cin >> t[i];
    cin >> m;
    vector<int> p(m),x(m);
    rep(i,m) cin >> p[i] >> x[i];
    ll total = 0;
    rep(i,n) total += t[i];
    rep(i,m){
        cout << total + x[i] - t[p[i]-1] << endl;
    }
    return 0;
}

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

using namespace std;

string s;
int k;

int main()
{
	cin >> s >> k;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == 'a') continue;
		if (k >= 'z' + 1 - s[i])
		{
			k -= 'z' + 1 - s[i];
			s[i] = 'a';
		}
	}
	int last = s.length()-1;
	s[last] = (s[last] - 'a' + k % 26) % 26 + 'a';
	cout << s << '\n';
	return 0;
}



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

#define    int               long long int
 #define    bp(x)         __builtin_popcount(x)
#define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}

int32_t main()
{
    fast
    int n,x,ff=0;  cin>>n;
    int a[n+1],b[n+1];
    multiset<int>s,s2,s3;
    multiset<int> :: iterator it;
    f(i,1,n)    cin>>a[i];
    f(i,1,n){
        cin>>x;
        s.insert(x);
        s2.insert(x);
        s3.insert(x);
    }
    f(i,1,n){
        it=s.upper_bound(a[i]);
        if(it!=s.end() && *it!=a[i]){
            b[i]=*it;
            s.erase(it);
        }
        else if(*(s.begin())!=a[i]){
            b[i]=*(s.begin());
            s.erase(s.begin());
        }
        else    ff=1;
    }
    if(ff){
        ff=0;
        f(i,1,n){
            it=s2.end();
            it--;
            if(*(s2.begin())!=a[i]){
                b[i]=*(s2.begin());
                s2.erase(s2.begin());
            }
            else if(*it!=a[i]){
                b[i]=*it;
                s2.erase(it);
            }
            else    ff=1;
        }
        if(ff)
        {
            ff=0;
            f(i,1,n){
                it=s3.end();
                it--;
                if(*it!=a[i]){
                    b[i]=*it;
                    s3.erase(it);
                }
               else  if(*(s3.begin())!=a[i]){
                    b[i]=*(s3.begin());
                    s3.erase(s3.begin());
                }
                else    ff=1;
            }
            if(ff)  cout<<"No";
            else{
                cout<<"Yes\n";
                f(i,1,n)    cout<<b[i]<<" ";
            }
        } 
        else{
            cout<<"Yes\n";
        f(i,1,n)    cout<<b[i]<<" ";
        }
    }
    else{
        cout<<"Yes\n";
        f(i,1,n)    cout<<b[i]<<" ";
    }
}

Measured memory_bytes: 34888
#include<stdio.h>
#include<map>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int p[200008];
int main(){
  int n;
  scanf("%d",&n);
  for(int i=1;i<=n;i++)
    scanf("%d",p+i);
  sort(p+1,p+n+1);
  int x=n/2;
  x=p[x+1]-p[x];
 // x--;
  printf("%d\n",x);
}


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

int main(){
	int a,b,c;
	int ans;
	bool flg;
	int cnt=-1;
	
	while(cin>>a>>b){
		cnt++;flg=false;
		//-----test-----
		if(cnt==105) break;
		//--------------
		c=a+b;
		ans=1;
		while(10<=c){
			c/=10;
			ans++;
		}
		cout<<ans<<endl;
	}
	
	return 0;
}

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

int main() {
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;

  int ans = 0;
  if (a == 0) ans = 1;
  if (b == 0) ans = 2;
  if (c == 0) ans = 3;
  if (d == 0) ans = 4;
  if (e == 0) ans = 5;

  cout << ans << endl;
}


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

class P {
public:
  double x, y;
};

void Koch(int n, P p1, P p2) {
  if (!n) return;

  const double PI = acos(-1.0);
  P s, t, u;
  s.x = (2 * p1.x + p2.x) / 3;
  s.y = (2 * p1.y + p2.y) / 3;
  t.x = (p1.x + 2 * p2.x) / 3;
  t.y = (p1.y + 2 * p2.y) / 3;
  u.x = (t.x - s.x) * cos(60 * PI / 180) - (t.y - s.y) * sin(60 * PI / 180) + s.x;
  u.y= (t.x - s.x) * sin(60 * PI / 180) + (t.y - s.y) * cos(60 * PI / 180) + s.y;

  Koch(n - 1, p1, s);
  cout << s.x << " " << s.y << endl;
  Koch(n - 1, s, u);
  cout << u.x << " " << u.y << endl;
  Koch(n - 1, u, t);
  cout << t.x << " " << t.y << endl;
  Koch(n - 1, t, p2);
}

int main() {
  int n; cin >> n;
  P p1, p2;
  p1.x = 0; p1.y = 0;
  p2.x = 100; p2.y = 0;

  cout << p1.x << " " << p1.y << endl;
  Koch(n, p1, p2);
  cout << p2.x << " " << p2.y << endl;

  return 0;
}


Measured memory_bytes: 3252
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fastio ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
//const long long INF64 = 1'000'000'000'000'000'000ll;
#define MOD 1000000007
double pow(double a, int n){
    double ret =1;
    while(n){
        if(n%2==1)ret*=a;
        a*=a;
        n/=2;
    }
    return ret;
}
const int MAX_SIZE = 1000001; 
vector<int >isprime(MAX_SIZE , true); 
vector<int >prime; 
vector<int >SPF(MAX_SIZE); 
void manipulated_seive(int N) 
{ 
	 isprime[0] = isprime[1] = false ; 
	 for (int i=2; i<N ; i++) 
	 { 
		 if (isprime[i]) 
		 { 
			 prime.push_back(i); 
			 SPF[i] = i; 
		 } 
		 
		 for (int j=0;j < (int)prime.size() && i*prime[j] < N && prime[j] <= SPF[i];j++) 
		 { 
			 isprime[i*prime[j]]=false; 
			 SPF[i*prime[j]] = prime[j] ; 
		 } 
	 } 
}
#undef int
int main() {
    #define int long long
    //fastio;
    int n;
	cin>>n;
	int arr[n],b[n+1];
	for(int i=0;i<n;i++){
		cin>>arr[i];
		b[arr[i]]=i+1;
	}
	for(int i=1;i<=n;i++){
		cout<<b[i]<<" ";
	}

    return 0;
}


Measured memory_bytes: 18048
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<int> A(X), B(Y), C(Z);
    REP (i, X) cin >> A[i];
    REP (i, Y) cin >> B[i];
    REP (i, Z) cin >> C[i];
    sort(A.begin(), A.end(), greater<int>());
    sort(B.begin(), B.end(), greater<int>());
    sort(C.begin(), C.end(), greater<int>());
    vector<int> v;
    REP (i, X) REP (j, Y) v.push_back(A[i] + B[j]);
    sort(v.begin(), v.end(), greater<int>());
    vector<int> w;
    REP (i, min(3000LL, (int)v.size())) REP (j, Z) {
        w.push_back(v[i] + C[j]);
    }
    sort(w.begin(), w.end(), greater<int>());
    REP (i, K) cout << w[i] << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 43368
import java.util.Scanner;
import java.lang.Math;

public class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n; n =in.nextInt();
		int[] h = new int[n];
		for(int i=0;i<n;i++) h[i]=in.nextInt();
		int[] dp = new int[n];
		for(int i=0;i<n;i++) dp[i]=1000000000;
		dp[0]=0;
		for(int i=1;i<n;i++)
		{
			if(i>=2) dp[i]=Math.min(dp[i-1]+Math.abs(h[i]-h[i-1]), dp[i-2]+Math.abs(h[i]-h[i-2]));
			else dp[i]=dp[i-1]+Math.abs(h[1]-h[0]);
		}
		//for(int i=0;i<n;++i) System.out.println(dp[i]);
		System.out.print(dp[n-1]);
	}
}


Measured memory_bytes: 50600
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>


#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;


double A[2][2];
double C[2];


int main()
{
	while (cin >> A[0][0] >> A[0][1] >> C[0] >> A[1][0] >> A[1][1] >> C[1]){
		double t = A[1][0] / A[0][0];
		A[1][0] -= A[0][0] * t;
		A[1][1] -= A[0][1] * t;
		C[1] -= C[0] * t;

		t = A[0][1] / A[1][1];
		A[0][1] -= A[1][1] * t;
		C[0] -= C[1]*t;

		printf("%.3lf %.3lf\n", C[0] / A[0][0], C[1] / A[1][1]);
	}




}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using vl = vector<long long>;
using P = pair<long long,long long>;
 
int main(){
	ll x,y,z; cin >> x >> y >> z;
	cout << z << " "<< x << " " << y << endl;
}

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

public class Main{
	
	private static int N;
	public static void main(String args[]) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		N = Integer.parseInt(br.readLine());
		
		for(int i=0;i<N;i++){
			int a, b, c;
			String line = br.readLine();
			String[] arrays = line.split(" ");
			
			a = (int)Math.pow(Integer.parseInt(arrays[0]),2);
			b = (int)Math.pow(Integer.parseInt(arrays[1]),2);
			c = (int)Math.pow(Integer.parseInt(arrays[2]),2);
			
			if(a+b==c || a+c==b || b+c==a){
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}
		}
	}
}

Measured memory_bytes: 20172
#include <bits/stdc++.h>
#define LL long long
#define N 100010
using namespace std;

LL n, k, a[N], cnt[2];

int main() {
    cin >> n >> k;
    for(int i=0; i<n; i++)
        cin >> a[i];

    LL ans = 0;
    for(LL kk=40; kk>=0; kk--) {
        cnt[0] = 0;
        cnt[1] = 0;
        for(int i=0; i<n; i++) {
            cnt[ a[i]>>kk&1LL ]++;
        }
        if(cnt[0]>cnt[1] && ans+(1LL<<kk)<=k) {
            ans += (1LL<<kk);
        }
    }

    LL sum = 0;
    for(int i=0; i<n; i++)
        sum += ans^a[i];
    cout << sum << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> ii;

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

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

    int ma = a[0], mb = b[0], mc = c[0];
    for (int i = 1; i < n; ++i) {
      int na = max(mb, mc) + a[i];
      int nb = max(ma, mc) + b[i];
      int nc = max(mb, ma) + c[i];
      ma = na, mb = nb, mc = nc;
    }
    cout << max(max(ma, mb), mc) << endl;

    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int lcm(int a, int b) {
    if (a%b == 0) {
        return b;
    } else {
        return lcm(b, a%b);
    }
}
int main() {
    int n;
    cin >> n;
    int result;
    cin >>result;
    for (int i=0; i<n-1; i++) {
        int a;
        cin >> a;
        result = lcm(result, a);
    }
    cout << result << endl;
}

Measured memory_bytes: 3628
// Enjoy your stay.

#include <bits/stdc++.h>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define mt make_tuple
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)(x).size())

using namespace std;

typedef istringstream iss;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef stringstream sst;
typedef vector<ll> vi;

//
int par_uf[100010],rank_uf[100010];

void init(int n){for(int i=0;i<n;i++){par_uf[i]=i;rank_uf[i]=0;}}
int find(int x){if(par_uf[x]==x)return x;else return par_uf[x]=find(par_uf[x]);}
void unite(int x,int y){x=find(x);y=find(y);if(x==y)return;if(rank_uf[x]<rank_uf[y])par_uf[x]=y;else{par_uf[y]=x;if(rank_uf[x]==rank_uf[y])rank_uf[x]++;}}
bool same(int x,int y){return find(x)==find(y);}
//

int N,H,W;
vi row[100010],col[100010];
int p[40010];

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	cin>>N>>W>>H;
	int border = 0;
	rep(i,N){
		int y,x;
		cin>>x>>y;
		x--;y--;
		row[y].pb(i);
		col[x].pb(i);
		if(y==0 || y==H-1 || x==0 || x==W-1)border = 1;
	}

	init(N);
	rep(i,H){
		rep(j,sz(row[i])-1){
			unite(row[i][j],row[i][sz(row[i])-1]);
		}
	}
	rep(j,W){
		rep(i,sz(col[j])-1){
			unite(col[j][i],col[j][sz(col[j])-1]);
		}
	}
	rep(i,N){
		p[find(i)]=1;
	}
	int C = 0;
	rep(i,N){
		C += p[i];
	}
	if(C == 1) cout << N-1 << endl;
	else if(border) cout << N-1 + C-1 << endl;
	else cout << N-1 + C << endl;
}

Measured memory_bytes: 8472
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define all(a)  (a).begin(),(a).end()

int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}

int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int kaijou(int a){
  int b=1;
  fo(i,a)
    b*=i+1;
  return b;
}

int lcm(int a,int b){
  return a*b/gcd(a,b);
}
signed main(){
  double n,k;
  cin>>n>>k;
  double ans=0;
  double c=1.0/n;
  for(int i=1; i<=n; i++){
    double a=0;
    int b=i;

    while(b<k){
      b*=2;
      a++;
    }
    ans+=c*(pow(1.0/2,a));
  }
  cout<<yuko(14)<<ans<<endl;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);

        StringBuilder sb = new StringBuilder();
        for(int n = scn.nextInt(); n > 0; n--) {
            sb.append(scn.next());
        }

        String src = sb.toString();
        int ans = -1;
        while(src.indexOf(String.valueOf(++ans)) >= 0);
        System.out.println(ans);
    }
}

Measured memory_bytes: 30248
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
typedef long long ll;
const int KTINF = 1e9+7;

int main(int argc, char **argv)
{
	int n, a[110], i;
	char *sp = "";
	scanf("%d", &n);
	if (n == 0) return 0;
	for (i = 0; i < n; i++) {
		scanf("%d", a + i);
	}
	for (i = 0; i < n; i++) {
		printf("%s%d", sp, a[n - i - 1]);
		sp = " ";
	}
	putchar('\n');

	return 0;
}

Measured memory_bytes: 600