akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1000000007;
int main(){
  ll n, A[200100], tmp = 0, ans = 0;
  cin >> n;
  for(int i=0; i<n; ++i) cin >> A[i];
  for(int i=n-2; i>=0; --i){
      tmp += A[i+1];
      tmp = tmp%MOD;
      ans += A[i]*tmp%MOD;
      ans = ans%MOD;
  } 
  cout << ans << endl;
}

Measured memory_bytes: 5164
#include <stdio.h>
int max (int a,int b){
  if(a>b){
    return a;
  } else {
    return b;
  }
}
int max3 (int a,int b,int c){
  return max(max(a,b),max(b,c));
}
int main(){
  int a,b;
  scanf("%d%d",&a,&b);
  printf("%d\n",max3(a+b,a-b,a*b));
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main(void){
    int n;
    int gap_n;
    int gap;
    int cnt;
    scanf("%d", &n);
    
    int gaps[40];
    int n_ = n;
    gap_n = 0;
    while (n_ > 3) {
        gaps[gap_n] = n_ - 2;
        n_ /= 2;
        gap_n++;
    }
    gaps[gap_n++] = 1;
    
    int arr[n];
    for (int i=0; i<n; i++) {
        scanf("%d", &arr[i]);
    }

    printf("%d\n", gap_n);
    for (int g=0; g<gap_n; g++) {
        if (g!=0) printf(" ");
        printf("%d", gaps[g]);
    }
    printf("\n");
        
    cnt = 0;
    for (int g=0; g<gap_n;g++) {
        gap = gaps[g];
        for (int i=0; i<n; i++) {
            int j=i;
            int value = arr[i];
            while ((j>=gap) && (arr[j-gap]>value)) {
                arr[j] = arr[j-gap];
                j -= gap;
                cnt++;
            }
            arr[j] = value;
        }
    }
    
    printf("%d\n", cnt);
    
    for (int i=0; i<n; i++) {
        if (i!=0) printf("\n");
        printf("%d", arr[i]);
    }
}



Measured memory_bytes: 6504
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = True
    m = 0
    for i in range(N-1):
        m = max(m, A[i])
        if m-1 > A[i+1]:
            ans = False
    return 'Yes' if ans else 'No'

print(solve())

Measured memory_bytes: 14396
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {
	int N,an=0;
	cin >> N;
	rep(i, N) {
		int j = i+1;
		int k = 0;
		while (j > 0) {
			j /= 10;
			k++;
		}
		if (k % 2 == 1) {
			an++;
		}
	}
	
		cout << an << endl;
	
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mod 1000000007
// #define mod 998244353
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	set<string> s;
	int n;
	cin>>n;
	for(int i = 0; i < n; i++){
		string temp;
		cin>>temp;
		s.insert(temp);
	}
	cout<<s.size()<<endl;
	return 0;
}

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

int main()
{
  int N, x=0, y=0;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A.at(i);
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  for(int i=0; i<N; i=i+2){
    x+=A.at(i);
    if(i<N-1) y+=A.at(i+1);
  }
  cout << x-y << endl;
} 

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

#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)

namespace std {
	template<class S, class T> pair<S, T> operator + (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first + b.first, a.second + b.second);}
	template<class S, class T> pair<S, T> operator - (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first - b.first, a.second - b.second);}
	template<class S, class T> pair<S, T>& operator += (pair<S, T> &a, const pair<S, T> &other) {return a = a + other;}
	template<class S, class T> pair<S, T>& operator -= (pair<S, T> &a, const pair<S, T> &other) {return a = a - other;}
	template<class S, class T> ostream& operator << (ostream& ost, pair<S, T> p) {ost << "(" << p.first << ", " << p.second << ")";return ost;}
	template<class T> ostream& print_iterable_container(ostream& ost, T& container) {
		for (auto&& iter = begin(container); iter != end(container); ++iter) ost << (iter == begin(container) ? " [ " : ", ") << (*iter);
		return ost << " ]";
	}
#	define APPLY_PRINT_ITERABLE_CONTAINER(container_type)\
	template<class T> ostream& operator << (ostream& ost, container_type<T>& container) {\
		return print_iterable_container(ost, container);\
	}
	APPLY_PRINT_ITERABLE_CONTAINER(vector);
	APPLY_PRINT_ITERABLE_CONTAINER(list);
	APPLY_PRINT_ITERABLE_CONTAINER(deque);
}

template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

using ld = long double;

template<class T> using VV = vector<vector<T> >;
template<class T> using maxPQ = priority_queue<T>;
template<class T> using minPQ = priority_queue<T, vector<T>, greater<T> >;
template<class T, class U> using uomap = unordered_map<T, U>;
template<class T> using uoset = unordered_set<T>;

