akhauriyash/Code-Regression huggingface dataset:
using System;


public class B{
	
	public static void Main(){
	
		string[] args = Console.ReadLine().Split(' ');
		int h = Int32.Parse(args[0]);
		int w = Int32.Parse(args[1]);
		
		bool[] deleteRow = new bool[h];
		for( int i = 0; i < h; i++ ) deleteRow[i] = true;
		
		bool[] deleteCol = new bool[w];
		for( int i = 0; i < w; i++ ) deleteCol[i] = true;
		
		char[,] a = new char[h,w];		
		for( int i = 0; i < h; i++ ){
			string str = Console.ReadLine();
			for( int j = 0; j < w; j++ ) a[i,j] = str[j];
		}
		
		for( int i = 0; i < h; i++ ){
			for( int j = 0; j < w; j++ ){
				if( a[i,j] == '#' ){
					deleteRow[i] = false;
					deleteCol[j] = false;
				}
			}			
		}
		
		for( int i = 0; i < h; i++ ){
			if( deleteRow[i] ) continue;
			for( int j = 0; j < w; j++ ){
				if( deleteCol[j] ) continue;
				Console.Write( a[i,j] );
			}			
			Console.WriteLine();
		}
		
	}
	
}

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

typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define sz(v) ll(v.size())


void solve(ll X, ll Y, ll Z, ll K, vector<ll> A, vector<ll> B, vector<ll> C){
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    ll dp[K+1][K+1];
    fill(dp[0], dp[K+1], 0);

    vector<ll> AB;
    rep(i, X) {
        rep(j, Y) {
            AB.push_back(A[i] + B[j]);
        }
    }
    sort(AB.begin(), AB.end());

    vector<ll> ABC;

    FOR(i, 1, min(K, sz(AB))+1) {
        FOR(j, 1, min(K, Z)+1) {
            ABC.push_back(AB[X*Y-i] + C[Z-j]);
        }
    }

    sort(ABC.begin(), ABC.end());

    rep(i, K) {
        cout << ABC[sz(ABC) - i - 1] << endl;
    }
}

int main() {
  ll X;
    scanf("%lld",&X);
    ll Y;
    scanf("%lld",&Y);
    ll Z;
    scanf("%lld",&Z);
    ll K;
    scanf("%lld",&K);
    vector<ll> A(X);
    for(int i = 0 ; i < X ; i++){
        scanf("%lld",&A[i]);
    }
    vector<ll> B(Y);
    for(int i = 0 ; i < Y ; i++){
        scanf("%lld",&B[i]);
    }
    vector<ll> C(Z);
    for(int i = 0 ; i < Z ; i++){
        scanf("%lld",&C[i]);
    }
  solve(X, Y, Z, K, move(A), move(B), move(C));
  return 0;
}


Measured memory_bytes: 113640
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int n, x;
    
    vector<int> a;
    
    cin >> n;
    
    for(int i = 0; i < n; i++) {
        cin >> x;
        a.push_back(x);
    }
    
    reverse(a.begin(), a.end());
    
    for(int i = 0; i < n; i++) {
        if(i == n-1) cout << a[i] << endl;
        else cout << a[i] << " ";
    }
    
    
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds; 
using namespace std;



typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
 
//defines
typedef long long ll;

    
ll solve(ll t)
{/*hon when the digit in the one's place of 
N
 is 
2
, 
4
, 
5
, 
7
, or 
9
;
pon when the digit in the one's place of 
N
 is 
0
, 
1
, 
6
 or 
8
;
bon when the digit in the one's place of 
N
 is 
3
.*/
  ll n;cin>>n;
    string s;cin>>s;
    ll m=s.size();
    if(m<=n)cout<<s;
  else
  {string ss=s.substr(0,n);
  cout<<ss<<"...";}
 if(t>0)cout<<"\n";
return 0;
}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t=1;
   // cin>>t;
    while(t--)
    {
        solve(t);
    }
    
        
    return 0;
}

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

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

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

    size_t N, M;
    cin >> N >> M;

    vector<bool> bad(N + 1);
    for (size_t i = 0; i < M; ++i) {
        size_t a; cin >> a;
        bad[a] = true;
    }

    const int MOD = int(1e9) + 7;
    vector<intmax_t> dp(N + 1);
    dp[0] = dp[1] = 1;
    for (size_t i = 2; i <= N; ++i) {
        if (!bad[i - 1]) (dp[i] += dp[i - 1]) %= MOD;
        if (!bad[i - 2]) (dp[i] += dp[i - 2]) %= MOD;
    }

    cout << dp[N] << "\n";

    return 0;
}


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

using namespace std;

