akhauriyash/Code-Regression huggingface dataset:
H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]

AB = [list(map(lambda x, y: abs(x - y), a, b)) for a, b in zip(A, B)]
dp = [[[0] * 12801 for _ in range(W + 1)] for _ in range(H + 1)]
dp[0][0][0] = 1

for h in range(H):
    for w in range(W):
        ab = AB[h][w]
        for i in range(10000):
            if dp[h][w][i] == 1:
                dp[h+1][w][i+ab] = 1
                dp[h+1][w][abs(i-ab)] = 1
                dp[h][w+1][i+ab] = 1
                dp[h][w+1][abs(i-ab)] = 1

for i in range(1000):
    if dp[H][W-1][i] == 1:
        print(i)
        break


Measured memory_bytes: 693128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int H,W,K;
    cin>>H>>W>>K;
    int v[H]{};
    string S[H];
    rep(i,H){
        cin>>S[i];
    }
    rep(i,H){
        rep(j,W){
            if(S[i][j]=='#') v[i]++;
        }
    }
    int ans[H][W]={};
    int cou=0;
    bool z=false;
    rep(i,H){
        if(v[i]==0) {
            if(z){
                rep(j,W){
                    ans[i][j]=ans[i-1][j];
                }
            }
            continue;
        }
        z=true;
        cou++;
        int c=0;
        rep(j,W){
            ans[i][j]=cou;
            if(S[i][j]=='#'){
                c++;
                if(c<v[i]) cou++;
            }
        }
    }
    for(int i=H-1;i>=0;i--){
        if(ans[i][0]==0) {
            rep(j,W){
                ans[i][j]=ans[i+1][j];
            }
        }
    }
    rep(i,H){
        rep(j,W){
            cout << ans[i][j]<<" ";
        }
        cout << endl;
    }


}


Measured memory_bytes: 1536
let id x = x
let n = Scanf.scanf "%d\n" id
 
let array = Array.init n (fun _ -> Scanf.scanf "%d\n" id)
let l = Array.length array
let list' = Array.to_list array
let list = List.sort compare list'
  
let rec pl i =
  if i = l then 0 else
    (List.nth list i) + pl (i+1)

let max = pl 0
      
let rec func i =
  if i = l then 0 else
    if ((List.nth list i) mod 10) <> 0 then max - (List.nth list i) else
      func (i+1)

let ans = if max mod 10 <> 0 then max else func 0

let () =
  Printf.printf "%d\n" ans

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define mod 1000000007
#define mi first
#define ma second
#define N 100000000
#define fo(i,m,n) for(int i=m;i<n;i++)
#define M 7
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
using ll=long long;
using ul=unsigned long long;
using pii=pair<int,int>;
using vvi=vector<vector<int>>;
using vi=vector<int>;
using pll=pair<ll,ll>;
using vsi=vector<set<int>>;
using vll=vector<ll>;

ll power(ll a,ll n){
    ll j=0;
    ll x=1;
    while(1ll<<j<=n){
        if(1ll<<j&n)
            x=(x*a)%mod;

        a=a*a%mod;
        j++;
    }

    return x;
}

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

}

int lb(vi &a,int x){
    int n=a.size();
    int l=0;
    int r=n-1;
    int ind=-1;
    while(l<=r){
        int mid=(l+r)/2;
        if(x>=a[mid]){
            l=mid+1;
            ind=mid;
        }
        else
            r=mid-1;

    }

    return ind+1;

}

int up(vll &a,ll x){
    int n=a.size();
    int l=0;
    int r=n-1;
    int ind=-1;

    while(l<=r){
        int mid=(l+r)/2;
        if(a[mid]>x){
            r=mid-1;
            ind=mid;
        }
        else
            l=mid+1;

    }

    return ind;
}

ll max(ll a,ll b){
    if(a>b)
        return a;
    else
        return b;

}

ll min(ll a, ll b){
    if(a>b)
        return b;
    else
        return a;

}

void yn(bool a){
    if(a)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

}


struct fenwick_tree{
    int n;
    int* bit;
    fenwick_tree(int n){
        this->n=n;
        bit=new int[n+1];
        fill(bit,bit+n+1,0);
    }

    void update(int idx,int x){
        while(idx<=n){
            bit[idx]+=x;
            x+=(x&-x);
        }
    }

    int query(int r){
        int tot;
        while(r){
            tot+=bit[r];
            r-=(r&-r);
        }
        return tot;
    }

};


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

    int l[n];

    fo(i,0,n)
            cin>>l[i];
    sort(l,l+n);

    int cnt=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(l[i]==l[j])
                continue;
            for(int k=j+1;k<n;k++){
                if(l[j]==l[k])
                    continue;
                if(l[i]+l[j]>l[k])
                    cnt++;
                else
                    break;
            }

        }

    }
    cout<<cnt<<endl;

}


Measured memory_bytes: 3632
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    A = readInts()
    # どうせ大きいやつはとられるしな
    A = sorted(A)
    #print(A)
    ans = 0
    #print(len(A)-1,len(A)-n-1)
    for i in range(len(A)-2,len(A)-2*n-1,-2):
        #print(A[i])
        ans += A[i]
    print(ans)
if __name__ == '__main__':
  main()


