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

public class Main {
  static String[] r = {"Sunny","Cloudy","Rainy"};
  	public static int ncr(String str)
    {
      if(str.equalsIgnoreCase("Sunny"))
        return 0;
      if(str.equalsIgnoreCase("Cloudy"))
        return 1;
      if(str.equalsIgnoreCase("Rainy"))
        return 2;
      return -1;
    }
    public static void main(String[] args) throws Exception {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        OutputStream outputStream = System.out;
    	PrintWriter out = new PrintWriter(outputStream);

        int i, n, m, k;
		
		String str= br.readLine();    
      	HashSet<Character> h = new HashSet<>();
      h.add('L');
      h.add('U');
      h.add('D');
      	HashSet<Character> s = new HashSet<>();
      s.add('R');
      s.add('U');
      s.add('D');
      int flag=0;
        for(i=1;i<=str.length();i++)
        {
          char ch =str.charAt(i-1);
          if(i%2==0)
          {
            if(!h.contains(ch))
            	{flag=1;break;}
          }
          else
          {
            if(!s.contains(ch))
            {flag=1;break;}
          }  
        }
      if(flag==1)
		out.print("No");
     else
       	out.print("Yes");
	out.flush();
	out.close();
	}
}

Measured memory_bytes: 22996
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		double r=sc.nextDouble();
		double pi=Math.PI;
		double area=r*r*pi;
		double length=2*r*pi;
		System.out.printf("%f %f",area,length);
	}
}

Measured memory_bytes: 28208
#include<stdio.h> 

int main(void){
int A, B, C, D;
scanf("%d %d %d %d", &A, &B, &C, &D);

if(A+B > C+D) printf("Left");
else if (A+B < C+D) printf("Right");
else printf("Balanced");

return 0;

}

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

class Program {
  static void Main() {
    var arr = Console.ReadLine().Split().Select(ulong.Parse).ToArray();
    var a = arr[0];
    var b = arr[1];
    var x = arr[2];
    var ans = b / x - a / x;
    Console.WriteLine(a % x == 0 ? ans + 1 : ans);
  }
}

Measured memory_bytes: 13396
<?php
fscanf(STDIN, "%s %s %s", $a, $b, $c);
// $a = 'abc';
// $b = 'cdf';
// $c = 'fgh';
$arrayFirst = str_split($a);
$arraySecond = str_split($b);
$arrayThird = str_split($c);
if($arrayFirst[count($arrayFirst) - 1] === $arraySecond[0]){
  if($arraySecond[count($arraySecond) -1] === $arrayThird[0]){
    echo 'YES';
  }else{
    echo 'NO';
  }
}else{
  echo 'NO';
}
?>

Measured memory_bytes: 4728
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n]={};
  for(int i=0;i<n;i++) cin>>a[i];
  long long ans=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
        if(i<j&&j<k&&a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i]&&((a[i]+a[j])>a[k]&&(a[j]+a[k])>a[i]&&(a[i]+a[k])>a[j])){
          
            ans++;
        }
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main()
{
    int h,w; cin >> h >> w;
    string field[h];
    rep(i,h) cin >> field[i];
    
    int dx[] = {-1,0,1,-1,1,-1,0,1};
    int dy[] = {1,1,1,0,0,-1,-1,-1};

    rep(hi,h) rep(wi,w){
        if(field[hi][wi]=='.') field[hi][wi] = '0';
        if(field[hi][wi] != '#') continue;
        rep(k,8){
            int nx = wi + dx[k]; int ny = hi + dy[k];
            if(nx < 0 || ny < 0 || nx >= w || ny >= h || field[ny][nx]=='#') continue;
            if(field[ny][nx]=='.') field[ny][nx] = '0';
            field[ny][nx]++;
        }
    }
    rep(hi,h){
        cout << field[hi] << endl;
    }
}

/*
g++ c.cpp
./a.out

oj d https://atcoder.jp/contests/abc172/tasks/abc172_c
g++ c.cpp
oj t
*/