const ll INF = 1001001001;
const ll INFll = (ll)INF * INF;
const ll MOD = 1000000007;
const ll MOD_FFT = 998244353;
const ld EPS = 1e-15;

//function<void(int,int)> tensi_no_3p=[&](int v,int d){
//};

int main() {
	ios_base::sync_with_stdio(false);
	vi N(4);
	rep(i, 4) cin >> N[i];
	sort(N.begin(), N.end());
	if (N[0] == 1 && N[1] == 4 && N[2] == 7 && N[3] == 9) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
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 (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    string s, t;
    cin >> s >>t;
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());

    cout << (s<t ? "Yes" : "No") << endl;

    return 0;
}

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

using namespace std;
int main(){   
	int n,c;  
	int r=0;   
	while(cin >> n && n){      
		c = 0;       
		vector<int> one(n);
		vector<int> two(n);    
		for(int i=0;i<n;i++){ 
			cin >> one[i];      
		}        
		while(one != two){           
			for(int k=0;k<one.size();k++){      
				r=0;            
				for(int i=0;i<one.size();i++)if(one[k]==one[i])r++;     
				two[k]=r;            
			}          
			c++;      
			swap(one,two);    
		}         
		cout << c-1 << endl;       
		for(int i=0;i<n;i++){     
			if(i)cout << " ";     
			cout << one[i];       
		}       
		cout << endl; 
	}
}

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

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

  long long ans = 0;
  
  ans = K*pow(K-1, N-1);
  cout << ans << endl;
  
}

Measured memory_bytes: 256
l = input().split()
x = l[0]
y = int(l[1])

ans = 0

foots = 2*int(x)

for i in  range(int(x)+1):
    if foots == y:
        ans +=1
    foots += 2

if ans == 1:
    print("Yes")

else:
    print("No")

Measured memory_bytes: 9180
#pragma GCC opimize (3, "Ofast", "inline")
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	int n, r;
	cin >> n >> r;
	if(n >= 10) cout << r << endl;
	else cout << 100*(10-n)+r << endl;
	return 0;
}

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

#define nax 100009
#define FOR(i,n,m) for(ll i =(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define pb push_back
#define fst first
#define snd second
#define mp make_pair
#define sz(v) int(v.size())
#define all(v) v.begin() , v.end()

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

int main(){
	int n; cin>>n;
	vi v(n);
	REP(i,n) cin>>v[i];

	int cont = 0,m = 0;
	REP(i,n-1){
		if(v[i+1]<=v[i]) cont++;
		else{
			m = max(m,cont);
			cont = 0;
		}
	}
	m = max(m,cont);

	cout<<m<<endl;

	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		double x1 = s.nextDouble();
		double y1 = s.nextDouble();
		double x2 = s.nextDouble();
		double y2 = s.nextDouble();
		System.out.println(Math.abs(Math.hypot(x2 - x1, y2 - y1)));
	}
}

Measured memory_bytes: 18468
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rep_ll(i,n) for(ll i = 0; i < (ll)(n); i++)
using namespace std;
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
const long double PI = (acos(-1));
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1};
ll mod = 1000000007;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    ll cnt=0;
    map<int,int> mp;
    rep(j, n){
        int j_aj=j-a[j];
        int i_p_ai=j+a[j];
        cnt += mp[j_aj];
        mp[i_p_ai]++;
    }
    cout << cnt;
}

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

int main()
{
    ll i,j,k,n,p,q;

    cin>>n>>k>>q;
    ll a[n+1]={0};
    for(i=1;i<=q;i++)
    {
        cin>>p;
        a[p]++;
    }
    for(i=1;i<=n;i++)
    {
        if(k-q+a[i]>0)cout<<"Yes\n";
        else cout<<"No\n";
    }
}


Measured memory_bytes: 1408
#include <cstdio>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	for(int i=b;i<=c;++i){
		if(i%a==0){
			puts("OK");
			return 0;
		}
	}
	puts("NG");
	return 0;
}

Measured memory_bytes: 1660
// C - Base -2 Number
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N; cin>>N;
	string ans = "";
	int p = -2;
	while(N != 0){
		int r = N % p; N /= p;
		if(r < 0){ r -= p; N++; }
		ans = to_string(r) + ans;
	}
	if(ans == "") ans = "0";
	cout<< ans <<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String args[]) {
    Scanner stdln = new Scanner(System.in);
    String str = stdln.nextLine();
    String array[] = str.split("");
    int i = 0;
    while(i < array.length){
      if(array[i].equals("B")) {
        if(i > 0) {
          array[i] = null;
          int x = i;
          while(array[x] == null){
            x--;
            if(x == 0) break;
          }
          array[x] = null;
        }else{array[i] = null;}
      }
      i++;
    }
    StringBuilder buf = new StringBuilder();
    String s = null;
    int j = 0;
    while(j < array.length){
      if (array[j] != null) {
        buf.append(array[j]);
        j++;
      }else j++;
    }
    s = new String(buf);
    System.out.println(s);
  }
}


