akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
  
#define mp make_pair
#define s second 
#define f first
#define ll long long
#define pb push_back
  
using namespace std;
/*
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  */
const int inf = 2e9+7;
const int N = 2e6;

vector<ll>m(N, 9223372036854775800);
int used[N];
 
int xx[8]={1, 1, -1, -1, 2, 2, -2, -2};
int yy[8]={2, -2, 2, -2, 1, -1, 1, -1};

int main(){
	used[0]=1;
	m[0]=0;
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
	int n, k;
	cin >> n >> k;
	for(int i=0; i<n ;i++){
		ll a, b;
		cin >> a >> b;
		for(int i=1e5+1; i>=0; i--){
			if(used[i]){
				used[i+b]=1;
				m[i+b]=min(m[i]+a, m[i+b]);
			}
		}
	}
	int mx=0;
	for(int i=0; i<=1e5+1; i++){
	
		if(m[i]<=k)
			mx=i;
	}
	cout << mx;
    return 0;
}



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


int main()
{
	double r;
	double pi = 3.141592653589;
	cin >> r;
	double s = r * r * pi;
	double l = r * 2 * pi;
	printf("%.6lf %.6lf\n", s, l);
	return 0;
}

Measured memory_bytes: 1240
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		ABC060BSolver solver = new ABC060BSolver();
		solver.main();
	}
}

class ABC060BSolver {
	
	int A;
	int B;
	int C;
	
	public ABC060BSolver() {
		Scanner cin = new Scanner(System.in);
		this.A = cin.nextInt();
		this.B = cin.nextInt();
		this.C = cin.nextInt();
	}
	