int main() {
    int h, w;
    cin >> h >> w;

    vector<vector<char>> s(h, vector<char>(w));

    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            cin >> s.at(i).at(j);
        }
    }
    
    int ans = 0;

    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            if (s.at(i).at(j) == '.') {
                
                vector<vector<int>> visited(h, vector<int>(w, -1));
                //visited.at(i).at(j) = 0;

                queue<tuple<int, int, int>> q;
                q.push(make_tuple(i, j, visited.at(i).at(j)));
                
                while (!q.empty()) {
                    int y, x, count;
                    tie(y, x, count) = q.front();
                    q.pop();

                    if (visited.at(y).at(x) != -1) continue;

                    visited.at(y).at(x) = ++count;
                    ans = max(ans, visited.at(y).at(x));

                    if (y-1 >= 0 && s.at(y-1).at(x) == '.') {
                        q.push(make_tuple(y-1, x, count));
                    }
                    if (y+1 < h  && s.at(y+1).at(x) == '.') {
                        q.push(make_tuple(y+1, x, count));
                    }
                    if (x-1 >= 0 && s.at(y).at(x-1) == '.') {
                        q.push(make_tuple(y, x-1, count));
                    }
                    if (x+1 < w  && s.at(y).at(x+1) == '.') {
                        q.push(make_tuple(y, x+1, count));
                    }
                    
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
import sys

def check(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i-1], t[i] = t[i], t[i-1]
        if ''.join(t).count('AGC') >= 1:
            return False
    return True


def dfs(cur, last3, N, memo=[]):
    if last3 in memo[cur]:
        return memo[cur][last3]

    if cur == N:
        return 1

    ret = 0
    for c in 'AGCT':
        if check(last3 + c):
            ret = (ret + dfs(cur+1, last3[1:]+c, N, memo)) % (10**9 + 7)
    memo[cur][last3] = ret
    return ret


def main():
    input = sys.stdin.readline
    N = int(input())

    memo = [{} for _ in range(N+1)]
    print(dfs(0, 'TTT', N, memo))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3848
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
const int MAXN = 100000 + 10;

int n;
int a[MAXN], b[MAXN];
namespace solver1 {

  int fa[MAXN];
  int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
  void main() {
    static int seq1[MAXN], seq2[MAXN];
    for (int i = 1; i <= n; i++) {
      a[n + 1] ^= a[i];
      seq1[i] = a[i];
    }
    seq1[n + 1] = a[n + 1];

    for (int i = 1; i <= n; i++) {
      b[n + 1] ^= b[i];
      seq2[i] = b[i];
    }
    seq2[n + 1] = b[n + 1];
    std::sort(seq1 + 1, seq1 + n + 2);
    std::sort(seq2 + 1, seq2 + n + 2);
    for (int i = 1; i <= n + 1; i++) {
      if (seq1[i] != seq2[i]) {
        puts("-1");
        return;
      }
    }

    for (int i = 1; i <= n + 1; i++) fa[i] = i;

    std::map<int, int> last1, last2;
    for (int i = 1; i <= n + 1; i++) {
      if (a[i] == b[i]) continue;
      if (last1.count(a[i])) {
        fa[find(last1[a[i]])] = find(i);
      }

      if (last1.count(b[i])) {
        fa[find(last1[b[i]])] = find(i);
      }

      if (last2.count(a[i])) {
        fa[find(last2[a[i]])] = find(i);
      }
      
      if (last2.count(b[i])) {
        fa[find(last2[b[i]])] = find(i);
      }
      last1[a[i]] = i;
      last2[b[i]] = i;
    }

    int ans = 0;
    for (int i = 1; i <= n + 1; i++) {
      if (a[i] == b[i]) continue;

      ans += 1 + (fa[i] == i);
    }
    if (a[n + 1] == b[n + 1]) {
      if (last1.count(a[n + 1])) {
        printf("%d\n", ans - 1);
      } else {
        printf("%d\n", ans);
      }
    } else {
      printf("%d\n", ans - 2);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }

  for (int i = 1; i <= n; i++) {
    scanf("%d", b + i);
  }

  solver1::main();
  
}


Measured memory_bytes: 13184
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  cin >> N;
  vector<Pair> A(N);
  for (int64_t i = 0; i < N; ++i) {
    int64_t x, l;
    cin >> x >> l;
    A[i].first = x - l;
    A[i].second = x + l;
  }
  auto LessThan = [](const Pair a, const Pair b) -> bool { return a.second < b.second; };
  sort(A.begin(), A.end(), LessThan);
  int64_t result = 0;
  int64_t end = INT64_MIN;
  for (int64_t i = 0; i < N; ++i) {
    if (end <= A[i].first) {
      ++result;
      end = A[i].second;
    }
  }
  cout << result << endl;
  return 0;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    cin >> n;
    vector<int> pos(n+1);
    REP(i, n){
        int a;
        cin >> a;
        pos[a] = i;
    }

    multiset<int> st;
    st.insert(-1);
    st.insert(-1);
    st.insert(n);
    st.insert(n);

    ll ans = 0;

    for(int i=n; i>0; i--){
        int p = pos[i];
        auto itr = st.upper_bound(p);

        int l1, l2, r1, r2;

        r1 = *itr;
        itr++;
        r2 = *itr;

        itr--;
        itr--;

        l1 = *itr;
        itr--;
        l2 = *itr;

        ans += (ll) i * ((p - l1) * (r2 - r1) + (l1 - l2) * (r1 - p));

        st.insert(p);
    }

    cout << ans << endl;
    
    return 0;
}


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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

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

int main(void){

    int n;
    cin >> n;

    map<string, int> mp;

    roop(i, n){
        string s; cin >> s;
        mp[s];
    }

    cout << mp.size() << endl;

    return 0;
}


Measured memory_bytes: 19104
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <numeric>
#include <set>
// #include <bits/stdc++.h>


using namespace std;
typedef long long li;


// Index range: [1, n]
// sum(x) returns the sum over [1, x]
// add(x, v) adds v to the value at x.
struct BIT {
    int n;
    vector<li> bit;

    BIT(int _n): n(_n), bit(_n + 1) {}

    li sum(int i) {
        li s = 0;
        while (i > 0) {
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }

    void add(int i, li x) {
        while (i <= n) {
            bit[i] += x;
            i += i & -i;
        }
    }
};

struct RangeAddBIT {
    BIT bit;
    // index: [1, n]
    RangeAddBIT(int n): bit(n + 1) {}

    void range_add(int l, int r, li v) {
        // add v to [l, r]
        if (r < l) {
            return;
        }
        bit.add(l, v);
        bit.add(r + 1, -v);
    }

    li get_at(int i) {
        return bit.sum(i);
    }
};

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

    li n, m;
    cin >> n >> m;
    vector<vector<pair<li, li>>> ranges(m + 1);
    for (int i = 0; i < n; ++i) {
        li l, r;
        cin >> l >> r;
        ranges[r - l + 1].emplace_back(l, r);
    }

    RangeAddBIT rab(m);
    li longer = n;
    for (int d = 1; d <= m; ++d) {
        li ans = longer;
        for (int p = d; p <= m; p += d) {
            ans += rab.get_at(p);
        }
        cout << ans << endl;

        for (auto && range: ranges[d]) {
            rab.range_add(range.first, range.second, 1);
            longer--;
        }
    }


    return 0;
}


Measured memory_bytes: 11136
#include<iostream>
#include<string>
using namespace std;
int main(){
    string str1, str2;
    int taro, hanako, n;
    taro = 0;
    hanako = 0;
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> str1 >> str2;
        if (str1 < str2) {
            hanako += 3;
        } else if (str1 == str2) {
            taro += 1;
            hanako += 1;
        } else {
            taro += 3;
        }
    }
    cout << taro << " " << hanako << endl;
}


Measured memory_bytes: 3216
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new A().doIt();
//		new B().doIt();
		new C().doIt();
//		new D().doIt();
	}
	class A{
		void doIt() {
			int N = sc.nextInt();
			int sum = 0;
			for(int i = 1;i <= N;i++) {
				sum = sum + i;
			}
			System.out.println(sum);
		}
	}
	class B{
		void doIt() {
			String str = sc.next();
			char ctr[] = str.toCharArray();
			ArrayList<Character> array = new ArrayList<Character>();
			for(int i = 0;i < str.length();i++) {
				if(ctr[i] == 'B') {
					if(array.size() > 0)array.remove(array.size() - 1);
				}else array.add(ctr[i]);
			}
			for(int i = 0;i < array.size();i++)System.out.print(array.get(i));
			System.out.println();
		}
	}
	class C{
		void doIt(){
			int N = sc.nextInt();
			int a[] = new int[N];
			for(int i = 0;i < N;i++)a[i] = sc.nextInt();
			
			int ans = Integer.MAX_VALUE;
			
			for(int i = -100;i <= 100;i++)ans = Math.min(ans, Distance(i,N,a));
			
			System.out.println(ans);
		}
		int Distance(int Pos,int N,int a[]) {
			int sum = 0;
			for(int i = 0;i < N;i++)sum += (Pos - a[i]) * (Pos - a[i]);
			return sum;
		}
	}
	class D{
	}
}