Measured memory_bytes: 9556
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

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

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

int main() {
	ll A, B;
	cin >> A >> B;
	cout << lcm(A, B) << endl;
	return 0;
}


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

public class Main {

    static long gcd(long a, long b){
        if(a<b) return gcd(b,a);
        if(b==0) return a;
        if(a%b==0) return b;
        return gcd(b,a%b);
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long r = sc.nextLong();
        long D = sc.nextLong();
        long weight = sc.nextLong();
        for(int i=0; i<10; i++){
            weight = r*weight-D;
            System.out.println(weight);
        }

    }
}

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

using namespace std;

typedef long long int LLI;

int main() { 
    int a, b, c, x;
    while (cin >> a >> b >> c >> x) {
        int cnt = 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) ++cnt;
        cout << cnt << "\n";
    }

    return 0;
}


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n;

int main() {
    cin >> n;

    Vi v(n, 0);
    REP(i, n-1) {
        int x; cin >> x;
        v[x-1]++;
    }

    REP(i, n) {
        cout << v[i] << '\n';
    }
    
    return 0;
}


Measured memory_bytes: 4024
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

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

template <typename T>
struct RSQ {
  T n;
  T k;//`バケットの数
  T sqrt_n;//バケットの大きさ
  vector<T> data;
  vector<T> bucket_sum;

  RSQ() = delete;
  RSQ(T n_,T sqrt_n_ = 1000) {
    initialize(n_,sqrt_n_);
  }

  void initialize(T n_,T sqrt_n_ = 1000) {
    n = n_;

    sqrt_n = sqrt_n_;

    k = (n + sqrt_n - 1) / sqrt_n;//切り上げ割り算

    data.clear();bucket_sum.clear();

    data.resize(k * sqrt_n,0);
    bucket_sum.resize(k,0);
  }

  void update (T i,T a) {// i番目(0-indexed)の値をaに更新
    add(i,a - data[i]);
  }
  void add(T i,T x) {// i番目(0-indexed)の値をxだけ増やす
    if (i >= sqrt_n * k) {
      cerr << "error index k" << endl;
      return;
    }
    if (i >= n) {
      cerr << "warning index k" << endl;
    }

    data[i] += x;
    bucket_sum[i / sqrt_n] += x;
  }
  T query(T a,T b) const {
    T ret = 0;
    rep(i,k) {
      T l = i * sqrt_n,r = (i + 1) * sqrt_n;
      if (b <= l || r <= a)continue;
      if (l < a || b < r) {
        for (int i = max(l,a);i < min(b,r);i++) {
          ret += data[i];
        }
      }else {
        ret += bucket_sum[i];
      }
    }
    return ret;
  }
};

typedef long long ll;
ll n,q;

signed main() {
  cin >> n >> q;

  RSQ<ll> rsq(n);

  rep (i,q) {
    ll c,x,y;
    cin >> c >> x >> y;
    if(c) {
      x--;y--;
      cout << rsq.query(x,y+1) << endl;
    }else {
      x--;
      rsq.add(x,y);
    }
  }
  return 0;
}




Measured memory_bytes: 3636
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
int main(){
    string s;
    getline(cin,s);
    if (s == "Sunny")
        printf("Cloudy\n");
    if (s == "Cloudy")
        printf("Rainy\n");
    if (s == "Rainy")
        printf("Sunny\n");

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	a += b;
	c += d;
	string ans;
	if (a == c) ans = "Balanced";
	if (a > c) ans = "Left";
	if (a < c) ans = "Right";
	cout << ans << endl; 
	return 0;	
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char pat[4][9][9];
  int i, j, k;
  for(i = 0; i < 8; ++i) scanf("%s", pat[0][i]);
  for(i = 1; i < 4; ++i){
    printf("%d\n", i * 90);
    for(j = 0; j < 8; ++j)
      for(k = 0; k < 8; ++k)
        pat[i][k][7 - j] = pat[i - 1][j][k];

    for(j = 0; j < 8; ++j){
      for(k = 0; k < 8; ++k) printf("%c", pat[i][j][k]);
      puts("");
    }
  }
  return 0;
}

