akhauriyash/Code-Regression huggingface dataset:
import itertools
a = input().split(" ")
row = list(itertools.product([0,1],repeat=int(a[0])))
column = list(itertools.product([0,1],repeat=int(a[1])))
field = []
for i in range(int(a[0])):
    field.append(list(input()))

b = len(row)
c = len(column)
row_m = []
column_m = []
all = 0
for i in range(int(a[0])):
    count = 0
    for j in range(int(a[1])):
        if field[i][j] == "#":
            count += 1
            all += 1
    row_m.append(count)

for i in range(int(a[1])):
    count = 0
    for j in range(int(a[0])):
        if field[j][i] == "#":
            count += 1
    column_m.append(count)
result = 0
for i in row:
    for j in column:
        mainasu = 0

        for k in range(len(i)):
            if i[k] == 1:
                for l in range(len(j)):
                    if j[l] == 1:
                        if field[k][l] == "#":
                            mainasu += 1
        
        row_num = sum([x*y for (x,y) in zip(i,row_m)])
        column_num = sum([x*y for (x,y) in zip(j,column_m)])
        if int(a[2]) == all - (row_num+column_num - mainasu):
            result += 1
print(result)



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

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

  string s, t;
  cin >> s >> t;
  int ans = 0;
  for (int i = 0; i < (int) s.size(); i++) {
    if (s[i] != t[i]) {
      ans++;
    }
  }
  cout << ans << "\n";
  return 0;  
}


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

int main(){
    int n; cin >> n;
    int sod, m = n;
    while ( m > 0 ){
        sod += m % 10;
        m /= 10;
    }
    string ans;
    if ( n % sod == 0 ) ans = "Yes";
    else ans = "No";
    cout << ans << endl;
}

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

int main(){
    int N;
    cin>>N;
    if(__builtin_popcount(N)==1){
        cout<<"No"<<endl;
        return 0;
    }else{
        cout<<"Yes"<<endl;
    }
    cout<<1<<' '<<2<<endl;
    for(int i=2;i<N;i+=2){
        cout<<i<<' '<<i+1<<endl;
        cout<<i+1<<' '<<1+N<<endl;
        cout<<1+N<<' '<<i+N<<endl;
        cout<<i+N<<' '<<i+1+N<<endl;
    }
    if(N%2==0){
        int y=1;
        while(y<=N)y<<=1;
        y>>=1;
        int x=N^y^1;
        if(x&1){
            cout<<x<<' '<<N<<endl;
        }else{
            cout<<x+N<<' '<<N<<endl;
        }
        if(y&1){
            cout<<y<<' '<<2*N<<endl;
        }else{
            cout<<y+N<<' '<<2*N<<endl;
        }
        //cout<<y<<'/'<<x<<endl;
    }
    return 0;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
//#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int n,m;
struct uf{
    int par[3005];
    void init(){ rep(i,3005) par[i] = i;}
    int find(int x){
        if(x == par[x]) return x; else return par[x] = find(par[x]);
    }
    void unite(int x,int y){
        x = find(x); y = find(y); if(x == y) return;
        par[x] = y;
    }
    bool same(int x,int y){ return find(x) == find(y); }
}kaede;
struct BipartiteMatching {
  vector< vector< int > > graph;
  vector< int > match, alive, used;
  int timestamp;

  BipartiteMatching(int n) : graph(n), alive(n, 1), used(n, 0), match(n, -1), timestamp(0) {}

  void add_edge(int u, int v) {
    graph[u].push_back(v);
    graph[v].push_back(u);
  }

  bool dfs(int idx) {
    used[idx] = timestamp;
    for(auto &to : graph[idx]) {
      int to_match = match[to];
      if(alive[to] == 0) continue;
      if(to_match == -1 || (used[to_match] != timestamp && dfs(to_match))) {
        match[idx] = to;
        match[to] = idx;
        return true;
      }
    }
    return false;
  }

  int bipartite_matching() {
    int ret = 0;
    for(int i = 0; i < graph.size(); i++) {
      if(alive[i] == 0) continue;
      if(match[i] == -1) {
        ++timestamp;
        ret += dfs(i);
      }
    }
    return ret;
  }

  void output() {
    for(int i = 0; i < graph.size(); i++) {
      if(i < match[i]) {
        cout << i << "-" << match[i] << endl;
      }
    }
  }
};
set<int>used;
int main(){
    cin >> n >> m;
    kaede.init();
    BipartiteMatching bm(3005);
    int gen = 0;
    rep(i,m){
        int a,b; cin >> a >> b;
        bm.add_edge(a,1500+b);
        if(kaede.same(a,1500+b) == false){
            kaede.unite(a,1500+b); gen++;
        }
        used.insert(a); used.insert(1500+b);
    }
    //min?
    cout << m-bm.bipartite_matching() << " ";
    //max?
    cout << m+gen-(int)(used.size()) << endl;
}


Measured memory_bytes: 3372
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if(b % a == 0)cout << a+b;
    else cout << b-a;
}