Measured memory_bytes: 39172
#include <bits/stdc++.h>
#define rep(i,s,n)	for(int i=s;i<n;i++)
#define ii pair<int, int >
#define ll long long int
#define vi vector<int >
#define vll vector<long long int >
#define vvi vector<vector<int > >
#define vvl vector<vector< long long int > >
#define mii map<int , int >
#define umii unordered_map<int, int>
#define mp make_pair
#define pb push_back
using namespace std;

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

    //write your code here
		int k, n;
		cin>> k>> n;
		vll v(n,0), ans(n,0);
		rep(i,0,n)	cin>> v[i];
		ll dist=0;
		ll pox = v[0]+(k-v[n-1]);
		rep(i,0,n-1)	dist+= v[i+1]-v[i];
		ll fin =222222222222222;
		rep(i,0, n){
			ans[i] = dist;
			fin = min(fin,ans[i]);
			dist += pox;
			if(i<=n){
				dist-=v[i+1]-v[i];
				pox = v[i+1]-v[i];
			}
		}
		cout<<fin<<endl;
    return 0;
}


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

using namespace std;

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

    int cnt = 0;
    for (int i=0; i<n-2; i++) {
        if (s.substr(i, 3) == "ABC")
            cnt++;
    }

    cout << cnt << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int i, a, b, c, cnt=0;
  scanf("%d %d %d", &a, &b, &c);
  for (i=a; i<=b; i++){
    if (c%i==0) cnt++;
  }
  printf("%d\n", cnt);
  return 0;
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int n,k,d,sum,temp;
	cin>>n>>k;
	vector<int> ans(n,0);
	while(k--){
		cin>>d;
		for(int i=0;i<d;i++){
			cin>>temp;
			ans[temp-1]++;
		}
	}
	sum=0;
	for(int i=0;i<n;i++){
		if(!ans[i])
		sum++;
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 3632
def count_difference(S):
    last = ''
    cnt = 0
    for s in S:
        if(s==last):
            cnt+=1
            last='0'
        else:
            last=s
    return cnt,last
#%%
S = input()
K = int(input())

cnt_diff = 0
last = ''
cnt_diff, last = count_difference(S)
if(len(S)==S.count(S[0])):
    print(len(S)*K//2)
elif(S[0]==S[-1] and last!='0'):
    cnt_diff2,_ = count_difference(S*2)
    if(cnt_diff2==cnt_diff*2):
        print(cnt_diff*K)
    else:
        print(cnt_diff+(cnt_diff+1)*(K-1))
else:
    print(cnt_diff*K)




Measured memory_bytes: 3064
using System;

namespace ConsoleApp1
{
    class Program
    {

        static void Main(string[] args)
        {
            var s = long.Parse(Console.ReadLine());
            int a = (int)Math.Ceiling(Math.Sqrt(s));
            int b = (int)(((long)a) * a - s);
            Console.WriteLine("0 0 " + a + " 1 " + b + " " + a);
#if DEBUG
            Console.ReadKey();
#endif
        }
    }
}


Measured memory_bytes: 13140
D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
L,M,N = [-1]*27,2,9
def calc(d,n)
  s,x = S[d],0
  t = (0..25).map { C[_1]*(d-L[_1])+s[_1] }
  i = (0..25).max_by(M){t[_1]}.max_by {|i|
    next t[i]  if n == 0 || d+1 >= D
    l,L[i] = L[i],d
    c = t[i] + (calc(d+1,n-1)>>5)
    L[i] = l
    x < c ? x=c : c
  }
  (x<<5) + i
end
D.times { p 1 + i=calc(_1,N)&31; L[i]=_1 }

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

using namespace std;

using ll = long long;
using ld = long double;

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (auto &e : a) cin >> e;

    const int mod = 1e9 + 7;
    vector<vector<int>> dp(n + 1, vector<int>(k + 1));
    for (int i = 0; i <= k; i++) dp[0][i] = 1;

    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= k; j++) {
            dp[i][j] = (dp[i - 1][j] - (j - a[i - 1] - 1 >= 0 ? dp[i - 1][j - a[i - 1] - 1] : 0) + mod) % mod;
            dp[i][j] = (j ? dp[i][j - 1] + dp[i][j] : dp[i][j]) % mod;
        }
    }

    cout << (dp[n][k] - (k ? dp[n][k - 1] : 0) + mod) % mod;
}

int main() {
    cout << fixed << setprecision(20);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}


Measured memory_bytes: 41464
H, W = map(int, input().split())
L = [[0 for w in range(W)] for h in range(H)]
_L = [['' for w in range(W)] for h in range(H)]
for h in range(H):
    tmp = list(input())
    for w in range(W):
        if tmp[w] == "#":
            _L[h][w] = "#"
            if h+1 < H:
                L[h + 1][w] += 1
            if h > 0:
                L[h - 1][w] += 1
            if h+1 < H and w+1 < W:
                L[h + 1][w + 1] += 1
            if h > 0 and w+1 < W:
                L[h - 1][w + 1] += 1
            if w+1 < W:
                L[h][w + 1] += 1
            if h+1 < H and w > 0:
                L[h + 1][w - 1] += 1
            if h > 0 and w > 0:
                L[h - 1][w - 1] += 1
            if w > 0:
                L[h][w - 1] += 1
for h in range(H):
    for w in range(W):
        if _L[h][w] == "":
            _L[h][w] = str(L[h][w])