	void main() {
		for (int i = 1; i <= B; i++) {
			if (A*i % B == C) {
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
	}
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  for(int i=1;i<=9;i++)
  {
    for(int j=1;j<=9;j++)
    {
      if((i*j)==n)
      {
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  
  cout<<"No"<<endl;
  
  return 0;
}

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

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

  string ans = "";
  for (char c : S) {
    if (c == '0' || c == '1') {
      ans += c;
    } else if (c == 'B' && ans.size() != 0) {
      ans.erase(ans.size() - 1);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int md=1000000007,N=400005;
struct node
{
	int x,v;
}a[N];
int n,i,j,k,v1[N],v2[N],lt,rt,mid,l[N],r[N],mx[N],f[N],s[N];
bool cmp(node a,node b)
{
	return a.x<b.x;
}
int main()
{
	scanf("%d",&n);
	for(i=1;i<=n;++i)
		scanf("%d%d",&a[i].x,&a[i].v);
	sort(a+1,a+1+n,cmp);
	v1[1]=a[1].v;
	for(i=2;i<=n;++i)
		v1[i]=max(v1[i-1],a[i].v);
	v2[n]=a[n].v;
	for(i=n-1;i>=1;--i)
		v2[i]=min(v2[i+1],a[i].v);
	for(i=1;i<=n;++i)
	{
		lt=1,rt=i;
		while(lt<rt)
		{
			mid=lt+rt>>1;
			if(v1[mid]<a[i].v)
				lt=mid+1;
			else
				rt=mid;
		}
		l[i]=lt;
		lt=i,rt=n;
		while(lt<rt)
		{
			mid=lt+rt+1>>1;
			if(v2[mid]>a[i].v)
				rt=mid-1;
			else
				lt=mid;
		}
		r[i]=lt;
		//printf("%d %d\n",l[i],r[i]);
		mx[r[i]]=max(mx[r[i]],l[i]);
	}
	//return 0;
	s[0]=f[0]=1;
	for(i=1;i<=n+1;++i)
	{
		mx[i]=max(mx[i],mx[i-1]);
		f[i]=(s[i-1]-(mx[i-1]==0?0:s[mx[i-1]-1])+md)%md;
		//for(j=mx[i-1];j<i;++j)
			//f[i]=(f[i]+f[j])%md;
		s[i]=(s[i-1]+f[i])%md;
	}
	printf("%d",f[n+1]);
	return 0;
}


Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;
template<class T>void sort(vec<T> &v){sort(v.begin(),v.end());}
template<class T>void rsort(vec<T> &v){sort(v.rbegin(),v.rend());}
const ll mod = 1e9+7;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,k; cin >> n >> k;
    vec<ll> a(n); rep(i,n){cin >> a[i]; --a[i];}
    vec<ll> cycle; set<ll> s;
    ll to = 0;
    while(true){
        if(s.count(to))break;
        cycle.push_back(to); s.insert(to);
        to = a[to];
    }
    ll start;
    rep(i,cycle.size()){
        if(cycle[i] == to)start = i;
    }
    if(k < start){
        cout << cycle[k]+1 << endl;
        return 0;
    }
    k -= start;
    ll m = cycle.size() - start;
    cout << cycle[start + k%m]+1 << endl;
}

Measured memory_bytes: 15496
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int inf = scan.nextInt();
		int sup = scan.nextInt();
		int num = scan.nextInt();
		int count = 0;
		
		if (inf < 1 || sup < 1 || num < 1 || inf > 10000 || sup > 10000 || num > 10000 || inf > sup) {
			System.out.println("Error!");
		}
		
		for (int i = inf; i <= sup; i++) {
			if ((num % i) == 0) {
				count++;
			}
		}
		
		System.out.println(count);
	}

}

Measured memory_bytes: 17316
eval"N,K,*A="+`dd`.split*?,
s,*l=eval A*?+
1.upto(3e4){|j|s%j<1&&l<<j<<s/j}
p l.select{|h|t=0
K>=A.map{|x|x%h}.sort.map{|x|t+=x}[-t/h-1]}.max

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

string S;


int main() {
 cin >> S;
  
  int count0 = 0;
  int count1 = 0;
 for (auto s : S) { 
   if (s == '0') count0++;
 }
 count1 =   S.length() - count0;
  
  cout << 2 * min(count0,count1) << endl;
}

Measured memory_bytes: 512
import sys

input = sys.stdin.readline


def main():
    K, Q = map(int, input().split())
    D = list(map(int, input().split()))

    for _ in range(Q):
        n, x, m = map(int, input().split())
        md = [D[i] % m for i in range(K)]
        smda = 0
        mda0 = 0
        for i in range((n - 1) % K):
            if md[i] == 0:
                mda0 += 1
            smda += md[i]
        smd = smda
        md0 = mda0
        for i in range((n - 1) % K, K):
            if md[i] == 0:
                md0 += 1
            smd += md[i]
        roop = (n - 1) // K
        res = n - 1 - (x % m + smd * roop + smda) // m - md.count(0) * roop - mda0
        print(res)


main()


Measured memory_bytes: 61788
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a%b)

N, x = map(int, input().split())
X = list(map(int, input().split()))

dif = []

for n in range(N):
    dif.append(abs(x - X[n]))

ans = dif[0]

for n in range(1, N):
    ans = gcd(ans, dif[n])

print(ans)

Measured memory_bytes: 14252
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final long a = scanner.nextLong();
        final long b = scanner.nextLong();

        final long gcd = computeGCD(a, b);
        System.out.println(a * b / gcd);
    }

    private static long computeGCD(final long a, final long b) {
        if (b > a) {
            return computeGCD(b, a);
        }

        if (b == 0) {
            return a;
        }

        return computeGCD(b, a % b);
    }
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> ii;
const int ms = 2e3+9;
int dist[ms], n, m, a,b,c;
int inf = 0x3f3f3f3f3f3f3f3f;
vector<ii> g[ms];

void solve(){
	for(int i = 0;i<ms;i++) dist[i] =-inf;
	dist[1] = 0;
	
	for(int i = 0;i<n-1;i++){
		for(int j = 1;j<=n;j++){
			for(auto it: g[j]){
				if(dist[it.first] < dist[j] + it.second){
					dist[it.first] = dist[j] + it.second;
				}
			}
		}
	}
	int val = dist[n];
	
	for(int j = 1;j<=n;j++)
		for(auto it: g[j]){
			if(dist[it.first] < dist[j] + it.second)
				dist[it.first] = dist[j] + it.second;
		}
	int val2 = dist[n];
	if(val < val2)
		cout<<"inf";
	else
		cout<<val;
	
}

main(){
	cin >> n >> m;
	for(int i = 0;i<m;i++){
		cin >> a >> b >> c;
		g[a].push_back({b,c});
	}
	solve();
}

Measured memory_bytes: 384
a, b, c, n = map(int, input().split())
aa =[a,b,c]
aa.sort()
r = aa[2]
g = aa[1]
b = aa[0]
 
count = 0
for i_r in range(0,int(n/r)+1):
    if (n - r*i_r)<0:continue
    for i_g in range(0,int((n-r*i_r)/g)+1):
        if (n - r*i_r - g*i_g)<0:continue
        if 0==((n - r*i_r - g*i_g)%b):
 
            count = count + 1
 
print(count)

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

int main() {

  string a;
  cin >> a;
  int ans = 0;
  
  rep(i,a.size()/2) {
    if(a[i] != a[a.size() - 1 - i]) ans++;
  }
  
  cout << ans << endl;

}


Measured memory_bytes: 384
n = int(input())
L = [[] for _ in range(n)]
for i in range(n):
    L[i] = [i for i in map(int,input().split())]
    L[i].remove(L[i][0])
    if L[i] != []:
        L[i].remove(L[i][0])
for i in range(n):
    adjacent = [0 for _ in range(n)]
    for el in L[i]:
        adjacent[el-1] = 1
    print(' '.join(map(str,adjacent)))


Measured memory_bytes: 5612
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int mod = (int) 1e9 + 7;
const int MAXN = 105000;

int n, m;
vector <int> divs;
map<int, long long> dp[50];
long long f[MAXN];
long long invf[MAXN];
long long sum[MAXN];

long long binpow(long long x, long long p) {
  long long res = 1;
  while (p) {
    if (p & 1) {
      res = (res * x) % mod;
      p--;
    } else {
      x = (x * x) % mod;
      p /= 2;
    }
  }
  return res % mod;
}

long long inv(long long x) {
  return binpow(x, mod - 2) % mod;
}

long long calc(long long x, int num) {
  if (dp[num].count(x)) {
    return dp[num][x];
  }
  if (num == 1) {
    dp[num][x] = 1;
    return 1;
  }

  long long res = 0;
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      res = (res + calc(x / i, num - 1)) % mod;
      if (x / i != i) {
        res = (res + calc(i, num - 1)) % mod;
      }
    }
  }