Measured memory_bytes: 23124
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;
typedef long long ll;

int main(void) {
	ll n, k, sum = 0;
	cin >> n >> k;
	vector<ll>a(n);
	for (ll i = 0;i < n;i++)cin >> a[i];
	sort(a.begin(), a.end());
	ll i = n - 1;
	while (k != 0) {
		sum += a[i];
		i--;
		k--;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
<?php
$step = trim(fgets(STDIN));
$rows = [];
 
while (($row = trim(fgets(STDIN))) !== '') {
  $rows[] = explode(' ', $row);
}
 
$memo = [];
 
for ($i=0; $i < $step; $i++) {
  $result = 0;
  for ($j=0; $j <= $i; $j++) {
    $result += $rows[0][$j];
  }
  for ($j=$i; $j < $step; $j++) {
    $result += $rows[1][$j];
  }
  $memo[] = $result;
}
 
echo max($memo)."\n";

Measured memory_bytes: 4728
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		String result = "";
		
		if(a < b){
			result = "a < b";
		}else if(a > b){
			result = "a > b";
		}else if (a == b){
			result = "a == b";
		}
		
		System.out.println(result);
	}
}

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

int main(){
	int m,s,g;
	vector<int> a(100);
	cin>>m>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]>>s>>g;
	vector<int> n(100+m);
	for(int i=1; i<=m; i++) cin>>n[i];
	vector<int> shortest(100+m,INT_MAX);
	queue<pair<int,vector<int>>> q;
	q.push(make_pair(s,vector<int>()));
	for(;;){
		int now = q.front().first;
		vector<int> hist = q.front().second;
		if(now==g) break;
		q.pop();
		for(int i=1; i<=6; i++){
			if(now+a[i] >= 1 && now+a[i] <= m){
				int next = now+a[i]+n[now+a[i]];
				vector<int> copy = hist;
				copy.push_back(i);
				if(shortest[next] > copy.size()){
					shortest[next] = copy.size();
					q.push(make_pair(next, copy));
				}
			}
			if(now-a[i] >= 1 && now-a[i] <= m){
				int next = now-a[i]+n[now-a[i]];
				vector<int> copy = hist;
				copy.push_back(-i);
				if(shortest[next] > copy.size()){
					shortest[next] = copy.size();
					q.push(make_pair(next, copy));
				}
			}
		}
	}
	for(int tgt : q.front().second){
		for(int dice;;){
			cin>>dice;
			if(abs(tgt)==dice){
				cout<<(tgt<0?-1:1)<<endl;
				break;
			}else{
				cout<<0<<endl;
			}
		}
	}
}

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