for h in range(H):
    print("".join(_L[h]))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  string s;
  cin >> s;
  rep(i, s.size()-1) {
    if (s.substr(i, 2) == "AC") {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=55;
vector<int> G[N];
bitset<N> s[N][N];
int pre[N],S,E;
int a[N],b[N];
map<pair<int,int>,int> ma;
void dfs(int u,int fa) {
	if(u==E) {
		int t=E;
		while(pre[t]!=-1) s[S][E]|=(1LL<<ma[{t,pre[t]}]),t=pre[t];
		return;
	}
	for(int i=0;i<G[u].size();i++) {
		int v=G[u][i];
		if(v==fa) continue;
		pre[v]=u;
		dfs(v,u);
	}
}
int main() {
	int n,m;
	scanf("%d",&n);
	for(int i=1,u,v;i<n;i++) {
		scanf("%d%d",&u,&v);
		ma[{v,u}]=ma[{u,v}]=i;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=n;j++) {
			if(i==j) continue;
			S=i,E=j,pre[i]=-1;
			dfs(i,-1);
		}
	}
	scanf("%d",&m);
	for(int i=0;i<m;i++) {
		scanf("%d%d",&a[i],&b[i]);
	}
	ll ans=1LL<<(n-1);
	for(int i=1;i<1<<m;i++) {
		int num=0;
		bitset<N> t(0);
		for(int j=0;j<m;j++) {
			if((1<<j)&i) num++,t|=s[a[j]][b[j]];
		}
		if(num&1) ans-=1LL<<(n-1-t.count());
		else ans+=1LL<<(n-1-t.count());
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		SC sc = new SC(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int K=sc.nextInt();
		int counter=0;
		for(int i=Math.min(A, B); i>=1; i--) {
			if(A%i==0 && B%i==0) {
				counter++;
				if(counter==K) {
					pl(i);
					break;
				}
			}
		}
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(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());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
}

Measured memory_bytes: 21076
from collections import defaultdict

N = int(input())
A = [int(x) for x in input().split()]

mod = 10 ** 9 + 7
c = defaultdict(int)
for a in A:
    if a != 0:
        x = (N - 1 + a) // 2
        y = (N - 1 - a) // 2
        c[(x, y)] += 1

ans = 1
for v in c.values():
    if v == 2:
        ans *= 2
    else:
        ans = 0
        break
    ans %= mod
print(ans)

Measured memory_bytes: 20112
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

int main() {
  int n, m, a;
  while(cin >> n >> m >> a, n+m+a) {
    a--;
    vector<pair<int,int>> v[1000];
    for(int i = 0; i < m; i++) {
      int h, p, q; cin >> h >> p >> q;
      v[h-1].push_back(pair<int,int>(p-1,q-1));
    }
    for(int i = 999; i >= 0; i--) {
      for(int j = 0; j < v[i].size(); j++) {
        if(v[i][j].first == a) a = v[i][j].second;
        else if(v[i][j].second == a) a = v[i][j].first;
      }
    }
    cout << a+1 << endl;
  }
}

Measured memory_bytes: 3024
#include<stdio.h>
#define N 100
#define INFTY 1e9
int main(void)
{
    int n, i, j, k, t, l,  mul;
    int p[N+1],m[N+1][N+1];
    scanf("%d",&n);
    for(i = 1; i <= n; i++)
    {
        scanf("%d %d",&p[i-1],&p[i]);
    }
    for(i = 1; i <= n; i++) m[i][i] = 0;
    for(i = 2; i <= n; i++){
        for(j = 1; j<= n-i+1; j++ )
        {
            t =  i + j -1;
            m[j][t] = INFTY;
            for(k = j; k <= t-1 ;k++)
            {
                mul = m[j][k]+m[k+1][t] + p[j-1]*p[k]*p[t];
                if(mul < m[j][t]) m[j][t] = mul;
            }
            
            
        }
    }
    printf("%d\n",m[1][n]);
    return 0;
}


Measured memory_bytes: 2112
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		double r = scan.nextDouble();
		System.out.println(String.format("%8f", r * r * Math.PI) + " " + String.format("%8f", 2 * r * Math.PI));
	}
}


Measured memory_bytes: 28300
def update(k,x):
  k+=N0-1
  data[k]=x
  while k>=0:
    k=~-k//2
    data[k]=min(data[2*k+1],data[2*k+2])
def query(l,r):
  L,R=l+N0,r+N0
  s=INF
  while L<R:
    if R&1:
      R-=1
      s=min(s,data[R-1])
    if L&1:
      s=min(s,data[L-1])
      L+=1
    L//=2
    R//=2
  return s
n,m,*t=map(int,open(0).read().split())
N0=2**(n).bit_length()
INF=10**18
data=[INF]*2*N0
update(1,0)
for l,r,c in sorted(zip(*[iter(t)]*3)):update(r,min(data[r+N0-1],query(l,r)+c))
print(data[n+N0-1]%INF or-1)

Measured memory_bytes: 37132
#include <bits/stdc++.h>
using namespace std;
#define print(x) cout << (x) << endl;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<pair<long long, long long>> xy(N);
    for (int i = 0; i < N; i++) {
        cin >> xy.at(i).first >> xy.at(i).second;
    }
    sort(xy.begin(), xy.end());
    vector<pair<long long, long long>> distance;
    for (int i = 0; i < N - 1; i++) {
        for (int j = N - 1; j > i; j--) {
            distance.push_back(make_pair(xy.at(j).first - xy.at(i).first, xy.at(j).second - xy.at(i).second));
        }
    }
    sort(distance.begin(), distance.end());
    int answer = 0;
    int count = 0;
    for (int i = 1; i < N*(N-1)/2; i++) {
        if (distance.at(i-1) == distance.at(i)) {
            count++;
        }
        else {
            count = 0;
        }
        answer = max(answer, count);
    }
    if (N == 1) {
        cout << 1 << endl;
    }
    else {
    cout << N - answer - 1 << endl;
    }
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#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 in(x) cin >> x
#define out(str) cout << str << endl

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

int N,T,A,minA,maxben,ans;

int main(){
    cin>>N>>T;
    cin>>minA;
    rep(i,N-1){
        cin>>A;
        if(minA>A) minA=A;
        else{
            if(A-minA>maxben){
                maxben=A-minA;
                ans=1;
            }
            else if(A-minA==maxben) ans++;
        }
    }
    out(ans);
    
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void){
	int n;
	cin >> n;
	vector<string> str(n);
	map<string, int> mp;
	rep(i, 0, n) {
		string s;
		cin >> s;
		mp[s]++;
	}
	int eval = 0;
	for (auto itr = mp.begin();itr != mp.end();++itr) {
		string s = itr->first;
		int num = itr->second;
		if (eval < num) {
			str.clear();
			str.push_back(s);
			eval = num;
		}
		else if (eval == num) {
			str.push_back(s);
		}
	}
	rep(i, 0, str.size())cout << str[i] << endl;
	return 0;
}


Measured memory_bytes: 26752
function main(input) {
    var line = input.split(/\r?\n/g);
    var arr = line[0].split(" ");
    const a = parseInt(arr[0]), b = parseInt(arr[1]);
    var an = "";
    var bn = "";
    for (var i = 0; i < b; i++)
        an += a;
    for (var i = 0; i < a; i++)
        bn += b
    console.log(an < bn ? an : bn)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<long long> vl;
typedef pair<long long, long long> pl;
typedef vector<vector<long long>> matrix;

#define F 						first
#define S 						second
#define PB 						push_back
#define MP 						make_pair
#define all(c) 					c.begin(), c.end()
#define f(i,a,b) 				for(ll i=a; i<b; i++)
#define rep(i,n) 				f(i,0,n)
#define tr(c,i) 				for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) 			(c.find(x) != c.end())	//for set and map
#define cpresent(c,x) 			(find(all(c),x) != c.end())	//for vectors
#define w(t)					ll t; cin>>t; while(t--)
#define epsilon 				1e-9
#define MOD						(ll)1e9

void doublade() {
	ios::sync_with_stdio(false); cin.tie(0); cout.precision(10);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

int main() {
	doublade();
	// w(t) {
		ll a, b;
		cin>>a>>b;
		cout<<a*b<<"\n";
	// }
	return 0;
}

Measured memory_bytes: 3568
#include <stdio.h>

int main(void){
  int a,b,c,t,i;
  t = 0;
  scanf("%d %d %d", &a, &b, &c);
  for (i = a;i<=b;i++){
    if (c % i == 0){
      t++;
    }
  }
  printf("%d\n", t);
  return(0);
}

Measured memory_bytes: 596
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long
#define pb push_back

int main() {
  int N, M;
  cin >> N >> M;
  // 全パターン
  int a = (N+M)*(N+M-1)/2;
  // 奇数のパターン数
  int b = N*M;
  int ans = a- b;
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>
#include <string.h>
#include <bits/stdc++.h>

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define pi pair<int,int>
#define fi first
#define se second

#define FOR(var, to)          for (register s64 var = 0; var < (s64)to; var++)
#define FROMTO(var, from, to) for (register s64 var = from; var <= (s64)to; var++)

#define INIT(var) FOR(i,countof(var)) var[i] = 0
#define INPUT(var) FOR(i,countof(var)) var[i] = ri()

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)

#define MOD 1000000007
#define INF (1 << 30)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

using namespace std;

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

static inline s64 rs64() {
  s64 a;
  scanf("%" SCNd64, &a);
  return a;
}

static inline void wi(int a) {
  printf("%d", a);
}

static inline void wu64(u64 a) {
  printf("%" PRIu64, a);
}

static inline void ws64(s64 a) {
  printf("%" PRId64, a);
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

int main() {
    int n = ri();
    string s;
    FOR(i,n) cin >> s[i];
    
    bool res = false;
    FOR(i,n) if (s[i] == 'Y') res = true;
    
    cout << (res ? "Four" : "Three") << endl;
 return 0;
}


Measured memory_bytes: 256
#
# 3c
#

def main():
    while True:
        x, y = map(int, input().split())
        if x == y == 0:
            break
        elif x > y:
            print(f"{y} {x}")
        else:
            print(f"{x} {y}")


if __name__ == '__main__':
    main()


Measured memory_bytes: 5624
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	Scanner sc = new Scanner(System.in);

	String s;
	int[] map;

	void run() {
		for (;;) {
			s = sc.next();
			if (s.equals(".")) {
				break;
			}
			solve();
		}
	}

	void solve() {
		map = new int[256];
		map['0'] = 0;
		map['1'] = 1;
		map['2'] = 2;
		int ans = 0;

		/*
		map['P'] = 0;
		map['Q'] = 0;
		map['R'] = 1;

		debug(f(0).value);

		if (5 == 5) {
			return;
		}*/

		for (int p = 0; p < 3; p++) {
			for (int q = 0; q < 3; q++) {
				for (int r = 0; r < 3; r++) {
					map['P'] = p;
					map['Q'] = q;
					map['R'] = r;
					Result res = f(0);
					//debug(p, q, r, res.value);
					if (res.value == 2) {
						ans++;
					}
				}
			}
		}
		println(ans + "");
	}

	Result f(int p) {
		// debug("f",p);
		if (Character.isDigit(s.charAt(p))
				|| Character.isUpperCase(s.charAt(p))) {
			return new Result(p + 1, map[s.charAt(p)]);
		} else if (s.charAt(p) == '-') {
			Result r = f(p + 1);
			r.value = 2 - r.value;
			return r;
		} else {
			Result r = f(p + 1);
			Result r2 = f(r.p + 1); // skip '*' or '+'

			// debug("res1",r.p, r.value);
			// debug("res2",r2.p, r2.value);
			// debug(s.charAt(r.p));
			
			if (s.charAt(r.p) == '*') {
				r.value = min(r.value, r2.value);
			} else {
				// '+'
				r.value = max(r.value, r2.value);
			}
			r.p=r2.p+1;
			return r;
		}
	}

	class Result {
		int p, value;

		Result(int p, int value) {
			this.p = p;
			this.value = value;
		}
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s) {
		System.out.print(s);
	}

	void println(String s) {
		System.out.println(s);
	}

	public static void main(String[] args) {
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

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

int main() {
  int n;
  cin >>n;
  for(int i=1 ; i<10 ; i++){
    if(n%i==0&&n/i<10){
      cout <<"Yes" <<endl;
      return 0;
    }
    else{
      continue;
    }
  }
  cout <<"No" <<endl;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		char[] list = sc.next().toCharArray();
		if (list[k - 1]== 'A')
			list[k - 1] ='a';
		if(list[k - 1] == 'B')
			list[k - 1] ='b';
		if(list[k - 1] == 'C')
		list[k - 1] = 'c';
		for(char m: list)
			out.print(m);
		
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define M ((ll)(1e9)+7)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;

void solve()
{
    char c;cin>>c;
    c++;
    cout<<c<<endl;
}

int main()
{
    solve();
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];puts("");}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};//RDLU
#define yes puts("YES")
#define no puts("NO")

int n,m;
string s;
vs t,d;
bool f(int a){
	rep(i,m)if(t[i][0]==s[a]){
		if(d[i][0]=='L')a--;
		else a++;
		if(a<0||a>=n)return false;
	}
	return true;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin>>n>>m>>s;
	t=vs(m),d=vs(m);
	rep(i,m)cin>>t[i]>>d[i];

	int out=0;
	int l=-1,r=n;
	while(r-l>1){
		int h=(l+r)/2;
		if(f(h))r=h;
		else l=h;
	}
	out-=r;
	l=-1,r=n;
	while(r-l>1){
		int h=(l+r)/2;
		if(f(h))l=h;
		else r=h;
	}
	out+=r;
	cout<<max(0ll,out)<<endl;
}


Measured memory_bytes: 22352
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
int main(void)
{
    char a,b;
    cin >> a >> b;
    if(a>b)pr('>');
    else if(a<b)pr('<');
    else if(a==b)pr('=');
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n=0,r=0,z=0,sum=0;
    scanf("%d%d",&n,&r);
    
    if(n>=10){
        printf("%d",r);
    }else{
        z=100*(10-n);
        sum=z+r;
        printf("%d",sum);
    }
    
    return 0;
}


Measured memory_bytes: 256
n =int(input())
l = [list(map(int,input().split())) for i in range(n)]
#print(n,l)

ans = [[0]*3 for i in range(n)]

for i in range(n):
  if i == 0:
    ans[0][0] = l[0][0]
    ans[0][1] = l[0][1]
    ans[0][2] = l[0][2]
  if i > 0:
    for j in range(0,3):
      a = j - 1
      b = j + 1
      if b > 2:
        b = 0
        #print(a,b)
      ans[i][j] = max(ans[i-1][a] + l[i][j], ans[i-1][b] + l[i][j])

#print(ans)
print(max(ans[n-1]))

Measured memory_bytes: 47348
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;

#define int long long

#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define rrep(i, n) for (int i=(int)n-1;i>=0;--i)
#define rrep1(i, n) for (int i=n;i>=1;--i)
#define range(i, l, r) for (int i=l;i<(int)r;++i)
#define rrange(i, l, r) for (int i=(int)r-1;i>=(int)l;--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;
using ld=long double;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}

const int mod = TEN(9)+7;
const int inf = TEN(18) * 3 + 10;

int n, w, s, e;

signed main()
{
	string S; cin >> S;
	rep(i, S.size()) {
		if (S[i] == 'N') n++;
		if (S[i] == 'W') w++;
		if (S[i] == 'S') s++;
		if (S[i] == 'E') e++;
	}

	if (((e > 0 and w > 0) or (e == 0 and w == 0)) and ((s > 0 and n > 0) or (s == 0 and n == 0))) cout << "Yes\n";
	else cout << "No\n";
}



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

int main(){
    int N, L;
    cin >> N >> L;
    vector<string> S(N);
    for (int i=0; i<N; ++i) {
        cin >> S[i];
    }

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

    for (int i=0; i<N; i++) {
        cout << S[i];
    }

    return 0;
}

Measured memory_bytes: 256
//In the name of God

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
const int N = 1e5 + 5;

void solve() {
	int n;
	cin >> n;
	puts(n >= 30 ? "Yes" : "No");
}

int main() {
	ios_base::sync_with_stdio(false);	
    cin.tie(NULL);
	int tt = 1;
	// cin >> tt;
	for (int tc = 1; tc <= tt; tc++) {
		// cout << "Case " <<;
		solve();
		// cout << chk(2);
	}
}

Measured memory_bytes: 3652
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	bool ans;
	foreach (i; 1..10)
	{
		foreach (j; 1..10)
		{
			if (i*j == N)
				ans = true;
		}
	}
	
	writeln(ans ? "Yes" : "No");
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const ll LINF = 1LL<<60;

#define int long long

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

    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());

    if (n <= 3) {
        if (n == 1) cout << 0 << endl;
        if (n == 2) cout << a[0] << endl;
        if (n == 3) cout << a[0]+a[1] << endl;
        return 0;
    }

    int ans = 0;
    priority_queue<pair<int, pair<int, int>>> q;

    for (int i = 0; i < 2; i++) ans += a[i];
    q.push({a[1], {a[0], a[1]}});
    q.push({a[2], {a[1], a[2]}});
    q.push({a[2], {a[0], a[2]}});

    for (int i = 3; i < n; i++) {
        pair<int, pair<int, int>> pp = q.top(); q.pop();
        int x = pp.second.first;
        int y = pp.second.second;
        int w = pp.first;

        ans += w;
        q.push({a[i], {x, a[i]}});
        q.push({a[i], {y, a[i]}});
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11088
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=100010;
const ll mod=1e9+7;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; }
    mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { mint res(*this); return res+=a; }
    mint operator-(const mint a) const { mint res(*this); return res-=a; }
    mint operator*(const mint a) const { mint res(*this); return res*=a; }
    mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; }
    // for prime mod
    mint inv() const { return pow(mod-2); }
    mint& operator/=(const mint a) { return (*this) *= a.inv(); }
    mint operator/(const mint a) const { mint res(*this); return res/=a; }
};

