akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args)  {
		Scanner sc = new Scanner(System.in);

		int a[] = new int[3];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();

		Arrays.sort(a);

		System.out.println(a[2] + a[1] == a[0] || a[2] == a[1] + a[0] ? "Yes" : "No");
	}
}

Measured memory_bytes: 21844
i=input().split( )
W = int(i[0])
H = int(i[1])
x = int(i[2])
y = int(i[3])
r = int(i[4])
if((W>= (x+r)) and (H>=(y+r)) and ((x-r) >= 0) and ((y-r) >= 0)):
    ret='Yes' 
else:
    ret='No'
print(ret)

Measured memory_bytes: 7692
#include<bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
class UnionFind {
    public:
        //親の番号を格納する。親だった場合は-(その集合のサイズ)
         vector<int> Parent;

        //作るときはParentの値を全て−1にする
        //こうすると全てバラバラになる
        UnionFind(int N){
            Parent = vector<int>(N, -1);
        }

        //Aがどのグループに属しているか調べる
        int root(int A) {
            if(Parent[A] < 0) return A;
            return Parent[A] = root(Parent[A]);
        }

        //自分のいるグループの頂点数を調べる
        int size(int A){
            return -Parent[root(A)];//親をとってきたい
        }

        //AとBをくっつける
        bool connect(int A, int B){
            //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
            A=root(A);
            B=root(B);
            if(A==B){
                return false;
            }

            if(size(A) < size(B)) swap(A,B);

            Parent[A] += Parent[B];
            Parent[B]=A;
            return true;
        }
};
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(m),b(m);
    rp(i,m){
        cin >> a.at(i) >> b.at(i);
        a.at(i)--;
        b.at(i)--;
    }
    UnionFind uni(n);
    vector<ll> ans(m,0ll); 
    ans.at(m-1)=(ll) n*(n-1)/2;
    for(int i=m-1; i>=1; i--){
        ans[i-1]=ans[i];
        int as=uni.size(a[i]),bs=uni.size(b[i]);
        if(uni.connect(a[i],b[i])){
            //cout << "here" << endl;
            ans[i-1] -= (ll)as*bs;
        }
    }
    rp(i,m) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <limits.h>
#include <vector>
using namespace std;
int main(int argc, char const *argv[])
{
    int n;
    vector<int> ary;
    cin >> n;
    for(int i=0; i<n; i++){
        int x;
        cin >> x;
        ary.push_back(x);
    }
    int amax = INT_MIN;
    int mi = ary[0];
    for(int i=1; i<n; i++){
        amax = max(amax, ary[i]-mi);
        mi = min(mi, ary[i]);
    }
    cout << amax << endl; 
    return 0;
}



Measured memory_bytes: 3944
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();

        int[][] dp = new int[s.length+1][t.length+1];

        for (int i=1; i<=s.length; i++) {
            for (int j=1; j<=t.length; j++) {
                if (s[i-1] == t[j-1]) {
                    dp[i][j] = dp[i-1][j-1] + 1;
                } else {
                    dp[i][j] = Math.max(dp[i][j-1], dp[i-1][j]);
                }
            }
        }

        StringBuilder sb = new StringBuilder();

        int i = s.length - 1, j = t.length - 1;

        while (0 <= i && 0 <= j) {
            if (s[i] == t[j]) {
                sb.append(s[i]);
                i--;
                j--;
            } else {
                if (dp[i+1][j] < dp[i][j+1]) {
                    i--;
                } else {
                    j--;
                }
            }
        }

        System.out.println(sb.reverse().toString());

//        for (int i=0; i<=s.length; i++) {
//            for (int j=0; j<t.length; j++) {
//                System.out.print(dp[i][j] + " ");
//            }
//            System.out.println(dp[i][t.length]);
//        }



    }
}



Measured memory_bytes: 80724
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;