Measured memory_bytes: 3596
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
//---------------------------

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



  int n;cin >> n;
  vector<int> v(n),w(n);
  long long ans = 1, cnt = 0;
  REP(i,n){
    cin >> v[i];
  }
  sort(v.begin(),v.end(),greater<int>());

  REP(i,n){
    if (cnt >= 2) {
      break;
    }
    if (v[i] == v[i+1]) {
      ans = ans * v[i];
      cnt++;
      i++;
    //  cout << i << " " << v[i] << " " << cnt << "\n";
    }
    if (i == n-1 && cnt < 2) {
      ans = 0;
    }
  }
  P(ans);

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define clr(a,b) memset(a,b,sizeof a)
#define PII pair<int,int>
#define PI acos(-1.0)
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
typedef long long ll;
typedef unsigned long long ull;
const int INF=0x3f3f3f3f;
const int maxn=1e5+10;
int dp[1<<16],V[maxn],cnt[16];
int n,x,y,a;
inline int Count(int x)
{
	int ans=0;
	for(int i=0;i<=15;++i) if(x&(1<<i)) ans++;
	return ans;
}
int Work(int S)
{
    if(S==0) return 0;
    if(dp[S]!=-1) return dp[S];
    dp[S]=INF;
    for(int i=1;i<16;i++)
    {
    	if(S&(1<<i))
            for(int j=1;j<16;j++)
            {
            	
            	if(S&(1<<j))
                {
                    int cs=S^(1<<i)^(1<<j)^(1<<(i^j));
                    if(i!=j)
					{
						if(((1<<(i^j)) & S) == (1<<(i^j))) dp[S]=min(dp[S], Work(cs) + 2);
						else dp[S]=min(dp[S], Work(cs) + 1 ); 
					}
                }
			}
	}
    return dp[S];
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<n;i++)
    {
        scanf("%d%d%d",&x,&y,&a);
        V[x]^=a; V[y]^=a;
    }
    for(int i=0;i<n;i++) if(V[i]) cnt[V[i]]++;
    int ans=0,s=0;
    for(int i=0;i<16;i++) ans += cnt[i]/2, s^=(cnt[i]&1)<<i;
    memset(dp,-1,sizeof dp);
    ans+=Work(s);
    printf("%d\n",ans);
	return 0;
}


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