Measured memory_bytes: 552
import sys
from bisect import bisect_left

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, Q = map(int, readline().split())
    S = [int(readline()) for _ in range(A)]
    T = [int(readline()) for _ in range(B)]
    X = [int(readline()) for _ in range(Q)]

    ans = [INF] * Q
    vs = [0] * 2
    vt = [0] * 2
    for i, x in enumerate(X):
        idx_s = bisect_left(S, x)
        idx_t = bisect_left(T, x)

        vs[0] = S[idx_s - 1] if idx_s > 0 else -INF
        vt[0] = T[idx_t - 1] if idx_t > 0 else -INF
        vs[1] = S[idx_s] if idx_s < A else INF
        vt[1] = T[idx_t] if idx_t < B else INF

        for s in vs:
            for t in vt:
                ans[i] = min(ans[i], abs(x - s) + abs(s - t), abs(x - t) + abs(t - s))

    print('\n'.join(map(str, ans)))

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 34456
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion
void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    int H, W;
    cin >> H >> W;
    vec<string> mp(H);
    vec<bool> cols(W, true), rows(H, true);
    REP(i, H){
        cin >> mp[i];
        REP(j, W){
            if(mp[i][j] != '.'){
                rows[i] = false;break;
            }
        }
    }
    REP(j, W){
        REP(i, H){
            if(mp[i][j] != '.'){
                cols[j] = false;break;
            }
        }
    }
    REP(i, H){
        if(rows[i]){
            continue;
        }
        REP(j, W){
            if(cols[j]){
                continue;
            }
            cout << mp[i][j];
        }
        cout << el;
    }
}



Measured memory_bytes: 3592
import java.util.*;

class Main {
	public static int digitNumber(int number) {
		int count = 0;
		while (number != 0) {
			number /= 10;
			count++;
		}
		return count;
	}
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			System.out.println(digitNumber(a + b));
		}
	}
}

Measured memory_bytes: 26188
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? 1e9:1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n; cin >> n;
    cout << (n%2 ? 2*n:n) << endl;
}