int main(){
	int aru[5];
	for(int i=0;i<5;i++) cin>>aru[i];
	sort(aru,aru+5);
	for(int i=4;i>=0;i--){
		if(i!=4) cout<<" ";
		cout<<aru[i];
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3152
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
using namespace std;

#define fi first
#define se second
typedef long long LL;
typedef long double LD;

int N,a[100010];

int main(){
    cin >> N;

    int i;
    for (i=1; i<=N; i++)
        cin >> a[i];
    sort(a+1,a+N+1);

    bool ans=0;
    for (int k=a[N]; k<=a[N]+1; k++){
        int i,cnte=0,cnts=0,tot=k;

        bool ok=1;
        for (i=1; i<=N; i++){
            if (a[i]==tot) cnte++;
            else if (a[i]==tot-1) cnts++;
            else ok=0;
        }

        if (!ok) continue;
        if (cnts>tot) continue;
        tot-=cnts;

        if (tot<=cnte/2 && !(tot==0 && cnte>0)) ans=1;
    }

    if (ans) cout << "Yes\n";
    else cout << "No\n";
    return 0;


}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
const char newl = '\n';
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
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; }
const long long INF = 1LL<<60;

int main(){
    int n;cin >> n;
    vector<int> p(n);
    vector<int> l(n+1);
    l[0] = 2*100000;
    rep(i,n){
        cin >> p[i];
        chmin(l[i],p[i]);
        l[i+1] = l[i];
    }
    
    int ans = 0;
    rep(i,n){
        if(p[i]==l[i]) ans++;
    }
    cout << ans << newl;

}

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

#define ll long long 

int main() {
    ios::sync_with_stdio(0); 
    
    int h, a; 
    cin >> h >> a; 

    if (h % a) {
        cout << h/a + 1 << endl; 
    } else cout << h/a << endl; 


    return 0; 
}



Measured memory_bytes: 256
while ((m,f,r = gets.split(" ").map(&:to_i)).select{|i| i == -1}.length != 3) do
  if([m,f].select{|j| j == -1}.length != 0) || (m + f < 30)
    puts "F"
  else
    case (m + f)
    when 80..100
      puts "A"
    when 65...80
      puts "B"
    when 50...65
      puts "C"
    when 30...50
      puts (r >= 50) ? "C" : "D"
    end
  end
end

Measured memory_bytes: 8608
#pragma GCC optimze("Ofast")
#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;
#define mod 1000000007
#define md 998244353
#define trace(...)
#define ll long long int
#define ld long double
#define fi first
#define se second
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define mem(a) memset(a, 0, sizeof(a))
#define vpi std::vector<pair<int,int>>
#define pii pair<int,int>
#define pb push_back
#define sall(v) sort(v.begin(),v.end())
#define all(v) (v.begin(),v.end())
#define minf -10000000
#define vi vector<int>
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
ll power(ll x, ll y,ll p) { 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or equal to p 
    while (y > 0) {  
        if (y & 1) // If y is odd, multiply x with result
            res = (res*x) % p;  
        y = y>>1; // y = y/2 // y must be even now
        x = (x*x) % p;   
    } 
    return res; 
}
ll power(ll x, ll y) { 
    ll res = 1;      // Initialize result 
    while (y > 0) {    
        if (y & 1)// If y is odd, multiply x with result 
            res = (res*x) ;  
        y = y>>1; // y = y/2 // y must be even now 
        x = (x*x);   
    } 
    return res; 
}
 
ll max3(ll a,ll b,ll c){
    return max(a,max(b,c));
}
ll min3(ll a,ll b,ll c){
    return min(a,min(b,c));
}
bool isPrime(ll n) { // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}

void solve(){
    string s,t;cin>>s>>t;
    int n=s.length();
    int ans=0;
    fr(i,0,n-1)if(s[i]!=t[i])ans++;
    cout<<ans<<endl;
    return;
}

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout<<fixed<<setprecision(8);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
    #ifndef ONLINE_JUDGE
    cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
    #endif
    return 0;
}

Measured memory_bytes: 3856
import java.io.*;
import java.util.*;
import static java.lang.Math.min;
import static java.lang.Math.max;
public class Main {
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
       // int arr[] = new int[5];
        for(int i=1; i<=5; i++){
            int x = sc.nextInt();
            if(x==0) out.println(i);
        }
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}
class Pair implements Comparable<Pair>{
    int x,y;
    Pair(int x, int y){
        this.x = x;
        this.y = y;
    }
    public int compareTo(Pair p){
        return (int)(this.x - p.x);
    }

}

Measured memory_bytes: 32696
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
int main() {
	llong a, b;
	llong c, d;
	cin >> a >> b >> c >> d;
	llong gcd_cd = GCD(c, d);
	llong b_div_c = b / c;
	llong b_div_d = b / d;
	llong b_div_cd = b / (c * d / gcd_cd);
	llong a_div_c = (a-1) / c;
	llong a_div_d = (a-1) / d;
	llong a_div_cd = (a-1) / (c * d / gcd_cd);
	llong b_num = b - (b_div_c + b_div_d - b_div_cd);
	llong a_num = (a-1) - (a_div_c + a_div_d - a_div_cd);
	cout << b_num - a_num <<endl;
	return 0;
}

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

int main(){
	long long x;
	cin>>x;
	
	long long srt=100;
	long long year;
	for(long long i=1; i<100000000; i++){
		srt*=1.01;
		if(srt>=x){
			year=i;
			break;
		}
	}
	cout<< year <<endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <list>
#include <vector>
#include <array>
#include <memory>
using namespace std;
struct Node;
using pNode = shared_ptr<Node>;
struct Node{
    Node(int id) : x(0), cnt(0), id(id) {}
    ~Node() = default;
    int x, cnt, id;
    list<pNode> adj;
};
array<bool, 200000> traced {};
void dfs(pNode current, int cnt = 0) {
    traced[current->id] = true;
    current->cnt = cnt + current->x;
    for (auto p : current->adj) {
        if (!traced[p->id]) dfs(p, current->cnt);
    }
}
int main() {
    int N, Q;
    cin >> N >> Q;
    vector<pNode> tree(N);
    for (int i = 0; i < N; i++) tree[i] = make_shared<Node>(i);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        tree[a-1]->adj.push_back(tree[b-1]);
        tree[b-1]->adj.push_back(tree[a-1]);
    }
    for (int i = 0; i < Q; i++) {
        int p, x;
        cin >> p >> x;
        tree[p-1]->x += x;
    }
    dfs(tree[0]);
    for (auto p : tree) {
        cout << p->cnt << " ";
    }
}

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

using namespace std;
#define ll long long


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a;
        cin >> a;
        n -= a;
    }
    cout << max(-1, n) << endl;
    return 0;
}