Measured memory_bytes: 256
N = int(input())
count = 0
D = 0
task = [list(map(int, input().split())) for _ in range(N)]
task = sorted(task, key = lambda x:x[1])
for i in range(N):
  count += task[i][0]
  if count > task[i][1]:
    print("No")
    D = 1
    break
if D== 0:
  print("Yes")

Measured memory_bytes: 55264
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
#define fi first
#define se second
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    int n,k;cin>>n>>k;
    vector<double> p(n);
    rep(i,n)cin>>p[i];


    double tmp=0.0;
    rep(i,k){
        tmp += (1.0 + p[i])/2.0;
    }
    
    double ans = tmp;
    rep1(i,n-k){
        tmp = tmp - p[i-1]/2.0 + p[i+k-1]/2.0;
        ans=max(ans,tmp);
    }

    cout<<fixed<<setprecision(15)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4708
N,D,A=map(int,input().split())
P=sorted([list(map(int,input().split())) for i in range(N)])
l=r=a=d=0
m=[0]*(N+1)
while l<N:
    while r<N and P[r][0]<=P[l][0]+2*D:
        r+=1
    d+=m[l]
    x=-(-max(0,P[l][1]-d)//A)
    a+=x
    d+=x*A
    m[r]-=x*A
    l+=1
print(a)


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

int main(){

    long long n;
    cin >> n;

    /*int len = 0;
    long long sum = 0, p = 1;
    for(int i=1;;i++){
        p*=26;
        sum+=p;
        if(n<=sum){
            len = i;
            break;
        }
    }
    cout << len << endl;*/

    string name = "";
    long long d = 0, r = 0;
    while(n>0){
        d = n/26;
        r = n%26;
        if(r==0){
            d = d-1;
            name = "z" + name;
        }
        else{
            name = (char)(r-1+'a') + name;
        }
        n = d;
    }

    cout << name << endl;
}


Measured memory_bytes: 3624
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    PriorityQueue<Double> queue = new PriorityQueue<>();
    for (int i = 0; i < n; i++) {
      queue.add(sc.nextDouble());
    }
    while (queue.size() > 1) {
      double item1 = queue.poll();
      double item2 = queue.poll();
      queue.add((item1 + item2) / 2);
    }
    System.out.println(queue.peek());
  }
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}



int main() {
    li a;
    cin >> a;
    printf("%.12f\n", ((a - a / 2) * 1.0 / a));

    return 0;
}

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

using namespace std;

int main(int argc, const char * argv[]) {
  int N;
  cin >> N;
  vector<long int> A(N + 1);
  vector<long int> B(N + 1, 0);
  vector<long int> C(N + 1);

  for(int i = 0; i<N+1; i++){
    cin >> A[i];
  }
  for(int i = 0; i<N; i++){
    cin >> B[i];
  }
  long int Asum = accumulate(A.begin(), A.end(), 0L);

  C[0] = A[0] - B[0];
  for (int i = 1; i < N + 1; i++) {
    if (C[i - 1] < 0) {
      (A[i] + C[i - 1]) < 0 ? A[i] = 0 : A[i] += C[i - 1];
      C[i - 1] = 0;
    }
    C[i] = A[i] - B[i];
  }
  if(C[N] < 0){
    C[N] = 0;
  }

  long int Csum = accumulate(C.begin(), C.end(), 0L);

  cout << Asum - Csum << endl;

  return 0;
}


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