Measured memory_bytes: 256
/*input
4 1
6 6 6 6
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll sub(ll a,ll b){
    ll x=a-b;
    while(x<0) x+=MOD;
    while(x>MOD) x-=MOD;
    return x;
}
ll mult(ll a,ll b){
    return a*b%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=(res*a)%MOD;
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
const int maxn=2e5+5;
double arr[maxn];
int main(){
	int n,k;
	cin>>n>>k;
	REP(i,n){
		double p;
		cin>>p;
		arr[i]=((p*(p+1))/2)/p;
	}
	double ans=0,cur=0;
	REP(i,k) cur+=arr[i];
	MXTO(ans,cur);
	REP(i,n-k){
		cur-=arr[i];
		cur+=arr[i+k];
		MXTO(ans,cur);
	}
	cout<<fixed<<setprecision(6)<<ans;
}


Measured memory_bytes: 1792
use proconio::input;

#[allow(unused_variables)]
fn main() {
    input! {
      s: String,
      t: String,
    };

    let s = Vec::from(s);
    let t = Vec::from(t);

    let mut ans = 0;

    for i in 0..s.len() {
        if &s[i] != &t[i] {
            ans += 1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2828
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000010;
constexpr ll INF= 2000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

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

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

// N^P mod M（ただしM == -1の時はmodを取らない）
template<typename T>
T RS(T N, T P, T M){
    if(P==0) return 1;
    if(P < 0) return 0;
    if(P%2==0){
        ll t = RS(N, P/2, M);
        if(M == -1) return t * t;
        return t * t % M;
    }
    if(M == -1) return N * RS(N,P - 1,M);
    return N * RS(N, P-1, M) % M;
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    vector<vector<int>> cnt(M);
    for(int i = 0;i < N;i++) {
        cnt.at(vec.at(i) % M).push_back(vec.at(i));
    }
    vector<P> cnt2(M); //first:総数、second:奇数個ある数
    for(int i = 0;i < M;i++) {
        sort(cnt.at(i).begin(),cnt.at(i).end());
        cnt2.at(i).first = cnt.at(i).size();
        int odd = 0;
        int cnt3 = 0;
        int count = 0;
        for(int j = 0;j < cnt.at(i).size();j++) {
            if(cnt.at(i).at(j) != cnt3) {
                if(count % 2 == 1) {
                    odd++;
                }
                cnt3 = cnt.at(i).at(j);
                count = 1;
            }
            else {
                count++;
            }
        }
        if(count % 2 == 1) {
            odd++;
        }
        cnt2.at(i).second = odd;
    }
    int ret = 0;
    ret += cnt2.at(0).first / 2;
    for(int i = 1;i <= M / 2;i++) {
        if(i == M - i) {
            ret += cnt2.at(i).first / 2;
        }
        else {
            P A = cnt2.at(i);
            P B = cnt2.at(M - i);
            int cnt5 = min(A.second, B.second);
            ret += cnt5;
            A.first -= cnt5;
            A.second -= cnt5;
            B.first -= cnt5;
            B.second -= cnt5;
            if(A.second != 0) {
                int cnt6 = min(A.second, B.first);
                ret += cnt6;
                A.first -= cnt6;
                A.second -= cnt6;
                B.first -= cnt6;
            }
            else if(B.second != 0) {
                int cnt6 = min(A.first, B.second);
                ret += cnt6;
                A.first -= cnt6;
                B.first -= cnt6;
                B.second -= cnt6;
            }
            ret += (A.first - A.second) / 2 + (B.first - B.second) / 2;
        }
    }
    cout << ret << endl;
}

Measured memory_bytes: 9848
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        s: String,
        t: String,
    }
    let s = s.chars().collect::<Vec<_>>();
    let t = t.chars().collect::<Vec<_>>();
    for i in 0..n {
        print!("{}{}", s[i], t[i]);
    }
    println!("");
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

struct UF{
    vint par;
    UF(int n){
        par.resize(n);
        rep(i,n)par[i]=i;
    }
    int find(int x){
        return x==par[x]?x:par[x]=find(par[x]);
    }
    void unite(int x,int y){
        par[find(y)]=find(x);
    }
};

int N,M;
int A[11111],B[11111],C[11111],D[11111];

bool check(double x){
    vector<pair<double,int>>v(M);
    rep(i,M)v[i]={D[i]-x*C[i],i};
    sort(all(v));
    reverse(all(v));

    int cc=0,dd=0;
    rep(i,M)cc+=C[i];
    rep(i,M)dd+=D[i];

    UF uf(N);
    double cost=0;
    rep(i,M){
        int j=v[i].se;
        if(uf.find(A[j])==uf.find(B[j]))continue;
        uf.unite(A[j],B[j]);
        cost+=v[i].fi;
    }

    return cost>=dd-cc*x;
}

signed main(){
    scanf("%lld%lld",&N,&M);
    rep(i,M)scanf("%lld%lld%lld%lld",&A[i],&B[i],&C[i],&D[i]);

    if(M==N-1){
        cout<<0<<endl;
        return 0;
    }


    double lb=0,ub=1e12;
    rep(i,100){
        double mid=(ub+lb)/2;
        if(check(mid))ub=mid;
        else lb=mid;
    }
    printf("%.20f\n",ub);

    return 0;
}

Measured memory_bytes: 3736
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define maxn 200005
int a[maxn];
using namespace std;
int main()
{
    int n,t;
    scanf("%d%d",&n,&t);

    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);

      ll sum=t;
      ll ans=t;

        for(int i=2;i<=n;i++)
        {
           if(a[i]<=ans)
           {
              sum+=t-(ans-a[i]);
              ans=a[i]+t;
           }

        else
        {sum+=t;
           ans=a[i]+t;
        }
}
printf("%lld\n",sum);
return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
int n, m;
vector <int> c[N];
struct node{
    int A, B;
}a[N];
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= n; i++) cin >> a[i].B >> a[i].A;
    for(int i = 1; i <= n; i++) {
        if(a[i].B <= m) c[m - a[i].B].push_back(a[i].A);
    }
    priority_queue <int> q;
    int ans = 0;
    for(int i = m - 1; i >= 0; i--) {
        for(auto it : c[i]) q.push(it);
        if(!q.empty()) {
            ans += q.top(); q.pop();
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
map<ll,ll>mp;

int main ()
{
    ll n;
    string a,b="";
    cin>>n;
    cin>>a;
    for(int i=0;i<a.size();i++)
    {
        if(a[i]!=b[b.size()-1])
            b+=a[i];
    }
    cout<<b.size()<<endl;
    return 0;

}


Measured memory_bytes: 3740
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<(int)(n);i++)
#define N 110


int main() {
	char a[N][N];
	int dp[N][N];
	f(i, N) {
		f(j, N) {
			a[i][j] = 0;
			dp[i][j] = MOD;
		}
	}
	int n, k,m;
	int x, y, z;
	int s, ans;
	bool v = true;
	ans = 0;
	scanf("%d %d", &n, &m);
	f(i, n) {
		scanf("%s", a[i]);
	}
	if (a[0][0] == '#')dp[0][0] = 1;
	else dp[0][0] = 0;
	f(i, n) {
		f(j, m) {
			if (a[i][j] != a[i][j + 1])dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + 1);
			else dp[i][j + 1] = min(dp[i][j + 1], dp[i][j]);
			if (a[i][j] != a[i+1][j])dp[i+1][j] = min(dp[i+1][j], dp[i][j] + 1);
			else dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
		}
	}
	if (a[n - 1][m - 1] == '#')s = dp[n - 1][m - 1] + 1;
	else s = dp[n - 1][m - 1];
	ans = s / 2;
	printf("%d\n", ans);


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <utility>

#include <cassert>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

const ll INF = 1e15;

ll cs[100100], cy[100100];

void dijkstra(int s, ll c[], vector<vector<pii> > E) {
	priority_queue<pll> q;

	c[s] = 0;
	q.push(pll(0,s));
	while(q.size()) {
		pll a = q.top(); q.pop();
		if(-a.fi > c[a.se]) continue;
		c[a.se] = -a.fi;
		for(int i = 0; i < E[a.se].size(); i++) {
			if(c[E[a.se][i].se] > -a.fi + E[a.se][i].fi) {
				c[E[a.se][i].se] = -a.fi + E[a.se][i].fi;
				q.push(pll(a.fi-E[a.se][i].fi, E[a.se][i].se));
			}
		}
	}
}

int main() {
	int n, m, s, t;
	cin >> n >> m >> s >> t;
	s--; t--;

	vector<vector<pii> > yen(n), snuke(n);
	rep(i,m) {
		int u, v, a, b;
		cin >> u >> v >> a >> b;
		u--; v--;
		yen[u].push_back(pii(a,v));
		yen[v].push_back(pii(a,u));
		snuke[u].push_back(pii(b,v));
		snuke[v].push_back(pii(b,u));
	}
	rep(i,100100)
		cs[i] = cy[i] = INF;
	dijkstra(s,cy,yen);
	dijkstra(t,cs,snuke);

	/*
	for(int i = 0; i < 10; i++)
		cout << "*" << cy[i] << endl;
		// */

	vector<pll> rest(n);
	rep(i,n) {
		rest[i] = pll(INF - (cs[i]+cy[i]), i);
	}
	sort(all(rest));
	rep(i,n) {
		while(rest.back().se < i)
			rest.pop_back();
		cout << rest.back().fi << endl;
	}
	return 0;
}