void main() {
    int N;
    long L;
    scan(N, L);

    auto s = new string[](N);
    iota(N).each!(i => s[i] = readln.chomp);

    auto ssum = s.map!(si => si.length.to!int).sum();

    auto nex = new int[][](ssum * 2, 2);
    fillAll(nex, -1);
    int m = 1;

    foreach (i ; 0 .. N) {
        int k = s[i].length.to!int;
        int v = 0;
        foreach (j ; 0 .. k) {
            int c = s[i][j] - '0';
            if (nex[v][c] == -1) {
                nex[v][c] = m++;
            }
            v = nex[v][c];
        }
    }

    debug {
        writeln(nex);
    }

    int nim;

    void dfs(int v, int dep) {
        if (nex[v][0] == -1 && nex[v][1] == -1) {
            return;
        }
        else if (nex[v][0] == -1 || nex[v][1] == -1) {
            long h = L - dep;
            int m = 1;

            while (!(h & 1)) {
                h >>= 1;
                m++;
            }

            nim ^= m;

            if (nex[v][0] == -1) {
                dfs(nex[v][1], dep + 1);
            }
            else {
                dfs(nex[v][0], dep + 1);
            }
        }
        else {
            dfs(nex[v][0], dep + 1);
            dfs(nex[v][1], dep + 1);
        }
    }

    dfs(0, 0);

    writeln(nim ? "Alice" : "Bob");
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


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

using namespace std;

int main()
{
    int n;
    vector<int> d;
    cin >> n; 
    d.resize(n);
    for (auto &x:d) {
        cin >> x;
    }

    if (n % 2 == 1) {
        cout << '0' << endl;
    } else {
        sort(d.begin(), d.end());
        cout << d[n/2] - d[n/2 - 1] << endl;
    }
}

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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

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

const int N = 2e5 + 5;

bool M[N];
int F[N], I[N], C[N], W[N];
vector<int> V[N], G[N];
map<int, int> CNT;

int Power(int a, int b) {
	int res = 1;
	for (; b; b >>= 1, a = 1LL * a * a % MOD) if (b & 1) res = 1LL * res * a % MOD;
	return res;
}
bool CMP(int i, int j) { return W[i] < W[j]; }
int DFS(int v) {
	M[v] = true;
	CNT[C[v]]++;
	int sz = 1;
	for (int u : G[v]) if (!M[u]) sz += DFS(u);
	return sz;
}

int main() {

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

	F[0] = 1;
	for (int i = 1; i < N; i++) F[i] = 1LL * F[i - 1] * i % MOD;
	I[N - 1] = Power(F[N - 1], MOD - 2);
	for (int i = N - 2; i >= 0; i--) I[i] = 1LL * I[i + 1] * (i + 1) % MOD;

	int n, x, y; cin >> n >> x >> y;
	vector<int> m;
	for (int i = 1; i <= n; i++) cin >> C[i] >> W[i], V[C[i]].push_back(i);
	for (int i = 1; i <= n; i++) if (!V[i].empty()) {
		sort(all(V[i]), CMP);
		m.push_back(V[i][0]);
		for (int j = 1; j < sz(V[i]); j++) if (W[V[i][0]] + W[V[i][j]] <= x) 
			G[V[i][0]].push_back(V[i][j]), G[V[i][j]].push_back(V[i][0]);
	}
	sort(all(m), CMP);
	if (sz(m) > 1) {
		int a = m[0], b = m[1];
		if (W[a] + W[b] <= y) G[a].push_back(b), G[b].push_back(a);
		for (int i = 1; i <= n; i++) {
			if (C[i] != C[a] && W[a] + W[i] <= y) G[a].push_back(i), G[i].push_back(a);
			if (C[i] != C[b] && W[b] + W[i] <= y) G[b].push_back(i), G[i].push_back(b);
		}
	}
	int ans = 1;
	for (int i = 1; i <= n; i++) if (!M[i]) {
		CNT.clear();
		int sz = DFS(i);
		ans = 1LL * ans * F[sz] % MOD;
		for (auto c : CNT) ans = 1LL * ans * I[c.second] % MOD;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 30068
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int sc() {
		int a=scan.nextInt();
		return a;
	}
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int a=sc();
		int cnt=0;
		for(int i=1;i<=a;i++) {
			String str=String.valueOf(i);
			if(str.length()%2==1)cnt++;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 27476
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

ll a,b;
ll ans=0;

signed main(){
    cin>>a>>b;

    ll t=(b-a+1);
    int x=0,y=0;
    if(a%2==1)x=1;
    if(b%2==1)y=1;
    
    if(t<=2){
        for(ll i=a;i<=b;i++)ans^=i;

    }else{
        if(x && y){
            ans^=a;
            if((t-1)/2 %2==1)ans^=1;
        }else if(x==0 && y){
            ans^=0;
            if((t)/2 %2==1)ans^=1;

        }else if(x && y==0){
            ans^=a;
            if((t-2)/2 %2==1)ans^=1;
            ans^=b;
        }else if(x==0 && y==0){
            ans^=b;
            if((t-1)/2 %2==1)ans^=1;
        }

    }

    

    
    cout<<ans<<endl;




}

Measured memory_bytes: 256
S = input()

if S == 'SUN' : print(7)
if S == 'MON' : print(6)
if S == 'TUE' : print(5)
if S == 'WED' : print(4)
if S == 'THU' : print(3)
if S == 'FRI' : print(2)
if S == 'SAT' : print(1)



Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

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

int main(){
    int  a, b, c;
    int k;
    cin >> a >> b >> c;
    cin >> k;
    string ans = "No";
    rep(i, k+1){
        if(a<b){
            if(b<c){
                ans = "Yes";
                break;
            }else{
                c *= 2;
            }
        }else{
            b *= 2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<String> list = new ArrayList<String>();
        while(true) {
            String line = sc.nextLine();
            if(line.equals("0")) {
                break;
            }
            list.add(line);
        }
        
        for(int i = 0; i < list.size(); i++) {
            int sum = 0;
            for(int j = 0; j < list.get(i).length(); j++) {
                String str = String.valueOf(list.get(i).charAt(j));
                sum += Integer.parseInt(str);
            }
            System.out.println(sum);
        }
    }
 }


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


int main() {
    int c[3][3];
    int b1,b2,b3;
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++) cin >> c[i][j];
    for(int i=0;i<=100;i++){
        b1 = c[0][0]-i;
        b2 = c[0][1]-i;
        b3 = c[0][2]-i;
        if(b1<0 || b2<0 || b3<0) break;
        if(c[1][0]-b1 == c[1][1]-b2 && c[1][1]-b2 == c[1][2]-b3) {
            if(c[2][0]-b1 == c[2][1]-b2 && c[2][1]-b2 == c[2][2]-b3){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

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

using namespace std;

int main(void) {
  int n;
  while (cin >> n, n) {
    int m;
    string s;
    cin >> m >> s;

    int l = 0, r = 0;
    int ans = 0;
    while (l < m) {
      while (s[l] == 'O') l++, r++;
      while (s[r + 1] == 'O' && s[r + 2] == 'I') {
        r += 2;
      }
      ans += max(0, (r - l) / 2 - n + 1);
      l = ++r;
    }

    cout << ans << endl;
  }

  return 0;
}


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

#define ll long long
#define pb push_back
#define eb emplace_back
//#define st first
#define sc second

using namespace std;

const ll mod = 1e9 + 7;
const int e = 2*1e5 + 69;
const int base = 311;

// dung inverse module de tinh nCk
// beginer 79
// mbeginer
// cach tao hoan vi tu n so : n*(n+1)/2;

//vector<pair<ll,ll>>adj[e];
//vector<ll>adj[e];

/*ll Pow(ll n, ll dem)
{
    if(dem == 0) return 1;
    if(dem == 1) return n ;
    ll t = Pow(n, dem/2);
    if(dem % 2 == 0) return (t*t);
    else return ((t * t) * n);
}*/

/*ll C(ll k, ll n)
{
    if(k == 0) return 1;
    if(n < k) return 0;
    return (gt[n]%mod * (igt[k]%mod * igt[n-k]%mod)%mod)%mod;
}*/

ll n, m, k;
ll h[e];
string s;
bool chk = false;

void dq(ll i)
{
    if(i >= 4)
    {
        ll cur = s[1] - '0';
        for(int j=1; j<=3; j++)
        {
            if(h[j] == 1)
            {
                cur += s[j+1] - '0';
            }
            else
            {
                cur -= (s[j+1] - '0');
            }
        }
        if(cur == 7)
        {
            chk = true;
            cout << s[1];
            for(int j=1; j<=3; j++)
            {
                if(h[j] == 1) cout <<"+";
                else cout <<"-";
                cout << s[j+1];
            }
            cout <<"=7";
            return ;
        }
        //cout <<"\n";
    }
    else
    {
        for(int j=0; j<=1; j++)
        {
            h[i] = j;
            if(chk == true) return ;
            dq(i+1);
        }
    }
    if(chk == true) return ;

}

int main()
{
    cin >> s;
    n = s.size();
    s = ' ' + s;
    dq(1);
}
/*

*/


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#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
#include <cmath>
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

int get_digits(int num) {
    int ans = 0;
    while(num) {
        num /= 10;
        ans++;
    }
    return ans;
}

#define INF 100
int main(void) {
    int64_t num;
    cin >> num;
    int num_2 = sqrt(0.5 + num);
    for(int val = num_2; val >= 1; val--) {
        if(num%val) continue;
        int val2 = num/val;
        cout << max(get_digits(val), get_digits(val2)) << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#define MAX 100000

int partition(int *A,int p,int r){
  int x,i,j,tmp;
  x = A[r];
  i = p-1;
  for(j=p;j<r;j++){
    if(A[j] <= x){
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;
  return i+1;
}


int main(){
  int i,n,A[MAX],q;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);
  q = partition(A,0,n-1);
  for(i=0;i<n;i++){
    if(i)printf(" ");
    if(i==q)printf("[");
    printf("%d",A[i]);
    if(i==q)printf("]");
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 2132
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int h,w;
	cin>>w>>h;
	int n,x;
	cin>>n;
	int r=0,c=0;
	int a[105][105];
	bool right=true;
	for(int i=1;i<=n;i++){
		cin>>x;
		while(x){
			a[r][c]=i;
			if(right){
				c++;
				if(c==h){
					c--;
					r++;
					right=false;
				}
			}else{
				c--;
				if(c==-1){
					c++;
					r++;
					right=true;
				}
			}
			x--;
		}
	}
	for(int i=0;i<w;i++){
		for(int j=0;j<h;j++){
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
vector<int> adj[100007];
int vis[100007];
vector<int> v;
int arr[100007];
int n,m;
void dfs(int s)
{
	vis[s]=1;
	for(auto x:adj[s])
	{
		if(!vis[x])
			dfs(x);
	}
	v.push_back(s);
}
int dp[100007];
int f(int i)
{
	if(i==n)
		return 0;
	
	if(dp[i]!=-1)
		return dp[i];
	
	int a=0;
	
	for(auto x:adj[v[i]])
	{
		a=max(a,1+f(arr[x]));	
		//cout<<i<<" "<<v[i]<<" "<<x<<"\n";
	}
	return dp[i]=a;
}
int main()
{
	cin>>n>>m;
	memset(dp,-1,sizeof(dp));
	int i;
	for(i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		adj[a].push_back(b);
	}
	for(i=1;i<=n;i++)
	{
		if(!vis[i])
			dfs(i);
	}
	reverse(v.begin(),v.end());
	for(i=0;i<n;i++)
		arr[v[i]]=i;
	int ans=0;
	for(i=0;i<n;i++)
	{
		ans=max(ans,f(i));
	}
	cout<<ans;
	return 0;
	
}

Measured memory_bytes: 12152
#include <iostream>

int main()
{
	char S[3];
	std::cin >> S[0] >> S[1] >> S[2];

	if (S[1] == 'B')
	{
		std::cout << "ARC\n";
	}
	else if (S[1] == 'R')
	{
		std::cout << "ABC\n";
	}

	return 0;
}

Measured memory_bytes: 3624
n = gets.to_i
rs = []
(0..n-1).each do |i|
  a = gets.chomp.split.map(&:to_s)
  rs << [a[0],a[1].to_i,i+1]
end
rs = rs.sort_by{|a,b,c|b}.reverse.sort_by(&:first)
rs.each do |r|
  puts r[2]
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
void init_fact(){
	kaijo[0]=1;
	for(int i=1;i<=2000000;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(!kaijo[0])init_fact();
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
	x=modpow(x,MOD-2);
	return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
	return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int n,ans[100010],ansk;
vector<P>v[100010];
bool used[100010];
void dfs(int x,int co){
	used[x]=true;
	int now=1;
	for(P to:v[x]){
		if(now==co)now++;
		if(!used[to.fi]){
			ans[to.se]=now;
			dfs(to.fi,now);
			now++;
		}
	}
}
signed main(){
	cin>>n;
	rep(i,n-1){
		int a,b;
		cin>>a>>b;
		a--,b--;
		v[a].pb({b,i});
		v[b].pb({a,i});
	}
	rep(i,n)ansk=max(ansk,(int)v[i].size());
	dfs(0,-1);
	cout<<ansk<<endl;
	rep(i,n-1)cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 10112
#include <iostream>
#include <queue>

using namespace std;

int main(void){
  int N, M;
  cin >> N >> M;
  int i;
  int tmp;
  priority_queue<int> q;
  
  //入力．優先度付きキューに入れていく
  for(i=0; i<N; i++){
    cin >> tmp;
    q.push(tmp);
  }

  //先頭(最大値)を取得(=tmp)した後に削除する
  //tmpを半額にしてキューに追加
  for(i=0; i<M; i++){
    tmp = q.top();
    q.pop();
    q.push(tmp/2);
  }

  //キューの値を順に足していく
  long int sum = 0;
  while(q.empty() == 0){
    sum += q.top();
    q.pop();
    //cout << "sum = "<<sum<< endl;
  }

  cout << sum << endl;
  
  return 0;
}


Measured memory_bytes: 892
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <map>
# include <stack>
using namespace std;
# define M_PI 3.141592
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 
long long count_div(long long a, long long b, long long x)
{
    return b / x - a / x;
}
long long calc_len(long long a)
{
    long long ans = 0;
    long long i,l;
    for (i = 1, l = 10; ; i++, l *= 10)
    {
        if (a >= l)
        {
            ans += i*(l - l / 10);
            long long x3 = count_div(l / 10 - 1, l - 1, 3);
            long long x5 = count_div(l / 10 - 1, l - 1, 5);
            long long x15 = count_div(l / 10 - 1, l - 1, 15);
            ans -= (x3 + x5 - x15)*i;
            ans += (x3 + x5) * 4;
        }
        else
        {
            ans += i*(a - l / 10 + 1);
            long long x3 = count_div(l / 10 - 1, a, 3);
            long long x5 = count_div(l / 10 - 1, a, 5);
            long long x15 = count_div(l / 10 - 1, a, 15);
            ans -= (x3 + x5 - x15)*i;
            ans += (x3 + x5) * 4;
            break;
        }
    }
    if(a%15==0)
    {
        ans-=8;
    }
    else if(a%3==0||a%5==0)
    {
        ans-=4;
    }
    else
    {
        ans-=i;
    }
    return ans;
}
string fizzbuzz(long long x)
{
    stringstream ss;
    for (long long i = x; i < x + 20; i++)
    {
        if (i == 0)ss << 0;
        else if (i % 15==0)
        {
            ss << "FizzBuzz";
        }
        else if (i % 5 == 0)
        {
            ss << "Buzz";
        }
        else if (i % 3 == 0)
        {
            ss << "Fizz";
        }
        else
        {
            ss << i;
        }
    }
    return ss.str();
}
 
string solve(long long s)
{
    long long l, r, m;
    l = 0; r = 1000000000000000000;
  
    while (l < r)
    {
        m = (l + r) / 2;
        long long len = calc_len(m);
        if (len < s)
            l = m+1;
        else
            r = m;
    }
    l=max(l-1,(long long )1);
    long long dif = s - calc_len(l);
    /*puts("");
    cout<<s<<endl;
    debug(dif);
    debug(l);*/
    return fizzbuzz(l).substr(dif-1,20);
}
  
int main()
{
    long long s;
    cin>>s;
    cout<<solve(s)<<endl;
}

Measured memory_bytes: 1216
#include <iostream>
#include <vector> 
#include <cmath>
#include <climits>
using namespace std;
int sqaure(int n) {
	return n * n;
}

int min(int a, int b) {
	return (a > b ? b : a);
}
int main()
{
    int n;
    cin >> n;
    vector<int> dp(n);
    int answer = INT_MAX;
    for(int i = 0; i < n; i++) cin >> dp[i];
    long long total = 0;
    int counter = 0;
    bool done = false;
    
    while(counter < 100) {
    	total = 0;
    	for(int j = 0; j < n; j++) {
    	total  += sqaure(dp[j] - counter);
    	}
         counter++;
    	answer = min(answer, total);
    	
    	
    }
    cout << answer <<  "\n";
   
	return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]
f=0
for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            for l in range(m):
                if a[i+k][j+l]!=b[k][l]:
                    break
            else:continue
            break
        else:
            f=1
            break
    if f==1:break
print("Yes" if f else "No")

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define OUT(x)                cout << #x << " = " << x << endl; 
#define rep(i, n)             for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r)          for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r)          for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define each(i, v)            for (auto i : v)
#define all(x)                (x).begin(), (x).end()
#define rall(x)               (x).rbegin(), (x).rend()
#define pb(x)                 push_back(x)
#define bp(x)                 __builtin_popcount(x)
#define mp(x, y)              make_pair((x), (y))
#define fi                    first
#define se                    second
#define setp(x)               setprecision(x)
#define mset(m, v)            memset(m, v, sizeof(m))
static const int INF        = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int MOD        = 1000000007;
static const double PI      = 3.14159265358979;

#define int                   long long

typedef vector<double>        vd;
typedef vector<string>        vs;
typedef vector<bool>          vb;
typedef vector<int>           vi;
typedef pair<int, int>        pii;
typedef vector<pii>           vpii;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; i ++) cout << *i << " "; cout << endl; }
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }
int in() { int _x; cin >> _x; return _x; }

int g[1010][1010];

struct state { int x, score; };
      
signed main() { 
        int n, m;
        cin >> n >> m;
        rep(i, n) rep(j, n) g[i][j] = 0;
        rep(i, m) {
                int a, b, c;
                cin >> a >> b >> c;
                a --;
                b --;
                g[a][b] = c;
        }
        vi used(1010, -INFL);
        queue<state> q;
        q.push({0, 0});
        int cnt = 0;
        int prev;
        int f = 0;
        while (true) {
                state p;
                bool ff = false;
                if (!q.empty()) {
                        p = q.front(); q.pop();
                        ff = true;
                }
                cnt ++;
                if (ff) {
                        rep(i, n) {
                                if (g[p.x][i] != 0 && used[i] < p.score + g[p.x][i]) {
                                        used[i] = p.score + g[p.x][i];
                                        q.push({i, p.score + g[p.x][i]});
                                }
                        }
                }
                if (q.empty() && p.x == n - 1) break;
                if (cnt > 3000 && cnt < 5000) prev = used[n - 1];
                if (cnt > 7000) {
                        if (prev == used[n - 1]) f = 1;
                        else f = 2;
                        break;
                }
        }
        if (f == 0 || f == 1) cout << used[n - 1] << endl;
        else cout << "inf" << endl;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  double w, h, x, y;
  cin >> w >> h >> x >> y;
  printf("%.15lf ", w * h / 2.0);
  if (x * 2 == w && y * 2 == h)
    cout << "1" << endl;
  else
    cout << "0" << endl;
}


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

#define ll long long int
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define sz(a) int((a).size())
#define mod 1000000007
#define inf LLONG_MAX
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
template <typename T>
inline T gcd(T a, T b) { while (b != 0) swap(b, a %= b); return a; }

template <typename T>
inline void seethis(vector<T>vect)
{
    for(T x:vect)
        cout<<x<<" ";
    cout<<"\n";
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
//LCM
int lcm(int a, int b) {  return a * (b / gcd(a, b)); }

//For sort by second
bool cmp(const pair<int,int> &a)
{ return a.first<a.second; }

//Tree
/* const int MAXN = 1e5 + 5;
vector<ll> adj[MAXN];*/

//ModPower
ll modpower(ll a,ll b,ll c)
{
    ll res=1;
    while(b)
    {
        if(b&1LL)
            res=(res*a)%c;
        a=(a*a)%c;
        b>>=1;
    }
    return res;
}

int main()
{
    FASTIO;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   ll n,m;
    cin>>n>>m;

    // the number of wa i got before getting ac.
    unordered_map<int,int>mp;

    //Number of problems on which i got ac.
    unordered_set<ll>se;
    ll pen=0;

    for(int i=0;i<m;i++)
    {
        int x;
        string s;
        cin>>x>>s;


        if(s=="AC" and se.find(x)==se.end())
        {
            pen+=mp[x];
            mp[x]=0;
            se.insert(x);
        }
        else
        {
            mp[x]++;
        }




    }

    ll ca=se.size();

    cout<<ca<<" "<<pen<<"\n";

    
    return 0;
}


Measured memory_bytes: 11268
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb;
		
		do {
			sb = new StringBuilder();
			
			String[] strs = br.readLine().split("\\s+");
			int height	= Integer.parseInt(strs[0]);
			int width	= Integer.parseInt(strs[1]);
			
			if (height == 0 && width == 0) break;
			
			for (int i = 0; i < height; i++) {
				for (int j = 0; j < width; j++) {
					if (isOdd(i) && isOdd(j))	sb.append("#");
					if (isOdd(i) && !isOdd(j))	sb.append(".");
					if (!isOdd(i) && isOdd(j))	sb.append(".");
					if (!isOdd(i) && !isOdd(j))	sb.append("#");
				}
				sb.append("\n");
			}
			
			System.out.println(sb);
		} while (true);
	}
	
	public static boolean isOdd(int i) {
		return i % 2 == 0 ? false : true;
	}
}

Measured memory_bytes: 25752
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
       
        while(true){
            int n = sc.nextInt();
            if(n == 0){
                break;
            }else{
                int array[][] = new int[n + 1][n + 1];
                for(int i = 0; i < n; i++){
                    for(int j = 0; j < n; j++){
                        array[i][j] = sc.nextInt();
                        array[i][n] += array[i][j];
                        array[n][j] += array[i][j];
                    }
                    array[n][n] += array[i][n];
                }
                for(int i = 0; i < n + 1; i++){
                    for(int j = 0; j < n + 1; j++){
                        System.out.printf("%5d", array[i][j]);
                    }
                    System.out.println();
                }
            }
            
        }
    }
}



Measured memory_bytes: 31912
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)

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

ll beki(ll a, ll b) {
	ll tmp = 1;
	REP(i, b) tmp *= a;
	return tmp;
}

int s[110] = {}, t[110] = {};
string S, T;

int main() {
	cin >> S >> T;
	REP(i, S.length()) {
		s[S[i] - 'a']++;
		t[T[i] - 'a']++;
	}
	sort(s, s + 110);
	sort(t, t + 110);
	REP(i, 110) {
		if (s[i] != t[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

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

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

typedef pair <int, int> pii; 
typedef long long ll;
typedef long double ld;

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}


ll a[8];


int main()
{
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  int n = 7;
  for (int i = 1; i <= n; i++)  cin >> a[i];

  ll ans = 0;
  ans += a[2];

  if (a[1] && a[4] && a[5] && a[1] % 2 + a[4] % 2 + a[5] % 2 >= 2) {
    a[1]--, a[4]--, a[5]--;
    ans += 3;
  }              
  for (int i = 1; i <= n; i++)
    a[i] -= a[i] % 2;
  ans += a[1] + a[4] + a[5];

  cout << ans;

  return 0;
}






// Coded by Z..



Measured memory_bytes: 256
// c++include
#include <iostream>
// cinclude
#include <stdio.h>
#include<string.h>
#include<math.h>
//c++標準ライブラリ
#include<vector>
#include<string>
//std使用<-namespace
using namespace std;

// define, typedef
#define rpt(i, n) for(i = 0; i < (n); i++)
typedef long long ll;

// main関数
int main(void) {
	int n;
	cin >> n;
	cout << n * n * n;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        sc.close();
        int cnt = 0;
        if (n >= 2) {
            cnt += n * (n-1) / 2;
        }
        if (m >= 2) {
            cnt += m * (m-1) / 2;
        }
        
        System.out.println(cnt);
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<map>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const ll MOD = 1000000007;
 
using namespace std;

int main(){
    int N, M, K;    cin >> N >> M >> K;
    for(int i=0; i<N+1; i++){
        for(int j=0; j<M+1; j++){
            if(i*j + (N-i)*(M-j) == K){
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
}

Measured memory_bytes: 3560
import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()

class SegmentTree(object):
    def __init__(self, A, dot, unit):
        n = 1 << (len(A) - 1).bit_length()
        tree = [unit] * (2 * n)
        for i, v in enumerate(A):
            tree[i + n] = v
        for i in range(n - 1, 0, -1):
            tree[i] = dot(tree[i << 1], tree[i << 1 | 1])
        self._n = n
        self._tree = tree
        self._dot = dot
        self._unit = unit

    def __getitem__(self, i):
        return self._tree[i + self._n]

    def update(self, i, v):
        i += self._n
        self._tree[i] = v
        while i != 1:
            i >>= 1
            self._tree[i] = self._dot(self._tree[i << 1], self._tree[i << 1 | 1])

    def add(self, i, v):
        self.update(i, self[i] + v)

    def sum(self, l, r):
        l += self._n
        r += self._n
        l_val = r_val = self._unit
        while l < r:
            if l & 1:
                l_val = self._dot(l_val, self._tree[l])
                l += 1
            if r & 1:
                r -= 1
                r_val = self._dot(self._tree[r], r_val)
            l >>= 1
            r >>= 1
        return self._dot(l_val, r_val)

def resolve():
    n = int(input())
    trees = [[0] * n for _ in range(26)]
    character = [None] * n

    for i, c in enumerate(input()):
        c = ord(c) - ord('a')
        character[i] = c
        trees[c][i] = 1
    for i in range(26):
        trees[i] = SegmentTree(trees[i], max, 0)

    for _ in range(int(input())):
        q, *A = input().split()
        if q == '1':
            i, c = A
            i = int(i) - 1
            c = ord(c) - ord('a')
            trees[character[i]].update(i, 0)
            character[i] = c
            trees[c].update(i, 1)
        else:
            l, r = map(int, A)
            l -= 1
            print(sum(trees[i].sum(l, r) for i in range(26)))
resolve()

Measured memory_bytes: 330204
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
ll dp[1<<21];
int cnt[1<<21];
int a[22][22];
int main(){
    int n;
    cin >> n;
    rep(i,n){
        rep(j,n){
            cin >> a[i][j];
        }
    }
    dp[0] = 1;
    rep(i,1<<n){
        int t = 0;
        rep(j,n){
            if((i>>j)&1){
                t++;
            }
        }
        cnt[i] = t;
    }
    rep(i,1<<n){
        int s = cnt[i];
        rep(j,n){
            if(((i>>j)&1)==0){
                if(a[s][j]){
                    dp[i|(1<<j)] += dp[i];
                    dp[i|(1<<j)] %= mod; 
                }
            }
        }
        //cerr << dp[i] << endl;
    }
    cout << dp[(1<<n)-1] << endl;
    return 0;
}

Measured memory_bytes: 24832
X = int(input())

if 400 <= X < 600:
  print(8)
elif 600 <= X < 800:
  print(7)
elif 800 <= X < 1000:
  print(6)
elif 1000 <= X < 1200:
  print(5)
elif 1200 <= X < 1400:
  print(4)
elif 1400 <= X < 1600:
  print(3)
elif 1600 <= X < 1800:
  print(2)
else:
  print(1)


Measured memory_bytes: 9216
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "KharYusuf", 1 << 27);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastReader in = new FastReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            BMinorChange solver = new BMinorChange();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class BMinorChange {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            char[] a = s.next().toCharArray(), b = s.next().toCharArray();
            int ans = 0;
            for (int i = 0; i < a.length; i++) if (a[i] != b[i]) ans++;
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 30740
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::string s;
	std::cin >> s;
	int count = 0;
	rep(i,n-2) {
		if(s.substr(i,3)=="ABC") count++;
	}
	print(count);
	return 0;
}


Measured memory_bytes: 256
// ここにQuestionクラスをコピペ
using AtcoderBeginnerContest160.Questions;
using AtcoderBeginnerContest160.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtcoderBeginnerContest160.Questions
{
    public class QuestionB : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            int x = inputStream.ReadInt();
            int coin500 = x / 500;
            int coin5 = (x % 500) / 5;

            yield return coin500 * 1000 + coin5 * 5;
        }
    }
}


namespace AtcoderBeginnerContest160
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionB();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtcoderBeginnerContest160.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtcoderBeginnerContest160.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion


Measured memory_bytes: 13140
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let (n,k) = {
        let t = read_vec::<usize>();
        (t[0],t[1])
    };
    let xn = read_vec::<i64>();
    let mut ans = 1e9 as i64;
    for j in 0..(n-k+1){
        // TLE pattern
        // let target = xn.iter().skip(j).take(k).collect::<Vec<&i64>>();
        // let left = target[0].abs() + (target[k-1]-target[0]).abs();
        // let right = target[k-1].abs() + (target[k-1]-target[0]).abs();
        // let min = std::cmp::min(left,right);
        // ans = std::cmp::min(ans,min);
        let start = xn[j];
        let end = xn[j+k-1];
        let left = start.abs() + (end - start).abs();
        let right = end.abs() + (end - start).abs();
        let min = std::cmp::min(left,right);
        ans = std::cmp::min(ans,min);
    }
    println!("{}",ans);
}

Measured memory_bytes: 8444
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    int m;
    int c;
    cin >> n >> m >> c;
    int a;
    int b[m];
    for (int i=1;i<= m;i++){
        cin >> b[i];
    }
    
    int count = 0;
    for(int i=1;i<=n;i++){
        int sum = 0;
       for (int j=1;j<=m;j++){
        cin >> a;
        sum += a*b[j];
       }
       sum += c;
       if( sum > 0){
           count++;
       }
    }
    
    cout << count;
}

Measured memory_bytes: 256