int main()
{
	int64_t n, m, ans = -1;
	cin >> n >> m;
	for (int64_t g = 1; g * g <= m; g++)
	{
		if (m % g == 0)
		{
			int64_t h = m / g;
			if (n <= m / g)
			{
				ans = max(ans, g);
			}
			if (n <= m / h)
			{
				ans = max(ans, h);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
r,c = gets.split(" ").map(&:to_i)
matrix = r.times.map { gets.split(" ").map(&:to_i) }
sum_rows = matrix.map {|xs| xs.reduce(:+) }
sum_cols = c.times.map {|j|
  r.times.map {|i| matrix[i][j] }.reduce(:+)
}

sum_cols << sum_cols.inject(:+)
r.times {|i| matrix[i] << sum_rows[i] }
matrix << sum_cols

puts matrix.map {|xs| xs.join(" ") }.join("\n")

Measured memory_bytes: 9112
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

struct Val {
  ll sum, ways;
  Val operator+(const Val& rhs) const {
    if (sum > rhs.sum) return *this;
    if (sum < rhs.sum) return rhs;
    return Val{sum, ways + rhs.ways};
  }
};

int main() {
  int N, A, B;
  while (cin >> N >> A >> B) {
    vector<ll> v(N);
    for (int i = 0; i < N; i++) cin >> v[i];
    vector<vector<Val>> dp(N + 1, vector<Val>(N + 1));
    dp[0][0] = {0, 1};
    for (int i = 0; i < N; i++) {
      dp[i + 1][0] = dp[i][0];
      for (int j = 1; j <= N; j++) {
        auto& a = dp[i][j];
        auto& b = dp[i][j - 1];
        dp[i + 1][j] = a + Val{b.sum + v[i], b.ways};
      }
    }
    ll num = 0, den = 1, ways = 0;
    for (int j = A; j <= B; j++) {
      auto& a = dp[N][j];
      if (a.sum * den > num * j) {
        num = a.sum;
        den = j;
        ways = a.ways;
      } else if (a.sum * den == num * j) {
        ways += a.ways;
      }
    }
    printf("%.10f\n%lld\n", (double)num / den, ways);
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout<<#x<<" "<<x<<"\n";
#define lli long long int
long long int mod= 1000000007,modd=998244353;
int32_t main()
{
     string s;
     cin>>s;
     lli n=s.length();
     lli i;
     for(i=0;i<n;i++)
     {
         if(s[i]=='?') cout<<"D";
         else
         {
            cout<<s[i];
         }
     }
     cout<<"\n";
   return 0;
}//main


Measured memory_bytes: 3720
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AMeasure {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    string s;
	    in >> s;
	    if(s.length() == 2) out << s << endl;
	    else {
	        reverse(s.begin(), s.end());
	        out << s << endl;
	    }
	}
};


int main() {
	AMeasure solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vii = vector<int>;
using pii = pair<int, int>;
template <typename T = vii>
using vec = vector<T>;

const ll INF = 1e18, MOD = 1e9 + 7;

const int MAX = 1e6;

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    // freopen("in.in", "r", stdin);

    string s;
    cin >> s;
    const int n = s.size();
    vii a;
    int val = 0;
    for (int p = 1, i = n - 1; i >= 0; i--, (p *= 10) %= 13) {
        if (s[i] == '?') {
            a.push_back(p);
        }
        else {
            (val += p * (s[i] - '0')) %= 13;
        }
    }
    val = (5 - val + 13) % 13;
    vll dp(13);
    dp[0] = 1;
    for (int x : a) {
        vll new_dp(13);
        for (int i = 0; i < 13; i++) {
            for (int j = 0; j < 10; j++) {
                const int k = (i + j * x) % 13;
                (new_dp[k] += dp[i]) %= MOD;
            }
        }
        swap(dp, new_dp);
    }
    cout << dp[val] << '\n';
}

Measured memory_bytes: 1020
#include <iostream>
using namespace std;
#define M 1000000007

class ModComb {
    long long *fact, *facti;
    const int mod;
public:
    explicit ModComb(int n, int m) : mod(m) {
        fact = new long long[n+1];
        facti = new long long[n+1];
        fact[0] = 1; facti[0] = 1;
        for (int i = 1; i <= n; i++) fact[i] = (fact[i-1] * i) % m;
        // calc 1/n!
        long long &inv = facti[n], pw = fact[n];
        inv = 1;
        for (int e = mod-2; e > 0; e /= 2) {
            if (e&1) inv = inv * pw % mod;
            pw = pw * pw % mod;
        }
        for (int i = n-1; i > 0; i--) facti[i] = (facti[i+1] * (i+1)) % m;
    }

    ~ModComb() {
        if (fact) delete[] fact;
        if (facti) delete[] facti;
    }

    long long get(int n, int k) const {
        if (n < 0 || k < 0 || k > n) return 0;
        return fact[n] * facti[k] % mod * facti[n-k] % mod;
    }
};

int main() {
    int n, m, k; cin >> n >> m >> k;
    ModComb mc(n*m+1, M);
    long long comb = mc.get(n*m-2, k-2);
    long long ans = 0;
    for (int d = 1; d < n; d++) ans += (long long)m * m * d * (n - d);
    for (int d = 1; d < m; d++) ans += (long long)n * n * d * (m - d);
    ans %= M;
    cout << comb * ans % M << endl;
}


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

using namespace std;
using namespace __gnu_pbds;

/*
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("-O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define md(l, r) l + (r - l) / 2
#define ll long long
#define btw(a, l, r) a.begin() + l, a.begin() + r + 1
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int(x.size()))
#define sqr(x) (x) * (x)
#define endl '\n'

#define getfiles ifstream cin("input.txt"); ofstream cout("output.txt");
#define clr(x, y) memset((x), (y), sizeof (x))
#define ld long double

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<vector<pair<int, int> > > vvpii;
typedef vector<vector<pair<ll, ll> > > vvpll;
typedef pair<int, pair<int, int> > piii;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef vector<vector<ll> > vvll;
typedef vector<pair<ll, pair<ll, ll> > > vplll;
typedef pair<ll, ll> pll;

const ld eps = -1e9;
const long long N = 200001, P = 1e9 + 7, P1 = 1e9 + 13, iINF = 1e9, INF = 2e18, K = 73, K1 = 79;

ll dstF(ll x, ll y, ll xx, ll yy) {
    return (sqr(x - xx) + sqr(y - yy));
}

ld dstSqrtF(ll x, ll y, ll xx, ll yy) {
    return (sqrt(sqr(x - xx) + sqr(y - yy)));
}

ll _bp(ll val, ll st, ll p) {
    if (st == 0) {
        return 1;
    }
    ll temp = _bp(val, st / 2, p);
    temp = sqr(temp);
    temp %= p;
    if (st % 2 == 1) {
        temp *= val;
        temp %= p;
    }
    return temp;
}

ll _bp(ll val, ll st) {
    if (st == 0) {
        return 1;
    }
    ll temp = _bp(val, st / 2);
    temp = sqr(temp);
    if (st % 2 == 1) {
        temp *= val;
    }
    return temp;
}

ll nok(ll a, ll b) {
    return (a / __gcd(a, b) * b);
}


ll fact[1001000];

void buildFacts(ll n, ll p) {
    fact[0] = 1;
    for (ll i = 1; i <= n; i++) {
        fact[i] = (fact[i - 1] * i) % p;
    }
}

ll C(ll n, ll k, ll p = -1) {
    if (p == -1) {
        ll x = fact[n];
        ll y = (fact[k] * fact[n - k]);
        return (x / y);
    } else {
        ll x = fact[n];
        ll y = (fact[k] * fact[n - k]) % p;
        x = (x * _bp(y, p - 2, p)) % p;
        return x;
    }
}


void solve() {
    ll n;
    cin >> n;
    buildFacts(n + 1, P);
    ll ans = 0;
    for (int i = 2; i <= n; i++) {
        ans += ((((C(n, i, P) * ((_bp(2ll, i, P) - 2 + P) % P)) % P) * _bp(8ll, n - i, P)) % P);
        ans %= P;
        //cout << ans << endl;
    }
    cout << ans << endl;
}

signed main() {
    //freopen("checklist.in", "r", stdin);
    //freopen("checklist.out", "w", stdout);
    //fast_io;
    int q;
    q = 1;
    //cin >> q;
    while (q != 0) {
        solve();
        --q;
    }
}

/*
*/


Measured memory_bytes: 11436
S = list(input())
T = list(input())
s = len(S)
t = len(T)
ans = ""

for i in reversed(range(s-t+1)):
    for j in range(t):
        if S[i+j] != T[j] and S[i+j] !="?":
            break
        if j == t-1:
            for k in range(t):
                S[i+k] = T[k]
            s = str("".join(S).replace("?","a"))
            print(s)
            exit()
print("UNRESTORABLE")

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<cassert>
#include<queue>

using namespace std;

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

int main() {
  while (true) {
    long long n, m;
    cin >> n >> m;
    if (n == 0 && m == 0) break;
    assert(n >= m);
    long long sum = 0, mn = 1234567890123456789LL, mn1 = 1234567890321456789LL;
    vector<pair<long long, pair<int, long long> > > edge[n];
    rep (i, m) {
      long long x, y, c;
      cin >> x >> y >> c;
      if (c <= 0) sum += c;
      else {
	if (c <= mn) {
	  mn1 = mn;
	  mn = c;
	} else if (c < mn1) {
	  mn1 = c;
	}
	edge[x].push_back(make_pair(y, make_pair(i, c)));
	edge[y].push_back(make_pair(x, make_pair(i, c)));
      }
    }
    long long res = mn + mn1;
    {
      bool can[111][111] = {};
      rep (i, n) {
	queue<long long> pos;
	pos.push(i);
	while (!pos.empty()) {
	  long long now = pos.front();
	  pos.pop();
	  if (can[i][now]) continue;
	  can[i][now] = true;
	  rep (j, edge[now].size()) {
	    pos.push(edge[now][j].first);
	  }
	}
      }
      rep (i, n) rep (j, n) if (!can[i][j] && !can[j][i]) {
	cout << sum << endl;
	goto next;
      }
    }
    rep (iii, n) rep (jjj, edge[iii].size()) {
      bool can[111][111] = {};
      int num = edge[iii][jjj].second.first;
      rep (i, n) {
	queue<long long> pos;
	pos.push(i);
	while (!pos.empty()) {
	  long long now = pos.front();
	  pos.pop();
	  if (can[i][now]) continue;
	  can[i][now] = true;
	  rep (j, edge[now].size()) {
	    if (edge[now][j].second.first == num) continue;
	    pos.push(edge[now][j].first);
	  }
	}
      }
      rep (i, n) rep (j, n) if (!can[i][j] && !can[j][i]) {
	res = min(res, edge[iii][jjj].second.second);
      }
    }
    cout << sum + res << endl;
  next:;
  }
  return 0;
}

Measured memory_bytes: 1224
#!/usr/bin/perl

sub main() {
  my($A,$B)=split(/ /,<>);
  my $ans = prob($A,$B);
  print $ans;
}

sub prob() {
  my($A,$B) = @_;
  my $ab = $A.$B;
  chomp($ab);
  return 'H' if $ab eq 'HH';
  return 'D' if $ab eq 'HD';
  return 'D' if $ab eq 'DH';
  return 'H' if $ab eq 'DD';
}

&main();

Measured memory_bytes: 512
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner cin = new Scanner(System.in);
		
		while (cin.hasNext()){
			int n = cin.nextInt();
			calculation(n);
		}
	}
	
	public static void calculation(int n){
		int ans = 0;
		int a, b, c, d;
		
		for (a = 0; a < 10; a++){
			for (b = 0; b < 10; b++){
				for (c = 0; c < 10; c++){
					for (d = 0; d < 10; d++){
						if (a + b + c + d == n){
							ans++;
						}
					}
				}
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 26484
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define ep emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll a, b; cin >> a >> b;

  if (a <= 1 || b <= 1) {
    cout << 1 << endl;
    return (0);
  }

  cout << (a * b + 1) / 2 << endl;

  return (0);
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int N, K;

	cin >> N >> K;

	if ((N + 1) / 2 >= K) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
H, W, M = map(int, input().split())
hw = set()
cnt_h, cnt_w = [0] * H, [0] * W
for i in range(M):
    x, y = map(int, input().split())
    hw.add((x - 1, y - 1))
    cnt_h[x - 1] += 1
    cnt_w[y - 1] += 1

max_h, max_w = max(cnt_h), max(cnt_w)

h_list = [h for h in range(H) if cnt_h[h] == max_h]
w_list = [w for w in range(W) if cnt_w[w] == max_w]

res = max_h + max_w - 1
for h in h_list:
    for w in w_list:
        if (h, w) not in hw:
            print(res + 1)
            exit()
print(res)


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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<std::vector<char> > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int n, m; cin >> n >> m;
    v_bool a(n+5, true);
    v_ll v(n+5, 0);

    irep(i, m) {
        int tmp; cin >> tmp;
        a[tmp] = false;
    }
    
    v[0] = 1;
    irep(i, n) {
        if(a[i+1]) { 
            v[i+1] += v[i]; 
            v[i+1] %= IMOD;
        }
        if(a[i+2]) { 
            v[i+2] += v[i]; 
            v[i+2] %= IMOD;
        }  
    }

    //irep(i, n) { cout << v[i] << endl; }
    cout << v[n] << endl;
    return 0;
}
/** atcoder **/


Measured memory_bytes: 1024
#include <cstdio>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;

class Node
{
public:
	vector<int> to;
};

bool dfs(int p, int T, vector<Node>& graph, vector<vector<int> >& flow, vector<int>& level, vector<bool>& finished)
{
	if(p==T) return true;
	if(finished[p]) return false;;
	
	finished[p]=true;
	
	for(int i=0; i<graph[p].to.size(); i++)
	{
		int next=graph[p].to[i];
		if(level[p]>=level[next]) continue;
		if(flow[p][next]) continue;
		
		if(dfs(next, T, graph, flow, level, finished))
		{
			finished[p]=false;
			flow[p][next]++;
			flow[next][p]--;
			return true;
		}
	}
	return false;
}

int dinic(int S, int T, vector<Node>& graph, vector<vector<int> >& flow)
{
	bool end=false;
	int total=0;
	while(!end)
	{
		end=true;
		vector<int> level(graph.size(), -1);
		level[S]=0;
		
		queue<int> q;
		q.push(S);
		while(!q.empty())
		{
			int n=q.front(); q.pop();
			for(int i=0; i<graph[n].to.size(); i++)
			{
				int next=graph[n].to[i];
				if(level[next]!=-1) continue;
				if(flow[n][next]) continue;
				level[next]=level[n]+1;
				q.push(next);
			}
		}
		
		if(level[T]==-1) break;
		
		vector<bool> finished(graph.size());
		while(1)
		{
			if(dfs(S,T,graph,flow,level,finished))
			{
				total++;
				end=false;
			}
			else break;
		}
	}
	
	return total;
}

int main()
{
	int N,M;
	while(scanf("%d", &N), N)
	{
		map<int, int> d;
		vector<Node> graph;
		int cnt=N+2;
		scanf("%d", &M);
		graph.resize(N+2+M);
		vector<vector<int> > flow(N+2+M, vector<int>(N+2+M));
		for(int i=0; i<M; i++)
		{
			int t;
			scanf("%d", &t);
			if(d.count(t)==0) 
			{
				d[t]=cnt;
				cnt++;
			}
			
			int id=d[t];
			graph[0].to.push_back(id);
		}
		for(int i=0; i<N; i++)
		{
			scanf("%d", &M);
			while(M--)
			{
				int t;
				scanf("%d", &t);
				if(d.count(t)==0) continue;
				int id=d[t];
				graph[id].to.push_back(i+2);
				graph[i+2].to.push_back(id);
				flow[i+2][id]=1;
			}
			graph[i+2].to.push_back(1);
		}
		
		printf("%d\n", dinic(0,1,graph,flow));
	}
	
}

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

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

    x = abs(x);
    long long sum = 0;
    for (int i = 1; 1; i++) {
        sum += i;
        if (sum >= x) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3624
program main
   implicit none
   integer H, W, i, j, TF
   character, allocatable :: s(:, :)
   read(*, *) H, W
   allocate(s(0:H+1, 0:W+1))
   s(:, :) = '.'
   do j = 1, H
       do i = 1, W-1
           read(*, '(a1)', advance = 'No') s(j, i)
	   end do
       read(*, '(a1)') s(j, W)
   end do
   TF = 0
   do j = 1, H
       do i = 1, W
	       if(s(i, j) == '#') then
	           if(s(i, j) == s(i-1, j) .or. s(i, j) == s(i+1, j) .or. s(i, j) == s(i, j-1) .or. s(i, j) == s(i, j+1)) then
		            TF = TF + 0
		       else
		            TF = TF - 1
				    exit
		       end if
	       end if
	   end do
   end do
   if(TF == 0) then
       write(*, *) 'Yes'
   else
       write(*, *) 'No'
   end if
end program main

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        String str = scan.next();
        int orderNum = scan.nextInt();
        int a = 0;
        int b = 0;

        for (int i = 0; i < orderNum; i++){
            String order = scan.next();

            if (order.equals("print")){
                a = scan.nextInt();
                b = scan.nextInt();

                String printResult = str.substring(a, b + 1);
                System.out.println(printResult);
            }

            if (order.equals("reverse")){
                a = scan.nextInt();
                b = scan.nextInt();

                char[] strReverse = str.toCharArray();

                for (int j = 0; j < (b - a + 1) / 2; j++){
                    char tmp = strReverse[j + a];
                    strReverse[j + a] = strReverse[b - j];
                    strReverse[b - j] = tmp;
                }
                str = String.valueOf(strReverse);
            }

            if (order.equals("replace")){
                a = scan.nextInt();
                b = scan.nextInt();
                String strReplaceWord = scan.next();
                char[] strReplace = str.toCharArray();
                char[] strReplaceWordChara = strReplaceWord.toCharArray();

                for (int j = 0; j < strReplaceWordChara.length; j++){
                	strReplace[a + j] = strReplaceWordChara[j];
                }
                str = String.valueOf(strReplace);
            }
        }
        scan.close();
    }
}

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

class Program
{

    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var inputs = Console.ReadLine().Split(' ');
        var A = new List<long>();
        for (int i = 0; i < inputs.Length; i++)
        {
            A.Add(long.Parse(inputs[i]));
        }
        A.Add(0);

        var lefts = new long[N + 1];
        lefts[0] = A[0];
        for (int i = 0; i < A.Count - 1; i++)
        {
            lefts[i + 1] = Gcd(lefts[i], A[i + 1]);
        }

        var rights = new long[N + 1];
        rights[N] = A[N - 1];
        for (int i = A.Count - 1; i >= 1; i--)
        {
            rights[i - 1] = Gcd(rights[i], A[i - 1]);
        }

        long max = 0;
        for (int i = 0; i < A.Count - 1; i++)
        {
            long target;
            if (i == 0)
            {
                target = rights[1];
            }
            else if(i == A.Count - 2)
            {
                target = lefts[i - 1];
            }
            else
            {
                target = Gcd(lefts[i - 1], rights[i + 1]);
            }

            max = Math.Max(target, max);
        }

        Console.WriteLine(max);
    }


    /**
     * ユークリッド互除法
     * <see cref="https://qiita.com/gushwell/items/e9614b4ac2bea3fc6486"/>
     */
    public static long Gcd(long a, long b)
    {
        if (a < b)
            // 引数を入替えて自分を呼び出す
            return Gcd(b, a);
        while (b != 0)
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }

}



Measured memory_bytes: 25820
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define co(i) cout<<(i)<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
#define all(i) i.begin(),i.end()
#define pint pair<int, int>
#define vint vector<int>
using namespace std;

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

#define ld long double

ld dp[302][302][302];
	
int main(){
	int n; cin>>n;
	int b[3]={};
	FOR(i,0,n){
		int a; cin>>a;
		a--;
		b[a]++;
	}
	dp[0][0][0]=0;
	FOR(k,0,b[2]+1){
		FOR(j,0,b[1]+b[2]+1){
			FOR(i,0,b[0]+b[1]+b[2]+1){
				if(i==0&&j==0&&k==0) continue;
				ld p1=(ld)i/n,p2=(ld)j/n,p3=(ld)k/n;
				if(i) dp[i][j][k]+=p1*dp[i-1][j][k];
				if(j) dp[i][j][k]+=p2*dp[i+1][j-1][k];
				if(k) dp[i][j][k]+=p3*dp[i][j+1][k-1];
				dp[i][j][k]+=1;
				dp[i][j][k]/=(p1+p2+p3);
			}
		}
	}
	fcout<<dp[b[0]][b[1]][b[2]]<<endl;
}


Measured memory_bytes: 430336
/*
[abc136] B - Uneven Numbers
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

int N;

ll solve() {
    int ans = 0;
    for (int k = 1; k <= N; k *= 100) {
        ans += min(N, k * 10 - 1) - k + 1;
    }

    return ans;
}

int main() {
    cin >> N;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
 
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

int main() {
    int n, m;
    cin >> n >> m;
    if(n == m){
        cout << "Yes";
    }else{
        cout << "No"; 
    }
    
    return 0;
}

Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final long n = Long.parseLong(in.nextLine());
        long k = 0, kk = 1;
        for (int i = 0; i < n; i++) {
            if ((k / kk) % 10 == 9 && f(k + kk) > f(k + 10 * kk)) { 
                kk *= 10;
            }
            k += kk;
            System.out.println(k);
        }
    }

    private static double f(long num) {
        long copy = num;
        long sum = 0;
        while (copy > 0) {
            sum += copy % 10;
            copy /= 10;
        }
        return (double) num / sum;
    }
}


Measured memory_bytes: 36328
mod = 10**9+7
N,K = map(int,input().split())
p = [1]*(10**5+1)
for i in range(1,10**5+1):
    p[i] = pow(i,N,mod)
memo = [-1]*(K+1)
memo[1] = 1
def f(k):
    if memo[k] != -1:
        return memo[k]
    res = p[k]
    for n in range(2,k+1):
        res -= f(k//n)
    res %= mod
    memo[k] = res
    return res
ans = 0
for n in range(1,K+1):
    ans += n*f(K//n)
    ans %= mod

print(ans)

Measured memory_bytes: 70064
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	ls := make([]int, n)
	for i := range ls {
		fmt.Scan(&ls[i])
	}

	amount := 0
	maxL := ls[0]
	for i := 1; i < n; i++ {
		tmp := ls[i]
		if maxL < tmp {
			amount += maxL

			maxL = tmp
		} else {
			amount += tmp
		}
	}

	if maxL < amount {
		fmt.Print("Yes")
	} else {
		fmt.Print("No")
	}
}


Measured memory_bytes: 512
n = int(input())
dict = {}
for i in range(97, 123):
    dict[chr(i)] = 100
for _ in range(n):
    s = input()
    for i in range(97, 123):
        count = s.count(chr(i))
        dict[chr(i)] = min(count, dict[chr(i)])
ans = ''
for i in range(97, 123):
    if dict[chr(i)] != 100:
        ans +=  chr(i) * dict[chr(i)]
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define ll long long
#define pi (acos(-1))
// https://atcoder.jp/contests/abc172/tasks/abc172_d
int main() { 
        
int l,r,d;int ans=0;
std::cin>>l>>r>>d;
for(int i=l;i<=r;++i){
if(i%d==0){
ans++;
}}
std::cout<<ans<<std::endl;


        return 0; }

Measured memory_bytes: 3592
#include"bits/stdc++.h"
using namespace std;

bool solve(vector<int>& A, int M, int i);

int main(void) {

	int N, Q, M;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A.at(i);

	cin >> Q;
	for (int i = 0; i < Q; i++)
	{
		cin >> M;
		if (solve(A, M, 0)) cout << "yes" << endl;
		else cout << "no" << endl;
	}

	return 0;
}

bool solve(vector<int>& A, int M, int i)
{
	if (i >= A.size())return false;
	if (A.at(i) == M) return true;

	bool flag = solve(A, M, i + 1) || solve(A, M - A.at(i), i + 1);
	return flag;
}


Measured memory_bytes: 3108
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	return gcd(b, a % b);
}

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

	ll n, x;
	
	cin >> n >> x;
	ll a[n];

	ll d[n];

	rep(i, n)
	{
		cin >> a[i];
		d[i] = abs(a[i] - x);
	}

	ll gc = d[0];
	for(int i = 1; i < n; i++)
	{
		gc = gcd(gc, d[i]);
	}

	cout << gc << endl;
	
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(){
    int n;

    scanf("%d", &n);

    int x = 0;
    int flag = 0;
    for(x = 0; ; ++x){
        if((int)(x * 1.08) == n){
            flag = 1;
            break;
        }else if(x > n) break;
    }

    if(flag == 1) printf("%d\n", x);
    else printf(":(\n");

    return 0;
}


Measured memory_bytes: 1732
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');
// const input = fs.readFileSync('./input.txt', 'utf8');

_b(input);

function _b(input: string) {
  const [_ND, ..._XY] = input.split('\n');
  _XY.pop();
  const [N, D] = _ND.split(' ').map((s) => parseInt(s));

  const D2 = D * D;
  let count = 0;
  for (const line of _XY) {
    const [X, Y] = line.split(' ').map((s) => parseInt(s));
    if (X * X + Y * Y <= D2) {
      count++;
      // console.log('Yes', X, Y);
    } else {
      // console.log('No', X, Y);
    }
  }

  console.log(count);
}


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

int A, B;
int main() {
    cin >> A >> B;

    map<int, int> mp;
    mp[A]++;
    mp[B]++;

    for (int i = 1; i <= 3; i++) {
        if (!mp.count(i)) {
            cout << i << endl;
            return 0;
        }
    }
}

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

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

  int first_idx = -1;
  for (int i = 0; i < s.length(); i++)
  {
    if (s[i] == 'C')
    {
      first_idx = i;
      break;
    }
  }
  if (first_idx == -1)
  {
    cout << "No" << endl;
    return 0;
  }

  for (int i = first_idx; i < s.length(); i++)
  {
    if (s[i] == 'F')
    {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector<int>x(m);
  vector<int>y(m);
  vector<int>balls(n+1,1);
  int i;
  for(i=0;i<m;i++){
    cin >> x[i] >> y[i];
  }
  vector<bool>red(n+1,false);
  red[1] = true;
  for(i=0;i<m;i++){
    if(red[x[i]]){
      red[y[i]]=true;
    }
      balls[x[i]]--;
      balls[y[i]]++;
      if(balls[x[i]]==0)red[x[i]]=false;
  }
  int ans = 0;
  for(i=1;i<=n;i++){
    if(red[i])ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPD(i,n) for(int i=(n)-1;i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
#define TLE() cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms.\n";
const ll MOD = 1E9+7;
const ll IINF = 1E18;
const int INF = 1e9;
const double EPS = 1E-9;
const double PI = atan(1.0) * 4.0;
template<class T> T getbit(T s, int i) {return s>>i&1;}
template<class T> void flipbit(T& s, int i) {s^=(1LL<<i);}
constexpr int cntbit(ll x) {return __builtin_popcountll(x);}
constexpr int lg2(ll x) {return __lg(x);} // return int(log2(x))
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
ll fpow(ll a,ll p){ll res=1LL;while(p){if(p&1LL) res=res*a%MOD;a=a*a%MOD;p>>=1LL;} return res;}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	vector<pair<string,pair<int,int>>> v;
	int n;
	cin>>n;
	REP(i,n){
		string s;
		int x;
		cin>>s>>x;
		v.eb(s,mp(x,i));
	}
	sort(all(v),[](const pair<string,pair<int,int>>& L,const pair<string,pair<int,int>>& R){
				if(L.fi==R.fi) return L.se.fi>R.se.fi;
				else{
					for(int i=0;i<min(sz(L.fi),sz(R.fi));++i)
						if(L.fi[i]<R.fi[i]) return true;
						else if(L.fi[i]>R.fi[i]) return false;
					return sz(L.fi)<sz(R.fi);	
				}
			});
	for(auto i:v)
		cout<<i.se.se+1<<'\n';
}



Measured memory_bytes: 3664
s=input()
q=int(input())
mode=1
h=[]
t=[]
for i in range(q):
    x=input()
    if x=="1":
        if mode==1:
            mode=0
        else:
            mode=1
    else:
        a=int(x[0])
        b=int(x[2])
        c=x[4]
        if b==1:
            if mode==1:
                h.append(c)
            else:
                t.append(c)
        elif b==2:
            if mode==0:
                h.append(c)
            else:
                t.append(c)
s=list(s)
if mode==1:
    ans=h[::-1]+s+t
elif mode==0:
    ans=t[::-1]+s[::-1]+h
print("".join(ans))

Measured memory_bytes: 10076
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            System.out.println(A + B >= 10 ? "error" : (A + B));
        }
    }
}


Measured memory_bytes: 27072
#include<bits/stdc++.h>
using namespace std;
int k,a[40],f;
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int x,y;
		cin>>x>>y;
		if(a[x]!=y&&a[x]||n>1&&x==1&&y==0)f=1;
		a[x]=y;
	}
	if(f){
		cout<<-1;
		return 0;
	}
	int i=1;
    if(a[1]==0&&n>1)
    	cout<<1,i++;
	for(;i<=n;i++)
		cout<<a[i];
}

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

rmax=0
for a100 in range(0,f+1,100*a):
   for b100 in range(0,f-a100+1,100*b):
#   for b100 in range(0,f+1,100*b):
        if a100+b100>0:
            fcd=f-a100-b100
            for ci in range(0,fcd+1,c):
                for di in range(0,fcd+1,d):
                    if a100+b100+ci+di <=f:
                        if (a100+b100)/100*e>=ci+di:
                            if rmax<(ci+di)/(a100+b100):
                                rmax=(ci+di)/(a100+b100)
                                rab=a100+b100+ci+di
                                rcd=ci+di
if rmax>0:
    print(rab,rcd)
else:
    print(100*a,0)               

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;




int main(void) {
    
    int n,l;
    cin>>n>>l;
    vs s(n);
    rep(i,n)cin>>s[i];
    Sort(s);
    rep(i,n)cout<<s[i];
    cout<<endl;

}


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

int main(){

  int r0, w0, c, r;

  while(cin>>r0>>w0>>c>>r, r){
    for(int x=0;;x++){
      if(r0+x*r-c*w0>=0){
	cout<<x<<endl;
	break;
      }
    }
  }
  
  return 0;
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var N = input[0];
            var M = input[1];
            var A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var AsumM = new int[N + 1];
            for (var i = 1; i <= N; i++) AsumM[i] = (AsumM[i - 1] + A[i - 1]) % M;
            var numCnt = new Dictionary<int, int>();
            var ans = 0L;
            for (int i = 1; i <= N; i++)
            {
                if (AsumM[i] == 0) ans++;
                if (numCnt.ContainsKey(AsumM[i]))
                {
                    ans += numCnt[AsumM[i]];
                    numCnt[AsumM[i]]++;
                }
                else
                {
                    numCnt.Add(AsumM[i], 1);
                }
            }            

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 23264
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void) {
	//touitsu がtourist に見えたww
	int n,a=0,i;cin>>n;
	string A,B,C;cin>>A>>B>>C;
	for(i=0;i<n;i++){
		if(A[i]==B[i]&&B[i]==C[i]){}
		else if(A[i]==B[i]||B[i]==C[i]||A[i]==C[i]){a++;}
		else{a+=2;}
	}
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 384
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ _, m ] <- readInts
	[ ls, rs ] <- transpose <$> replicateM m readInts
	let
		lb = foldl1 max ls
		ub = foldl1 min rs
	print $ max 0 $ ub - lb + 1

Measured memory_bytes: 43260
#include <bits/stdc++.h>
#define ll long long
using namespace std;
template <typename T> void read(T &x) {
	x = 0; int f = 1; char c = getchar();
	while (!isdigit(c)) {if (c == '-') f = -1; c = getchar();}
	while (isdigit(c)) x = x * 10 + c - '0', c = getchar(); x *= f;
}
const int N = 100010;
int a[N];
int main() {
	int n; read(n);
	if (n % 3 == 0) {
		for (int i = 1; i <= n; i++) read(a[i]);
		sort(a + 1, a + n + 1);
		if (a[1] != a[n / 3] || a[n / 3 + 1] != a[n / 3 * 2] || a[n / 3 * 2 + 1] != a[n]) return puts("No"), 0;
		if ((a[1] ^ a[n / 3 + 1] ^ a[n]) == 0) puts("Yes");
			else puts("No");
	} else {
		bool fl = 1; int las = 0;
		for (int i = 1; i <= n; i++) {
			int x; read(x);
			if (x != las) fl = 0;
		}
		puts(fl ? "Yes" : "No");
	}
	return 0;
}

Measured memory_bytes: 640