vector<ll> inv,fact,invfact;
void mod_build(int n){  
  fact.resize(n+1); inv.resize(n+1); invfact.resize(n+1);
  fact[0]=inv[0]=invfact[0]=1; inv[1]=1;
  rep(i,n){
    fact[i+1]=fact[i]*(i+1)%mod;
    if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
    invfact[i+1]=invfact[i]*inv[i+1]%mod;
  }
}
ll perm(int n,int k){ if(n<0||k<0||k>n){ return 0; } else { return fact[n]*invfact[n-k]%mod; } }
ll comb(int n,int k){ if(n<0||k<0||k>n){ return 0; } else { return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod; }}
ll modpow(ll x,ll n){
  x%=mod; ll res=1;
  while(n>0){ if(n&1){res=res*x%mod;} x=x*x%mod; n>>=1; }
  return res;
}
ll modinv(ll a){ return modpow(a, mod-2); }

int main(){
  mod_build(mx*2);
  int n,k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  }
  if(k==1){ cout << 0 << ln; return 0;}

  sort(a.begin(),a.end());
  mint maxx=0, minx=0;
  rep(i,n){
    minx += a[i]*comb(n-1-i,k-1);
  }
  sort(a.rbegin(),a.rend());
  rep(i,n){
    maxx += a[i]*comb(n-1-i,k-1);
  }
  mint ans = maxx-minx;
  cout << ans.x << ln;
  return 0;
}

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