  dp[num][x] = res;
  return res;
}

int main() { 

  cin >> n >> m;
  if (m == 1) {
    cout << 1 << endl;
    return 0;
  }

  for (int i = 1; i <= 30; i++) {
    sum[i] = calc(m, i);
  }

  f[0] = 1;
  invf[0] = 1;
  for (int i = 1; i <= n; i++) {
    f[i] = 1ll * f[i - 1] * i % mod;
    invf[i] = inv(f[i]);
  }

  long long ans = 0;
  for (int i = 1; i <= min(30, n); i++) {
    // cerr << sum[i] << endl;
    long long cur = f[n] * invf[i] % mod;
    cur = cur * invf[n - i] % mod;
    cur = cur * sum[i] % mod;
    // cerr << cur << endl;
    ans = (ans + cur) % mod;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3584
#include<stdio.h>
 
int main(void){
  int flag,i,n,a[100],count=0,temp,j;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);
  flag=1;
  j=0;
  while(flag){
    flag=0;
    for(i=n-1;i>=j+1;i--){
      if(a[i]<a[i-1]){
    temp=a[i];
    a[i]=a[i-1];
    a[i-1]=temp;
    count++;
    flag=1;
      }
    }
    j++;
  }
  for(i=0;i<n;i++){
    if(i==n-1) printf("%d\n",a[i]);
    else printf("%d ",a[i]);
  }
  printf("%d\n",count);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           return  0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    return Parent[a] = root(Parent[a]);
  }

  bool issame(int a, int b){
    return root(a) == root(b);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);

    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

int main(){
  int a,b; cin >> a >> b;
  bool ok[4];
  rep(i,4) ok[i] = true;
  ok[a] = ok[b] = false;
  for(int i = 1; i < 4; i++) {
    if(ok[i]) cout << i << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
double P[9];
int i;
int f(int a,int b,int c,int d){return (P[a]<=P[b]&&P[b]<=P[d])||(P[a]<=P[c]&&P[c]<=P[d]);}
int main()
{
	for(i=0;~scanf("%lf",&P[i]);i=(i+1)%8)
	{
		if(i%8==7)
			puts(((f(0,4,6,2)||f(4,0,2,6))&&(f(1,5,7,3)||f(5,1,3,7)))?"YES":"NO");
	}
	return 0;
}

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

int main(){
    while(1){
        int h,w;
        cin>>h>>w;
        if(h==0) break;
        for(int i=1;i<=h;i++){
            for(int j=1;j<=w;j++){
                if(i==1 || i==h || j==1 || j==w){
                    cout<<"#";
                }else{
                    cout<<".";
                }
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3084
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static int N;
    static int[] A;
    static int MAX1;
    static int MAX2;
    static void Main(string[] args)
    {
        var s = new Scanner();

        N = s.ReadInt();
        A = new int[N];
        for (int i = 0; i < N; i++)
        {
            A[i] = s.ReadInt();
            if (MAX1 < A[i])
            {
                MAX2 = MAX1;
                MAX1 = A[i];
            }
            else
            {
                MAX2 = Math.Max(MAX2, A[i]);
            }
        }

        Solve();
    }

    static void Solve()
    {
        foreach (var ai in A)
        {
            if (MAX1 == ai)
            {
                Console.WriteLine(MAX2);
            }
            else
            {
                Console.WriteLine(MAX1);
            }
        }
    }
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }

    public string ReadStr()
    {
        return this.Next();
    }

    public char ReadChar()
    {
        return this.Next()[0];
    }

    public int ReadInt()
    {
        return int.Parse(this.Next());
    }

    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }

    public long ReadLong()
    {
        return long.Parse(this.Next());
    }

    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }

    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }

    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }

    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}



Measured memory_bytes: 17332
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[List[int]]"):
    import numpy as np
    from scipy.sparse.csgraph import floyd_warshall
    A = np.array(A, dtype=np.float64)
    B = floyd_warshall(A, directed=True)
    if not np.array_equal(A, B):
        return -1
    delta = 1e-3
    _, pre = floyd_warshall(A-delta+np.identity(N)*delta, return_predecessors=True)
    return int(A[pre == [[i]*N for i in range(N)]].sum()) // 2

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [[int(next(tokens)) for _ in range(N)] for _ in range(N)]  # type: "List[List[int]]"
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


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

int main(){
    int h, m, s, hh, mm, ss;
    while(cin >> h >> m >> s >> hh >> mm >> ss){
        s = h * 3600 + m * 60 + s;
        ss = hh * 3600 + mm * 60 + ss;
        ss -= s;
        cout << ss /3600 << " " << (ss%3600)/60 << " " << ss%60<<endl;
    }
    return 0;
}

Measured memory_bytes: 3112
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
#include<cstdlib>
#include<iostream>
using namespace std;
int glid[102][102];
int cnt;
int W,H;
int dx[2][6]={{-1,0,1,0,-1,-1},
			  {0,1,1,1,0,-1}
	   };
int dy[2][6]={{-1,-1,0,1,1,0},
			  {-1,-1,0,1,1,0}
	   };
void func(int,int);
int main(void)
{
	int i,j,k,xx,yy;
	cin>>W>>H;
	for(i=1;i<=H;i++) {
		for(j=1;j<=W;j++) {
			cin>>glid[i][j];
		}
	}
	for(i=0;i<=H;i++){
		glid[i][0]=0;
		glid[i][W+1]=0;
	}
	for(i=0;i<=W;i++) {
		glid[0][i]=0;
		glid[H+1][i]=0;
	}
	cnt=0;
	func(0,0);
	cout<<cnt<<endl;
	return 0;
}
void func(int x,int y)
{
	int i,j,k,xx,yy,ff;
	glid[y][x]=-1;
	for(i=0;i<6;i++) {
		xx=x+dx[y%2][i];
		yy=y+dy[y%2][i];
		if(xx<=W+1 && xx>=0 && yy<=H+1 && yy>=0 && glid[yy][xx]==1) cnt++;
		if(xx<=W+1 && xx>=0 && yy<=H+1 && yy>=0 && glid[yy][xx]==0) func(xx,yy);
		
	}
}

Measured memory_bytes: 3364
#include<iostream>
#include<list>
#include<algorithm>
#include<string>
using namespace std;

int main()
{
    int n;
    cin >> n;
    string s;
    int key;
    list<int> L;
    for(int i=0;i<n;i++){
        cin >> s;
        if(s == "insert"){
            cin >> key;
            L.push_front(key);
        }
        else if(s == "delete"){
            cin >> key;
            for(list<int>::iterator it = L.begin(); it != L.end();it++){
                if(*it == key){
                    L.erase(it);
                    break;
                }
            }
        }
        else if(s == "deleteFirst"){
            L.pop_front();
        }
        else if(s == "deleteLast"){
            L.pop_back();
        }
    }
    for(list<int>::iterator it = L.begin();it != L.end();it++){
        if(it != L.begin())
            cout << ' ';
        cout << *it;
    }
    cout << endl;
}


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

using namespace std;

#define MAX 1510

int H,W;
int mat[MAX][MAX];
int dp[MAX][MAX];

int getLargestSquare(){
  int res = 0;
  for(int i = 0 ; i < W ; i++){
    dp[0][i] = !(mat[0][i] == 1);
    res = max(res,(int)(mat[0][i] == 0));
  }
  for(int i = 0 ; i < H ; i++){
    dp[i][0] = !(mat[i][0] == 1);
    res = max(res,(int)(mat[0][i] == 0));
  }
  for(int i = 1 ; i < H ; i++){
    for(int j = 1 ; j < W ; j++){
      if(mat[i][j] == 1){
        dp[i][j] = 0;
      }else{
        dp[i][j] = min(dp[i-1][j-1],min(dp[i-1][j],dp[i][j-1])) + 1;
        res = max(dp[i][j],res);
      }
    }
  }
  return res*res;
}

int main(){
  cin >> H >> W;
  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      cin >> mat[i][j];
    }
  }
  cout << getLargestSquare() << endl;
  return 0;
}