Measured memory_bytes: 3656
N,M=map(int,input().split())
if M==0:
  print(0,0)
else:
  ac = [0]*N
  wa = [0]*N
  score=0
  mis=0
  for i in range(M):
    p,s = input().split()
    p=int(p)
    if s =="AC":
      if ac[p-1]==0:
        ac[p-1] = 1
        score += 1
    else:
    
      if ac[p-1] == 0:
        wa[p-1] += 1
  
  
  for i in range(N):
    if ac[i-1] == 1:
      mis += wa[i-1]
  print(score,mis)

    
  





Measured memory_bytes: 4596
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

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

int main()

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

    int n, ans = 0;

    cin >> n;

    int arr[n];

    for (int i = 0; i < n; i++) {

        cin >> arr[i];
    }

    for (int i = 0; i < n-1; i++) {

        if (arr[i] == arr[i+1]) {

            ans++;
            i++;
        }
    }

    cout << ans;

    return 0;
}



Measured memory_bytes: 256
def main():
    c = [list(map(int, input().split())) for _ in range(3)]
    f = [[x[0] - x[1], x[1] - x[2], x[2] - x[0]] for x in c]
    g = f[0] == f[1] == f[2]
    print('Yes' if g else 'No')


if __name__ == '__main__':
    main()


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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define f first
#define s second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll INF = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int inf = (int)1e9;

const int N = 300500;

ll fct[N], rv[N], n, a[N], cnt[N], ans, cur;

ll bp(ll x, ll y){
	ll z = 1;
	while(y){
		if(y & 1)
			z = z * x % mod;
		x = x * x % mod;
		y >>= 1;
	}
	return z;
}