#define f first
#define s second
#define ins insert
#define eb emplace_back
#define endl '\n'
#define ll long long
#define ld long double
#define vl vector<ll>
#define tc ll t; cin >> t; while (t--)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define sz(c) (ll) c.size()	
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define trav(x,c) for(auto &x : c)
#define _for(i,a,n) for(ll i = a ; i < n ; ++i)
#define _rfor(i,a,n) for(ll i = n-1 ; i >= a ; --i)
#define dx(x) cout << #x << ": " << x << endl;
#define dc(c) trav(x,c) cout << x << " "; cout << endl;
#define dm(m) trav(x,m) cout << x.f << "->" << x.s << endl;
#define godspeed cin.tie(0) -> sync_with_stdio(0);

int main() {
    godspeed;
    ll n, m; cin >> n >> m;
    vl v(n); _for(i,0,n) cin >> v[i];
    sort(rall(v));
    ll sum = accumulate(all(v),0);


    (v[m-1] >= sum/(4.0*m)) ? yes : no;
}

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

typedef long long ll;
const int inf = 1e9;

int n;

int main(){
	cin>>n;
	if(1000 - (n % 1000) == 1000)cout<<0<<endl;
	else cout<<1000 - (n % 1000)<<endl;
	return 0;
}


Measured memory_bytes: 3644
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
 
