akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main { 
	static ArrayList<Integer> list = new ArrayList<Integer>();
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		makeList();
		while(true) {
			int n = stdIn.nextInt();
			if(n == 0) break;
			int count = 0;
			for(int i = 0; i < list.size(); i++) {
				for(int j = i; j < list.size(); j++) {
					for(int k = j; k < list.size(); k++) {
						for(int l = k; l < list.size(); l++) {
							if(list.get(i) + list.get(j) + list.get(k) + list.get(l) == n) {
								count++;
								break;
							}
						}
					}
				}
			}
			System.out.println(count);
		}
	}
	public static void makeList() {
		for(int i = 0; i < 32768; i++) {
			if(i * i > 32768) {
				break;
			}
			list.add(i*i);
		}
	}
		
}

Measured memory_bytes: 20796
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            // 各種変数の読み込み
            var s = Console.ReadLine().ToCharArray();
            bool good = true;
            for (int i = 0; i < s.Length; i++)
            {
                if (i % 2 == 1 && s[i] == 'R')
                {
                    good = false;
                    break;
                }
                else if (i % 2 == 0 && s[i] == 'L')
                {
                    good = false;
                    break;
                }
            }
            if (good)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
#if DEBUG
            Console.ReadKey();
#endif
        }


        private static int Readint()
        {
            // 1行に1つのintが入力されたのを読む
            return int.Parse(Console.ReadLine());
        }

        private static int[] Readints()
        {
            // 1行に複数のintが入力されたのを読む
            var s = Console.ReadLine().Split(' ');
            var output = new int[s.Length];
            for (int i = 0; i < s.Length; i++)
            {
                output[i] = int.Parse(s[i]);
            }
            return output;
        }

        private static int[][] Readints(int n, bool transpose = false)
        {
            // n行それぞれにintが入力されたのを読む
            // output[行番号][列番号]で返す。
            // transposeがtrueのときは、output[列番号][行番号]で返す。
            var s = Console.ReadLine().Split(' ');
            int rownum = s.Length;
            if (transpose)
            {
                var outputs = new int[rownum][];
                for (int j = 0; j < rownum; j++)
                {
                    outputs[j] = new int[n];
                }
                for (int i = 0; i < s.Length; i++)
                {
                    outputs[i][0] = int.Parse(s[i]);
                }
                for (int l = 1; l < n; l++)
                {
                    var temps = Console.ReadLine().Split(' ');
                    for (int i = 0; i < rownum; i++)
                    {
                        outputs[i][l] = int.Parse(temps[i]);
                    }
                }
                return outputs;
            }
            else
            {
                var outputs = new int[n][];
                outputs[0] = new int[rownum];
                for (int i = 0; i < s.Length; i++)
                {
                    outputs[0][i] = int.Parse(s[i]);
                }
                for (int l = 1; l < n; l++)
                {
                    outputs[l] = new int[rownum];
                    var temps = Console.ReadLine().Split(' ');
                    for (int i = 0; i < rownum; i++)
                    {
                        outputs[l][i] = int.Parse(temps[i]);
                    }
                }
                return outputs;
            }
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;

int main(){
  string s;
  getline(cin, s);
  for(int i=0; i<(int)s.length(); i++){
    if(isupper(s[i])) s[i]=tolower(s[i]);
    else if(islower(s[i])) s[i]=toupper(s[i]);
  }

  cout << s << endl;

  return 0;
}



Measured memory_bytes: 3164
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>
#include <map>

using namespace std;
 
int main() {
	long long n,power = 1;
	int inf = 1e09 + 7;
	cin >> n;
	for(int i = 1; i <= n;i++){
	    power = power * i % inf;
	}
    
	cout << power << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int A, P;
    cin >> A >> P;
    cout << (A * 3 + P) / 2 << endl;
    return 0;
}


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

using namespace std;


int main(){
    int N;
    cin >> N;
    int M=1000005;
    int cnt[M];
    for(int i=0;i<M;i++){
        cnt[i]=0;
    }
    int A[N];
    for(int i=0;i<N;i++){
        cin >> A[i];
        if(cnt[A[i]]>1){
            continue;
        }else{
            for(int j=A[i];j<M;j+=A[i]){
                cnt[j]++;
            }
        }
    }
    int ans=0;
    for(int i=0;i<N;i++){
        if(cnt[A[i]]==1){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 7880
#if defined _MSC_VER //if using Visual Studio
#include "std_lib_facilities.h" //include this local header file
#include <queue>
#else
#include<bits/stdc++.h> //include this non portable headerfile 
using namespace std; //and the standard namespace
#endif
#pragma warning(disable:4996)//necessary if we want to use freopen() 

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vld = vector<ld>;
using pll = pair<ll, ll>;
using vpl = vector<pll>;

#define dx first
#define dy second
#define forx(n) for (ll x=1;x<=n;x++)
#define fory(n) for (ll y=1;y<=n;y++)
#define rall(v) (v).rbegin(),(v).rend()
#define all(v) (v).begin(),(v).end()
#define fork(n) for (ll k=0;k<n;k++)
#define forj(n) for (ll j=0;j<n;j++)
#define fori(n) for (ll i=0;i<n;i++)
#define in(t) ll t; cin >> t; while(t--)
#define fin(n) ll n; cin >> n; fori(n)
#define trav(v) for(auto &i:v)
#define pb(x) push_back(x)

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
#if defined _MSC_VER 
	freopen("Text.txt", "r", stdin);//read all input form this local file 
#endif
	vector<int>prevPoints(3, 0);
	vector<int>currentPoints(3, 0);
	fin(n) {
		int newPoints[3];
		cin >> newPoints[0] >> newPoints[1] >> newPoints[2];
		forj(3) {
			fork(3) {
				if (j != k) {
					currentPoints[j] = max(currentPoints[j], newPoints[j] + prevPoints[k]);
				}
			}
		}
		prevPoints = currentPoints;
	}
	cout << *max_element(begin(currentPoints), end(currentPoints));
}

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

int main() {
  long long a,b,c;

 cin >> a >> b >> c;

 long long d = c - a - b;
 if(d > 0 && d * d > 4 * a * b){
 cout << "Yes" << endl;
 } else {
 cout << "No" << endl;
 }

 return 0;
}

Measured memory_bytes: 3620
// Problem : A - RGB Cards
// Contest : AtCoder - AtCoder Beginner Contest 064
// URL : https://atcoder.jp/contests/abc064/tasks/abc064_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
const int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
int a,b,c;cin>>a>>b>>c;
if((b*10+c)%4==0)cout<<"YES";
else
cout<<"NO";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 3516
// 2009ツアツジツアツ地ツ凝ヲツ予ツ選 F : Chemist's Math
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>

using namespace std;

int pos;
string str;
map<string, int> idx;

int abs(int x){ return x > 0 ? x : -x; }
int gcd(int a, int b){ return a%b ? gcd(b, a%b) : b; }
int lcm(int a, int b){ return a/gcd(a,b)*b; }

vector<int> getCof(){
	vector<int> res(idx.size(), 0);
	if(str[pos]=='+'||str[pos]=='-'||str[pos]=='.'||str[pos]==')') return res;
	if(str[pos]=='('){ pos++; res = getCof(); pos++; }
	else {
		string t;
		t += str[pos++];
		if(pos<str.size()&&islower(str[pos])) t += str[pos++];
		res[idx[t]]++;
	}
	int mul = 1;
	if(isdigit(str[pos])){
		mul = str[pos++]-'0';
		if(isdigit(str[pos])) mul = 10*mul + str[pos++]-'0';
	}
	vector<int> next = getCof();
	for(int i=0;i<res.size();i++) res[i] = res[i]*mul + next[i];
	return res;
}

int main(){
	while(cin >> str){
		if(str == ".") break;
		int size = 0;
		idx.clear();
		for(int i=0;i<str.size();i++){
			string t;
			if(isupper(str[i])){
				t += str[i];
				if(i+1<str.size()&&islower(str[i+1])) t += str[i+1];
				if(!idx.count(t)){ idx[t] = size++; }
			}
		}
		pos = 0;
		bool rev = false;
		vector< vector<int> > v(size);
		while(str[pos]!='.'){
			if(str[pos]=='+') pos++;
			if(str[pos]=='-') { rev = true; pos += 2; }
			vector<int> cof = getCof();
			for(int i=0;i<size;i++)
				v[i].push_back(!rev ? cof[i] : -cof[i]);
		}
		for(int i=0;i<v[0].size()-1;i++){
			if(v[i][i]==0){
				int idx = i;
				while(!v[idx][i]) idx++;
				swap(v[i], v[idx]);
			}
			for(int j=0;j<size;j++){
				if(j == i) continue;
				if(v[j][i]==0) continue;
				int mulA = v[j][i]/gcd(v[i][i],v[j][i]);
				int mulB = v[i][i]/gcd(v[i][i],v[j][i]);
				for(int k=0;k<v[j].size();k++) v[j][k] = v[j][k]*mulB-v[i][k]*mulA;
			}
			for(int j=0;j<size;j++){
				int div = 0;
				for(int k=0;k<v[j].size();k++)
					if(v[j][k]!=0) div = !div ? abs(v[j][k]) : gcd(div, abs(v[j][k]));
				if(div!=0)
					for(int k=0;k<v[j].size();k++) v[j][k] /= div;
			}
		}
		int mul = 1;
		for(int i=0;i<v[0].size()-1;i++) mul = lcm(mul, abs(v[i][i]));
		for(int i=0;i<v[0].size()-1;i++) cout << abs(mul/v[i][i]*v[i].back()) << " ";
		cout << mul << endl;
	}
}

Measured memory_bytes: 0
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long ll;
ll N, K, ans;
int main() {
  scanf("%ld %ld", &N, &K);
  if(K%2 == 0 && 2*N >= K) ans += pow((N-K/2)/K+1, 3);
  if(N >= K) ans += pow((N-K)/K+1, 3);
  printf("%ld\n", ans);
}


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

using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5, mod = 1e9 + 7;
int N;
vector<int> adj[MAXN];
ll dp[MAXN][2];

ll rec(int u, int p, int c)
{
	if (dp[u][c] != -1)
		return dp[u][c];
	ll tot = 0, ways = 1;
	for (int v : adj[u])
	{
		if (v == p)
			continue;
		ways = ways * rec(v, u, 0) % mod;
	}
	tot = ways;
	if (c == 0)
	{
		ways = 1;
		for (int v : adj[u])
		{
			if (v == p)
				continue;
			ways = ways * rec(v, u, 1) % mod;
		}
		tot = (tot + ways) % mod;
	}
	return dp[u][c] = tot;
}

int main()
{
	ios_base::sync_with_stdio(0);

	cin >> N;
	for (int i = 0; i < N - 1; i++)
	{
		int x, y;
		cin >> x >> y;
		x--, y--;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	memset(dp, -1, sizeof(dp));
	ll ans = rec(0, -1, 0);
	cout << ans;

	return 0;
}

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

int main()
{
  string s;
  cin >> s;
  int n = s.size();
  set<char> st;
  for(int i = 0; i < n; i++){
    st.insert(s[i]);
  }
  if(n == st.size()){
    cout << "yes" << endl;
  }
  else{
    cout << "no" << endl;
  }
}

Measured memory_bytes: 256
#include <vector>
#include <cstdint>
#include <algorithm>
#include <iostream>
#include <map>

template <typename T>
T ncond(const std::vector<T> &a, T m)
{

	std::map<T, T> nums;
	nums[0]++;

	T sum = 0;
	for (auto x : a) {
		sum += x;
		nums[sum % m]++;
	}

	T ret = 0;
	for (auto x : nums) {
		ret += x.second * (x.second - 1) / 2;
	}

	return ret;
}

int main(int argc, const char *argv[])
{
	std::int64_t N, M;
	std::cin >> N >> M;

	std::vector<std::int64_t> A(N);
	for (int i = 0; i < N; i++) {
		std::cin >> A[i];
	}

	std::cout << ncond(A, M) << std::endl;

	return 0;
}


Measured memory_bytes: 4992
A=int(input())
S=[]
T=[]
for i in range(1,A+1):
    N,P=input().split()
    P=int(P)
    T.append([N,P,i])
T.sort()

flg=0
AT=[]
for i in range(A):
    AT.append([T[i][1],T[i][2]])

    if i+1 == A:
        AT.sort(reverse=True)
        for j in range(len(AT)):
            print(AT[j][1])
        quit()

    if T[i][0] == T[i+1][0]:
        continue
    else:
        AT.sort(reverse=True)
        for j in range(len(AT)):
            print(AT[j][1])
        AT=[]


Measured memory_bytes: 3064
#include<stdio.h>
#include<algorithm>
int main(){
    int n, ans=0;
    scanf("%d", &n);
    if(n>9999){
        n=std::min(n, 99999);
        ans+=(n - 9999);
    }
    if(n>99){
        n=std::min(n, 999);
        ans+=(n - 99);
    }
    if(n>=0){
        n=std::min(n, 9);
        ans+=n;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
import sys

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    used = set()
    left = 1
    right = N
    for i in range(M):
        if right - left not in used:
            if N - (right - left) not in used and N - (right - left) != right - left:
                print(left, right)
                used |= {right - left}
                used |= {N - (right - left)}
                left += 1
                right -= 1
            else:
                print(left, right - 1)
                used |= {right - left - 1}
                used |= {N - (right - left - 1)}
                left += 1
                right -= 2
        else:
            print(left, right - 1)
            used |= {right - left - 1}
            used |= {N - (right - left - 1)}
            left += 1
            right -= 2

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 25956
#include<stdio.h>
int main()
{
	long long sum=0;
	int i,j,k,h,tem,z;
	scanf("%d",&k);     
	for(i=1;i<=k;i++)
	{
	 for(j=1;j<=k;j++)
	 {
	    for(h=1;h<=k;h++)
	    {
		    tem=i;       
		    if(tem>j)     
		    {
		        tem=j;
		    }
		    if(tem>h)
		    {
		        tem=h;
		    }
	      for(z=tem;z>=1;z--)
          {
		        if(i%z==0&&j%z==0&&h%z==0)
		        {
		            sum=sum+z;
		            break;
		        }
		        
	    	} 
	    } 
    
	 }
	} 
printf("%lld",sum);
	return 0;
}


Measured memory_bytes: 2120
def distinct_or_not_2(a_list):
    a_list.sort()
    for i in range(len(a_list)-1):
        if a_list[i] == a_list[i+1]:
            return 'NO'
    return 'YES'

n = int(input())
a_list = [int(a) for a in input().split()]

print(distinct_or_not_2(a_list))

Measured memory_bytes: 25168
# coding: utf-8
S = list(input())
T = list(input())
ans=10000000

for i in range(len(S)-len(T)+1):
    tmp=0
    for j in range(len(T)):
        if T[j]!=S[i+j]:
            tmp+=1
    ans=min(ans,tmp)

print(ans)



Measured memory_bytes: 9112
// AtCoder ABC131: C - Anti-Division
// 2019.9.3 bal4u

#include <stdio.h>

typedef long long ll;

int gcd(int a, int b) {
	int r;
	while (b != 0) r = a % b, a = b, b = r;
	return a;
}

ll lcm(int a, int b) {
	return a/gcd(a, b)*(ll)b;
}

ll cnt(ll a, ll b, ll c) { return b/c - (a-1)/c; }
	
int main()
{
	int i, C, D; ll A, B, ans, c, d, x;
	
	scanf("%lld%lld%d%d", &A, &B, &C, &D);
	ans = B-A+1;
	ans -= cnt(A, B, (ll)C);
	ans -= cnt(A, B, (ll)D);
	ans += cnt(A, B, lcm(C, D));
	printf("%lld\n", ans);
	return 0;
}



Measured memory_bytes: 256
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e3+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

ll dp[MAXn][MAXn];
ll d[MAXn][MAXn];


int main()
{
    IOS();
    ll h,w;
    cin>>h>>w;
    REP1(i, h)
    {
        string s;
        cin>>s;
        REP1(j, w)d[i][j] = (s[j-1] == '.');
    }
    dp[1][1] = 1;
    REP1(i,h)REP1(j, w)
    {
        if(i == 1 && j == 1)continue;
        if(!d[i][j])continue;
        dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
    }
    cout<<dp[h][w]<<endl;
}


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

int main() {
  int N;
  int M;
  cin >> N;
  cin >> M;
  int total=0;
  vector<int> A(M);
  int ans;
  for (int i = 0; i < M; i++) {
    cin >> A.at(i);
    total=total + A.at(i);
  }
  ans = N-total;
  if (total > N) ans=-1;
  cout << ans << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int H, W;
  while (true) {
    cin >> H >> W;
    if (H == 0 && W == 0)
      break;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if (i == 0 || i == H - 1 || j == 0 || j == W - 1)
          cout << "#";
        else
          cout << ".";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3076
//Keep working hard :)
#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long

const int N = 1e5+5;
int a[N];

void fileIO()
{
        #ifndef ONLINE_JUDGE
        freopen("int.txt","r",stdin);
        freopen("out.txt","w",stdout);
        #endif
}
int main()
{
	IOS;
    //    fileIO();
        int n;
        cin >> n;
        int k = n,sum(0);
        while(k)
        {
                sum += k%10;
                k /= 10;
        }
        n%sum == 0 ? cout <<"Yes":cout<<"No";
	return 0;
}


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

int main(void){
    ll N;
    pair<ll, ll> ans;
    cin >> N;
    cin >> ans.first >> ans.second;
    for(ll i = 0; i < N - 1; i++){
        pair<ll, ll> T;
        cin >> T.first >> T.second;
        ll mul = ((ans.first % T.first == 0) ? ans.first / T.first : ans.first / T.first + 1);
        mul = max(mul, (ans.second % T.second == 0) ? ans.second / T.second : ans.second / T.second + 1);
        T.first *= mul; T.second *= mul;
        ans.first = T.first;
        ans.second = T.second;
    }
    cout << ans.first + ans.second << endl;
}


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

int main(void)
{
  int n;
  cin>>n;
  int l, r;
  int ans=0;
  for(int i=0; i<n; i++)
    {
      cin>>l>>r;
      ans+=r-l+1;
    }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::cmp::max;
use std::cmp::min;

fn calc_gcd(a: i64, b: i64) -> i64 {
    return if b > 0 { calc_gcd(b, a % b) } else { a };
}

fn main() {
    input! {
        N: usize,
        tmpAs: [i64; N],
    }

    let mut As: Vec<i64> = Vec::new();
    As.extend_from_slice(&tmpAs);

    // ソートはタダ
    // As.sort();

    // なんか最大公約数と関係ある気がする
    let mut gcd = As[0];
    for &a in As.iter() {
        gcd = calc_gcd(gcd, a);
    }

    let ans = gcd;
    println!("{}", ans);
}


Measured memory_bytes: 4480
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define INF ((1LL<<62)-(1LL<<31))
#define min(p,q)((p)<(q)?(p):(q))

ll a[100010];
ll n,cnt,ans;
int main(){
	scanf("%lld",&n);
	ll m=INF;
	rep(i,0,n){
		scanf("%lld",a+i);
		m=min(m,llabs(a[i]));
		ans+=llabs(a[i]);
		if(a[i]<0)cnt^=1;
	}
	if(cnt)ans-=2*m;	
	printf("%lld",ans);
}

Measured memory_bytes: 896
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[m];
		int ans = 0;
		for(int i = 0; i < n; i++) {
			int k = sc.nextInt();
			for(int j = 0; j < k; j++) {
				int temp = sc.nextInt()-1;
				a[temp]++;
			}
		}
		for(int i = 0; i < m; i++) {
			if(a[i]==n) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 22484
N = int(input())
r = 0
for d in range(1, 11):
  for i in range(3**d):
    x = 0
    for j in range(d):
      x += [3, 5, 7][i%3]*10**j
      i = i//3
    if x > N:
      break
    if len(set(str(x))) == 3:
      #print(x)
      r += 1
print(r)


Measured memory_bytes: 3060
from collections import Counter
n = int(input())
l = list(map(int, input().split()))

l1 = [l[i] for i in range(0, n, 2)]
l2 = [l[i] for i in range(1, n, 2)]
c1 = sorted(Counter(l1).items(), key = lambda x: x[1], reverse = True) + [(0, 0)]
c2 = sorted(Counter(l2).items(), key = lambda x: x[1], reverse = True) + [(0, 0)]

res = c1[0][1] + c2[0][1]
if c1[0][0] == c2[0][0]:
    res = max((c1[1][1] + c2[0][1]), (c1[0][1] + c2[1][1]))

# print(c1, c2)
print(n - res)

Measured memory_bytes: 21204
#include<stdio.h>

int main(){
	int n,i,a,b,ta,tb;
	
	while(0<=scanf("%d",&n)){
		if(n==0) break;
		ta=0;
		tb=0;
		for(i=0;i<n;i++){
			scanf("%d%d",&a,&b);
			if(a>b){
				ta+=a+b;
			}else if(a<b){
				tb+=a+b;
			}else{
				ta+=a;
				tb+=b;
			}
		}
		printf("%d %d\n",ta,tb);
	}
	return 0;
}

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


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

	vector<int> L(N);
	for(auto& e : L) {
		cin >> e;
	}
	sort(L.begin(), L.end());

	ll s = 0;
	for(int i=0;i+1<N;i++) {
		s += L[i];
	}
	if(L[N - 1] < s) {
		cout << "Yes" << endl;
	}else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
from fractions import gcd
n,k=map(int,input().split())
*a,=map(int,input().split())

g=a[0]
for i in range(1,n):
    g=gcd(g,a[i])

if k in a or (k%g==0 and k<=max(a)):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 94216
#include <stdio.h>

int N;

int main()
{
    scanf("%d",&N);
    if(N%10==2 || N%10==4 || N%10==5 || N%10==7 || N%10==9)
	puts("hon");
    else if(N%10==0 || N%10==1 || N%10==6 || N%10==8)
	puts("pon");
    else
	puts("bon");
    return 0;
}




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

int main(void){
   int N,K;
   cin>>N>>K;
   vector<int> l(N);
   for(int i=0;i<N;i++){
      cin>>l[i];
   }
   sort(l.begin(),l.end());
   int ans=0;
   for(int i=N-1;i>=N-K;i--){
      ans+=l[i];
   }
   cout<<ans<<endl;
   return 0;
}



Measured memory_bytes: 3636
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val N = in.nextInt
  val X = in.nextLong

  val ls = (1 to N).scanLeft(1L)((z, i) => z * 2 + 3).toArray
  val ps = (1 to N).scanLeft(1L)((z, i) => z * 2 + 1).toArray

  def count(l: Int, eat: Long): Long = {
    if (l == 0) (if (eat <= 0) 0 else 1)
    else if (eat <= 1 + ls(l - 1)) count(l - 1, eat - 1)
    else ps(l - 1) + 1 + count(l - 1, eat - ls(l - 1) - 2)
  }

  println(count(N, X))
}

Measured memory_bytes: 25540
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF=1e9+5;
const int N=2e5+5;
const ll mod=1e9+7;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n,k;
	cin>>n>>k;
	vector<ll> a(n);
	vector<ll> pos,neg;
	int zeros=0;
	for(ll& x:a){
		cin>>x;
		if(x>0) pos.push_back(x);
		if(x<0) neg.push_back(abs(x));
		if(!x) ++zeros;
	}
	int ps=(int)pos.size(),ns=(int)neg.size();
	if((ps+ns/2*2>=k)&&(ps>0||k%2==0)){
		sort(rall(pos));
		sort(rall(neg));
		ll start=1;
		if(k&1) start=pos[0];
		vector<ll> ar;
		for(int i=k%2;i<ps-1;i+=2) ar.push_back(pos[i]*pos[i+1]);
		for(int i=0;i<ns-1;i+=2) ar.push_back(neg[i]*neg[i+1]);
		sort(rall(ar));	
		for(int i=0;i<k/2;++i){
			(start*=ar[i]%mod)%=mod;
		}
		cout<<start%mod<<endl;
	}
	else{
		for(int i=0;i<n;++i) a[i]=abs(a[i]);
		sort(all(a));
		ll ans=1;
		for(int i=0;i<k;++i) (ans*=a[i]%mod)%=mod;
		cout<<(mod-ans)%mod<<endl;
	}
	return 0;
}


Measured memory_bytes: 8196
#!/usr/bin/env python3


def main():
    args = input().split()
    N = int(args[0])
    Y = int(args[1])

    for num10000 in range(0, N + 1):
        for num5000 in range(0, N + 1 - num10000):
            num1000 = N - num10000 - num5000
            value = 10000 * num10000 + 5000 * num5000 + 1000 * num1000
            if value == Y:
                print(num10000, num5000, num1000)
                return

    print(-1, -1, -1)


if __name__ == "__main__":
    main()


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

 using namespace std;

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

   vector<int> p(n);

   for (int i = 0; i < n; i++) cin >> p.at(i);

   int counter = 0;
   for (int i = 1; i < n - 1; i++) {
     if ((p.at(i - 1) - p.at(i)) * (p.at(i + 1) - p.at(i)) < 0)  counter++;
   }

   cout << counter << endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	a, b, c := make([]int, n), make([]int, n), make([]int, n-1)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	for i := 0; i < n; i++ {
		b[i] = nextInt()
	}
	for i := 0; i < n-1; i++ {
		c[i] = nextInt()
	}

	sum := 0
	for i := 0; i < n; i++ {
		sum += b[a[i]-1]
		if i != 0 && a[i-1]+1 == a[i] {
			sum += c[a[i-1]-1]
		}
	}
	fmt.Println(sum)
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>
#include <cmath>

int main(void){
    std::string s;
    std::cin >> s;

    bool aflag = false, bflag = false, cflag = false;
    for(int i = 0; i < 3; i++){
        if(s[i] == 'a'){
            aflag = true;
        }
        else if(s[i] == 'b'){
            bflag = true;
        }
        else if(s[i] == 'c'){
            cflag = true;
        }




    }

    std::cout << (aflag && bflag && cflag ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
a = gets.split.map(&:to_i).sort
count = 0
while a[-1] != a[-2]
  a[0] += 1
  a[1] += 1
  count += 1
end
while a[-2] > a[0]
  a[0] += 2
  count += 1
end
if a[-2] != a[0]
  count += 1
end
puts count

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

using namespace std;

typedef long long ll;

const int MAXN = 100, MAXW = 100000;

ll N, W, w[MAXN], v[MAXN], dp[MAXN + 1][MAXW + 1];

ll knapsack(int i, ll k) {
    if (i == N)
        return 0;
    if (dp[i][k] == -1) {
        dp[i][k] = knapsack(i + 1, k);
        if (k + w[i] <= W)
            dp[i][k] = max(dp[i][k], v[i] + knapsack(i + 1, k + w[i]));
    }
    return dp[i][k];
}

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

    cin >> N >> W;
    for (int i = 0; i < N; i++)
        cin >> w[i] >> v[i];

    memset(dp, -1, sizeof dp);
    cout << knapsack(0, 0) << endl;
}


Measured memory_bytes: 79360
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp65 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().ToArray();

            string a = st[0];
            string b = st[1];

            int num = int.Parse(a + b);

            Console.WriteLine((int)Math.Sqrt(num) * (int)Math.Sqrt(num) == num ? "Yes" : "No");

        }
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>

using namespace std;

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

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repi(i, j, n) for(int i = j;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 998244353
#define F first
#define S second

int a, b, c, d;
ll dp[6006][6006];

int main() {

 //freopen("input.in","r",stdin);
 //freopen("output.out","w",stdout);

  cin>>a>>b>>c>>d;
  c -= a;
  d -= b;
  rep(i, a+c) {
    rep(j, b+d) {
      if(i < a && j < b) {dp[i][j]=1;continue;}
      if(j == b-1) {dp[i][j] = (dp[i-1][j]*b)%mod;continue;}
      if(i == a-1) {dp[i][j] = (dp[i][j-1]*a)%mod;continue;}
      if(j < b) continue;
      if(i < a) continue;

      dp[i][j] += (j+1)*dp[i-1][j];
      dp[i][j] += (i+1)*dp[i][j-1];
      dp[i][j] %= mod;
      if(i-1 >= 0 && j-1 >= 0) {
        dp[i][j] = dp[i][j] - i*j*dp[i-1][j-1];
        dp[i][j] %= mod;
        (dp[i][j] += mod)%=mod;
      }

    }
  }
  // rep(i, a+c) {
  //   rep(j, b+d) {
  //       cout<<dp[i][j] << " ";
  //   }cout<<endl;
  // }
  cout << dp[a+c-1][b+d-1] << endl;

  return 0;
}


Measured memory_bytes: 85860
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 1e5 + 5;
const int inf = 1e9;
const int mod = 1e9 + 7;

vector<ii> adj[maxn];
int way[2][maxn] , n , m , s , t;
ll dis[2][maxn];
void DIJ(int way[maxn] , ll dis[maxn] , int st){
    fill_n(dis,maxn,1e18);
    dis[st] = 0;way[st] = 1;
    priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> pq;
    pq.push(mp(0,st));
    while(pq.size()){
        auto u = pq.top();pq.pop();
        if(dis[u.second] != u.first)continue;
        for(ii c : adj[u.second]){
            if(dis[c.first] > u.first + c.second){
                dis[c.first] = u.first + c.second;
                pq.push(mp(dis[c.first],c.first));
                way[c.first] = way[u.second];
            }else if(dis[c.first] == u.first + c.second){
                way[c.first] += way[u.second];
                if(way[c.first] >= mod)way[c.first] -= mod;
            }
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    cin >> n >> m >> s >> t;
    for(int i = 1 ; i <= m ; ++i){
        int u , v , c;cin >> u >> v >> c;
        adj[u].pb(mp(v,c));
        adj[v].pb(mp(u,c));
    }
    DIJ(way[0],dis[0],s);
    DIJ(way[1],dis[1],t);
    int res = (ll)way[0][t] * way[0][t] % mod;
    for(int i = 1 ; i <= n ; ++i){
        if(dis[0][i] * 2 == dis[0][t]){
            res -= (ll)way[1][i] * way[1][i] % mod * way[0][i] % mod * way[0][i]  % mod;
            if(res < 0)res += mod;
        }
        for(ii c : adj[i]){
            if(dis[0][i] + c.second + dis[1][c.first] == dis[0][t] &&
                dis[0][i] * 2 < dis[0][t] && dis[1][c.first] * 2 < dis[0][t]){
                res -= (ll)way[0][i] * way[0][i] % mod * way[1][c.first] % mod * way[1][c.first] % mod;
                if(res < 0)res += mod;
            }
        }
    }
    cout << res;
}


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

int main(void) {
    string s,t;
    cin >> s >> t;
    int count = 0;
    for (int i = 0; i < 3;i++){
        if(s.at(i)==t.at(i))
            count++;
    }
    cout << count << endl;
}


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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	if(n==1)
	{
		cout << "Hello World";
	}
	else
	{
		int a,b;
		cin >> a >> b;
		cout << a+b;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int N; cin >> N;
    vector<ll> H(N);
    rep(i,N)cin >> H[i];

    for(int i=N-2;i>=0;i--){
        if(H[i] > H[i+1]){
            H[i]--;
        }

        if(H[i] > H[i+1]){
            cout << "No"<< endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 1024
using namespace std;
#include<string>
#include<cmath>
#include <map>
#include <unordered_map>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define ppl pair<ll,ll>
#define F first
#define S second
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

#define fr(i,a,b) for(ll i=a;i<b;i++)
#define ffr(i,a,b) for(ll i=a;i>=b;i--)
#include<bits/stdc++.h>
#include<vector>
#define vl vector<ll>
#define PI 3.141592654
const ll N = 1e9;
#include<iterator>

void solve() {
	ll n, d, x, y, c = 0; cin >> n >> d;
	ll s = (d * d);
	fr(i, 0, n) {
		cin >> x >> y;
		if (((x * x) + (y * y)) <= s)c++;
	}
	cout << c;
}


int main() {
	fio;
#ifndef ONLINE_JUDGE
	// for getting input
	freopen("input.txt", "r", stdin);
	//for writing output
	freopen("jout.txt", "w", stdout);
#endif

	ll t;
	if (1)
		t = 1;
	else
		cin >> t;
	while (t--) {
		//cout << "Case #" << h << ":\n";
		solve();
		//h++;
		cout << '\n';
	}
	return 0;
}


Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
    int n;
    int[] as;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        solve();
    }

    void solve() {
        ArrayList<Integer> xList = new ArrayList<>();
        ArrayList<Integer> yList = new ArrayList<>();
        int maxAbs = 0;
        int maxAbsIndex = -1;
        for (int i = 0; i < n; i++) {
            if (Math.abs(as[i]) > Math.abs(maxAbs)) {
                maxAbs = as[i];
                maxAbsIndex = i;
            }
        }
        if (maxAbs == 0) {
            System.out.println(0);
            return;
        }
        for (int i = 0; i < n; i++) {
            xList.add(maxAbsIndex + 1);
            yList.add(i + 1);
        }
        if (maxAbs < 0) {
            for (int i = n - 1; i > 0; i--) {
                xList.add(i + 1);
                yList.add(i);
            }
        } else {
            for (int i = 0; i < n - 1; i++) {
                xList.add(i + 1);
                yList.add(i + 2);
            }
        }
        System.out.println(xList.size());
        for (int i = 0; i < xList.size(); i++) {
            System.out.println(xList.get(i) + " " + yList.get(i));
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


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

int main(){
	int H, W, i, j, f;
	scanf("%d%d", &H, &W);
	char **a = (char **)malloc(sizeof(char *) * H);
	for(i = 0; i < H; i++){
		a[i] = (char *)malloc(sizeof(char) * (W + 1));
		scanf("%s", a[i]);
	}
	int *reductR = (int *)malloc(sizeof(int) * H);
	int *reductC = (int *)malloc(sizeof(int) * W);
	for(i = 0; i < H; i++){
		for(j = 0, f = 1; j < W; j++){
			if(a[i][j] == '#'){
				f = 0;
			}
		}
		reductR[i] = f;
	}
	for(j = 0; j < W; j++){
		for(i = 0, f = 1; i < H; i++){
			if(a[i][j] == '#'){
				f = 0;
			}
		}
		reductC[j] = f;
	}
	for(i = 0; i < H; i++){
		if(reductR[i] == 0){
			for(j = 0; j < W; j++){
				if(reductC[j] == 0){
					printf("%c", a[i][j]);
				}
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 128
// AtCoder Grand Contest 005
// C - Tree Restoring

#include <cstdio>
#include <set>
#include <functional>
#define MAX_N 100
using namespace std;


int N;
multiset<int, greater<int> > A;

int main() {

  int a, r;

  scanf("%d", &N);
  for (int i = 0; i < N; ++i) {
    scanf("%d", &a);
    A.insert(a);
  }

  r = *A.begin();
  for (int i = 0; i < r + 1; ++i) {
    if (A.find(r - (i / 2)) == A.end()) {
      printf("Impossible\n");
      return 0;
    }
    A.erase(A.find(r - (i / 2)));
  }

  if (A.size() > 0) {
    auto itr = A.end();
    itr--;
    if (*itr <= (r + 1) / 2) {
      printf("Impossible\n");
      return 0;
    }
  }

  printf("Possible\n");

  return 0;

}




Measured memory_bytes: 256
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    k,n = map(int, input().split())
    a = list(map(int, input().split()))
    res = 0
    for i in range(n-1):
        res = max(res, a[i+1]-a[i])
    res = max(res, a[0]+k-a[n-1])
    print(k-res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 25432
#include<bits/stdc++.h>
using namespace std;
int main(){
  string N;
  cin >> N;
  reverse(N.begin(),N.end());
  N += "00";
  //cout << N << endl;
  
  int64_t ans = 0;
  for(int i=0; i<N.size(); i++){
    int x = N.at(i) - '0';
    if(x < 5){
      ans += x;
    }
    if(x >= 6){
      ans += 10 - x;
      if(N.at(i+1) != '9'){
        N.at(i+1)++;
      }
      else{
        int y = i+1;
        while(N.at(y) == '9'){
          N.at(y) = '0';
          y++;
        }
        N.at(y)++;
      }
    }
    if(x == 5){
      if(N.at(i+1) >= '5'){
        if(N.at(i+1) != '9'){
          N.at(i+1)++;
        }
        else{
          int y = i+1;
          while(N.at(y) == '9'){
            N.at(y) = '0';
            y++;
          }
          N.at(y)++;
        }
      }
      ans += 5;
    }
    //cout << N << endl;
  }
  cout << ans << endl;
} 

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

int main()
{
  int n;

  cin >> n;
  while (n--){
    double x1, x2, x3, y1, y2, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

    double a1 = 2 * (x2 - x1);
    double b1 = 2 * (y2 - y1);
    double c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;

    double a2 = 2 * (x3 - x1);
    double b2 = 2 * (y3 - y1);
    double c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;

    double x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
    double y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);

    double r = hypot(x - x1, y - y1);

    printf("%.3f %.3f %.3f\n", x, y, r);
  }
}

Measured memory_bytes: 1256
#include <iostream>
#include <iomanip>

using namespace std;

int a, b, d, r;
double f;

int main(){

	cin >> a >> b;

	d = a / b;
	r = a % b;
	f = 1.000000 * a / b;

	cout << fixed << d << " " << r << " " << f << endl;
	return 0;
}






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

int main()
{
    int n;
    cin >> n;
    n %= 1000;
    cout << (1000 - n) % 1000 << endl;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main()
{
    int x,y,z,c,b;
    cin>>x>>y;
    z=x+y;
    c=x*y;
    b=x-y;
    if(z>c && z>b){
        cout<<z;
    }
    else if(c>z&& c>b){
        cout<<c;}

    else{cout<<b;}


    return 0;
}


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

struct Dinic {
	static const int INF = 1e9;

	struct E {
		//to,??????,?????????index
		int to, cap, rev;
		E(int t, int c, int r) {
			to = t;
			cap = c;
			rev = r;
		}
	};

	//?????§????????°
	int MAX_V;
	vector<vector<E>>G;
	Dinic(int max_v) {
		MAX_V = max_v;
		G.resize(MAX_V);
	}

	//?????????
	inline void add_edge(int from, int to, int cap) {
		if (from == to)return;
		G[from].push_back(E(to, cap, G[to].size()));
		G[to].push_back(E(from, 0, G[from].size() - 1));
	}

	//?????????
	inline void add_undirected_edge(int from, int to, int cap) {
		if (from == to)return;
		G[from].push_back(E(to, cap, G[to].size()));
		G[to].push_back(E(from, cap, G[from].size() - 1));
	}

	//??±???
	vector<int>level;

	//??±?????????????????????
	void bfs(int s) {
		level.assign(MAX_V, -1);
		queue<int> que;
		level[s] = 0;
		que.push(s);
		while (!que.empty()) {
			int v = que.front(); que.pop();
			for (int i = 0; i < G[v].size(); i++) {
				E &e = G[v][i];
				if (e.cap > 0 && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					que.push(e.to);
				}
			}
		}
	}

	//s -- v -- u -- t
	//t????????±???????????¢?´¢
	int dfs(int s, int u, int crr) {
		if (s == u || crr == 0)return crr;

		int sum = 0;

		for (int i = 0; i < G[u].size(); i++) {
			E& e = G[u][i];				//u - v
			int v = e.to;
			E& ee = G[v][e.rev];		//v - u

			if (level[v] >= level[u] || ee.cap <= 0)continue;

			int f = dfs(s, v, min(crr - sum, ee.cap));
			if (f <= 0)continue;

			//???????????´??°
			ee.cap -= f;
			e.cap += f;

			//???????????´??°
			sum += f;

			if (sum == crr)break;
		}

		return sum;
	}

	int max_flow(int s, int t) {
		int flow = 0;
		//t??????????????????????????§
		while (1) {
			bfs(s);
			if (level[t] < 0)return flow;
			flow += dfs(s, t, INF);
		}
	}
};

int gcd(int a, int b) {
	if (b == 0)return a;

	return gcd(b,a%b);
}

int main()
{
	while (1) {
		int m, n; cin >> m >> n;
		if (m == 0)break;

		vector<int>b(m), r(n);
		for (int i = 0; i < m; i++)cin >> b[i];
		for (int i = 0; i < n; i++)cin >> r[i];

		Dinic dnc(m + n + 2);
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				if (gcd(b[i], r[j]) != 1) {
					dnc.add_edge(i, m + j, 1);
				}
			}
		}

		for (int i = 0; i < m; i++)dnc.add_edge(m + n, i, 1);
		for (int j = 0; j < n; j++)dnc.add_edge(m + j, m + n + 1, 1);

		int ans = dnc.max_flow(m+n, m+n+1);

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 7392
class Array
  def uniq?
    return true if size <= 1
    s = sort
    x = s[-1] 
    s.each do |a|
      return false if x == a
      x = a
    end
    return true
  end
end

n = gets.to_s.to_i
a = gets.to_s.split.map{|i|i.to_i}

puts a.uniq? ? "YES" : "NO"

Measured memory_bytes: 19072