ll cnk(ll x, ll y){
	if(x < 0 || x < y)
		return 0;
	return fct[x] * rv[y] % mod * rv[x - y] % mod;
}

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

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

	//cout << setprecision(10) << fixed;
	
	fct[0] = rv[0] = 1;
	for(int i = 1; i <= 200000; ++i)	
		fct[i] = fct[i - 1] * i % mod, rv[i] = bp(fct[i], mod - 2);

	cin >> n;

	for(int i = 1; i <= n; ++i)
		cin >> a[i];
	
	for(int i = 1; i <= n; ++i){
		cnt[i] = fct[i - 1] * cnk(n, i) % mod * fct[n - i] % mod; 
		cur += cnt[i];
		cur %= mod;
	}

	ans = cur * a[1] % mod;

	for(int i = 2; i <= n; ++i){
		cur -= cnt[n - i + 2];
		if(cur < 0)
			cur += mod;
		cur += cnt[i];
		if(cur >= mod)
			cur -= mod;
		ans = (ans + cur * a[i] % mod) % mod;
	}

	cout << ans;

	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}

Measured memory_bytes: 7552
import numpy as np
import math
a,b,h,m = map(int,input().split())
tyo = h/12*360 + 0.5*m
rad = abs(tyo-m/60*360)
rad = math.radians(rad)
print(math.sqrt(a*a+b*b-2*a*b*math.cos(rad)))

Measured memory_bytes: 27196
def bc(x):
    return bin(x).count("1")

def f(n):
    res = 0
    for i in range(n):
        if n == 0:
            return res
        else:
            res += 1
            n = n % bc(n)
    return res

N,X = open(0).read().split()
N = int(N)
pc = X.count('1')
na = 0
nb = 0
if N == 1:
    if X == '1':
        print(0)
    else:
        print(1)
else:
    if pc == 0:
        for i in range(N):
            print(1)
    elif pc == N:
        for i in range(1,N+1):
            na = (na+pow(2,N-i,N-1)) % (N-1)
        for i in range(1,N+1):
            temp = na
            temp = (temp-pow(2,N-i,N-1)) % (N-1)
            print(f(temp)+1)
    elif pc == 1:
        ind = X.index('1')
        na = pow(2,N-ind-1,2)
        for i in range(1,N+1):
            if i != ind + 1:
                temp = na
                temp = (temp+pow(2,N-i,2)) % 2
                print(f(temp)+1)
            else:
                print(0)
    else:
        for i in range(1,N+1):
            if X[i-1] == '1':
                na = (na+pow(2,N-i,pc-1)) % (pc-1)
        for i in range(1,N+1):
            if X[i-1] == '1':
                nb = (nb+pow(2,N-i,pc+1)) % (pc+1)
        for i in range(1,N+1):
            if X[i-1] == '1':
                temp = na
                temp = (temp-pow(2,N-i,pc-1)) % (pc-1)
                print(f(temp)+1)
            else:
                temp = nb
                temp = (temp+pow(2,N-i,pc+1)) % (pc+1)
                print(f(temp)+1)

Measured memory_bytes: 80804
#include<bits/stdc++.h>
 
using namespace std;
 
struct edge
{
  int to, cost;
};
 
double p, all;
int N;
vector< edge > g[100000];
 
double getCost(int idx, int par = -1)
{
  double ret = 0;
  for(auto &e : g[idx]) {
    if(e.to == par) continue;
    auto get = getCost(e.to, idx) + e.cost;
    ret += p * get;
  }
  return (ret);
}
 
double rec(int idx, int par = -1)
{
  double ret = all;
  for(auto &e : g[idx]) {
    if(e.to == par) continue;
    auto get = rec(e.to, idx) + e.cost;
    ret += p * get;
  }
  return (ret);
}
 
int main()
{
  cin >> p;
  cin >> N;
  for(int i = 0; i < N - 1; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b;
    g[a].push_back((edge) {b, c});
    g[b].push_back((edge) {a, c});
  }
  all = getCost(0);
  cout << fixed << setprecision(10) << rec(0) << endl;
}

Measured memory_bytes: 14996
#include <stdio.h>
#include <algorithm>
#include <string.h>
using namespace std;