using ll = long long;
#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)
 
using namespace std;
 
int main(void) {
    int r;
    cin >> r;
 
    float pi = 3.14159265;
 
    float ans = 2 * (float) r * pi;
    // cout << 2 * r * pi << endl;
    printf("%f\n", ans);
    return 0;
}

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

int main(){

    int N; cin >> N;
    int n = -1;
    for(int i = 0; i < 1000000; i++){
        if(N == i * (i - 1) / 2){
            n = i;
            break;
        }
    }
    if(N == 1){
        cout << "Yes" << endl;
        cout << 2 << endl;
        cout << 1 << " " << 1 << endl;
        cout << 1 << " " << 1 << endl;
        
    }else if(n == -1) cout << "No" << endl;
    else{
        vector<vector<int> > G(n, vector<int> (n, -1));
        int num = 1;
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                if(i == j) continue;

                if(G[i][j] == -1){
                    G[i][j] = G[j][i] = num;
                    num++;
                }
            }
        }

        //cout << num << endl;

        cout << "Yes" << endl;
        cout << n << endl;
        for(int i = 0; i < n; i++){
            cout << n - 1 << " ";
            int cnt = 1;
            for(int j = 0; j < n; j++){
                if(i == j) continue;
                if(n - 1 == cnt) cout << G[i][j] << endl;
                else cout << G[i][j] << " ";
                cnt++;
            }
        } 

    }

    return 0;
}