int main()
{
  string s;
  cin >> s;
  int n = s.size();
  string res = s;
  rep(i, n)
  {
    if(res[i] == '?')
    {
      res[i] = 'D';
    }
  }
  
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 3864
#include <bits/stdc++.h>
	
using namespace std;
	
#define endl "\n"
#define ll long long
#define vi vector <int >
#define vii vector < pii >
#define vll vector <ll >
#define pii pair <int, int>
#define pdd pair< double, double>
#define piii pair < pii, int > 
#define pll pair<ll, ll >
#define umap unordered_map
#define pb push_back
#define pq priority_queue
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define rep(i,b,c) for(int i = (int)b; i < (int)c; i++)
#define double long double
#define a first
#define b second

vi arr(100010);

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

	int m,n;
	cin >> m >> n;
	string s1 = "", s2 = "";

	forn(i, n){
		s1+= to_string(m);
	}
	forn(i, m){
		s2+= to_string(n);
	}
	if(s1 < s2) cout << s1 << endl;
	else cout << s2 << endl;




	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;

int main(){
  int N, M;
  cin>>N>>M;
  int judge[100001]={}, ans=0, pnt=0;

  rep(i, M){
    int p;
    string s;
    cin>>p>>s;

    if(s == "WA" && judge[p]!=-1){
      judge[p]++;
    }
    else if(judge[p]!=-1){
      ans++;
      pnt += judge[p];
      judge[p] = -1;
    }
  }

  printf("%d %d\n", ans, pnt);

}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#define FAST_IO ios::sync_with_stdio(false)
using namespace std;
int x,y,a[1000000],vis[1000000];
vector <int> E[123456];
long long ans,maxx,max1,n,m,cnt,maxt;
void solve(int x)
{
	vis[x]=1;
	if (a[x]<maxx)
	  maxx=a[x],maxt=x;
   for(int i=0;i<E[x].size();i++){
        int u=E[x][i];
		if(!vis[u]) solve(u);
	}
	return;
}
int main()
{
	FAST_IO;
	cin>>n>>m;
	for (int i=1;i<=n;i++)
      cin>>a[i];
  
    for (int i=1;i<=m;i++)
    {
	
      cin>>x>>y;
      x++;
      y++;
      E[x].push_back(y);
      E[y].push_back(x);
    }
   
    memset(vis,0,sizeof(vis));
    for (int i=1;i<=n;i++)
    {
    	maxx=2000000000;
    	maxt=0;
    	if (vis[i]==0)
         cnt++,solve(i),ans+=maxx; 
 
        
        a[maxt]=2000000001;
	}
	 if(cnt==1) {printf("0\n");return 0;}
	if (cnt*2-2>n) 
	{
	cout<<"Impossible";
	return 0;
    }
	sort(a+1,a+n+1);
	for (int i=1;i<=cnt-2;i++)
	{
		ans+=a[i];
		if (a[i]==2000000001)
		  {
		  	cout<<"Impossible";
	return 0;
		  }
	}
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 11648
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false);
    char a,b,c,d,e,f;
    cin >> a >> b >> c;
    cin >> d >> e >> f;
    if(b == e && a == f && c == d){
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
 
  return 0;
}

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

#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define setIO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
#define trav(e, x) for (auto &(e) : (x))
#define pb(x) push_back(x)
#define eb(x...) emplace_back(x)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define lc(i) 2*i
#define rc(i) 2*i+1
#define int long long
using namespace std;
using ii = pair<int, int>;
using vi = vector<int>;

const int N = 1e5 + 5, MOD = 1e9 + 7, INF = 1e9 + 5;

int add(int x, int y) {
    return ((x % MOD) + (y % MOD)) % MOD;
}

int mul(int x, int y) {
    return ((x % MOD) * (y % MOD)) % MOD;
}

signed main() {
    FAST_IO;
//    setIO("input.txt", "output.txt");

    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int dp[n];
    dp[n - 1] = a[n - 1];
    for (int i = n - 2; i >= 0; i--) dp[i] = add(dp[i + 1], a[i]);
    int ans = 0;
    for (int i = 0; i < n - 1; i++) ans = add(ans, mul(a[i], dp[i + 1]));
    cout << ans % MOD;
}


Measured memory_bytes: 6760
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;


int main() {
int N;
int max_=0,x=0;
string S;
cin>>N>>S;
rep(i,N){
  if(S[i]=='I'){
    x++;
    max_=max(max_,x);

  }
  else{
    x--;
  }
}
cout<<max_<<endl;
return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pie acos(-1)
#define loop(i,a,n) for(int i=a;i<n;i++)
#define trav(a,x) for(auto &a:x)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define endl "\n"
#define dbg(x)  cout<<#x<<" " <<x<<endl;
#define dbg(x,y)  cout<<#x<<" " <<x<<" "<<#y<<" "<<y<<endl;
#define all(v) v.begin(),v.end()
const int e = 100005;
const ll INF = 1e18+5;
void max_self(ll& a , ll b )
{
    a=max(a,b);
}
void min_self(ll& a , ll b)
{
    a=min(a,b);
}
void solve()
{
    ll n,w;
    cin>>n>>w;
    vl wt(n),val(n);
    
    // since only one item is allowed thus we will find max value tha we can get
    ll max_val=0;
    loop(i,0,n)
    {
        cin>>wt[i]>>val[i];
        max_val += val[i];
    }
    vl dp(max_val+1,INF);
    dp[0]=0;
    // dp[i] is minimum weight for value i
    for(int i=0 ; i<n ;i++ )
    {
        for(int val_already = max_val - val[i] ; val_already >=0 ;val_already--)
        {
            min_self( dp[val_already + val[i]] , dp[val_already] + wt[i]);
        }
    }
    //dbg(max_val);
    ll ans=0;
    for(ll i=0;i<=max_val;i++)
    {
        if(dp[i]<=w)
        max_self(ans,i);
    }
    cout<<ans;
}
int main() {
	// your code goes here
	io;
	
    solve();
	return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
using namespace std;
int main()
{
    long long n,m;
    scanf("%lld %lld",&n,&m);
    if(n*2>=m)
    {
        printf("%lld\n",m/2);
    }
    else
    {
        printf("%lld\n",(n*2+m)/4);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	ll A;
	int B;
	cin >> A >> B;
	if (A >= 13)
	{
		cout << B << '\n';
	}
	else if (A <= 5)
	{
		cout << "0" << '\n';
	}
	else
	{
		cout << B / 2 << '\n';
	}
	return 0;
}

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

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> pii;

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

	int n;
	cin >> n;

	int a[n+2];
	a[0] = 0;
	a[n+1] = 0;

	rep(i,n) cin >> a[i+1];

	ll sm = 0;
	rep(i,n+1){
		sm += abs(a[i+1]-a[i]);
	}

	rep(i,n){
		if(a[i] <= a[i+1] && a[i+1] <= a[i+2]) cout << sm << endl;
		else if(a[i] <= a[i+2] && a[i+2] <= a[i+1]) cout << sm - 2* (a[i+1] - a[i+2]) << endl;
		else if(a[i+1] <= a[i] && a[i] <= a[i+2]) cout << sm - 2*(a[i] - a[i+1]) << endl;
		else if(a[i+1] <= a[i+2] && a[i+2] <= a[i]) cout << sm - 2*(a[i+2] - a[i+1]) << endl;
		else if(a[i+2] <= a[i] && a[i] <= a[i+1]) cout << sm - 2*(a[i+1] - a[i]) << endl;
		else if(a[i+2] <= a[i+1] && a[i+1] <= a[i]) cout << sm << endl;
	}
}

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

int main() {
    int64_t N;
    cin >> N;
    int64_t ans = 0;
    for (int64_t i = 1; i <= N; i++) {
        int64_t num = N / i;
        ans += (i + N / i * i) * num / 2;
    }
    cout << ans << endl;
}

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

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]) {
  ll n;
  cin >> n;
  if (n % 2 == 0) {
    cout << n << '\n';
  } else {
    cout << n * 2 << '\n';
  }

  return 0;
}

Measured memory_bytes: 3572
#include <stdio.h>
#define MAX 100
 
int Ryo[MAX+1][MAX+1], fat[MAX+1], d[MAX+1], f[MAX+1], t;
 
void visit(int pine){
  int i;
  d[pine] = t++;
  for(i=1;i<=fat[pine];i++) if(!d[Ryo[pine][i]]) visit(Ryo[pine][i]);
  f[pine] = t++;
}
 
main(){
  int i, j, u, v,n;
  scanf("%d", &n);
  t = 1;
  for(i=1;i<=n;i++){
    d[i] = f[i] = 0;
    scanf("%d", &u);
    scanf("%d", &fat[u]);
    for(j=1;j<=fat[u];j++) scanf("%d", &Ryo[u][j]);
  }
  for(i=1;i<=n;i++) if(!d[i]) visit(i);
  for(i=1;i<=n;i++) printf("%d %d %d\n", i, d[i], f[i]);
  return 0;
}

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

int main(){
  int H, W, d[10][10], num[10] = {0};
  cin >> H >> W;
  rep(i, 10){
     rep(j, 10) cin >> d[i][j];
   }
  rep(k, 10){
    rep(i, 10){
      rep(j, 10) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    }
  }
   rep(i, H){
     rep(j, W){
       int a;
       cin >> a;
       if(a != -1) num[a]++;
     }
   }
  int ans = 0;
  rep(i, 10){
    ans += num[i]*d[i][1];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;


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

  string w;
  cin >> w;
  vector<ll> cnt(26);

  REP(i,w.length()){ cnt[w[i]-'a'] ^= 1; }

  cout << ((*max_element(cnt.begin(), cnt.end())==0) ? "Yes" : "No") << "\n";
  return 0;
}


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

namespace CodeForce
{



    class CF
    {

        public static int Binomial(int x)
        {
            return (x * (x - 1)) / 2;
        }

        static void Main(string[] args)
        {
            List<int> nums = new List<int>(from x in Console.ReadLine().Split(' ') select Convert.ToInt32(x));

            int answer = Binomial(nums[0]) + Binomial(nums[1]);

            Console.WriteLine(answer);
        }
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
using namespace std;
typedef pair<int, int> P;

const int INF = 1 << 28;
int dp[510][1010];

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

	int N, M;
	while(cin >> N >> M) {
		vector<P> r(M);
		for(int i = 0; i < M; i++) {
			cin >> r[i].second >> r[i].first;
		}
		sort(r.begin(), r.end());

		fill((int*)begin(dp), (int*)end(dp), INF);
		dp[0][N] = 0;
		for(int i = 0; i < M; i++) {
			int pos = r[i].first;
			for(int j = 1; j <= N; j++) {
				if(dp[i][j] == INF) continue;
				int d = (i == 0) ? pos : abs(pos - r[i - 1].first);
				// ??????
				int ret = abs(pos - min(r[i].second, j));
				dp[i + 1][N] = min(dp[i + 1][N], dp[i][j] + d + 2 * ret);
				// ????????????
				int nj = min(r[i].second, j);
				dp[i + 1][nj] = min(dp[i + 1][nj], dp[i][j] + d);
			}
		}

		int pos = (M == 0) ? 0 : r.back().first;
		cout << dp[M][N] + (N + 1 - pos) << endl;
	}
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define inv(n, a) for(int i = 0; i < n; i++) cin >> a[i]
#define MOD 1000000007
#define INF 1e7
#define LINF 1e15
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    
    int dp[110][110];
    dp[0][0] = (s[0][0] == '#');
    rep(i, h){
        rep(j, w){
            if(i == 0 && j == 0) continue;
            dp[i][j] = INF;
            if(i != 0) dp[i][j] = dp[i-1][j] + (s[i][j] == '#' && s[i-1][j] == '.');
            if(j != 0) chmin(dp[i][j], dp[i][j-1] + (s[i][j] == '#' && s[i][j-1] == '.'));
        }
    }
    cout << dp[h-1][w-1] << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=2e5+5;
inline int read(){
	char c=getchar();int t=0,f=1;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int n,k,a[maxn],sum[maxn];
struct node{
	int l,r,cnt;
}t[maxn*60];
int rt[maxn],cnt;
inline void insert(int &rt,int pre,int l,int r,int pos){
	if(!rt)rt=++cnt;
	t[rt].cnt=t[pre].cnt+1;
	if(l==r){
		return ;
	}
	int mid=(l+r)>>1;
	if(pos<=mid){
		t[rt].r=t[pre].r;
		insert(t[rt].l,t[pre].l,l,mid,pos);
	}
	else{
		t[rt].l=t[pre].l;
		insert(t[rt].r,t[pre].r,mid+1,r,pos);
	}
}
inline int query(int rt,int l,int r,int pos){
	if(!rt)return 0;
	if(l==r)return t[rt].cnt;
	int mid=(l+r)>>1;
	if(pos<=mid)return query(t[rt].l,l,mid,pos);
	else return query(t[rt].r,mid+1,r,pos);
}
signed main(){
	n=read(),k=read();
	for(int i=1;i<=n;i++){
		a[i+1]=read();
		a[i+1]--;a[i+1]=a[i+1]%k;
	}
	n++;
	int ans=0;
	for(int i=1;i<=n;i++){
		sum[i]=(sum[i-1]+a[i])%k;
		insert(rt[i],rt[i-1],0,k,sum[i]);
	//	printf("%d ",sum[i]);
	}
//	puts("");
	for(int i=2;i<=n;i++){
		ans=ans+query(rt[i-1],0,k,sum[i])-query(rt[max(0ll,i-k)],0,k,sum[i]);
		//if(a[i]==0)ans++;
		//printf("%d %lld\n",i,ans);
	}
	printf("%lld\n",ans);
	return 0;
}


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

using namespace std;

int n, T, x;
char s[200005];

int main() {
    scanf("%d", &n);
    int mv = 0, a;
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a);
        mv = max(mv, a);
        ans += mv - a;
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 3812
from collections import Counter

# print('input >>')
N = int(input())
c = input()

counter = Counter(c)
R_cnt = counter['R']
W_cnt = counter['W']

ans = 0
for s in c[:R_cnt]:
    if s == 'W':
        ans += 1

# print('-----output-----')
print(ans)

Measured memory_bytes: 9772
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
d = {}

for i in range(n):
    if a[i] not in d:
        d[a[i]] = 1
    else:
        d[a[i]] += 1

for key in d:
    if key > d[key]:
        ans += d[key]
    elif key < d[key]:
        ans += d[key] - key
        
print(ans)

Measured memory_bytes: 17784
from collections import deque

n=int(input())
a=list(map(int,input().split()))
res=deque()
if n % 2 == 0:
    for i in range(n // 2):
        res.append(a[i*2])
        res.appendleft(a[i*2+1])
else:
    for i in range(n // 2):
        res.appendleft(a[i*2])
        res.append(a[i*2+1])
    res.appendleft(a[n-1])
print(" ".join(map(str,list(res))))

Measured memory_bytes: 122452
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var Sd = ReadLine();
            var T = ReadLine();
            for (var i = Sd.Length - T.Length; 0 <= i; --i)
            {
                var isOk = true;
                for (var j = 0; j < T.Length; ++j)
                {
                    if (Sd[i + j] == '?') continue;
                    if (Sd[i + j] != T[j])
                    {
                        isOk = false;
                        break;
                    }
                }
                if (isOk)
                {
                    var tmp = string.Empty;
                    tmp = Sd.Substring(0, i) + T + Sd.Substring(i + T.Length);
                    var ans = tmp.Replace('?', 'a');
                    WriteLine(ans);
                    return;
                }
            }
            WriteLine("UNRESTORABLE");
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

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

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

int A, B;

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

    cin >> A >> B;
    if (A >= 13) {
        cout << B << endl;
    } else if (A >= 6) {
        cout << B / 2 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
from functools import reduce
from fractions import gcd

A, B, C, D = map(int, input().split())
X = C//gcd(C, D)*(D//gcd(C, D))*gcd(C, D)

print(B-A-(B//C-(-(-A//C))+B//D-(-(-A//D))-(B//X-(-(-A//X)))))

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

using namespace std;

int main() {
    int i,j,n,p,q,temp;
    int t=0;
    int flag=0;
    int count=0;
    int maxl=0;
    string s;
    cin>>s;
        for(j=0; j<s.size(); ++j){
            if(s[j]=='A'||s[j]=='C'||s[j]=='G'||s[j]=='T'){
                ++count;
                if(count>maxl){maxl=count;}
            }
            else{count=0;}
        }
        cout<<maxl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int N,x;
    scanf("%d",&N);
    int A[N+1],B[N];
    long int sum=0;
    for(int i=0;i<N+1;i++){
        scanf("%d",&A[i]);
    }
    for(int i=0;i<N;i++){
        scanf("%d",&B[i]);
    }
    for(int i=0;i<N;i++){
        if(A[i]>B[i]){
            sum+=B[i];
        }else{
            sum+=A[i];
            x=B[i]-A[i];
            if(x>=A[i+1]){
                sum+=A[i+1];
                A[i+1]=0;
            }else{
                sum+=x;
                A[i+1]-=x;
            }
        }
    }
    printf("%ld\n",sum);
    return 0;
}

   


Measured memory_bytes: 896
# coding: utf-8
import sys
from bisect import bisect_left, bisect_right

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
X = lr()
if 0 in X:
    K -= 1

i = bisect_left(X, 0)
ne = X[:i]
i = bisect_right(X, 0)
po = X[i:]
INF = 10 ** 10
neg = [INF] * (K+1)  # 左からK本選ぶ場合、K-1本選ぶ場合・・・0本選ぶ場合
neg[-1] = 0
pos = [INF] * (K+1)
pos[0] = 0
for j in range(len(ne)):
    if -j-2 < -K-1:
        break
    neg[-j-2] = ne[-j-1]

for j in range(len(po)):
    if j+1 > K:
        break
    pos[j+1] = po[j]

answer = INF
for j in range(K+1):
    x = abs(neg[j]); y = abs(pos[j])
    mi = min(x, y)
    ma = max(x, y)
    temp = mi * 2 + ma
    if temp < answer:
        answer = temp
print(answer)
# 52

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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define mkp make_pair
#define pi pair<int,int>
#define push push
#define all(v) v.begin(),v.end()
#define rep(i,l,r) for(int i = (int)(l) ; i < (int)(r) ; i++)
#define clr(a,x) memset(a,x,sizeof(a));
#define rr(v) for(auto &val:v)
#define print(v) for(const auto itr:v){ cout << itr << ' ';} cout << endl;
#define init(v,x) for(auto &itr:v){ itr = x; }
#define minpq(x) x,vector<x>,greater<x>
#define ln length()
#define sz size()
#define infinity 1e18;
#define elif else if


signed main(){
    fastIO
    
    int n;
    cin >> n;
    
    int flag = 0;
    
    vector<pi> p(n);
    
    rep(i,0,n) {
		cin >> p[i].fi >> p[i].se;
	}
	
	rep(i,0,n) {
		if(p[i].fi == p[i].se and p[i+1].fi == p[i+1].se and p[i+2].fi == p[i+2].se) {
				flag = 1;
				break;
		}
	} 
	
	if(flag) cout << "Yes\n";
	else cout << "No\n";

    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
const int N = 1000000;
int n, a, b[N], c[N], cnt;
queue <int> q, qu;
int main(){
    cin >> n;
    for(int i = 1;i <= n; ++ i){
        cin >> a;
        b[a] = i;
        c[a] = n - i + 1;
    }
    for(int i = 1;i <= n * n; ++ i){
        if(!b[i]){
            ++cnt;
            continue;
        }
        if(cnt < b[i] - 1){
            cout << "No";
            return 0;
        }
        cnt -= b[i] - 1;
        for(int j = 1;j < b[i]; ++ j)q.push(b[i]);
    }
    cnt = 0;
    for(int i = n * n;i >= 1; -- i){
        if(!c[i]){
            ++cnt;
            continue;
        }
        if(cnt < c[i] - 1){
            cout << "No";
            return 0;
        }
        cnt -= c[i] - 1;
        for(int j = 1;j < c[i]; ++ j)qu.push(n - c[i] + 1);
    }
    for(int i = 1;i <= n * n && sz(q) != 0; ++ i){
        if(!b[i]){
            b[i] = q.front();
            q.pop();
        }
    }
    for(int i = n * n;i >= 1 && sz(qu) != 0; -- i){
        if(!b[i]){
            b[i] = qu.front();
            qu.pop();
        }
    }
    cout << "Yes\n";
    for(int i = 1;i <= n * n; ++ i)cout << b[i] << " ";
    return 0;
}


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

using namespace std;

#define CONTAIN357(s)   ((string::npos != s.find('3')) && (string::npos != s.find('5')) && (string::npos != s.find('7')))
string s357 = "357";

int f(string s, int n)
{
    int ans = 0;
    for(const auto& e : s357)
    {
        string tmps = s + e;
        if(n >= stoll(tmps))
        {
            if(CONTAIN357(tmps))
            {
                ans++;
            }
        }
        else
        {
            return ans;
        }
        ans += f(tmps, n);
    }

    return ans;
}

int main(void)
{
    int N;
    cin >> N;
    cout << f("", N) << endl;

    return 0;
}

Measured memory_bytes: 256
#b
s=input()

month = [str(i).zfill(2) for i in range(1,13)]

if s[2:] in month:
    if s[:2] in month:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    if s[:2] in month:
        print("MMYY")
    else:
        print("NA")

Measured memory_bytes: 38256
import sys
n , m, *e = map(int,sys.stdin.read().split())
total = n*(n-1)//2
ans =[total]
u = [-1]*(n+1)

def find(x):
    if u[x] < 0 :
        return x
    else:
        return find(u[x])

for x , y in zip(e[-2:1:-2],e[:1:-2]):
    x = find(x)
    y = find(y)
    x, y = sorted((x, y))
    if x != y:
        total -= u[x] * u[y]
        u[x] += u[y]
        u[y] = x
    ans += [total]

print(*ans[::-1], sep="\n")

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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  if(N%2 != 0){
    cout << "No" << endl;
    return 0;
  }
  bool X = true;
  for(int i=0;i<N/2;i++){
    if(S.at(i) == S.at(N/2+i)){
      X = true;
    }
    else{
      X = false;
      break;
    }
  }
  if(X == true){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
w, h = [eval(x) for x in input().split()]
while w != 0 and h != 0:
    for i in range(w):
        if i == 0 or i == w - 1:
            print('#' * h)
        else:
            print('#', '.' * (h - 2), '#', sep='')
        #print()
    print()
    w, h = [int(x) for x in input().split()]



Measured memory_bytes: 5640
#include <stdio.h>

int main(void){
	int H,W,i,j;

	while(1){
		scanf("%d %d",&H,&W);
		
		if(H==0 && W==0){
		break;
		}else{
			for(i=0;i<H;i++){
				for(j=0;j<W;j++){
					if(i+1!=H && j+1!=W &&i!=0 && j!=0){
						printf(".");
					}else{
						printf("#");
					}
				}
				printf("\n");
			}
		}
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
#define int long long int




signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	char a,b,c;
	cin >> a >> b >> c;
	cout << ((a=='7' || b=='7' || c=='7') ? "Yes" : "No");
	
}


Measured memory_bytes: 3596
N, M = map(int, input().split())
L, R = map(int, input().split())
if M == 1:
    print(R - L + 1)
    exit()
for _ in range(M-1):
    l, r = map(int, input().split())
    if l <= R and L <= r:
        L = max(L, l)
        R = min(R, r)
    else:
        print(0)
        exit()
print(R - L + 1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main ()
{
    srand(90);
    ios_base::sync_with_stdio(false); cin.tie(0);
    int A, B, X;
    cin>>A>>B>>X;
    int l=A+B;
    if(A>X)
    {
         cout<<"NO"<<endl;
    }
    else if(A == X)
    {
        cout<<"YES"<<endl;
    }
    else if(A<X)
    {
        if(A+B>=X){
        cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
    }
    else
    {
        cout<<"NO"<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main {
  public static void main(String[] args) throws Exception{
    try (Scanner sc = new Scanner(System.in)){
      int[] arr = new int[3];
      arr[0] = sc.nextInt();
      arr[1] = sc.nextInt();
      arr[2] = sc.nextInt();
      Arrays.sort(arr);
      System.out.println(arr[2] * 10 + arr[1] + arr[0]);
    }
  }
}


Measured memory_bytes: 20948
def m(a,b):
    n=3
    L=[0]*3
    for i in range(n):
        L[i]=a[i]-b[i]
    return L

def f(L):
    return len(set(L))==1

C=[]
for i in range(3):
    C.append(list(map(int,input().split())))

F=True
for i,j in [(0,1),(1,2),(2,0)]:
    F&=f(m(C[i],C[j]))

if F:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 61940
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
ll q_pow(ll a, ll b)
{
    ll ans = 1;
    while(b) {

        if(b&1)
            ans = (ans*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return ans;
}
struct node
{
    ll x;
    ll l;
    ll rr;
    bool operator < (const node &nex) {
        return rr < nex.rr;
    }
}a[100010];
int main()
{
    int i, j, k;
    int n, t, m;
    int r, c;
    cin >> t;
    for(i = 0; i < t; i++) {
        scanf("%I64d%I64d", &a[i].x, &a[i].l);
        a[i].rr = a[i].x + a[i].l;
    }
    sort(a, a+t);
    ll lef = -1e11;
    int sum = 0;
    for(i = 0; i < t; i++) {
        if(a[i].x-a[i].l < lef) {
            ;
        }
        else {
            sum++;
            lef = a[i].rr;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
#include<vector>
using namespace std;
 
int main() {
  int a,b=0;
  cin>>a;
  vector<int>p(a);
  for(int i=0;i<a;i++){
    cin>>p.at(i);
    b+=p.at(i);
  }
  sort(p.begin(), p.end());
  b-=p.at(a-1)/2;
  cout<<b;
}

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

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


/////////////////////////////////////////////////////////////////////////////////////////

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<char>> s(h,vector<char>(w));
    rep(i,h){
        rep(j,w){
            cin >> s[i][j];
        }
    }  
    bool ans = true;
    
    rep(i,h){
        rep(j,w){
            int cnt = 0;
            for (int k = 0;k < 4;k++){
                int nx = j + dx[k],ny = i + dy[k];
                if (nx >= 0 && nx < w && ny >= 0 && ny < h){
                    if (s[i][j] == '#' && s[ny][nx] == '#'){
                        cnt++;
                    }
                }
            }
            if (s[i][j] == '#' && cnt == 0){
                ans = false;
                break;
            }
        }
    }

    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int main(){
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int ans=0;
  for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
      for(int k=0;k<=c;k++){
        if(500*i+100*j+50*k==x)ans++;
      }
    }
  }
  cout <<ans<<endl;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void SMTB2019B()
{
	int N;
	cin >> N;
	int x = N / 1.08;
	while (int(x * 1.08 + 0.0000000001) < N)
	{
		++x;
	}
	if (int(x * 1.08 + 0.0000000001) == N)
	{
		cout << x << endl;
	}
	else
	{
		cout << ":(" << endl;
	}
}
int main()
{
	SMTB2019B();
	return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Control.Applicative
import Data.List
import qualified Data.Map as Map
import Data.Array
import qualified Data.ByteString.Char8 as BC
import Data.Maybe
import qualified Data.Set as Set
import qualified Data.Sequence as Sq
import qualified Data.IntMap as IMap
import qualified Data.Vector as V
import Data.Sequence (ViewL(..),ViewR(..),(><),(<|),(|>),Seq)

bsreadInt :: BC.ByteString -> Int
bsreadInt = fst . fromJust . BC.readInt

sqleft :: Seq a -> a
sqleft q = sqleft_(Sq.viewl q)
sqleft_ :: ViewL a -> a
sqleft_ (x :< xs) = x
sqright :: Seq a -> a
sqright q = sqright_(Sq.viewr q)
sqright_ :: ViewR a -> a
sqright_ (xs :> x) = x
--------------------------------------------------------------
main = do
    [a,b,c] <- map bsreadInt . BC.words <$> BC.getLine
    if (a+b) >= c
    then putStrLn "Yes"
    else putStrLn "No"

Measured memory_bytes: 380
#include <stdio.h>

int main()
{
  char s[11], a[4];

  int i;
  for(i=0; i<3; i++){
    scanf("%s", s);
    a[i] = s[0] + ('A' - 'a');
  }
  a[i] = '\0';

  printf("%s\n", a);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int max_n = 1e5 + 10;
using pq = pair<long, long>;

int main()
{
    int n, m;
    priority_queue<pq, vector<pq>, greater<pq>> que;

    cin >> n >> m;
    for (int i = 0; i < n; ++i)
    {
        int a, b;
        cin >> a >> b;
        que.push(make_pair(a, b));
    }

    long long res = 0;
    while(!que.empty())
    {
        pq p = que.top();
        que.pop();

        if(m - p.second > 0)
        {
            res += p.first * p.second;
            m -= p.second;
        } else
        {
            res += p.first * m;
            break;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 2420
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int A, B, C, D;
int main()
{
    cin >> A >> B >> C >> D;
    int left = A + B;
    int right = C + D;
    if (left == right)
    {
        cout << "Balanced" << endl;
        return 0;
    }
    cout << ((left > right) ? "Left" : "Right") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
string s;

int main() {
  INCANT;
  cin >> s;
  int cnt=0;
  rep(i, 6) cnt+=s[i]=='1';
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3628
fn input() -> String {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).unwrap();
	s.trim().to_owned()
}

fn main() {
	let     s = input();
	let mut f = true;
    
	for (i, c) in s.chars().enumerate() {
    	match c {
        	'R' => if (i + 1) % 2 == 0 {
				f = false;
				break;
			},
			'L' => if (i + 1) % 2 == 1 {
				f = false;
				break;
			},
			_ => {},
		}
	}

	println!("{}", if f == true { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [N, M] = input[0].map(Number);

  const answer = Array(N).fill(0);

  for (let i = 1; i <= M; i++) {
    const [a, b] = input[i].map(Number);

    answer[a - 1] += 1;
    answer[b - 1] += 1;
  }

  return answer.join("\n");
};

console.log(main(read()));


Measured memory_bytes: 29636