Measured memory_bytes: 21052
use proconio::{input, fastout};

#[fastout]
fn main() {
    input!{
        n: usize,
        m: usize,
        q: usize,
        abcd: [(usize, usize, usize, usize); q]
    }
    let mut v = vec![1; n];
    let mut ans = 0;
    loop {

        let mut value = 0;

        for &(a,b,c,d) in abcd.iter() {
            if v[b-1] - v[a-1] == c {
                value += d;
            }
        }
        ans = std::cmp::max(ans, value);

        if v.iter().all(|&x| x == m) {
            break;
        }
        if v[0] == m {
            break;
        }
        let mut changed = false;
        for i in 0..n {
            if v[i] == m {
                changed = true;
                if v[i-1] != m {
                    v[i-1] += 1;
                    for j in i..n {
                        v[j] = v[i-1];
                    }
                }
            }
        }
        if !changed {
            v[n-1] += 1;
        }

    }

    println!("{}", ans);
}


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

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

    int m = (int)(s[5] - '0') * 10 + (int)(s[6] - '0');
    if (m > 4) cout << "TBD" << endl;
    else cout << "Heisei" << endl;

    return 0;
}

Measured memory_bytes: 256
def main():
    N, A, B, C, D = map(int, input().split())
    S = input()

    for i in range(B-1, D-1):
        if S[i] + S[i+1] == "##":
            return 'No'
    for i in range(A-1, C-1):
        if S[i] + S[i+1] == "##":
            return 'No'

    if C < D:
        return "Yes"
    else:
        for i in range(B-1, D):
            if S[i-1] + S[i] + S[i+1] == '...':
                return "Yes"
        return "No"

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"

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

    int n;
    cin >> n;
    cout << (n - 1) / 2 + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
a=int(input())
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
z=num2alpha(a)
x=str.lower(z)
print(x)