Measured memory_bytes: 18328
num = gets.to_i
chars = []
num.times do |i|
  str = gets.chomp
  chars << str
end

chars.sort!

prev_str = ""
array = Array.new(chars.uniq.size, 1)
strings = Array.new(chars.uniq.size)
index = 0

(0..(num - 1)).each do |i|
  next_str = chars[i + 1]
  if chars[i] == next_str
    array[index] += 1
    strings[index] = chars[i]
  elsif chars[i] != next_str
    strings[index] = chars[i]
    index += 1
  end
end

result = [nil]
popular_str_count = 0

chars.uniq.size.times do |i|
  popular_str_count ||= array[i]
  
  if popular_str_count < array[i]
    popular_str_count = array[i]
    result = [strings[i]]
  elsif popular_str_count == array[i]
    result.push(strings[i])
  end
end
    
result.sort.each do |str|
  puts str
end


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
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; }
//end



int main(){
   int n; scanf("%d",&n);
   vector<int> a(n); rep(i,0,n)scanf("%d",&a[i]);
   int pre=-1,res=1;
   rep(i,0,n-1){
      if(a[i]<a[i+1]){
         if(pre==0){res++; pre=-1;}
         else pre=1;
      }
      if(a[i]>a[i+1]){
         if(pre==1){res++; pre=-1;}
         else pre=0;
      }
   } cout<<res<<endl;
   return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main()
{
    int a,b;
    cin >> a;
    cin >> b;
    
    int N = b-a;
    int c;
    for(int i=0 ; i<N; i++){
        c=c+i;
    }

    cout << c-a << endl; 
   
   
   return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<pair<int,int>> c(n+1);
    for(int i = 1; i <= n; i++){
        char col;
        cin >> col;
        if(col == 'R'){
            c[i].first = c[i-1].first + 1;
            c[i].second = c[i-1].second;
        }
        else{
            c[i].first = c[i-1].first;
            c[i].second = c[i-1].second + 1;
        }
    }

    int r = c[n].first;
    cout << c[r].second << endl;
}

Measured memory_bytes: 4780
// ARC099B.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 200;

typedef long long ll;

double count(ll i)
{
    ll sum = 0, x = i;
    while (x)
        sum += x % 10, x /= 10;
    return 1.0 * i / sum;
}

int main()
{
    ll k;
    scanf("%lld", &k);
    ll cnt = 0, curt = 0, base = 1;
    while (cnt < k)
        if ((curt / base) % 10 != 9)
        {
            curt += base, cnt++;
            printf("%lld\n", curt);
        }
        else
        {
            if (count(curt + base) > count(curt + base * 10))
                base *= 10;
            curt += base, cnt++;
            printf("%lld\n", curt);
        }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int ia,ma,sa,ea,ib,mb,sb,eb,S,T;
    cin >> ia >> ma >> sa >> ea >> ib >> mb >> sb >> eb ;
    S=ia+ma+sa+ea;
    T=ib+mb+sb+eb;
    if(S<T){
        cout << T << endl;
    }
    else if(S>=T){
        cout << S << endl;
    }    
    
    
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
bool check(string s, int k) {
    for (int i = 0 ; i + k < s.size() ; i++)
        if (s[i] == '1')
            s[i] ^= 1, s[i + k] ^= 1;
    if (s[s.size() - k] == '1')
        for (int i = s.size() - k ; i < s.size() ; i++)
            s[i] ^= 1;
    int cnt = 0;
    for (int i = 0 ; i < s.size() ; i++) {
        if (s[i] == '1')
            break;
        cnt++;
    }
    return cnt >= k;
}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    string s; cin >> s;
    int L = 0, R = s.size() + 1; while (R - L > 1) {
        int M = (L + R) >> 1;
        (check(s, M) ? L : R) = M;
    }
    cout << L << '\n';
}

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

int gcd(int a, int b){
    if(a<b){
        int temp = a;
        a = b;
        b = temp;
    }

    if(b==0) return a;
     return gcd(b, a%b);
}

int main(){    
    int N, X;
    cin >> N >> X;
    vector<int> x(N);
    int ans;
    for(int i=0; i<N; i++) {
        cin >> x[i];
        x[i] = abs(x[i]-X);
        if(i==0) ans = x[i];
        else ans = gcd(x[i],ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <cstdlib>
#include <cmath>
#include <fstream>

int main(void) {

	//test??¨
	//std::ifstream in("test.txt");
	//std::cin.rdbuf(in.rdbuf());

	std::string str;
	int m;
	int h;
	std::vector<std::string> ans;

	std::cin >> str;
	while (str != "-") {

		std::cin >> m;
		for (int i = 0; i < m; i++) {
			std::cin >> h;
			str += str.substr(0, h);
			str.erase(str.begin(), str.begin() + h);
		}
		ans.push_back(str);

		str.clear();
		std::cin >> str;
	}

	for (int i = 0; i < ans.size(); i++) {
		std::cout << ans[i] << std::endl;
	}

}

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

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

main(){

  ll n,m,p;
  cin>>n>>m>>p;
  weighted_edge E;
  vector<vector<ll>> adj(n);
  rep(i,m){
    ll a,b,c;
    cin>>a>>b>>c;
    a--;b--;c-=p;
    adj[a].emplace_back(b);
    E.emplace_back(a,b,-c);
  }

  vector<bool> from0(n);
  queue<ll> que;
  que.emplace(0);
  while(!que.empty()){
    auto v=que.front();
    que.pop();
    if(from0[v])continue;
    from0[v]=true;
    for(auto const& nx:adj[v]){
      que.emplace(nx);
    }
  }

  vector<ll> dist(n,INF);
  dist[0]=0;
  rep(i,n){
    for(auto const& e:E){
      chmin(dist[e.to],dist[e.from]+e.cost);
    }
  }
  vector<bool> loop(n,false);
  rep(i,n){
    for(auto const& e:E){
      if(chmin(dist[e.to],dist[e.from]+e.cost)){
        if(from0[e.from])loop[e.to]=true;
      }
    }
  }
  
  rep(i,n){
    for(auto const& e:E){
      if(from0[e.from]&&loop[e.from])loop[e.to]=true;
    }
  }

  if(loop[n-1]){
    cout<<"-1"<<endl;
  }else{
    cout<<max(0LL,-dist[n-1])<<endl;
  }

}

Measured memory_bytes: 640
N, K = map(int, input().split())
TD = sorted([list(map(int, input().split())) for i in range(N)], key=lambda x: -x[1])
q = []
ans = 0
s = set()
for i in range(K):
    ans += TD[i][1]
    if TD[i][0] in s:
        q.append(TD[i][1])
    s.add(TD[i][0])
ans += len(s) ** 2
k1 = K
ans1 = ans
while k1 < N and q:
    if TD[k1][0] not in s:
        ans1 = ans1 + TD[k1][1] - q.pop() - len(s) ** 2 + (len(s) + 1) ** 2
        ans = max(ans, ans1)
        s.add(TD[k1][0])
    k1 += 1
print(ans)

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

using lint = long long;
using ldouble = long double;

void solve() {
    int h, a;
    std::cin >> h >> a;

    int ans = 0;
    while (h > 0) {
        h -= a;
        ++ans;
    }

    std::cout << ans << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        // 文字列の入力
        //string s = Console.ReadLine();

         // 整数の入力
        long n = long.Parse(Console.ReadLine());
		/*
        // 文字列配列の入力
        string[] inputStrArray = Console.ReadLine().Split(' ');

        // 整数配列の入力
        long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
		*/
        //処理
        //syori

        //出力
        Console.WriteLine(Convert.ToInt32(Math.Ceiling((double)n/2)));
        Console.Out.Flush();
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
int main()
{
 int64_t X,now,year,plus;
  cin >> X;
  now=100;
  year=0;
  while(now<X)
  {
    year++;
    plus=now/100;
    now=now+plus;
  }
  cout << year << endl ;

}



Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n, k;
  cin >> n >> k;
  ll res = 0;
  if (!k) res = n*n;
  else {
  for (ll i = k+1; i <= n; i++) {
    res += ((i-1)-k+1)*(n/i);
    res += max((ll)0, n%i-k+1);
  }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

K=int(input())
if K%2==0 or K%5==0:
    print(-1)
else:   

    NOW=0

    for i in range(1,10**6+3):
        NOW=NOW+7*pow(10,i,K)
        NOW%=K

        if NOW==0:
            print(i)
            break
    else:
        print(-1)
        


Measured memory_bytes: 63360
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long

int n, m, l;
int cost[301][301], ans[301][301];

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        cin >> n>> m>> l;
        lp(i, 301) lp(j, 301) (i==j? cost[i][j] = 0:cost[i][j] = 1e18);
        lp(i, m) {
                int a, b, c; cin >> a>> b>> c;
                cost[a][b] = c;
                cost[b][a] = c;
        }
        lp(k, 301) lp(i, 301) lp(j, 301) cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
        lp(i, 301) lp(j, 301) {
                if (i == j) { ans[i][j] = 0;  continue;}
                if (cost[i][j] <= l) {
                        ans[i][j] = 1;
                } else ans[i][j] = 1e18;
        }
        lp(k, 301) lp(i, 301) lp(j, 301) ans[i][j] = min(ans[i][j], ans[i][k] + ans[k][j]);
        int q; cin >> q;
        while ( q-- ) {
                int a, b; cin >> a>> b;
                cout << (ans[a][b] == 1e18? -1: ans[a][b]-1)<< "\n";
        }
return 0;
}


Measured memory_bytes: 1920
#include <stdio.h>

int main() {
    int N, min, max, j;
    scanf("%d", &N);
    int X[N], i;
    for(i=0; i<N; i++) {
        scanf("%d", &X[i]);
    }
    min= max=X[0];
    for(i=1; i<N; i++) {
        if(X[i] < min) min = X[i];
        if(X[i] > max) max = X[i];
    }
    long long sum0;
    for(j=min; j<=max; j++) {
        long long sum=0, n=0;
        for(i=0; i<N; i++) {
            n = (X[i] - j)*(X[i] - j);
            sum += n;
        }
        if(j == min) sum0 = sum;
        if(sum0 > sum) sum0 = sum;
    }
    printf("%lld\n", sum0);
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

#define ELEMENT_CNT_MIN 1
#define ELEMENT_CNT_MAX 100
#define ELEMENT_MIN 0
#define ELEMENT_MAX 1000


void insertion_sort(int *arr, int size);
void put_arr(int *arr, int size);
int judge_constraint(int test_num, int min, int max);

int main(void){
    
    int element_cnt; 
	int element[ELEMENT_CNT_MAX];
    int i;
    
    /* input line 1 */
    scanf("%d", &element_cnt);
    
    if(judge_constraint(element_cnt, ELEMENT_CNT_MIN, ELEMENT_CNT_MAX) == -1)
    {
        return -1;
    }
	
	/* input line 2 */
	for(i = 0; i < element_cnt; i++)
	{
		scanf("%d", &element[i]);
		
		if(judge_constraint(element[i], ELEMENT_MIN, ELEMENT_MAX) == -1)
		{
			return -1;
		}
		
	}
	
	/* output line 1 */
	put_arr(element, element_cnt); 
	
	/* output line 2 ~ element_cnt */
	insertion_sort(&element[0], element_cnt);
	
    return 0;
}

void insertion_sort(int *arr, int size)
{
    int tmp;
    int i, j;

    for(i = 1; i < size; i++)
    {
        tmp = arr[i];
        j = i - 1;
        
        while((j >= 0) && (arr[j] > tmp))
        {
            arr[j + 1] = arr[j];
            j--;
        }
        arr[j + 1] = tmp;
        
        put_arr(arr, size);  
    }
}

void put_arr(int *arr, int size)
{
	int i;
	
	for(i = 0; i < size - 1; i++)
	{
	    printf("%d ", arr[i]);
	}
	printf("%d\n", arr[size - 1]);
}

int judge_constraint(int test_num, int min, int max)
{
    if(test_num < min || test_num > max)
    {
        return -1;
    }
    
    return 0;
}

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

long gcd(long a, long b){
    if(a<b){
        long t=a;
        a=b;
        b=t;
    }
    while(b!=0){
	long r=a%b;
	a=b;
	b=r;
    }
    return a;
}
bool solve(){
    long a, b, c, d;
    cin >> a >> b >> c >> d;
    if(b>d || a<b){
        return false;
    }
    long g=gcd(d-b, b);
    if(g+c<b){
        return false;
    }
    for(long i=0; i<100000; i++){
        long q = a/b;
        long r = a%b;
        a=r;
        if(q==0){
            return false;
        }
        if(a<=c){
            a+=d;
        }
    }
    return true;
}

int main(void){
    long t;
    cin >> t;
    for(long i=0; i<t; i++){
        bool b=solve();
        cout << (b ? "Yes" : "No" ) << endl;
    }
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int cnt = 0;
  
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    cnt += r - l + 1;
  }
  
  cout << cnt << endl;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int h, w, a[500 * 500];
vector<int> v;

int main() {
	cin >> h >> w;
	inc(i, h) {
	inc(j, w) {
		cin >> a[w * i + j];
	}
	}
	
	inc(i, h) { if(i % 2 != 0) { reverse(a + w * i, a + w * (i + 1)); } }
	
	inc(k, h * w - 1) {
		if(a[k] % 2 != 0) { v.PB(k); a[k + 1]++; }
	}
	
	cout << v.size() << "\n";
	inc(k, v.size()) {
		int i1 = (v[k] + 0) / w;
		int j1 = (v[k] + 0) % w;
		int i2 = (v[k] + 1) / w;
		int j2 = (v[k] + 1) % w;
		if(i1 % 2 != 0) { j1 = w - 1 - j1; }
		if(i2 % 2 != 0) { j2 = w - 1 - j2; }
		
		i1++; j1++; i2++; j2++;
		cout << i1 << " " << j1 << " " << i2 << " " << j2 << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 3704
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String  s = sc.nextLine();
		char[] c = s.toCharArray();
		int count = 0;
		if (s.length()<2||s.length()>100){
			System.out.println("No");
		}
		else{
			for (int i=0;i<c.length;i++){
				if (count==0&&c[i]==67){
					count++;
				}
				else if(count==1&&c[i]==70){
					count++;
				}
			}
			if (count==2){
				System.out.println("Yes");
			}
			else System.out.println("No");
		}
		
	}

}

Measured memory_bytes: 9684
#include <stdio.h>


int main(){
    char ch;
    while(1){
        scanf("%c", &ch);
        if(ch=='\n'){
            printf("\n");
            break;
        }else if(islower(ch)){
            printf("%c", toupper(ch));
        }else if(isupper(ch)){
            printf("%c", tolower(ch));
        }else{
            printf("%c", ch);
        }
    }

    return 0;
}

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

int main() {
    int x, y; cin >> x >> y;
    if(y % 2 == 1){
        cout << "No" << endl;
    } else if(2*x <= y && 4*x >= y){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

using ll = unsigned long long;

int main() {
	int l, r;
	cin >> l >> r;

	if (r - l >= 2019) {
		cout << 0 << endl;
		return 0;
	}

	ll ans = 2020;
	for (ll i = l; i < r; i++) {
		for (ll j = i + 1; j <= r; j++) {
			ans = min(ans, (i * j) % 2019);
			if (ans == 0) {
				cout << ans << endl;
				return 0;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
for line in sys.stdin:
    a, b, c, d, e, f = map(float, line.split())
    b /= a
    c /= a
    a = 1.0
    e -= b*d
    f -= c*d
    d = 0
    f /= e
    e = 1.0
    c -= b*f
    print '%.3f %.3f'%(round(c, 3), round(f, 3))

Measured memory_bytes: 6372
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

template<class T>bool umax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool umin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

// gcd
int gcd(int a, int b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

int main() {
    string S;
    cin >> S;
    for (int i = 0; i < S.size(); i+=2) {
        cout<< S[i];
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 512
cost_list = [ int(v) for v in input().split() ]
size_list = [1,2,4,8]
n = int(input())*4
value_list = list(zip(cost_list,size_list))
value_list = sorted([ [i[0]/i[1]] + list(i) for i in value_list])


ans = 0
for i in value_list:
    a = n // i[2]
    ans += i[1] * a
    n -= a * i[2]
print(ans)  

Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=1e5+9;
int a[N];
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll x,ans=0;
    ll cur=100;
    cin>>x;
    while(cur<x){ 
        cur+=(cur/100);
        ans++;
    }
    cout<<ans<<'\n';
    
    return 0;
}


Measured memory_bytes: 3656
// CODE FESTIVAL 2016 qual B
// C - Gr-idian MST

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <utility>
#define MAX_W 100000
#define MAX_H 100000
using namespace std;

typedef long long int ll;


int W, H;
pair<int, int> costs[MAX_W + MAX_H];
int cnt[2];
ll ans;

int main() {

  scanf("%d %d", &W, &H);
  for (int x = 0; x < W; x++) {
    scanf("%d", &costs[x].first);
    costs[x].second = 0;
  }
  for (int y = 0; y < H; y++) {
    scanf("%d", &costs[W + y].first);
    costs[W + y].second = 1;
  }

  sort(costs, costs + W + H);

  cnt[0] = 0;
  cnt[1] = 0;
  ans = 0;
  for (int i = 0; i < W + H; i++) {
    if (costs[i].second == 0) {
      ans += (ll)(H + 1 - cnt[1]) * (ll)costs[i].first;
      cnt[0]++;
    } else {
      ans += (ll)(W + 1 - cnt[0]) * (ll)costs[i].first;
      cnt[1]++;
    }
  }
  printf("%lld\n", ans);

  return 0;

}




Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

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

	ll t = 1;
	// cin>>t;

	while(t--){
		
		ll a;
		cin>>a;

		cout<<a + a*a + a*a*a<<"\n";

	}

	return 0;

}

Measured memory_bytes: 3584
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
void solve() {
	int n; cin >> n;
	map<int, int> a{};
	set<int> a_key;
	rep (i, n) {
		int a_num; cin >> a_num;
		a_key.insert(a_num);
		if (a.count(a_num) == 0) {
			a[a_num] = 1;
		} else {
			a[a_num]++;
		}
	}
	int ans = 0;
	for (auto itr = a_key.begin(); itr != a_key.end(); ++itr) {
		if (a[*itr] % 2 == 1) ans++;
	}
	cout << ans << endl;
	return;
}

int main() {
	solve();
  return 0;
}

Measured memory_bytes: 9600
#include <iostream>

using namespace std;

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

    int a=x,b=0;
    for(int i=0;i<x;i++){
        if(y == ((2*a)+(4*b))){
            cout << "Yes" << endl;
            return 0;
        }
        a--;
        if(a < 0)
            break;
        b++;
        if(b > x)
            break;
    }

    a=0,b=x;
    for(int i=0;i<x;i++){
        if(y == ((2*a)+(4*b))){
            cout << "Yes" << endl;
            return 0;
        }
        a--;
        if(a < 0)
            break;
        b++;
        if(b > x)
            break;
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <iomanip>       // fixed, setprecision
using namespace std;

int main()
{
  int64_t N, p, m = 10e+5, c = 0;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> p;
    if (m >= p)
    {
      c++;
    }
    m = min(m, p);
  }
  cout << c << endl;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define LOOP(i,x,n) for(int i=(x);i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
const int MOD=1e9+7;
const int INF=1e10;


signed main(){
  vector<int> a(3);
  REP(i,3)cin>>a[i];
  sort(ALL(a));
  int x=a[2]-a[0];
  int y=a[2]-a[1];
  int dif=abs(y-x);
  if(dif%2==0){
    cout<<min(x,y)+dif/2<<endl;
  }else{
    x++;
    dif=abs(x-y);
    if(x==y)cout<<x+1<<endl;
    else cout<<min(x,y)+dif/2+1<<endl;

  }
  return 0;
}


Measured memory_bytes: 256
S = input()
count = 0
passFlag = False
for x in range(len(S)):
    if x == 0:
        count = 1
        prev = S[0]
    else:
        if passFlag:
            passFlag = False
            count += 1
        else:
            if S[x] == prev:
                prev = S[x:x + 2]
                passFlag = True
            else:
                prev = S[x]
                count += 1
print(count)


Measured memory_bytes: 41564
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
    
		// 出力
		System.out.println((int)Math.floor((x - z)/(y + z)));
	}
}

Measured memory_bytes: 22740