Measured memory_bytes: 2176
# https://atcoder.jp/contests/abc146/tasks/abc146_b

import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    s = input()
    base = ord('A')
    ans = ''
    for c in s:
        code = ord(c) - base
        replaced = chr((code + n) % 26 + base)
        ans += replaced
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 40300
import java.util.*;

class UnionFind {
    int[] roots;
	
	public UnionFind(int N) {
		this.roots = new int[N];
		for(int i = 0; i < N; ++i) this.roots[i] = i;
	}
	
	int getRoot(int x) {
		if(this.roots[x] == x) return x;
		else return this.roots[x] = getRoot(this.roots[x]);
	}
	
	boolean isSameSet(int x, int y) {
		return getRoot(x) == getRoot(y);
	}
	
	void unite(int x, int y) {
	    int rx = getRoot(Math.max(x, y));
	    int ry = getRoot(Math.min(x, y));
	    if(rx == ry) return;
	    roots[rx] = ry;
	}
}

public class Main {
    static Scanner sc = new Scanner(System.in);
    static final int SIZE = 55;
    static int N = 0;
    static int M = 0;
    static int[] a = new int[SIZE];
    static int[] b = new int[SIZE];
    
    public static void main (String[] args) {
        N = sc.nextInt();
        M = sc.nextInt();
        for(int i = 0; i < M; ++i) {
            a[i] = sc.nextInt() - 1;
            b[i] = sc.nextInt() - 1;
        }
        
        int ans = 0;
        for(int i = 0; i < M; ++i) {
            if(isBridge(i)) ++ans;
        }
        System.out.println(ans);
    }
    
    static boolean isBridge(int num) {
        UnionFind uf = new UnionFind(N);
        for(int i = 0; i < M; ++i) {
            if(i != num) uf.unite(a[i], b[i]);
        }
        return isNotConnected(uf);
    }
    
    static boolean isNotConnected(UnionFind uf) {
        for(int i = 0; i < N - 1; ++i) {
            for(int j = i + 1; j < N; ++j) {
                if(!uf.isSameSet(i, j)) return true;
            }
        }
        return false;
    }
}

Measured memory_bytes: 23892
a = input().split()

W = a[0]
H = a[1]
x = a[2]
y = a[3]
r = a[4]

if int(x)+int(r) > int(W) or int(x)-int(r) < 0:
    print("No")
else:
    if int(y)+int(r) > int(H) or int(y)-int(r) < 0:
        print("No")
    else:
        print("Yes")



Measured memory_bytes: 5596
import std.stdio;

immutable mod = 4294967311L;
long[] inv_;

void main(){
	long x;
	int n, y, op;
	scanf("%d", &n);
	inv_ = new long[1_000_001];
	inv_[1] = 1;
	foreach(i; 2..50) inv_[i]=mul(inv_[mod%i], mod-mod/i)%mod;
	foreach(_; 0..n){
		scanf("%d%d", &op, &y);
		if(op >= 3 && y < 0) x = -x, y = -y;
		if(op == 1) x += y;
		else if(op == 2) x -= y;
		else if(op == 3) x *= y;
		else if(op == 4) x = mul(x, inv(y));
		x %= mod;
	}

	if(x < 0) x += mod;
	if(x > int.max) x -= mod;

	writeln(x);
}

long inv(int x){
	return inv_[x] ? inv_[x] : (inv_[x]=mod-(inv(mod%x)*(mod/x))%mod);
}

long mul(long x, long y){
	return ((x*(y>>16)%mod)<<16) + (x*(y&0xffff));
}

Measured memory_bytes: 10748
s = input()
N = len(s)

for length in range(N-1):
  tmp = set([i for i in s])
  for left in range(N-length+1):
    right = left + length
    tmp = set(s[left:right]) & tmp
    #print(left,right)
    #print(tmp)
    #print("--------")
  else:
    #print(length, tmp)
    if len(tmp) > 0:
      print(length-1)
      exit()
print(0)