Measured memory_bytes: 9156
#include <bits/stdc++.h>
#include <string>
#include <cmath>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    int a[m], b[m], ans[n];
    for (int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < n; i++)
    {
        ans[i] = 0;
    }
    for (int i = 0; i < m; i++)
    {
        ans[a[i] - 1]++;
        ans[b[i] - 1]++;
    }
    for (int i = 0; i < n; i++)
    {

        cout << ans[i] << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

ll memo[10][1001][101];
ll rec(int r, int sum, int lb=0) {
    if (sum < 0) return 0;
    if (r == 0) {
        if (sum == 0) return 1;
        else return 0;
    }
    if (memo[r][sum][lb] >= 0) return memo[r][sum][lb];
    ll ret = 0;
    for (int i = lb; i <= min(sum, 100); i++) {
        ret += rec(r-1, sum-i, i+1);
    }
    return memo[r][sum][lb] = ret;
}

int main() {
    int n, s;
    while (cin >> n >> s, n || s) {
        memset(memo, -1, sizeof(memo));
        cout << rec(n, s) << endl;
    }
    return 0;
}

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

int main(){
  int H,W;
  while(1){
    cin >> H >> W;
    if(H == 0 && W == 0) break;
    for(int i = 0; i < H; i++){
      for(int j = 0; j < W; j++){
       if( (i + j) % 2 == 0){
         cout << "#";
       } else {
         cout << ".";
       }
      }
    cout << "\n";
    }
  cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3096
from itertools import permutations

N,M,R = map(int, input().split())
r = map(int, input().split())
r = [ri-1 for ri in r]
d_matrx = [[float('inf')]*N for _ in range(N)]
for _ in range(M):
    a,b,c = map(int, input().split())
    d_matrx[a-1][b-1] = c
    d_matrx[b-1][a-1] = c

def warshall_floyd(v_count: int, matrix: list) -> list:
    """ ワーシャルフロイド　
    :param v_count: 頂点数
    :param matrix:  隣接行列(到達不能はfloat("inf"))
    """
    for i in range(v_count):
        for j, c2 in enumerate(row[i] for row in matrix):
            for k, (c1, c3) in enumerate(zip(matrix[j], matrix[i])):
                if c1 > c2+c3:
                    matrix[j][k] = c2+c3 # min(c1, c2+c3)
    return matrix

warshall_floyd(N, d_matrx)
ans = float('inf')
for p in permutations(r):
    cond = 0
    cur = p[0]
    for nex in p[1:]:
        cond += d_matrx[cur][nex]
        cur = nex
    ans = min(ans, cond)
print(ans)

Measured memory_bytes: 4656
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    int a,b;
    cin>>a>>b;
    if(a>=13) cout<<b<<endl;
    else if(a>=6 && a<=12) cout<<b/2<<endl;
    else if(a<=5) cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = [input() for i in range(n)]
s.sort()
ans = []
c = 1
max = 0
for i in range(1, n):
    if s[i - 1] == s[i]:
        c += 1
    else:
        if c == max:
            ans.append(s[i - 1])
        elif c > max:
            ans.clear()
            ans.append(s[i - 1])
            max = c
        c = 1
if c == max:
    ans.append(s[-1])
elif c > max:
    ans.clear()
    ans.append(s[n - 1])
for des in ans:
    print(des)

Measured memory_bytes: 20676
S = input()
T = input()

N = len(S)
S = S+S
flag = 0
for i in range(N):
    cnt = 0
    for j in range(N):
        if T[j]==S[i+j]:
            cnt += 1
        if cnt==N:
            flag = 1
if flag==1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38896
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x-I .)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

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

int main(){
    int N, M, x, y;
    cin >> N >> M;
    vector<int> in(N,0);
    vector<vector<int>> G(N, vector<int>());
    vector<int> dist(N, -1);
    rep(i,M){
        cin >> x >> y;
        --x; --y;
        G[x].push_back(y);
        ++in[y];
    }
    queue<int> Q;
    rep(i,N)if(in[i] == 0){Q.push(i); dist[i] = 0;}
    while(!Q.empty()){
        int f = Q.front();
        Q.pop();
        for(auto t:G[f]){
            --in[t];
            if(in[t] == 0)Q.push(t);
            chmax(dist[t], dist[f] + 1);            
        }
    }
    int ans = 0;
    rep(i,N)chmax(ans, dist[i]);
    cout << ans << endl;
    return 0;
}


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

long long g(long long x){
    return (x*(x+1))/2;
}

int main(){
    int N;
    cin >> N;
    long long s=0;
    for(int i=1; i<=N; i++){
        s += i*g(N/i);
    }
    cout << s << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int read( ){
	int x=0,y=1;char ch=' ';
	for(;(ch!='-' && (ch>'9' || ch<'0'));ch=getchar( ));
	if(ch=='-')y=-1,ch=getchar( );
	for(;ch>='0' && ch<='9';ch=getchar( ))x=x*10+ch-48;
	return x*y;
}
const int inf=0x3f3f3f3f;
int n;
string s1,s2;
int main( ){
	int x,y,z,k;
	cin>>s1>>s2;
	int sum=0;
	for(register int i=0;i<3;++i)
		if(s1[i]==s2[i])++sum;
	printf("%d\n",sum);

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define mp make_pair
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pii pair<ll,ll>
#define pb push_back
#define F first
#define S second
#define mi map<ll,ll>
#define mii map<pii,ll>
const ll N=(1e7+1);//mod=998244353;
//ll n,m,k;//
ll a[N],dp[N];
string s,t;
ll l=(1e7+2);
char ch[1000][1000];
int h,w,c=0,n;

//bool vis[1000][1000]={0}
bool valid(char ch1,char ch2,int r,int vl){
	int c=0;
	for(int i=0;i<n;i++){
		if(s[i]==ch1)c++;
		if(c>=r){//cout<<"i,c,r="<<i<<c<<r<<endl;
		return 1;}//nahin rah
		if(t[i]==ch2&&c>-vl+1)c--;
	}
	return 0;
}
int main(){
	cin>>h>>w>>n;int x,y;
	cin>>y>>x;
	cin>>s>>t;
	if(valid('L','R',x,w+1-x)){
		//cout<<"1"<<endl;
		cout<<"NO"<<endl;
	}
	else if(valid('R','L',w+1-x,x)){
		//cout<<"2"<<endl;
		cout<<"NO"<<endl;
	}
	else if(valid('U','D',y,h+1-y)){
		//cout<<"3"<<endl;
		cout<<"NO"<<endl;
	}
	else if(valid('D','U',h+1-y,y)){
		//cout<<"4"<<endl;
		cout<<"NO"<<endl;
	}
	else{
		//cout<<"5"<<endl;
		cout<<"YES"<<endl;
	}
}
/*
2
5 2
3 6 4 7 2
5 3
3 -5 6 3 10


*/


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

using namespace std;

int main(void) {
    double a, b, x;
    cin >> a >> b >> x;
    double d = b - x / (a * a);

    cout << fixed << setprecision(10);

    double ans = atan2(d, a / 2);

    if (ans > atan2(b, a)) ans = atan2(b, 2 * x / (a * b));

    cout << ans * 180 / M_PI << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// スペース区切りの整数の入力(NとMとC)
		int N = sc.nextInt();
		int M = sc.nextInt();
		int C = sc.nextInt();
		int judge = C;
		int answer = 0;
		int [][] A = new int[N][M];
		int [] B = new int[M];
		for(int k=0;k<M;k++){
			B[k] = sc.nextInt();
		}
		for(int i=0;i<N;i++){
			for(int j=0;j<M;j++){
				A[i][j] = sc.nextInt();
			}
		}
		for(int i=0;i<N;i++){
			for(int j=0;j<M;j++){
				judge = judge + A[i][j]*B[j];
			}
			if(judge > 0){
				answer++;
				}
			judge = C;
		}
		System.out.println(answer);
	}
}



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

public class Sakuin
{
    public string word { get; set; }
    public int page { get; set; }
}

public class hello
{
    public static void Main()
    {
        var sakuins = new List<Sakuin>();
        string line;
        for (; (line = Console.ReadLine()) != null;)
        {
            string[] s = line.Trim().Split(' ');
            var word = s[0];
            var page = int.Parse(s[1]);
            sakuins.Add(new Sakuin { word = word, page = page });
        }
        var a1 = sakuins.OrderBy(x => x.page).GroupBy(x1 => x1.word).OrderBy(x2 => x2.Key);
        foreach (var y1 in a1)
        {
            Console.WriteLine(y1.Key);
            var cc = y1.Count(z => z.page > 0);
            var count = 1;
            foreach (var y2 in y1)
            {
                Console.Write(y2.page);
                if (count == cc) Console.WriteLine();
                else
                {
                    Console.Write(" ");
                    count++;
                }
            }
        }
    }
}

Measured memory_bytes: 10788
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)

int main() {
    ll n, m;
    cin >> n >> m;
    vector<int> a(m);
    ll sum = 0;
    rep(i, m)
    {
        cin >> a[i];
        sum += a[i];
    }
    if (n-sum>=0) {
        cout << n-sum << endl;
    }else {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 3668
import java.util.Scanner;

public class Main{
  static int count1 = 0;
  static int count2 = 0;
  static int count3 = 0;
  static int count4 = 0;

  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    for(int i=0;i<6;i++){
    int N = sc.nextInt();

    switch(N){
      case 1:
        count1++;
        break;
      case 2:
        count2++;
        break;
      case 3:
        count3++;
        break;
      case 4:
        count4++;
        break;
    }
  }

  if(count1==2 || count2==2 || count3==2 || count4==2){
    if(count1==1 || count2==1 || count3==1 || count4==1){
      System.out.println("YES");
    }
    else{
      System.out.println("NO");
    }
  }
  else{
    System.out.println("NO");
  }


  }
}

Measured memory_bytes: 23124