int main() 
{
    char s[101], t[101];
    int l;
    
    scanf("%s%s", s, t);
    sort(s, s + strlen(s));
    sort(t, t + (l = strlen(t)));
    reverse(t, t + l);
    if(strcmp(s, t) < 0) puts("Yes");
    else puts("No");
	
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main() {
  char c;
  cin >> c;
  c += 1;
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 764
#include <stdlib.h>
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
	int a;
	string b;
	cin >> a;
	cin >> b;


	if (a<3200)
	{
		printf("red");
		cin >> a;
		return 0;
	}

	cout << b << endl;
	cin >> a;
	return 0;
}

Measured memory_bytes: 256
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n;
    cin>>n;
    vi a(n);
    map<int,int> m;
    i64 s0=0;
    forn(i,n){
        cin>>a[i];
        if(m.count(a[i]))   m[a[i]]++;
        else                m[a[i]] = 1;
        s0 += a[i];
    }
    int q;
    cin>>q;
    while(q--){
        int b,c;
        cin>>b>>c;
        if(m.count(b)){
            i64 d = c-b;
            i64 si = s0 + d*m[b];
            if(m.count(c))  m[c] += m[b];
            else            m[c] = m[b];
            m[b] = 0;
            s0=si;
            cout<<s0<<endl;
        }
        else{
            cout<<s0<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 7352
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)
	writer := bufio.NewWriter(os.Stdout)

	var n, m int
	fmt.Sscan(getNextLine(scanner), &n, &m)
	aa := getIntList(scanner)
	sort.Sort(sort.IntSlice(aa))
	sortby := make(SortBy, m)
	for i := 0; i < m; i++ {
		bc := getIntList(scanner)
		sortby[i].b = bc[0]
		sortby[i].c = bc[1]
	}
	sort.Sort(sortby)
	updated := 0
	for i := 0; i < m; i++ {
		for ii := 0; ii < sortby[i].b; ii++ {
			if updated >= n || aa[updated] >= sortby[i].c {
				break
			}
			aa[updated] = sortby[i].c
			updated++
		}
	}
	var sum int64

	for i := 0; i < n; i++ {
		sum += int64(aa[i])
	}
	fmt.Fprint(writer, sum)
	writer.Flush()

}

type BC struct {
	b int
	c int
}
type SortBy []BC

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i].c > a[j].c }


Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
int main (){
  string data;
  int sum = 0;
  
  //データ入力
cin >> data;

  //カウント機能
  for(int i =0;i < 3; i++ ){
    if(data.at(i) == '1'){
    sum++; 
    }
  }
  
  cout << sum <<endl;
  
  
}


Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K;
  string S;
  cin >> K >> S;
  
  if ( S.size() <= K ) {
    cout << S << endl;
  }
  else {
    for (int i = 0; i < K; i++) {
      cout << S.at(i);  
    }
    cout << "..." << endl;  
  }
  
}
  

Measured memory_bytes: 3632
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N;
	vector<long double>x(N);
	vector<long double>y(N);
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
	}
	for (int i = 1; i < N - 1; i++) {
		vector<long double>r;
		for (int j = 0; j < i; j++) {
			auto box = atan2l(y[j] - y[i], x[j] - x[i]);
			if (box < 0)box += acosl(-1);
			else box -= acosl(-1);
			r.push_back(box);
		}
		for (int j = i + 1; j < N; j++) {
			r.push_back(atan2l(y[j] - y[i], x[j] - x[i]));
		}
		sort(r.begin(), r.end());
		M = r.size();
		for (int j = 0; j < M; j++) {
			r.push_back(r[j]+acosl(-1) * 2);
		}
		bool flag = false;
		long double a = MOD;
		for (int j = 0; j < M; j++) {
			a = min(a, r[j + M - 1] - r[j]);
			if (r[j + M - 1] - r[j] <= acosl(-1)) {
				flag = true;
			}
		}
		//cout << setprecision(20) << a << endl;
		if (!flag) {
			cout << "Impossible\n";
			return 0;
		}
		//if (i == N - 3) {
		//	for (auto j : r)cout << setprecision(20) << j << endl;
		//}
	}
	cout << "Possible\n";
}


Measured memory_bytes: 3448
import sys
from collections import deque
H, W = map(int, input().split())
gridgraph = []
for line in sys.stdin.readlines():
    line = line.rstrip()
    gridgraph.append(list(line))
q = deque()
visited = [[False]*W for _ in range(H)]
ans = [[1e+9]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if gridgraph[i][j] == "#":
            q.append((i, j))
            visited[i][j] = True
            ans[i][j] = 0

while len(q):
    cy, cx = q.popleft()

    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        if not (cy+dy >= 0 and H-1 >= cy+dy and cx+dx >= 0 and W-1 >= cx+dx):
            continue
        if visited[cy+dy][cx+dx]:
            continue
        visited[cy+dy][cx+dx] = True
        ans[cy+dy][cx+dx] = min(ans[cy+dy][cx+dx], ans[cy][cx]+1)
        q.append((cy+dy, cx+dx))

min_value = 0
for a in ans:
    min_value = max(min_value, max(a))
print(min_value)


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

using ll=long long;
using int64=int64_t;
const int inf=100000000;

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) xの絶対値

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int fib(int x){
  if (x <= 2) return x;
  int a[x];
  a[0]=1;
  a[1]=2;
  for (int i=2;i<x;i++){
    a[i]=a[i-1]+a[i-2];
  }
  return a[x-1];
}//(x) フィボナッチ数列のx番目

int div1(ll x){
  return x%1000000007;
}

main(){
    int n=in(),num;
    vector<int> a(n);
    for (int i=0;i<n;i++) {
        cin >> num;
        a[num-1]=i;
    }
    for(int i=0;i<n;i++) printf("%d ",a[i]+1);
    printf("\n");
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

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

const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};

const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

vector< vector<int> > Graph;
vector< int > value;





int main(int argc, const char * argv[]) {
    
    

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2;
    
    cout << x2-y2+y1 << ' ' << y2+x2-x1 << ' ' << x1-y2+y1 << ' ' << y1+x2-x1 << endl;
}


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