Measured memory_bytes: 40688
#include <cstring>
#include <cstdio>
const int p[] = {2, 3, 5, 7, 11, 13, 17}, cnt[] = {8, 5, 3, 2, 2, 2, 2}, p_cnt = 7; 
int res[15], x[305], val[305], sum[305], n, ans = -1e9; 
void dfs(int u, int cur = 1)
{
	if (u >= p_cnt)
	{
		memset(sum, 0, sizeof(sum)); 
		for (int i = 0; i < n; i++)
		{
			int a = x[i];
			bool f = true;
			for (int j = 0; j < p_cnt; j++)
			{
				for (int k = res[j]; k; k--)
				{
					if (!(a % p[j]))
						a /= p[j]; 
				}
				if (!(a % p[j]))
					f = false; 
			}
			if (f)
				sum[a] += val[i]; 
		}
		int tot = sum[1]; 
		for (int i = 2; i <= 300; i++)
			tot += sum[i] > 0 ? sum[i] : 0; 
		if (tot > ans)
			ans = tot; 
		return; 
	}
	for (res[u] = 0; res[u] <= cnt[u]; res[u]++)
	{
		dfs(u + 1, cur); 
		cur *= p[u]; 
	}
}
int main()
{
	// freopen("CF17-TR-H.in", "r", stdin); 
	scanf("%d", &n); 
	for (int i = 0; i < n; i++)
		scanf("%d%d", x + i, val + i); 
	dfs(0, 1);
	printf("%d\n", ans);
	return 0; 
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
	int N;
	cin >> N;
	string S;
	cin >> S;
	
	if(N%2==1){
		cout << "No" << endl;
		return 0;
	} 
	
	for(int i=0; i<N/2; i++){
		if(S[i]!=S[N/2+i]){
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	return 0;
}

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


// ??\??? ????????¨???

typedef bool B;
typedef long double D;
typedef complex<D> P;
typedef vector<P> VP;
typedef struct {P s,t;} L;
typedef vector<L> VL;
typedef struct {P c;D r;} C;
typedef vector <C> VC;

const D eps=1.0e-10;
const D pi=acos(-1.0);
template<class T> bool operator==(T a, T b){return abs(a-b)< eps;}
template<class T> bool operator< (T a, T b){return a < b-eps;}
template<class T> bool operator<=(T a, T b){return a < b+eps;}
template<class T> int sig(T r) {return (r==0||r==-0) ? 0 : r > 0 ? 1 : -1;}
#define X real()
#define Y imag()

D ip(P a, P b) {return a.X * b.X + a.Y * b.Y;}
D ep(P a, P b) {return a.X * b.Y - a.Y * b.X;}
D sq(D a) {return sqrt(max(a, (D)0));}
P vec(L l){return l.t-l.s;}


// verify AOJ 2514
P proj(P b,P p){ return b*ip(b,p)/norm(b);}
P proj(L l,P p){ return l.s+proj(vec(l),p-l.s);}
P refl(L l,P p){ return proj(l,p)*D(2.0)-p; }

// ccw
enum CCW{
	FRONT = 1,
	RIGHT = 2,
	BACK = 4,
	LEFT = 8,
	MID = 16,
	ON=FRONT|BACK|MID
};

inline int ccw(P base, P a, P b) {              //???a??¨???b???????????????????????????
	a -= base; b -= base;
	if (ep(a, b) > 0)
		return LEFT;    // counter clockwise
	if (ep(a, b) < 0)
		return RIGHT;   // clockwise
	if (ip(a, b) < 0)
		return BACK;    // b--base--a on line
	if (norm(a) < norm(b))
		return FRONT;   // base--a--b on line
	// otherwise
	return MID;      // base--b--a on line  a??¨b????????????????????????
}

int main(void){
	L line;
	{
		D x[2],y[2];
		rep(i,2)cin >> x[i] >> y[i];
		line={{x[0],y[0]},{x[1],y[1]}};
	}
	int q;
	cin >> q;
	cout.precision(10);
	rep(loop,q){
		D x,y;
		cin >> x >> y;
		P point={x,y};
		P ans=refl(line,point);
		cout << fixed << ans.X << " " << ans.Y << endl;
	}
	return 0;
}

Measured memory_bytes: 1312
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cntwest = 0;
    int cnteast = 0;
    int ans = INT_MAX;
    rep(i, n)
    {
        if (s[i] == 'E')
        {
            cnteast++;
        }
    }
    if (s[0] == 'E')
    {
        cnteast--;
        chmin(ans, cnteast);
    }
    else
    {
        chmin(ans, cnteast);
    }
    for (int i = 1; i < n; i++)
    {
        if (s[i - 1] == 'W')
        {
            cntwest++;
        }
        if (s[i] == 'E')
        {
            cnteast--;
        }
        chmin(ans, cntwest + cnteast);
        //        cout << cntwest + cnteast << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3924
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int gcd(int a,int b)
{
	return b?gcd(b,a%b):a;
}
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	vector<int> vec;
	for (int i=1;i<=n;++i)
	{
		int tmp;
		scanf("%d",&tmp);
		vec.push_back(tmp);
	}
	sort(vec.begin(),vec.end());
	vec.erase(unique(vec.begin(),vec.end()),vec.end());
	if (k>vec.back())
	{
		printf("IMPOSSIBLE");
		return 0;
	}
	if (int(vec.size())==1)
	{
		if (k!=vec[0])
			printf("IM");
		printf("POSSIBLE");
		return 0;
	}
	int g=vec[1]-vec[0];
	for (size_t i=1;i<vec.size()-1;++i)
		g=gcd(g,vec[i+1]-vec[i]);
	if (k%g!=vec[0]%g)
		printf("IM");
	printf("POSSIBLE");
	return 0;
}


Measured memory_bytes: 892
#include <iostream>
using namespace std;
int main(void){
    
    int K;
    int odd, even;
    
    cin >> K;
    
    if(K % 2 == 0){
        
        odd = K / 2;
        even = K / 2;
        
    }else{
        
        odd = (K + 1) / 2;
        even = (K - 1) / 2;
        
    }
    
    cout << odd * even << endl;
    
    return 0;
    
}

Measured memory_bytes: 256