int main() {
  int n;
  cin >> n;
  
  vector<int> button(n);
  
  for (int i = 0; i < n; i++) {
    cin >> button.at(i);
  }
  
  int x = 1,num = 0;
  
  for (int i = 0; i < n; i++) {
    x = button.at(x - 1);
    num++;
    if (x == 2) {
      cout << num << endl;
      break;
    }
    else if (num == n - 1) {
      cout << -1 << endl;
    }
  }
}

Measured memory_bytes: 3788
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<set>
#include<map>
//#include<bits/stdc++.h>
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
int pt[123456], n, m, k, a, b, s[123456];
void f() {
	for1(i, n)pt[i] = i;
	return;
}
int root(int i) {
	if (pt[i] == i)return i;
	else return pt[i] = root(pt[i]);
}
void unite(int a, int b) {
	pt[root(b)] = root(a);
	root(b);
	return;
}
vector<int>d[123456];
signed main() {
	cin >> n >> m >> k; f();
	for1(i, m) {
		cin >> a >> b;
		d[a].push_back(b);
		d[b].push_back(a);
		unite(a, b);
	}
	for1(i, k) {
		cin >> a >> b;
		d[a].push_back(b);
		d[b].push_back(a);
	}
	for1(i, n) { root(i); s[pt[i]]++; }
	for1(i, n) {
		if (i > 1)cout << ' ';
		int ans = s[pt[i]] - 1;
		for (int t : d[i])if (pt[i] == pt[t])ans--;
		cout << ans;
	}cout << endl;
}

Measured memory_bytes: 9080
#include<stdio.h>
int main(){
	int a,b,H,W;
	
	while(1){
		scanf("%d%d",&H,&W);
		if(H==0&&W==0){
			break;
		}
		
		for(a=0;a<H;a++){
				for(b=0;b<W;b++){
					if(a%2==0&&b%2==0||(a+b)%2==0){
							printf("#");
							}
					else{
						printf(".");
					}
		}
		printf("\n");
		}
		printf("\n");
	}
	return 0;
}

				

Measured memory_bytes: 572
#include <iostream>

using namespace std;
int main(void){
    int N,D;

    cin >> N >> D;
    
    int count = 1;

    while(1){
        if((D*2+1)*count >= N){
            break;
        }
        count += 1;
    }

    cout << count << endl;
    
    return 0;
}

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

int main(){
    long long a;
    long double b; cin>>a>>b;
    cout<<(long long)(a*b)<<endl;
}


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


vector<int> Prime_Factorize(int n){
	  vector<int> ans;
	   for(int i=2; i*i<=n; i++){
			while(n%i == 0){
				  ans.push_back(i);
				  n /= i;
			}
	  }
	  if(n!=1) ans.push_back(n);
	  return ans;
}


int main(){
	  int n;  cin >> n;
	  cout << n << ":";
	  vector<int> ans = Prime_Factorize(n);
	  for(auto x : ans) cout << " " << x;
	  cout << endl;
}

Measured memory_bytes: 3132
#include<stdio.h>

int main(void){
    int n, m;
    long long int dp[100001];
    scanf("%d%d",&n,&m);
    int a[100001];
    for(int i=0;i<m;i++){
        scanf("%d",&a[i]);
    }
    int k=0;
    for(int i=0;i<n+1;i++){
        if(i==0){dp[i]=1;}
        else if(i==a[k]){dp[i]=0;k++;}
        else if(i==1){dp[i]=1;}
        else{
            dp[i] = dp[i-1] + dp[i-2];
            dp[i] = dp[i]%1000000007;
        }     
    }
    printf("%lld\n",dp[n]);
    return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define bolt ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define text_wali_bakchodi freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define F first
#define S second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
typedef long long ll;
typedef long double ld;
const ll mod = 1e9+7 ;
const ld pi=3.1415926535897932384626433;
const ll inf = 1e18;
bool isprime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x%mod;while(y>0){if(y&1)res=((res%mod)*(x%mod))%mod;y=y>>1;x=((x%mod)*(x%mod))%mod;}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll sol=a>b?a:b;return sol;}
ll min(ll a,ll b){ll sol=a<b?a:b;return sol;}


int main ()
{
   bolt;
   ll n,k;
   cin>>k;
   set <ll> s;
   for (ll i=1;i<=9;i++)
   {
      s.insert (i);
   }
   for (auto x: s)
   {
      //cout<<x<<" ";
      ll g=x%10;
      if (g==0)
      {
          s.insert (x*10);
          s.insert (x*10+1);
      }
      else if (g==9)
      {
         s.insert (x*10+8);
         s.insert(x*10 + 9);

      }
      else{
      s.insert (x*10+g-1);
      s.insert (x*10+g);
      s.insert (x*10 +g+1);}
      if (s.size()>=k)
         break;
   }
   auto it=s.begin();
   for (ll i=0;i<k;i++)
   {
      it++;
   }
   it--;
   cout<<*it;
}


Measured memory_bytes: 4992